You can speed it up easily by avoiding the loop. The main idea is to
replace the indexing of the type [i+1,j], [i-1,j], [i,j+1], [i,j-1] by
the appropriate slicing.
For example
for i in xrange(1,n):
for j in xrange(1,m)
a[i,j] = b[i-1,j] + c[i,j+1]
can be replaced by
a[1:,:-1] = b[:-1] +
-Original Message-
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Elton Mendes
Sent: Monday, November 27, 2006 13:57
To: numpy-discussion@scipy.org
Subject: [Numpy-discussion] Precision in Python
Hi.
I'm having a precision problem in python
Example:
>>> a = 5.14
Try numpy.tensordot
Nadav
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Carsten
Rostgaard
Sent: Thursday, November 23, 2006 10:06
To: numpy-discussion@scipy.org
Subject: [Numpy-discussion] dot operations on multidimensional arrays
Hi!
I am trying to us
Michael McNeil Forbes wrote:
> Robert Kern <[EMAIL PROTECTED]> wrote:
>> Michael McNeil Forbes wrote:
>>> What are the semantics of the "take" function?
>>>
>>> I would have expected that the following have the same shape and size:
>>>
>> a = array([1,2,3])
>> inds = a.nonzero()
>> a[in
Robert Kern <[EMAIL PROTECTED]> wrote:
> Michael McNeil Forbes wrote:
> > What are the semantics of the "take" function?
> >
> > I would have expected that the following have the same shape and size:
> >
> a = array([1,2,3])
> inds = a.nonzero()
> a[inds]
> > array([1, 2, 3])
> >>>
I'm impressed with how easy it is to compile numpy.
I'm even more impressed with how easy it is let someone else compile
it and just apt-get it.
Does anyone know the numpy plans for debian? It is currently at 1.0rc1.
I'm afraid to ask the debian numpy maintainers since they have already
done me
Hi! All,
I have a dual opteron 285 with 8G ram machine. And I ran FC6 x86_64 on
that. I did manage to get numpy (from svn) compiled by using icc
9.1.0.45 and mkl 9.0 ( got 3 errors when I ran the est). But no such
luck for scipy (from svn). Below is the error:
Lib/special/cephes/mconf.h(137): rem
Hi,
> The question is then:
> 1) Is there any way to change the axis for which the product-sum is
> performed. This can of course be done by a swapaxis before and after the
> operation, but this makes the array non-contiguous, in which case the
> dot operation often makes bugs (at least in Numeric
David Bogen wrote:
> All:
>
> Is it possible to build Numpy using Python 2.2? I haven't been able to
> find anything that explicitly lists the versions of Python with which
> Numpy functions so I've been working under the assumption that the two
> bits will mesh together somehow.
numpy requires
On 11/27/06, Elton Mendes <[EMAIL PROTECTED]> wrote:
Hi.
I'm having a precision problem in python
Example:
>>> a = 5.14343434
>>> b = round(a,1)
>>> b
5.0996
>>>
It´s possible to round the number exactly to 5.1
Short answer, no. The number 5.1 can't be exactly represented as a
On 12/5/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
On 12/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> Hello,
>
> I'm taking a CFD class, one of the codes I wrote runs very slow. When I
> look at hotshot is says the function below is the problem. Since this is an
> explicit step,
it looks like you could use weave.blitz() without much change to your code.
or weave.inline() if needed. see this page:
http://scipy.org/PerformancePython
On 12/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello,
I'm taking a CFD class, one of the codes I wrote runs very slow. When I
loo
On 12/3/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
Hello,
I'm taking a CFD class, one of the codes I wrote runs very slow. When I
look at hotshot is says the function below is the problem. Since this is an
explicit step, the for loops are only traversed once, so I think it's caused
by mem
Elton Mendes wrote:
> Hi.
> I'm having a precision problem in python
>
> Example:
>
>
> >>> a = 5.14343434
> >>> b = round(a,1)
> >>> b
> 5.0996
> >>>
>
> It´s possible to round the number exactly to 5.1
Read this:
http://www.python.org/infogami-faq/general/why-are-floating-point-calc
[EMAIL PROTECTED] wrote:
> Hello,
>
> I'm taking a CFD class, one of the codes I wrote runs very slow. When I look
> at hotshot is says the function below is the problem. Since this is an
> explicit step, the for loops are only traversed once, so I think it's caused
> by memory usage, but I'm no
On 11/23/06, Carsten Rostgaard <[EMAIL PROTECTED]> wrote:
Hi!
I am trying to use the "dot" method on multi-(more than 2)-dimensional
arrays.
Specifically I do
>> y = dot(a, b)
where a is a 2D array and b is a 3D array.
using numpy I get the the help:
"
dot(...)
dot(a,v) returns matrix-
Hello, i tried to create a 2d array, but encountered:
ValueError: dimensions too large.
Does this refer to insufficient memory, or is there really a limit on dimension
sizes?
Cheers.
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http:
> It seems running from the source dir has been the main problem all
> along. It works fine outside (I guess).
>
> I get one error in the test Steve recommends though. But hey, 519 out
> of 520 ain't so bad, is it?
>
Don't worry about the failing test. It's a bad test on your platform.
Hello,
I'm taking a CFD class, one of the codes I wrote runs very slow. When I look at
hotshot is says the function below is the problem. Since this is an explicit
step, the for loops are only traversed once, so I think it's caused by memory
usage, but I'm not sure if it's the local variables o
Chris Barker wrote:
> Hi all,
>
> I'd like to set the data type for what numpy.where creates. For example:
>
> import numpy as N
>
> N.where(a >= 5, 5, 0)
>
> creates an integer array, which makes sense.
>
> N.where(a >= 5, 5.0, 0)
>
> creates a float64 array, which also makes sense, but I'd like a
[EMAIL PROTECTED] wrote:
> I am looking for a way to create an array of the same type as another
> given array (but of different shape) that works both with Numeric and
> NumPy without being unreasonably slow. In other words, I am looking
> for a a replacement for the expression
>
> arr
Hi.
I'm having a precision problem in python
Example:
a = 5.14343434
b = round(a,1)
b
5.0996
It´s possible to round the number exactly to 5.1
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mail
Hello,
I've discovered a small problem when I tried to save a numpy array
with the pickle module. The dumped array is not always equal to the
loaded one and the error is not always here, depending on the way I
express matrix operations.
I illustrated the error with a small script attached w
Hi!
I am trying to use the "dot" method on multi-(more than 2)-dimensional
arrays.
Specifically I do
>> y = dot(a, b)
where a is a 2D array and b is a 3D array.
using numpy I get the the help:
"
dot(...)
dot(a,v) returns matrix-multiplication between a and b.
The product-sum is over t
Bill Spotz wrote:
>
> you might try
>
> from __future__ import generators
>
Some research did turn up that alternative, but then I started getting
this error:
$ /usr/bin/python2.2 setup.py build
Running from numpy source directory.
Traceback (most recent call last):
File "setup.py", line
From
http://docs.python.org/ref/yield.html
you might try
from __future__ import generators
On Dec 5, 2006, at 9:07 AM, David Bogen wrote:
> All:
>
> Is it possible to build Numpy using Python 2.2? I haven't been
> able to
> find anything that explicitly lists the versions of Pytho
All:
Is it possible to build Numpy using Python 2.2? I haven't been able to
find anything that explicitly lists the versions of Python with which
Numpy functions so I've been working under the assumption that the two
bits will mesh together somehow.
When I try to build Numpy 1.0.1 on RedHat Ente
27 matches
Mail list logo