From: Paul F D. <pa...@pf...> - 2003-02-07 21:47:58
|
{ CC to GvR just to show why I'm +1 on the if-PEP. I liked this in = another language I used to use; Perl ? } Perhaps knowlegeable persons could comment on the feasibility of coding = MA (masked arrays) in straight Python and then using Psyco on it? The = existing implementation is in pure python and uses Numeric to represent the two arrays it holds (the data and sometimes a mask) in each object. A great = deal of wasted motion is devoted to preparing Numeric arrays so as to avoid operations on masked elements.=20 It could have been written a lot simpler if performance didn't dictate trying to leverage off Numeric. In straight Python one can imagine an = add, for example, that was roughly: for k in 0<=3D k < len(a.data): result.mask[k] =3D a.mask[k] or b.mask[k] result.data[k] =3D a.data[k] if result.mask[k] else a.data[k] + b.data[k] (using the new if expression PEP just to confuse the populace) It seems to me that this might be competitive given the numbers someone posted before. Alas, I can't remember who was the original poster, but = I'd guess they might have a good guess. > -----Original Message----- > From: num...@li...=20 > [mailto:num...@li...] On=20 > Behalf Of Chris Barker > Sent: Friday, February 07, 2003 10:34 AM > To: fa...@op...; num...@li... > Subject: Re: [Psyco-devel] RE: [Numpy-discussion] Interesting=20 > Psyco/Numeric/Numarray comparison >=20 >=20 > Francesc Alted wrote: >=20 > > For this task may be is worth to consider using Pyrex > > (http://www.cosc.canterbury.ac.nz/~greg/python/Pyrex/) for=20 > that. From=20 > > the > > website: > >=20 > > """Pyrex lets you write code that mixes Python and C data types any=20 > > way you want, and compiles it into a C extension for Python.""" >=20 > I've been keeping my eye on Pyrex for a while now, but have=20 > not yet had enough of a use for it to justify tryin git out.=20 > I do ahve a question that I ahve not foudn the answer to on=20 > the web, which could make a big difference to how useful it is to me: >=20 > Is Pyrex aware of Numeric Arrays? >=20 > I imagine it could use them just fine, using the generic=20 > Python sequence get item stuff, but that would be a whole lot=20 > lower performance than if it understood the Numeric API and=20 > could access the data array directly. Also, how does it deal=20 > with multiple dimension indexing ( array[3,6,2] ) which the=20 > standard python sequence types do not support? >=20 > As I think about this, I think your suggestion is fabulous.=20 > Pyrex (or a > Pyrex-like) language would be a fabulous way to write code=20 > for NumArray, if it really made use of the NumArray API. >=20 > Thanks for your input, >=20 > -Chris >=20 > --=20 > Christopher Barker, Ph.D. > Oceanographer > =09 > NOAA/OR&R/HAZMAT (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception >=20 > Chr...@no... >=20 >=20 > ------------------------------------------------------- > This SF.NET email is sponsored by: > SourceForge Enterprise Edition + IBM + LinuxWorld =3D Something=20 > 2 See! http://www.vasoftware.com=20 > _______________________________________________ > Numpy-discussion mailing list Num...@li... > https://lists.sourceforge.net/lists/listinfo/numpy-discussion >=20 |