Tim Hochberg wrote:
> Another little tidbit: this is not as general as where, and could
> probably be considered a little too clever to be clear, but:
>
> b = 1 / (a + (a==0.0))
>
> is faster than using where in this particular case and sidesteps the
> divide by zero issue altogether.
Unfortunately, where does not have the behavior of not evaluating the second argument where the first one is true. That would be nice (if the speed were ok) but it isn't possible unless where is built into the language, since where doesn't even get called until the arguments have all been calculate
[EMAIL PROTECTED] wrote:
> Using numpy 1.0, why does
>
>
>
>
a = numpy.array([0.0,1.0,2.0],'d')
>
>
numpy.where(a
> == 0.0,1,1/a)
>
>
>
> give the correct result, but with the warning "Warning: divide
> by zero encountered in divide"?
>
>
>
> ? I thought
On 11/13/06, Mathew Yeates <[EMAIL PROTECTED]> wrote:
Not sure. When I run "top" I see the lineMemory: 6016M real, 2895M free, 4174M swap in use, 2427M swap freeIts the second number that drops like a rock. Plus, it never comes backuntil I quit the program. This is a great way to turn my machine in
[EMAIL PROTECTED] wrote:
> ? I thought that the point of where was
> that the second expression is never used for the elements where the condition
> evaluates true.
It is not used, but the expression still gets evaluated. There's really no way
around that.
> If this is the desired behavior, is t
Using numpy 1.0, why does
>>> a = numpy.array([0.0,1.0,2.0],'d')
>>> numpy.where(a
== 0.0,1,1/a)
give the correct result, but with the warning "Warning: divide
by zero encountered in divide"?
? I thought that the point of where was
that the second expression is never used for the elements
Not sure. When I run "top" I see the line
Memory: 6016M real, 2895M free, 4174M swap in use, 2427M swap free
Its the second number that drops like a rock. Plus, it never comes back
until I quit the program. This is a great way to turn my machine into a
nice desk ornament!
Mathew
Charles R Har
On 11/13/06, Mathew Yeates <[EMAIL PROTECTED]> wrote:
I have a memory mapped array. When I try and assign data, my mem usagegoes through the roof.Is it cache memory or process memory? I think a memory mapped file will keep pages cached in memory until the space is needed so as to avoid unneeded io.
On Mon, Nov 13, 2006 at 02:29:11PM -0700, Tim Hochberg wrote:
> Erin Sheldon wrote:
> > On 11/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> >
> >> Here's one more approach that's marginally faster than the map based
> >> solution and also won't chew up an extra memory since it's based on from
Erin Sheldon wrote:
> On 11/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
>
>> Here's one more approach that's marginally faster than the map based
>> solution and also won't chew up an extra memory since it's based on from
>> iter:
>>
>> numpy.fromiter(itertools.imap(tuple, results), dtype=myd
I have a memory mapped array. When I try and assign data, my mem usage
goes through the roof.
example: outdat[filenum,:]=outarr where outdat is memory mapped.
Anybody know how to avoid this?
Mathew
-
Using Tomcat but need
On 11/13/06, Tim Hochberg <[EMAIL PROTECTED]> wrote:
> Here's one more approach that's marginally faster than the map based
> solution and also won't chew up an extra memory since it's based on from
> iter:
>
> numpy.fromiter(itertools.imap(tuple, results), dtype=mydescriptor,
> count=len(results))
On 11/13/06, Seweryn Kokot <[EMAIL PROTECTED]> wrote:
Hello,Why ipython and python interactive shell give two different information?--- ipythonPython 2.4.4 (#2, Oct 20 2006, 00:23:25)Type "copyright", "credits" or "license" for more information.
IPython 0.7.2 -- An enhanced Interactive Python.?
Tim Hochberg wrote:
> [SNIP]
>>
>>
>
> Just for completeness, I benchmarked the fromiter and map(tuple,
> results) solutions as well. Map is fastest, followed by fromiter, list
> comprehension and then fromrecords. The differences are pretty minor
> however, so I'd stick with whatever s
Hello,
Why ipython and python interactive shell give two different information?
--- ipython
Python 2.4.4 (#2, Oct 20 2006, 00:23:25)
Type "copyright", "credits" or "license" for more information.
IPython 0.7.2 -- An enhanced Interactive Python.
? -> Introduction to IPython's features.
%m
On 11/13/06, Francesc Altet <[EMAIL PROTECTED]> wrote:
> In any case, you can also use rec.fromrecords for build recarrays from
> lists of lists. This breaks the aforementioned rule, but Travis allowed
> this because rec.* had to mimic numarray behaviour as much as possible.
> Here is an example of
Francesc Altet wrote:
> El dl 13 de 11 del 2006 a les 02:07 -0500, en/na Erin Sheldon va
> escriure:
>
>> On 11/13/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
>>
>>> On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
>>>
Hi all -
Thanks to everyone for the sugges
Pierre GM schrieb:
> On Sunday 12 November 2006 17:08, A. M. Archibald wrote:
>> On 12/11/06, Keith Goodman <[EMAIL PROTECTED]> wrote:
>>> Is anybody interested in making x.max() and nanmax() behave the same
>>> for matrices, except for the NaN part? That is, make
>>> numpy.matlib.nanmax return a m
El dl 13 de 11 del 2006 a les 02:07 -0500, en/na Erin Sheldon va
escriure:
> On 11/13/06, Charles R Harris <[EMAIL PROTECTED]> wrote:
> >
> >
> > On 11/12/06, Erin Sheldon <[EMAIL PROTECTED]> wrote:
> > > Hi all -
> > >
> > > Thanks to everyone for the suggestions.
> > > I think map(tuple, list) is
19 matches
Mail list logo