Interface SparseMatrix

    • Method Detail

      • getEntryList

        List<SparseMatrix.Entry> getEntryList()
        Exports the non-zero values in the matrix as a list of SparseMatrix.Entrys. This is useful for converting between the different formats of SparseMatrix.Entry. For example,
        
         // construct matrix using DOK
         DOKSparseMatrix dok = new DOKSparseMatrix(5, 5);
         // ... insert some values to DOK matrix
         // convert to CSR matrix for efficient matrix operations
         CSRSparseMatrix csr = new CSRSparseMatrix(5, 5, dok.getEntryList());
         
        Returns:
        the sparse entries
      • subMatrix

        SparseMatrix subMatrix​(int rowFrom,
                               int rowTo,
                               int colFrom,
                               int colTo)
        Extracts a sub-matrix given the bounds of row and column indices (inclusive).
        Parameters:
        rowFrom - the beginning row index
        rowTo - the ending row index
        colFrom - the beginning column index
        colTo - the ending column index
        Returns:
        A[rowFrom:rowTo, colFrom:colTo]