Re: [Numpy-discussion] svn numpy not building on osx 10.5.6, python.org python 2.5.2

2009-06-06 Thread David Cournapeau
George Nurser wrote: > running config_fc > unifing config_fc, config, build_clib, build_ext, build commands > --fcompiler options > running build_clib > customize UnixCCompiler > customize UnixCCompiler using build_clib > building 'npymath' library > compiling C sources > C compiler: gcc -arch ppc

Re: [Numpy-discussion] reciprocal(0)

2009-06-06 Thread Ralf Gommers
You're right, that's a little inconsistent. I would also prefer to get an overflow for divide by 0 rather than casting to zero. - ralf On Sun, Jun 7, 2009 at 12:22 AM, wrote: > On Sat, Jun 6, 2009 at 11:49 PM, Ralf Gommers > wrote: > > Hi, > > > > I expect `reciprocal(x)` to calculate 1/x, an

Re: [Numpy-discussion] svn numpy not building on osx 10.5.6, python.org python 2.5.2

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 5:07 PM, George Nurser wrote: > Hi, > the current svn version 7039 isn't compiling for me. > Clean checkout, old numpy directories removed from site-packages.. > Same command did work for svn r 6329 > > [george-nursers-macbook-pro-15:~/src/numpy] agn% python setup.py > confi

Re: [Numpy-discussion] reciprocal(0)

2009-06-06 Thread josef . pktd
On Sat, Jun 6, 2009 at 11:49 PM, Ralf Gommers wrote: > Hi, > > I expect `reciprocal(x)` to calculate 1/x, and for input 0 to either follow > the python rules or give the np.divide(1, 0) result. However the result > returned (with numpy trunk) is: > np.reciprocal(0) > -2147483648 > np.div

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread llewelr
Hi, On Jun 6, 2009 3:11pm, Chris Colbert wrote: it definately found your threaded atlas libraries. How do you know it's numpy is using lapack_lite? I don't, actually. But it is importing it. With python -v, this is the error I get if I don't set LD_LIBRARY_PATH to my scipy_build director

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread llewelr
Hi, On Jun 6, 2009 3:11pm, Chris Colbert wrote: it definately found your threaded atlas libraries. How do you know it's numpy is using lapack_lite? I don't, actually. But it is importing it. With python -v, this is the error I get if I don't set LD_LIBRARY_PATH to my scipy_build director

[Numpy-discussion] reciprocal(0)

2009-06-06 Thread Ralf Gommers
Hi, I expect `reciprocal(x)` to calculate 1/x, and for input 0 to either follow the python rules or give the np.divide(1, 0) result. However the result returned (with numpy trunk) is: >>> np.reciprocal(0) -2147483648 >>> np.divide(1, 0) 0 >>> 1/0 Traceback (most recent call last): File "", lin

Re: [Numpy-discussion] scipy 0.7.1rc2 released

2009-06-06 Thread Adam Mercer
On Fri, Jun 5, 2009 at 06:09, David Cournapeau wrote: > Please test it ! I am particularly interested in results for scipy > binaries on mac os x (do they work on ppc). Test suite passes on Intel Mac OS X (10.5.7) built from source: OK (KNOWNFAIL=6, SKIP=21) Cheers Adam __

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Tom K.
Fernando Perez wrote: > > On Sat, Jun 6, 2009 at 11:03 AM, Charles R > Harris wrote: > >> I don't think we can change the current matrix class, to do so would >> break >> too much code. It would be nice to extend it with an explicit inner >> product, >> but I can't think of any simple notation

Re: [Numpy-discussion] NameError: name 'numeric' is not defined

2009-06-06 Thread Robin
On Sun, Jun 7, 2009 at 12:53 AM, Robin wrote: > I haven't seen this before - is it something wrong with my build or > the current svn state? I am using macports python 2.5.4 on os x 10.5.7 Hmmm... after rebuilding from the same version the problem seems to have gone away... sorry for the noise...

