Re: [Numpy-discussion] On loop and broadcasting (again)

2006-10-05 Thread David Cournapeau
Travis Oliphant wrote:
> David Cournapeau wrote:
>
>> Hi,
>>
>>   The email from Albert made me look again on some surprising results I 
>> got a few months ago when starting my first "serious" numpy project. I 
>> noticed that when computing multivariate gaussian densities, centering 
>> the data was more expensive than everything else, including 
>> exponentiation. Now that I have some experience with numpy, and 
>> following the previous discussion, I tried the following script:
>>  
>>
>
> Try it again with the new code in SVN.
>
It looks like your modification solved this particular issue !:

 100.6450.0650.6450.065 
storage_email.py:8(center_broadcast)
 100.6250.0620.6250.062 
storage_email.py:26(center_manual)
  10.3330.3330.3330.333 
/usr/lib/python2.4/site-packages/numpy/lib/shape_base.py:530(repmat)

Now, using broadcast is as fast as doing the substraction itself (which 
does not include the necessary repmat). I tried it on my laptop, where I 
can safely use beta code (python 2.4 + SVN numpy), which  explains the 
timing differences compared to my previous email; as the memory is 
limited on the laptop, I only benchmarked the brodcasting. For smaller 
arrays, I couldn't see major differences in relative timing for the 
other implementations.

Thank you very much !

David

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] repmat

2006-10-05 Thread David Cournapeau
Bill Baxter wrote:
>
>> I'm not completely sold on the whole reparray thing: does repmat have
>> any use outside of the linear algebra convention of squashing a 3D array
>> into a 2D matrix (or however that goes)? If not, perhaps it should just
>> get left alone and exciled to matrix specific functions namespace. So:
>> 
>
> Well, I'm not sure about N-d, but I've definitely had a need for 1-d
> version of it.  That's what prompted me to look into this.  Also I
> think I read a comment in the other thread about pyEM that repmat()
> turned out to be one of the faster ways to implement
> something-or-other (?). 
It was in a very specific case, and it could have been replaced by an 
other function in this case without any loss of performance. The 
following is my experience with matlab/repmat: generally, repmat was 
necessary in many cases in matlab either for efficiency (big scalar 
matrix were slow to generate using ones and zeros, for example) and 
because matlab had almost no broadcasting rules, repmat was almost 
mandatory for matlab. In numpy, the syntax at least does not require 
repmat (at least, I never *had* to use it in numpy, and I used it a lot 
with matlab).

Moreoever, the slowness of some broadcasting seem solved in recent 
subversion (see my answer on the specific thread),

David
>  At the very least you could think of tiling
> 3D image data as one application, in fact 'tile()' is probably a
> better name for the function than 'reparray'.
>
> I was initially suprised that 'repeat()' featured so prominently in
> numpy.  I initially assumed it meant "repmat", and was surprised when
> it didn't do that.  I thought "why on earth would you want to do
> that?".  But it does turn out to have lots of uses (like implementing
> "repmat" ;-))
>
>   
>> +1 on deprecating, moving or otherwise getting rid of repmat.
>> Neutral on whether to replace it with something else, but if it is
>> replaced #3 looks like the correct route, but not with a different
>> argument name than 'shape'. Perhaps 'reps'.
>> 
>
> Hey!  Looks like we agree on the name of the argument, apparently.  :-)
> I do think there is a strong connection with "shape" though, that
> 'reps' hides. Maybe 'repshape' or 'tileshape'?  I'd be happy with
> reps, though.  Agreed that 'shape' is bad.  Makes it sound like you
> should specify the actual .shape of the output.
>
> --bb
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>   


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] contribution about history of Numeric

2006-10-05 Thread Fernando Perez
On 10/5/06, Paul Dubois <[EMAIL PROTECTED]> wrote:
> I was reading the 'History of SciPy' page and noticed the discussion about
> Numeric. Here's the true story about why the various names for the original:
> numpy, Numeric, Numerical.

I added this to the wiki page (http://www.scipy.org/History_of_SciPy),
though I don't know how to make a block quote in wiki markup, so I
left it without any visual clue.

Thanks for the info!

Best,

f

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] contribution about history of Numeric

2006-10-05 Thread Paul Dubois
I was reading the 'History of SciPy' page and noticed the discussion about Numeric. Here's the true story about why the various names for the original: numpy, Numeric, Numerical.At the time Source Forge was pretty young, and I decided to put the project there. We all said 'numpy' informally not Numerical Python but the module name was Numeric. I created the project as numpy. I have no memory of why I didn't call it Numeric, but if it wasn't a conflict, probably I was focused on making it clear it was for Python and/or easy to type. (the FTP's etc. all had to go through a long directory path that involved the name). The documentation for the CVS stuff was confusing, and I made a mistake with my first submit of 'Numeric' (I think it was ending up with everything in Numeric/Numeric) and then discovered I could not delete it; you had to ask the Source Forge staff. Impatient, I did a second submit as Numerical. 
In short, all my fault, but then again, SF was so security-minded that it was hard to do anything. That's why I soon gave up on their website and hosted it at my own site for so long. 
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] [OT] Interesting interview with Pearu (f2py and others...)

2006-10-05 Thread Fernando Perez
Hi all,

since this is not about me, I think it's fair to plug an interview :)

http://www.pythonthreads.com/articles/interviews/once-i-learned-about-python,-i-stopped-trying-out-different-languages.html

contains a very nice interview with Pearu, where in fact I learned a
number of interesting things not only about him but also about what's
happening with f2py.

Good job, Pearu :)

Best,

f

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] repmat

2006-10-05 Thread Bill Baxter
On 10/6/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> Bill Baxter wrote:
> > In short, repmat(A, M,N) is an oddball.  It only deals with 2D arrays.
> >
> > We should do some combination of:
> > 1) change repmat(A, M,N) to repmat(A, *dims) to add multidim ability
> > to it, while maintaining backwards compatibility.
> >
> Doesn't repmat imply matrix and thus 2d arrays? It is pretty horrible
> though.

It does kind of imply that (which is why I think something like
'reparray' would be a better name) but even matlab's repmat() function
doesn't restrict you to 2D arrays, and I'm pretty sure numpy.repmat
was intended to be a clone of that.

> > 2) change repmat(A, M,N) to repmat(A, shape) to add multidim ability
> > to it, and bring it into line with the "numpy standard" of shapes
> > being passed as one tuple arg.
> >
> I presume shape actually means number of repetitions, and not shape. If
> so, shape is the wrong name for the second argument. Anyway as long as
> your breaking backward compatibility you might as well improve the name.

Yeh, that did occur to me.  Maybe 'reps' would be a better name for
the argument.

> > 3) add a new method like reparray(A, shape) that has the multidim
> > ability, and matches numpy conventions.
> >
> Same comment on the name shape.
>
>
> > 4)   if 3), move repmat out of the top-level namespace to indicate 
> > deprecation
> >
> I'm not completely sold on the whole reparray thing: does repmat have
> any use outside of the linear algebra convention of squashing a 3D array
> into a 2D matrix (or however that goes)? If not, perhaps it should just
> get left alone and exciled to matrix specific functions namespace. So:

Well, I'm not sure about N-d, but I've definitely had a need for 1-d
version of it.  That's what prompted me to look into this.  Also I
think I read a comment in the other thread about pyEM that repmat()
turned out to be one of the faster ways to implement
something-or-other (?).  At the very least you could think of tiling
3D image data as one application, in fact 'tile()' is probably a
better name for the function than 'reparray'.

