Eigen庫中參數ComputeFullU,ComputeThinU,ComputeFullV,ComputeThinV的應用

對於 J=UΣVTJ=U \Sigma V^T在Eigen庫中進行奇異值分解 :

JacobiSVD<MatrixXd> 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.
它們的含義爲:
在這裏插入圖片描述

說明文檔中提示:
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/

發佈了36 篇原創文章 · 獲贊 31 · 訪問量 2萬+
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章