Re: [Numpy-discussion] ufunc for sum of squared difference

2016-11-14 Thread eat
int(1e6)) timeit np.sum(np.square(x- 2.)) 10 loops, best of 3: 23 ms per loop y= x- 2. timeit np.dot(y, y) The slowest run took 18.60 times longer than the fastest. This could mean that an intermediate result is being cached. 1000 loops, best of 3: 1.78 ms per loop timeit np.dot(y, y) 1000 loops, b

Re: [Numpy-discussion] Characteristic of a Matrix.

2015-01-05 Thread eat
*.[2] http://en.wikipedia.org/wiki/Matrix_%28mathematics%29#cite_note-2[3] http://en.wikipedia.org/wiki/Matrix_%28mathematics%29#cite_note-3 (and in this context also python objects). -eat The individual items in a matrix are called its *elements* or *entries*. An example of a matrix with 2

Re: [Numpy-discussion] Characteristic of a Matrix.

2015-01-05 Thread eat
there it doesn't look like np.array's handling of non-conformable lists has any defenders.) +1 for 'object array [and matrix] construction should require explicitly specifying dtype= object' -eat -- Nathaniel J. Smith Postdoctoral researcher - Informatics - University of Edinburgh http

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-10 Thread eat
. Thus the diagonal of such hat matrix would be (u[:, :r]** 2).sum(1). Regards, -eat Sorry for off-topic... ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] deprecate numpy.matrix

2014-02-10 Thread eat
On Mon, Feb 10, 2014 at 9:08 PM, alex argri...@ncsu.edu wrote: On Mon, Feb 10, 2014 at 2:03 PM, eat e.antero.ta...@gmail.com wrote: Rhetorical or not, but FWIW I'll prefer to take singular value decomposition (u, s, vt= svd(x)) and then based on the singular values s I'll estimate

Re: [Numpy-discussion] Creating an ndarray from an iterable over sequences

2014-01-21 Thread eat
, 25], [ 6, 36], [ 7, 49], [ 8, 64], [ 9, 81]]) My 2 cents, -eat Creating two 1-dimensional arrays first is costly as one has to iterate twice over the data. So the only way I see is creating an empty [10,2] array and filling it row by row. This is memory-efficient

Re: [Numpy-discussion] Possible conversion bug with record array

2013-05-22 Thread eat
', 'f4', (4, 4))]) My 2 cents, -eat Nicolas ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy

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

2013-02-26 Thread eat
uninitiated? Regards, -eat Josef Ben Root ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list

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

2013-01-19 Thread eat
Hi, On Fri, Jan 18, 2013 at 12:13 AM, Thouis (Ray) Jones tho...@gmail.comwrote: On Thu, Jan 17, 2013 at 10:27 AM, Charles R Harris charlesr.har...@gmail.com wrote: On Wed, Jan 16, 2013 at 5:11 PM, eat e.antero.ta...@gmail.com wrote: Hi, In a recent thread http

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

2013-01-16 Thread eat
. What do you think? -eat P.S. FWIW, if this idea really gains momentum obviously I'm volunteering to create a PR of it. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] argsort

2013-01-15 Thread eat
], [11, 9], [23, 12]]) -eat Best regards, Mads -- +-+ | Mads Ipsen | +--+--+ | Gåsebæksvej 7, 4. tv | | | DK-2500

Re: [Numpy-discussion] nan result from np.linalg.lstsq()

2012-10-29 Thread eat
Hi, On Mon, Oct 29, 2012 at 11:01 AM, Larry Paltrow larry.palt...@gmail.comwrote: np.isnan(data) is True False Check with: np.all(~np.isnan(x)) My 2 cents, -eat On Mon, Oct 29, 2012 at 1:50 AM, Pauli Virtanen p...@iki.fi wrote: Larry Paltrow larry.paltrow at gmail.com writes: I'm

Re: [Numpy-discussion] sum and prod

2012-09-08 Thread eat
) generator object genexpr at 0x062BDA08 In []: print np.prod([(arg 0) for arg in args]) 1 In []: print np.prod( (arg 0) for arg in args).next() True In []: sys.version Out[]: '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel)]' In []: np.version.version Out[]: '1.6.0' My 2 cents, -eat

Re: [Numpy-discussion] 2 greatest values, in a 3-d array, along one axis

