[Numpy-discussion] Profiling Python codes with hotshot and KCachegrind

2006-11-08 Thread Fernando Perez
Hi all, in the past, Arnd Baecker has made a number of very useful posts on this matter, and provided some nice utilities to do it. I now needed to profile some fairly complex codes prior to a big optimization push, so I went over his material and wrote a little tool to make the whole process as

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-08 Thread Pierre GM
Michael, First of all, thanks for your interest in the exercise of style the new implementation of MaskedArray is basically nothing but. On Tuesday 07 November 2006 20:11, Michael Sorich wrote: 1. It would be nice if the masked_singleton could be passed into a ndarray, as this would allow it

[Numpy-discussion] Warning: message 1Ggbsf-00056T-Ol delayed 72 hours

2006-11-08 Thread Mail Delivery System
This message was created automatically by mail delivery software. A message that you sent has not yet been delivered to one or more of its recipients after more than 72 hours on the queue on externalmx-1.sourceforge.net. The message identifier is: 1Ggbsf-00056T-Ol The subject of the message

[Numpy-discussion] reading matrix from a file

2006-11-08 Thread amit soni
Hi, i have a file with following format: 1 2 3 9 2 3 4 4I want to read it and then store the values into two matrices, s.t. A=[1 2;3 9] B=[2 3;4 4]Can anyone tell me how to do this in python? thanks Amit Check out the all-new Yahoo! Mail - Fire up a more powerful email and

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

2006-11-08 Thread Keith Goodman
On 11/8/06, izak marais [EMAIL PROTECTED] wrote: Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. All I could find was

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

2006-11-08 Thread Stefan van der Walt
On Wed, Nov 08, 2006 at 05:54:17AM -0800, izak marais wrote: Hi Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. All I

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

2006-11-08 Thread Nadav Horesh
Make A,B, matrices instead of arrays, so instead A = array((..)) Write A = matrix((.)) Assuming you had From numpy import * Nadav From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of izak marais Sent: Wednesday, November 08, 2006 15:54 To:

Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-08 Thread David Cournapeau
Andrew Straw wrote: David Cournapeau wrote: - To send data from the calling process to matlab, you first have to create a mxArray, which is the basic matlab handler of a matlab array, and populating it. Using mxArray is very ackward : you cannot create mxArray from existing data,

Re: [Numpy-discussion] reading matrix from a file

2006-11-08 Thread Francesc Altet
A Dimecres 08 Novembre 2006 13:42, amit soni escrigué: Hi, i have a file with following format: 1 2 3 9 2 3 4 4 I want to read it and then store the values into two matrices, s.t. A=[1 2;3 9] B=[2 3;4 4] Can anyone tell me how to do this in python? thanks Amit There

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

2006-11-08 Thread Albert Swart
Izak, you should first convert you arrays to matrices using ``numpy.matrix``. or numpy.asmatrix() --Rob - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with

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

2006-11-08 Thread Charles R Harris
On 11/8/06, Keith Goodman [EMAIL PROTECTED] wrote: On 11/8/06, izak marais [EMAIL PROTECTED] wrote: Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as

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

2006-11-08 Thread Sven Schreiber
izak marais schrieb: Hi Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. All I could find was the numeric function

Re: [Numpy-discussion] reading matrix from a file

2006-11-08 Thread Charles R Harris
On 11/8/06, Francesc Altet [EMAIL PROTECTED] wrote: A Dimecres 08 Novembre 2006 13:42, amit soni escrigué: Hi, i have a file with following format:1 23 92 34 4I want to read it and then store the values into two matrices, s.t.A=[1 2;3 9]B=[2 3;4 4] Can anyone tell me how to do this in

Re: [Numpy-discussion] reading matrix from a file