I was initially suprised that 'repeat()' featured so prominently in
numpy.  I initially assumed it meant "repmat", and was surprised when
it didn't do that.  I thought "why on earth would you want to do
that?".  But it does turn out to have lots of uses (like implementing
"repmat" ;-))

> +1 on deprecating, moving or otherwise getting rid of repmat.
> Neutral on whether to replace it with something else, but if it is
> replaced #3 looks like the correct route, but not with a different
> argument name than 'shape'. Perhaps 'reps'.

Hey!  Looks like we agree on the name of the argument, apparently.  :-)
I do think there is a strong connection with "shape" though, that
'reps' hides. Maybe 'repshape' or 'tileshape'?  I'd be happy with
reps, though.  Agreed that 'shape' is bad.  Makes it sound like you
should specify the actual .shape of the output.

--bb

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] repmat

2006-10-05 Thread Tim Hochberg
Bill Baxter wrote:
> [There seem to have been some gmail delivery problems that prevented
> my previous mail on this subject from being delivered]
>
> I've proposed that we fix repmat handle arbitrary dimensions before 1.0.
>
>http://projects.scipy.org/scipy/numpy/ticket/292
>
> I don't think this is particularly controversial, just I'm guessing
> no-one's found the time to look at my proposed fixes.  And
> gmail/sourceforge issues haven't helped either.
>
> In short, repmat(A, M,N) is an oddball.  It only deals with 2D arrays.
>
> We should do some combination of:
> 1) change repmat(A, M,N) to repmat(A, *dims) to add multidim ability
> to it, while maintaining backwards compatibility.
>   
Doesn't repmat imply matrix and thus 2d arrays? It is pretty horrible 
though.

> 2) change repmat(A, M,N) to repmat(A, shape) to add multidim ability
> to it, and bring it into line with the "numpy standard" of shapes
> being passed as one tuple arg.
>   
I presume shape actually means number of repetitions, and not shape. If 
so, shape is the wrong name for the second argument. Anyway as long as 
your breaking backward compatibility you might as well improve the name.

> 3) add a new method like reparray(A, shape) that has the multidim
> ability, and matches numpy conventions.
>   
Same comment on the name shape.


> 4)   if 3), move repmat out of the top-level namespace to indicate deprecation
>   
I'm not completely sold on the whole reparray thing: does repmat have 
any use outside of the linear algebra convention of squashing a 3D array 
into a 2D matrix (or however that goes)? If not, perhaps it should just 
get left alone and exciled to matrix specific functions namespace. So:

+1 on deprecating, moving or otherwise getting rid of repmat.
Neutral on whether to replace it with something else, but if it is 
replaced #3 looks like the correct route, but not with a different 
argument name than 'shape'. Perhaps 'reps'.

-tim

> The tracker item has all the code necessary to implement these fixes,
> it's just a matter of deciding which one to go with.
>
> My personal preference would be a combination of 1 and 3.  Add
> reparray(A,shape) , and change repmat to repmat(A, *shape).  Then just
> implement repmat as a call to reparray.
>
> If someone will decide which route to go, I'd be happy to provide an
> actual patch against the latest SVN to implement that decision.
>
> If this is somehow controversial for some reason then let's discuss
> it.  But so far the only response has been "copying data is a bad
> idea", which is really a separate issue.
>
> --bb
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>
>
>   



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] repmat

2006-10-05 Thread Bill Baxter
[There seem to have been some gmail delivery problems that prevented
my previous mail on this subject from being delivered]

I've proposed that we fix repmat handle arbitrary dimensions before 1.0.

   http://projects.scipy.org/scipy/numpy/ticket/292

I don't think this is particularly controversial, just I'm guessing
no-one's found the time to look at my proposed fixes.  And
gmail/sourceforge issues haven't helped either.

In short, repmat(A, M,N) is an oddball.  It only deals with 2D arrays.

We should do some combination of:
1) change repmat(A, M,N) to repmat(A, *dims) to add multidim ability
to it, while maintaining backwards compatibility.
2) change repmat(A, M,N) to repmat(A, shape) to add multidim ability
to it, and bring it into line with the "numpy standard" of shapes
being passed as one tuple arg.
3) add a new method like reparray(A, shape) that has the multidim
ability, and matches numpy conventions.
4)   if 3), move repmat out of the top-level namespace to indicate deprecation

The tracker item has all the code necessary to implement these fixes,
it's just a matter of deciding which one to go with.

My personal preference would be a combination of 1 and 3.  Add
reparray(A,shape) , and change repmat to repmat(A, *shape).  Then just
implement repmat as a call to reparray.

If someone will decide which route to go, I'd be happy to provide an
actual patch against the latest SVN to implement that decision.

If this is somehow controversial for some reason then let's discuss
it.  But so far the only response has been "copying data is a bad
idea", which is really a separate issue.

--bb

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Memory errors

2006-10-05 Thread Robert Kern
If you are going to start a new topic, please start a new thread as well, 
instead of replying to a message. Thanks.

Vikalpa Jetly wrote:
> I am reading a very large array (~9000,11000) of 1 byte image values. I need
> to change values in the array that meet a certain condition so I am running
> something like:
> 
> b = numpy.where(a>200,0,1)
> 
> to create a new array with the changed values. However, I get a
> "MemoryError" everytime I try this. I have over 3gb of RAM on my machine
> (most of which is available). The process runs fine on smaller datasets. Is
> there a maximum array size that numpy handles? Any alternatives/workarounds?

There is no predefined limit on the array size, just your memory.

However, note that what you are doing here is creating an int32 (or int64 if 
you 
are on a 64-bit machine) array since you are using Python integers in your 
where() function. You can save quite a bit of memory by using the array from 
(a>200) and simply casting it to the uint8 type. That way, you only have two 
arrays in memory at any time, a and b.

   b = (a > 200).astype(numpy.uint8)

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Memory errors

2006-10-05 Thread Travis Oliphant
Vikalpa Jetly wrote:

>I am reading a very large array (~9000,11000) of 1 byte image values. I need
>to change values in the array that meet a certain condition so I am running
>something like:
>
>b = numpy.where(a>200,0,1)
>
>to create a new array with the changed values. However, I get a
>"MemoryError" everytime I try this. I have over 3gb of RAM on my machine
>(most of which is available). The process runs fine on smaller datasets. Is
>there a maximum array size that numpy handles? Any alternatives/workarounds?
>
>  
>
The MemoryError is a direct result when system malloc fails.Rather 
than use where with two scalars (you're resulting array will be int32 
and therefore 4-times larger).

Use

b = zeros_like(a)
b[a>200] = 1

which will consume less memory.

-Travis
 

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] Memory errors

2006-10-05 Thread Vikalpa Jetly

I am reading a very large array (~9000,11000) of 1 byte image values. I need
to change values in the array that meet a certain condition so I am running
something like:

b = numpy.where(a>200,0,1)

to create a new array with the changed values. However, I get a
"MemoryError" everytime I try this. I have over 3gb of RAM on my machine
(most of which is available). The process runs fine on smaller datasets. Is
there a maximum array size that numpy handles? Any alternatives/workarounds?

Thanks.
Vikalpa

-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of A. M.
Archibald
Sent: Thursday, October 05, 2006 5:02 PM
To: Discussion of Numerical Python
Subject: Re: [Numpy-discussion] Hello and my first patch

On 05/10/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:

> I think a hybrid for weave / f2py / ctypes that allows "inlining in
> multiple languages" as well as automatic extension module generation for
> "already-written" code is in order.

