Package org.ejml.data

Class FMatrixIterator

  • All Implemented Interfaces:
    java.util.Iterator<java.lang.Float>

    public class FMatrixIterator
    extends java.lang.Object
    implements java.util.Iterator<java.lang.Float>
    This is a matrix iterator for traversing through a submatrix. For speed it is recommended that you directly access the elements in the matrix, but there are some situations where this can be a better design.
    • Constructor Summary

      Constructors 
      Constructor Description
      FMatrixIterator​(FMatrixD1 a, boolean rowMajor, int minRow, int minCol, int maxRow, int maxCol)
      Creates a new iterator for traversing through a submatrix inside this matrix.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int getIndex()
      Which element in the submatrix was returned by next()
      boolean hasNext()  
      boolean isRowMajor()
      True if it is iterating through the matrix by rows and false if by columns.
      java.lang.Float next()  
      void remove()  
      void set​(float value)
      Sets the value of the current element.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
      • Methods inherited from interface java.util.Iterator

        forEachRemaining
    • Constructor Detail

      • FMatrixIterator

        public FMatrixIterator​(FMatrixD1 a,
                               boolean rowMajor,
                               int minRow,
                               int minCol,
                               int maxRow,
                               int maxCol)
        Creates a new iterator for traversing through a submatrix inside this matrix. It can be traversed by row or by column. Range of elements is inclusive, e.g. minRow = 0 and maxRow = 1 will include rows 0 and 1. The iteration starts at (minRow,minCol) and ends at (maxRow,maxCol)
        Parameters:
        a - the matrix it is iterating through
        rowMajor - true means it will traverse through the submatrix by row first, false by columns.
        minRow - first row it will start at.
        minCol - first column it will start at.
        maxRow - last row it will stop at.
        maxCol - last column it will stop at.
    • Method Detail

      • hasNext

        public boolean hasNext()
        Specified by:
        hasNext in interface java.util.Iterator<java.lang.Float>
      • next

        public java.lang.Float next()
        Specified by:
        next in interface java.util.Iterator<java.lang.Float>
      • remove

        public void remove()
        Specified by:
        remove in interface java.util.Iterator<java.lang.Float>
      • getIndex

        public int getIndex()
        Which element in the submatrix was returned by next()
        Returns:
        Submatrix element's index.
      • isRowMajor

        public boolean isRowMajor()
        True if it is iterating through the matrix by rows and false if by columns.
        Returns:
        row major or column major
      • set

        public void set​(float value)
        Sets the value of the current element.
        Parameters:
        value - The element's new value.