On Mon, Apr 6 at 3:50 AM, Jaroslav Hajek wrote > On Mon, Apr 6, 2009 at 5:12 AM, Tony Richardson > <[email protected]> wrote: > > I've attached three very simple polynomial functions that I'd like > > to contribute to octave-forge. g = polyscale(f,a) is equivalent to > > g(x) = f(x*a). g = polytranslate(f,a) is equivalent to g(x) = > > f(x+a) and g = polytranscale(f, a, b) is equivalent to g(x) = f((x+a)*b). > > > > The functions are fairly simple, but I've found them to be extremely
> > useful. > > > > Tony Richardson > > > > I think these would be useful extensions to Octave's polynomial > manipulation capabilities. > I can assist you with including them, but I have several remarks: > 1. You need to add proper copyright header for GPL3. It's easiest to > copy it from other Octave's sources. > 2. The coding style needs some adjustments to fit Octave's coding > styke. In particular, there should be a space between a function name > and parens, space after commas separating arguments, OK, I'll make the modifications. > 3. I see no need for polytranscale as a simple wrapper. It would make > sense if it used a faster code. No problem. I can omit it. (There should be a polyscaletrans() for completeness anyway.) > 4. I don't understand why you use bsxfun. That would make sense only > if you left T as a vector. I'll have to look into generating the result using T as a vector. I don't see how to do it at first glance. > 5. Maybe you could use "pascal" to form the pascal matrix? In my tests under Octave/Windows Vista: N=100;T = linspace(N-1,0,N)'*ones(1,N); ;bsxfun(@bincoeff,T,T') is about 4 times faster than N=100; pascal(N,1); for N=1000 it is about 10 times faster. This seems very odd. Am I missing something? Tony ------------------------------------------------------------------------------ _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