It might make sense to also include SWIG (since that seems to be a
popular choice for wrapping "already-written" C and C++ code).

A. M. Archibald

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread A. M. Archibald
On 05/10/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:

> I think a hybrid for weave / f2py / ctypes that allows "inlining in
> multiple languages" as well as automatic extension module generation for
> "already-written" code is in order.

It might make sense to also include SWIG (since that seems to be a
popular choice for wrapping "already-written" C and C++ code).

A. M. Archibald

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Travis Oliphant
Matthew Brett wrote:

>Hi,
>
>On 10/5/06, Martin Wiechert <[EMAIL PROTECTED]> wrote:
>  
>
>>Hi list,
>>
>>when I try to assign a sequence as an element of an object array via flat
>>indexing only the first element of the sequence is assigned:
>>
>>
>
>I've also been having trouble with flat on object arrays.
>
>Is this intended?
>
>In [1]: from numpy import *
>
>In [2]: a = arange(2)
>
>In [3]: a[1]
>Out[3]: 1
>
>In [4]: a.flat[1]
>Out[4]: 1
>
>In [5]: b = array([a], dtype=object)
>
>In [6]: b[1]
>---
>exceptions.IndexErrorTraceback (most
>recent call last)
>
>/home/mb312/devel_trees/scipy/Lib/io/
>
>IndexError: index out of bounds
>
>In [7]: b.flat[1]
>Out[7]: 1
>
>  
>

This is correct behavior.  Look at the shape of b.  It is being indexed 
correctly.

The problem is that it is ambiguous as to what is wanted when you write

b = array([a], dtype=object).

We have gone through the rounds on this one and the current behavior is 
our best compromise.

-Travis




-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Travis Oliphant
A. M. Archibald wrote:

>On 05/10/06, Greg Willden <[EMAIL PROTECTED]> wrote:
>  
>
>>On 10/5/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
>>
>>
>>>Perhaps that is the best way to move forward along with the work on a
>>>"pylab" super-package.
>>>  
>>>
>>That is exactly what I want.
>>
>>
>
>What is unsatisfactory about installing numpy+scipy+matplotlib? I've
>found they're generally pretty complete (except where no decent python
>alternative exists).
>
>  
>
>>In the end I want a nice collection of functions, logically organized, that
>>let me analyze/filter/plot etc. etc. etc.
>>
>>The key for me is "logically organized".
>>
>>
>
>  
>
There is a structure to it, but it's more organic because of the 
multiple contributors.

weave should be in NumPy but nobody was willing to step up to maintain 
it a year ago.   I may be willing to step up at this point.   I would 
like to see weave in NumPy (maybe not the blitz libraries though...)

I think a hybrid for weave / f2py / ctypes that allows "inlining in 
multiple languages" as well as automatic extension module generation for 
"already-written" code is in order.


-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Travis Oliphant
Martin Wiechert wrote:

>Hi list,
>
>when I try to assign a sequence as an element of an object array via flat 
>indexing only the first element of the sequence is assigned:
>
>  
>
import numpy
numpy.version.version


>'1.0rc1.dev3171'
>  
>
from numpy import *
a = ndarray ((2,2), object)
a.flat [2] = (1, 2, 3)
a.flat [2]


>1
>  
>
a


>array([[None, None],
>   [1, None]], dtype=object)
>
>Is this a feature? Wouldn't a naive user like me expect
>a.flat [2] == (1, 2, 3)?
>
>  
>
You are probably right.This should be changed.

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Matthew Brett
Hi,

On 10/5/06, Martin Wiechert <[EMAIL PROTECTED]> wrote:
> Hi list,
>
> when I try to assign a sequence as an element of an object array via flat
> indexing only the first element of the sequence is assigned:

I've also been having trouble with flat on object arrays.

Is this intended?

In [1]: from numpy import *

In [2]: a = arange(2)

In [3]: a[1]
Out[3]: 1

In [4]: a.flat[1]
Out[4]: 1

In [5]: b = array([a], dtype=object)

In [6]: b[1]
---
exceptions.IndexErrorTraceback (most
recent call last)

/home/mb312/devel_trees/scipy/Lib/io/

IndexError: index out of bounds

In [7]: b.flat[1]
Out[7]: 1

Best,

Matthew

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Christopher Barker
The situation is confusing, we all know that, and we all want to move 
toward a better way.

Key to that is that SciPy needs to be easier to build and install -- 
that's happening, but I don't know that it's there yet. Maybe it can be 
built on Fedora Core 4 now, but last I tried it couldn't be.

Anyway, few thoughts on comments made here:

> Matplotlib plots the spectrogram

Here's a key problem -- matplotlib includes WAY too much. There are 
reasons, and there is history, but as a goal, I think matplotlib should 
be just what it says it is -- a plotting library.

I don't know that MPL has been declared the "official" plotting package 
for SciPy, but it would be nice if it were. SciPy has suffered for a 
very long time without a full-featured, cross-platform, "official" 
plotting package. AS far as I know, MPL comes the closest (except it 
doesn't do 3-d -- darn!)

A. M. Archibald wrote:
> Frankly, I tend to prefer the other approach to solving all these
> issues: distribute numpy, scipy, and matplotlib as one bundle.

This is really the only way to set things up for someone that want what 
could be used as a "matlab replacement". If we ever get settools working 
just right, we should be able to do:

easy_install scipy

and have it all! woo hoo!

However, as we work to that goal, i do think it makes sense that numpy, 
and matplotlib be packages unto themselves -- developed separately, etc. 
In fact, SciPy should be a collection of distinct packages as well. I 
think there is a real benefit to be able to install just what you need. 
Not very user of numpy and/or MPL is looking for a full scientific 
software package.

I'm a big advocate of people using numpy arrays for all sorts of thinks 
that fit well into an n-d array, that have nothing to do with Scientific 
programming. Matplotlib is also very useful for people who need a quick 
plot for a web site or something. These people don't want to install the 
entirety of SciPy.

> * routines and objects can be in the package in which they make the
> most semantic sense,

exactly. If it's plotting (but not computing stuff to plot) put it in 
MPL, if it's generic computation (if you can't understand it with high 
school math, it's not generic), put it in numpy. Of course, these aren't 
clear definitions, but can still be useful as guidelines.


> * documentation can be cross-referenced between packages (so the
> Matrix class can tell people to look in scipy.linalg for inverses, for
> example)

If it were me, I'd probably have the Matrix package depend on a linear 
algebra package, and have only one of those.



Travis Oliphant wrote:

> 3) some kind of problem-domain hierarchy

+1

> Do we want to pull scipy apart  into two components:  one that needs 
> Fortran to build and another that doesn't? 

yup -- I don't like it, but the state of Fortran compilers really gives 
little choice.



-Chris








-- 
Christopher Barker, Ph.D.
Oceanographer

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

