taichi.types.compound_types
#
- taichi.types.compound_types.argpack(**kwargs)#
Creates an argument pack type with given members.
- Parameters:
kwargs (dict) – a dictionary contains the names and types of the argument pack members.
- Returns:
A argument pack type.
Example:
>>> vec3 = ti.types.vector(3, ti.f32) >>> sphere = ti.types.argpack(center=vec3, radius=float) >>> s = sphere(center=vec3([0., 0., 0.]), radius=1.0)
- taichi.types.compound_types.matrix(n=None, m=None, dtype=None)#
Creates a matrix type with given shape and data type.
- Parameters:
n (int) – number of rows of the matrix.
m (int) – number of columns of the matrix.
dtype (
primitive_types
) – matrix data type.
- Returns:
A matrix type.
Example:
>>> mat2x2 = ti.types.matrix(2, 2, ti.f32) # 2x2 matrix type >>> M = mat2x2([[1., 2.], [3., 4.]]) # an instance of this type
- taichi.types.compound_types.struct(**kwargs)#
Creates a struct type with given members.
- Parameters:
kwargs (dict) – a dictionary contains the names and types of the struct members.
- Returns:
A struct type.
Example:
>>> vec3 = ti.types.vector(3, ti.f32) >>> sphere = ti.types.struct(center=vec3, radius=float) >>> s = sphere(center=vec3([0., 0., 0.]), radius=1.0)
- taichi.types.compound_types.vector(n=None, dtype=None)#
Creates a vector type with given shape and data type.
- Parameters:
n (int) – dimension of the vector.
dtype (
primitive_types
) – vector data type.
- Returns:
A vector type.
Example:
>>> vec3 = ti.types.vector(3, ti.f32) # 3d vector type >>> v = vec3([1., 2., 3.]) # an instance of this type