pystencils.types.PsIntegerType#

class pystencils.types.PsIntegerType(width, signed=True, const=False)#

Signed and unsigned integer types.

PsIntegerType cannot be instantiated on its own, but only through PsSignedIntegerType and PsUnsignedIntegerType. This distinction is meant mostly to help in pattern matching.

Parameters:
  • args (Any)

  • kwargs (Any)

Return type:

Any

property width: int#

Return this type’s width in bits.

property itemsize: int#

If this type has a valid in-memory size, return that size in bytes.

property numpy_dtype: dtype | None#

A np.dtype object representing this data type.

Available both for backward compatibility and for interaction with the numpy-based runtime system.

create_literal(value)#

Create a C numerical literal for a constant of this type.

Raises:

PsTypeError – If the given value’s type is not the numeric type’s compiler-internal representation.

Return type:

str

Parameters:

value (Any)

create_constant(value)#

Create the internal representation of a constant with this type.

Raises:

PsTypeError – If the given value cannot be interpreted in this type.

Return type:

Any

Parameters:

value (Any)