Class AccessAnyD.MatrixView<N extends Comparable<N>>

java.lang.Object
org.ojalgo.structure.AccessAnyD.MatrixView<N>
All Implemented Interfaces:
Comparable<AccessAnyD.MatrixView<N>>, Iterable<AccessAnyD.MatrixView<N>>, Iterator<AccessAnyD.MatrixView<N>>, Access1D<N>, Access2D<N>, Access2D.Collectable<N,Mutate2D>, Structure1D, Structure2D
Enclosing interface:
AccessAnyD<N extends Comparable<N>>

public static final class AccessAnyD.MatrixView<N extends Comparable<N>> extends Object implements Access2D<N>, Iterable<AccessAnyD.MatrixView<N>>, Iterator<AccessAnyD.MatrixView<N>>, Comparable<AccessAnyD.MatrixView<N>>, Access2D.Collectable<N,Mutate2D>
  • Field Details

    • myColumnsCount

      private final long myColumnsCount
    • myCount

      private final long myCount
    • myDelegateAnyD

      private final AccessAnyD<N extends Comparable<N>> myDelegateAnyD
    • myLastOffset

      private final long myLastOffset
    • myOffset

      private long myOffset
    • myRowsCount

      private final long myRowsCount
  • Constructor Details

    • MatrixView

      protected MatrixView(AccessAnyD<N> access)
    • MatrixView

      MatrixView(AccessAnyD<N> access, long index)
  • Method Details

    • compareTo

      public int compareTo(AccessAnyD.MatrixView<N> other)
      Specified by:
      compareTo in interface Comparable<N extends Comparable<N>>
    • count

      public long count()
      Description copied from interface: Structure2D
      count() == countRows() * countColumns()
      Specified by:
      count in interface Structure1D
      Specified by:
      count in interface Structure2D
    • 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 Comparable<N>>
      Parameters:
      row - A row index.
      col - A column index.
      Returns:
      One matrix element
    • doubleValue

      public double doubleValue(long row, long col)
      Specified by:
      doubleValue in interface Access2D<N extends Comparable<N>>
    • estimateSize

      public long estimateSize()
    • get

      public N get(long row, long col)
      Specified by:
      get in interface Access2D<N extends 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
    • goToMatrix

      public void goToMatrix(long index)
      Move the view to a specific matrix. The index specified here should correspond to what is returned by the index() method.
      See Also:
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface Iterator<N extends Comparable<N>>
    • hasPrevious

      public boolean hasPrevious()
    • index

      public long index()
      If the underlying AccessAnyD data structure was created as 4x5x7x8, it can be viewed as 7x8 4x5 matrices. The dimensions of the MatrixView would be 4x5, and the index returned by this method indicates which of 7x8 matrices the view currently points to. The range of these indices would be 0-55.
      Returns:
      The index of the matrix (which matrix are we currently viewing).
    • iterator

      public AccessAnyD.MatrixView<N> iterator()
      Specified by:
      iterator in interface Iterable<N extends Comparable<N>>
    • next

      public AccessAnyD.MatrixView<N> next()
      Specified by:
      next in interface Iterator<N extends Comparable<N>>
    • previous

      public AccessAnyD.MatrixView<N> previous()
    • remove

      public void remove()
      Specified by:
      remove in interface Iterator<N extends Comparable<N>>
    • supplyTo

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

      public String toString()
      Overrides:
      toString in class Object
    • getOffset

      long getOffset()