2

I need to compute the Singular Value Decomposition (SVD) of many $4 \times 4$ matrices. I'm looking for SVD algorithms specialized for small matrices. I've read that the std::vector sorting algorithm in the C++ STL is often hardcoded for short vectors for optimal performance. I want to hard code the SVD for the case $4 \times 4$ matrices.

What information is there about optimally solving small cases of SVD?

Anton Menshov
  • 8,672
  • 7
  • 38
  • 94
mana
  • 131
  • 2
  • 1
    Related, but 2x2: https://scicomp.stackexchange.com/questions/8899/robust-algorithm-for-2-times-2-svd, https://scicomp.stackexchange.com/questions/10972/singular-value-decomposition-of-a-2-x-2-complex-matrix – Federico Poloni Sep 10 '20 at 08:17
  • 2
    That said, I would be skeptical of anything that does not rely on orthogonal transformations, even if it claims to be 'closed-form'. – Federico Poloni Sep 10 '20 at 08:21
  • 1
    The Eigen library provides templates to perform SVD on fixed-size matrices. This will save some memory, and may provide some performance advantage with vectorized operations. I think Eigen::JacobiSVD<Matrix<float, 4, 4>, Eigen::NoQRPreconditioner> would be optimal for your problem, as no preconditioner is required for square matrices.

    https://eigen.tuxfamily.org/dox/classEigen_1_1JacobiSVD.html

    – Charlie S Sep 10 '20 at 12:52

0 Answers0