2012-08-03 Thread eat
]]) In []: # second largest In []: a[a.argsort(0), ndx[1], ndx[2]][-2] Out[]: array([[4, 2, 4, 4], [5, 4, 4, 4]]) My 2 cents, -eat Angus. -- AJC McMorland Post-doctoral research fellow Neurobiology, University of Pittsburgh ___ NumPy-Discussion

Re: [Numpy-discussion] Reordering 2 dimensional array by column

2012-08-02 Thread eat
[b_indices[::-1]] new_b = b_matrix[len(b_matrix)-1] Is there an easy way to reorder it? Or is there at least a complicated way which produces the right output? I hope you can help me! Thanks! My 2 cents, -eat Best regards, Nicole ___ NumPy

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom vlastimil.b...@gmail.comwrote: 2012/7/30 eat e.antero.ta...@gmail.com: Hi, A partial answer to your questions: On Mon, Jul 30, 2012 at 10:33 PM, Vlastimil Brom vlastimil.b...@gmail.com wrote: Hi all, I'd like to ask

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom vlastimil.b...@gmail.comwrote: 2012/7/31 eat e.antero.ta...@gmail.com: Hi, On Tue, Jul 31, 2012 at 10:23 AM, Vlastimil Brom vlastimil.b...@gmail.com wrote: 2012/7/30 eat e.antero.ta...@gmail.com: Hi, A partial answer

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 6:43 PM, Nathaniel Smith n...@pobox.com wrote: On Tue, Jul 31, 2012 at 2:23 PM, eat e.antero.ta...@gmail.com wrote: Apparently ast(.) does not return a view of the original matches rather a copy of size (n* (2* distance+ 1)), thus you may run out of memory

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 7:30 PM, Nathaniel Smith n...@pobox.com wrote: On Tue, Jul 31, 2012 at 4:57 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Tue, Jul 31, 2012 at 6:43 PM, Nathaniel Smith n...@pobox.com wrote: On Tue, Jul 31, 2012 at 2:23 PM, eat e.antero.ta...@gmail.com

Re: [Numpy-discussion] array slicing questions

2012-07-31 Thread eat
Hi, On Tue, Jul 31, 2012 at 7:20 PM, Vlastimil Brom vlastimil.b...@gmail.comwrote: 2012/7/31 eat e.antero.ta...@gmail.com: Hi, On Tue, Jul 31, 2012 at 5:01 PM, Vlastimil Brom vlastimil.b...@gmail.com wrote: 2012/7/31 eat e.antero.ta...@gmail.com: Hi, On Tue, Jul 31, 2012

Re: [Numpy-discussion] array slicing questions

2012-07-30 Thread eat
?) And of course, are there maybe other things, which should be made better/differently? (using Numpy 1.6.2, python 2.7.3, win XP) My 2 cents, -eat Thanks in advance for any hints or suggestions, regards, Vlastimil Brom ___ NumPy

Re: [Numpy-discussion] np.unique for one bi-dimensional array

2012-07-24 Thread eat
array. However, perhaps something like the following lines will help you: In []: lot= zip(a_clean, b_clean) In []: lot Out[]: [(4, 3), (4, 5), (5, 4), (4, 4), (4, 3), (4, 4)] In []: [[x, lot.count(x)] for x in set(lot)] Out[]: [[(4, 5), 1], [(5, 4), 1], [(4, 4), 2], [(4, 3), 2]] My 2 cents, -eat

Re: [Numpy-discussion] Problems understanding histogram2d

2012-07-20 Thread eat
state that x and y must be one dimensional and they must be equal length. My 2 cents, -eat On Fri, Jul 20, 2012 at 5:11 PM, Andreas Hilboll li...@hilboll.de wrote: Hi, I have a problem using histogram2d: from numpy import linspace, histogram2d bins_x = linspace(-180., 180., 360

Re: [Numpy-discussion] Good way to develop numpy as popular choice!

2012-06-22 Thread eat
exists into python list of lists? If all my processing before the munkres step is using NumPy, converting it into python lists has a cost. Also, your timings indicate only ~2x slowdown, while the timing tests done by eat show an order-of-magnitude difference. I suspect there is great room

Re: [Numpy-discussion] Good way to develop numpy as popular choice!

2012-06-21 Thread eat
for example at http://www.assignmentproblems.com/). How the assignment algorithms are (typically) described, it actually may be quite a tedious job to create more performance ones utilizing numpy arrays instead of lists of lists. My 2 cents, -eat http://pypi.python.org/pypi/munkres

Re: [Numpy-discussion] convert any non square matrix in to square matrix using numpy

2012-06-18 Thread eat
, 0.54991376, 0.78182313], [ 0.42980812, 0.59622975, 0.29315485, 0.3828001 ], [ 0., 0., 0., 0.], [ 0., 0., 0., 0.]]) will help you. My 2 cents, -eat ___ NumPy

