Re: [Numpy-discussion] Can not update a submatrix

2008-01-31 Thread Nadav Horesh
Thanks for your explanation. It explains also the following: >>> R = N.arange(9).reshape(3,3) >>> ax = [0,2] >>> U = R[ax,:] >>> U array([[0, 1, 2], [6, 7, 8]]) >>> U[:] = 100 >>> U array([[100, 100, 100], [100, 100, 100]]) >>> R# No change since U is a copy array([[0, 1, 2],

[Numpy-discussion] blcr checkpoint/restart

2008-01-31 Thread Neal Becker
Hi numeric processing fans. I'm pleased to report that you can now have convenient checkpoint/restart, at least if you are running fedora linux. Berkeley Lab Checkpoint/Restart for Linux (BLCR) http://ftg.lbl.gov/CheckpointRestart/CheckpointDownloads.shtml What I've done is: 1) built 2 rpm pack

Re: [Numpy-discussion] Can not update a submatrix

2008-01-31 Thread Francesc Altet
A Wednesday 30 January 2008, Timothy Hochberg escrigué: > [...a fine explanation by Anne and Timothy...] Ok. As it seems that this subject has interest enough, I went ahead and created a small document about views vs copies at: http://www.scipy.org/Cookbook/ViewsVsCopies I think it resumes what

[Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hi, The following gives the wrong answer: In [2]: A = array(['a','aa','b']) In [3]: B = array(['d','e']) In [4]: A.searchsorted(B) Out[4]: array([3, 0]) The answer should be [3,3]. I've come across this while trying to come up with an ismember function which works for strings (setmember1d does

Re: [Numpy-discussion] [numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hi, OK, i'm using: In [6]: numpy.__version__ Out[6]: '1.0.3' Should I try the development version? Which version of numpy would people generally recommend? James ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.scipy.org/mai

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread lorenzo bolla
works fine for me. In [33]: A = numpy.array(['a','aa','b']) In [34]: B = numpy.array(['d','e']) In [35]: A.searchsorted(B) Out[35]: array([3, 3]) In [36]: numpy.__version__ Out[36]: '1.0.5.dev4567' L. On 1/31/08, James Philbin <[EMAIL PROTECTED]> wrote: > > Hi, > > The following gives th

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hmmm. Just downloaded and installed 1.0.4 and i'm still getting this error. Are you guys using the bleeding edge version or the official 1.0.4 tarball from the webpage? James ___ Numpy-discussion mailing list Numpy-discussion@scipy.org http://projects.sc

[Numpy-discussion] [numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hi, The following gives the wrong answer: In [2]: A = array(['a','aa','b']) In [3]: B = array(['d','e']) In [4]: A.searchsorted(B) Out[4]: array([3, 0]) The answer should be [3,3]. I've come across this while trying to come up with an ismember function which works for strings (setmember1d does

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Nadav Horesh
It works fine also for me (numpy 1.04 gentoo linux on amd64) Nadav On Thu, 2008-01-31 at 15:51 +0100, lorenzo bolla wrote: > works fine for me. > > > In [33]: A = numpy.array(['a','aa','b']) > > In [34]: B = numpy.array(['d','e']) > > In [35]: A.searchsorted(B) > Out[35]: array([3, 3]) > >

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread lorenzo bolla
I use a dev version (1.0.5.dev4567). L. On 1/31/08, James Philbin <[EMAIL PROTECTED]> wrote: > > Hmmm. Just downloaded and installed 1.0.4 and i'm still getting this > error. Are you guys using the bleeding edge version or the official > 1.0.4 tarball from the webpage? > > James > ___

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hi, Just tried with numpy from svn and still get this problem: >>> import numpy >>> numpy.__version__ '1.0.5.dev4763' >>> A = numpy.array(['a','aa','b']) >>> B = numpy.array(['d','e']) >>> A.searchsorted(B) array([3, 0]) I guess this must be a platform-dependent bug. I'm running python version: P

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Matthieu Brucher
No problem for me (also a svn version) : Python 2.5.1 (r251:54863, Oct 30 2007, 13:54:11) [GCC 4.1.2 20070925 (Red Hat 4.1.2-33)] on linux2 >>> import numpy >>> A = numpy.array(['a','aa','b']) >>> B = numpy.array(['d','e']) >>> A.searchsorted(B) array([3, 3]) Matthieu 2008/1/31, lorenzo bolla <

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Robin
I do get the problem with a recent(ish) svn, on OS X 10.5.1, python 2.5.1 (from python.org): In [76]: A = array(['a','aa','b']) In [77]: B = array(['d','e']) In [78]: A.searchsorted(B) Out[78]: array([3, 0]) In [79]: numpy.__version__ Out[79]: '1.0.5.dev4722' __

[Numpy-discussion] matrix <-> ndarray bug

2008-01-31 Thread dmitrey
I don't know, maybe it's already fixed in more recent versions? >>> from numpy import * >>> a=mat('1 2') >>> b = asfarray(a).flatten() >>> print b[0] [[ 1. 2.]] # ^^ I expected getting 1.0 here >>> numpy.version.version '1.0.3' ___ Numpy-discuss

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Bruce Southey
Hi, With my system running x86_64 SUSE10.0 AMD opteron: Under Python 2.5.1 (Python 2.5.1 -r251:54863) and numpy 1.0.4 (download of released version) I have the same bug. Under Python 2.4.1 (May 25 2007, 18:41:31) and numpy 1.0.3 I have no problem. Perhaps a 32/64 bit problem? Bruce On Jan 31, 2

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Hans Meine
Am Donnerstag, 31. Januar 2008 15:35:25 schrieb James Philbin: > The following gives the wrong answer: > > In [2]: A = array(['a','aa','b']) > > In [3]: B = array(['d','e']) > > In [4]: A.searchsorted(B) > Out[4]: array([3, 0]) > > The answer should be [3,3]. Heh, I got both answers in the same ses

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Alan G Isaac
Problem also with Windows P3 binaries. fwiw, Alan Isaac Python 2.5.1 (r251:54863, Apr 18 2007, 08:51:08) [MSC v.1310 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> numpy.__version__ '1.0.4' >>> A = numpy.array(['a','aa','b']) >

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread lorenzo bolla
from docstring in multiarraymodule.c /** @brief Use bisection of sorted array to find first entries >= keys. * * For each key use bisection to find the first index i s.t. key <= arr[i]. * When there is no such index i, set i = len(arr). Return the results in ret. * All arrays are assumed conti

Re: [Numpy-discussion] matrix <-> ndarray bug

2008-01-31 Thread Alan G Isaac
On Thu, 31 Jan 2008, dmitrey apparently wrote: > already fixed in more recent versions? Yes, at least it's fixed in my 1.0.4. By the way, do you know about the ``A`` attribute of matrices? Cheers, Alan Isaac ___ Numpy-discussion mailing list Numpy-

Re: [Numpy-discussion] matrix <-> ndarray bug

2008-01-31 Thread dmitrey
Alan G Isaac wrote: > On Thu, 31 Jan 2008, dmitrey apparently wrote: > >> already fixed in more recent versions? >> > > Yes, at least it's fixed in my 1.0.4. > > By the way, do you know about the ``A`` attribute of matrices? > Yes, I know, but numpy.ndarray has no the attribute (I had s

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread lorenzo bolla
oops. it fails also on an SGI Altix with Suse Linux on it: Linux pico 2.6.16.27-0.9-default #1 SMP Tue Feb 13 09:35:18 UTC 2007 ia64 ia64 ia64 GNU/Linux In [33]: A = numpy.array(['a','aa','b']) In [34]: B = numpy.array(['d','e']) In [35]: A.searchsorted

[Numpy-discussion] Accepted Numpy Core Datatype Formats

2008-01-31 Thread Mack Smith
Where can I find a list of accepted tokens for the Numpy Core formats as used in numpy.core.rec.fromfile for instance. I'm working with a binary file format that includes single byte buffers and other formats that I need to correctly parse. Any help would be appreciated. Thanks in advance. M

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Christopher Barker
lorenzo bolla wrote: > * All arrays are assumed contiguous on entry and both arr and key must > be of<- > * the same comparable type. <- > > A and B are not of the same type ('|S2' is not '|S1'). > This should be mentioned somewhere more accessible. It should also raise an excepti

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Hi, > In particular: > > * All arrays are assumed contiguous on entry and both arr and key must be > of<- > * the same comparable type. <- In which case, this seems to be an overly strict implementation of searchsorted. Surely all that should be required is that the comparison functi

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Charles R Harris
On Jan 31, 2008 9:17 AM, lorenzo bolla <[EMAIL PROTECTED]> wrote: > from docstring in multiarraymodule.c > > /** @brief Use bisection of sorted array to find first entries >= keys. > * > * For each key use bisection to find the first index i s.t. key <= > arr[i]. > * When there is no such index

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
Well, i've digged around in the source code and here is a patch which makes it work for the case I wanted: --- multiarraymodule.c.old 2008-01-31 17:42:32.0 + +++ multiarraymodule.c 2008-01-31 17:43:43.0 + @@ -2967,7 +2967,10 @@ char *parr = arr->data; char *

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Charles R Harris
On Jan 31, 2008 10:33 AM, James Philbin <[EMAIL PROTECTED]> wrote: > Hi, > > > In particular: > > > > * All arrays are assumed contiguous on entry and both arr and key must > be > > of<- > > * the same comparable type. <- > In which case, this seems to be an overly strict implementat

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
> True. The problem is knowing when that is the case. The subroutine in > question is at the bottom of the heap and don't know nothin'. IIRC, it just > sits there and does the comparison by calling through a pointer with char* > arguments. What does the comparison function actually look like for t

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Charles R Harris
On Jan 31, 2008 10:49 AM, James Philbin <[EMAIL PROTECTED]> wrote: > Well, i've digged around in the source code and here is a patch which > makes it work for the case I wanted: > > --- multiarraymodule.c.old 2008-01-31 17:42:32.0 + > +++ multiarraymodule.c 2008-01-31 17:43:43.00

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Charles R Harris
On Jan 31, 2008 10:55 AM, James Philbin <[EMAIL PROTECTED]> wrote: > > True. The problem is knowing when that is the case. The subroutine in > > question is at the bottom of the heap and don't know nothin'. IIRC, it > just > > sits there and does the comparison by calling through a pointer with >

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Travis E. Oliphant
James Philbin wrote: > I can't fathom where the comparison functions exist in the code. It > seems that the comparison signature is of the form (void*, void*, > PyArrayObject*), so it doesn't seem possible at the moment to specify > a compare function which can reason about the underlying types of

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread James Philbin
I can't fathom where the comparison functions exist in the code. It seems that the comparison signature is of the form (void*, void*, PyArrayObject*), so it doesn't seem possible at the moment to specify a compare function which can reason about the underlying types of the two void*'s. However, I t

Re: [Numpy-discussion] searchsorted bug

2008-01-31 Thread Travis E. Oliphant
James Philbin wrote: > I can't fathom where the comparison functions exist in the code. It > seems that the comparison signature is of the form (void*, void*, > PyArrayObject*), so it doesn't seem possible at the moment to specify > a compare function which can reason about the underlying types of