Re: [Numpy-discussion] How to call import_array() properly?

2010-12-27 Thread Bruce Sherwood
ince what I've done works okay. And I realized that I could collapse init_numpy a bit: #if PY_MAJOR_VERSION >= 3 int #else void #endif init_numpy() { import_array(); } Bruce Sherwood On Mon, Dec 27, 2010 at 12:15 PM, Robert Kern wrote: > On Mon, Dec 27, 2010 at 13:09, Bruc

Re: [Numpy-discussion] How to call import_array() properly?

2010-12-27 Thread Bruce Sherwood
er there's a more intelligent or elegant way to drive import_array than the following code: #if PY_MAJOR_VERSION >= 3 int init_numpy() { import_array(); } #else void init_numpy() { import_array(); } #endif Bruce Sherwood On Mon, Dec 27, 2010 at 8:20 AM, Robert Kern wrote

Re: [Numpy-discussion] How to call import_array() properly?

2010-12-26 Thread Bruce Sherwood
I made a mistake: the Mac behaves the same way when I repeat the experiment. I guess I simply have to define init_numpy() to be of type int for Python 3 on both machines. Nevertheless, if you see a more elegant coding, I'd be interested. Thanks. Bruce Sherwood On Sun, Dec 26, 2010 at 3:

[Numpy-discussion] How to call import_array() properly?

2010-12-26 Thread Bruce Sherwood
t this seems like an odd kludge, since it isn't needed on the Mac, and I think it's also not needed on Linux. Bruce Sherwood ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Type of init_numpy()?

2010-11-28 Thread Bruce Sherwood
Sorry for the confusion. I misspoke. I guess the issue is with import_array. I'll look more closely at what I'm seeing. Thanks. Bruce Sherwood On Sun, Nov 28, 2010 at 10:07 AM, Pauli Virtanen wrote: > On Sun, 28 Nov 2010 09:52:05 -0700, Bruce Sherwood wrote: >> For Python 2.

[Numpy-discussion] Type of init_numpy()?

2010-11-28 Thread Bruce Sherwood
For Python 2.x, init_numpy() was void on all platforms. For Python 3.1, I find experimentally that init_numpy() is int on Windows (but still void on Mac, and I think also void on Ubuntu Linux). Is this a bug? Bruce Sherwood ___ NumPy-Discussion

Re: [Numpy-discussion] numpy speed question

2010-11-26 Thread Bruce Sherwood
math versions for scalar arguments. Bruce Sherwood On Thu, Nov 25, 2010 at 2:34 PM, Gökhan Sever wrote: > On Thu, Nov 25, 2010 at 4:13 AM, Jean-Luc Menut wrote: >> Hello all, >> >> I have a little question about the speed of numpy vs IDL 7.0. I did a >> very simple little che

[Numpy-discussion] Slow element-by-element access?

2010-11-21 Thread Bruce Sherwood
Is this a known issue? Does it matter? I was unable to find any discussion of this. Bruce Sherwood ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

[Numpy-discussion] numpy.int32 -> double?

2009-04-28 Thread Bruce Sherwood
2.5 and am using Boost 1.38 with Python 2.6. Any ideas or suggestions? Thanks. Bruce Sherwood ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-29 Thread Bruce Sherwood
would pay for numpy to make what is probably an exceedingly fast check and do much faster calculations of sqrt(scalar) and other such mathematical functions. Bruce Sherwood Bruce Sherwood wrote: > I found by timing measurements that a faster scheme with less penalty > for the case of sq

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-29 Thread Bruce Sherwood
I found by timing measurements that a faster scheme with less penalty for the case of sqrt(array) looks like this: def sqrt(x): if type(x) is float: return mathsqrt(x) return numpysqrt(x) Bruce Sherwood wrote: > Roman Yakovenko wrote: >> On Dec 29, 2007 7:47 AM, Bruce Sherwoo

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-29 Thread Bruce Sherwood
Roman Yakovenko wrote: > On Dec 29, 2007 7:47 AM, Bruce Sherwood <[EMAIL PROTECTED]> wrote: > >> I realized belatedly that I should upgrade from Boost 1.33 to 1.34. >> Alas, that didn't cure my problem. >> > Can you post small and complete example of

[Numpy-discussion] numpy and math sqrt timings

2007-12-28 Thread Bruce Sherwood
a scalar argument. Shouldn't/couldn't numpy do something like this internally? Bruce Sherwood from math import * mathsqrt = sqrt from numpy import * numpysqrt = sqrt from time import clock # 0.8 microsec for "raw" math sqrt # 5.7 microsec for &

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-28 Thread Bruce Sherwood
I realized belatedly that I should upgrade from Boost 1.33 to 1.34. Alas, that didn't cure my problem. Bruce Sherwood Bruce Sherwood wrote: > I should have added: This structure worked with the older version of > VPython which used Numeric, but it doesn't work in the beta versi

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-27 Thread Bruce Sherwood
, and clueless about how to remedy them. Bruce Sherwood Bruce Sherwood wrote: > Thanks for the comment, which limits the range of possible solutions. > The VPython vector class is implemented in C++, not in Python. I made up > the simple test in my previous note to try out the solution

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-27 Thread Bruce Sherwood
v.x, s*v.y, s*v.z); } Maybe the unsolvable problem is in the Boost definitions: py::class_("vector", py::init< py::optional >()) .def( self * double()) .def( double() * self) Left multiplication is fine, but right multiplication isn't. Bruce Sherwood Robert

Re: [Numpy-discussion] [C++-sig] Overloading sqrt(5.5)*myvector

2007-12-26 Thread Bruce Sherwood
Documents\0VPythonWork\vectors.py", line 24, in numpy.float64.__mul__ = new_mul TypeError: can't set attributes of built-in/extension type 'numpy.float64' I'm copying this to the numpy discussion list, as maybe someone there will see where to go starting fr

[Numpy-discussion] Overloading sqrt(5.5)*myvector

2007-12-25 Thread Bruce Sherwood
from Numeric to numpy because Numeric sqrt returned float whereas numpy sqrt returns numpy.float64, so that the result is not one of my vector objects. I don't have a problem with myvector*sqrt(5.5). Desperately, Bruce Sherwood --- I'm not sure whether this is a

[Numpy-discussion] Numpy or Boost problem

2007-12-20 Thread Bruce Sherwood
o specify the left-hand and right-hand overloadings. But do I have to add something like .def( npy_float64() * self)? Help would be much appreciated. Bruce Sherwood ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mailman/listinfo/numpy-discussion