[Numpy-discussion] KeyError with float96 in linalg.py: polyfit
Jan-Matthias Braun
jan_braun at gmx.net
Tue Jul 4 05:10:18 CDT 2006
Hi all,
I'm testing some computations with float96 at the moment and right now I have
problems with polyfit raising a KeyError for the keycode 'g', which is
floatxx with xx>64.
I am getting a KeyError using polyfit on some float96 values. The used
Routines seem to know nothing about this type.
My main question is: have I missed something? Shouldn't this type be used?
Below is a more detailed descripton.
Thanks in advance,
Jan
----------------------------------------------------------------------------
In file numpy/linalg/linalg.py, the following definitions at lines 26ff seem
to be the offending ones:
# Helper routines
_array_kind = {'i':0, 'l': 0, 'q': 0, 'f': 0, 'd': 0, 'F': 1, 'D': 1}
_array_precision = {'i': 1, 'l': 1, 'q': 1, 'f': 0, 'd': 1, 'F': 0, 'D': 1}
_array_type = [['f', 'd'], ['F', 'D']]
Here the new typecodes are missing. I tried
# Helper routines
_array_kind = {'i':0, 'l': 0, 'q': 0, 'f': 0, 'd': 0, 'g': '0', 'F': 1,
'D':1, 'G':1}
_array_precision = {'i': 1, 'l': 1, 'q': 1, 'f': 0, 'd': 1, 'g': 1,
'F': 0, 'D': 1, 'G': 1}
_array_type = [['f', 'd', 'g'], ['F', 'D', 'G']]
which gets me a step further to a TypeError:
File "lib/python2.3/site-packages/numpy/linalg/linalg.py", line 454, in
lstsq
bstar[:b.shape[0],:n_rhs] = b.copy()
TypeError: array cannot be safely cast to required type
(Question: Why only one typecode for a type which varies in bitlength on
different platforms? On Opteron CPU's I've seen float128 with 'g'?)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://projects.scipy.org/pipermail/numpy-discussion/attachments/20060704/30bd6364/attachment.bin
More information about the Numpy-discussion
mailing list