m2_svd
m2_svd(U, S, V, sig, m)
Performs Singular Value Decomposition (SVD) on a 2x2 matrix, optimized for MLS-MPM.
This function computes the SVD of a 2x2 matrix m such that m = U * Σ * V^T, where:
- U is a 2x2 orthogonal matrix (rotation).
- Σ (sig) is a 2x2 diagonal matrix containing the singular values.
- V is a 2x2 orthogonal matrix (rotation).
The function modifies U, sig, and V in-place. The input matrix m and the intermediate matrix S are overwritten during the computation.
The algorithm uses a closed-form solution and optimizations specific to 2x2 matrices, making it very fast. It also handles the case where the off-diagonal elements of the intermediate matrix S are close to zero, simplifying calculations. The results are transposed, consistent with the Taichi programming language.
Kind: global function
| Param | Type | Description |
|---|---|---|
| U | Array.<number> | Output: 2x2 orthogonal matrix (rotation), stored as a flattened array [c, s, -s, c]. Modified in-place. |
| S | Array.<number> | Output: Intermediate 2x2 matrix, overwritten during calculation. Modified in-place. |
| V | Array.<number> | Output: 2x2 orthogonal matrix (rotation), stored as a flattened array. Modified in-place. |
| sig | Array.<number> | Output: 2x2 diagonal matrix containing singular values, stored as a flattened array [σ1, 0, 0, σ2]. Modified in-place. |
| m | Array.<number> | Input: 2x2 matrix, stored as a flattened array [a, b, c, d], representing [[a, c], [b, d]]. Will be overwritten. |