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.

  • 1
    $\begingroup$ Just a check, do you connect Eigen to some high-performance BLAS/LAPACK library? Say Intel MKL. $\endgroup$ – Anton Menshov Nov 19 '19 at 16:45
  • $\begingroup$ I am constrained by a distribution scheme that makes this a bit tricky, but I can look into it. $\endgroup$ – Ian Hincks Nov 19 '19 at 17:45
  • $\begingroup$ 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. $\endgroup$ – Amit Hochman Nov 21 '19 at 12:01
  • $\begingroup$ I'm going to try a few methods. I was just trying to figure out if there was some obvious choice to make. $\endgroup$ – Ian Hincks Nov 21 '19 at 14:30

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.


| cite | improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.