[Numpy-discussion] Small integers not promoted for calculations
Colin J. Williams
cjw at sympatico.ca
Wed Oct 1 14:45:06 EDT 2003
This may have been logged already.
Colin W.
#tz.py
import numarray as N
import numarray.linear_algebra as L
b= N.array([[1, 2], [8, 3]], type= N.Int8)
print b
if b.type() not in L.LinearAlgebra2._array_kind:
# Undocumented feature - Int8 or In16 not handled, try promotion
b= b.astype(N.Int32)
pass
c= L.inverse(b)
print c
pass
Traceback (most recent call last):
File
"C:\PROGRA~1\Python23\lib\site-packages\Pythonwin\pywin\framework\scriptutils.py",
line 307, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File
"C:\PROGRA~1\Python23\lib\site-packages\Pythonwin\pywin\debugger\__init__.py",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File
"C:\PROGRA~1\Python23\lib\site-packages\Pythonwin\pywin\debugger\debugger.py",
line 591, in run
exec cmd in globals, locals
File "C:\Documents and Settings\cjw\Work\Test\tz.py", line 10, in ?
c= L.inverse(b)
File
"C:\PROGRA~1\Python23\lib\site-packages\numarray\linear_algebra\LinearAlgebra2.py",
line 141, in inverse
return solve_linear_equations(a, num.identity(a.getshape()[0]))
File
"C:\PROGRA~1\Python23\lib\site-packages\numarray\linear_algebra\LinearAlgebra2.py",
line 121, in solve_linear_equations
t =_commonType(a, b)
File
"C:\PROGRA~1\Python23\lib\site-packages\numarray\linear_algebra\LinearAlgebra2.py",
line 60, in _commonType
kind = max(kind, _array_kind[t])
KeyError: Int8
>>>
More information about the NumPy-Discussion
mailing list