Types (polykin.utils.types)¤
Type aliases for numeric scalars and NumPy arrays used throughout the package.
This module defines common scalar, array-like, vector, and matrix type aliases
based on numpy.typing.NDArray. The aliases primarily constrain data types
(e.g., float64 or integer) and provide consistent terminology across the
codebase.
Array shapes (such as vectors or matrices) are documented by convention and validated at runtime where required, as NumPy's static typing currently does not enforce shape information.
FloatArrayLike
module-attribute
¤
FloatArrayLike = (
list[float] | tuple[float, ...] | FloatArray
)
Any object that can be interpreted as a float array, including:
- Python list of floats
- Python tuple of floats
- NumPy float64 array
FloatVectorLike
module-attribute
¤
FloatVectorLike = (
list[float] | tuple[float, ...] | FloatVector
)
Any object that can be interpreted as a 1D float vector, including:
- Python list of floats
- Python tuple of floats
- 1D NumPy float64 array
Float2x2Matrix
module-attribute
¤
Float2x2Matrix = NDArray[float64]
A NumPy float64 array of shape (2, 2).
FloatMatrix
module-attribute
¤
FloatMatrix = NDArray[float64]
A 2-dimensional NumPy float64 array of arbitrary shape.
FloatSquareMatrix
module-attribute
¤
FloatSquareMatrix = NDArray[float64]
A 2-dimensional NumPy float64 array with equal number of rows and columns.
FloatRangeArray
module-attribute
¤
FloatRangeArray = NDArray[float64]
A NumPy float64 array of shape (2,) representing a range of values.
IntArrayLike
module-attribute
¤
IntArrayLike = list[int] | tuple[int, ...] | IntArray
Any object that can be interpreted as an integer array, including:
- Python list of ints
- Python tuple of ints
- NumPy integer array
IntVectorLike
module-attribute
¤
IntVectorLike = list[int] | tuple[int, ...] | IntVector
Any object that can be interpreted as a 1D integer vector, including:
- Python list of ints
- Python tuple of ints
- 1D NumPy integer array
Number
module-attribute
¤
Number = TypeVar('Number', float, complex)
A generic numeric type, either float or complex.