@Override final public Vector solve( final Vector b) { checkSolveDimensions(b); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); return upperTriangularSolve(qr.R, qr.Q.transpose().times(b)); }
@Override final public Vector solve( final Vector b) { checkSolveDimensions(b); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); return upperTriangularSolve(qr.R, qr.Q.transpose().times(b)); }
@Override final public Vector solve( final Vector b) { checkSolveDimensions(b); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); return upperTriangularSolve(qr.R, qr.Q.transpose().times(b)); }
@Override final public Matrix solve( final Matrix B) { checkSolveDimensions(B); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); // I'll only use it as the transpose qr.Q = qr.Q.transpose(); final int numColumns = B.getNumColumns(); DenseMatrix X = new DenseMatrix(getNumColumns(), numColumns); for (int i = 0; i < numColumns; ++i) { X.setColumn(i, upperTriangularSolve(qr.R, qr.Q.times(B.getColumn(i)))); } return X; }
@Override final public Matrix solve( final Matrix B) { checkSolveDimensions(B); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); // I'll only use it as the transpose qr.Q = qr.Q.transpose(); final int numColumns = B.getNumColumns(); DenseMatrix X = new DenseMatrix(getNumColumns(), numColumns); for (int i = 0; i < numColumns; ++i) { X.setColumn(i, upperTriangularSolve(qr.R, qr.Q.times(B.getColumn(i)))); } return X; }
@Override final public Matrix solve( final Matrix B) { checkSolveDimensions(B); if (!isSquare()) { throw new IllegalStateException("Solve only works on square " + "matrices (this is " + getNumRows() + " x " + getNumColumns()); } QR qr = qrDecompose(); // I'll only use it as the transpose qr.Q = qr.Q.transpose(); final int numColumns = B.getNumColumns(); DenseMatrix X = new DenseMatrix(getNumColumns(), numColumns); for (int i = 0; i < numColumns; ++i) { X.setColumn(i, upperTriangularSolve(qr.R, qr.Q.times(B.getColumn(i)))); } return X; }