[Numpy-discussion] More guestions on Chebyshev class.
Charles R Harris
charlesr.harris@gmail....
Thu Oct 1 01:16:13 CDT 2009
The Chebyshev class is now working pretty well, but I would like to settle
some things up front.
1) Order in which coefficients are stored/passed/accessed.
The current poly1d class ctor is called with the coefficients in high to low
order, yet the __getitem__ and __setitem__ methods access them in reverse
order. This seems confusing and I think both should go in the same order and
my preference would be from low to high. The low to high order also works a
bit better for implementation.
2) poly1d allows the size of the coefficient array to be dynamically
extended. I have mixed feeling about that and would prefer not, but there
are arguments for that: students might find it easier to fool with.
3) The poly1d class prunes leading (high power) zeros. Because the Cheb
class has a fit static method that returns a Cheb object, and because when
fitting with Chebyshev polynomials the user often wants to see *all* of the
coefficients, even if some of the leading ones are zero, the Cheb class does
not automatically prune the zeros, instead there are methods for that.
4) All the attributes of the Cheb class are read/write. The poly1d class
attempts to hide some, but the method used breaks the copy module. Python
really doesn't have private attributes, so I left all the attributes exposed
with the usual Python proviso: if you don't know what it does, don't fool
with it.
5) Is Cheb the proper name for the class?
Thoughts?
Chuck
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.scipy.org/pipermail/numpy-discussion/attachments/20091001/9aaba4a4/attachment.html
More information about the NumPy-Discussion
mailing list