Re: [Numpy-discussion] add .H attribute?

2013-07-13 Thread Alan G Isaac
On Sun, Jul 7, 2013 at 9:28 AM, Alan G Isaac alan.is...@gmail.com mailto:alan.is...@gmail.com wrote: I miss being able to spell a.conj().T as a.H, as one can with numpy matrices. On 7/7/2013 4:49 PM, Charles R Harris wrote: There was a long thread about this back around 1.1 or so, long

Re: [Numpy-discussion] add .H attribute?

2013-07-13 Thread Alan G Isaac
On 7/13/2013 1:46 PM, Nathaniel Smith wrote: Why not just write def H(a): return a.conj().T in your local namespace? First of all, I am sympathetic to being conservative about the addition of attributes! But the question about adding a.H about the possibility of improving - speed

[Numpy-discussion] numpy.sign query

2013-07-12 Thread Alan G Isaac
The docs for numpy.sign at http://docs.scipy.org/doc/numpy/reference/generated/numpy.sign.html do not indicate how complex numbers are handled. Currently, np.sign appears to return the sign of the real part as a complex value. Was this an explicit choice? Was x/abs(x) considered (for non-zero

[Numpy-discussion] add .H attribute?

2013-07-07 Thread Alan G Isaac
With numpy arrays, I miss being able to spell a.conj().T as a.H, as one can with numpy matrices. Is adding this attribute to arrays ever under consideration? Thanks, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] SLARTG

2013-07-05 Thread Alan G Isaac
On 7/5/2013 2:50 PM, Alan G Isaac wrote: I see that CLARTG is here: https://github.com/scipy/scipy/blob/master/scipy/sparse/linalg/eigen/arpack/ARPACK/SRC/sstqrb.f But is there a Python interface in SciPy? (Or any other SciPy access to Givens rotation?) Sorry, that was SLARTG, whereas

Re: [Numpy-discussion] numpy.filled, again

2013-06-29 Thread Alan G Isaac
On 6/29/2013 3:00 PM, Nathaniel wrote: any objections to np.full? Still curious: why isn't ``tile`` the right name? (It already exists.) import numpy as np np.tile(3.0, (2,3)) array([[ 3., 3., 3.], [ 3., 3., 3.]]) If someone explained this, sorry to have missed it. Alan

Re: [Numpy-discussion] numpy.filled, again

2013-06-29 Thread Alan G Isaac
On 6/29/2013 3:00 PM, Nathaniel wrote: any objections to np.full? On Sat, Jun 29, 2013 at 9:55 PM, Alan G Isaac wrote: Still curious: why isn't ``tile`` the right name? (It already exists.) import numpy as np np.tile(3.0, (2,3)) array([[ 3., 3., 3.], [ 3., 3., 3

Re: [Numpy-discussion] numpy.filled, again

2013-06-29 Thread Alan G Isaac
and I don't see the problem with ``tile_like``. On 6/29/2013 6:15 PM, Robert Kern wrote: It makes no sense except in the scalar case. I would think it makes sense in every case that can be normally broadcast to the shape of the paradigm array. Anyway, I drop the suggestion. Cheers, Alan

Re: [Numpy-discussion] numpy.filled, again

2013-06-14 Thread Alan G Isaac
On 6/14/2013 9:27 AM, Aldcroft, Thomas wrote: If I just saw np.values(..) in some code I would never guess what it is doing from the name That suggests np.fromvalues. But more important than the name I think is allowing broadcasting of the values, based on NumPy's broadcasting rules.

Re: [Numpy-discussion] numpy.filled, again

2013-06-14 Thread Alan G Isaac
On 2013/06/14 5:15 AM, Alan G Isaac wrote: But more important than the name I think is allowing broadcasting of the values, based on NumPy's broadcasting rules. Broadcasting a scalar is then a special case, even if it is the case that has dominated this thread. On 6/14/2013 1:18 PM, Eric

Re: [Numpy-discussion] numpy.filled, again

2013-06-13 Thread Alan G Isaac
On 6/13/2013 4:36 PM, Benjamin Root wrote: np.values() might be a decent alternative. This could then reasonably support broadcasting from the shape of the input to the shape of the array. Alan Isaac ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] numpy.filled, again

