1
我使用apache.commons.math3庫來計算一個3x3矩陣的特徵向量,但對於計算特徵向量的特徵分解方法將返回錯誤的結果:這是我的代碼:EigenvalueDecomposition返回錯誤的特徵向量
double[][] matrix = {
{1 ,3 ,2},
{1 ,4 ,3},
{2 ,1 ,0}
};
RealMatrix realMatrix = MatrixUtils.createRealMatrix(matrix);
EigenDecomposition decomposition = new EigenDecomposition(realMatrix);
for(int i = 0; i<3; i++){
RealVector eigenvector = decomposition.getEigenvector(i);
System.out.println(eigenvector.getEntry(0)+" "+eigenvector.getEntry(1)+" "+eigenvector.getEntry(2));
}
印刷結果是:
-0.5760517243311052 -0.7536997812678066 -0.31638750072027233
0.22370947445236325 -0.6030287282098593 0.770086088626364
0.293925829450875 1.583437114738283 -2.642858652367182
而正確的人應該是
0.29050, -0.78307, 1
1.82072, 2.38220, 1
問題是什麼?這是精確錯誤嗎?在我看來,不可能出現這樣的錯誤結果