On Mon, Apr 6, 2009 at 3:58 PM, Richardson, Anthony <[email protected]> wrote: > Jaroslav Hajek wrote >> On Mon, Apr 6, 2009 at 3:18 PM, Richardson, Anthony >> <[email protected]> wrote: >> > 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. >> >> Well I think something like bsxfun(@bincoeff, p, p') would work. But >> my point was mainly that you can as well use bincoeff (T, T'), gievn >> that bincoeff accepts vector arguments (which is a precondition for >> bsxfun). > > bincoeff(T, T') does not work for me with T a vector (octave 3.0.1). > > error: bincoeff: n and k must be of common size or scalars > > bsxfun(@bincoeff, T, T') does work with T a vector. Does bincoeff > accept vector arguments in newer versions of Octave? > > Tony
Strange; I think T was a square matrix in your code; so T and T' should be of common size. Maybe we didn't speak of the same code. Anyway, bsxfun is not really a top performer now; it even seems to slow things down (but OTOH requires less memory). It doesn't matter; though, the pascal solution is certainly better. -- RNDr. Jaroslav Hajek computing expert & GNU Octave developer Aeronautical Research and Test Institute (VZLU) Prague, Czech Republic url: www.highegg.matfyz.cz ------------------------------------------------------------------------------ _______________________________________________ Octave-dev mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/octave-dev
