【发布时间】:2014-07-24 22:19:04
【问题描述】:
基本上,我想计算属于 ComplexDoubleMatrix 类的矩阵的逆,但是我没有找到像 inverse() 或 inv() 这样的函数,有没有人知道如何计算一个逆矩阵矩阵?先感谢您。
我的最终目标是使用 jblas.eigen 创建矩阵的特征分解。 现在我目前的实现是由下面的 jama 库实现的。为了执行类似的函数,我需要计算 Vinverse,这就是为什么我想在 jblas 中找到一个反函数。
public static SimpleEigenDecomposition SimpleEigenDecomposition(double [][] rates)
{
Matrix ratesMatrix = new Matrix(rates);
EigenvalueDecomposition ed = new EigenvalueDecomposition(ratesMatrix);
Matrix V = ed.getV();
Matrix D =ed.getD();
Matrix Vinverse = V.inverse();
Matrix resultMatrix = V.times(D).times(V.inverse());
//check if result and rates are close enough
SimpleMatrix trueMatrix = new SimpleMatrix(rates);
SimpleMatrix calculatedMatrix = new SimpleMatrix(resultMatrix.getArray()) ;
if(EJMLUtils.isClose(trueMatrix, calculatedMatrix, THRESHOLD))
{
return new SimpleEigenDecomposition(V, D, Vinverse);
}else{
throw new RuntimeException();
}
【问题讨论】:
标签: java matrix eigenvector eigenvalue