Eigen库中参数ComputeFullU,ComputeThinU,ComputeFullV,ComputeThinV的应用

对于 J = U Σ V T J=U \Sigma V^T J=UΣVT在Eigen库中进行奇异值分解 :

JacobiSVD svd(J, ComputeFullV| ComputeFullU);
    U = svd.matrixU();
    V = svd.matrixV();
    A = svd.singularValues(); 

其中A为 Σ \Sigma Σ 对角线元素;

对于以下构造函数的输入参数

JacobiSVD(const MatrixType& matrix, unsigned int computationOptions = 0)

第一个参数为要进行计算的矩阵,第二个参数有四个取值:
#ComputeFullU, #ComputeThinU,#ComputeFullV, #ComputeThinV.
它们的含义为:
Eigen库中参数ComputeFullU,ComputeThinU,ComputeFullV,ComputeThinV的应用_第1张图片

说明文档中提示:
This JacobiSVD decomposition computes only the singular values by default. If you want U or V, you need to ask for them explicitly.

另外,对于square matric 与 thin matric的区别:
Thin unitaries are only available if your matrix type has a Dynamic number of columns (for example MatrixXf).

You can ask for only thin U or V to be computed, meaning the following. In case of a rectangular n-by-p matrix, letting m be the smaller value among n and p, there are only m singular vectors; the remaining columns of U and V do not correspond to actual singular vectors. Asking for thin U or V means asking for only their m first columns to be formed. So U is then a n-by-m matrix, and V is then a p-by-m matrix. Notice that thin U and V are all you need for (least squares) solving.

参考文献【3】Python与C++中SVD(奇异值分解)得到的右奇异值不同 给出了一些对比运行结果,可以参考;

参考地址:
【1】https://eigen.tuxfamily.org/dox/group__enums.html#ggae3e239fb70022eb8747994cf5d68b4a9aa7fb4e98834788d0b1b0f2b8467d2527
【2】http://eigen.tuxfamily.org/dox-devel/classEigen_1_1JacobiSVD.html
【3】http://www.pythonheidong.com/blog/article/65726/

你可能感兴趣的:(程序人生)