[PYTHON MATRIX-SIG] Two questions
VIENNET Emmanuel 48.06.27.97 Equipe Gallinari
Emmanuel.Viennet@laforia.ibp.fr
Wed, 29 May 1996 19:40:31 +0200
Hi all,
I'm using Numerical Python 0.36 since a few weeks and I'm really
impressed...
Two questions, however:
1- I'd like to compute with floats, instead of doubles, to save
storage (for now, I frequently run out of my 100Mo swap space).
1.1 : this is probably a bug:
>>> from Numeric import *
>>> a = ones(10,Float(32))
>>> a.typecode()
'd'
1.2 : the above bug comes from an implicit conversion :
>>> a = zeros(10,Float(32))
>>> a.typecode()
'f'
>>> b = a + 1
>>> b.typecode()
'd'
The consequence is that's currently impossible to compute with
floats... ? I don't exactly remember the conclusions from the
previous discussions about conversion rules, but the current behaviour
is uncomfortable, especially with *big* arrays. Did I miss something ?
2- The second question :
The following code builds and returns an array from C:
PyArrayObject arr = (PyArrayObject *)PyArray_FromDims(
nbdims,dims, PyArray_FLOAT );
if (!arr) {
...
}
do something with arr->data
return Py_BuildValue("O", arr );
Is this right ? (This seems to leak).
Thanks for your attention
Emmanuel
--
Emmanuel Viennet: <viennet@ura1507.univ-paris13.fr>
LIPN - Institut Galilee - Universite Paris-Nord
93430 Villetaneuse - France
=================
MATRIX-SIG - SIG on Matrix Math for Python
send messages to: matrix-sig@python.org
administrivia to: matrix-sig-request@python.org
=================