Module ojalgo

Class RowsSupplier<N extends Comparable<N>>

java.lang.Object
org.ojalgo.matrix.store.RowsSupplier<N>
All Implemented Interfaces:
Consumer<Access2D<?>>, Group, Group.Additive<MatrixStore<N>>, NormedVectorSpace<MatrixStore<N>,N>, Operation, Operation.Addition<MatrixStore<N>>, Operation.Multiplication<MatrixStore<N>>, Operation.Subtraction<MatrixStore<N>>, ScalarOperation, ScalarOperation.Addition<MatrixStore<N>,N>, ScalarOperation.Division<MatrixStore<N>,N>, ScalarOperation.Multiplication<MatrixStore<N>,N>, ScalarOperation.Subtraction<MatrixStore<N>,N>, VectorSpace<MatrixStore<N>,N>, Matrix2D<N,MatrixStore<N>>, ElementsSupplier<N>, MatrixStore<N>, SparseStructure2D, Access1D<N>, Access1D.Aggregatable<N>, Access1D.Collectable<N,Mutate1D>, Access1D.Sliceable<N>, Access1D.Visitable<N>, Access2D<N>, Access2D.Aggregatable<N>, Access2D.Collectable<N,TransformableRegion<N>>, Access2D.Sliceable<N>, Access2D.Visitable<N>, Mutate1D, Mutate1D.Fillable<N>, Mutate1D.Modifiable<N>, Mutate2D, Mutate2D.Exchangeable, Mutate2D.Fillable<N>, Mutate2D.Modifiable<N>, Mutate2D.ModifiableReceiver<N>, Mutate2D.Receiver<N>, Operate2D<N,ElementsSupplier<N>>, Structure1D, Structure2D, Structure2D.Logical<Access2D<N>,MatrixStore<N>>, Structure2D.ReducibleTo1D<ElementsSupplier<N>>

public final class RowsSupplier<N extends Comparable<N>> extends Object implements MatrixStore<N>, SparseStructure2D, Mutate2D.ModifiableReceiver<N>
Sparse rows – rows can be added and removed.
Author:
apete
  • Method Details

    • add

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

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

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

      public SparseArray<N> addRow()
    • 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
    • countNonzeros

      public int countNonzeros()
      Specified by:
      countNonzeros in interface SparseStructure2D
    • 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 Comparable<N>>
      Specified by:
      doubleValue in interface MatrixStore<N extends Comparable<N>>
      Parameters:
      row - A row index.
      col - A column index.
      Returns:
      One matrix element
    • exchangeColumns

      public void exchangeColumns(long colA, long colB)
      Specified by:
      exchangeColumns in interface Mutate2D.Exchangeable
    • exchangeRows

      public void exchangeRows(long rowA, long rowB)
      Specified by:
      exchangeRows in interface Mutate2D.Exchangeable
    • get

      public PhysicalStore<N> get()
      Specified by:
      get in interface MatrixStore<N extends Comparable<N>>
    • get

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

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

      public SparseArray<N> getRow(int index)
    • getRowDim

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

      public void modifyAny(Transformation2D<N> modifier)
      Specified by:
      modifyAny in interface Mutate2D.ModifiableReceiver<N extends Comparable<N>>
    • modifyOne

      public void modifyOne(long row, long col, UnaryFunction<N> modifier)
      Specified by:
      modifyOne in interface Mutate2D.Modifiable<N extends Comparable<N>>
    • physical

      public PhysicalStore.Factory<N,?> physical()
      Specified by:
      physical in interface MatrixStore<N extends Comparable<N>>
    • 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 Access2D.RowView<N> rows()
      Specified by:
      rows in interface Access2D<N extends Comparable<N>>
    • 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 Comparable<N>>
      Specified by:
      rows in interface MatrixStore<N extends Comparable<N>>
      Specified by:
      rows in interface Structure2D.Logical<Access2D<N extends Comparable<N>>,MatrixStore<N extends 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, Comparable<?> value)
      Specified by:
      set in interface Mutate2D
    • sliceRow

      public SparseArray<N> sliceRow(long row)
      Specified by:
      sliceRow in interface Access2D.Sliceable<N extends Comparable<N>>
    • supplyTo

      public void supplyTo(TransformableRegion<N> receiver)
      Specified by:
      supplyTo in interface Access2D.Collectable<N extends Comparable<N>,TransformableRegion<N extends Comparable<N>>>
      Specified by:
      supplyTo in interface MatrixStore<N extends Comparable<N>>
    • toCSC

      public R064CSC toCSC()
      Specified by:
      toCSC in interface SparseStructure2D
    • toCSR

      public R064CSR toCSR()
      Specified by:
      toCSR in interface SparseStructure2D
    • toString

      public String toString()
      Overrides:
      toString in class Object