[Numpy-discussion] NameError: name 'numeric' is not defined

2009-06-06 Thread Robin
Hi, I just updated to latest numpy svn: In [10]: numpy.__version__ Out[10]: '1.4.0.dev7039' It seemed to build fine, but I am getting a lot of errors testing it: -- Ran 178 tests in 0.655s FAILED (errors=138) Out[8]: Almost al

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Alan G Isaac
On 6/6/2009 6:39 PM Robert Kern apparently wrote: > Ah, that's the beauty of .flat; it takes care of that for you. .flat > is not a view onto the memory directly. It is a not-quite-a-view onto > what the memory *would* be if the array were contiguous and the memory > directly reflected the layout a

[Numpy-discussion] svn numpy not building on osx 10.5.6, python.org python 2.5.2

2009-06-06 Thread George Nurser
Hi, the current svn version 7039 isn't compiling for me. Clean checkout, old numpy directories removed from site-packages.. Same command did work for svn r 6329 [george-nursers-macbook-pro-15:~/src/numpy] agn% python setup.py config_fc --fcompiler=gnu95 build_clib --fcompiler=gnu95 build_ext --fco

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 17:34, Alan G Isaac wrote: > On 6/6/2009 6:02 PM Keith Goodman apparently wrote: >>> def fill_diag(arr, value): >>     if arr.ndim != 2: >>         raise ValueError, "Input must be 2-d." >>     if arr.shape[0] != arr.shape[1]: >>         raise ValueError, 'Input must be squar

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Alan G Isaac
On 6/6/2009 6:02 PM Keith Goodman apparently wrote: >> def fill_diag(arr, value): > if arr.ndim != 2: > raise ValueError, "Input must be 2-d." > if arr.shape[0] != arr.shape[1]: > raise ValueError, 'Input must be square.' > arr.flat[::arr.shape[1]+1] = value You might

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Keith Goodman
On Sat, Jun 6, 2009 at 2:01 PM, Robert Kern wrote: >  There is a neat trick for accessing the diagonal of an existing array > (a.flat[::a.shape[1]+1]), but it won't work to implement > diag_indices(). Perfect. That's 3x faster. def fill_diag(arr, value): if arr.ndim != 2: raise Value

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 3:00 PM, Alan G Isaac wrote: > On 6/6/2009 4:30 PM Robert Kern apparently wrote: > > The old idea of introducing RowVector and ColumnVector would help > > here. If x were a ColumnVector and A a Matrix, then you can introduce > > the following rules: > > > > x.T is a RowVect

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Alan G Isaac
> On Sat, Jun 6, 2009 at 1:59 PM, Alan G Isaac For sure GAUSS does. The result of x' * A * x > is a "matrix" (it has one row and one column) but > it functions like a scalar (and even more, > since right multiplication by it is also allowed). On 6/6/2009 4:32 PM Charles R Harr

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 16:00, Alan G Isaac wrote: > On 6/6/2009 4:30 PM Robert Kern apparently wrote: >> The old idea of introducing RowVector and ColumnVector would help >> here. If x were a ColumnVector and A a Matrix, then you can introduce >> the following rules: >> >> x.T is a RowVector >> Ro

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 13:30, Fernando Perez wrote: > On Sat, Jun 6, 2009 at 12:09 AM, Robert Kern wrote: > >> +1 > > OK, thanks.  I'll try to get it ready. > >> diag_indices() can be made more efficient, but these are fine. > > Suggestion?  Right now it's not obvious to me... Oops! Never mind. I

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Alan G Isaac
On 6/6/2009 4:30 PM Robert Kern apparently wrote: > The old idea of introducing RowVector and ColumnVector would help > here. If x were a ColumnVector and A a Matrix, then you can introduce > the following rules: > > x.T is a RowVector > RowVector * ColumnVector is a scalar > RowVector * Matrix is

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 2:30 PM, Robert Kern wrote: > On Sat, Jun 6, 2009 at 14:59, Alan G Isaac wrote: > > On 6/6/2009 2:58 PM Charles R Harris apparently wrote: > >> How about the common expression > >> exp((v.t*A*v)/2) > >> do you expect a matrix exponential here? > > > > > > I take your point

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 15:31, Bruce Southey wrote: > While not trying to be negative, this raises important questions that > need to be covered because the user should not have to do trial and > error to find what actually works and what that does not. While > certain features can be fixed within

