Re: [Numpy-discussion] [OT] Why Python 'fits your brain'

2006-11-09 Thread Bill Baxter
I think Ruby users say the same about Ruby, maybe even more emphatically than Python users, and Ruby's chart looks like just about the most complicated one there. C and Python look to be about on par. Also I suspect a chart of Lisp's grammar would be even simpler than any of those up there, but I

Re: [Numpy-discussion] matrix multiplication (newbie question)

2006-11-08 Thread Bill Baxter
Also have a look at the section on Arrays vs Matrices in the Numpy for Matlab users page. That particular section has nothing to do with Matlab, really. http://www.scipy.org/NumPy_for_Matlab_Users Most of the suggestions and comments made here are already on that page. --bb On 11/8/06, Joris De

Re: [Numpy-discussion] Stacking arrays...

2006-11-07 Thread Bill Baxter
dstack maybe? or does that add a dim on the other end?--bbOn 11/8/06, Christopher Barker <[EMAIL PROTECTED] > wrote:HI all,I'm trying to get the hang of this new r_ and c_ stuff. I need to take two MxN arrays, and stack them together into one MxNx2arrays. I found this works: >>> a = N.ones((3,4)) >

[Numpy-discussion] Compressed index sets, generators and iterators

2006-11-01 Thread Bill Baxter
Has any thought been given to using compressed or functional representations of index sets?For instance there could be a where-like function that returns an object that can generate a set of indexes on the fly, rather than explicitly allocating arrays and enumerating all of the indices. What's the

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-11-01 Thread Bill Baxter
On 11/2/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: On 01/11/06, Travis Oliphant <[EMAIL PROTECTED]> wrote:> And it may be a good idea to also have a get_ctype method or some-such> on the ctypes attribute so that  one could get a "ctypes description" > from the NumPy data-type.It seems to me tha

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-11-01 Thread Bill Baxter
, Lisandro Dalcin <[EMAIL PROTECTED]> wrote: On 10/31/06, Bill Baxter <[EMAIL PROTECTED]> wrote:> One thing I see with PIL and Matplotlib and PyOpenGL is that they're having> to add specific support for Numpy and numeric and numarray and PIL and > ctypes etc.This is a rea

Re: [Numpy-discussion] Need more comments from scientific community on python-dev

2006-10-31 Thread Bill Baxter
One thing I see with PIL and Matplotlib and PyOpenGL is that they're having to add specific support for Numpy and numeric and numarray and PIL and ctypes etc.I'm also in the camp that doesn't really understand this stuff well enough to really argue in favor of it, but would the proposed extensions

Re: [Numpy-discussion] Matrices for testing

2006-10-25 Thread Bill Baxter
On 10/26/06, jeremito <[EMAIL PROTECTED]> wrote: Hmmm.  I guess I'll have to find another way to get some"standard/well-known" matrices to work with.  Thanks for your help.Well if all you want is some matrices, there's nothing stopping you from grabbing the matrices in the LAPACK distribution and u

Re: [Numpy-discussion] some work on arpack

2006-10-22 Thread Bill Baxter
Don't know if this is any use, but to me (not knowing Fortran nearly so well as C++) this looks pretty useful: http://www.caam.rice.edu/software/ARPACK/arpack++.html http://www.ime.unicamp.br/~chico/arpack++/ It provides a nice high-level interface on top of ARPACK. I could see it being useful on

Re: [Numpy-discussion] some work on arpack

2006-10-21 Thread Bill Baxter
On 10/22/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > On 10/21/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > Here's something I've been wondering: is it ok to port Matlab > > functions over to python? If so, then it's maybe an afternoon's

Re: [Numpy-discussion] some work on arpack

2006-10-21 Thread Bill Baxter
Here's something I've been wondering: is it ok to port Matlab functions over to python? If so, then it's maybe an afternoon's work to get eigs working, given eigs.m and python Arpack wrappers. I'm 99% sure it would *not* be kosher to copy-paste their code directly, but it's not a copy paste job b

Re: [Numpy-discussion] The NumPy Fortran-ordering quiz

2006-10-17 Thread Bill Baxter
I think the answer to #3 is wrong. >From 1.0rc2 I get: >>> array([1,2,3,4,5,6],order='C').reshape((2,3),order='F') array([[1, 2, 3], [4, 5, 6]]) But the quiz wants me to answer something different. --bb - Using Tomca

Re: [Numpy-discussion] [SciPy-dev] NumPy/SciPy + MPI for Python

