Upcasting
For the record, here is the script that was used to generate the upcasting table.
1 import numpy
2
3 types = [
4 'bool_',
5 'uint8','uint16','uint32','uint64',
6 'int8','int16','int32','int64',
7 'float32','float64','float96',
8 'complex64','complex128','complex192',
9 ]
10
11 t = []
12 for ta in types:
13 a = numpy.zeros( (1,), dtype=numpy.typeDict[ta] )
14 ti = []
15 t.append(ti)
16 for tb in types:
17 b = numpy.zeros( (1,), dtype=numpy.typeDict[tb] )
18 ti.append( (a+b).dtype.name )
19
20 ntypes = len(types)
21 print '|| ',
22 for j in range(ntypes):
23 print '||', "'''"+types[j]+"'''",
24 print ' ||'
25 for i in range(ntypes):
26 print '||', "'''"+types[i]+"'''",
27 for j in range(ntypes):
28 if i<=j:
29 print '||', t[i][j],
30 else:
31 print '||',
32 print '||'