/** * Convenience method to compute a QR decomposition * * @param A * Matrix to decompose. Not modified * @return Newly allocated decomposition */ public static QR factorize(Matrix A) { return new QR(A.numRows(), A.numColumns()).factor(new DenseMatrix(A)); }
/** * Convenience method to compute a QR decomposition * * @param A * Matrix to decompose. Not modified * @return Newly allocated decomposition */ public static QR factorize(Matrix A) { return new QR(A.numRows(), A.numColumns()).factor(new DenseMatrix(A)); }
@Override public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) { DenseMatrix matA = inputs[0].getOriginal(); no.uib.cipr.matrix.QR qr = new no.uib.cipr.matrix.QR(matA.numRows(),matA.numColumns()); DenseMatrix tmp = new DenseMatrix(matA); DenseMatrix Q = null; UpperTriangDenseMatrix R = null; long prev = System.nanoTime(); for( long i = 0; i < numTrials; i++ ) { // the input matrix is over written tmp.set(matA); qr.factor(tmp); Q = qr.getQ(); R = qr.getR(); } long elapsedTime = System.nanoTime()-prev; if( outputs != null ) { outputs[0] = new MtjBenchmarkMatrix(Q); outputs[1] = new MtjBenchmarkMatrix(R); } return elapsedTime; } }