2013-06-12 Thread Alan G Isaac
Le 12/06/2013 16:18, Nathaniel Smith a écrit : Now imagine a new version of this page, if we add 'filled'. There will be a list at the top with functions named: empty filled ones zeros It's immediately obvious what all of these things do, and how they differ from each other,

Re: [Numpy-discussion] What's the difference between calling __mul__ and *?

2013-06-07 Thread Alan G Isaac
On 6/7/2013 12:30 PM, Will Lee wrote: Can somebody tell me why these operations are not the same in numpy? http://docs.python.org/2/reference/datamodel.html#object.__rmul__ hth, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-04-10 Thread Alan G Isaac
On 4/10/2013 3:31 AM, Robert Kern wrote: You cannot use objects that do not have a valid __eq__() (as in, returns boolean True if and only if they are to be considered equivalent for the purpose of dictionary lookup, otherwise returns False) as dictionary keys. Your oofun object still violates

Re: [Numpy-discussion] try to solve issue #2649 and revisit #473

2013-04-03 Thread Alan G Isaac
On 4/3/2013 2:44 PM, huangkan...@gmail.com wrote: I suggest add function dot to matrix import numpy as np; x = np.arange(5); I = np.asmatrix(np.identity(5)); I.dot(x) matrix([[ 0., 1., 2., 3., 4.]]) Alan Isaac ___ NumPy-Discussion mailing

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-03-15 Thread Alan G Isaac
On 3/15/2013 9:21 AM, Dmitrey wrote: Temporary walkaround for a serious bug in FuncDesigner automatic differentiation kernel due to a bug in some versions of Python or NumPy, Are the suspected bugs documented somewhere? Alan PS The word 'banausic' is very rare in English. Perhaps you meant

Re: [Numpy-discussion] OpenOpt Suite release 0.45

2013-03-15 Thread Alan G Isaac
On 3/15/2013 3:34 PM, Dmitrey wrote: the suspected bugs are not documented yet I'm going to guess that the state of the F_i changes when you use them as keys (i.e., when you call __le__. It is very hard to imagine that this is a Python or NumPy bug. Cheers, Alan

[Numpy-discussion] scipy.optimize.fminbound bound violation

2013-03-07 Thread Alan G Isaac
Under what conditions should I expect fminbound to call the supplied function with argument values substantially outside the user-provided bounds? Thanks, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Alan G Isaac
On 3/1/2013 9:32 AM, Henry Gomersall wrote: there should be an equivalent for floats that unambiguously returns a range for the half open interval If I've understood you: start + stepsize*np.arange(nsteps) fwiw, Alan Isaac ___ NumPy-Discussion

Re: [Numpy-discussion] step paramter for linspace

2013-03-01 Thread Alan G Isaac
One motivation of this thread was that adding a step parameter to linspace might make things easier for beginners. I claim this thread has put the lie to that, starting with the initial post. So what is the persuasive case for the change? Imo, the current situation is good: use arange if you

Re: [Numpy-discussion] drawing the line

2013-02-26 Thread Alan G Isaac
On 2/26/2013 1:11 PM, josef.p...@gmail.com wrote: Alan was in favor of the dot method I still really like this, and it probably violates any simple rule for drawing the line. Nevertheless it would be nice to have some principle(s) other than the squeaky wheel principle for thinking about such

Re: [Numpy-discussion] drawing the line (was: Adding .abs() method to the array object)

2013-02-25 Thread Alan G Isaac
I'm hoping this discussion will return to the drawing the line question. http://stackoverflow.com/questions/8108688/in-python-when-should-i-use-a-function-instead-of-a-method Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Array accumulation in numpy

2013-02-19 Thread Alan G Isaac
x=[1,2,3,4,5,6] ind=[1,3,9,3,4,1] f=np.zeros(10) np.bincount(ind,x) hth, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Shouldn't all in-place operations simply return self?

2013-01-17 Thread Alan G Isaac
Is it really better to have `permute` and `permuted` than to add a keyword? (Note that these are actually still ambiguous, except by convention.) Btw, two separate issues seem to be running side by side. i. should in-place operations return their result? ii. how can we signal that an operation

Re: [Numpy-discussion] New numpy functions: vals and vals_like or filled, filled_like?

2013-01-14 Thread Alan G Isaac
Just changing the subject line so a good suggestion does not get lost ... Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-14 Thread Alan G Isaac
Thanks Pierre for noting that np.tile already provides a chunk of this functionality: a = np.tile(5,(1,2,3)) a array([[[5, 5, 5], [5, 5, 5]]]) np.tile(1,a.shape) array([[[1, 1, 1], [1, 1, 1]]]) I had not realized a scalar first argument was possible. Alan Isaac

