具体原理参考别人博客:https://www.cnblogs.com/lantingg/p/7844605.html
我直接上代码
void SVD(vector<vector<double>>A_Matrix, vector<vector<double>>&U_Matrix, vector<vector<double>>&V_Matrix, vector<double>&S_Vector, int &K_D)
{
int Rows = A_Matrix.size();
int Cols = A_Matrix[0].size();
U_Matrix.clear();
V_Matrix.clear();
S_Vector.clear();
S_Vector.resize(K_D, 0);
U_Matrix.resize(K_D);
for (int i = 0; i < K_D; ++i)
{
U_Matrix[i].resize(Rows,0);
}
V_Matrix.resize(K_D);
for (int i = 0; i < K_D;