Re: [Numpy-discussion] fast access and normalizing of ndarray slices

2012-06-04 Thread eat
0.2 0.3 0.4 0.17 0.33 0.5 ] Fast enough: In []: data, lengths= gen([5, 15, 5e4]) In []: data.size Out[]: 476028 In []: %timeit normalize(data, lengths) 10 loops, best of 3: 29.4 ms per loop My 2 cents, -eat -- srean On Thu, May 31, 2012 at 12:36 AM, Wolfgang Kerzendorf wkerzend

Re: [Numpy-discussion] why not zerodivision error?

2012-05-20 Thread eat
encountered in divide My 2 cents, -eat Chao -- *** Chao YUE Laboratoire des Sciences du Climat et de l'Environnement (LSCE-IPSL) UMR 1572 CEA-CNRS-UVSQ Batiment 712 - Pe 119 91191 GIF Sur YVETTE Cedex Tel: (33

Re: [Numpy-discussion] (no subject)

2012-04-22 Thread eat
]], [[ 1, 2, 15, 28], [17, 18, 9, 20], [-1, 2, 23, 4]]]) My 2 cents, -eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] problem with vectorized difference equation

2012-04-07 Thread eat
loop In []: timeit s1(y, u) 100 loops, best of 3: 2.16 ms per loop In []: 122/ 2.16 Out[]: 56.48148148148148 My 2 cents, -eat will accumulate and give y = [1,7,14,22] Sameer Am I missing something? Regards, Francesco Sameer Grover wrote: On Saturday 07 April 2012 12:14 AM

Re: [Numpy-discussion] Numpy Memory Error with corrcoef

2012-03-27 Thread eat
= np.random.randn(5, 3) print np.corrcoef(data).round(3) print c= Correlations(data) print np.array([p for p in c.obs_iterate()]).round(3) My 2 cents, -eat Best regards, Nicole Stoffels -- Dipl.-Met. Nicole Stoffels Wind Power Forecasting and Simulation ForWind - Center for Wind

Re: [Numpy-discussion] Want to eliminate direct for-loop

2012-02-11 Thread eat
, 1, 1, 48, 68, 1, 75, 1, 1, 115, 1, 95, 1, 1, 1, 1, 1, 1, 1, 28, 1, 68, 1, 1, 28]) My 2 cents, -eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman

Re: [Numpy-discussion] numpy.arange() error?

2012-02-09 Thread eat
this issue is raised also earlier, but wouldn't it be more consistent to let arange operate only with integers (like Python's range) and let linspace handle the floats as well? My 2 cents, eat Eric ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-07 Thread eat
= t2) x = cond(data).reshape((m//4, 4, n//4, 4)) found = np.any(np.any(x, axis=1), axis=2) Regards, eat Sturla ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread eat
= np.where((excerpt= t1) (excerpt= t2), True, False) return mask.sum(2).sum(2).astype(np.bool) if __name__ == '__main__': from numpy.random import randint r= randint(777, size= (64, 288)); print r print np.allclose(ds_0(r), ds_1(r)) My 2 cents, eat

Re: [Numpy-discussion] avoiding loops when downsampling arrays

2012-02-06 Thread eat
153 ..., 316 613 570]] True and compared in performance wise: In []: %timeit ds_0(r) 10 loops, best of 3: 56.3 ms per loop In []: %timeit ds_1(r) 100 loops, best of 3: 2.17 ms per loop My 2 cents, eat Catherine ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] Unrealistic expectations of class Polynomial or a bug?

2012-01-30 Thread eat
On Sat, Jan 28, 2012 at 11:14 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Sat, Jan 28, 2012 at 11:15 AM, eat e.antero.ta...@gmail.com wrote: Hi, Short demonstration of the issue: In []: sys.version Out[]: '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel

[Numpy-discussion] Unrealistic expectations of class Polynomial or a bug?

