include/vecmat/batch3.h file

Strided batch reference for 3×3 and Voigt-6 kernels.

Strides are in elements, so packed and padded layouts both work. A batch of one matches the scalar call. AVX2 and NEON cover multiply, inverse, and ddot; polar stays on mat3_polar.

Functions

auto vm_batch3_mul(vm_float_t* C, int c_stride, const vm_float_t* A, int a_stride, const vm_float_t* B, int b_stride, int n) -> bool
Batched 3×3 multiply, (C_i = A_i B_i).
auto vm_batch3_inverse(vm_float_t* C, int c_stride, const vm_float_t* A, int a_stride, int n) -> bool
Batched 3×3 inverse.
auto vm_batch3_polar(vm_float_t* R, int r_stride, vm_float_t* U, int u_stride, const vm_float_t* F, int f_stride, int n) -> bool
Batched polar decomposition, (F_i = R_i U_i).
auto vm_batch3_ddot(vm_float_t* d, const vm_float_t* a, int a_stride, const vm_float_t* b, int b_stride, int n) -> bool
Batched Voigt-6 double contraction, (d_i = a_i : b_i).

Function documentation

bool vm_batch3_mul(vm_float_t* C, int c_stride, const vm_float_t* A, int a_stride, const vm_float_t* B, int b_stride, int n)

Batched 3×3 multiply, (C_i = A_i B_i).

Parameters
C Output matrices; item i at C + i * c_stride.
c_stride Element stride between output matrices.
A Left matrices; item i at A + i * a_stride.
a_stride Element stride between left matrices.
B Right matrices; item i at B + i * b_stride.
b_stride Element stride between right matrices.
n
Returns false if a pointer is NULL or n is non-positive.

bool vm_batch3_inverse(vm_float_t* C, int c_stride, const vm_float_t* A, int a_stride, int n)

Batched 3×3 inverse.

Parameters
C Output matrices; item i at C + i * c_stride.
c_stride Element stride between output matrices.
A Input matrices; item i at A + i * a_stride.
a_stride Element stride between input matrices.
n
Returns false if a pointer is NULL, n is non-positive, or any inverse fails.

bool vm_batch3_polar(vm_float_t* R, int r_stride, vm_float_t* U, int u_stride, const vm_float_t* F, int f_stride, int n)

Batched polar decomposition, (F_i = R_i U_i).

Parameters
R Output rotations; item i at R + i * r_stride.
r_stride Element stride between rotations.
U Output stretches; item i at U + i * u_stride.
u_stride Element stride between stretches.
F Input gradients; item i at F + i * f_stride.
f_stride Element stride between gradients.
n
Returns false if a pointer is NULL, n is non-positive, or any polar fails.

bool vm_batch3_ddot(vm_float_t* d, const vm_float_t* a, int a_stride, const vm_float_t* b, int b_stride, int n)

Batched Voigt-6 double contraction, (d_i = a_i : b_i).

Parameters
d Output scalars; length n.
a Left tensors; item i at a + i * a_stride.
a_stride Element stride between left tensors.
b Right tensors; item i at b + i * b_stride.
b_stride Element stride between right tensors.
n
Returns false if a pointer is NULL or n is non-positive.