diff options
author | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-09 21:55:15 +0300 |
---|---|---|
committer | Bastien Montagne <montagne29@wanadoo.fr> | 2015-10-09 22:26:33 +0300 |
commit | 8159718fafc57cfbc9da7f706e599a91caccfa42 (patch) | |
tree | 4ddfa59687a8b4d048aafc0cdf66deb27acf5e0b /source/blender/blenlib/intern/math_solvers.c | |
parent | ad5f6a95dd8c76773306b4e7f891b6e97fbbcd20 (diff) |
BLI: add SVD solver for mat3 (using eigen3).
Diffstat (limited to 'source/blender/blenlib/intern/math_solvers.c')
-rw-r--r-- | source/blender/blenlib/intern/math_solvers.c | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/intern/math_solvers.c b/source/blender/blenlib/intern/math_solvers.c index 2f962714c8c..d1dad9a6269 100644 --- a/source/blender/blenlib/intern/math_solvers.c +++ b/source/blender/blenlib/intern/math_solvers.c @@ -59,3 +59,16 @@ bool BLI_eigen_solve_selfadjoint_m3(const float m3[3][3], float r_eigen_values[3 return EG3_self_adjoint_eigen_solve(3, (const float *)m3, r_eigen_values, (float *)r_eigen_vectors); } + +/** + * \brief Compute the SVD (Singular Values Decomposition) of given 3D matrix (m3 = USV*). + * + * \param m3 the matrix to decompose. + * \return r_U the computed left singular vector of \a m3 (NULL if not needed). + * \return r_S the computed singular values of \a m3 (NULL if not needed). + * \return r_V the computed right singular vector of \a m3 (NULL if not needed). + */ +void BLI_svd_m3(const float m3[3][3], float r_U[3][3], float r_S[3], float r_V[3][3]) +{ + EG3_svd_square_matrix(3, (const float *)m3, (float *)r_U, (float *)r_S, (float *)r_V); +} |