2012-01-28 Thread eat
not face this issue) or - it's just the 'nature' of computations with float values (if so, probably I should be able to tackle this regardless of the polynomial order) or - it's a nasty bug in class Polynomial Regards, eat ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread eat
[]: 3045.74724 Or does the results of calculations depend more on the platform? My 2 cents, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] bug in numpy.mean() ?

2012-01-24 Thread eat
of whether it is a version or platform related problem. -eat On Tue, 2012-01-24 at 17:12 -0600, eat wrote: Hi, Oddly, but numpy 1.6 seems to behave more consistent manner: In []: sys.version Out[]: '2.7.2 (default, Jun 12 2011, 15:08:59) [MSC v.1500 32 bit (Intel

[Numpy-discussion] Would it be possible to enhance np.unique(.) with a keyword kind

2011-12-19 Thread eat
over complicated unless I'm not able to request a stable sorting order from np.unique(.) (like np.unique(., return_index= True, kind= 'mergesort'). (FWIW, I apparently do have a working local hack for this kind of functionality, but without extensive testing of 'all' corner cases). Thanks, eat

Re: [Numpy-discussion] Would it be possible to enhance np.unique(.) with a keyword kind

2011-12-19 Thread eat
Hi, On Tue, Dec 20, 2011 at 2:33 AM, josef.p...@gmail.com wrote: On Mon, Dec 19, 2011 at 6:27 PM, eat e.antero.ta...@gmail.com wrote: Hi, Especially when the keyword return_index of np.unique(.) is specified to be True, would it in general also be reasonable to be able to specify

Re: [Numpy-discussion] Would it be possible to enhance np.unique(.) with a keyword kind

2011-12-19 Thread eat
Hi, On Tue, Dec 20, 2011 at 3:41 AM, josef.p...@gmail.com wrote: On Mon, Dec 19, 2011 at 8:16 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Tue, Dec 20, 2011 at 2:33 AM, josef.p...@gmail.com wrote: On Mon, Dec 19, 2011 at 6:27 PM, eat e.antero.ta...@gmail.com wrote: Hi

Re: [Numpy-discussion] build numpy matrix out of smaller matrix

2011-12-01 Thread eat
] [1,2,1,2] [3,4,3,4]] i tried different things on numpy which didn't work any ideas ? Perhaps something like this: In []: a= np.array([[1, 2], [3, 4]]) In []: np.c_[[a, a], [a, a]] Out[]: array([[[1, 2, 1, 2], [3, 4, 3, 4]], [[1, 2, 1, 2], [3, 4, 3, 4]]]) Regards, eat

Re: [Numpy-discussion] build numpy matrix out of smaller matrix

2011-12-01 Thread eat
., 3., 4., 4.], [ 3., 3., 4., 4.]]) But, of'course this is way more generic (and preferable) approach to utilize. eat Josef Cheers! Ben Root ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org

Re: [Numpy-discussion] Example Usage of Neighborhood Iterator in Cython

2011-10-17 Thread eat
], [6, 7, 8, 9, 0], [7, 8, 9, 0, 1]]) Regards, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion

Re: [Numpy-discussion] Fill a particular value in the place of number satisfying certain condition by another number in an array.

2011-08-01 Thread eat
Hi On Mon, Aug 1, 2011 at 3:14 PM, Jeffrey Spencer jeffspenc...@gmail.comwrote: Depends where it is contained but another option is and I find it to typically be faster: B = zeros(A.shape) maximum(A,B,A) Since maximum(.) can handle broadcasting maximum(A, 0, A) will be even faster. -eat

Re: [Numpy-discussion] Rationale for returning type-wrapped min() / max() scalars? (was: Problem with ufunc of a numpy.ndarray derived class)

2011-07-31 Thread eat
[]: C_CONTIGUOUS : True F_CONTIGUOUS : False OWNDATA : False WRITEABLE : True ALIGNED : True UPDATEIFCOPY : False Seems to be slightly inconsistent, but does it really matter? -eat This on Linux 64 with latest master. Chuck ___ NumPy

Re: [Numpy-discussion] Array vectorization in numpy

