Small integers not promoted for calculations
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
I logged this on SF. I extended the type promotion mappings to include the lower precision integer types and committed it to CVS. I was going to give you a link in the ViewCVS so you could look it over, but that info appears to be stale. Try this tomorrow: http://cvs.sourceforge.net/viewcvs.py/numpy/numarray/Packages/LinearAlgebra2... Thanks, Todd -- Todd Miller jmiller@stsci.edu STSCI / ESS / SSB
participants (2)
-
Colin J. Williams -
Todd Miller