[EMAIL PROTECTED]

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Tim Hochberg
Travis Oliphant wrote:
> Tim Hochberg wrote:
>
>   
  
  

 
>>> That would be easy to do. Right now the opcodes should work correctly 
>>> on data that is spaced in multiples of the itemsize on the last axis. 
>>> Other arrays are copied (no opcode required, it's embedded at the top 
>>> of interp_body lines 64-80). The record array case apparently slips 
>>> through the cracks when we're checking whether an array is suitable to 
>>> be used correctly (interpreter.c 1086-1103). It would certainly not be 
>>> any harder to only allow contiguous arrays than to correctly deal with 
>>> record arrays. Only question I have is whether the extra copy will 
>>> overwhelm the savings of that operating on contiguous data gives.  The 
>>> thing to do is probably try it and see what happens.
>>>
>>>
>>>   
>> OK, I've checked in a fix for this that makes a copy when the array is 
>> not strided in an even multiple of the itemsize. I first tried copying 
>> for all discontiguous array, but this resulted in a large speed hit for 
>> vanilla strided arrays (a=arange(10)[::2], etc.), so I was more frugal 
>> with my copying. I'm not entirely certain that I caught all of the 
>> problematic cases, so let me know if you run into any more issues like this.
>>
>>  
>>
>> 
> There is an ElementStrides check and similar requirement flag you can 
> use to make sure that you have an array whose strides are multiples of 
> it's itemsize.
>
>   
Thanks Travis, I'll make a note; next time I look at this code I'll see 
if that can be used to simplify the code in question.


-tim


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Albert Strasheim
Hello all

Some comments from a Windows user's perspective.

On Thu, 05 Oct 2006, Travis Oliphant wrote:

> John Hunter wrote:
> 
> >>"Robert" == Robert Kern <[EMAIL PROTECTED]> writes:
> >
> >Robert> IMO, I'd rather see this and similar functions go into
> >Robert> scipy. New functions that apply semantics to arrays (in
> >Robert> this case, treating them as time series), I think should
> >Robert> go into scipy. New functions that treat arrays simply as
> >Robert> arrays and are generally useful can probably go into
> >Robert> numpy.
> >
> >I prefer Perry's longstanding suggestion: things that do not add to
> >distribution complexity should go into numpy.  If it compiles as
> >easily as numpy itself, it should go into numpy where sensible.  
> 
> I don't think this is as feasible as it sounds at first.  Some people 
> complain that NumPy is too big already.  

I agree here. Focus NumPy on doing array library things.

> SciPy is very easy to install on Windows (there is a binary available).  
> The only major platform that still gives some trouble is Intel Mac (due 
> to the fortran compiler situation).   But, all you need is one person 
> who can build it and distribute a binary.

So far, I've been shying away from SciPy, because, if I encounter a 
problem, I have no easy way of building from SVN on Windows. I don't 
think I'm the only one: few Windows users have a proper Fortran 
compiler. Sure, there's MinGW, but that breaks all my other tools, most 
notably the Visual Studio debugger and other useful things like 
profilers (e.g. IBM Rational Quantify).

That being said, Enthought's nightly builds obviate the need of most 
Windows users to build from source. (Enthought rocks.)

Two feature requests at this point, which would make
NumPy/SciPy/Matplotlib dead easy to use on Windows, even if you're 
trying to stay close to trunk:

1. Please consider setting up a buildbot(*) that builds and runs the 
tests on every checkin. I've set up a buildbot for NumPy on my own 
machine; it takes a matter of minutes. Probably they already have 
something like this in place.

(*) http://buildbot.sourceforge.net/

2. Please consider doing separate builds per CPU with ATLAS 3.7.11, 
Intel MKL and ACML. By all means, make a generic build available that 
runs everywhere. This will require some reading of the MKL license 
agreement, but I think Enthought should be able to distribute Windows 
builds based on MKL without problems. Why go to this trouble? MATLAB 
R2006b uses Intel MKL on my CPU, and it is much faster than NumPy with 
ATLAS 3.6.0. Core Duo users also have the option of enabling OpenMP, to  
spread calculations to multiple cores.

> I think a better long-term solution is to understand how to package 
> things better by working with people at Enthought so that when you 
> advertise to the ex-Matlab user you point him to a "super-package" that 
> installs a bunch of other small packages.  This is a more maintainable 
> solution as long as we set standards for
>
> 1) documentation
> 2) tests
> 3) some kind of problem-domain hierarchy

Agreed. If Enthought is willing to provide the resources, Enthon could 
be the perfect solution to many of the issues that we currently 
encounter to get decent builds on Windows.

> The idea of just lumping more an more things into NumPy itself is not a 
> good idea.  What most users want is something that installs easily (like 
> Enthon).   How it is packaged is not as important.  What developers need 
> is a sane multi-namespace system that can be maintained separately if 
> needed.
> 
> I think we decided a while ago, that the package approach should contain 
> indicators as to whether or not a fortran compiler was needed to build 
> the system so that dependency on those things could be eliminated if 
> needed. 
> 
> Do we want to pull scipy apart  into two components:  one that needs 
> Fortran to build and another that doesn't? 

Maybe. Maybe not. On Linux this doesn't make much difference to me if I 
check out 3 projects or 10 -- builds are easy. On Windows, getting the 
support libraries, build tools and configuration right is much harder. 
Hard enough, that I don't think anybody wants to do it regularly.
 
> Perhaps that is the best way to move forward along with the work on a 
> "pylab" super-package.

Yes, please.

Regards,

Albert


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Martin Wiechert
Hi list,

when I try to assign a sequence as an element of an object array via flat 
indexing only the first element of the sequence is assigned:

>>> import numpy
>>> numpy.version.version
'1.0rc1.dev3171'
>>> from numpy import *
>>> a = ndarray ((2,2), object)
>>> a.flat [2] = (1, 2, 3)
>>> a.flat [2]
1
>>> a
array([[None, None],
   [1, None]], dtype=object)

Is this a feature? Wouldn't a naive user like me expect
a.flat [2] == (1, 2, 3)?

Thanks in advance,
Martin Wiechert

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread A. M. Archibald
On 05/10/06, Greg Willden <[EMAIL PROTECTED]> wrote:
> On 10/5/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> > Perhaps that is the best way to move forward along with the work on a
> > "pylab" super-package.
>
> That is exactly what I want.

What is unsatisfactory about installing numpy+scipy+matplotlib? I've
found they're generally pretty complete (except where no decent python
alternative exists).

> In the end I want a nice collection of functions, logically organized, that
> let me analyze/filter/plot etc. etc. etc.
>
> The key for me is "logically organized".

For the most part, the organization is pretty logical:
* Basic array and matrix operations in numpy
* linear algebra, differential equation, interpolation, etc. tools are
in scipy, each in their own subpackage
* weave is mysteriously in scipy
* plotting tools are in matplotlib

There are a few historical quirks, like window functions in numpy
(they really belong in scipy), and some of the less-used scipy
subpackages are a bit of a mess internally (scipy.interpolate for
example), but otherwise I'm not sure what you want to be different.

> And right now that means "So a newbie can find the function I need and the
> function I need is there"
>
> I'm not criticising.  I'd like to help get there.

Install all three major packages. Use the window functions from scipy
in matplotlib.

