Effacer les filtres
Effacer les filtres

How to generate multinomial configurations using perms, combk, ...?

1 vue (au cours des 30 derniers jours)
Satyajit Ghosh
Satyajit Ghosh le 27 Nov 2018
Trying to write a function to generate all possible configurations of a state. State mean number of data points falling in each bin of histogram. For example, state (1,3,1,0,1,1,1) means first been contain 1 data, and so on. Now, evidently in the above state there are total 8 (=1+3+1+0+1+1+1) events. Let's name all 8 events like this - a,b,c,d,e,f,g,h.
Then possible configurations for the given state are -
(a)(bcd)(e)()(f)(g)(h)
(a)(bcd)(e)()(f)(h)(g)
(a)(bcd)(e)()(g)(f)(h)
.....................
.....................
Want to determine all possible configurations in computationally efficient way. I already wrote a code using a 'combnk' and complicated for loop which turned out to be very slow. Now I am thinking about using 'perms' like this -
>> perms(h,g,f,e,d,c,b,a)
But this will give me 8! configurations. But I rather want , which is nothing but multinomial coefficient. Means configurations like (a)(bcd)(e)()(f)(g)(h) and (a)(cbd)(e)()(f)(g)(h) are not different and we should have mechanism to eliminate those.

Réponses (0)

Catégories

En savoir plus sur Code Generation dans Help Center et File Exchange

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by