Re: [Numpy-discussion] New numpy functions: filled, filled_like

2013-01-13 Thread Alan G Isaac
On Sun, Jan 13, 2013 at 11:24 PM, Robert Kern robert.k...@gmail.com wrote: One alternative that does not expand the API with two-liners is to let the ndarray.fill() method return self: a = np.empty(...).fill(20.0) On 1/13/2013 6:39 PM, Nathaniel Smith wrote: This violates the

Re: [Numpy-discussion] Insights / lessons learned from NumPy design

2013-01-09 Thread Alan G Isaac
I'm just a Python+NumPy user and not a CS type. May I ask a naive question on this thread? Given the work that has (as I understand it) gone into making NumPy usable as a C library, why is the discussion not going in a direction like the following: What changes to the NumPy code base would be

Re: [Numpy-discussion] Insights / lessons learned from NumPy design

2013-01-09 Thread Alan G Isaac
On 1/9/2013 9:58 AM, Nathaniel Smith wrote: I don't think most happy current numpy users are wishing they could switch to writing Lisp on the JVM or vice-versa, so I don't think it's surprising that no-one's jumped up to do this work. Sure. I'm trying to look at this more from the Clojure

Re: [Numpy-discussion] Do we want scalar casting to behave as it does at the moment?

2013-01-08 Thread Alan G Isaac
On 1/8/2013 1:48 PM, Olivier Delalleau wrote: As I mentioned in another post, I also agree that it would make things simpler and safer to just yield the same result as if we were using a one-element array. Yes! Anything else is going to drive people insane, especially new users. Alan Isaac

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/9/2012 12:21 PM, Nathaniel Smith wrote: you might want to double-check that the np.random.choice in 1.7 actually*does* give an error if the input array is not 1-d Any idea where I can look at the code? I browsed github after failing to find a productive search string, but failed to

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/12/2012 8:59 AM, Sebastian Berg wrote: https://github.com/numpy/numpy/blob/master/numpy/random/mtrand/mtrand.pyx#L919 Sounds like it should be pretty simple to add axis=None which would change the current behavior very little, it would stop give an error anymore for none 1-d arrays

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/12/2012 10:00 AM, Nathaniel Smith wrote: I don't really have an opinion on whether those things should be supported, or what the right API should be; I haven't really thought about it. Maybe others on the list have opinions. I was just saying that we have plenty of time to decide about

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
In a comment on the issue https://github.com/numpy/numpy/issues/2724 Sebastian notes: it could also be reasonable to have size=None as default and have it return a scalar/the given axes removed in that case. That would be a real change in functionality unfortunately, but it would make sense for

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/12/2012 12:16 PM, Sebastian Berg wrote: So instead of taking a sequence of length 1, take an element as default. Sebastien has proposed that np.random.choice return a single *element* by default, not a 1d array of length 1. He proposes to associate this with a default value of

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/12/2012 5:46 PM, Nathaniel Smith wrote: Want to make a pull request? Well, I'd be happy to help Sebastien to change the code, but I'm not a git user. And I'd have some questions. E.g., with `size=None`, couldn't we just call Python's random.choice? And for sampling without replacement,

Re: [Numpy-discussion] fix random.choice for 1.7?

2012-11-12 Thread Alan G Isaac
On 11/12/2012 8:18 PM, Sebastian Berg wrote: I have created a pull request This is still a bit different than I thought you intended. With `size=None` we don't get an element, but rather a 0d array. I thought the idea was to return an element in this case? Alan

[Numpy-discussion] random.choice