Task-oriented documentation is so far a bit scant, although the scipy
cookbook (http://www.scipy.org/Cookbook ) and the numpy examples list
(http://www.scipy.org/Numpy_Example_List ) are a good start.

A. M. Archibald

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Alan G Isaac
> On 10/5/06, John Hunter <[EMAIL PROTECTED]> wrote: 
>> I would be nice to have as much as possible in the most 
>> widely distributed package IMO. 


On Thu, 5 Oct 2006, Greg Willden apparently wrote: 
> That is a much better policy in my view. 


A user's perspective:
Well yes, all else equal, I'd like to have as much as 
possible in the easiest to install package,
BUT
my top priority is that numpy be completely bulletproof.

Do these goals conflict?

Cheers,
Alan Isaac


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Robert Kern
Greg Willden wrote:
> On 10/5/06, *Robert Kern* <[EMAIL PROTECTED] 
> > wrote:
> 
> Greg Willden wrote:
> 
>  >  From my view as a newbie to numpy/scipy/matplotlib it isn't
> clear where
>  > I should look for what functionality.  Matplotlib plots the
> spectrogram
>  > but it only supports two or three window functions.  Numpy
> supports 4 or
>  > 5 window functions and Scipy apparently supports more but Matplotlib
>  > doesn't support Scipy.
> 
> That's not true. specgram() takes a windowing function. It doesn't
> matter where
> that function comes from. 
> 
> The next sentence (that you snipped) afirms what you said.
> 
> Of course this is a minor example and I could just write the window 
> function myself and then use it in Matplotlib
> 
> 
> The details of my off-the-cuff example would probably be better 
> addressed by the Matplotlib folks.  (i.e. why they don't have builtin 
> functions for more windows).
> 
> You can see how it's all very confusing to someone new.
> "Matplotlib can plot a spectrogram but I need to use a window function 
> from SciPy because Matplotlib only supports NumPy and NumPy doesn't have 
> the one I want?"
> 
> You get the idea.

No, I'm afraid I don't.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/5/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
Perhaps that is the best way to move forward along with the work on a"pylab" super-package.That is exactly what I want.  In the end I want a nice collection of functions, logically organized, that let me analyze/filter/plot etc. etc. etc.
The key for me is "logically organized".And right now that means "So a newbie can find the function I need and the function I need is there"I'm not criticising.  I'd like to help get there.
Greg-- Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/5/06, Robert Kern <[EMAIL PROTECTED]> wrote:
Greg Willden wrote:>  From my view as a newbie to numpy/scipy/matplotlib it isn't clear where> I should look for what functionality.  Matplotlib plots the spectrogram> but it only supports two or three window functions.  Numpy supports 4 or
> 5 window functions and Scipy apparently supports more but Matplotlib> doesn't support Scipy.That's not true. specgram() takes a windowing function. It doesn't matter wherethat function comes from.
The next sentence (that you snipped) afirms what you said. Of course this is a minor example and I could just write the window function myself and then use it in Matplotlib
The details of my off-the-cuff example would probably be better addressed by the Matplotlib folks.  (i.e. why they don't have builtin functions for more windows). You can see how it's all very confusing to someone new.
"Matplotlib can plot a spectrogram but I need to use a window function from SciPy because Matplotlib only supports NumPy and NumPy doesn't have the one I want?"You get the idea.Greg-- 
Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Travis Oliphant
John Hunter wrote:

>>"Robert" == Robert Kern <[EMAIL PROTECTED]> writes:
>>
>>
>
>Robert> IMO, I'd rather see this and similar functions go into
>Robert> scipy. New functions that apply semantics to arrays (in
>Robert> this case, treating them as time series), I think should
>Robert> go into scipy. New functions that treat arrays simply as
>Robert> arrays and are generally useful can probably go into
>Robert> numpy.
>
>I prefer Perry's longstanding suggestion: things that do not add to
>distribution complexity should go into numpy.  If it compiles as
>easily as numpy itself, it should go into numpy where sensible.  
>

I don't think this is as feasible as it sounds at first.  Some people 
complain that NumPy is too big already.  
SciPy is very easy to install on Windows (there is a binary available).  
The only major platform that still gives some trouble is Intel Mac (due 
to the fortran compiler situation).   But, all you need is one person 
who can build it and distribute a binary.

I think a better long-term solution is to understand how to package 
things better by working with people at Enthought so that when you 
advertise to the ex-Matlab user you point him to a "super-package" that 
installs a bunch of other small packages.  This is a more maintainable 
solution as long as we set standards for

1) documentation
2) tests
3) some kind of problem-domain hierarchy

The idea of just lumping more an more things into NumPy itself is not a 
good idea.  What most users want is something that installs easily (like 
Enthon).   How it is packaged is not as important.  What developers need 
is a sane multi-namespace system that can be maintained separately if 
needed.

I think we decided a while ago, that the package approach should contain 
indicators as to whether or not a fortran compiler was needed to build 
the system so that dependency on those things could be eliminated if 
needed. 

Do we want to pull scipy apart  into two components:  one that needs 
Fortran to build and another that doesn't? 

Perhaps that is the best way to move forward along with the work on a 
"pylab" super-package.

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread A. M. Archibald
On 05/10/06, Greg Willden <[EMAIL PROTECTED]> wrote:

> That is a much better policy in my view.
>
> I (gently) encourage this group (Travis?) to make this the policy for
> Numpy/Scipy.
>
> From my view as a newbie to numpy/scipy/matplotlib it isn't clear where I
> should look for what functionality.  Matplotlib plots the spectrogram but it
> only supports two or three window functions.  Numpy supports 4 or 5 window
> functions and Scipy apparently supports more but Matplotlib doesn't support
> Scipy.  Of course this is a minor example and I could just write the window
> function myself and then use it in Matplotlib but I want to give back so
> that the project can grow.  I'd really like to be able to leave Matlab
> behind and encourage everyone else to do the same but there are still these
> annoyances that need to be worked out.

Unfortunately, that policy (put it in numpy if it doesn't make the
build dependencies any worse) makes it even harder for the user to
figure out what is where. Say I want a fast matrix product. Do I look
in numpy or scipy? It'll run faster if it uses a tuned BLAS, so it
ought to have external requirements, so I'd look in scipy, but maybe
there's a simple non-tuned implementation in numpy instead...

Frankly, I tend to prefer the other approach to solving all these
issues: distribute numpy, scipy, and matplotlib as one bundle. The
requirements for scipy are not particularly onerous, particularly if
it comes as part of your distribution. There are currently some
problems successfully finding optimized versions of LAPACK and BLAS,
but to me the benefits of bundling the packages together outweigh the
difficulties:

* routines and objects can be in the package in which they make the
most semantic sense, rather than the one with the correct external
dependencies (how is a user supposed to know whether convolution uses
an external library or not?)

* documentation can be cross-referenced between packages (so the
Matrix class can tell people to look in scipy.linalg for inverses, for
example)

* users can more easily find what's available rather than rewriting from scratch

* derived packages (ipython, IDEs, MATLAB-alikes) have many fewer
possibilities to support

I'm not arguing that the development processes need to be connected,
just that making the primary distributed object a package containing
all the components will make life easier for everyone involved.

A. M. Archibald

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Robert Kern
Greg Willden wrote:

>  From my view as a newbie to numpy/scipy/matplotlib it isn't clear where 
> I should look for what functionality.  Matplotlib plots the spectrogram 
> but it only supports two or three window functions.  Numpy supports 4 or 
> 5 window functions and Scipy apparently supports more but Matplotlib 
> doesn't support Scipy.

That's not true. specgram() takes a windowing function. It doesn't matter where 
that function comes from.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/5/06, John Hunter <[EMAIL PROTECTED]> wrote:
I prefer Perry's longstanding suggestion: things that do not add todistribution complexity should go into numpy.  If it compiles aseasily as numpy itself, it should go into numpy where sensible.  Itremains a fact of life that numpy gets a wider distribution than
scipy, and some packages are hesitant to require scipy as a prereqbecause of the additional complexity or building fortran, etc.  Iwould be nice to have as much as possible in the most widelydistributed package IMO.
That is a much better policy in my view.I (gently) encourage this group (Travis?) to make this the policy for Numpy/Scipy.From my view as a newbie to numpy/scipy/matplotlib it isn't clear where I should look for what functionality.  Matplotlib plots the spectrogram but it only supports two or three window functions.  Numpy supports 4 or 5 window functions and Scipy apparently supports more but Matplotlib doesn't support Scipy.  Of course this is a minor example and I could just write the window function myself and then use it in Matplotlib but I want to give back so that the project can grow.  I'd really like to be able to leave Matlab behind and encourage everyone else to do the same but there are still these annoyances that need to be worked out.
ThanksGreg-- Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] zip safe egg?