2011-07-20 Thread eat
)) 0.058299207687377931 More like: In []: %timeit m =- .5 1000 loops, best of 3: 35 ns per loop -eat t=timeit.Timer('m -= 0.5', setup='import numpy as np;m = np.ones([8092,8092],float)') np.mean(t.repeat(repeat=10, number=1)) 0.28192551136016847 t=timeit.Timer('np.subtract(m, 0.5, m

Re: [Numpy-discussion] SVD does not converge

2011-06-28 Thread eat
on a square 5x5 matrix? Something like: A_pinv= dot(A, pinv(dot(A.T, A))).T Instead of a 380x380 based matrix: A_pinv= dot(pinv(dot(A, A.T)), A).T My two cents - eat -- Lou Pecora, my views are my own. ___ NumPy-Discussion mailing list NumPy

Re: [Numpy-discussion] missing data discussion round 2

2011-06-28 Thread eat
cause of NaNs. But I believe there exists plenty other much more sophisticated situations where this kind of simple treatment is not sufficient, at all. Anyway, even in the future it should still be possible to play nicely with these kind of simple scenarios. - eat Thanks, Jason

Re: [Numpy-discussion] missing data discussion round 2

2011-06-27 Thread eat
'missing data' is not doable. Thanks, - eat -Mark ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list

Re: [Numpy-discussion] missing data discussion round 2

2011-06-27 Thread eat
On Mon, Jun 27, 2011 at 8:53 PM, Mark Wiebe mwwi...@gmail.com wrote: On Mon, Jun 27, 2011 at 12:44 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Mon, Jun 27, 2011 at 6:55 PM, Mark Wiebe mwwi...@gmail.com wrote: First I'd like to thank everyone for all the feedback you're providing

Re: [Numpy-discussion] argmax for top N elements

2011-06-22 Thread eat
cents, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http

Re: [Numpy-discussion] 3d ODR

2011-06-16 Thread eat
://docs.scipy.org/doc/scipy/reference/odr.html My 2 cents, eat Regards, Christian K. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

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

2011-05-29 Thread eat
[]: True In [1061]: [3, 1, 4] in A Out[1061]: True But In []: [1, 2, 3] in A Out[]: False In []: [3, 2, 1] in A Out[]: True So, obviously the logic behind __contains__ is not so very straightforward. Perhaps just a bug? Regards, eat The docstring is not helpful: In [58]: np.ndarray

Re: [Numpy-discussion] Need to eliminate a nested loop

2011-05-11 Thread eat
, -1) U= np.r_[u0, u1, u2, np.ones((1, n** 3))] f= (np.dot(E, U)* U).sum(0).reshape(n, n, n) Regards,eat Thanks Eleanor -- View this message in context: http://old.nabble.com/Need-to-eliminate-a-nested-loop-tp31591457p31591457.html Sent from the Numpy-discussion mailing list archive

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-31 Thread eat
() bbins= (bins[:-1]+ d).ravel() bbins= r_[bbins, bbins[-1]+ 1] counts, _= histogram(b, bbins) return counts.reshape(-1, nob), bins It has two disadvantages 1) needs more memory and 2) global bins (which although should be quite straightforward to enhance if needed). Regards, eat

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-30 Thread eat
on. Just wondering if this kind massive histogramming could be somehow avoided totally. Regards, eat Éric. So it seems that you give your array directly to histogramdd (asking a 4000D histogram!). Surely that's not what you are trying to achieve. Can you elaborate more on your objectives

Re: [Numpy-discussion] random number genration

2011-03-29 Thread eat
with probability q=1-p? Would it be sufficient to: In []: bs= ones(1e6, dtype= int) In []: bs[randint(0, 1e6, 1e5)]= 0 In []: bs.sum()/ 1e6 Out[]: 0.904706 Regards, eat thanks ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http

Re: [Numpy-discussion] random number genration

2011-03-29 Thread eat
On Tue, Mar 29, 2011 at 1:29 PM, eat e.antero.ta...@gmail.com wrote: Hi, On Tue, Mar 29, 2011 at 12:00 PM, Alex Ter-Sarkissov ater1...@gmail.comwrote: If I want to generate a string of random bits with equal probability I run random.randint(0,2,size). What if I want a specific

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread eat
parameters using np.histogram. FWIW, have you considered to use http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogramdd.html#numpy.histogramdd Regards, eat Thanks. Éric. Un clavier azerty en vaut deux -- Éric Depagne

Re: [Numpy-discussion] np.histogram on arrays.