2012-11-09 Thread Alan G Isaac
I just noticed that 1.7 is scheduled to add a random.choice function. I wonder if the best structure has been chosen. Specifically, it does not provide for array flattening, and it does not provide for subarray choice. Back in 2006 (?) Robert Kern suggested something like the below (forgive any

Re: [Numpy-discussion] m-ary logical functions

2012-07-12 Thread Alan G Isaac
On 7/12/2012 1:45 PM, Nathaniel Smith wrote: I'd actually like to see out= as a kw-only arg. That would be great. Numpy 2.0? Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] possible enhancement to getitem?

2012-06-08 Thread Alan G Isaac
On 6/8/2012 9:14 AM, Neal Becker wrote: The fact that this proposed numpy behavior would not match python list behavior holds little weight for me. It is not just Python behavior for lists. It is the semantics for all sequence types. Breaking this would be appalling. Alan Isaac

Re: [Numpy-discussion] What is consensus anyway

2012-04-25 Thread Alan G Isaac
On 4/25/2012 4:51 PM, Andreas H. wrote: I would assume that most users see numpy as infrastructure, they write their own code on top of it. As a normal user of numpy, I wouldn't know where it would need improvement to suit my needs because it already does all I need. (Okay, masked arrays are

[Numpy-discussion] documentation bug: Matrix library page not populated

2012-04-18 Thread Alan G Isaac
http://docs.scipy.org/doc/numpy/reference/routines.matlib.html#module-numpy.matlib promises a list of functions that does not appear (at the moment, anyway). Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-27 Thread Alan G Isaac
On 2/27/2012 10:10 AM, Paulo Jabardo wrote: I have a few features that I believe would make text file easier for many people. In some countries (most?) the decimal separator in real numbers is not a point but a comma. I think it would be very useful that the decimal separator be specified

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-27 Thread Alan G Isaac
On 2/27/2012 1:00 PM, Paulo Jabardo wrote: First of all '.' isn't international notation That is in fact a standard designation. http://en.wikipedia.org/wiki/Decimal_mark#Influence_of_calculators_and_computers Alan Isaac ___ NumPy-Discussion mailing

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-27 Thread Alan G Isaac
On 2/27/2012 2:28 PM, Pauli Virtanen wrote: ISO specifies comma to be used in international standards (ISO/IEC Directives, part 2 / 6.6.8.1): http://isotc.iso.org/livelink/livelink?func=llobjId=10562502objAction=download I do not think you are right. I think that is a presentational

Re: [Numpy-discussion] Possible roadmap addendum: building better text file readers

2012-02-27 Thread Alan G Isaac
On 2/27/2012 2:47 PM, Matthew Brett wrote: Maybe we can just agree it is an important option to have rather than an unimportant one, It depends on what you mean by option. If you mean there should be conversion tools from other formats to a specified supported format, then I agree. If you

Re: [Numpy-discussion] bincount([], minlength=2) should work right?

2012-02-25 Thread Alan G Isaac
On 2/25/2012 4:44 PM, James Bergstra wrote: bincount([]) makes no sense, I disagree: http://permalink.gmane.org/gmane.comp.python.numeric.general/42041 but if a minlength argument is provided, then the routine should succeed. Definitely! Alan Isaac

Re: [Numpy-discussion] Test survey that I have been putting together

2012-02-24 Thread Alan G Isaac
On 2/23/2012 7:20 PM, Travis Oliphant wrote: https://www.surveymonkey.com/s/numpy_list_survey After you complete the survey, I would really appreciate any feedback on questions that could be improved, removed, or added. I felt the survey was targeting business users rather than academic

Re: [Numpy-discussion] The end of numpy as we know it ?

2012-02-18 Thread Alan G Isaac
On 2/18/2012 10:20 AM, josef.p...@gmail.com wrote: we need to streamline the code so the bunch of amateurs doesn't understand what's going on and cannot effectively threaten a fork anymore. I don't mean to take today's peculiar post too seriously, and your opening line undermines that. But

Re: [Numpy-discussion] Numpy governance update

2012-02-15 Thread Alan G Isaac
On 2/14/2012 10:07 PM, Bruce Southey wrote: The one thing that gets over looked here is that there is a huge diversity of users with very different skill levels. But very few people have an understanding of the core code. (In fact the other thread about type-casting suggests that it is

Re: [Numpy-discussion] Numpy governance update

2012-02-15 Thread Alan G Isaac
On 2/15/2012 1:50 PM, Matthew Brett wrote: I believe that leaving the governance informal and underspecified at this stage would be a grave mistake, for everyone concerned. To justify that concern, can you point to an analogous case, where things went awry by not formalizing the governance

Re: [Numpy-discussion] Numpy governance update

2012-02-15 Thread Alan G Isaac
On 2/15/2012 2:46 PM, Benjamin Root wrote: I think it is only fair that the group occasionally pings this mailing-list for important progress reports. No offense intended, but that sounds like an unfunded mandate. More useful would be an offer to liaison between the two. Cheers, Alan

Re: [Numpy-discussion] Numpy governance update

2012-02-15 Thread Alan G Isaac
On 2/15/2012 2:46 PM, Benjamin Root wrote: The NA discussion is the perfect example where a governance structure would help resolve disputes. How? I'm not seeing it. Who would have behaved differently and why? Alan ___ NumPy-Discussion mailing

Re: [Numpy-discussion] Numpy governance update

2012-02-15 Thread Alan G Isaac
My analysis is fundamentally different than Matthew and Benjamin's for a few reasons. 1. The problem has been miscast. The economic interests of the developers *always* has had an apparent conflict with the economic interests of the users: users want developers to work more on the

Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread Alan G Isaac
On 2/3/2012 5:16 AM, santhu kumar wrote: x = nX3 vector. mass = nX1 vector inert = zeros((3,3)) for i in range(n): ri = x[i,:].reshape(1,3) inert = inert + mass[i,]*(sum(ri*ri)*eye(3) - dot(ri.T,ri)) This should buy you a bit. xdot = (x*x).sum(axis=1) for (massi,xi,xdoti)

Re: [Numpy-discussion] Trick for fast

2012-02-03 Thread Alan G Isaac
On 2/3/2012 3:37 PM, josef.p...@gmail.com wrote: res = - np.dot(x.T, mass*x) res[np.arange(3), np.arange(3)] -= np.trace(res) Nice! Get some speed gain with slicing: res = - np.dot(x.T, mass*x) res.flat[slice(0,None,4)] -= np.trace(res) Alan ___

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Alan G Isaac
On 1/31/2012 8:26 AM, Neal Becker wrote: I was just bitten by this unexpected behavior: In [24]: all ([i 0 for i in xrange (10)]) Out[24]: False In [25]: all (i 0 for i in xrange (10)) Out[25]: True Turns out: In [31]: all is numpy.all Out[31]: True np.array([i 0 for i in xrange

Re: [Numpy-discussion] numpy all unexpected result (generator)

2012-01-31 Thread Alan G Isaac
On 1/31/2012 10:35 AM, Benjamin Root wrote: A generator is an input that could be converted into an array. def mygen(): i = 0 while True: yield i i += 1 Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

[Numpy-discussion] Mersenne Twister: Python vs. NumPy

2011-12-30 Thread Alan G Isaac
If I seed NumPy's random number generator, I get the expected sequence. If I use the same seed for Python's random number generator, I get a different sequence. 1. Why does the Python sequence differ from others? 2. Can I somehow put both MT's in a common state? Thank you, Alan Isaac

Re: [Numpy-discussion] Mersenne Twister: Python vs. NumPy

2011-12-30 Thread Alan G Isaac
On Fri, Dec 30, 2011 at 15:13, Alan wrote: If I seed NumPy's random number generator, I get the expected sequence. On 12/30/2011 10:36 AM, Robert Kern wrote: What do you mean by expected? Where are these expectations coming from? Other implementations of the Mersenne Twister? Right.

Re: [Numpy-discussion] NumPy Governance

2011-12-04 Thread Alan G Isaac
On 12/4/2011 1:43 AM, Charles R Harris wrote: I don't think there are 5 active developers, let alone 11. With hard work you might scrape together two or three. Having 5 or 11 people making decisions for the two or three actually doing the work isn't going to go over well. Very true! But you

Re: [Numpy-discussion] Reading automatically all the parameters from a file

2011-11-30 Thread Alan G Isaac
On 11/30/2011 6:09 AM, Giovanni Plantageneto wrote: I find ConfigParser a bit low level, is there any function that automatically reads everything from a file? You could just use a dictionary for your params, and import it from your configuration file. If you insist on an ini format,

Re: [Numpy-discussion] ANN: Spyder v2.1

2011-11-03 Thread Alan G Isaac
On 11/3/2011 5:36 AM, Pierre Raybaut wrote: * PySide support Congratulations! I hope this means that Spyder will be included in the Enthought Python Distribution (so that I can have my students use it). Alan Isaac ___ NumPy-Discussion mailing list

[Numpy-discussion] simulate AR

2011-10-14 Thread Alan G Isaac
As a simple example, if I have y0 and a white noise series e, what is the best way to produces a series y such that y[t] = 0.9*y[t-1] + e[t] for t=1,2,...? 1. How can I best simulate an autoregressive process using NumPy? 2. With SciPy, it looks like I could do this as e[0] = y0

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread Alan G Isaac
Assuming stationarity ... On 10/14/2011 1:22 PM, josef.p...@gmail.com wrote: maybe ? I just meant that the MA approximation is not reliable for a non-stationary AR. E.g., http://www.jstor.org/stable/2348631 Cheers, Alan ___ NumPy-Discussion mailing

Re: [Numpy-discussion] simulate AR

2011-10-14 Thread Alan G Isaac
On 10/14/2011 1:42 PM, josef.p...@gmail.com wrote: If I remember correctly, signal.lfilter doesn't require stationarity, but handling of the starting values is a bit difficult. Hmm. Yes. AR(1) is trivial, but how do you handle higher orders? Thanks, Alan

Re: [Numpy-discussion] should the return type of matlib.reshape be ndarray or matrix?

2011-10-04 Thread Alan G Isaac
On 10/3/2011 6:59 PM, Pengkui Luo wrote: Most functions in numpy return ndarray by default. Use numpy.asmatrix() if you want a matrix. Please note that the example is using matlib.reshape, not numpy.reshape. Alan Isaac ___ NumPy-Discussion mailing

[Numpy-discussion] should the return type of matlib.reshape be ndarray or matrix?

2011-09-28 Thread Alan G Isaac
Is this the intended behavior? from numpy import matlib m = matlib.reshape([1,2],(2,1)) type(m) type 'numpy.ndarray' For any 2d shape, I expected a matrix. (And probably an exception if the shape is not 2d.) Thanks, Alan Isaac

Re: [Numpy-discussion] Matrix addition, +=

2011-09-12 Thread Alan G Isaac
On 9/12/2011 7:18 AM, Jonas Wallin wrote: Why does MuY += MuY.transpose() and MuY = MuY + MuY.transpose() give different answers? Because the first one is done in-place, so you are changing MuY (and thus MuY.transpose) as the operation proceeds. MuY.transpose() is generally a

Re: [Numpy-discussion] matrix inversion

2011-08-10 Thread Alan G Isaac
On 8/10/2011 8:50 PM, jp d wrote: i am trying to invert matrices like this: [[ 0.01643777 -0.13539939 0.11946689] [ 0.12479926 0.01210898 -0.09217618] [-0.13050087 0.07575163 0.01144993]] in perl using Math::MatrixReal; and in various online calculators i get [ 2.472715991745

Re: [Numpy-discussion] Adding a linear system type to NumPy?

2011-07-17 Thread Alan G Isaac
On 7/17/2011 1:57 PM, Sturla Molden wrote: I suggest inverting a NumPy matrix could result in an unsolved linear system type, instead of actually computing the matrix inverse and returning a new matrix. 1. Too implicit. 2. Too confusing for new users. 2a. Too confusing for students.

Re: [Numpy-discussion] Concepts for masked/missing data

2011-06-25 Thread Alan G Isaac
On 6/25/2011 2:06 PM, Benjamin Root wrote: Note that np.sum([]) also returns 0.0. I think the reason why it has been returning zero instead of NaN was because there wasn't a NaN-equivalent for integers. http://en.wikipedia.org/wiki/Empty_sum fwiw, Alan Isaac

Re: [Numpy-discussion] bincount limitations

2011-06-01 Thread Alan G Isaac
On Thu, Jun 2, 2011 at 1:49 AM, Mark Millermarkperrymil...@gmail.com wrote: Not quite. Bincount is fine if you have a set of approximately sequential numbers. But if you don't On 6/1/2011 9:35 PM, David Cournapeau wrote: Even worse, it fails miserably if you sequential numbers but with

Re: [Numpy-discussion] finding elements that match any in a set

2011-05-29 Thread Alan G Isaac
On 5/28/2011 3:40 PM, Robert wrote: (myarray in mylist) turns into mylist.__contains__(myarray). Only the list object is ever checked for this method. There is no paired method myarray.__rcontains__(mylist) so there is nothing that numpy can override to make this operation do anything

Re: [Numpy-discussion] finding elements that match any in a set

2011-05-29 Thread Alan G Isaac
On 5/28/2011 3:46 PM, Robert Kern wrote: mylist.__contains__(x), it should treat all objects exactly the same: check if it equals any item that it contains. There is no way for it to say, Oh, I don't know how to deal with this type, so I'll pass it over to x.__contains__(). Which makes my

Re: [Numpy-discussion] Windows Registry Keys

2011-05-19 Thread Alan G Isaac
On 5/19/2011 2:07 PM, Mathew Yeates wrote: I have installed a new version of Python27 in a new directory. I want to get this info into the registry so, when I install Numpy, it will use my new Python It probably will already. Did you try? (Assumption: you're using Windows installers.) Alan

Re: [Numpy-discussion] Windows Registry Keys

2011-05-19 Thread Alan G Isaac
On 5/19/2011 2:15 PM, Mathew Yeates wrote: I*am* using the windows installer. And you find that it does not find your most recent Python 2.7 install, for which you also used the Windows installer? Alan Isaac ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Windows Registry Keys

2011-05-19 Thread Alan G Isaac
On 5/19/2011 2:24 PM, Mathew Yeates wrote: The Registry keys point to the old Python27. Odd. The default installation settings should have reset this. Or so I believed. Maybe this will help? http://effbot.org/zone/python-register.htm Alan Isaac

Re: [Numpy-discussion] ATLAS - support letter

2011-04-20 Thread Alan G Isaac
On 4/20/2011 9:55 PM, pratik wrote: If the place where he is seeking tenure does not know his name (i.e hasn't heard of ATLAS) Letters are often more for administrators, who can be from any field, than for the department faculty. fwiw, Alan Isaac

Re: [Numpy-discussion] How to use a function into import function in python

2011-04-08 Thread Alan G Isaac
On 4/8/2011 6:54 AM, dileep kunjaai wrote: I defined a function hit_rate( ) i want to use this into import function(name of function). http://docs.python.org/tutorial/modules.html Alan Isaac ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Rounding the decimal part of a real number

2011-04-06 Thread Alan G Isaac
On 4/6/2011 9:14 AM, dileep kunjaai wrote: Is there any function for rounding the real number, for n (say) decimal places: http://www.google.com/search?q=numpy+round produces http://docs.scipy.org/doc/numpy/reference/generated/numpy.round_.html Cheers, Alan Isaac

Re: [Numpy-discussion] Strange behavior of operator *=

2011-04-05 Thread Alan G Isaac
On 4/5/2011 5:49 AM, François Steinmetz wrote: a = eye(2, dtype='int') a *= 1.0 a ; a.dtype array([[1, 0], [0, 1]]) dtype('int64') This in-place (!) multiplication should not change the dtype of a. I suspect you did not exactly cut and paste... Alan Isaac

Re: [Numpy-discussion] Strange behavior of operator *=

2011-04-05 Thread Alan G Isaac
On 4/5/2011 9:26 AM, François Steinmetz wrote: It does not change the dtype, 'int' is just interpreted as 'int64' : So the meaning of 'int' is system specific? import numpy as np; a=np.eye(2,dtype='int'); a.dtype dtype('int32') Alan Isaac

Re: [Numpy-discussion] Strange behavior of operator *=

2011-04-05 Thread Alan G Isaac
On 4/5/2011 10:37 AM, Nathaniel Smith wrote: Yes, this is a fact about Python 'int', not a fact about numpy -- a Python 'int' is defined to hold a C 'long', which will be either 32 or 64 bits depending on platform. So what is the rule for Python 3, where iiuc it can no longer be a fact about

Re: [Numpy-discussion] Remove deprecated skiprows

2011-04-05 Thread Alan G Isaac
On 4/5/2011 6:11 PM, Skipper Seabold wrote: To my mind, skip_headers is a bool I agree. Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] division operator

2011-04-04 Thread Alan G Isaac
On 4/4/2011 6:49 AM, Alex Ter-Sarkissov wrote: divide(float(var1),float(var2)) http://docs.scipy.org/doc/numpy/reference/generated/numpy.true_divide.html hth, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] What Requires C and what is just python

2011-03-20 Thread Alan G Isaac
On 3/20/2011 11:08 AM, Ben Smith wrote: I'd like to do is limit myself to just the functions that are implemented in python, package it with py2exe and hand that to anyone that needs it. So, my question, if anyone knows, what's implemented in python and what depends on the c libraries?

Re: [Numpy-discussion] NumPy speed tests by NASA

2011-02-22 Thread Alan G Isaac
On 2/22/2011 3:45 PM, Sturla Molden wrote: I came accross some NumPy performance tests by NASA. Comparisons against pure Python, Matlab, gfortran, Intel Fortran, Intel Fortran with MKL, and Java. For those that are interested, it is here: https://modelingguru.nasa.gov/docs/DOC-1762 I don't

Re: [Numpy-discussion] how to do this efficiently?

2011-02-09 Thread Alan G Isaac
On 2/9/2011 10:58 AM, Neal Becker wrote: But where is numpy's 'find_first' function? np.argmax(arrayT) (Of course that constructs a boolean array...) Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] how to do this efficiently?

2011-02-09 Thread Alan G Isaac
On 2/9/2011 11:39 AM, Bruce Southey wrote: np.argmax(x5) # doesn't appear to be correct It was an answer to the particular question of how to do find_first, which it does (at the cost of a boolean array): it finds the first element greater than 5. x array([5, 4, 3, 6, 7, 3, 2, 1])

Re: [Numpy-discussion] counting non-zero entries in an ndarray

2010-12-22 Thread Alan G Isaac
On 12/22/2010 9:16 AM, Ian Stokes-Rees wrote: a != 0 will be used, but I'm not sure then how to count the number of True entries. (a != 0).sum() hth, Alan Isaac ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] sample without replacement

2010-12-21 Thread Alan G Isaac
On 12/20/2010 10:49 PM, josef.p...@gmail.com wrote: What's the difference between a numpy Random and a python random.Random instance of separate states of the random number generators? Sorry, I don't understand the question. The difference for my use is that a np.RandomState instance

[Numpy-discussion] bincount question

2010-12-21 Thread Alan G Isaac
:: np.bincount([]) Traceback (most recent call last): File stdin, line 1, in module ValueError: The first argument cannot be empty. Why not? (I.e., why isn't an empty array the right answer?) Thanks, Alan Isaac ___

[Numpy-discussion] bincount and generators

2010-12-21 Thread Alan G Isaac
bincount does not currently allow a generator as an argument. I'm wondering if it is considered too costly to extend it to allow this. (Motivation: I'm counting based on an attribute of a large number of objects, and I don't need a list of the data.) Thanks, Alan Isaac

[Numpy-discussion] sample without replacement

2010-12-20 Thread Alan G Isaac
I want to sample *without* replacement from a vector (as with Python's random.sample). I don't see a direct replacement for this, and I don't want to carry two PRNG's around. Is the best way something like this? permutation(myvector)[:samplesize] Thanks, Alan Isaac

Re: [Numpy-discussion] sample without replacement

2010-12-20 Thread Alan G Isaac
On 12/20/2010 9:41 PM, josef.p...@gmail.com wrote: python has it in random sample( population, k) Yes, I mentioned this in my original post: http://www.mail-archive.com/numpy-discussion@scipy.org/msg29324.html But good simulation practice is perhaps to seed a simulation specific random

Re: [Numpy-discussion] truth value of dtypes

2010-12-10 Thread Alan G Isaac
On 12/10/2010 4:13 AM, Nils Becker wrote: def f(dtype=None): if not dtype: I think you want: if dtype is None: fwiw, Alan ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org

Re: [Numpy-discussion] numpy speed question

2010-11-25 Thread Alan G Isaac
On 11/25/2010 5:55 AM, Jean-Luc Menut wrote: it was just a test to compare the speed of the cosine function in IDL and numpy The point others are trying to make is that you *instead* tested the speed of creation of a certain object type. To test the *function* speeds, feed both large arrays.

Re: [Numpy-discussion] Advise for numerical programming content (New python user)

2010-11-18 Thread Alan G Isaac
On 11/18/2010 9:48 PM, Sachin Kumar Sharma wrote: Does graphic output like maps, histogram, crossplot, tornado charts is good enough with basic installation or needs some additional packages? For the graphics, you should probably first consider Matplotlib. For your other questions, perhaps

Re: [Numpy-discussion] short circuit != ?

2010-10-27 Thread Alan G Isaac
On 10/27/2010 9:56 AM, Zachary Pincus wrote: the structure of the python language prevents meaningful short-circuiting in the case of np.any(a!=b) Maybe: any((ai != bi) for ai,bi in izip(a.flat,b.flat)) ? fwiw, Alan Isaac ___ NumPy-Discussion

<    1   2   3   4   5   6   7   >