2006-10-05 Thread Bryce Hendrix




Robert Kern wrote:

  
Perhaps the best solution is to complain to the setuptools list, I'm 
just looking for a quick fix for now.

  
  
Patch setup.py in our build system, I would think.

  


Thats what I did, but patching working copies of files has been
troublesome in the past when svn conflicts have wiggled their way into
shipped builds.


  What revision of numpy and what version of setuptools are you using? setuptools 
0.7a1 and numpy r3261 correctly recognizes numpy as not zip-safe.

  


0.6c3. I think 0.6c1 did _not_ tag it as zip safe either. Guess I'll
just update setuptools on our build system.

Bryce


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] zip safe egg?

2006-10-05 Thread Robert Kern
Bryce Hendrix wrote:
> Robert Kern wrote:
>> It is not zip-safe if you want to compile against the headers. That keyword 
>> can't be added to the setup() call in the trunk's setup.py because numpy 
>> cannot 
>> depend on setuptools, at the moment.
>>
> Adding the keyword does not break builds not using setuptools, the build 
> just prints a warning that its not a valid keyword. I just discovered 
> this is also an issue for scipy eggs when building with weave.

A warning is not really acceptable in the trunk, either. We've found that 
warnings during the build process tend to make people think that something went 
wrong.

> Perhaps the best solution is to complain to the setuptools list, I'm 
> just looking for a quick fix for now.

Patch setup.py in our build system, I would think.

What revision of numpy and what version of setuptools are you using? setuptools 
0.7a1 and numpy r3261 correctly recognizes numpy as not zip-safe.

zip_safe flag not set; analyzing archive contents...
numpy._import_tools: module references __file__
numpy._import_tools: module references __path__
numpy.version: module references __file__
numpy.core.generate_array_api: module references __file__
numpy.core.setup: module references __file__
numpy.distutils.exec_command: module references __file__
numpy.distutils.misc_util: module references __file__
numpy.distutils.system_info: module references __file__
numpy.distutils.command.build_src: module references __file__
numpy.f2py.diagnose: module references __file__
numpy.f2py.f2py2e: module references __file__
numpy.f2py.setup: module references __file__
numpy.f2py.lib.wrapper_base: module references __file__
numpy.lib.utils: module MAY be using inspect.getsource
numpy.lib.utils: module MAY be using inspect.getsourcefile
numpy.numarray.util: module references __file__
numpy.testing.numpytest: module references __file__

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] zip safe egg?

2006-10-05 Thread Bryce Hendrix
Robert Kern wrote:
> It is not zip-safe if you want to compile against the headers. That keyword 
> can't be added to the setup() call in the trunk's setup.py because numpy 
> cannot 
> depend on setuptools, at the moment.
>
>   
Adding the keyword does not break builds not using setuptools, the build 
just prints a warning that its not a valid keyword. I just discovered 
this is also an issue for scipy eggs when building with weave.

Perhaps the best solution is to complain to the setuptools list, I'm 
just looking for a quick fix for now.

Bryce

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] zip safe egg?

2006-10-05 Thread Robert Kern
Bryce Hendrix wrote:
> Is anyone using the numpy egg compressed? Recent versions of setuptools 
> seem to think it is zip safe, but this causes builds to fail which 
> compile with the numpy headers. Can we change the setup.py to default to 
> not zip safe (by adding zip_safe=False as a keyword arg to the setup 
> function call)?

It is not zip-safe if you want to compile against the headers. That keyword 
can't be added to the setup() call in the trunk's setup.py because numpy cannot 
depend on setuptools, at the moment.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] zip safe egg?

2006-10-05 Thread Bryce Hendrix
Is anyone using the numpy egg compressed? Recent versions of setuptools 
seem to think it is zip safe, but this causes builds to fail which 
compile with the numpy headers. Can we change the setup.py to default to 
not zip safe (by adding zip_safe=False as a keyword arg to the setup 
function call)?

Bryce

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Tim Hochberg
Ivan Vilata i Balaguer wrote:
> En/na Tim Hochberg ha escrit::
>
>   
>> Ivan Vilata i Balaguer wrote:
>> 
>>> It seemed that discontiguous arrays worked OK in Numexpr since r1977 or
>>> so, but I have come across some alignment or striding problems which can
>>> be seen with the following code::
>>>   
>> I looked at this just a little bit and clearly this bit from interp_body 
>> cannot work in the presence of recor arrays:
>>
>> //
>> intp sf1 = sb1 / sizeof(double);\
>> //...
>> #define f1((double *)x1)[j*sf1]
>>
>> There are clearly some assumptions that sb1 is evenly divisible by 
>> sizeof(double). [...]
>> 
>
> I noticed something strange in those statements when implementing
> support for strings, and I must confess that I didn't grasp their
> meaning, so I implemented it a little differently for strings::
>
> #define s1((char   *)x1 + j*params.memsteps[arg1])
>   
I believe that these approaches are the same as long as memstep is a 
multiple of itemsize. I chose the indexing rather than the pointer foo 
version[1] because there's a rumor that compilers will sometimes 
generate faster code for it. One additional potential slowdown in the 
above is the compiler may not be able to tell that memsteps[arg1]) is 
constant and may do that lookup repeatedly. Or maybe not, I try not to 
second guess compilers too much.

-tim



[1] I'm pretty sure I used the pointer foo version at least for a while. 
and may have gone back and forth several times.

> That seemed to work, but it might not be right (though I tested a bit),
> and certainly it may not be efficient enough.  Here you have my previous
> patches if you want to have a look at how I (try to) do it:
>
> 1.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg01551.html
> 2.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg02261.html
> 3.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg02644.html
>
> ::
>
>   Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
>  Cárabos Coop. V.  V  V   Enjoy Data
> ""
>
>   
> 
>
> -
> Take Surveys. Earn Cash. Influence the Future of IT
> Join SourceForge.net's Techsay panel and you'll get the chance to share your
> opinions on IT & business topics through brief surveys -- and earn cash
> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
> 
>
> ___
> Numpy-discussion mailing list
> Numpy-discussion@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>   



-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread John Hunter
> "Robert" == Robert Kern <[EMAIL PROTECTED]> writes:

Robert> IMO, I'd rather see this and similar functions go into
Robert> scipy. New functions that apply semantics to arrays (in
Robert> this case, treating them as time series), I think should
Robert> go into scipy. New functions that treat arrays simply as
Robert> arrays and are generally useful can probably go into
Robert> numpy.

I prefer Perry's longstanding suggestion: things that do not add to
distribution complexity should go into numpy.  If it compiles as
easily as numpy itself, it should go into numpy where sensible.  It
remains a fact of life that numpy gets a wider distribution than
scipy, and some packages are hesitant to require scipy as a prereq
because of the additional complexity or building fortran, etc.  I
would be nice to have as much as possible in the most widely
distributed package IMO.

JDH

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Ivan Vilata i Balaguer
En/na Tim Hochberg ha escrit::

> Tim Hochberg wrote:
 Ivan Vilata i Balaguer wrote:
> It seemed that discontiguous arrays worked OK in Numexpr since 
> r1977 or
> so, but I have come across some alignment or striding problems 
> which can
> be seen with the following code::
> OK, I've checked in a fix for this that makes a copy when the array is 
> not strided in an even multiple of the itemsize. I first tried copying 
> for all discontiguous array, but this resulted in a large speed hit for 
> vanilla strided arrays (a=arange(10)[::2], etc.), so I was more frugal 
> with my copying. I'm not entirely certain that I caught all of the 
> problematic cases, so let me know if you run into any more issues like this.

Great!  For the moment I just can say that the problems I had with that
have disappeared, but I will keep you up to date if I find something
else.  Thank you very much!

::

Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
   Cárabos Coop. V.  V  V   Enjoy Data
  ""



signature.asc
Description: OpenPGP digital signature
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/5/06, Robert Kern <[EMAIL PROTECTED]> wrote:
IMO, I'd rather see this and similar functions go into scipy. New functions thatapply semantics to arrays (in this case, treating them as time series), I thinkshould go into scipy. New functions that treat arrays simply as arrays and are
generally useful can probably go into numpy.Okay I'll take a look at the Scipy parts tonight.So do you cancel that ticket I created or do I attach a new patch against scipy or what?
ThanksGreg-- Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Robert Kern
Greg Willden wrote:
> On 10/4/06, *Travis Oliphant* <[EMAIL PROTECTED] 
> > wrote:
> 
> Great contribution.  Thanks a bunch.  I think this will probably go into
> the scipy package, though.  There is already a lot of windows available
> in the scipy.signal.window function.
> 
> BTW.  Is there some sort of clear statement about what goes in Scipy 
> versus what goes in Numpy?  It's a bit confusing for this newbie.

IMO, I'd rather see this and similar functions go into scipy. New functions 
that 
apply semantics to arrays (in this case, treating them as time series), I think 
should go into scipy. New functions that treat arrays simply as arrays and are 
generally useful can probably go into numpy.

There's some grey area in this scheme, of course. New non-uniform random number 
generators might need to go into numpy, for now, simply due to technical 
reasons. Fleshing out the masked array and matrix classes would be similar, I 
imagine.

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
  that is made terrible by our own mad attempt to interpret it as though it had
  an underlying truth."
   -- Umberto Eco


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/4/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
Great contribution.  Thanks a bunch.  I think this will probably go intothe scipy package, though.  There is already a lot of windows availablein the scipy.signal.window function.BTW.  Is there some sort of clear statement about what goes in Scipy versus what goes in Numpy?  It's a bit confusing for this newbie.
ThanksGreg-- Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Travis Oliphant
Tim Hochberg wrote:

>>>  
>>>  
>>>
>>That would be easy to do. Right now the opcodes should work correctly 
>>on data that is spaced in multiples of the itemsize on the last axis. 
>>Other arrays are copied (no opcode required, it's embedded at the top 
>>of interp_body lines 64-80). The record array case apparently slips 
>>through the cracks when we're checking whether an array is suitable to 
>>be used correctly (interpreter.c 1086-1103). It would certainly not be 
>>any harder to only allow contiguous arrays than to correctly deal with 
>>record arrays. Only question I have is whether the extra copy will 
>>overwhelm the savings of that operating on contiguous data gives.  The 
>>thing to do is probably try it and see what happens.
>>
>>
>
>OK, I've checked in a fix for this that makes a copy when the array is 
>not strided in an even multiple of the itemsize. I first tried copying 
>for all discontiguous array, but this resulted in a large speed hit for 
>vanilla strided arrays (a=arange(10)[::2], etc.), so I was more frugal 
>with my copying. I'm not entirely certain that I caught all of the 
>problematic cases, so let me know if you run into any more issues like this.
>
>  
>
There is an ElementStrides check and similar requirement flag you can 
use to make sure that you have an array whose strides are multiples of 
it's itemsize.

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] On loop and broadcasting (again)

2006-10-05 Thread Travis Oliphant
David Cournapeau wrote:

>Hi,
>
>   The email from Albert made me look again on some surprising results I 
>got a few months ago when starting my first "serious" numpy project. I 
>noticed that when computing multivariate gaussian densities, centering 
>the data was more expensive than everything else, including 
>exponentiation. Now that I have some experience with numpy, and 
>following the previous discussion, I tried the following script:
>  
>

Try it again with the new code in SVN.

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] On loop and broadcasting (again)

2006-10-05 Thread David Cournapeau
Hi,

   The email from Albert made me look again on some surprising results I 
got a few months ago when starting my first "serious" numpy project. I 
noticed that when computing multivariate gaussian densities, centering 
the data was more expensive than everything else, including 
exponentiation. Now that I have some experience with numpy, and 
following the previous discussion, I tried the following script:

import numpy
from numpy.random import randn

import numpy as N

def center_broadcast(X, mu):
   return X - mu

def center_broadcast2(X, mu):
   return N.transpose(X.T - mu.T)

def center_repmat(X, mu):
   n   = X.shape[0]
   return X - N.repmat(mu, n, 1)

def center_outer(X, mu):
   n   = X.shape[0]
   return X - N.outer(N.ones(n), mu)

def center_dot(X, mu):
   n   = X.shape[0]
   return X - N.dot(N.ones((n, 1)), mu[N.newaxis, :])

def center_manual(X, mu):
   return X - mu

def bench():
   n   = 1e5
   d   = 30
   niter   = 10

   X   = randn(n, d)
   mu  = randn(d)
   va  = randn(d) ** 2

   mur = N.repmat(mu, n, 1)

   for i in range(niter):
   y1  = center_broadcast(X, mu)
   y2  = center_repmat(X, mu)
   y3  = center_dot(X, mu)
   y4  = center_outer(X, mu)
   y5  = center_manual(X, mur)
   y6  = center_broadcast2(X, mur)

if __name__ == '__main__':
   import hotshot, hotshot.stats
   profile_file= 'storage.prof'
   prof= hotshot.Profile(profile_file, lineevents=1)
   prof.runcall(bench)
   p = hotshot.stats.load(profile_file)
   print p.sort_stats('cumulative').print_stats(20)
   prof.close()


If X is an array containing n samples of d dimension,  and mu an array 
with d elements, I want to compute x - mu, for each row x of X. The idea 
is to compare timing of "manual broadcasting" using repmat vs 
broadcasting, and storage influence:
- center_broadcast expect mu to be a d elements array, and uses the 
numpy broadcast rules
- center_broadcast2 expect same args, but tranpose to force a C-like 
storage.
- center_repmat uses repmat instead of the automatic broadcast to make 
mu a (n, d) array with n times the same row
- center_outer and center_dot implements manually the repmat using 
matrix product (under matlab, this was much faster on large matrices)
- center_manual expects mu to be already in a (n, d) form with n times 
the same row: this is to see the cost of the substraction itself.

The results are the following:

  104.2040.4204.2040.420 
storage_email.py:8(center_broadcast)
  100.4750.0483.4490.345 
storage_email.py:18(center_outer)
  102.9640.2962.9640.296 
/usr/lib/python2.4/site-packages/numpy/core/numeric.py:227(outer)
  102.7670.2772.7680.277 
storage_email.py:11(center_broadcast2)
  100.4850.0491.2880.129 
storage_email.py:14(center_repmat)
  101.2170.1221.2270.123 
storage_email.py:22(center_dot)
  110.8830.0800.8830.080 
/usr/lib/python2.4/site-packages/numpy/lib/shape_base.py:522(repmat)
  100.4570.0460.4570.046 
storage_email.py:26(center_manual)
   50.1370.0270.1370.027 
/usr/lib/python2.4/site-packages/numpy/core/fromnumeric.py:375(sum)
  200.0200.0010.0200.001 
