필터 지우기
필터 지우기

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

조회 수: 1 (최근 30일)
Satyajit Ghosh
Satyajit Ghosh 2018년 11월 27일
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.

답변 (0개)

카테고리

Help CenterFile Exchange에서 Code Generation에 대해 자세히 알아보기

Community Treasure Hunt

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

Start Hunting!

Translated by