2011/9/18 Jordi Gutiérrez Hermoso <[email protected]>: > 2011/9/17 Juan Pablo Carbajal <[email protected]>: > >> I changed the names of the functions. I added an optional argument >> to multinom_exp to make it compatible with the original version, >> since the order of the exponents was not the same. >> >> I added the new functions here >> https://sourceforge.net/tracker/?func=detail&aid=3410842&group_id=2888&atid=352888 > > I guess you really want this to run in Matlab, which is why you > changed the comment characters to % from #. There are number of > further changes in order to fit this with the more limited Matlab > languagen: > > 1) rows(x) has to be changed to size(x,1) > > 2) foo(x)(:) has to be changed to temp = foo(x); temp(:) > > Additionally, I made a few stylistic changes while keeping Matlab > compatibility (I hope): > > 3) Octave style is to write foo (x) when foo is a function and > foo(x) when foo is an array to visually distinguish function > calls from array indexing. The exception is inside matrices, > since the interpreter reads [foo (x)] as [foo, (x)]. > > 4) There was no need to call ones () in the accumarray call, which > seems like undocumented behaviour. Simply "1" instead was > enough. I'll push a documentation fix for that now. > > 5) A stray "%%s" seems to have happened when you replaced my ## > with %%. > > 6) I find it visually cleaner to use ndims than varargin for the > optional sorting parameter, since then you can easily use an > explicit for the third optional argument. > > 7) I changed [dummy, foo] = bar (...) to [~, foo] = bar (...), > which is syntax that works since Octave 3.4 and is more > explicit about discarding output parameters. > > 8) I added spaces after commas. > > Given that I'm now making stylistic editorial decisions, I think I do > want my name on this thing. Thank you for that. ;-) > > HTH, > - Jordi G. H. >
Thank you very much Jordi, I am learning a lot of Octave culture, this is really good! I was unaware of 3) and I fully agree with 6). I will modify the other functions to follow 6). I share most of my code with colleagues that use Matlab, so I try to keep conflicts as much as I can, but full compatibility is not compulsory as soon as changes needed are minimum. Your name was there already! ;D Thanks again! -- M. Sc. Juan Pablo Carbajal ----- PhD Student University of Zürich http://ailab.ifi.uzh.ch/carbajal/ ------------------------------------------------------------------------------ BlackBerry® 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
