private void solveSystem(int numRows, int numCols) { LinearSolver<DenseMatrix64F> qrSolver = LinearSolverFactory.qr(numRows, numCols); QRDecomposition<DenseMatrix64F> decomposition = qrSolver.getDecomposition(); qrSolver.setA(X); y.setData(response); qrSolver.solve(this.y, this.b); DenseMatrix64F R = decomposition.getR(null, true); LinearSolver<DenseMatrix64F> linearSolver = LinearSolverFactory.linear(numCols); linearSolver.setA(R); DenseMatrix64F Rinverse = new DenseMatrix64F(numCols, numCols); linearSolver.invert(Rinverse); // stores solver's solution inside of Rinverse. CommonOps.multOuter(Rinverse, this.XtXInv); }