Aronne made good suggestions.
Here is another weapon for your arsenal:
1) I assume that the shape of your array is irrelevant (reshape if needed)
2) Depending on the structure of your data np.unique can be handy:
arr_unique, idx = np.unique(arr1d, return_inverse=True)
then search arr_unique instead
On Feb 7, 2012, at 12:24 PM, Sturla Molden wrote:
> On 07.02.2012 19:17, Benjamin Root wrote:
>
> print x.shape
>> (2, 3, 4)
> print x[0, :, :].shape
>> (3, 4)
> print x[0, :, idx].shape
>> (2, 3)
>
> That looks like a bug to me. The length of the first dimension should be
> the sa
On Mon, Feb 6, 2012 at 11:44 AM, Naresh Pai wrote:
> I have two large matrices, say, ABC and DEF, each with a shape of 7000 by
> 4500. I have another list, say, elem, containing 850 values from ABC. I am
> interested in finding out the corresponding values in DEF where ABC has
> elem and store th
On Tue, Feb 7, 2012 at 2:03 PM, Travis Oliphant wrote:
> John Turner at ORNL has the numpy.org domain and perhaps we could get him to
> point it to numpy.github.com
Remember to also put a CNAME file in the root of the repository:
http://pages.github.com/
Stéfan
On Tue, 7 Feb 2012, Henry Gomersall wrote:
> On Tue, 2012-02-07 at 12:26 -0800, Warren Focke wrote:
>>> Is this a bug I should register?
>>
>> Yes.
>>
>> It should work right if you replace
>> s[axes[-1]] = (s[axes[-1]] - 1) * 2
>> with
>> s[-1] = (a.shape[axes[-1]] - 1) * 2
>> but I'm
On Tue, 2012-02-07 at 12:26 -0800, Warren Focke wrote:
> > Is this a bug I should register?
>
> Yes.
>
> It should work right if you replace
> s[axes[-1]] = (s[axes[-1]] - 1) * 2
> with
> s[-1] = (a.shape[axes[-1]] - 1) * 2
> but I'm not really in a position to test it right now.
I ca
This comes up from time to time.This is an example of what is described at
the top of page 84 of "Guide to NumPy". Also read Chapter 17 to get the
explanation of how fancy indexing is implemented if you really want to
understand the issues.
When you mix fancy-indexing with "simple indexin
On Feb 7, 2012, at 4:02 AM, Pauli Virtanen wrote:
> Hi,
>
> 06.02.2012 20:41, Ralf Gommers kirjoitti:
> [clip]
>> I've created https://github.com/scipy/scipy.github.com and gave you
>> permissions on that. So with that for the built html and
>> https://github.com/scipy/scipy.org-new for the sour
On Tue, Feb 7, 2012 at 2:23 PM, Sturla Molden wrote:
> On 04.02.2012 16:55, Ralf Gommers wrote:
>
> > Although not ideal, I don't have a problem with that in principle.
> > However, wouldn't it break installing without admin rights if Python
> > is installed by the admin?
>
> Not on W
On Tue, 7 Feb 2012, Henry Gomersall wrote:
> On Tue, 2012-02-07 at 11:53 -0800, Warren Focke wrote:
>> You're not doing anything wrong.
>> irfftn takes complex input and returns real output.
>> The exception is a bug which is triggered because max(axes) >=
>> len(axes).
>
> Is this a bug I shoul
On Tue, 2012-02-07 at 11:53 -0800, Warren Focke wrote:
> You're not doing anything wrong.
> irfftn takes complex input and returns real output.
> The exception is a bug which is triggered because max(axes) >=
> len(axes).
Is this a bug I should register?
Cheers,
Henry
_
On Tue, Feb 7, 2012 at 10:41 AM, Sturla Molden wrote:
> It's the combination of a single index and fancy indexing that does
> this, not the slicing.
There are some quirks in the broadcasting machinery that makes it
almost impossible to guess what the outcome of mixed indexing is going
to be. The
On Tue, 7 Feb 2012, Henry Gomersall wrote:
> On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote:
>> irfftn is an optimization for real input and does not take complex
>> input. You have to use numpy.fft.ifftn instead:
>>
> hmmm, that doesn't sound right to me (though there could be some no
On 07.02.2012 19:24, Sturla Molden wrote:
> On 07.02.2012 19:17, Benjamin Root wrote:
>
>> >>> print x.shape
>> (2, 3, 4)
>> >>> print x[0, :, :].shape
>> (3, 4)
>> >>> print x[0, :, idx].shape
>> (2, 3)
>
> That looks like a bug to me. The length of the first dimension should be
> the sam
On 07.02.2012 19:17, Benjamin Root wrote:
> >>> print x.shape
> (2, 3, 4)
> >>> print x[0, :, :].shape
> (3, 4)
> >>> print x[0, :, idx].shape
> (2, 3)
That looks like a bug to me. The length of the first dimension should be
the same.
Sturla
__
On Tue, Feb 7, 2012 at 11:11 AM, Jordi Gutiérrez Hermoso wrote:
> Consider the following. Is this a bug?
>
> Thanks,
> - Jordi G. H.
>
> ---
> #!/usr/bin/python
>
> import numpy as np
>
> x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])
>
> idx =
On 07.02.2012 17:15, David Cournapeau wrote:
> I did not know GotoBLAS2 was open source (it wasn't last time I
> checked). That's very useful information, I will look into it.
One potential problem I just discovered is dependency on a DLL called
libpthreadGC2.dll. First, it's a DLL that must be
> for i in range(m):
> for j in range(n):
> found[i//4,j//4] = cond(x[i,j])
>
Blah, that should be
found[i//4,j//4] |= cond(x[i,j])
Sturla
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
h
On 07.02.2012 17:14, David Cournapeau wrote:
> How did you link a library with mixed C and gfortran ?
Use gfortran instead of gcc when you link. gfortran knows what to do
(and don't put -lgfortran in there). Something like this I think:
gfortran -o whatever.pyd -shared cobj.o fobj.o -lmsvcr90 -
Consider the following. Is this a bug?
Thanks,
- Jordi G. H.
---
#!/usr/bin/python
import numpy as np
x = np.reshape(np.random.uniform(size=2*3*4), [2,3,4])
idx = np.array([False, True, False, True])
y = x[0,:,:];
## Why is this transposed?
print x[
On 07.02.2012 15:27, eat wrote:
> This is elegant and very fast as well!
Just be aware that it depends on C ordered input. So:
m,n = data.shape
cond = lamda x : (x >= t1) & (x <= t2)
x = cond(np.ascontiguousarray(data)).reshape((m//4, 4, n//4, 4))
found = np.any(np.any(x, axis=1)
On Tue, Feb 7, 2012 at 1:55 PM, Sturla Molden wrote:
> On 07.02.2012 14:38, Sturla Molden wrote:
>
>> May I suggest GotoBLAS2 instead of ATLAS?
>
> Or OpenBLAS, which is GotoBLAS2 except it is still maintained.
I did not know GotoBLAS2 was open source (it wasn't last time I
checked). That's very
On Tue, Feb 7, 2012 at 1:30 PM, Sturla Molden wrote:
> On 27.10.2011 15:02, David Cournapeau wrote:
>
>> - we need to recompile atlas (but I can take care of it)
>> - the biggest: it is difficult to combine gfortran with visual
>> studio (more exactly you cannot link gfortran runtime to a vi
Hi
This is elegant and very fast as well!
On Tue, Feb 7, 2012 at 2:57 PM, Sturla Molden wrote:
> On 06.02.2012 22:27, Sturla Molden wrote:
> >
> >
> >>
> >> # Make a 4D view of this data, such that b[i,j]
> >> # is a 2D block with shape (4,4) (e.g. b[0,0] is
> >> # the same as a[:4, :4]).
> >> b
On Tue, 2012-02-07 at 09:15 +, Henry Gomersall wrote:
> > numpy.fft.ifftn(a, axes=axes)
> >
> > Or do you mean if the error message is expected?
>
> Yeah, the question was regarding the error message. Specifically, the
> problem it seems to have with an axes argument like that.
Sorry,
On 07.02.2012 14:38, Sturla Molden wrote:
> May I suggest GotoBLAS2 instead of ATLAS?
Or OpenBLAS, which is GotoBLAS2 except it is still maintained.
https://github.com/xianyi/OpenBLAS
___
NumPy-Discussion mailing list
NumPy-Discussion@scipy.org
http:/
On 27.10.2011 15:02, David Cournapeau wrote:
>- we need to recompile atlas (but I can take care of it)
May I suggest GotoBLAS2 instead of ATLAS?
Is is faster (comparable to MKL), easier to build, and now released
under BSD licence.
http://www.tacc.utexas.edu/tacc-projects/gotoblas2
Sturl
On 27.10.2011 15:02, David Cournapeau wrote:
>- we need to recompile atlas (but I can take care of it)
>- the biggest: it is difficult to combine gfortran with visual
> studio (more exactly you cannot link gfortran runtime to a visual
> studio executable).
Why is that?
I have used gfortr
On 04.02.2012 16:55, Ralf Gommers wrote:
> Although not ideal, I don't have a problem with that in principle.
> However, wouldn't it break installing without admin rights if Python
> is installed by the admin?
Not on Windows.
Sturla
___
Num
On 06.02.2012 22:27, Sturla Molden wrote:
>
>
>>
>> # Make a 4D view of this data, such that b[i,j]
>> # is a 2D block with shape (4,4) (e.g. b[0,0] is
>> # the same as a[:4, :4]).
>> b = as_strided(a, shape=(a.shape[0]/4, a.shape[1]/4, 4, 4),
>> strides=(4*a.strides[0], 4*a.strides
On Mon, Feb 6, 2012 at 2:34 PM, Charles R Harris
wrote:
> Use Polynomial.fit, it tracks the domain for you. Want to use Legendre
> functions? Use Legendre.fit. Want to plot the result? plot(*p.linspace()),
> want to plot the derivative? plot(*p.deriv().linspace()). Want to convert a
> Legendre ser
Hi,
06.02.2012 20:41, Ralf Gommers kirjoitti:
[clip]
> I've created https://github.com/scipy/scipy.github.com and gave you
> permissions on that. So with that for the built html and
> https://github.com/scipy/scipy.org-new for the sources, that should do it.
>
> On the numpy org I don't have the
On Tue, 2012-02-07 at 09:15 +, Henry Gomersall wrote:
>
> On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote:
> > irfftn is an optimization for real input and does not take complex
> > input. You have to use numpy.fft.ifftn instead:
> >
> hmmm, that doesn't sound right to me (though the
On Tue, 2012-02-07 at 01:04 +0100, Torgil Svensson wrote:
> irfftn is an optimization for real input and does not take complex
> input. You have to use numpy.fft.ifftn instead:
>
hmmm, that doesn't sound right to me (though there could be some non
obvious DFT magic that I'm missing). Indeed,
np.i
34 matches
Mail list logo