public Matrix chol() { try { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); Matrix l = new MTJDenseDoubleMatrix2D(chol.getL()); return l; } catch (Exception e) { throw new RuntimeException(e); } }
public Matrix chol() { try { DenseCholesky chol = DenseCholesky.factorize(getWrappedObject()); Matrix l = new MTJDenseDoubleMatrix2D(chol.getL()); return l; } catch (Exception e) { throw new RuntimeException(e); } }
@Override public long process(BenchmarkMatrix[] inputs, BenchmarkMatrix[] outputs, long numTrials) { DenseMatrix matA = inputs[0].getOriginal(); DenseCholesky cholesky = new DenseCholesky(matA.numRows(),false); LowerSPDDenseMatrix uspd = new LowerSPDDenseMatrix(matA); LowerTriangDenseMatrix L = null; long prev = System.nanoTime(); for( long i = 0; i < numTrials; i++ ) { // the input matrix is over written uspd.set(matA); if( !cholesky.factor(uspd).isSPD() ) { throw new DetectedException("Is not SPD"); } L = cholesky.getL(); } long elapsedTime = System.nanoTime()-prev; if( outputs != null ) { outputs[0] = new MtjBenchmarkMatrix(L); } return elapsedTime; } }