Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-30 Thread Henry Gomersall
On 29/10/13 18:01, Sebastian Berg wrote: > On Tue, 2013-10-29 at 16:47 +, Henry Gomersall wrote: >> >Is there a way to extract the size of array that would be created by >> >doing 1j*array? >> > > There is np.result_type. It does the handling of scalars as normal, > dtypes will be handled like

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-30 Thread Eraldo Pomponi
> We really ought to have a special page for all of Robert's little gems! > I'm totally in favor or having that page. In my gmail account almost every Robert's answer gets a star!!! Maybe one day I'll try to put them together. Cheers, EP ___ NumPy-Discu

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread David Goldsmith
We really ought to have a special page for all of Robert's little gems! DG On Tue, Oct 29, 2013 at 10:00 AM, wrote: > > -Message: 5 > Date: Tue, 29 Oct 2013 17:02:33 + > From: Robert Kern > Subject: Re: [Numpy-discussion] getting the equi

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread Sebastian Berg
On Tue, 2013-10-29 at 16:47 +, Henry Gomersall wrote: > Is there a way to extract the size of array that would be created by > doing 1j*array? > There is np.result_type. It does the handling of scalars as normal, dtypes will be handled like arrays (scalars are allowed to lose precision). -

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread Henry Gomersall
On 29/10/13 17:02, Robert Kern wrote: > > Quick and dirty: > > # Get a tiny array from `a` to test the dtype of its output when > multiplied > # by a complex float. It must be an array rather than a scalar since the > # casting rules are different for array*scalar and scalar*scalar. > dt = (a.flat

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread Robert Kern
On Tue, Oct 29, 2013 at 4:47 PM, Henry Gomersall wrote: > > Is there a way to extract the size of array that would be created by > doing 1j*array? > > The problem I'm having is in creating an empty array to fill with > complex values without knowing a priori what the input data type is. > > For ex

Re: [Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread Henry Gomersall
On 29/10/13 16:47, Henry Gomersall wrote: > Is there a way to extract the size of array that would be created by > doing 1j*array? Of course, I mean dtype of the array. Henry ___ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.

[Numpy-discussion] getting the equivalent complex dtype from a real or int array

2013-10-29 Thread Henry Gomersall
Is there a way to extract the size of array that would be created by doing 1j*array? The problem I'm having is in creating an empty array to fill with complex values without knowing a priori what the input data type is. For example, I have a real or int array `a`. I want to create an array `b`