[SciPy-user] numarray.dot
Colin J. Williams
cjw at sympatico.ca
Tue Aug 5 14:35:57 EDT 2003
Todd,
Many thanks for your speedy response. The line numbers don't tie with
my ufunc.py
and so I will await the formal release. I presume that the change
applies to _matrixtype.
Incidentally, I am exploring the feasibility of basing a Matrix class on
NumArray, but
find it difficult, in view of the use of factory functions, rather than
the conventional
instance constructors.
Thanks again.
Colin W.
Todd Miller wrote:
>This problem is now fixed in numarray CVS. In case you'd like to try it
>yourself on numarray-0.6, the change looks like:
>
>Index: Lib/ufunc.py
>===================================================================
>RCS file: /cvsroot/numpy/numarray/Lib/ufunc.py,v
>retrieving revision 1.60
>diff -r1.60 ufunc.py
>1872,1875c1872
>< if artype != brtype:
>< return _nt.Float64
>< else:
>< return artype
>---
>
>
>> return max(artype, brtype)
>>
>>
>
>
>Thanks again,
>Todd
>
>
>On Tue, 2003-08-05 at 11:37, Todd Miller wrote:
>
>
>>You're quite correct about the bug in the output array type selection
>>for numarray.dot. The current code dates to a time when numarray did
>>not have support for complex numbers.
>>
>>Thanks for the input.
>>Todd
>>
>>On Tue, 2003-08-05 at 11:03, Colin J. Williams wrote:
>>
>>
>>>This function appears to take only partial account of imaginary data,
>>>see the
>>>second exeution below..
>>>
>>>I would have expected a complex element type in a ComplexArray instance.
>>>or a message that this type of input cannot be handled.
>>>
>>>Colin W.
>>>
>>>print 'version:', _sys.version
>>>
>>>import numarray as N
>>>z= N.dot([1, 2], [[3], [4]])
>>>print 'z, type(z), z[0], z.type():', z, type(z), z[0], z.type()
>>>
>>>z= N.dot([1, 2], [[3j], [4]])
>>>print 'z, type(z), z[0], z.type():', z, type(z), z[0], z.type()
>>>
>>>Results:
>>>
>>>version: 2.3c2 (#45, Jul 24 2003, 21:23:54) [MSC v.1200 32 bit (Intel)]
>>>z, type(z), z[0], z.type(): [11] <class
>>>'numarray.numarraycore.NumArray'> 11 Int32
>>>z, type(z), z[0], z.type(): [ 8.] <class
>>>'numarray.numarraycore.NumArray'> 8.0 Float64
>>>
>>>
>>>_______________________________________________
>>>SciPy-user mailing list
>>>SciPy-user at scipy.net
>>>http://www.scipy.net/mailman/listinfo/scipy-user
>>>
>>>
More information about the SciPy-User
mailing list