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
问题是什么?这是精确错误吗?在我看来,不可能出现这样的错误结果