2011-03-29 Thread eat
Hi, On Tue, Mar 29, 2011 at 5:13 PM, Éric Depagne e...@depagne.org wrote: FWIW, have you considered to use http://docs.scipy.org/doc/numpy/reference/generated/numpy.histogramdd.html# numpy.histogramdd Regards, eat I tried, but I get a /usr/lib/pymodules/python2.6/numpy/lib

Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output

2011-03-24 Thread eat
. Would old= seterr(invalid= 'ignore') be sufficient for you? Regards, eat from numpy import __version__ __version__ '2.0.0.dev-1fe8136' D. ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy

Re: [Numpy-discussion] should get rid of the annoying numpy STDERR output

2011-03-24 Thread eat
-manager, but that's really create! (Perhaps documents could reflect that.) Regards, eat In [3]: np.array(np.inf)*0. Warning: invalid value encountered in multiply Out[3]: nan In [4]: with np.errstate(all='ignore'): ...: np.array(np.inf)*0. ...: ...: Out[4]: nan In [5]: np.array

Re: [Numpy-discussion] avoid a line...

2011-03-17 Thread eat
). Regards, eat -- DILEEPKUMAR. R J R F, IIT DELHI ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing

Re: [Numpy-discussion] Norm of array of vectors

2011-03-17 Thread eat
with minimal norm. Is there more efficient way to do this than argmin(array([sqrt(dot(x,x)) for x in vec_array]))? Try argmin(sum(vec_array** 2, 0)** 0.5) Regards, eat Thanks in advance. Andrey. ___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] view 1d array as overlapping segments?

2011-03-07 Thread eat
6] # [ 3 4 5 6 0] # last item garbage # [ 4 5 6 0 34]] # 2 last items garbage My two cents, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Taking a large number of dot products at once

2011-03-03 Thread eat
, 0.19113117, 1.37267133, 0.74219888, 1.55296562, 0.15264303, 0.72039922]) In [493]: dot(x[:, 0].T, y[:, 0]) Out[493]: 1.2540468282421895 Regards, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org

Re: [Numpy-discussion] OT: performance in C extension; OpenMP, or SSE ?

2011-02-15 Thread eat
based full matrix calculations can be done less than 5 ms. My two cents, eat I'm using gcc on Linux. Now I'm wondering if I could go even faster !? My hope that the compiler might automagically do some SSE2 optimization got disappointed. Since I have a 4 core CPU I thought OpenMP might

Re: [Numpy-discussion] odd performance of sum?

2011-02-12 Thread eat
Hi Sturla, On Sat, Feb 12, 2011 at 5:38 PM, Sturla Molden stu...@molden.no wrote: Den 10.02.2011 16:29, skrev eat: One would expect sum to outperform dot with a clear marginal. Does there exixts any 'tricks' to increase the performance of sum? First of all, thanks for you still replying

[Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)]' # installed binaries from http://python.org/ In []: np.version.version Out[]: '1.5.1' # installed binaries from http://scipy.org/ Regards, eat ___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
, you'll reach to spend more time ;-). Regards, eat On Thu, Feb 10, 2011 at 7:10 PM, Charles R Harris charlesr.har...@gmail.com wrote: On Thu, Feb 10, 2011 at 8:29 AM, eat e.antero.ta...@gmail.com wrote: Hi, Observing following performance: In []: m= 1e5 In []: n= 1e2 In []: o= ones(n

