warp.matrix_from_rows#

warp.matrix_from_rows(*args)[source]#

Construct a matrix with each vector argument as a row.

The resulting matrix has dimensions (num_vectors, vector_length), where the i-th row of the matrix contains the elements of the i-th vector argument.

Parameters:

*args (Sequence[Vector]) – Variable number of vectors to use as matrix rows. All vectors must have the same length and dtype.

Returns:

A matrix with shape (num_vectors, vector_length).

Example

a = wp.vec3f(1.0, 2.0, 3.0)
b = wp.vec3f(4.0, 5.0, 6.0)
m = wp.matrix_from_rows(a, b)
# m is a 2x3 matrix:
# [[1.0, 2.0, 3.0],
#  [4.0, 5.0, 6.0]]