[Numpy-discussion] Changes to arraysetops

2009-06-06 Thread Neil Crighton
Thanks for the summary! I'm +1 on points 1, 2 and 3. +0 for points 4 and 5 (assume_unique keyword and renaming arraysetops). Neil PS. I think you mean deprecate, not depreciate :) ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://ma

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 1:59 PM, Alan G Isaac wrote: > On 6/6/2009 2:58 PM Charles R Harris apparently wrote: > > How about the common expression > > exp((v.t*A*v)/2) > > do you expect a matrix exponential here? > > > I take your point that there are conveniences > to treating a 1 by 1 matrix as a

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Bruce Southey
On Sat, Jun 6, 2009 at 2:01 AM, Fernando Perez wrote: [snip] > > > def mask_indices(n,mask_func,k=0): >    """Return the indices for an array, given a masking function like > tri{u,l}.""" >    m = np.ones((n,n),int) >    a = mask_func(m,k) >    return np.where(a != 0) > > > def diag_indices(n,

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 14:59, Alan G Isaac wrote: > On 6/6/2009 2:58 PM Charles R Harris apparently wrote: >> How about the common expression >> exp((v.t*A*v)/2) >> do you expect a matrix exponential here? > > > I take your point that there are conveniences > to treating a 1 by 1 matrix as a scala

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Alan G Isaac
On 6/6/2009 2:58 PM Charles R Harris apparently wrote: > How about the common expression > exp((v.t*A*v)/2) > do you expect a matrix exponential here? I take your point that there are conveniences to treating a 1 by 1 matrix as a scalar. Most matrix programming languages do this, I think. For sur

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2009-06-06 Thread Minjae Kim
Thanks for this excellent recipe. I have not tried it out myself yet, but I will follow the instruction on clean Ubuntu 9.04 64-bit. Best, Minjae On Sat, Jun 6, 2009 at 11:59 AM, Chris Colbert wrote: > since there is demand, and someone already emailed me, I'll put what I > did in this post. I

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Chris Colbert
i need the full link to pastebin.com in order to view your post. It will be something like http://pastebin.com/m6b09f05c chris On Sat, Jun 6, 2009 at 2:32 PM, Richard Llewellyn wrote: > I posted the setup.py build output to pastebin.com, though missed the > uninteresting stderr (forgot tcsh co

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 12:34 PM, Olivier Verdier wrote: > I took that very seriously when you said that matrices were important to > you. Far from me the idea of forbidding numpy users to use matrices. > My point was the fact that newcomers are confused by the presence of both > matrices and arra

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Fernando Perez
On Sat, Jun 6, 2009 at 11:35 AM, Gael Varoquaux wrote: > I think they need examples. Right now, it is not clear at all to me what > they do. Cheers, f # With doctests, set to be repeatable by seeding the rng. def structured_rand_arr(size, sample_func=np.random.random, lt

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Alan G Isaac
On 6/6/2009 2:03 PM Charles R Harris apparently wrote: > So is eye(3)*(v.T*v) valid? If (v.T*v) is 1x1 you have incompatible > dimensions for the multiplication Exactly. So it is not valid. As you point out, to make it valid implies a loss of the associativity of matrix multiplication. Not a goo

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Keith Goodman
On Sat, Jun 6, 2009 at 11:46 AM, Keith Goodman wrote: > On Sat, Jun 6, 2009 at 11:30 AM, Fernando Perez wrote: >> On Sat, Jun 6, 2009 at 12:09 AM, Robert Kern wrote: >>> diag_indices() can be made more efficient, but these are fine. >> >> Suggestion?  Right now it's not obvious to me... > > I'm i

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Keith Goodman
On Sat, Jun 6, 2009 at 11:30 AM, Fernando Perez wrote: > On Sat, Jun 6, 2009 at 12:09 AM, Robert Kern wrote: >> diag_indices() can be made more efficient, but these are fine. > > Suggestion?  Right now it's not obvious to me... I'm interested in a more efficient way too. Here's how I plan to adap

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Fernando Perez
On Sat, Jun 6, 2009 at 11:03 AM, Charles R Harris wrote: > I don't think we can change the current matrix class, to do so would break > too much code. It would be nice to extend it with an explicit inner product, > but I can't think of any simple notation for it that python would parse. Maybe it'

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Gael Varoquaux
On Sat, Jun 06, 2009 at 11:30:37AM -0700, Fernando Perez wrote: > On Sat, Jun 6, 2009 at 12:09 AM, Robert Kern wrote: > - Any interest in also having the stuff below? I'm needing to build > structured random arrays a lot (symmetric, anti-symmetric, symmetric > with a particular diagonal, etc), an

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Olivier Verdier
I took that very seriously when you said that matrices were important to you. Far from me the idea of forbidding numpy users to use matrices. My point was the fact that newcomers are confused by the presence of both matrices and arrays. I think that there should be only one matrix/vector/tensor obj

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Richard Llewellyn
I posted the setup.py build output to pastebin.com, though missed the uninteresting stderr (forgot tcsh command to redirect both). Also, used setup.py build --fcompiler=gnu95. To be clear, I am not certain that my ATLAS libraries are not found. But during the build starting at line 95 (pastebin.c

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Fernando Perez
On Sat, Jun 6, 2009 at 8:27 AM, Keith Goodman wrote: > What do you think of passing in the array a instead of n and ndim > (diag_indices_list_2 below)? Yes, I thought of that too. I see use cases for both though. Would people prefer both, or rather a flexible interface that tries to introspect t

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Fernando Perez
On Sat, Jun 6, 2009 at 12:09 AM, Robert Kern wrote: > +1 OK, thanks. I'll try to get it ready. > diag_indices() can be made more efficient, but these are fine. Suggestion? Right now it's not obvious to me... A few more questions: - Are doctests considered enough testing for numpy, or are se

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Charles R Harris
On Sat, Jun 6, 2009 at 9:29 AM, Alan G Isaac wrote: > On 6/6/2009 12:41 AM Charles R Harris apparently wrote: > > Well, one could argue that. The x.T is a member of the dual, hence maps > > vectors to the reals. Usually the reals aren't represented by 1x1 > > matrices. Just my [.02] cents. > > Of

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Chris Colbert
and where exactly are you seeing atlas not found? during the build process, are when import numpy in python? if its the latter, you need to add a .conf file in /etc/ld.so.conf.d/ with the line /usr/local/rich/src/scipy_build/lib and then run sudo ldconfig Chris On Sat, Jun 6, 2009 at 1:42 P

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Chris Colbert
can you run this and post the build.log to pastebin.com: assuming your numpy build directory is /home/numpy-1.3.0: cd /home/numpy-1.3.0 rm -rf build python setup.py build &&> build.log Chris On Sat, Jun 6, 2009 at 1:37 PM, Richard Llewellyn wrote: > Hi Chris, >  thanks much for posting those

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Richard Llewellyn
Hi Chris, thanks much for posting those installation instructions. Seems similar to what I pieced together. I gather ATLAS not found. Oops, drank that beer too early. I copied Atlas libs to /usr/local/rich/src/scipy_build/lib. This is my site.cfg. Out of desperation I tried search_static_fir

Re: [Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Chris Colbert
when you build numpy, did you use site.cfg to tell it where to find your atlas libs? On Sat, Jun 6, 2009 at 1:02 PM, Richard Llewellyn wrote: > Hello, > > I've managed a build of lapack and atlas on Fedora 10 on a quad core, 64, > and now (...) have a numpy I can import that runs tests ok. :]    I

[Numpy-discussion] is my numpy installation using custom blas/lapack?

2009-06-06 Thread Richard Llewellyn
Hello, I've managed a build of lapack and atlas on Fedora 10 on a quad core, 64, and now (...) have a numpy I can import that runs tests ok. :]I am puzzled, however, that numpy builds and imports lapack_lite. Does this mean I have a problem with the build(s)? Upon building numpy, I see the tr

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2009-06-06 Thread Chris Colbert
since there is demand, and someone already emailed me, I'll put what I did in this post. It pretty much follows whats on the scipy website, with a couple other things I gleaned from reading the ATLAS install guide: and here it goes, this is valid for Ubuntu 9.04 64-bit (# starts a comment when wo

Re: [Numpy-discussion] matrix default to column vector?

2009-06-06 Thread Alan G Isaac
On 6/6/2009 12:41 AM Charles R Harris apparently wrote: > Well, one could argue that. The x.T is a member of the dual, hence maps > vectors to the reals. Usually the reals aren't represented by 1x1 > matrices. Just my [.02] cents. Of course that same perspective could lead you to argue that a M

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Keith Goodman
On Sat, Jun 6, 2009 at 12:01 AM, Fernando Perez wrote: > def diag_indices(n,ndim=2): >    """Return the indices to index into a diagonal. > >    Examples >     >    >>> a = np.array([[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,16]]) >    >>> a >    array([[ 1,  2,  3,  4], >           [ 5,

Re: [Numpy-discussion] performance matrix multiplication vs. matlab

2009-06-06 Thread Keith Goodman
On Fri, Jun 5, 2009 at 2:37 PM, Chris Colbert wrote: > I'll caution anyone from using Atlas from the repos in Ubuntu 9.04  as the > package is broken: > > https://bugs.launchpad.net/ubuntu/+source/atlas/+bug/363510 > > > just build Atlas yourself, you get better performance AND threading. > Buildi

Re: [Numpy-discussion] extract elements of an array that are contained in another array?

2009-06-06 Thread josef . pktd
On Sat, Jun 6, 2009 at 4:42 AM, Neil Crighton wrote: > Robert Cimrman ntc.zcu.cz> writes: > >> Anne Archibald wrote: >> >> > 1. add a keyword argument to intersect1d "assume_unique"; if it is not >> > present, check for uniqueness and emit a warning if not unique >> > 2. change the warning to an

Re: [Numpy-discussion] extract elements of an array that are contained in another array?

2009-06-06 Thread Neil Crighton
Robert Cimrman ntc.zcu.cz> writes: > Anne Archibald wrote: > > > 1. add a keyword argument to intersect1d "assume_unique"; if it is not > > present, check for uniqueness and emit a warning if not unique > > 2. change the warning to an exception > > Optionally: > > 3. change the meaning of the fun

Re: [Numpy-discussion] matrix multiplication

2009-06-06 Thread Gael Varoquaux
On Fri, Jun 05, 2009 at 06:02:09PM -0400, Alan G Isaac wrote: > I think something close to this would be possible: > add dot as an array method. > A .dot(B) .dot(C) > is not as pretty as > A * B * C > but it is much better than > np.dot(np.dot(A,B),C) > In fact it is so much bett

Re: [Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Robert Kern
On Sat, Jun 6, 2009 at 02:01, Fernando Perez wrote: > Howdy, > > I'm finding myself often having to index *into* arrays to set values. > As best I can see, in numpy functions/methods like diag or tri{u,l} > provide for the extraction of values from arrays, but I haven't found > their counterparts

[Numpy-discussion] Functions for indexing into certain parts of an array (2d)

2009-06-06 Thread Fernando Perez
Howdy, I'm finding myself often having to index *into* arrays to set values. As best I can see, in numpy functions/methods like diag or tri{u,l} provide for the extraction of values from arrays, but I haven't found their counterparts for generating the equivalent indices. Their implementations ar