在大型矩阵(即10,000 x 10,000)上执行反演

时间:2019-05-03 05:19:17

标签: java ojalgo

我正在尝试对大于10,000 x 10,000的矩阵进行求逆。

InverterTask<Double> matrixInverter = InverterTask.PRIMITIVE.make(storeM);
try{
       storeI = matrixInverter.invert(storeM);
 }catch (RecoverableCondition e){
       throw new RuntimeException(e);
 }

storeM是大小为10,000 x 10,000的矩阵。

但是,我遇到了以下错误:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at org.ojalgo.array.Primitive64Array.<init>(Primitive64Array.java:368)
at org.ojalgo.matrix.store.PrimitiveDenseStore.<init>(PrimitiveDenseStore.java:482)
at org.ojalgo.matrix.store.PrimitiveDenseStore$1.makeZero(PrimitiveDenseStore.java:255)
at org.ojalgo.matrix.store.PrimitiveDenseStore$1.makeZero(PrimitiveDenseStore.java:95)
at org.ojalgo.matrix.decomposition.GenericDecomposition.makeZero(GenericDecomposition.java:105)
at org.ojalgo.matrix.decomposition.InPlaceDecomposition.setInPlace(InPlaceDecomposition.java:83)
at org.ojalgo.matrix.decomposition.LUDecomposition.compute(LUDecomposition.java:266)
at org.ojalgo.matrix.decomposition.LUDecomposition.decompose(LUDecomposition.java:94)
at org.ojalgo.matrix.decomposition.LUDecomposition.invert(LUDecomposition.java:199)
at distlearn.Inversion.main(Inversion.java:46)

我可以在ojAlgo中使用哪些其他方法来执行此类任务?

编辑: 我实际上正在寻找使用问题的对偶执行内核岭回归的方法。这意味着对于N个条目的数据集,我可能需要对NxN矩阵进行求逆。

1 个答案:

答案 0 :(得分:0)

根据您要对结果执行的操作,不涉及矩阵求逆的其他方式

假设您确实需要将其求逆,则可以执行数学堆栈交换上已回答的操作:Inversion of large matrices

它提供了一种解决方案,可以在原位进行反转(在过程中确实分配了一些临时内存,但是据说这要比正常的反转操作要成功得多) )