private void flushSolver() throws IOException { UpperTriangular r = qSolver.getRTilde(); double[][] qt = qSolver.getThinQtTilde(); rSubseq.add(r); value.setBlock(qt); getTempQw().append(tempKey, value); /* * this probably should be a sparse row matrix, but compressor should get it * for disk and in memory we want it dense anyway, sparse random * implementations would be a mostly a memory management disaster consisting * of rehashes and GC // thrashing. (IMHO) */ value.setBlock(null); qSolver.reset(); }
private void flushSolver() throws IOException { UpperTriangular r = qSolver.getRTilde(); double[][] qt = qSolver.getThinQtTilde(); rSubseq.add(r); value.setBlock(qt); getTempQw().append(tempKey, value); /* * this probably should be a sparse row matrix, but compressor should get it * for disk and in memory we want it dense anyway, sparse random * implementations would be a mostly a memory management disaster consisting * of rehashes and GC // thrashing. (IMHO) */ value.setBlock(null); qSolver.reset(); }
private void flushSolver() throws IOException { UpperTriangular r = qSolver.getRTilde(); double[][] qt = qSolver.getThinQtTilde(); rSubseq.add(r); value.setBlock(qt); getTempQw().append(tempKey, value); /* * this probably should be a sparse row matrix, but compressor should get it * for disk and in memory we want it dense anyway, sparse random * implementations would be a mostly a memory management disaster consisting * of rehashes and GC // thrashing. (IMHO) */ value.setBlock(null); qSolver.reset(); }
private void flushQBlocks() throws IOException { if (blockCnt == 1) { /* * only one block, no temp file, no second pass. should be the default * mode for efficiency in most cases. Sure mapper should be able to load * the entire split in memory -- and we don't require even that. */ value.setBlock(qSolver.getThinQtTilde()); outputQHat(value); outputR(new VectorWritable(new DenseVector(qSolver.getRTilde().getData(), true))); } else { secondPass(); } }
private void flushQBlocks() throws IOException { if (blockCnt == 1) { /* * only one block, no temp file, no second pass. should be the default * mode for efficiency in most cases. Sure mapper should be able to load * the entire split in memory -- and we don't require even that. */ value.setBlock(qSolver.getThinQtTilde()); outputQHat(value); outputR(new VectorWritable(new DenseVector(qSolver.getRTilde().getData(), true))); } else { secondPass(); } }
private void flushQBlocks() throws IOException { if (blockCnt == 1) { /* * only one block, no temp file, no second pass. should be the default * mode for efficiency in most cases. Sure mapper should be able to load * the entire split in memory -- and we don't require even that. */ value.setBlock(qSolver.getThinQtTilde()); outputQHat(value); outputR(new VectorWritable(new DenseVector(qSolver.getRTilde().getData(), true))); } else { secondPass(); } }
@Test public void testGivensQR() throws Exception { // DenseMatrix m = new DenseMatrix(dims<<2,dims); Matrix m = new DenseMatrix(3, 3); m.assign(new DoubleFunction() { private final Random rnd = RandomUtils.getRandom(); @Override public double apply(double arg0) { return rnd.nextDouble() * SCALE; } }); m.setQuick(0, 0, 1); m.setQuick(0, 1, 2); m.setQuick(0, 2, 3); m.setQuick(1, 0, 4); m.setQuick(1, 1, 5); m.setQuick(1, 2, 6); m.setQuick(2, 0, 7); m.setQuick(2, 1, 8); m.setQuick(2, 2, 9); GivensThinSolver qrSolver = new GivensThinSolver(m.rowSize(), m.columnSize()); qrSolver.solve(m); Matrix qtm = new DenseMatrix(qrSolver.getThinQtTilde()); assertOrthonormality(qtm.transpose(), false, SVD_EPSILON); Matrix aClone = new DenseMatrix(qrSolver.getThinQtTilde()).transpose() .times(qrSolver.getRTilde()); System.out.println("aclone : " + aClone); }