/** * {@inheritDoc} * * NOTE: Returned matrix is Yale format if m is Diagonal, Dense, or Sparse * in Yale format. Is sparse row if m is Sparse and in sparse row format. * * @return {@inheritDoc} */ @Override final public SparseMatrix copyMatrix( final Matrix m) { if (m instanceof SparseMatrix) { return new SparseMatrix((SparseMatrix) m); } else if (m instanceof DenseMatrix) { return new SparseMatrix((DenseMatrix) m); } else if (m instanceof DiagonalMatrix) { return new SparseMatrix((DiagonalMatrix) m); } // I have to handle other matrix types SparseMatrix result = new SparseMatrix(m.getNumRows(), m.getNumColumns()); result.convertFromVector(m.convertToVector()); return result; }
/** * {@inheritDoc} * * NOTE: Returned matrix is Yale format if m is Diagonal, Dense, or Sparse * in Yale format. Is sparse row if m is Sparse and in sparse row format. * * @return {@inheritDoc} */ @Override final public SparseMatrix copyMatrix( final Matrix m) { if (m instanceof SparseMatrix) { return new SparseMatrix((SparseMatrix) m); } else if (m instanceof DenseMatrix) { return new SparseMatrix((DenseMatrix) m); } else if (m instanceof DiagonalMatrix) { return new SparseMatrix((DiagonalMatrix) m); } // I have to handle other matrix types SparseMatrix result = new SparseMatrix(m.getNumRows(), m.getNumColumns()); result.convertFromVector(m.convertToVector()); return result; }
/** * {@inheritDoc} * * NOTE: Returned matrix is Yale format if m is Diagonal, Dense, or Sparse * in Yale format. Is sparse row if m is Sparse and in sparse row format. * * @return {@inheritDoc} */ @Override final public SparseMatrix copyMatrix( final Matrix m) { if (m instanceof SparseMatrix) { return new SparseMatrix((SparseMatrix) m); } else if (m instanceof DenseMatrix) { return new SparseMatrix((DenseMatrix) m); } else if (m instanceof DiagonalMatrix) { return new SparseMatrix((DiagonalMatrix) m); } // I have to handle other matrix types SparseMatrix result = new SparseMatrix(m.getNumRows(), m.getNumColumns()); result.convertFromVector(m.convertToVector()); return result; }