我正在尝试为过度确定的系统计算最小二乘。
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
我需要调用什么才能返回 Matrix D1 的最小平方?