org.eclipse.january.dataset

## Class BooleanBroadcastIterator

- java.lang.Object
- - org.eclipse.january.dataset.IndexIterator
  - - org.eclipse.january.dataset.BooleanIterator
    - - org.eclipse.january.dataset.BooleanBroadcastIterator

-     public class BooleanBroadcastIterator
      extends BooleanIterator

  Class to run over a pair of datasets in parallel with NumPy broadcasting to promote shapes which have lower rank and outputs to a third dataset
  Since:
    2.1

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected int[]` | `aDelta`
    `protected int[]` | `aShape`
    `protected int[]` | `aStride`
    `protected int` | `endrank`
    `protected int[]` | `oDelta`
    `protected int[]` | `oStride`
    `protected int[]` | `pos` position in dataset

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

      `aDataset, aMax, aStart, aStep, cDataset, cIndex, maxShape, oDataset, oIndex, oStart, oStep, outputA, value`

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

      `index`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BooleanBroadcastIterator(boolean v, Dataset a, Dataset c, Dataset o, boolean createIfNull)` Construct a boolean iterator that stops at every position in the choice dataset where its value matches the given boolean

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `int[]` | `getFirstShape()`
    `int[]` | `getMaskShape()`
    `int[]` | `getPos()`
    `boolean` | `hasNext()`
    `void` | `reset()` Reset iterator

    - ### Methods inherited from class org.eclipse.january.dataset.BooleanIterator

      `createIterator, createIterator, createIterator, createIterator, getChoice, getOutput, getShape`

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

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

- - ### Field Detail

    - #### aShape

          protected int[] aShape

    - #### aStride

          protected int[] aStride

    - #### oStride

          protected int[] oStride

    - #### endrank

          protected int endrank

    - #### pos

          protected int[] pos

      position in dataset

    - #### aDelta

          protected int[] aDelta

    - #### oDelta

          protected int[] oDelta

  - ### Constructor Detail

    - #### BooleanBroadcastIterator

          public BooleanBroadcastIterator(boolean v,
                                          Dataset a,
                                          Dataset c,
                                          Dataset o,
                                          boolean createIfNull)

      Construct a boolean iterator that stops at every position in the choice dataset where its value matches the given boolean
      Parameters:
        `v` - boolean value
        `a` - primary dataset
        `c` - choice dataset
        `o` - output dataset, can be null
        `createIfNull` - if true create the output dataset if that is null

  - ### Method Detail

    - #### hasNext

          public boolean hasNext()

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

    - #### getFirstShape

          public int[] getFirstShape()

      Returns:
        shape of first broadcasted dataset

    - #### getMaskShape

          public int[] getMaskShape()

      Returns:
        shape of second broadcasted dataset

    - #### reset

          public void reset()

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

    - #### 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)

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