Class SparseStore.Builder<N extends java.lang.Comparable<N>>

  • All Implemented Interfaces:
    Factory2D.Builder<SparseStore<N>>, Mutate1D, Mutate2D, Structure1D, Structure2D
    Enclosing class:
    SparseStore<N extends java.lang.Comparable<N>>

    public static final class SparseStore.Builder<N extends java.lang.Comparable<N>>
    extends java.lang.Object
    implements Factory2D.Builder<SparseStore<N>>
    May be a preferable way to build a sparse matrix if:
    • You don't know the number of nonzero elements in advance.
    • Setting elements in strictly increasing column major order is not possible.
    • Multiple threads are used to set elements.
    This builder uses separate/additional memory to store the elements before they are copied to the actual sparse matrix. The actual sparse matrix is built when the build() method is called.
    • Field Detail

      • myColDim

        private final int myColDim
      • myRowDim

        private final int myRowDim
    • Method Detail

      • getColDim

        public int getColDim()
        Specified by:
        getColDim in interface Structure2D
        Returns:
        The number of columns
      • getRowDim

        public int getRowDim()
        Specified by:
        getRowDim in interface Structure2D
        Returns:
        The number of rows
      • set

        public void set​(int row,
                        int col,
                        double value)
        Specified by:
        set in interface Mutate2D
      • set

        public void set​(long row,
                        long col,
                        java.lang.Comparable<?> value)
        Specified by:
        set in interface Mutate2D