Module ojalgo

Class ColumnsSupplier<N extends java.lang.Comparable<N>>

    • Field Detail

      • myColumns

        private final java.util.List<SparseArray<N extends java.lang.Comparable<N>>> myColumns
      • myPhysicalStoreFactory

        private final PhysicalStore.Factory<N extends java.lang.Comparable<N>,​?> myPhysicalStoreFactory
      • myRowsCount

        private final int myRowsCount
    • Method Detail

      • add

        public void add​(int row,
                        int col,
                        double addend)
        Specified by:
        add in interface Mutate2D.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long row,
                        long col,
                        java.lang.Comparable<?> addend)
        Specified by:
        add in interface Mutate2D.Modifiable<N extends java.lang.Comparable<N>>
      • add

        public void add​(long row,
                        long col,
                        double addend)
        Specified by:
        add in interface Mutate2D.Modifiable<N extends java.lang.Comparable<N>>
      • addColumns

        public void addColumns​(int numberToAdd)
      • columns

        public MatrixStore<N> columns​(int... columns)
        Description copied from interface: MatrixStore
        A selection (re-ordering) of columns. Note that it's ok to reference the same base column more than once, and any negative column reference/index will translate to a column of zeros. The number of columns in the resulting matrix is the same as the number of elements in the columns index array.
        Specified by:
        columns in interface Access2D<N extends java.lang.Comparable<N>>
        Specified by:
        columns in interface MatrixStore<N extends java.lang.Comparable<N>>
        Specified by:
        columns in interface Structure2D.Logical<Access2D<N extends java.lang.Comparable<N>>,​MatrixStore<N extends java.lang.Comparable<N>>>
      • countColumns

        public long countColumns()
        Description copied from interface: Structure2D
        Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
        Specified by:
        countColumns in interface Structure2D
        Returns:
        The number of columns
      • countRows

        public long countRows()
        Description copied from interface: Structure2D
        Only need to implement if the structure may contain more than Integer.MAX_VALUE elements.
        Specified by:
        countRows in interface Structure2D
        Returns:
        The number of rows
      • doubleValue

        public double doubleValue​(int row,
                                  int col)
        Description copied from interface: Access2D
        Extracts one element of this matrix as a double.
        Specified by:
        doubleValue in interface Access2D<N extends java.lang.Comparable<N>>
        Specified by:
        doubleValue in interface MatrixStore<N extends java.lang.Comparable<N>>
        Parameters:
        row - A row index.
        col - A column index.
        Returns:
        One matrix element
      • get

        public N get​(int row,
                     int col)
        Specified by:
        get in interface MatrixStore<N extends java.lang.Comparable<N>>
      • getColDim

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

        public SparseArray<N> getColumn​(int index)
      • getRowDim

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

        public void putLast​(int row,
                            int col,
                            double value)
        Efficiently appends a new nonzero element to the end of the specified column.

        This method assumes that the supplied row is strictly greater than all existing row indices in the specified column. No search is performed; the value is simply appended. If the ascending order of row indices is broken, future behavior is unspecified. If the value is zero, nothing is stored.

        Parameters:
        row - the row index (must be after all existing row indices in the column)
        col - the column to which the value should be appended
        value - the value to insert (only nonzero values are actually stored)
      • removeColumn

        public Access1D<N> removeColumn​(int index)
      • reset

        public void reset()
        Description copied from interface: Mutate1D
        Reset this mutable structure to some standard (all zeros) initial state. It must still be usuable after this call, and the structure/size/shape must not change.
        Specified by:
        reset in interface Mutate1D
      • 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
      • toString

        public java.lang.String toString()
        Overrides:
        toString in class java.lang.Object
      • toCSC

        R064CSC toCSC​(int nbRows,
                      int nbCols,
                      int nbNz)