2006-10-14 Thread Bill Baxter
On 10/15/06, A. M. Archibald <[EMAIL PROTECTED]> wrote: > So, well, any suggestion for a name? pylab is already in use by > matplotlib (for some reason), as is Scientific Python (and numpy, > Numeric and numarray are obviously already confusing). I always thought 'pylab' was an odd name, so I alwa

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > For this sort of thing, I > would just make a new module to pull together the function I want and > use that instead. It's then easy to explain that this new module bbeconf > (Bill Baxter's Excellent Collection Of Numeric Functions) is actually

Re: [Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/13/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 10/12/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > > > On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > >

[Numpy-discussion] How to make sqrt(-1) be 1j

2006-10-12 Thread Bill Baxter
On 10/12/06, Stefan van der Walt <[EMAIL PROTECTED]> wrote: > On Thu, Oct 12, 2006 at 08:58:21AM -0500, Greg Willden wrote: > > On 10/11/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > I tried to explain the argument at > > http://www.scipy.org/NegativeSquareRoot >

Re: [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?

2006-10-11 Thread Bill Baxter
On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: > On 10/11/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > Stefan van der Walt wrote: > > >Further, if I understand correctly, changing sqrt and power to give > > >the right answer by default will slow things down somewhat. But is it > > >wor

Re: [Numpy-discussion] incrementing along a diagonal

2006-10-11 Thread Bill Baxter
On 10/12/06, David Novakovic <[EMAIL PROTECTED]> wrote: > Johannes Loehnert wrote: > This is very nice, exactly what i want, but it doesnt work for mxn > matricies: > > >>> x = zeros((5,3)) > >>> x > array([[0, 0, 0], >[0, 0, 0], >[0, 0, 0], >[0, 0, 0], >[0, 0, 0]])

Re: [Numpy-discussion] round

2006-10-11 Thread Bill Baxter
Hmm. I learned "round to even" in school... But another formula that should get you what you want is: floor(x + 0.5).astype(int) --bb On 10/12/06, Greg Willden <[EMAIL PROTECTED]> wrote: > Hi All, > > I've read discussions in the archives about how round() "rounds to even" and > how that is s

Re: [Numpy-discussion] select part of array using two conditions

2006-10-11 Thread Bill Baxter
On 10/11/06, Nils Wagner <[EMAIL PROTECTED]> wrote: > Mark Bakker wrote: > > Hello - > > > > I want to select part of an array using two conditions. > > I know how to do it with one condition (and it works great), but when > > I use two conditions I get an error message? > > This is probably easy,

Re: [Numpy-discussion] ide for python/numpy/scipy/mpl, development ?

2006-10-09 Thread Bill Baxter
If you don't mind going commercial, then the WingIDE has been working very well for me. And it apparently has a VIM mode (and emacs). I'm an emacs guy, though, so I haven't tried out the VIM support. Wing is based on GTK so the interface on Windows doesn't look so nice, or act so much like a nati

Re: [Numpy-discussion] can this be made faster?

2006-10-08 Thread Bill Baxter
So what's the answer then?  Can it be made faster?--bbOn 10/9/06, Robert Kern <[EMAIL PROTECTED]> wrote: Bill Baxter wrote:> Yes, that'd be>a[b] += cNo, I'm afraid that fancy indexing does not do the loop that you are thinking it would (and for reasons that we'

Re: [Numpy-discussion] can this be made faster?

2006-10-07 Thread Bill Baxter
, 1]) > >>> a[b]+=c > Traceback (most recent call last): > File "", line 1, in ? > IndexError: invalid index > > whereas i would like to get > > array([3, 2]) > > > > On 10/8/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > Yes,

Re: [Numpy-discussion] can this be made faster?

2006-10-07 Thread Bill Baxter
Yes, that'd be a[b] += c On 10/8/06, Daniel Mahler <[EMAIL PROTECTED]> wrote: > Is there a 'loop free' way to do this in Numeric > > for i in arange(l): >a[b[i]]+=c[i] > > where l == len(b) == len(c) > > thanks > Daniel --

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 abi

