[SciPy-user] conj and element-by-element multiplication
David M. Cooke
cookedm at physics.mcmaster.ca
Fri May 20 18:03:01 EDT 2005
Ryan Krauss <ryanfedora at comcast.net> writes:
> No, I am running Linux.
Odd; I do too, and don't see this. glibc's pow doesn't have the same
problem as Window's does. x**2 is at most 50% slower, not 10x.
Which version of Numeric and python are you using, and which Linux
distribution? (Numeric's version you can get from Numeric.__version__)
Ideally, x**2 should run in the same time as x*x
You're using scipy's multiply, which is the same (I think) as the
multiply in Numeric 24.0b2, which are different from 23.8 and earlier
(which does a time-wasting postcheck of the array for infinite values).
> David M. Cooke wrote:
>
> Ryan Krauss <ryanfedora at comcast.net> writes:
>
>
>
> Thanks David, that seems like the right answer. But to get the speed benefit
> you mention, I need to use multiply(x.real,x.real) instead of x.real**2 - same
> for imag. There is about a factor of 10 time difference between the two. So
> my norm2 function now looks like this:
>
>
>
> Are you on Windows? The pow() function there, well, sucks big time. On
> other platforms the two are pretty close in speed.
>
> I'm working on a better version of the power ufunc for Numeric, so
> hopefully in a later version this will be fixed (or rather, worked
> around).
--
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke http://arbutus.physics.mcmaster.ca/dmc/
|cookedm at physics.mcmaster.ca
More information about the SciPy-User
mailing list