/** * 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; }
/** * * @param computeVectors * @param tol Tolerance for a matrix being symmetric */ public SwitchingEigenDecomposition( int matrixSize , boolean computeVectors , double tol ) { symmetricAlg = DecompositionFactory.eig(matrixSize,computeVectors,true); generalAlg = DecompositionFactory.eig(matrixSize,computeVectors,false); this.computeVectors = computeVectors; this.tol = tol; }
public SymmetricQRAlgorithmDecomposition_D64GCFree(boolean computeVectors) { this(DecompositionFactory.tridiagonal(0), computeVectors); }
/** * <p> * Computes the quality of the computed decomposition. A value close to or less than 1e-15 * is considered to be within machine precision. * </p> * * <p> * This function must be called before the original matrix has been modified or else it will * produce meaningless results. * </p> * * @return Quality of the decomposition. */ public double quality() { return DecompositionFactory.quality(mat,eig); }
/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
public QRNullspaceCalculator(int matrixSize) { MathTools.checkIntervalContains(matrixSize, 1, Integer.MAX_VALUE); nullspaceProjector = new DenseMatrix64F(matrixSize, matrixSize); tempMatrixForProjectionInPlace = new DenseMatrix64F(matrixSize, matrixSize); decomposer = DecompositionFactory.qr(matrixSize, matrixSize); nullspace = new DenseMatrix64F(matrixSize, matrixSize); Q = new DenseMatrix64F(matrixSize, matrixSize); R = new DenseMatrix64F(matrixSize, matrixSize); }
/** * <p> * Computes the quality of the computed decomposition. A value close to or less than 1e-15 * is considered to be within machine precision. * </p> * * <p> * This function must be called before the original matrix has been modified or else it will * produce meaningless results. * </p> * * @return Quality of the decomposition. */ public double quality() { return DecompositionFactory.quality(mat,eig); }
/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
public DampedQRNullspaceCalculator(int matrixSize, double alpha) { this.alpha = alpha; MathTools.checkIntervalContains(matrixSize, 1, Integer.MAX_VALUE); nullspaceProjector = new DenseMatrix64F(matrixSize, matrixSize); tempMatrixForProjectionInPlace = new DenseMatrix64F(matrixSize, matrixSize); linearSolver = LinearSolverFactory.symmPosDef(matrixSize); decomposer = DecompositionFactory.qr(matrixSize, matrixSize); nullspace = new DenseMatrix64F(matrixSize, matrixSize); Q = new DenseMatrix64F(matrixSize, matrixSize); R1 = new DenseMatrix64F(matrixSize, matrixSize); }
/** * 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); }
/** * * @param computeVectors * @param tol Tolerance for a matrix being symmetric */ public SwitchingEigenDecomposition( int matrixSize , boolean computeVectors , double tol ) { symmetricAlg = DecompositionFactory.eig(matrixSize,computeVectors,true); generalAlg = DecompositionFactory.eig(matrixSize,computeVectors,false); this.computeVectors = computeVectors; this.tol = tol; }
public SymmetricQRAlgorithmDecomposition_D64GCFree(boolean computeVectors) { this(DecompositionFactory.tridiagonal(0), computeVectors); }
/** * <p> * Computes the quality of the computed decomposition. A value close to or less than 1e-15 * is considered to be within machine precision. * </p> * * <p> * This function must be called before the original matrix has been modified or else it will * produce meaningless results. * </p> * * @return Quality of the decomposition. */ public double quality() { return DecompositionFactory.quality(mat,eig); }
/** * Checks to see if the rows of the provided matrix are linearly independent. * * @param A Matrix whose rows are being tested for linear independence. * @return true if linearly independent and false otherwise. */ public static boolean isRowsLinearIndependent( DenseMatrix64F A ) { // LU decomposition LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(A.numRows,A.numCols); if( lu.inputModified() ) A = A.copy(); if( !lu.decompose(A)) throw new RuntimeException("Decompositon failed?"); // if they are linearly independent it should not be singular return !lu.isSingular(); }
CommonOps.extract(P, 0, 3, 0, 3, KR, 0, 0); QRDecomposition<DenseMatrix64F> qr = DecompositionFactory.qr(3, 3);
/** * 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); }
/** * * @param computeVectors * @param tol Tolerance for a matrix being symmetric */ public SwitchingEigenDecomposition( int matrixSize , boolean computeVectors , double tol ) { symmetricAlg = DecompositionFactory.eig(matrixSize,computeVectors,true); generalAlg = DecompositionFactory.eig(matrixSize,computeVectors,false); this.computeVectors = computeVectors; this.tol = tol; }
public SymmetricQRAlgorithmDecomposition_D64(boolean computeVectors) { this(DecompositionFactory.tridiagonal(0),computeVectors); }
/** * <p> * Computes a metric which measures the the quality of a singular value decomposition. If a * value is returned that is close to or smaller than 1e-15 then it is within machine precision. * </p> * * <p> * SVD quality is defined as:<br> * <br> * Quality = || A - U W V<sup>T</sup>|| / || A || <br> * where A is the original matrix , U W V is the decomposition, and ||A|| is the norm-f of A. * </p> * * @param orig The original matrix which was decomposed. Not modified. * @param svd The decomposition after processing 'orig'. Not modified. * @return The quality of the decomposition. */ public static double quality( DenseMatrix64F orig , SingularValueDecomposition<DenseMatrix64F> svd ) { return quality(orig,svd.getU(null,false),svd.getW(null),svd.getV(null,true)); }
public Matrix[] lu() { if (isSquare()) { LUDecomposition<DenseMatrix64F> lu = DecompositionFactory.lu(matrix.numRows, matrix.numCols); lu.decompose(matrix); DenseMatrix64F lm = new DenseMatrix64F(matrix.numRows, matrix.numCols); DenseMatrix64F um = new DenseMatrix64F(matrix.numRows, matrix.numCols); lu.getLower(lm); lu.getUpper(um); Matrix l = new EJMLDenseDoubleMatrix2D(lm); Matrix u = new EJMLDenseDoubleMatrix2D(um); Matrix p = new EJMLDenseDoubleMatrix2D(lu.getPivot(null)); return new Matrix[] { l, u, p }; } else { return super.lu(); } }