Module ojalgo

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

    • Field Detail

      • myColumnsCount

        private final int myColumnsCount
      • myPhysicalStoreFactory

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

        private final java.util.List<SparseArray<N extends java.lang.Comparable<N>>> myRows
    • Method Detail

      • 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>>
      • addRows

        public void addRows​(int numberToAdd)
      • 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
      • doCyclicFT

        public void doCyclicFT​(int from,
                               Mutate1D row,
                               int to,
                               Access1D<?> column)
        Performs the row/column cyclic shifts required by the Forrest-Tomlin update algorithm as implemented in ojAlgo's own sparse LU decomposition. This method is not intended for any other use case.
        Parameters:
        from - the row index to start the cyclic shift
        row - a Mutate1D to receive the removed row's values (shifted left by one column)
        to - the row index to end the cyclic shift
        column - an Access1D providing the new column values
      • 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
      • 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 row.

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

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

        public SparseArray<N> removeRow​(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
      • rows

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

        public RowsSupplier<N> selectRows​(int[] indices)
      • 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