numerictypes: Define the numeric type objects
This module is designed so 'from numerictypes import *' is safe.
Exported symbols include:
Dictionary with all registered number types (including aliases):
typeDict
Type objects (not all will be available, depends on platform):
see variable sctypes for which ones you have
Bit-width names
int8 int16 int32 int64 int128
uint8 uint16 uint32 uint64 uint128
float16 float32 float64 float96 float128 float256
complex32 complex64 complex128 complex192 complex256 complex512
c-based names
bool_
object_
void, str_, unicode_
byte, ubyte,
short, ushort
intc, uintc,
intp, uintp,
int_, uint,
longlong, ulonglong,
single, csingle,
float_, complex_,
longfloat, clongfloat,
As part of the type-hierarchy: xx -- is bit-width
generic
bool_
number
integer
signedinteger (intxx)
byte
short
intc
intp int0
int_
longlong
unsignedinteger (uintxx)
ubyte
ushort
uintc
uintp uint0
uint_
ulonglong
floating (floatxx)
single
float_ (double)
longfloat
complexfloating (complexxx)
csingle
complex_ (cfloat, cdouble)
clongfloat
flexible
character
str_ (string)
unicode_
void
object_ (not used much)
$Id: numerictypes.py,v 1.17 2005/09/09 22:20:06 teoliphant Exp $
ScalarType = [ _types.IntType, _types.FloatType, _types.ComplexType, _types.LongType, _types.BooleanType, _types.StringType, _types.UnicodeType, _types.BufferType ]
ScalarType = tuple(ScalarType)
allTypes = { }
cast = _typedict()
generic = allTypes['generic']
genericTypeRank = [ 'bool', 'int8', 'uint8', 'int16', 'uint16', 'int32', 'uint32', 'int64', 'uint64', 'int128', 'uint128', 'float16', 'float32', 'float64', 'float80', 'float96', 'float128', 'float256', 'complex32', 'complex64', 'complex128', 'complex160', 'complex192', 'complex256', 'complex512', 'object' ]
nbytes = _typedict()
revdict = { }
sctypes = { Const('int') : List(()), Const('uint') : List(()), Const('float') : List(()), Const('complex') : List(()), Const('others') : List([Name('bool'), Name('object'), Name('str'), Name('unicode'), Name('void')]) }
typeDict = { }
typeNA = { }
We use these later
void = allTypes['void']
Return a bit-width name for a given type object
Determines whether the given object represents
a numeric array type.returns the sctype of highest precision of the same general kind as 't'
| Local name | Refers to |
|---|---|
| array | multiarray.array |
| bool | __builtin__.bool |
| complex | __builtin__.complex |
| empty | multiarray.empty |
| float | __builtin__.float |
| int | __builtin__.int |
| long | __builtin__.long |
| ndarray | multiarray.ndarray |
| object | __builtin__.object |
| str | __builtin__.str |
| typeinfo | multiarray.typeinfo |
| unicode | __builtin__.unicode |
| _types | types |