/usr/lib/python2.4/site-packages/numpy/core/numeric.py:527(ones)
  310.0000.0000.0000.000 
/usr/lib/python2.4/site-packages/numpy/core/numeric.py:125(asarray)
  100.0000.0000.0000.000 
/usr/lib/python2.4/site-packages/numpy/core/fromnumeric.py:116(transpose)

As you can see, there is a quite a difference between implementations: 
using repmat is the fastest, with repmat taking twice as much time as 
the substraction itself. Replacing repmat with dot does not give any 
advantage (I guess the underlying implementation uses the same core C 
functions ?). Is it expected than automatic broadcast is so much 
expensive ? And why using tranpose gives a 40% speed improvement ? What 
makes automatic broadcast so expensive compared to repmat ?

For what it worths, the substraction itself is as fast as in matlab, 
whereas the repmat is twice slower (this quick script is not meant as a 
comparison against matlab of course, but I just wanted to check how 
matlab behaves in those situations),

David

-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Vectorizing code, for loops, and all that

2006-10-05 Thread Travis Oliphant
Travis Oliphant wrote:

>Albert Strasheim wrote:
>  
>
[1] 12.97% of function time
[2] 8.65% of functiont ime
[3] 62.14% of function time

If statistics from elsewhere in the code would be helpful, let me 
know,
  


>>>and
>>>
>>>  
>>>
I'll see if I can convince Quantify to cough it up.

  


>>>Please run the same test but using
>>>
>>>x1 = N.random.rand(39,2000)
>>>x2 = N.random.rand(39,64,1)
>>>
>>>z1 = x1[:,N.newaxis,:] - x2
>>>
>>>  
>>>
>>Very similar results to what I had previously:
>>
>>[1] 10.88%
>>[2] 7.25%
>>[3] 68.25%
>>
>>  
>>
>>
>Thanks,
>
>I've got some ideas about how to speed this up by eliminating some of 
>the unnecessary calculations  going on outside of the function loop, but 
>there will still be some speed issues depending on how the array is 
>traversed once you get above a certain size.   I'm not sure there anyway 
>around that, ultimately, due to memory access being slow on most hardware. 
>  
>

Well, I tried out my ideas and didn't get much improvement (8-10%).  
Then, I finally realized more fully that the slowness was due to the 
loop taking place over an axis which had a very large stride so that the 
memory access was taking a long time. 

Thus, instead of picking the loop axis to correspond to the axis with 
the longest dimension, I've picked the loop axis to be one with the 
smallest sum of strides.

In this particular example, the speed-up is about 6-7 times...

-Travis


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Tim Hochberg
Tim Hochberg wrote:
> David M. Cooke wrote:
>> On Wed, 04 Oct 2006 10:19:08 -0700
>> Tim Hochberg <[EMAIL PROTECTED]> wrote:
>>
>>  
>>> Ivan Vilata i Balaguer wrote:
>>>
 It seemed that discontiguous arrays worked OK in Numexpr since 
 r1977 or
 so, but I have come across some alignment or striding problems 
 which can
 be seen with the following code::
   
>>> I looked at this just a little bit and clearly this bit from 
>>> interp_body cannot work in the presence of recor arrays:
>>>
>>> //
>>> intp sf1 = sb1 / sizeof(double);\
>>> //...
>>> #define f1((double *)x1)[j*sf1]
>>>
>>>
>>> There are clearly some assumptions that sb1 is evenly divisible by 
>>> sizeof(double). Blech!. This is likely my fault, and I expect it 
>>> won't be too horrible to fix, but I don't know that I'll have time 
>>> immediately.
>>> 
>>
>> My thinking is that this should be handled by a copy, so that the 
>> opcodes
>> always work on contiguous data. The copy can be another opcode. One 
>> advantage
>> of operating on contiguous data is that it's easier to use the 
>> processor's
>> vector instructions, if applicable.
>>   
>
> That would be easy to do. Right now the opcodes should work correctly 
> on data that is spaced in multiples of the itemsize on the last axis. 
> Other arrays are copied (no opcode required, it's embedded at the top 
> of interp_body lines 64-80). The record array case apparently slips 
> through the cracks when we're checking whether an array is suitable to 
> be used correctly (interpreter.c 1086-1103). It would certainly not be 
> any harder to only allow contiguous arrays than to correctly deal with 
> record arrays. Only question I have is whether the extra copy will 
> overwhelm the savings of that operating on contiguous data gives.  The 
> thing to do is probably try it and see what happens.

OK, I've checked in a fix for this that makes a copy when the array is 
not strided in an even multiple of the itemsize. I first tried copying 
for all discontiguous array, but this resulted in a large speed hit for 
vanilla strided arrays (a=arange(10)[::2], etc.), so I was more frugal 
with my copying. I'm not entirely certain that I caught all of the 
problematic cases, so let me know if you run into any more issues like this.

-tim


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Hello and my first patch

2006-10-05 Thread Greg Willden
On 10/4/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:
Not really, because these functions were in *both* Numeric andnumarray.  That's the trouble.And the multiple scipy packages situation needs more discussion Weare all ears...Well I started here because I have been using the Matplotlib package and it uses these compatibility functions.  So I wanted more window functions available for calls to specgram.
This does bring up a frustration for users new to scipy/numpy/matplotlib.  In short, that there are three packages.  I know the historical reasons why but I hope that the ultimate destination is a tight integration among these packages.  I hope to help out toward that goal.
ThanksGreg-- Linux.  Because rebooting is for adding hardware.
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


Re: [Numpy-discussion] Problems with Numexpr and discontiguous arrays

2006-10-05 Thread Ivan Vilata i Balaguer
En/na Tim Hochberg ha escrit::

> Ivan Vilata i Balaguer wrote:
>> It seemed that discontiguous arrays worked OK in Numexpr since r1977 or
>> so, but I have come across some alignment or striding problems which can
>> be seen with the following code::
> I looked at this just a little bit and clearly this bit from interp_body 
> cannot work in the presence of recor arrays:
> 
> //
> intp sf1 = sb1 / sizeof(double);\
> //...
> #define f1((double *)x1)[j*sf1]
> 
> There are clearly some assumptions that sb1 is evenly divisible by 
> sizeof(double). [...]

I noticed something strange in those statements when implementing
support for strings, and I must confess that I didn't grasp their
meaning, so I implemented it a little differently for strings::

#define s1((char   *)x1 + j*params.memsteps[arg1])

That seemed to work, but it might not be right (though I tested a bit),
and certainly it may not be efficient enough.  Here you have my previous
patches if you want to have a look at how I (try to) do it:

1.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg01551.html
2.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg02261.html
3.http://www.mail-archive.com/numpy-discussion%40lists.sourceforge.net/msg02644.html

::

Ivan Vilata i Balaguer   >qo<   http://www.carabos.com/
   Cárabos Coop. V.  V  V   Enjoy Data
  ""



signature.asc
Description: OpenPGP digital signature
-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


[Numpy-discussion] compatibility of extension modules

2006-10-05 Thread Christian Kristukat
Hi,
i've got problems running a numpy/scipy extension module (scipy.sandbox.odr)
built with cygwin/mingw32 on XP on other machines (windows 2000). I get those
very informative 'windows encountered a problem' messages when calling the
extension module - importing seems to work.
Is there any optimization done in the build process which creates
incompatibilities between different systems? And if yes, how can I turn them 
of? 
Regards, Christian 


-
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
___
Numpy-discussion mailing list
Numpy-discussion@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion