On Tue, Oct 11, 2011 at 6:33 PM, wrote:
> On Tue, Oct 11, 2011 at 7:13 PM, Benjamin Root wrote:
> > On Tue, Oct 11, 2011 at 2:51 PM, Matthew Brett
> > wrote:
> >>
> >> Hi
> >>
> >> On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris
> >> wrote:
> >> >
> >> >
> >> > On Tue, Oct 11, 2011 at 12:23
On Tue, Oct 11, 2011 at 7:13 PM, Benjamin Root wrote:
> On Tue, Oct 11, 2011 at 2:51 PM, Matthew Brett
> wrote:
>>
>> Hi
>>
>> On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris
>> wrote:
>> >
>> >
>> > On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett
>> >
>> > wrote:
>> >>
>> >> Hi,
>> >>
>> >>
On Tue, Oct 11, 2011 at 2:06 PM, Derek Homeier <
de...@astro.physik.uni-goettingen.de> wrote:
> On 11 Oct 2011, at 20:06, Matthew Brett wrote:
>
> > Have I missed a fast way of doing nice float to integer conversion?
> >
> > By nice I mean, rounding to the nearest integer, converting NaN to 0,
> >
On Tue, Oct 11, 2011 at 2:51 PM, Matthew Brett wrote:
> Hi
>
> On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris
> wrote:
> >
> >
> > On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett >
> > wrote:
> >>
> >> Hi,
> >>
> >> I recently ran into this:
> >>
> >> In [68]: arr = np.array(-128, np.int8)
>
Hi,
On Tue, Oct 11, 2011 at 5:30 PM, Derek Homeier
wrote:
> On 11.10.2011, at 9:18PM, josef.p...@gmail.com wrote:
>>>
>>> In [42]: c = np.zeros(4, np.int16)
>>> In [43]: d = np.zeros(4, np.int32)
>>> In [44]: np.around([1.6,np.nan,np.inf,-np.inf], out=c)
>>> Out[44]: array([2, 0, 0, 0], dtype=int
On 11.10.2011, at 9:18PM, josef.p...@gmail.com wrote:
>>
>> In [42]: c = np.zeros(4, np.int16)
>> In [43]: d = np.zeros(4, np.int32)
>> In [44]: np.around([1.6,np.nan,np.inf,-np.inf], out=c)
>> Out[44]: array([2, 0, 0, 0], dtype=int16)
>>
>> In [45]: np.around([1.6,np.nan,np.inf,-np.inf], out=d)
Hi,
On Tue, Oct 11, 2011 at 2:39 PM, Matthew Brett wrote:
> Hi,
>
> I realize it is probably too late to do anything about this, but:
>
> In [72]: info = np.finfo(np.float32)
>
> In [73]: info.minexp
> Out[73]: -126
>
> In [74]: info.maxexp
> Out[74]: 128
>
> minexp is correct, in that 2**(-126)
Hi
On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris
wrote:
>
>
> On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett
> wrote:
>>
>> Hi,
>>
>> I recently ran into this:
>>
>> In [68]: arr = np.array(-128, np.int8)
>>
>> In [69]: arr
>> Out[69]: array(-128, dtype=int8)
>>
>> In [70]: np.abs(arr)
>> O
Hi,
On Tue, Oct 11, 2011 at 3:20 PM, Colin J. Williams
wrote:
> If you are using integers, why not use Python's Long?
You mean, why do I need to know the next lowest representable integer
in a float type?
It's because I have a floating point array that I'm converting to
integers, and I'm trying
Hi,
On Tue, Oct 11, 2011 at 3:16 PM, Charles R Harris
wrote:
>
>
> On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett
> wrote:
>>
>> Hi,
>>
>> I recently ran into this:
>>
>> In [68]: arr = np.array(-128, np.int8)
>>
>> In [69]: arr
>> Out[69]: array(-128, dtype=int8)
>>
>> In [70]: np.abs(arr)
>>
Hi,
On Tue, Oct 11, 2011 at 3:06 PM, Derek Homeier
wrote:
> On 11 Oct 2011, at 20:06, Matthew Brett wrote:
>
>> Have I missed a fast way of doing nice float to integer conversion?
>>
>> By nice I mean, rounding to the nearest integer, converting NaN to 0,
>> inf, -inf to the max and min of the in
If you are using integers, why not use Python's Long?
Colin W.
On 11/10/2011 2:00 PM, Matthew Brett wrote:
Hi,
Can anyone think of a clever way to round an integer to the next
lowest integer represented in a particular floating point format?
For example:
In [247]: a = 2**25+3
This is out of
On Tue, Oct 11, 2011 at 3:06 PM, Derek Homeier
wrote:
> On 11 Oct 2011, at 20:06, Matthew Brett wrote:
>
>> Have I missed a fast way of doing nice float to integer conversion?
>>
>> By nice I mean, rounding to the nearest integer, converting NaN to 0,
>> inf, -inf to the max and min of the integer
On Tue, Oct 11, 2011 at 12:23 PM, Matthew Brett wrote:
> Hi,
>
> I recently ran into this:
>
> In [68]: arr = np.array(-128, np.int8)
>
> In [69]: arr
> Out[69]: array(-128, dtype=int8)
>
> In [70]: np.abs(arr)
> Out[70]: -128
>
>
This has come up for discussion before, but no consensus was ever r
On 11 Oct 2011, at 20:06, Matthew Brett wrote:
> Have I missed a fast way of doing nice float to integer conversion?
>
> By nice I mean, rounding to the nearest integer, converting NaN to 0,
> inf, -inf to the max and min of the integer range? The astype method
> and cast functions don't do what
Hi,
I realize it is probably too late to do anything about this, but:
In [72]: info = np.finfo(np.float32)
In [73]: info.minexp
Out[73]: -126
In [74]: info.maxexp
Out[74]: 128
minexp is correct, in that 2**(-126) is the minimum value for the
exponent part of float32. But maxexp is not correct
Hi,
I recently ran into this:
In [68]: arr = np.array(-128, np.int8)
In [69]: arr
Out[69]: array(-128, dtype=int8)
In [70]: np.abs(arr)
Out[70]: -128
Of course, I can see why this happens, but it is still surprising, and
it seems to me that it would be a confusing source of bugs, because of
co
Hi,
While struggling with floating point precision, I ran into this:
In [52]: a = 2**54+3
In [53]: a
Out[53]: 18014398509481987L
In [54]: np.float128(a)
Out[54]: 18014398509481988.0
In [55]: np.float128(a)-1
Out[55]: 18014398509481987.0
The line above tells us that float128 can exactly repres
Hi,
Have I missed a fast way of doing nice float to integer conversion?
By nice I mean, rounding to the nearest integer, converting NaN to 0,
inf, -inf to the max and min of the integer range? The astype method
and cast functions don't do what I need here:
In [40]: np.array([1.6, np.nan, np.inf
Hi,
Can anyone think of a clever way to round an integer to the next
lowest integer represented in a particular floating point format?
For example:
In [247]: a = 2**25+3
This is out of range of the continuous integers representable by float32, hence:
In [248]: print a, int(np.float32(a))
33554
On 10/11/2011 12:06 PM, Skipper Seabold wrote:
> On Tue, Oct 11, 2011 at 12:41 PM, Christoph Groth wrote:
>> Skipper Seabold writes:
>>
>>> So it's the dot function being called repeatedly on smallish arrays
>>> that's the bottleneck? I've run into this as well. See this thread
>>> [1].
>>> (...)
On Tue, Oct 11, 2011 at 12:41 PM, Christoph Groth wrote:
> Skipper Seabold writes:
>
>> So it's the dot function being called repeatedly on smallish arrays
>> that's the bottleneck? I've run into this as well. See this thread
>> [1].
>> (...)
>
> Thanks for the links. "tokyo" is interesting, tho
Skipper Seabold writes:
> So it's the dot function being called repeatedly on smallish arrays
> that's the bottleneck? I've run into this as well. See this thread
> [1].
> (...)
Thanks for the links. "tokyo" is interesting, though I fear the
intermediate matrix size regime where it really makes
>> My question was about ways to achieve a speedup without modifying the
>> algorithm. I was hoping that there is some numpy-like library for
>> python which for small arrays achieves a performance at least on par
>> with the implementation using tuples. This should be possible
>> technically.
>
Hi Nils,
On 11 Oct 2011, at 16:34, Nils Wagner wrote:
> How do I use genfromtxt to read a file with the following
> lines
>
> 11 2.2592365264892578D+01
> 22 2.2592365264892578D+01
> 13 2.669845581055D+00
>
2011/10/11 Skipper Seabold
> On Tue, Oct 11, 2011 at 11:57 AM, Christoph Groth wrote:
> > Pauli Virtanen writes:
> >
> >>> Thank you for your suggestion. It doesn't help me however, because
> >>> the algorithm I'm _really_ trying to speed up cannot be vectorized
> >>> with numpy in the way you
11.10.2011 17:57, Christoph Groth kirjoitti:
[clip]
> My question was about ways to achieve a speedup without modifying the
> algorithm. I was hoping that there is some numpy-like library for
> python which for small arrays achieves a performance at least on par
> with the implementation using tup
On Tue, Oct 11, 2011 at 11:57 AM, Christoph Groth wrote:
> Pauli Virtanen writes:
>
>>> Thank you for your suggestion. It doesn't help me however, because
>>> the algorithm I'm _really_ trying to speed up cannot be vectorized
>>> with numpy in the way you vectorized my toy example.
>>>
>>> Any o
Pauli Virtanen writes:
>> Thank you for your suggestion. It doesn't help me however, because
>> the algorithm I'm _really_ trying to speed up cannot be vectorized
>> with numpy in the way you vectorized my toy example.
>>
>> Any other ideas?
>
> Reformulate the problem so that it can be vectori
Hi,
I have now spent several hours hunting down a major slowdown of my code caused
(apparently) by using config.add_library() for a reusable part of C source
files instead of just config.add_extension().
The reason of the slowdown was different, but hard to discern, naming of
options and silen
Hi all,
How do I use genfromtxt to read a file with the following
lines
11 2.2592365264892578D+01
22 2.2592365264892578D+01
13 2.669845581055D+00
33 2.2592365264892578D+01
> Any other ideas?
I'm not an expert at all, but I far as I understand if you cannot
vectorize your problem, numpy is not the best tool to use if the speed
matter a bit.
Of course it's not a realistic example, but a simple loop computing a
cosine is 3-4 time slower using numpy cos than python
I don't really understand the operation you have in mind that should lead to
your desired result, so here's a way to get it that discards most of mat's
content: (which does not seem needed to compute what you want):
(stack.T * mat[0, 0]).T
-=- Olivier
2011/10/11 Martin Raspaud
> -BEGIN PGP
11.10.2011 14:14, Christoph Groth kirjoitti:
[clip]
> Thank you for your suggestion. It doesn't help me however, because the
> algorithm I'm _really_ trying to speed up cannot be vectorized with
> numpy in the way you vectorized my toy example.
>
> Any other ideas?
Reformulate the problem so tha
Olivier Delalleau writes:
> Here's a version that uses less Python loops and thus is faster. What
> still takes time is the array creation (np.array(...)), I'm not sure
> exactly why. It may be possible to speed it up.
Thank you for your suggestion. It doesn't help me however, because the
algor
Here's a version that uses less Python loops and thus is faster. What still
takes time is the array creation (np.array(...)), I'm not sure exactly why.
It may be possible to speed it up.
def points_numpy(radius):
rr = radius**2
M = np.identity(2, dtype=int)
x_y = np.array(list(itertools.p
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1
On 11/10/11 07:49, Martin Raspaud wrote:
> Hi all,
[...]
> I'm looking for the operation needed to get the two (stacked) vectors
> array([[0, 1, 2],
>[6, 8, 10]]))
> or its transpose.
Hi again,
Here is a solution I just found:
np.einsum("ik,
Dear numpy experts,
I could not find a satisfying solution to the following problem, so I
thought I would ask:
In one part of a large program I have to deal a lot with small (2d or
3d) vectors and matrices, performing simple linear algebra operations
with them (dot products and matrix multiplicat
В Mon, 10 Oct 2011 11:20:08 -0400
Olivier Delalleau пишет:
>
> The following doesn't use numpy but seems to be about 20x faster:
>
> A_rows = {}
> for i, row in enumerate(A):
> A_rows[tuple(row)] = i
> for i, row in enumerate(B):
> C[i] = A_rows.get(tuple(row), -1)
>
39 matches
Mail list logo