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
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
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:
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
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.
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
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
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
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
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
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
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
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 &
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
, 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
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
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
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
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
19 matches
Mail list logo