我正在尝试为一个过度确定的系统计算最小二乘。
DenseMatrix64F D_dense = RandomMatrices.createRandom(dimension, 3 * dimension, -1, 1, r);
D1 = SimpleMatrix.wrap(D1).transpose().getMatrix();
LinearSolver<DenseMatrix64F> x2 = LinearSolverFactory.leastSquares(D1.numRows, D1.numCols);
x2.setA(D1);
DenseMatrix64F D_i = new DenseMatrix64F(D1.numRows, D1.numCols);
x2.invert(D_i);但是我得到了一个错误
Exception in thread "main" java.lang.IllegalArgumentException: Unexpected dimensions for X: X rows = 9 expected = 3我需要调用什么才能返回矩阵D1的leastSquares?
发布于 2014-12-05 08:54:15
看起来你在试着对一个矩形矩阵求逆。你只能对一个方阵求逆。这也不是最好的解决方法。请参阅手册中的以下链接:
https://code.google.com/p/efficient-java-matrix-library/wiki/SolvingLinearSystems
https://stackoverflow.com/questions/22561429
复制相似问题