Re: [Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
Hi Robert, On Thu, Feb 10, 2011 at 8:16 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 10, 2011 at 11:53, eat e.antero.ta...@gmail.com wrote: Thanks Chuck, for replying. But don't you still feel very odd that dot outperforms sum in your machine? Just to get it simply; why sum

Re: [Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
). Thanks, eat -- Pauli Virtanen ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion ___ NumPy-Discussion mailing list NumPy-Discussion

Re: [Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
Hi Robert, On Thu, Feb 10, 2011 at 10:58 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 10, 2011 at 14:29, eat e.antero.ta...@gmail.com wrote: Hi Robert, On Thu, Feb 10, 2011 at 8:16 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 10, 2011 at 11:53, eat e.antero.ta

Re: [Numpy-discussion] odd performance of sum?

2011-02-10 Thread eat
Hi, On Fri, Feb 11, 2011 at 12:08 AM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 10, 2011 at 15:32, eat e.antero.ta...@gmail.com wrote: Hi Robert, On Thu, Feb 10, 2011 at 10:58 PM, Robert Kern robert.k...@gmail.com wrote: On Thu, Feb 10, 2011 at 14:29, eat e.antero.ta

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-02-01 Thread eat
the coefficient arrays reasonable (perhaps some kind of lightweigt 'database' for them ;-). Please feel free to provide any more information. Regards, eat On Tue, Feb 1, 2011 at 10:20 PM, dpar...@chromalloy.com wrote: I'm not sure I need to dive into cython or C for this - performance

Re: [Numpy-discussion] Vectorize or rewrite function to work with array inputs?

2011-01-31 Thread eat
= air_gamma_1(t) ag[np.logical_or(t 379., t 4731.)]= NAN return ag elif far 0.069: ag= air_gamma_2(t, far) ag[np.logical_or(t 699., t 4731.)]= NAN return ag else: return NAN Rest of the code is in the attachment. My two cents, eat NAN = float

Re: [Numpy-discussion] Help in speeding up accumulation in a matrix

2011-01-29 Thread eat
. It still involves Python looping but that's not so much overhead. My 2 cents eat For instance I could use broadcasting by using a dot product %timeit dot(Ms.T,w) 1 loops, best of 3: 1.77 s per loop But this is i) slower ii) takes too much memory (btw, I'd really need an inplace dot-product in numpy

[Numpy-discussion] tril, triu, document/ implementation conflict

2011-01-26 Thread eat
'fix' incase someone is interested. Regards, eat twodim_base_fix.py Description: Binary data ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] tril, triu, document/ implementation conflict

2011-01-26 Thread eat
Hi, On Wed, Jan 26, 2011 at 2:35 PM, josef.p...@gmail.com wrote: On Wed, Jan 26, 2011 at 7:22 AM, eat e.antero.ta...@gmail.com wrote: Hi, I just noticed a document/ implementation conflict with tril and triu. According tril documentation it should return of same shape and data-type

[Numpy-discussion] How to improve performance of slow tri*_indices calculations?

2011-01-24 Thread eat
? Regards, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Crosstabulation

2010-07-19 Thread eat
)), np.int) for i in xrange(len(c1)): tmp= d2[c1[i]== d1] for j in xrange(len(c2)): xtab[i, j]= np.sum(c2[j]== tmp) print xtab, np.sum(xtab)== np.prod(d1.shape) Anyway it's straightforward to extend it to nd x-tabulations ;-). My 2 cents, eat

Re: [Numpy-discussion] Find indices of largest elements

2010-04-15 Thread eat
, 2], [2, 3, 3], [3, 4, 1]]) n= 3 # between print [np.unravel_index(ind, a.shape) for ind in np.argsort(a.ravel())[-n:]] # and print [np.where(val== a) for val in np.sort(a.ravel())[-n:]] Regards, eat Best, -Nikolaus ___ NumPy-Discussion

Re: [Numpy-discussion] Find indices of largest elements

2010-04-14 Thread eat
, -Niko Hi, Just a= np.asarray([[1, 8, 2], [2, 1, 3]]) print np.where((a.T== a.max(axis= 1)).T) However, if any row contains more than 1 max entity, above will fail. Please let me to know if that's relevant for you. -eat ___ NumPy-Discussion mailing

Re: [Numpy-discussion] Getting index of array after applying cond

2010-04-02 Thread eat
is x[cond].max()? Just my 2 cents. Regards, eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion

Re: [Numpy-discussion] Getting index of array after applying cond

2010-04-02 Thread eat
this current thread relate anyway to the earlier one 'Match two arrays'? If so, would you like to elaborate more about your 'real' problem? Regards, eat Thanks, Shailendra ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http

Re: [Numpy-discussion] quot;Matchquot; two arrays

2010-04-01 Thread eat
not be used. I can think of only C style code to achieve this. Can any one suggest pythonic way of doing this? Thanks, Shailendra This is straightforward implementation as a starting point. eat code import numpy as np def dist(p1, p2): return np.sqrt(np.sum((p1- p2)** 2, 0)) def cdist(p1

Re: [Numpy-discussion] amp;quot;Matchamp;quot; two arrays

2010-04-01 Thread eat
Oops. Wrongly timed. t= np.array(timeit.repeat(perf, repeat= rep, number= 1))/ rep should be t= np.array(timeit.repeat(perf, repeat= rep, number= 1)) eat ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org