Function Karana::Math::linSolveSVD

Function Karana::Math::linSolveSVD#

Function Documentation#

Mat Karana::Math::linSolveSVD(const Mat &A, const Mat &b, double threshold = Eigen::Default)#

Solve the linear system A x = b for x using a truncated SVD.

The threshold parameter determines which singular values are truncated by setting a minimum relative precision compared to the largest singular value of A. In other words, we define a k-dimensional subspace implicitly defined by threshold and find the least-squares solution in that subspace. This corresponds to the optimal min-norm least-squares solution.

Parameters:
  • A – Coefficient matrix

  • b – Right-hand-side matrix/vector

  • threshold – Threshold below which we truncate singular values for numerical stability

Returns:

x matrix/vector that best solves A x = b