2011/9/16 Jordi Gutiérrez Hermoso <[email protected]>:
> On 15 September 2011 10:08, Juan Pablo Carbajal <[email protected]> wrote:
>> Dear all,
>>
>> I have added to the features tracker a small set of functions that I
>> think they could go into the specfun package.
>>
>> https://sourceforge.net/tracker/?func=detail&aid=3409993&group_id=2888&atid=352888
>>
>
> Below is a much better implementation of multinom_exp, which uses the
> standard stars and bars method for counting monomials, or in this
> case, enumerating them:
>
>    function alpha = multinom_exp(m, n)
>
>      ## This is standard stars and bars.
>      numsymbols = m+n-1;
>      stars = nchoosek(1:numsymbols, n);
>
>      ## Star labels minus their consecutive position becomes their index
>      ## position!
>      idx = bsxfun(@minus, stars, [0:n-1]);
>
>      ## Manipulate indices into the proper shape for accumarray.
>      nr = rows(idx);
>      idx = [repmat([1:nr], n,1)(:), idx'(:)];
>      alpha = accumarray (idx, ones(nr*n, 1));
>
>    endfunction
>
> HTH,
> - Jordi G. H.
>

Hi,

Jordi, amazing! Thank you very much.

1. Is it ok if I keep the name "multinomExp" for the function or is
there a naming convention in octave (I like camelCase)?
2. How shall I do with the copyright notice? I add you to the
copyright? I replace any instance of my name by yours? Do you have
your own copyright text?

Thanks again for the amazing improvement.

-- 
M. Sc. Juan Pablo Carbajal
-----
PhD Student
University of Zürich
http://ailab.ifi.uzh.ch/carbajal/

------------------------------------------------------------------------------
BlackBerry&reg; DevCon Americas, Oct. 18-20, San Francisco, CA
http://p.sf.net/sfu/rim-devcon-copy2
_______________________________________________
Octave-dev mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/octave-dev

Reply via email to