2006-11-08 Thread Francesc Altet
A Dimecres 08 Novembre 2006 15:55, Charles R Harris escrigué: Try In [8]: tmp = fromfile('tmp.txt', sep=' ', dtype=int) In [9]: a = tmp[:4].reshape(2,2) In [10]: b = tmp[4:].reshape(2,2) In [11]: a Out[11]: array([[1, 2], [3, 9]]) In [12]: b Out[12]: array([[2, 3],

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

2006-11-08 Thread Joris De Ridder
[im]: Sorry if this is an obvious question, but what is the easiest way to multiply matrices in numpy? Suppose I want to do A=B*C*D. The ' * ' operator apparently does element wise multiplication, as does the 'multiply' ufunc. [im] All I could find was the numeric function

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

2006-11-08 Thread Johannes Loehnert
Hi, in extension to the previous answers, I'd like to say that it is strongly preferable to use dot(A,dot(B,C)) or dot(dot(A,B),C) instead of A*B*C. The reason is that with dot(), you can control of which operation is performed first, which can *massively* influence the time needed, depending

Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-08 Thread Andrew Straw
David Cournapeau wrote: Andrew Straw wrote: David Cournapeau wrote: - To send data from the calling process to matlab, you first have to create a mxArray, which is the basic matlab handler of a matlab array, and populating it. Using mxArray is very ackward : you cannot

Re: [Numpy-discussion] Profiling Python codes with hotshot and KCachegrind

2006-11-08 Thread Fernando Perez
On 11/8/06, Stefan van der Walt [EMAIL PROTECTED] wrote: This looks very interesting. It works for me on simple scripts, but whenever I include the lines from numpy.testing import set_local_path set_local_path('../../..') in the input, pycachegrind aborts with File

[Numpy-discussion] Calculating tan inverse

2006-11-08 Thread amit soni
how can I calculate arctan of a number in python?thanksAmit Sponsored Link Mortgage rates near 39yr lows. $420,000 Mortgage for $1,399/mo - Calculate new house payment- Using Tomcat but need to do more? Need to support web

Re: [Numpy-discussion] Calculating tan inverse

2006-11-08 Thread Nadav Horesh
There is arctan function in numpy, and in math (atan, atan2) Nadav. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of amit soni Sent: Wednesday, November 08, 2006 19:36 To: numpy-discussion@lists.sourceforge.net Subject: [Numpy-discussion] Calculating tan

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-08 Thread A. M. Archibald
On 08/11/06, Pierre GM [EMAIL PROTECTED] wrote: I like your idea, but not its implementation. If MA.masked_singleton is defined as an object, as you suggest, then the dtype of the ndarray it is passed to becomes 'object', as you pointed out, and that is not something one would naturally

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-08 Thread Pierre GM
A good candidate for should be masked marked is NaN. It is supposed to mean, more or less, no sensible value. Which might turn out out to be the best indeed. Michael's application would then look like import numpy as N import maskedarray as MA maskit = N.nan test = N.array([1,2,maskit])

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

2006-11-08 Thread Sven Schreiber
Johannes Loehnert schrieb: Hi, in extension to the previous answers, I'd like to say that it is strongly preferable to use dot(A,dot(B,C)) or dot(dot(A,B),C) instead of A*B*C. The reason is that with dot(), you can control of which operation is performed first, which can *massively*

[Numpy-discussion] slice assignment: strange behaviour

2006-11-08 Thread koara
Hello, a piece of my code started giving strange results with certain data; i managed to track down the cause to a slice array assignment. In the following code snip; 'mat' is a numpy.array with shape=(22973, 1009), 'vec' is a numpy.array with shape=(22973,), both of type int: for i in

[Numpy-discussion] building fc6 rpm of numpy

2006-11-08 Thread Vincent Broman
Building an rpm of numpy-1.0.1.dev3432-1 on fedora core 6 is failing for me. With either python-2.4.3 or 2.4.4 I try python setup.py bdist_rpm inside the source directory, and everything seems to go well except for many File listed twice messages for all kinds of files, and then at the end there

Re: [Numpy-discussion] slice assignment: strange behaviour

2006-11-08 Thread koara
koara wrote: Hello, a piece of my code started giving strange results with certain data; i managed to track down the cause to a slice array assignment. In the Also if i first build a sequence of columns and then use numpy.transpose(numpy.vstack(sequence)) the result is ok. But the

Re: [Numpy-discussion] building fc6 rpm of numpy

2006-11-08 Thread Albert Strasheim
Howdy On Wed, 08 Nov 2006, Vincent Broman wrote: Building an rpm of numpy-1.0.1.dev3432-1 on fedora core 6 is failing for me. With either python-2.4.3 or 2.4.4 I try python setup.py bdist_rpm inside the source directory, and everything seems to go well except for many File listed twice

Re: [Numpy-discussion] building fc6 rpm of numpy

2006-11-08 Thread Albert Strasheim
Argh, On Thu, 09 Nov 2006, Albert Strasheim wrote: %_unpackaged_files_terminate_build 1 Cut and paste error. Make that %_unpackaged_files_terminate_build 0 Cheers, Albert - Using Tomcat but need to do more? Need to

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] building fc6 rpm of numpy

2006-11-08 Thread Neal Becker
Try the enclosed spec file. Also, you can use the one from Fedora devel (I think the one I enclosed is the same).%{!?python_sitearch: %define python_sitearch %(%{__python} -c from distutils.sysconfig import get_python_lib; print get_python_lib(1))} # eval to 2.3 if python isn't yet present,

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-08 Thread Tim Hochberg
A. M. Archibald wrote: On 08/11/06, Pierre GM [EMAIL PROTECTED] wrote: I like your idea, but not its implementation. If MA.masked_singleton is defined as an object, as you suggest, then the dtype of the ndarray it is passed to becomes 'object', as you pointed out, and that is not

[Numpy-discussion] reason

2006-11-08 Thread MONTANA NEBRASKA
Spam postage charges or strings attached Whyi!Drugs often in unable even to once. Visitor Hereplain simple.Threads Posts am Members or Welcome newest member spacerocks.Updated program French lot called mtm available address.Tsig Vermonter worzel Statistics Threads Posts Members Welcome

[Numpy-discussion] Anyone have a little shooting-method function to share

2006-11-08 Thread David L Goldsmith
Hi! I need to numerically solve: (1-t)x + x' - x = f(t), x(0) = x0, x(1) = x1 I've been trying to use (because it's the approach I inherited) an elementary finite-difference discretization, but unit tests have shown that that approach isn't working. After a little review, I believe I

Re: [Numpy-discussion] Passing numpy arrays to matlab

2006-11-08 Thread David Cournapeau
Josh Marshall wrote: I don't see how you are going to get around doing the copies. Matlab is in a separate process from the Python interpreter, and there is no shared memory. In what way do you want these proxy classes to look like numpy arrays? I am not talking about the copy in the

Re: [Numpy-discussion] A reimplementation of MaskedArray

2006-11-08 Thread A. M. Archibald
On 08/11/06, Tim Hochberg [EMAIL PROTECTED] wrote: It has always been my experience (on various flavors or Pentium) that operating on NANs is extremely slow. Does anyone know on what hardware NANs are *not* slow? Of course it's always possible I just never notice NANs on hardware where they