[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 controversia

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

2006-10-03 Thread Bill Baxter
Er, is this the PyEM in question? It doesn't have much of a web presence... http://www.ar.media.kyoto-u.ac.jp/members/david/ --bb On 10/3/06, David Cournapeau <[EMAIL PROTECTED]> wrote: > Albert Strasheim wrote: > > Hello all > > > > I recently started looking at David Cournapeau's PyEM packag

Re: [Numpy-discussion] numpy1.0rc and matplotlib-0.87.5

2006-09-26 Thread Bill Baxter
Are you sure it's matplotlib-0.87.5? Line 74 in my c:/Python24/Lib/site-packages/matplotlib/numerix/ is "from numpy import *" and not "Matrix = matrix" as in your stackdump. You can check the site-packages/matplotlib/__init__.py file for the __version__ variable to make sure. Mine's got: __versio

Re: [Numpy-discussion] Shift or rotate command?

2006-09-24 Thread Bill Baxter
ctually doing is not what we've been calling 'rolling'. It's just a move, really (remove value from one place and re-insert in another). So perhaps the name should be 'moveaxis' instead? --bb On 9/25/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Mon, 25

Re: [Numpy-discussion] Shift or rotate command?

2006-09-24 Thread Bill Baxter
Went ahead and added an enhancement request: http://projects.scipy.org/scipy/numpy/ticket/293 This is something I've wanted in the past too. --bb On 9/25/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > > On 9/24/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > >

Re: [Numpy-discussion] Shift or rotate command?

2006-09-24 Thread Bill Baxter
Howdy Angus, Yeh, that does seem like a hole in the API. Travis added a rollaxis() but there's still no simple way to roll the elements themselves. I took a look at numpy.fft.fftshift, which is a function that has to do a similar thing. It does it by concatenating aranges and then doing a take()

Re: [Numpy-discussion] general version of repmat?

2006-09-23 Thread Bill Baxter
Here's a new version of 'reparray'. I tested the previous version against 'repmat' for the 2d case and found it to be as much as 3x slower in some instances. Ick. So I redid it using the approach repmat uses -- reshape() and repeat() rather than concatenate(). Now it's very nearly as fast as r

Re: [Numpy-discussion] Rationale for atleast_3d

2006-09-22 Thread Bill Baxter
Thanks for the explanations, folks, I thought that might be the case. On 9/23/06, Sebastian Haase <[EMAIL PROTECTED]> wrote: > I'm working with "stacks of 2d arrays" -- but I was always under the > impression that -- since the last axis is the "fastest" -- "stacks of > " should stack in the first

Re: [Numpy-discussion] general version of repmat?

2006-09-22 Thread Bill Baxter
On 9/22/06, Alan G Isaac <[EMAIL PROTECTED]> wrote: > On Fri, 22 Sep 2006, Bill Baxter apparently wrote: > > Ok, here's my best shot at a generalized repmat: > > Sorry to always repeat this suggestion when > it comes to repmat, but I think the whole approach >

Re: [Numpy-discussion] general version of repmat?

2006-09-22 Thread Bill Baxter
Ok, here's my best shot at a generalized repmat: def reparray(A, tup): if numpy.isscalar(tup): tup = (tup,) d = len(tup) A = numpy.array(A,copy=False,subok=True,ndmin=d) for i,k in enumerate(tup): A = numpy.concatenate([A]*k, axis=i) return A Can anyone improv

[Numpy-discussion] Rationale for atleast_3d

2006-09-22 Thread Bill Baxter
26 weeks, 4 days, 2 hours and 9 minutes ago, Zdeněk Hurák asked why atleast_3d acts the way it does: http://article.gmane.org/gmane.comp.python.numeric.general/4382/match=atleast+3d He doesn't seem to have gotten any answers. And now I'm wondering the same thing. Anyone have any idea? --bb

Re: [Numpy-discussion] reading large files

2006-09-22 Thread Bill Baxter
Do you also have a 64-bit processor? Just checking since you didn't mention it. --bb On 9/22/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > > > I would like to read files >2Gbyte. From earlier posting I believed it > should be possible with python 2.5. > > I am getting MemoryError when tr

Re: [Numpy-discussion] take behaviour has changed

2006-09-21 Thread Bill Baxter
Yep, check the release notes: http://www.scipy.org/ReleaseNotes/NumPy_1.0 search for 'take' on that page to find out what others have changed as well. --bb On 9/22/06, Christian Kristukat <[EMAIL PROTECTED]> wrote: > Hi, > from 1.0b1 to 1.0rc1 the default behaviour of take seems to have changed wh

[Numpy-discussion] general version of repmat?

2006-09-21 Thread Bill Baxter
Is there some way to get the equivalent of repmat() for ndim == 1 and ndim >2. For ndim == 1, repmat always returns a 2-d array, instead of remaining 1-d. For ndim >2, repmat just doesn't work. Maybe we could add a 'reparray', with the signature: reparray(A, repeats, axis=None) where repeats is

[Numpy-discussion] matrixmultiply moved (release notes?)

2006-09-21 Thread Bill Baxter
Apparently numpy.matrixmultiply got moved into numpy.oldnumeric.matrixmultiply at some point (or rather ceased to be imported into the numpy namespace). Is there any list of all such methods that got banished? This would be nice to have in the release notes. --bb ---

Re: [Numpy-discussion] change of default dtype

2006-09-20 Thread Bill Baxter
t;[EMAIL PROTECTED]> wrote: > It is a wiki, and contributions are absolutely welcome, so please go > ahead and change it to be more clear. > > Bill Baxter wrote: > > >I think that's supposed to be covered by this line: > >"The default array data-type is now floa

Re: [Numpy-discussion] change of default dtype

2006-09-20 Thread Bill Baxter
I think that's supposed to be covered by this line: "The default array data-type is now float64 (c double precision) instead of c integer." But yeh, I agree. It's definitely not obvious what that means in terms of concrete API changes. --bb On 9/21/06, David Grant <[EMAIL PROTECTED]> wrote: > I

Re: [Numpy-discussion] please change mean to use dtype=float

2006-09-19 Thread Bill Baxter
On 9/20/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > > I guess I'm not really aware of the float96 type ... > > Is that a "machine type" on any system ? I always thought that -- e.g . > > coming from C -- double is "as good as it gets"... > > Who uses float96 ? I heard somewhere that (some)

Re: [Numpy-discussion] max argmax combo

2006-09-19 Thread Bill Baxter
On 9/20/06, Francesc Altet <[EMAIL PROTECTED]> wrote: > A Dimarts 19 Setembre 2006 19:21, Charles R Harris va escriure: > > > > Do you want both the indexes and index sorted array returned, or just sort > > the array using indexes, i.e., something like > > > > a.sort(kind="quicksort", method="indir

Re: [Numpy-discussion] max argmax combo

2006-09-18 Thread Bill Baxter
On 9/19/06, Charles R Harris <[EMAIL PROTECTED]> wrote: > On 9/18/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > > I find myself often wanting both the max and the argmax of an array. > > (And same for the other arg* functions) > > You have to do something like &g

[Numpy-discussion] max argmax combo

2006-09-18 Thread Bill Baxter
I find myself often wanting both the max and the argmax of an array. (And same for the other arg* functions) Of course I can do argmax first then use fancy indexing to get the max as well. But the result of argmax isn't really in a format that's readily usable as an index. You have to do something

Re: [Numpy-discussion] unique1d: renaming retindx to return_index

2006-09-18 Thread Bill Baxter
Grepping through numpy/**/*.py, the only three functions I could find with an argument to specify extra return values are: linspace(start, stop, num=50, endpoint=True, retstep=False) average(a, axis=None weights=None, returned=False) unique1d(ar1, retindx=False) If unique1d is going to chan

Re: [Numpy-discussion] Fwd: Collection.findTransformation() never stops

2006-09-18 Thread Bill Baxter
Hey there, I don't see anything called "LinearAlgegra.eigenvectors()". Do you maybe mean numpy.linalg.eig? Which version of numpy are you using? The latest release is 1.0b5. >>> import numpy >>> numpy.__version__ '1.0b5' >>> numpy.linalg.eig([[2,1],[1,2]]) (array([ 3., 1.]), array([[ 0.7071067

Re: [Numpy-discussion] Axis Iterator?

2006-09-14 Thread Bill Baxter
On 9/15/06, Tim Hochberg <[EMAIL PROTECTED]> wrote: > Isn't swapaxis appropriate for this? In other words: > You're right. Just didn't think of that. Never used swapaxes before. def axisiter(arr, i): return arr.swapaxes(0,i) --bb ---

Re: [Numpy-discussion] Axis Iterator?

2006-09-14 Thread Bill Baxter
Iteration over axis 0 is built-in, so you can already do (vectorFunc(row) for row in array) And you can use transpose() to make it so the axis you want to iterate over is axis 0. (vectorFunc(col) for col in array.transpose(1,0)) Or just use the .T attribute (vectorFunc(col) for col in a

Re: [Numpy-discussion] stumped numpy user seeks help

2006-08-30 Thread Bill Baxter
On 8/30/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Mathew Yeates schrieb: > will be a numpy matrix, use if you don't like that. But here > it's really nice to work with matrices, because otherwise .sum() will > give you a 1-d array sometimes, and that will suddenly look like a row > to (inst

Re: [Numpy-discussion] array indexing problem

2006-08-29 Thread Bill Baxter
That's just the way it works in numpy. Slices return arrays of lower rank. If you want arrays that behave like they do in linear algebra you can use 'matrix' instead. Check out the Numpy for Matlab users page for more info on array vs. matrix. http://www.scipy.org/NumPy_for_Matlab_Users --bb On

Re: [Numpy-discussion] tensor dot ?

2006-08-28 Thread Bill Baxter
On 8/29/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Example: > > If a.shape is (3,4,5) > and b.shape is (4,3,2) > > Then > > tensordot(a, b, axes=([1,0],[0,1])) > > returns a (5,2) array which is equivalent to the code: > > c = zeros((5,2)) > for i in range(5): > for j in range(2): >

Re: [Numpy-discussion] memory corruption bug

2006-08-28 Thread Bill Baxter
Nope, that's the way python works in general for any type other than basic scalar types. >>> a = [1,2,3,4] >>> b = a >>> b[1] = 99 >>> print a [1, 99, 3, 4] >>> print b [1, 99, 3, 4] Also the issue never comes up for types like tuples or strings because they aren't mutable. --bb On 8/28/06, Sven

Re: [Numpy-discussion] memory corruption bug

2006-08-26 Thread Bill Baxter
You're sure it's not just pass-by-reference semantics biting you?If you make an array and pass it to another class or function, by default they just get a reference to the same array.so e.g.:a = numpy.array ([1,2,3])some_class.set_array(a)a[1] = 10Then both the local 'a' and the 'a' that some_class

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Bill Baxter
On 8/26/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: I've come up with adding the functions (not methods at this point)deletefrominsertinto"delete" and "insert" really would be better.   The current "insert" function seems inaptly named.  What it does sounds more like "overlay" or "set_masked". .

Re: [Numpy-discussion] Deleting a row from a matrix

2006-08-26 Thread Bill Baxter
On 8/26/06, Francesc Altet <[EMAIL PROTECTED]> wrote: I'm personally an addict to encapsulate as much functionality as possible inmethods (but perhaps I'm biased by an insane use of TAB in ipython console).You can still get tab completion for functions:  numpy. Even if it's your custom to "from num

Re: [Numpy-discussion] users point of view and ufuncs

2006-08-24 Thread Bill Baxter
On 8/24/06, Sasha <[EMAIL PROTECTED]> wrote: > On 8/24/06, Bill Baxter <[EMAIL PROTECTED]> wrote: > >[snip] it would be > > nice to add a concise definition of "ufunc" to the numpy glossary: > > http://www.scipy.org/Numpy_Glossary. > > > &g

Re: [Numpy-discussion] users point of view and ufuncs

2006-08-23 Thread Bill Baxter
On 8/24/06, Sebastian Haase <[EMAIL PROTECTED]> wrote: > I'm not sure what this question is asking, so I'll answer what I think> it is asking.>> The mean, min, max, and average functions are *not* ufuncs.   They are> methods of particular ufuncs. >Yes - that's what  wanted to hear !  I'm just tryin

Re: [Numpy-discussion] request for new array method: arr.abs()

2006-08-23 Thread Bill Baxter
The thing that I find I keep forgetting is that abs() is a built-in, but other simple functions are not.  So it's abs(foo), but numpy.floor(foo) and numpy.ceil(foo).  And then there's round() which is a built-in but can't be used with arrays, so numpy.round_(foo).    Seems like it would be more co

Re: [Numpy-discussion] numpy.random.rand function doesn't take tuple

2006-08-21 Thread Bill Baxter
If you like, here's a rand function that takes either a sequence or a tuple.  I use this for interactive sessions.def rand(*shape):    """    Return an array of the given dimensions which is initialized to     random numbers from a uniform distribution in the range [0,1).    rand(d0, d1, ..., dn)

Re: [Numpy-discussion] linspace upper bound not met?

2006-08-21 Thread Bill Baxter
Out of curiosity I checked on what matlab does.  It does explicity set the last value to 'stop' to avoid the roundoff issue.In numpy terms, it does something like    y = r_[start+r_[0:num-1]*(stop-start)/(num-1.0 ),  stop]But for numpy it's probably more efficient to just do the 'y[-1] = stop' like

[Numpy-discussion] linspace upper bound not met?

2006-08-21 Thread Bill Baxter
I was porting some code over from matlab in which I relied on the upper bound of linspace to be met exactly.It turns out that it isn't always exactly met in numpy.In [390]: filter(lambda x: x[1]!=0.0, [ (i, 1.0-numpy.linspace(0,1,i)[-1]) for i in range(2,200) ])Out[390]:[(50, 1.1102230246251565e-01

Re: [Numpy-discussion] bug with numpy.linalg.eig for complex output

2006-08-18 Thread Bill Baxter
Thanks for the info Nils.  Sounds like it was fixed post-1.0b1.  Good news.And Trac seems to be letting me in again.  Not sure what was wrong there.--bbOn 8/18/06, Nils Wagner <[EMAIL PROTECTED]> wrote: Bill Baxter wrote:> If you do this:> >>>  numpy.linalg.eig(numpy.rando

[Numpy-discussion] bug with numpy.linalg.eig for complex output

2006-08-17 Thread Bill Baxter
If you do this:>>>  numpy.linalg.eig(numpy.random.rand(3,3))You'll (almost always) get a wrong answer back from numpy.  Something like:(array([ 1.72167898, -0.07251007, -0.07251007]),  array([[ 0.47908847,  0.72095163,  0.72095163],  [ 0.56659142, -0.46403504, -0.46403504],   [ 0.67040914

Re: [Numpy-discussion] NumPy, shared libraries and ctypes

2006-08-08 Thread Bill Baxter
On 8/9/06, Albert Strasheim <[EMAIL PROTECTED]> wrote: Next caveat: on Windows, shared libraries aka DLLs, typically have a .dllextension. However, Python extensions have a .pyd extension.We have a utility function in NumPy called ctypes_load_library which handles finding and loading of shared libr

Re: [Numpy-discussion] Examples of basic C API usage?

2006-08-08 Thread Bill Baxter
Ah, great.  That is helpful, though it does seem to be a bit outdated.--bbOn 8/8/06, Karol Langner <[EMAIL PROTECTED] > wrote:On Tuesday 08 of August 2006 05:18, Bill Baxter wrote:> I see Pyrex and SWIG examples in numpy/doc but there doesn't seem to be an > example

Re: [Numpy-discussion] numpy and matplotlib

2006-08-08 Thread Bill Baxter
Matplotlib needs to be recompiled against the latest Numpy.They should release a new version compatible with Numpy 1.0 beta soon.--bbOn 8/9/06, George Gumas <[EMAIL PROTECTED]> wrote:I downloaded numpy 1  and matplotlib and when running numpy i get  the error message below  from matplotlib._n

[Numpy-discussion] Examples of basic C API usage?

2006-08-07 Thread Bill Baxter
I see Pyrex and SWIG examples in numpy/doc but there doesn't seem to be an example of just a simple straightforward usage of the C-API.For instance make a few arrays by hand in C and then call numpy.multiply() on them.  So far my attempts to call PyArray_SimpleNewFromData all result in segfaults. A

Re: [Numpy-discussion] comments on r_ and c_ ?

2006-08-06 Thread Bill Baxter
On 8/1/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > Bill Baxter wrote: > > When you have a chance, could the powers that be make some comment on > > the r_ and c_ situation? > r_ and c_ were in SciPy and have been there for several years. > > For NumPy, c_ has be

Re: [Numpy-discussion] Graph class

2006-08-01 Thread Bill Baxter
Hi David, For a graph, the fact that it's stored as a matrix, or stored as linked nodes, or dicts, etc, is an implementation detail. So from a classical OO point of view, inheritance is not what you want. Inheritance says "this is a kind of that". But a graph is not a kind of matrix. A matrix

[Numpy-discussion] comments on r_ and c_ ?

2006-07-31 Thread Bill Baxter
When you have a chance, could the powers that be make some comment on the r_ and c_ situation? From what I understand Travis added these fairly recently and they aren't officially documented anywhere. There was discussion previously about whether to rename them or not, but no real conclusion was r

Re: [Numpy-discussion] [SciPy-user] concatenate, r_ ...

2006-07-30 Thread Bill Baxter
> By the way, you seem puzzled by the behaviour of column_stack. I think > it fits well with the docstring. What was unexpected to me was its behavior when handling inputs that are not 1-d. The docstring doesn't say what will happen in that case. But my expectation is that it should associate.

Re: [Numpy-discussion] 1.0b1 problem on Solaris

2006-07-24 Thread Bill Baxter
t use the 0.4.9 source? > > > Bill Baxter wrote: > > Yep, scipy needs to be recompiled against the 1.0b1 version of numpy. > > I think they should have an updated version on the web site in a few > > days or so if you don't feel like compiling yourself. > > >

Re: [Numpy-discussion] 1.0b1 problem on Solaris

2006-07-24 Thread Bill Baxter
Yep, scipy needs to be recompiled against the 1.0b1 version of numpy. I think they should have an updated version on the web site in a few days or so if you don't feel like compiling yourself. --bb On 7/25/06, Mathew Yeates <[EMAIL PROTECTED]> wrote: > I installed numpy-1.0b1 and now >import nump

Re: [Numpy-discussion] Please comment on SVN versioning convention

2006-07-24 Thread Bill Baxter
On 7/25/06, Andrew Straw <[EMAIL PROTECTED]> wrote: > 1.0.2881 - This would sort after 1.0 (and 1.0b and 1.0c) and before 1.1 > for most tools out there. I like that best. Save the 1.1 prefix until it's actually released as such. The numbering scheme needs to deal with what to call the patch tip

Re: [Numpy-discussion] matrix-related bug in 1.0b1

2006-07-24 Thread Bill Baxter
On 7/25/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Travis Oliphant schrieb: > > Sven Schreiber wrote: > >> > > The change was trying to fix up some cases but did break this one. The > > problem is that figuring out whether or not to transpose the result is a > > bit tricky. I've obviously st

Re: [Numpy-discussion] trivial question: how to compare dtype - but ignoring byteorder ?

2006-07-24 Thread Bill Baxter
> > And I think byteorder matters when comparing dtypes: > > >>> numpy.dtype('>f4') == numpy.dtype(' > False Oh -- that '<' part is indicating *byte order* ?! I thought it was odd that numpy could only tell me the type was "less than f4", which I assumed must be shorthand for "less than or equ

Re: [Numpy-discussion] numpy.prod() vs. numpy.product()

2006-07-24 Thread Bill Baxter
I can't answer why, but in oldnumeric.py, you can see there's two different fuctions with basically identical code, so yes they are distinct, but no they are not different. Seems like prod could be replaced by prod=product. def product (x, axis=0, dtype=None): """Product of the array elements

Re: [Numpy-discussion] matrix-related bug in 1.0b1

2006-07-23 Thread Bill Baxter
Howdy, On 7/22/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Hi, > > Summary: Slicing seems to be broken with matrices now. > > ... > Example: > > >>> import numpy as n > >>> n.__version__ > '1.0b1' > >>> import numpy.matlib as m > >>> a = n.zeros((2,3)) > >>> b = m.zeros((2,3)) > >>> a[:1,:].sh

Re: [Numpy-discussion] r_, c_, hstack, and vstack with 1-d arrays

2006-07-22 Thread Bill Baxter
On 7/21/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Bill Baxter schrieb: > > > Finally, I noticed that the atleast_nd methods return arrays > > regardless of input type. > > Are you sure? I reported that issue with *stack and I remember it was fixed. Doh! My bad.

[Numpy-discussion] appending/inserting/deleting axes of arrays

2006-07-22 Thread Bill Baxter
Howdy, Is there any nicer syntax for the following operations on arrays? Append a row: a = vstack((a,row)) Append a column: a = hstack((a,col)) Append a row of zeros: a = vstack((a,zeros((1,a.shape[1] Append a col of zeros: a = hstack((a,zeros((a.shape[0],1 Insert a row before row j a

Re: [Numpy-discussion] r_, c_, hstack, and vstack with 1-d arrays

2006-07-22 Thread Bill Baxter
I looked into the various concatenation methods a bit more to better understand what's going on under the hood. Here's essentially what these different methods do: vstack(tup): concatenate( map(atleast_2d,tup), axis=0 ) hstack(tup): concatenate( map(atleast_1d,tup),axis=1 ) column_stack

Re: [Numpy-discussion] r_, c_, hstack, and vstack with 1-d arrays

2006-07-19 Thread Bill Baxter
On 7/19/06, Sven Schreiber <[EMAIL PROTECTED]> wrote: > Bill Baxter schrieb: > > For 1-d inputs I think r_ should act like vstack, and c_ should act > > like column_stack. > > Currently r_ and c_ both act like hstack for 1-d inputs. > > Well Bill, as I said be

[Numpy-discussion] r_, c_, hstack, and vstack with 1-d arrays

2006-07-19 Thread Bill Baxter
For 1-d inputs I think r_ should act like vstack, and c_ should act like column_stack. Currently r_ and c_ both act like hstack for 1-d inputs. Background: I keep getting bitten by the fact that this doesn't work: >>> a = array([1,2,3]) >>> b = array([[1,2,3],[2,3,4]]) >>> c = array([4,5,6]) >>>

Re: [Numpy-discussion] fast way of doing "cross-multiplications" ?

2006-07-18 Thread Bill Baxter
Maybe this will help -- it computes the squared distances between a bunch of points: def dist2(x,c): """ Calculates squared distance between two sets of points. n2 = dist2(x, c) D = DIST2(X, C) takes two matrices of vectors and calculates the squared Euclidean distance between

Re: [Numpy-discussion] Startup .numpyrc file

2006-07-17 Thread Bill Baxter
On 7/18/06, Keith Goodman <[EMAIL PROTECTED]> wrote: > On 7/17/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: > > Keith Goodman wrote: > Does anyone out there save the print defaults across sessions? How do you do > it? > > Does numpy look for any startup files (~/.numpyrc)? If you set a PYTHONST

Re: [Numpy-discussion] Scalars, comparisons and indexing. Is this a bug?

2006-07-14 Thread Bill Baxter
I believe that's the problem that the indexing PEP from Travis is supposed to address: http://www.python.org/dev/peps/pep-0357/ So I think there's not much anyone can do about it untill the PEP is accepted and implemented. Maybe you can cast to int? > In [34]: (1,2)[int(a[0]==b)] --bb On 7/15

Re: [Numpy-discussion] [Fwd: Re: A few comments (MDP conversion)]

2006-07-14 Thread Bill Baxter
On 7/15/06, Robert Kern <[EMAIL PROTECTED]> wrote: > Nils Wagner wrote: > > > >>> p = linalg.pinv(a) > > Traceback (most recent call last): > > File "", line 1, in ? > > File "/usr/lib64/python2.4/site-packages/numpy/linalg/linalg.py", line > > 426, in pinv > > if issubclass(a.dtype.dtype,

Re: [Numpy-discussion] LAPACK Problem with "import numpy" on AIX

2006-07-13 Thread Bill Baxter
On 7/13/06, Adam Carter <[EMAIL PROTECTED]> wrote: Hi all,Do I need lapack_lite aswell? Where can I get it? If I need this otherLAPACK, how can I ensure that my code uses the optimised version of LAPACKalready on this system I'm using? Lapack_lite is in the numpy sources.  I think it's the fallback

Re: [Numpy-discussion] determining if you have ATLAS or not

2006-07-12 Thread Bill Baxter
Terrific.  Nils sent me the answer:scipy.show_config() ornumpy.show_config ()will give you some useful information.And here it goes straight to the wikihttp://www.scipy.org/Installing_SciPy/Windows --bb - Using Tomcat but nee

[Numpy-discussion] determining if you have ATLAS or not

2006-07-12 Thread Bill Baxter
How can you probe numpy for info about what sort of BLAS/LAPACK you have, or other build configuration info?Searching the ml archives I turned up this one hint from Travis, which can be embodied in code thusly:     import numpy    def have_blas():         return id(numpy.dot) != id(numpy.core.multi

Re: [Numpy-discussion] Building SciPy under Windows attn. Bill Baxter

2006-07-12 Thread Bill Baxter
Thanks, that seems to have done the trick!I've got a SVN Scipy now!I updated the building scipy wiki page with this piece of advice.--bbOn 7/13/06, John Carter <[EMAIL PROTECTED]> wrote: I had problems building SciPy and NumPy under Windows. They went awaywhen I stopped using the stable version of

[Numpy-discussion] numpy distutils problem on Windows

2006-07-12 Thread Bill Baxter
In numpy/distutils/command/config.py:'cookedm' added a get_output() command on June 9.This get_output function uses os.WEXITSTATUS and various other os.W* functions.These do not exist in Python on Windows. Is there some other way to achieve the same thing without those?For now, just commenting out

Re: [Numpy-discussion] Args for rand and randn, and workarounds

2006-07-12 Thread Bill Baxter
On 7/12/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Because of this.  I've removed the global_namespace functions (fft,ifft, rand, and randn) from numpy.  They are *no longer* in thetop-level name-space.   If you want them, setup a startup-fileappropriately. Any hints as to where we can find the

Re: [Numpy-discussion] Testing a self-compiled numpy

2006-07-12 Thread Bill Baxter
On 7/10/06, Bryce Hendrix <[EMAIL PROTECTED]> wrote: Keith Goodman wrote: Doesn't --prefix=/install/numpy/here/ work on windows? For our Windows Enthon project, the build command is setup.py config --compiler=mingw32 build --compiler=mingw32 install --prefix=path_to_whe

[Numpy-discussion] Args for rand and randn, and workarounds

2006-07-11 Thread Bill Baxter
And mark my words, if we make rand() polymorphic, we will get just as many newbies coming to the list asking why ones(3, 4)doesn't work. I think you're probably right there, at least for Matlab converts.  Matlab allows either way of calling for all of rand, ones, zeros, eye, and in general tries to

Re: [Numpy-discussion] Testing a self-compiled numpy

2006-07-09 Thread Bill Baxter
Thanks for the reply Keith.On 7/10/06, Keith Goodman <[EMAIL PROTECTED]> wrote: One quick hack is to install the new numpy somewhere else and thenrename the directory containing 0.9.8 to numpySTOP. Then you don'thave to worry about the ordering of the path.The  only thing is that the numpy install

[Numpy-discussion] Testing a self-compiled numpy

2006-07-09 Thread Bill Baxter
I got numpy compiled according the the instruction on the Wiki, but is there some way to try it out without wiping out my stable install of 0.9.8?I tried modifying my PYTHONPATH to put the new numpy build directory first, but 'import numpy' still picks up the installed 0.9.8 version.I also tried r

Re: [Numpy-discussion] building ATLAS on Win32 - endless compile loop

2006-07-09 Thread Bill Baxter
I did some searching on the web and found that Pentium M is more or less a Pentium III.After selecting "Pentium III" in the ATLAS setup, the build worked.  Still, on my ~1GHz laptop took several hours, nothing like the 15 minutes advertised on the Wiki.   (I updated the wiki accordingly) Just out o

  1   2   >