warp.types#

Type introspection and construction utilities.

This module provides functions for runtime type checking, creating custom vector, matrix, quaternion, and transformation types, and querying type properties.

API#

is_array

Return True if the value is one of the Warp array type instances.

is_composite

Return True if the value is a composite type instance (vector, matrix, quaternion, or transformation).

is_float

Return True if the value is a floating-point type instance.

is_int

Return True if the value is an integer type instance.

is_matrix

Return True if the value is a matrix instance.

is_quaternion

Return True if the value is a quaternion instance.

is_scalar

Return True if the value is a scalar type instance.

is_struct

Return True if the value is a Warp struct instance.

is_tile

Return True if the value is a tile instance.

is_transformation

Return True if the value is a transformation instance.

is_value

Return True if the value is a value type instance (scalar, vector, matrix, quaternion, or transformation).

is_vector

Return True if the value is a vector instance.

matrix

Create a matrix type with the given shape and data type.

quaternion

Create a quaternion type with the given data type.

transformation

Create a rigid-body transformation type with the given data type.

type_ctype

Return the ctypes type corresponding to a Warp dtype.

type_is_array

Return True if the type is one of the Warp array types.

type_is_composite

Return True if the type is a composite type (vector, matrix, quaternion, or transformation).

type_is_float

Return True if the type is a floating-point type.

type_is_int

Return True if the type is an integer type.

type_is_matrix

Return True if the type is a matrix type.

type_is_quaternion

Return True if the type is a quaternion type.

type_is_scalar

Return True if the type is a scalar (integer or floating-point).

type_is_struct

Return True if the type is a Warp struct type.

type_is_tile

Return True if the type is a tile type.

type_is_transformation

Return True if the type is a transformation type.

type_is_value

Return True if the type is a value type (scalar, vector, matrix, quaternion, or transformation).

type_is_vector

Return True if the type is a vector type.

type_repr

Convert a Warp type to a human-readable string representation.

type_size

Return the number of elements in a type (1 for scalars, length for vectors/matrices).

type_size_in_bytes

Return the size in bytes of a Warp dtype.

types_equal

Return True if two Warp types are equal.

vector

Create a vector type with the given length and data type.