[Numpy-discussion] can't import repmat from numpy

2007-04-29 Thread dmitrey
What's wrong? start python shell; from numpy import sin => all ok from numpy import repmat => Traceback (most recent call last): File "", line 1, in ImportError: cannot import name repmat D. ___ Numpy-discussion mailing list Numpy-discussion@sci

Re: [Numpy-discussion] arctan2 with complex args

2007-04-29 Thread Anne Archibald
On 29/04/07, David Goldsmith <[EMAIL PROTECTED]> wrote: > Far be it from me to challenge the mighty Wolfram, but I'm not sure that > using the *formula* for calculating the arctan of a *single* complex > argument from its real and imaginary parts makes any sense if x and/or y > are themselves compl

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Jim Jewett
On 4/29/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > On 4/29/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > > On 4/29/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > > Hmm... Maybe the conclusion to draw from this is that we shouldn't > > > make Ring a class? Maybe it ought to be a metaclass,

Re: [Numpy-discussion] arctan2 with complex args

2007-04-29 Thread David Goldsmith
Far be it from me to challenge the mighty Wolfram, but I'm not sure that using the *formula* for calculating the arctan of a *single* complex argument from its real and imaginary parts makes any sense if x and/or y are themselves complex (in particular, does Lim(formula), as the imaginary part

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Guido van Rossum
On 4/29/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > On 4/29/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > > Hmm... Maybe the conclusion to draw from this is that we shouldn't > > make Ring a class? Maybe it ought to be a metaclass, so we could ask > > isinstance(Complex, Ring)? > > Yes; all the

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Guido van Rossum
On 4/29/07, Jim Jewett <[EMAIL PROTECTED]> wrote: > Or isexample, so that we aren't locked into implementing ABCs as base classes. You don't have to use the feature even if it exists. :-) I think there are good reasons to support overriding isinstance/issubclass beyond ABCs. -- --Guido van Ross

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Jim Jewett
On 4/29/07, Steven Bethard <[EMAIL PROTECTED]> wrote: > On 4/29/07, Talin <[EMAIL PROTECTED]> wrote: > > If it were technically possible, I would recommend that this PEP have to > > run the same gauntlet that any other large library addition would, which > > is to go through a long period of commun

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Jim Jewett
On 4/29/07, Guido van Rossum <[EMAIL PROTECTED]> wrote: > Hmm... Maybe the conclusion to draw from this is that we shouldn't > make Ring a class? Maybe it ought to be a metaclass, so we could ask > isinstance(Complex, Ring)? Yes; all the ABCs are assertions about the class. (Zope interfaces do s

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Guido van Rossum
On 4/29/07, Talin <[EMAIL PROTECTED]> wrote: > Guido van Rossum wrote: > > Maybe we should stop trying to capture radically different > > mathematical number systems using classes or types, and limit > > ourselves to capturing the systems one learns in high school: C, R, Q, > > Z, and (perhaps) N (

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Guido van Rossum
On 4/29/07, Jeffrey Yasskin <[EMAIL PROTECTED]> wrote: > On 4/28/07, Baptiste Carvello <[EMAIL PROTECTED]> wrote: > > 2) In the PEP, the concepts are used *inconsistently*. Complex derives from > > Ring > > because the set of complex numbers *is a* ring. Int derives from Complex > > because > > i

Re: [Numpy-discussion] sort bug

2007-04-29 Thread Matthieu Brucher
2007/4/29, Anton Sherwood <[EMAIL PROTECTED]>: > Anton Sherwood wrote: > > I'm using eigenvectors of a graph's adjacency matrix as "topological" > > coordinates of the graph's vertices as embedded in 3space (something I > > learned about just recently). Whenever I've done this with a graph that

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread Charles R Harris
On 4/29/07, Kevin Jacobs <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> wrote: On 4/29/07, Andrew Straw <[EMAIL PROTECTED]> wrote: > > No, the nth index of a Python sequence is a[n], where n starts from > zero. Thus, if I want the nth dimension of array a, I want a.shape[n]. > > I reverted the page to

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread Kevin Jacobs <[EMAIL PROTECTED]>
On 4/29/07, Andrew Straw <[EMAIL PROTECTED]> wrote: No, the nth index of a Python sequence is a[n], where n starts from zero. Thus, if I want the nth dimension of array a, I want a.shape[n]. I reverted the page to its original form and added a couple explanatory comments about zero vs one based

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread Keith Goodman
On 4/29/07, Andrew Straw <[EMAIL PROTECTED]> wrote: > No, the nth index of a Python sequence is a[n], where n starts from > zero. Thus, if I want the nth dimension of array a, I want a.shape[n]. > > I reverted the page to its original form and added a couple explanatory > comments about zero vs one

Re: [Numpy-discussion] bug in http://www.scipy.org /NumPy for Matlab Users

