/** * Creats a new SimpleMatrix which is identical to the original. * * @param orig The matrix which is to be copied. Not modified. */ public SimpleMatrix( SimpleMatrix orig ) { this.mat = orig.mat.copy(); }
/** * Returns a copy of the found homography matrix. * @return Homography matrix. */ public DenseMatrix64F getHomography() { return found.copy(); } }
/** * Creates a new SimpleMatrix which is a copy of the DenseMatrix64F. * * @param orig The original matrix whose value is copied. Not modified. */ public SimpleMatrix( DenseMatrix64F orig ) { this.mat = orig.copy(); }
/** * Creats a new SimpleMatrix which is identical to the original. * * @param orig The matrix which is to be copied. Not modified. */ public SimpleMatrix( SimpleMatrix orig ) { this.mat = orig.mat.copy(); }
/** * Creates a new SimpleMatrix which is a copy of the DenseMatrix64F. * * @param orig The original matrix whose value is copied. Not modified. */ public SimpleMatrix( DenseMatrix64F orig ) { this.mat = orig.copy(); }
/** * Creats a new SimpleMatrix which is identical to the original. * * @param orig The matrix which is to be copied. Not modified. */ public SimpleMatrix( SimpleMatrix orig ) { this.mat = orig.mat.copy(); }
/** * Creates a new SimpleMatrix which is a copy of the DenseMatrix64F. * * @param orig The original matrix whose value is copied. Not modified. */ public SimpleMatrix( DenseMatrix64F orig ) { this.mat = orig.copy(); }
@Override public DenseMatrix64F getL(DenseMatrix64F L) { if( L == null ) { L = this.L.copy(); } else { L.set(this.L); } return L; }
@Override public DenseMatrix64F getL(DenseMatrix64F L) { if( L == null ) { L = this.L.copy(); } else { L.set(this.L); } return L; }
private DenseMatrix64F getTranspose(DenseMatrix64F dataMatrix) { DenseMatrix64F dataMatrixTranspose = dataMatrix.copy(); transpose(dataMatrixTranspose); return dataMatrixTranspose; }
private double[][] getXtXInverse(MatrixFormulation matrixFormulation) { DenseMatrix64F XtXInvMatrix = matrixFormulation.XtXInv.copy(); int dim = XtXInvMatrix.getNumCols(); double[][] XtXInvArray = new double[dim][dim]; for (int i = 0; i < dim; i++) { for (int j = 0; j < dim; j++) { XtXInvArray[i][j] = XtXInvMatrix.get(i, j); } } return XtXInvArray; }
/** * Computes the rank of a matrix using the specified tolerance. * * @param A Matrix whose rank is to be calculated. Not modified. * @param threshold The numerical threshold used to determine a singular value. * @return The matrix's rank. */ public static int rank( DenseMatrix64F A , double threshold ) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows,A.numCols,false,false,true); if( svd.inputModified() ) A = A.copy(); if( !svd.decompose(A) ) throw new RuntimeException("Decomposition failed"); return SingularOps.rank(svd, threshold); }
/** * Computes the rank of a matrix using the specified tolerance. * * @param A Matrix whose rank is to be calculated. Not modified. * @param threshold The numerical threshold used to determine a singular value. * @return The matrix's rank. */ public static int rank( DenseMatrix64F A , double threshold ) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows,A.numCols,false,false,true); if( svd.inputModified() ) A = A.copy(); if( !svd.decompose(A) ) throw new RuntimeException("Decomposition failed"); return SingularOps.rank(svd, threshold); }
/** * Computes the rank of a matrix using the specified tolerance. * * @param A Matrix whose rank is to be calculated. Not modified. * @param threshold The numerical threshold used to determine a singular value. * @return The matrix's rank. */ public static int rank( DenseMatrix64F A , double threshold ) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows,A.numCols,false,false,true); if( svd.inputModified() ) A = A.copy(); if( !svd.decompose(A) ) throw new RuntimeException("Decomposition failed"); return SingularOps.rank(svd, threshold); }
/** * Computes the nullity of a matrix using the specified tolerance. * * @param A Matrix whose rank is to be calculated. Not modified. * @param threshold The numerical threshold used to determine a singular value. * @return The matrix's nullity. */ public static int nullity( DenseMatrix64F A , double threshold ) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows,A.numCols,false,false,true); if( svd.inputModified() ) A = A.copy(); if( !svd.decompose(A) ) throw new RuntimeException("Decomposition failed"); return SingularOps.nullity(svd,threshold); } }
/** * Computes the nullity of a matrix using the specified tolerance. * * @param A Matrix whose rank is to be calculated. Not modified. * @param threshold The numerical threshold used to determine a singular value. * @return The matrix's nullity. */ public static int nullity( DenseMatrix64F A , double threshold ) { SingularValueDecomposition<DenseMatrix64F> svd = DecompositionFactory.svd(A.numRows,A.numCols,false,false,true); if( svd.inputModified() ) A = A.copy(); if( !svd.decompose(A) ) throw new RuntimeException("Decomposition failed"); return SingularOps.nullity(svd,threshold); } }
/** * 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 static DenseMatrix64F flipUpDown(DenseMatrix64F matrix) { DenseMatrix64F ret = matrix.copy(); int nRows = ret.getNumRows(); int nColumns = ret.getNumCols(); for (int i = 0; i < nRows; i++) { int newRowNumber = nRows - i - 1; for (int j = 0; j < nColumns; j++) { ret.set(newRowNumber, j, matrix.get(i, j)); } } return ret; }
public static DenseMatrix64F flipUpDown(DenseMatrix64F matrix) { DenseMatrix64F ret = matrix.copy(); int nRows = ret.getNumRows(); int nColumns = ret.getNumCols(); for (int i = 0; i < nRows; i++) { int newRowNumber = nRows - i - 1; for (int j = 0; j < nColumns; j++) { ret.set(newRowNumber, j, matrix.get(i, j)); } } return ret; }
public Matrix copy() { Matrix m = new EJMLDenseDoubleMatrix2D(matrix.copy()); if (getMetaData() != null) { m.setMetaData(getMetaData().clone()); } return m; }