code: public static int rowNumber(int index, INDArray arr) {
          double otherTest = ((double) index) / arr.size(-1);
          int test = (int) Math.floor(otherTest);
  
          // FIXME: int cast
  
          int vectors = (int) arr.vectorsAlongDimension(-1);
          if (test >= vectors)
              return vectors - 1;
          return test;
      }
docs: Compute the linear offset
  for an index in an ndarray.
  
  For c ordering this is just the index itself.
  For fortran ordering, the following algorithm is used.
  
  Assuming an ndarray is a list of vectors.
  The index of the vector relative to the given index is calculated.
  
  vectorAlongDimension is then used along the last dimension
  using the computed index.
  
  The offset + the computed column wrt the index: (index % the size of the last dimension)
  will render the given index in fortran ordering
  @param index the index
  @param arr the array
  @return the linear offset