2007-04-29 Thread Alan G Isaac
On Sun, 29 Apr 2007, Andrew Straw apparently wrote: > No, the nth index of a Python sequence is a[n], where n starts from > zero. Thus, if I want the nth dimension of array a, I want a.shape[n]. So now we have no seventh day of the week? Even the Python reference manual has Monday as the *fir

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread dmitrey
I think it's better to add "see remark!" inside the cells because not all people read the text from 4th column and this can lead to serious mistakes and lot of time elapsed for bug hunting. WBR, D. Andrew Straw wrote: > No, the nth index of a Python sequence is a[n], where n starts from > zero. T

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread Andrew Straw
No, the nth index of a Python sequence is a[n], where n starts from zero. Thus, if I want the nth dimension of array a, I want a.shape[n]. I reverted the page to its original form and added a couple explanatory comments about zero vs one based indexing. dmitrey wrote: > now there is > MATLAB

Re: [Numpy-discussion] arctan2 with complex args

2007-04-29 Thread lorenzo bolla
You make your point, but I would expect a behaviour similar to Mathematica or Matlab. From http://documents.wolfram.com/mathematica/functions/ArcTan "If x or y is complex, then ArcTan[x, y] gives . When , ArcTan[x, y] gives the number such that and ." Lorenzo. On 4/29/07, David Goldsmith <[EM

Re: [Numpy-discussion] sort bug

2007-04-29 Thread Anton Sherwood
> Anton Sherwood wrote: > > I'm using eigenvectors of a graph's adjacency matrix as "topological" > > coordinates of the graph's vertices as embedded in 3space (something I > > learned about just recently). Whenever I've done this with a graph that > > *does* have a good 3d embedding, using the fi

Re: [Numpy-discussion] [Python-3000] PEP 31XX: A Type Hierarchy for Numbers (and other algebraic entities)

2007-04-29 Thread Jeffrey Yasskin
On 4/28/07, Baptiste Carvello <[EMAIL PROTECTED]> wrote: > 2) In the PEP, the concepts are used *inconsistently*. Complex derives from > Ring > because the set of complex numbers *is a* ring. Int derives from Complex > because > integer are complex numbers (or, alternatively, the set of integers

Re: [Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread Keith Goodman
On 4/29/07, dmitrey <[EMAIL PROTECTED]> wrote: > now there is > MATLABNDArray Matrix > size(a,n) a.shape[n] a.shape[n] > > but it should be > size(a,n) a.shape[n-1] a.shape[n-1] I made the change. But how should we change the comment?

Re: [Numpy-discussion] arctan2 with complex args

2007-04-29 Thread David Goldsmith
I'll take a stab at this one; if I miss the mark, people, please chime in. What's "strange" here is not numpy's behavior but octave's (IMO). Remember that, over R, arctan is used in two different ways: one is simply as a map from (-inf, inf) -> (-pi/2,pi/2) - here, let's call that invtan; the

[Numpy-discussion] bug in http://www.scipy.org/NumPy_for_Matlab_Users

2007-04-29 Thread dmitrey
now there is MATLABNDArray Matrix size(a,n) a.shape[n] a.shape[n] but it should be size(a,n) a.shape[n-1] a.shape[n-1] WBR, D. ___ Numpy-discussion mailing list Numpy-discussion@scipy.org h

Re: [Numpy-discussion] sort bug

2007-04-29 Thread Charles R Harris
On 4/29/07, Anton Sherwood <[EMAIL PROTECTED]> wrote: > Anton Sherwood wrote: > I refined it slightly: > > val,vec = numpy.linalg.eig(adj) > indx = val.argsort()[-4:-1] > val = val.take(indx) > vec = vec.take(indx, axis=1) > master = zip(val, vec.T) Charles R Harris wrot

Re: [Numpy-discussion] sort bug

2007-04-29 Thread Robert Kern
Anton Sherwood wrote: >> Anton Sherwood wrote: >> I refined it slightly: >> >> val,vec = numpy.linalg.eig(adj) >> indx = val.argsort()[-4:-1] >> val = val.take(indx) >> vec = vec.take(indx, axis=1) >> master = zip(val, vec.T) > > Charles R Harris wrote: >> But that won't ge

[Numpy-discussion] arctan2 with complex args

2007-04-29 Thread lorenzo bolla
Weird behaviour with arctan2(complex,complex). Take a look at this: In [11]: numpy.arctan2(1.,1.) Out[11]: 0.785398163397 In [12]: numpy.arctan2(1j,1j) --- exceptions.AttributeErrorTraceback (mos

[Numpy-discussion] simpliest way to check: array x is float, not integer

2007-04-29 Thread dmitrey
hi all, please inform me what is the simplest way to check, does the vector x that came to my func is float or integer. I.e. someone can pass to my func for example x0 = numpy.array([1, 0, 0]) and it can yield wrong unexpected results vs numpy.array([1.0, 0, 0]) . Thx, D. _

Re: [Numpy-discussion] sort bug

2007-04-29 Thread Anton Sherwood
> Anton Sherwood wrote: > I refined it slightly: > > val,vec = numpy.linalg.eig(adj) > indx = val.argsort()[-4:-1] > val = val.take(indx) > vec = vec.take(indx, axis=1) > master = zip(val, vec.T) Charles R Harris wrote: > But that won't get the 4 largest, and will ignore