pyccel.ast.numpytypes module#
Module containing types from the numpy module understood by pyccel
- class pyccel.ast.numpytypes.NumpyComplex128Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s complex128 type.
Class representing NumPy’s complex128 type.
- property element_type#
The type of an element of the complex.
The type of an element of the complex. In other words, the type of the floats which comprise the complex type.
- class pyccel.ast.numpytypes.NumpyComplex256Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s complex256 type.
Class representing NumPy’s complex256 type.
- property element_type#
The type of an element of the complex.
The type of an element of the complex. In other words, the type of the floats which comprise the complex type.
- class pyccel.ast.numpytypes.NumpyComplex64Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s complex64 type.
Class representing NumPy’s complex64 type.
- property element_type#
The type of an element of the complex.
The type of an element of the complex. In other words, the type of the floats which comprise the complex type.
- class pyccel.ast.numpytypes.NumpyFloat128Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s float128 type.
Class representing NumPy’s float128 type.
- class pyccel.ast.numpytypes.NumpyFloat32Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s float32 type.
Class representing NumPy’s float32 type.
- class pyccel.ast.numpytypes.NumpyFloat64Type(self)[source]#
Bases:
NumpyNumericType
Class representing NumPy’s float64 type.
Class representing NumPy’s float64 type.
- class pyccel.ast.numpytypes.NumpyInt16Type(self)[source]#
Bases:
NumpyIntType
Class representing NumPy’s int16 type.
Class representing NumPy’s int16 type.
- class pyccel.ast.numpytypes.NumpyInt32Type(self)[source]#
Bases:
NumpyIntType
Class representing NumPy’s int32 type.
Class representing NumPy’s int32 type.
- class pyccel.ast.numpytypes.NumpyInt64Type(self)[source]#
Bases:
NumpyIntType
Class representing NumPy’s int64 type.
Class representing NumPy’s int64 type.
- class pyccel.ast.numpytypes.NumpyInt8Type(self)[source]#
Bases:
NumpyIntType
Class representing NumPy’s int8 type.
Class representing NumPy’s int8 type.
- class pyccel.ast.numpytypes.NumpyIntType(self)[source]#
Bases:
NumpyNumericType
Super class representing NumPy’s integer types.
Super class representing NumPy’s integer types.
- class pyccel.ast.numpytypes.NumpyNDArrayType(self, dtype, rank, order)[source]#
Bases:
HomogeneousContainerType
Class representing the NumPy ND array type.
Class representing the NumPy ND array type.
- Parameters:
dtype (NumpyNumericType | PythonNativeBool | GenericType) – The internal datatype of the object (GenericType is allowed for external libraries, e.g. MPI).
rank (int) – The rank of the new NumPy array.
order (str) – The order of the memory layout for the new NumPy array.
- property order#
The data layout ordering in memory.
Indicates whether the data is stored in row-major (‘C’) or column-major (‘F’) format. This is only relevant if rank > 1. When it is not relevant this function returns None.
- property rank#
Number of dimensions of the object.
Number of dimensions of the object. If the object is a scalar then this is equal to 0.
- swap_order()[source]#
Get a type which is identical to this type in all aspects except the order.
Get a type which is identical to this type in all aspects except the order. In the case of a 1D array the final type will be the same as this type. Otherwise if the array is C-ordered the final type will be F-ordered, while if the array is F-ordered the final type will be C-ordered.
- Returns:
The new type.
- Return type:
- switch_basic_type(new_type)[source]#
Change the basic type to the new type.
Change the basic type to the new type. A new NumpyNDArrayType will be returned whose underlying elements are of the NumPy type which is equivalent to the new type (e.g. PythonNativeFloat may be replaced by np.float64).
- Parameters:
new_type (PyccelType) – The new basic type.
- Returns:
The new type.
- Return type:
- switch_rank(new_rank, new_order=None)[source]#
Get a type which is identical to this type in all aspects except the rank and/or order.
Get a type which is identical to this type in all aspects except the rank and/or order. The order must be provided if the rank is increased from 1. Otherwise it defaults to the same order as the current type.
- Parameters:
new_rank (int) – The rank of the new type.
new_order (str, optional) – The order of the new type. This should be provided if the rank is increased from 1.
- Returns:
The new type.
- Return type:
- class pyccel.ast.numpytypes.NumpyNumericType(self)[source]#
Bases:
FixedSizeNumericType
Base class representing a scalar numeric datatype defined in the numpy module.
Base class representing a scalar numeric datatype defined in the numpy module.