public Matrix[] qr() { DenseDoubleQRDecomposition qr = new DenseDoubleQRDecomposition(matrix); Matrix q = new ParallelColtDenseDoubleMatrix2D(qr.getQ(false)); Matrix r = new ParallelColtDenseDoubleMatrix2D(qr.getR(false)); return new Matrix[] { q, r }; }
buf.append(String.valueOf(this.hasFullRank())); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); buf.append(String.valueOf(this.getQ(false))); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); buf.append(String.valueOf(this.getR(false))); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); try { DoubleMatrix2D X = cern.colt.matrix.tdouble.DoubleFactory2D.dense.identity(m); this.solve(X); buf.append(String.valueOf(X)); } catch (IllegalArgumentException exc) {
@Override public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) { DoubleMatrix2D matA = inputs[0].getOriginal(); DenseDoubleAlgebra alg = new DenseDoubleAlgebra(); DoubleMatrix2D Q = null; DoubleMatrix2D R = null; long prev = System.nanoTime(); for( long i = 0; i < numTrials; i++ ) { DenseDoubleQRDecomposition decomp = alg.qr(matA); Q = decomp.getQ(true); R = decomp.getR(true); } long elapsedTime = System.nanoTime()-prev; if( outputs != null ) { outputs[0] = new PColtBenchmarkMatrix(Q); outputs[1] = new PColtBenchmarkMatrix(R); } return elapsedTime; } }
qr = new DenseDoubleQRDecomposition(matrix); } catch (IllegalArgumentException exc) { buf.append("\n\n" + constructionException + " QRDecomposition: " + exc.getMessage()); buf.append("\n\n" + qr.toString());
/** * Constructs and returns the QR-decomposition of the given matrix. */ public DenseDoubleQRDecomposition qr(DoubleMatrix2D matrix) { return new DenseDoubleQRDecomposition(matrix); }
/** * Solves A*x = b. * * @return x; a new independent matrix; solution if A is square, least * squares solution otherwise. */ public DoubleMatrix1D solve(DoubleMatrix2D A, DoubleMatrix1D b) { if (A.rows() == A.columns()) { return lu(A).solve(b); } else { DoubleMatrix1D x = b.copy(); qr(A).solve(x); return x.viewPart(0, A.columns()).copy(); } }
throw new IllegalArgumentException("Matrix row dimensions must agree."); if (!this.hasFullRank()) { throw new IllegalArgumentException("Matrix is rank deficient.");
qr = new DenseDoubleQRDecomposition(matrix); } catch (IllegalArgumentException exc) { buf.append("\n\n" + constructionException + " QRDecomposition: " + exc.getMessage()); buf.append("\n\n" + qr.toString());
/** * Constructs and returns the QR-decomposition of the given matrix. */ public DenseDoubleQRDecomposition qr(DoubleMatrix2D matrix) { return new DenseDoubleQRDecomposition(matrix); }
/** * Solves A*x = b. * * @return x; a new independent matrix; solution if A is square, least * squares solution otherwise. */ public DoubleMatrix1D solve(DoubleMatrix2D A, DoubleMatrix1D b) { if (A.rows() == A.columns()) { return lu(A).solve(b); } else { DoubleMatrix1D x = b.copy(); qr(A).solve(x); return x.viewPart(0, A.columns()).copy(); } }
throw new IllegalArgumentException("Matrix row dimensions must agree."); if (!this.hasFullRank()) { throw new IllegalArgumentException("Matrix is rank deficient.");
public Matrix[] qr() { DenseDoubleQRDecomposition qr = new DenseDoubleQRDecomposition(matrix); Matrix q = new ParallelColtDenseDoubleMatrix2D(qr.getQ(false)); Matrix r = new ParallelColtDenseDoubleMatrix2D(qr.getR(false)); return new Matrix[] { q, r }; }
buf.append(String.valueOf(this.hasFullRank())); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); buf.append(String.valueOf(this.getQ(false))); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); buf.append(String.valueOf(this.getR(false))); } catch (IllegalArgumentException exc) { buf.append(unknown + exc.getMessage()); try { DoubleMatrix2D X = cern.colt.matrix.tdouble.DoubleFactory2D.dense.identity(m); this.solve(X); buf.append(String.valueOf(X)); } catch (IllegalArgumentException exc) {
/** * Solves A*X = B. * * @return X; a new independent matrix; solution if A is square, least * squares solution otherwise. */ public DoubleMatrix2D solve(DoubleMatrix2D A, DoubleMatrix2D B) { if (A.rows() == A.columns()) { return lu(A).solve(B); } else { DoubleMatrix2D X = B.copy(); qr(A).solve(X); return X.viewPart(0, 0, A.columns(), B.columns()).copy(); } }
throw new IllegalArgumentException("Matrix row dimensions must agree."); if (!this.hasFullRank()) { throw new IllegalArgumentException("Matrix is rank deficient.");
/** * Solves A*X = B. * * @return X; a new independent matrix; solution if A is square, least * squares solution otherwise. */ public DoubleMatrix2D solve(DoubleMatrix2D A, DoubleMatrix2D B) { if (A.rows() == A.columns()) { return lu(A).solve(B); } else { DoubleMatrix2D X = B.copy(); qr(A).solve(X); return X.viewPart(0, 0, A.columns(), B.columns()).copy(); } }
throw new IllegalArgumentException("Matrix row dimensions must agree."); if (!this.hasFullRank()) { throw new IllegalArgumentException("Matrix is rank deficient.");