/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public SolvePseudoInverseSvd(int maxRows, int maxCols) { svd = DecompositionFactory.svd(maxRows,maxCols,true,true,true); }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public ConfigurableSolvePseudoInverseSVD(int maxRows, int maxCols, double singularValueLimit) { svd = DecompositionFactory.svd(maxRows, maxCols, true, true, true); this.singularValueLimit = singularValueLimit; }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public SolvePseudoInverseSvd(int maxRows, int maxCols) { svd = DecompositionFactory.svd(maxRows,maxCols,true,true,true); }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public SolvePseudoInverseSvd(int maxRows, int maxCols) { svd = DecompositionFactory.svd(maxRows,maxCols,true,true,true); }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public ConfigurableSolvePseudoInverseSVD(int maxRows, int maxCols, double singularValueLimit) { svd = DecompositionFactory.svd(maxRows, maxCols, true, true, true); this.singularValueLimit = singularValueLimit; }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public SolvePseudoInverseSvdGCFree(int maxRows, int maxCols) { svd = DecompositionFactory.svd(maxRows,maxCols,true,true,true); tempV = new DenseMatrix64F(maxCols, maxCols); }
/** * Creates a new solver targeted at the specified matrix size. * * @param maxRows The expected largest matrix it might have to process. Can be larger. * @param maxCols The expected largest matrix it might have to process. Can be larger. */ public SolvePseudoInverseSvdGCFree(int maxRows, int maxCols) { svd = DecompositionFactory.svd(maxRows,maxCols,true,true,true); tempV = new DenseMatrix64F(maxCols, maxCols); }
public TrifocalLinearPoint7() { svdNull = DecompositionFactory.svd(24, 27, false, true, false); svdNull = new SafeSvd(svdNull); }
public TrifocalExtractEpipoles() { svd = DecompositionFactory.svd(3, 3, true, true, true); svd = new SafeSvd(svd); }
public DecomposeHomography() { for( int i = 0; i < 4; i++ ) { solutionsN.add( new Vector3D_F64() ); solutionsSE.add( new Se3_F64() ); } // insure that the inputs are not modified svd = new SafeSvd(DecompositionFactory.svd(3, 3, false, true, false)); }
private static double computeSmallestSingularValue(DenseMatrix64F A) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows, A.numCols, false, false, true); svd.decompose(A); double[] singularValues = svd.getSingularValues(); return Doubles.min(singularValues); } }
private static double computeSmallestSingularValue(DenseMatrix64F A) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows, A.numCols, false, false, true); svd.decompose(A); double[] singularValues = svd.getSingularValues(); return Doubles.min(singularValues); } }
@ContinuousIntegrationTest(estimatedDuration = 0.0) @Test(timeout = 30000) public void errorSVD() { SingularValueDecomposition<DenseMatrix64F> dec = DecompositionFactory.svd(16, 16, true, true, true); DenseMatrix64F m = RandomMatrices.createRandom(16, 16, new Random(64)); MatrixIO.print(System.out, m,"%.10e"); dec.decompose(m); System.out.println("SVs="+Arrays.toString(dec.getSingularValues())); }
public NullspaceCalculator(int matrixSize, boolean makeLargestComponentPositive) { MathTools.checkIfInRange(matrixSize, 1, Integer.MAX_VALUE); iMinusNNT = new DenseMatrix64F(matrixSize, matrixSize); double singularValueLimit = 0.5; // because the singular values of I - N * N^T will be either 0 or 1. iMinusNNTSolver = new ConfigurableSolvePseudoInverseSVD(matrixSize, matrixSize, singularValueLimit); svd = DecompositionFactory.svd(matrixSize, matrixSize, false, true, false); sigma = new DenseMatrix64F(matrixSize, matrixSize); v = new DenseMatrix64F(matrixSize, matrixSize); nullspace = new DenseMatrix64F(matrixSize, matrixSize); // oversized, using reshape later x = new DenseMatrix64F(matrixSize, matrixSize);// oversized, using reshape later this.makeLargestComponentPositive = makeLargestComponentPositive; }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); }
public SimpleSVD( DenseMatrix64F mat , boolean compact ) { this.mat = mat; svd = DecompositionFactory.svd(mat.numRows,mat.numCols,true,true,compact); if( !svd.decompose(mat) ) throw new RuntimeException("Decomposition failed"); U = (T)SimpleMatrix.wrap(svd.getU(null,false)); W = (T)SimpleMatrix.wrap(svd.getW(null)); V = (T)SimpleMatrix.wrap(svd.getV(null,false)); // order singular values from largest to smallest SingularOps.descendingOrder(U.getMatrix(),false,W.getMatrix(),V.getMatrix(),false); tol = SingularOps.singularThreshold(svd); }
public DampedSVDNullspaceCalculator(int matrixSize, double alpha) { MathTools.checkIntervalContains(matrixSize, 1, Integer.MAX_VALUE); this.alpha = alpha; nullspaceProjector = new DenseMatrix64F(matrixSize, matrixSize); tempMatrixForProjectionInPlace = new DenseMatrix64F(matrixSize, matrixSize); decomposer = DecompositionFactory.svd(matrixSize, matrixSize, false, true, false); sigma = new DenseMatrix64F(matrixSize, matrixSize); sigmaDampedSigma = new DenseMatrix64F(matrixSize, matrixSize); v = new DenseMatrix64F(matrixSize, matrixSize); nullspace = new DenseMatrix64F(matrixSize, matrixSize); // oversized, using reshape later Q = new DenseMatrix64F(matrixSize, matrixSize); // oversized, using reshape later }
public Matrix[] calc(Matrix source) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd((int) source.getRowCount(), (int) source.getColumnCount(), true, true, false); if (source instanceof EJMLDenseDoubleMatrix2D) { svd.decompose(((EJMLDenseDoubleMatrix2D) source).getWrappedObject()); } else { svd.decompose(new EJMLDenseDoubleMatrix2D(source).getWrappedObject()); } Matrix u = new EJMLDenseDoubleMatrix2D(svd.getU(null, false)); Matrix v = new EJMLDenseDoubleMatrix2D(svd.getV(null, false)); Matrix s = new EJMLDenseDoubleMatrix2D(svd.getW(null)); return new Matrix[] { u, s, v }; }