[Numpy-discussion] flat indexing of object arrays

2006-10-05 Thread Martin Wiechert
rray ((2,2), object) >>> a.flat [2] = (1, 2, 3) >>> a.flat [2] 1 >>> a array([[None, None], [1, None]], dtype=object) Is this a feature? Wouldn't a naive user like me expect a.flat [2] == (1, 2, 3)? Thanks in advance, Martin Wiechert --

Re: [Numpy-discussion] immutable arrays

2006-09-21 Thread Martin Wiechert
On Thursday 21 September 2006 18:24, Travis Oliphant wrote: > Martin Wiechert wrote: > > Thanks Travis. > > > > Do I understand correctly that the only way to be really safe is to make > > a copy and not to export a reference to it? > > Because anybody having a r

Re: [Numpy-discussion] immutable arrays

2006-09-21 Thread Martin Wiechert
: > Martin Wiechert wrote: > > Hi list, > > > > I just stumbled accross NPY_WRITEABLE flag. > > Now I'd like to know if there are ways either from Python or C to make an > > array temporarily immutable. > > Just setting the flag > > Python: > >

[Numpy-discussion] immutable arrays

2006-09-20 Thread Martin Wiechert
Hi list, I just stumbled accross NPY_WRITEABLE flag. Now I'd like to know if there are ways either from Python or C to make an array temporarily immutable. Thanks, Martin. - Take Surveys. Earn Cash. Influence the Future of

Re: [Numpy-discussion] what's the difference between npy_intp and size_t?

2006-09-19 Thread Martin Wiechert
On Tuesday 19 September 2006 20:37, Travis Oliphant wrote: > Martin Wiechert wrote: > > Hi list, > > > > Please forgive my ignorance: Is there any difference between npy_intp and > > size_t. Aren't both "ints just big enough to be safe with pointer > &g

[Numpy-discussion] what's the difference between npy_intp and size_t?

2006-09-19 Thread Martin Wiechert
Hi list, Please forgive my ignorance: Is there any difference between npy_intp and size_t. Aren't both "ints just big enough to be safe with pointer arithmetics even on 64 bit architectures?". Thanks, Martin. - Take Survey

Re: [Numpy-discussion] record descriptors: trailing unused bytes

2006-09-18 Thread Martin Wiechert
On Monday 18 September 2006 20:46, Travis Oliphant wrote: > Martin Wiechert wrote: > > Hi list, > > > > does anybody know, if in C in the PyArray_Descr struct it is safe to > > manually change descr->elsize and descr->alignment as long as these are > > compa

[Numpy-discussion] record descriptors: trailing unused bytes

2006-09-17 Thread Martin Wiechert
Hi list, does anybody know, if in C in the PyArray_Descr struct it is safe to manually change descr->elsize and descr->alignment as long as these are compatible and descr->elsize is large enough to hold all fields? Of course I mean before any array is constructed using descr. Thanks, Martin.

Re: [Numpy-discussion] concatenation changes dtype

