# Singular vectors of s1 for tiny dense matrices

I have a function whose main bottleneck is finding a(ny) singular vector pair in the space of the largest singular value, along with the singular value itself. This is done a huge number of times. This is the structure I know about:

• Tiny. 4x4 is the most common case, but anything less than 100x100 could be possible
• Dense and complex
• Square
• Largest singular value bounded by square root of width

Right now we are using Eigen::JacobiSVD. Would anyone recommend something faster? The final iterations of the function require lots of precision, but we may be able to get away with less precision in the beginning iterations.

• Just a check, do you connect Eigen to some high-performance BLAS/LAPACK library? Say Intel MKL. – Anton Menshov Nov 19 '19 at 16:45
• I am constrained by a distribution scheme that makes this a bit tricky, but I can look into it. – Ian Hincks Nov 19 '19 at 17:45
• Since you only want the largest pair, have you tried an iterative method, such as the power/Krylov iterations? Note that if you have access to an eigenvalue solver you can probably apply it to A^TA with impunity, as the numerical issues should not affect the largest SV pair. – Amit Hochman Nov 21 '19 at 12:01
• I'm going to try a few methods. I was just trying to figure out if there was some obvious choice to make. – Ian Hincks Nov 21 '19 at 14:30

## 1 Answer

According to the documentation, Eigen::BDCSVD outperforms Eigen::JacobiSVD for sizes n >= 16, though testing is warranted and simple enough. The interface is exactly the same.

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