Keith Goodman gmail.com> writes:
> matrix([[ 0.94425407, 0.02216611, 0.999475 ],
> [ 0.40444129, nan, 0.23264341],
> [ 0.24202372, 0.05344269, 0.37967564]])
> >> x.max()
> 0.379675636032 < Wrong (for me)
> >> x[1,1] = 0
> >> x.max()
> 0.999474999444 <- Bea
On 2/7/07, Christian <[EMAIL PROTECTED]> wrote:
Sven Schreiber gmx.net> writes:
> So I think what's needed is:
>
> b = array(yourlist)
> b.reshape(b.shape[0], -1)
Row vectors are easy to get.
In [1]: asmatrix([1,2,3,4])
Out[1]: matrix([[1, 2, 3, 4]])
And nested lists work, but you will be
Pierre GM wrote:
> On Wednesday 07 February 2007 22:38:30 Robert Kern wrote:
>> Pierre GM wrote:
>>> All,
>>>
>>> I want to compare whether two arrays point to the same data.
>>> I've been using 'is' so far, but I'm wondering whether it's the right
>>> approach.
>> It isn't. Your analysis is correc
Pierre GM wrote:
> On Wednesday 07 February 2007 22:38:30 Robert Kern wrote:
>
>> Pierre GM wrote:
>>
>>> All,
>>>
>>> I want to compare whether two arrays point to the same data.
>>> I've been using 'is' so far, but I'm wondering whether it's the right
>>> approach.
>>>
>> It isn't.
On Wednesday 07 February 2007 22:38:30 Robert Kern wrote:
> Pierre GM wrote:
> > All,
> >
> > I want to compare whether two arrays point to the same data.
> > I've been using 'is' so far, but I'm wondering whether it's the right
> > approach.
>
> It isn't. Your analysis is correct.
So, there's no
Pierre GM wrote:
> All,
>
> I want to compare whether two arrays point to the same data.
> I've been using 'is' so far, but I'm wondering whether it's the right
> approach.
It isn't. Your analysis is correct.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
All,
I want to compare whether two arrays point to the same data.
I've been using 'is' so far, but I'm wondering whether it's the right
approach.
If x is a plain ndarray, `x is x`, and `x is not x.view()`. I understand the
second one (I think so...), `x` and `x.view `are two different Python
Sven Schreiber gmx.net> writes:
> So I think what's needed is:
>
> b = array(yourlist)
> b.reshape(b.shape[0], -1)
Yes! That is it.
Thanks, Christian
___
Numpy-discussion mailing list
Numpy-discussion@scipy.org
http://projects.scipy.org/mailman/listi
Christian Meesters uni-mainz.de> writes:
> Since searchsorted returns the index of the first item in a that is >= or >
> the key, it can't make the distinction between 0.1 and 0.2 as I would like to
Then how about a.searchsorted(val+0.5)
Christian
_
Christopher Barker noaa.gov> writes:
> I'm not sure I understand the specification of the problem. I would
> think that the definition of a column vector is that it's shape is:
>
> (-1,1)
I was not aware of that possibility althoug I own the book I - shame on me.
Thank you (and all others) for
Sturla Molden wrote:
>>Good point. I guess I thought the OP had tried that already. It turns
>>out it works fine, too.
>>
>>The __array_finalize__ is useful if you want the attribute to be carried
>>around when arrays are created automatically internally (after math
>>operations for example).
>>
Robert Kern wrote:
>> Does anyone know if there will be a SciPy '07 conference, and if so, when?
>
> Yes, there will be one. We are currently speaking with the venue (Caltech in
> Pasadena, CA) to set the dates. Expect the conference to be either late August
> or perhaps earlyish in September.
Ni
> Good point. I guess I thought the OP had tried that already. It turns
> out it works fine, too.
>
> The __array_finalize__ is useful if you want the attribute to be carried
> around when arrays are created automatically internally (after math
> operations for example).
I too may be missing so
Reggie Dugard wrote:
>On Wed, 2007-02-07 at 14:36 -0700, Travis Oliphant wrote:
>
>
>>Sturla Molden wrote:
>>
>>
>>
def __new__(cls,...)
...
(H, edges) = numpy.histogramdd(..)
cls.__defaultedges = edges
def __array_finalize__(self, obj):
if not hasa
Many thanks, Travis. I'll test the new version tonight.
--Tom
On 2/7/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
>
> >I am trying to register a custom type to numpy. When I do so it works
> >and the ufuncs work but then when I invoke any ufunc twice the second
> >time
On Wed, 2007-02-07 at 14:36 -0700, Travis Oliphant wrote:
> Sturla Molden wrote:
>
> >>def __new__(cls,...)
> >> ...
> >>(H, edges) = numpy.histogramdd(..)
> >>cls.__defaultedges = edges
> >>
> >>def __array_finalize__(self, obj):
> >>if not hasattr(self, 'edges'):
> >>sel
Tom Denniston wrote:
>I am trying to register a custom type to numpy. When I do so it works
>and the ufuncs work but then when I invoke any ufunc twice the second
>time my python interpretter segfaults. I think i know what the
>problem is. In the select_types method in ufuncobject.c in
>numpy/c
Christopher Barker wrote:
> Hi,
>
> Does anyone know if there will be a SciPy '07 conference, and if so, when?
Yes, there will be one. We are currently speaking with the venue (Caltech in
Pasadena, CA) to set the dates. Expect the conference to be either late August
or perhaps earlyish in Septemb
I am trying to register a custom type to numpy. When I do so it works
and the ufuncs work but then when I invoke any ufunc twice the second
time my python interpretter segfaults. I think i know what the
problem is. In the select_types method in ufuncobject.c in
numpy/core/src/ numpy gets a refer
Keith Goodman wrote:
> I'd like to know what the -1 means.
It means "fill in with whatever is necessary to make the size correct given the
other specified dimensions".
> But first I'm trying to figure out
> why there are two reshapes?
reshape() used to be simply a function, not a method.
> Do t
On 2/7/07, Sven Schreiber <[EMAIL PROTECTED]> wrote:
> Christopher Barker schrieb:
> > Christian wrote:
> >> when creating an ndarray from a list, how can I force the result to be
> >> 2d *and* a column vector? So in case I pass a nested list, there will be no
> >> modification of the shape and whe
Christopher Barker schrieb:
> Christian wrote:
>> when creating an ndarray from a list, how can I force the result to be
>> 2d *and* a column vector? So in case I pass a nested list, there will be no
>> modification of the shape and when I pass a simple list, it will be
>> converted to a 2d column
Sturla Molden wrote:
>>def __new__(cls,...)
>> ...
>>(H, edges) = numpy.histogramdd(..)
>>cls.__defaultedges = edges
>>
>>def __array_finalize__(self, obj):
>>if not hasattr(self, 'edges'):
>>self.edges = self.__defaultedges
>>
>>
>
>So in order to get an instance attr
Hi all,
I recently got a report of a bug triggered only on 64-bit hardware,
and on a machine (in case it's relevant) that runs python 2.5. This
is with current numpy SVN which I just rebuilt a moment ago to
triple-check:
In [3]: a = numpy.array([[1.0,2],[3,4]])
In [4]: numpy.linalg.qr(a)
** On
got it. thanks.
On 2/7/07, Travis Oliphant <[EMAIL PROTECTED]> wrote:
> Tom Denniston wrote:
>
> >The behavior below seems strange to me. The string array is type S3
> >yet it says that comparison with 'abc' is not implemented. The ==
> >operator seems to work though. Is there a subtlty I am m
I keep running into this problem:
>> import numpy.matlib as M
>> x = M.rand(3,3)
>> x[1,1] = M.nan
>> x
matrix([[ 0.94425407, 0.02216611, 0.999475 ],
[ 0.40444129, nan, 0.23264341],
[ 0.24202372, 0.05344269, 0.37967564]])
>> x.max()
0.379675636032 < Wrong (for
Tom Denniston wrote:
>The behavior below seems strange to me. The string array is type S3
>yet it says that comparison with 'abc' is not implemented. The ==
>operator seems to work though. Is there a subtlty I am missing or is
>it simply a bug?
>
>
>
No bug. Ufuncs do not work with variable
Christian wrote:
> when creating an ndarray from a list, how can I force the result to be
> 2d *and* a column vector? So in case I pass a nested list, there will be no
> modification of the shape and when I pass a simple list, it will be
> converted to a 2d column vector.
I'm not sure I understan
On Wednesday 07 February 2007 15:22, Stefan van der Walt wrote:
>On Wed, Feb 07, 2007 at 03:11:53PM +0100, Joris De Ridder wrote:
>> I expected as output
>> array([[ 1., 4.],
>>[ 7., 10.]])
>
>That is the answer I get with numpy 1.0.2.dev3537 under Python 2.4.
Python 2.5 + numpy 1.0.
Christian schrieb:
> Hi,
>
> when creating an ndarray from a list, how can I force the result to be
> 2d *and* a column vector? So in case I pass a nested list, there will be no
> modification of the shape and when I pass a simple list, it will be
> converted to a 2d column vector. I can only thi
Hi Joris
On Wed, Feb 07, 2007 at 03:11:53PM +0100, Joris De Ridder wrote:
> I expected as output
> array([[ 1., 4.],
>[ 7., 10.]])
That is the answer I get with numpy 1.0.2.dev3537 under Python 2.4.
Cheers
Stéfan
___
Numpy-discussion mailin
Hi,
I'm confused by the output of apply_along_axis() in the following very simple
example:
In [93]: a = arange(12.).reshape(2,2,3)
In [95]: a
Out[95]:
array([[[ 0., 1., 2.],
[ 3., 4., 5.]],
[[ 6., 7., 8.],
[ 9., 10., 11.]]])
In [96]: def myfunc(b):
...
On Wed, Feb 07, 2007 at 02:00:52PM +0100, Christian Meesters wrote:
> This questions might seem stupid, but I didn't get a clever solution myself,
> or found one in the archives, the cookbook, etc. . If I overlooked something,
> please give a pointer.
>
> Well, if I have an 1D array like
> [ 0.
On Wed, Feb 07, 2007 at 10:35:14AM +, Christian wrote:
> Hi,
>
> when creating an ndarray from a list, how can I force the result to be
> 2d *and* a column vector? So in case I pass a nested list, there will be no
> modification of the shape and when I pass a simple list, it will be
> convert
Christian Meesters wrote:
>> Try searchsorted.
> Thanks, but that doesn't work. Sorry, if my question wasn't clear.
>
> To illustrate the requirement:
> For instance:
a
> array([ 0. , 0.1, 0.2, 0.3, 0.4])
# should be 1
> ...
a.searchsorted(0.11)
> 2
# should be 2
> ...
> Try searchsorted.
Thanks, but that doesn't work. Sorry, if my question wasn't clear.
To illustrate the requirement:
For instance:
>>> a
array([ 0. , 0.1, 0.2, 0.3, 0.4])
>>> # should be 1
...
>>> a.searchsorted(0.11)
2
>>> # should be 2
...
>>> a.searchsorted(0.16)
2
I could correct for one
Christian Meesters wrote:
> Hi
>
> This questions might seem stupid, but I didn't get a clever solution myself,
> or found one in the archives, the cookbook, etc. . If I overlooked something,
> please give a pointer.
>
> Well, if I have an 1D array like
> [ 0. , 0.1, 0.2, 0.3, 0.4, 0.5]
>
Hi
This questions might seem stupid, but I didn't get a clever solution myself,
or found one in the archives, the cookbook, etc. . If I overlooked something,
please give a pointer.
Well, if I have an 1D array like
[ 0. , 0.1, 0.2, 0.3, 0.4, 0.5]
,a scalar like 0.122 and want to retrieve th
Hi,
it seems that I have the same trouble, but using Python under Linux:
> I have run into an interesting issue with multiarraymodule.c with
> regards to embedding Python in a C application on Windows XP. In the
> application, the following abbreviated sequence was executed
>
>
>
> 1) Py_Init
Hi,
when creating an ndarray from a list, how can I force the result to be
2d *and* a column vector? So in case I pass a nested list, there will be no
modification of the shape and when I pass a simple list, it will be
converted to a 2d column vector. I can only think of a solution using 'if'
cla
40 matches
Mail list logo