Skip to content

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.

FloatArray module-attribute ¤

FloatArray = NDArray[float64]

A NumPy array with float64 dtype.

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

FloatVector module-attribute ¤

FloatVector = NDArray[float64]

A 1-dimensional 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.

IntArray module-attribute ¤

IntArray = NDArray[int_]

A NumPy array with integer dtype.

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

IntVector module-attribute ¤

IntVector = NDArray[int_]

A 1-dimensional NumPy array of integers.

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.