2006-09-16 Thread Martin Wiechert
On Sunday 17 September 2006 00:36, Travis Oliphant wrote: > Martin Wiechert wrote: > > Hi list, > > > > Apparently r_[x,x] does not necessarily have the same dtype as x: > >>>> from numpy import * > >>>> dt = dtype ([('a', &#

[Numpy-discussion] concatenation changes dtype

2006-09-16 Thread Martin Wiechert
Hi list, Apparently r_[x,x] does not necessarily have the same dtype as x: >>> from numpy import * >>> dt = dtype ([('a', 'b'), ('f4', 'i4')]) >>> x = zeros ((1,), dt) >>> x.dtype dtype([('a', '|i1'), ('f4', '>> r_[x,x].dtype dtype('object') >>> >>> import numpy >>> numpy.version.version '1.0rc1.

Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 20:27, Travis Oliphant wrote: > Martin Wiechert wrote: > > On Friday 15 September 2006 19:14, Travis Oliphant wrote: > >> Martin Wiechert wrote: > >>> Thanks Albert! Do you also know the corresponding C-API function? It > >>>

Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 20:05, Travis Oliphant wrote: > Martin Wiechert wrote: > > Hi list, > > > > I'm using PyArray_DescrConverter with a dict object to create a > > "struct-like" dtype from C. > > As the struct contains different data types I

Re: [Numpy-discussion] PyArray_DescrConverter - alig nment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 19:14, Travis Oliphant wrote: > Martin Wiechert wrote: > > Thanks Albert! Do you also know the corresponding C-API function? It > > cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose > > signature has no "align"

Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailingunused bytes

2006-09-15 Thread Martin Wiechert
y > Docstring: > > Thanks Albert! Do you also know the corresponding C-API function? It cannot be PyArray_DescrConverter (PyObject *, PyArray_Descr **), whose signature has no "align", right? > Cheers, > > Albert > > > -Original Message- > > From: [EMAIL P

Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 16:40, Francesc Altet wrote: > A Divendres 15 Setembre 2006 16:13, Martin Wiechert va escriure: > > Hi list, > > > > I'm using PyArray_DescrConverter with a dict object to create a > > "struct-like" dtype from C. > > A

Re: [Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
On Friday 15 September 2006 16:13, Martin Wiechert wrote: > Hi list, > > I'm using PyArray_DescrConverter with a dict object to create a > "struct-like" dtype from C. > As the struct contains different data types I run into "unaligned access" > probl

[Numpy-discussion] PyArray_DescrConverter - alignment / trailing unused bytes

2006-09-15 Thread Martin Wiechert
Hi list, I'm using PyArray_DescrConverter with a dict object to create a "struct-like" dtype from C. As the struct contains different data types I run into "unaligned access" problems. Is there a way to force alignment or to get trailing unused bytes in the dtpye? Thanks, Martin -

[Numpy-discussion] `_import_array' defined but not used

2006-09-14 Thread Martin Wiechert
ppreciated. Regards, Martin Wiechert - Using Tomcat but need to do more? Need to support web services, security? Get stuff done quickly with pre-integrated technology to make your job easier Download IBM WebSphere Applicatio

[Numpy-discussion] Where is matrixmultiply?

2006-07-30 Thread Martin Wiechert
Hi all, is it just me, or is matrixmultiply missing from numpy1.0b? >>> import numpy >>> numpy.version.version '1.0b1' >>> numpy.matrixmultiply Traceback (most recent call last): File "", line 1, in ? AttributeError: 'module' object has no attribute 'matrixmultiply' Thanks Martin. ---

[Numpy-discussion] ix_ and boolean indices

2006-07-07 Thread Martin Wiechert
Hi all, for me M [ix_(I, J)] does not work if I, J are boolean arrays. Is this intended or a bug/missing feature? And is there a way (other than I = where (I) [0] etc.) to make it work? Thanks, Martin Using Tomcat but need to do more? Need to support web services, security? Get stuff done qu

[Numpy-discussion] maximmum.reduce and nans

2006-06-14 Thread Martin Wiechert
Hi list, does anybody know, why maximum.reduce (()) does not return -inf? Looks very natural to me and as a byproduct maximum.reduce would ignore nans, thereby removing the need of nanmax etc. The current convention gives >>> from numpy import * >>> maximum.reduce ((1,nan)) 1.0 >>> maximum.r

Re: [Numpy-discussion] addressing a submatrix

2006-06-14 Thread Martin Wiechert
Thanks Pau, that's exactly what I was looking for. Martin On Wednesday 14 June 2006 12:01, you wrote: > On 6/14/06, Martin Wiechert <[EMAIL PROTECTED]> wrote: > > Hi Simon, > > > > thanks for your reply. > > > > A [I, J] > > > > seems to o

Re: [Numpy-discussion] addressing a submatrix

2006-06-14 Thread Martin Wiechert
whole rectangle IxJ but only the elements (I_1, J_1), (I_2, J_2). E.g., if I==J this is the diagonal of the submatrix, not the full submatrix. Martin On Wednesday 14 June 2006 20:25, Simon Burton wrote: > On Wed, 14 Jun 2006 11:14:17 +0200 > > Martin Wiechert <[EMAIL PROTECTED]>

[Numpy-discussion] addressing a submatrix

2006-06-14 Thread Martin Wiechert
Hi list, is there a concise way to address a subrectangle of a 2d array? So far I'm using A [I] [:, J] which is not pretty and more importantly only works for reading the subrectangle. Writing does *not* work. (Cf. session below.) Any help would be appreciated. Thanks, Martin In [1]:a = z