基本上,我想计算属于ComplexDoubleMatrix类的矩阵的逆,但是我没有找到类似于逆()或inv()这样的函数,有没有人知道如何计算矩阵的逆?提前谢谢你。
我的最终目标是使用jblas.eigen创建一个矩阵的特征分解。现在,我的当前实现是由下面的jama库实现的。为了执行类似的函数,我需要计算V逆,这就是为什么我想在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();
}发布于 2017-01-02 13:27:56
矩阵A的逆可以通过求解AX = I,其中I是恒等矩阵,X<代码>E29则是E 110AE 211的逆。所以,用jblas我们可以说
DoubleMatrix Vinverse = Solve.solve(A, DoubleMatrix.eye(A.rows));请注意,我们不能反演一个非平方矩阵。我们可以使用方法检查矩阵A是正方形的:
A.isSquare(); // returns true if it ishttps://stackoverflow.com/questions/24944972
复制相似问题