org.eclipse.january.dataset

## Class SingleInputBroadcastIterator

- java.lang.Object
- - org.eclipse.january.dataset.IndexIterator
  - - org.eclipse.january.dataset.SingleInputBroadcastIterator

-     public class SingleInputBroadcastIterator
      extends IndexIterator

  Class to run over a single dataset with NumPy broadcasting to promote shapes which have lower rank and outputs to a second dataset

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `double` | `aDouble` Current value in array
    `int` | `aIndex` Index in array
    `long` | `aLong` Current value in array
    `int` | `oIndex` Index in array

    - ### Fields inherited from class org.eclipse.january.dataset.IndexIterator

      `index`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SingleInputBroadcastIterator(Dataset a, Dataset o)`
    `SingleInputBroadcastIterator(Dataset a, Dataset o, boolean createIfNull)`
    `SingleInputBroadcastIterator(Dataset a, Dataset o, boolean createIfNull, boolean allowInteger, boolean allowComplex)`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `Dataset` | `getOutput()`
    `int[]` | `getPos()`
    `int[]` | `getShape()`
    `boolean` | `hasNext()`
    `boolean` | `isOutputDouble()`
    `void` | `reset()` Reset iterator
    `void` | `setOutputDouble(boolean asDouble)` Set to output doubles

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Field Detail

    - #### aIndex

          public int aIndex

      Index in array

    - #### oIndex

          public int oIndex

      Index in array

    - #### aDouble

          public double aDouble

      Current value in array

    - #### aLong

          public long aLong

      Current value in array

  - ### Constructor Detail

    - #### SingleInputBroadcastIterator

          public SingleInputBroadcastIterator(Dataset a,
                                              Dataset o)

      Parameters:
        `a` - dataset to iterate over
        `o` - (can be null for new dataset, or a)

    - #### SingleInputBroadcastIterator

          public SingleInputBroadcastIterator(Dataset a,
                                              Dataset o,
                                              boolean createIfNull)

      Parameters:
        `a` - dataset to iterate over
        `o` - (can be null for new dataset, or a)
        `createIfNull` - if true, create new dataset if o is null

    - #### SingleInputBroadcastIterator

          public SingleInputBroadcastIterator(Dataset a,
                                              Dataset o,
                                              boolean createIfNull,
                                              boolean allowInteger,
                                              boolean allowComplex)

      Parameters:
        `a` - dataset to iterate over
        `o` - (can be null for new dataset, or a)
        `createIfNull` - (by default, can create float or complex datasets)
        `allowInteger` - if true, can create integer datasets
        `allowComplex` - if true, can create complex datasets

  - ### Method Detail

    - #### isOutputDouble

          public boolean isOutputDouble()

      Returns:
        true if output from iterator is double

    - #### setOutputDouble

          public void setOutputDouble(boolean asDouble)

      Set to output doubles
      Parameters:
        `asDouble` - true to output as double

    - #### getShape

          public int[] getShape()

      Overrides:
        `getShape` in class `IndexIterator`
      Returns:
        shape of iterator (can be null, if not known or applicable)

    - #### hasNext

          public boolean hasNext()

      Specified by:
        `hasNext` in class `IndexIterator`
      Returns:
        true if there is another iteration

    - #### getOutput

          public Dataset getOutput()

      Returns:
        output dataset (can be null)

    - #### getPos

          public int[] getPos()

      Specified by:
        `getPos` in class `IndexIterator`
      Returns:
        position indices (nb this is reference not a copy so avoid changing and can be null)

    - #### reset

          public void reset()

      Description copied from class: `IndexIterator`
      Reset iterator
      Specified by:
        `reset` in class `IndexIterator`

Copyright © 2014–2022 Eclipse Foundation. All rights reserved.