org.eclipse.january.dataset

## Class DatasetUtils

- java.lang.Object
- - org.eclipse.january.dataset.DatasetUtils

-     public class DatasetUtils
      extends Object

  Utilities for manipulating datasets

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `protected static org.slf4j.Logger` | `utilsLogger` Setup the logging facilities

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatasetUtils()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Dataset` | `append(IDataset a, IDataset b, int axis)` Append copy of dataset with another dataset along n-th axis
    `static IntegerDataset` | `calcIndexesFromPositions(List<? extends Dataset> positions, int[] shape, int... mode)` Calculate indexes in given shape from datasets of position
    `static List<IntegerDataset>` | `calcPositionsFromIndexes(Dataset indices, int[] shape)` Calculate positions in given shape from a dataset of 1-D indexes
    `static <T extends Dataset> T` | `cast(Class<T> clazz, IDataset d)` Cast a dataset
    `static CompoundDataset` | `cast(Dataset[] a, int dtype)` Cast array of datasets to a compound dataset
    `static Dataset` | `cast(IDataset d, boolean repeat, int dtype, int isize)` Cast a dataset
    `static Dataset` | `cast(IDataset d, int dtype)` Cast a dataset
    `static double[]` | `centroid(Dataset a, Dataset... bases)` Get the centroid value of a dataset, this function works out the centroid in every direction
    `static Dataset` | `choose(IntegerDataset index, Object[] choices, boolean throwAIOOBE, boolean clip)` Choose content from choices where condition is true, otherwise use default.
    `static Dataset` | `coerce(Dataset a, Object obj)` Create a copy that has been coerced to an appropriate dataset type depending on the input object's class
    `static Dataset` | `concatenate(IDataset[] as, int axis)` Concatenate the set of datasets along given axis
    `static Dataset` | `convertToDataset(IDataset data)` Convert (if necessary) a dataset obeying the interface to our implementation
    `static <T extends Dataset> T` | `copy(Class<T> clazz, IDataset d)` Copy and cast a dataset
    `static Dataset` | `copy(IDataset d, int dtype)` Copy and cast a dataset
    `static <T extends CompoundDataset> T` | `createCompoundDataset(Class<T> clazz, Dataset... datasets)` Create a compound dataset from given datasets
    `static CompoundDataset` | `createCompoundDataset(Dataset... datasets)` Create a compound dataset from given datasets
    `static CompoundDataset` | `createCompoundDataset(Dataset dataset, int itemSize)` Create a compound dataset from given dataset
    `static CompoundDataset` | `createCompoundDataset(int dtype, Dataset... datasets)` Create a compound dataset from given datasets
    `static CompoundDataset` | `createCompoundDatasetFromLastAxis(Dataset a, boolean shareData)` Create a compound dataset by using last axis as elements of an item
    `static Dataset` | `createDatasetFromCompoundDataset(CompoundDataset a, boolean shareData)` Create a dataset from a compound dataset by using elements of an item as last axis
    `static Object` | `createJavaArray(Dataset a)` Create Java array (of arrays) from dataset
    `static List<Double>` | `crossings(Dataset xAxis, Dataset yAxis, double yValue)` Find x values of all the crossing points of the dataset with the given y value
    `static List<Double>` | `crossings(Dataset xAxis, Dataset yAxis, double yValue, double xRangeProportion)` Function that uses the crossings function but prunes the result, so that multiple crossings within a certain proportion of the overall range of the x values
    `static List<Double>` | `crossings(Dataset d, double value)` Find linearly-interpolated crossing points where the given dataset crosses the given value
    `static <T extends Dataset> T` | `diag(T a, int offset)` Create a (off-)diagonal matrix from items in dataset
    `static Dataset` | `extract(IDataset data, IDataset condition)` Extract values where condition is non-zero.
    `static Dataset` | `eye(int rows, int cols, int offset, int dtype)`
    `static IntegerDataset` | `findFirstOccurrences(Dataset a, Dataset values)` Find first occurrences in one dataset of values given in another sorted dataset
    `static int` | `findIndexEqualTo(Dataset a, double n)` Find absolute index of first value in dataset that is equal to given number
    `static IntegerDataset` | `findIndexesForValues(Dataset a, Dataset values)` Find indexes in sorted dataset of values for each value in other dataset
    `static int` | `findIndexGreaterThan(Dataset a, double n)` Find absolute index of first value in dataset that is greater than given number
    `static int` | `findIndexGreaterThanOrEqualTo(Dataset a, double n)` Find absolute index of first value in dataset that is greater than or equal to given number
    `static int` | `findIndexLessThan(Dataset a, double n)` Find absolute index of first value in dataset that is less than given number
    `static int` | `findIndexLessThanOrEqualTo(Dataset a, double n)` Find absolute index of first value in dataset that is less than or equal to given number
    `static <T extends Dataset> T` | `flipLeftRight(T a)` Flip items in left/right direction, column-wise, or along second axis
    `static <T extends Dataset> T` | `flipUpDown(T a)` Flip items in up/down direction, row-wise, or along first axis
    `static IntegerDataset` | `indexSort(Dataset a, Integer axis)` Indirectly sort along given axis
    `static IntegerDataset` | `indices(int... shape)` Generate an index dataset for given dataset where sub-datasets contain index values
    `static Dataset` | `lnnorm(Dataset a)` Function that returns a normalised dataset which is bounded between 0 and 1 and has been distributed on a natural log scale
    `static Dataset` | `lognorm(Dataset a)` Function that returns a normalised dataset which is bounded between 0 and 1 and has been distributed on a log10 scale
    `static void` | `makeFinite(Dataset a)` Make floating point datasets contain only finite values.
    `static Dataset` | `makeUnsigned(IDataset a)` Make a dataset unsigned by promoting it to a wider dataset type and unwrapping the signs of its contents
    `static Dataset` | `makeUnsigned(IDataset a, boolean check)` Make a dataset unsigned by promoting it to a wider dataset type and unwrapping the signs of its contents
    `static List<Dataset>` | `meshGrid(Dataset... axes)` Construct a list of datasets where each represents a coordinate varying over the hypergrid formed by the input list of axes
    `static CompoundDataset` | `norm(CompoundDataset a, boolean overAllElements)` Function that returns a normalised compound dataset which is bounded between 0 and 1.
    `static Dataset` | `norm(Dataset a)` Function that returns a normalised dataset which is bounded between 0 and 1
    `static <T extends Dataset> T` | `put(T a, Dataset indices, Object values)` Changes specific items of dataset by replacing them with other array
    `static <T extends Dataset> T` | `put(T a, int[] indices, Object values)` Changes specific items of dataset by replacing them with other array
    `static void` | `removeNansAndInfinities(Dataset a, Number value)` Removes NaNs and infinities from floating point datasets.
    `static <T extends Dataset> T` | `repeat(T a, int[] repeats, int axis)` Constructs a dataset which has its elements along an axis replicated from the original dataset by the number of times given in the repeats array.
    `static <T extends Dataset> T` | `resize(T a, int... shape)` Resize a dataset
    `static <T extends Dataset> T` | `roll(T a, int shift, Integer axis)` Roll items over given axis by given amount
    `static <T extends Dataset> T` | `rollAxis(T a, int axis, int start)` Roll the specified axis backwards until it lies in given position
    `static <T extends Dataset> T` | `rotate90(T a)` Rotate items in first two dimension by 90 degrees anti-clockwise
    `static <T extends Dataset> T` | `rotate90(T a, int k)` Rotate items in first two dimension by 90 degrees anti-clockwise
    `static Dataset` | `select(BooleanDataset[] conditions, Object[] choices, Object def)` Select content from choices where condition is true, otherwise use default.
    `static Dataset` | `select(BooleanDataset condition, Object x, Object y)` Select content according where condition is true.
    `static Serializable` | `serializeDataset(IDataset data)` Serialize dataset by flattening it.
    `static Dataset` | `sliceAndConvertLazyDataset(ILazyDataset lazy)` Slice (or fully load), if necessary, a lazy dataset, otherwise take a slice view and convert to our dataset implementation.
    `static void` | `sort(Dataset a, Dataset... b)` Sort in place given dataset and reorder ancillary datasets too
    `static <T extends Dataset> T` | `sort(T a)`
    `static <T extends Dataset> T` | `sort(T a, Integer axis)`
    `static List<Dataset>` | `split(Dataset a, int[] indices, int axis)` Split a dataset into parts along given axis
    `static List<Dataset>` | `split(Dataset a, int sections, int axis, boolean checkEqual)` Split a dataset into equal sections along given axis
    `static Dataset` | `swapAxes(IDataset a, int axis1, int axis2)` Swap two axes in dataset
    `static <T extends Dataset> T` | `take(T a, Dataset indices, Integer axis)` Take items from dataset along an axis
    `static <T extends Dataset> T` | `take(T a, int[] indices, Integer axis)` Take items from dataset along an axis
    `static Dataset` | `tile(IDataset a, int... reps)` Construct a dataset that contains the original dataset repeated the number of times in each axis given by corresponding entries in the reps array
    `static Dataset` | `transpose(IDataset a, int... axes)` Permute copy of dataset's axes so that given order is old order:
    `static void` | `unwrapUnsigned(Dataset a, int bitWidth)` Unwrap dataset elements so that all elements are unsigned

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

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

- - ### Field Detail

    - #### utilsLogger

          protected static final transient org.slf4j.Logger utilsLogger

      Setup the logging facilities

  - ### Constructor Detail

    - #### DatasetUtils

          public DatasetUtils()

  - ### Method Detail

    - #### append

          public static Dataset append(IDataset a,
                       IDataset b,
                       int axis)

      Append copy of dataset with another dataset along n-th axis
      Parameters:
        `a` -
        `b` -
        `axis` - number of axis (negative number counts from last)
      Returns:
        appended dataset

    - #### put

          public static <T extends Dataset> T put(T a,
                                  Dataset indices,
                                  Object values)

      Changes specific items of dataset by replacing them with other array
      Parameters:
        `a` -
        `indices` - dataset interpreted as integers
        `values` -
      Returns:
        changed dataset

    - #### put

          public static <T extends Dataset> T put(T a,
                                  int[] indices,
                                  Object values)

      Changes specific items of dataset by replacing them with other array
      Parameters:
        `a` -
        `indices` -
        `values` -
      Returns:
        changed dataset

    - #### take

          public static <T extends Dataset> T take(T a,
                                   Dataset indices,
                                   Integer axis)

      Take items from dataset along an axis
      Parameters:
        `indices` - dataset interpreted as integers
        `axis` - if null, then use flattened view
      Returns:
        a sub-array

    - #### take

          public static <T extends Dataset> T take(T a,
                                   int[] indices,
                                   Integer axis)

      Take items from dataset along an axis
      Parameters:
        `indices` -
        `axis` - if null, then use flattened view
      Returns:
        a sub-array

    - #### tile

          public static Dataset tile(IDataset a,
                     int... reps)

      Construct a dataset that contains the original dataset repeated the number of times in each axis given by corresponding entries in the reps array
      Parameters:
        `a` -
        `reps` -
      Returns:
        tiled dataset

    - #### transpose

          public static Dataset transpose(IDataset a,
                          int... axes)

      Permute copy of dataset's axes so that given order is old order:

            axisPerm = (p(0), p(1),...) => newdata(n(0), n(1),...) = olddata(o(0), o(1), ...)
            such that n(i) = o(p(i)) for all i

      I.e. for a 3D dataset (1,0,2) implies the new dataset has its 1st dimension running along the old dataset's 2nd dimension and the new 2nd is the old 1st. The 3rd dimension is left unchanged.
      Parameters:
        `a` -
        `axes` - if null or zero length then axes order reversed
      Returns:
        remapped copy of data

    - #### swapAxes

          public static Dataset swapAxes(IDataset a,
                         int axis1,
                         int axis2)

      Swap two axes in dataset
      Parameters:
        `a` -
        `axis1` -
        `axis2` -
      Returns:
        swapped dataset

    - #### sort

          public static <T extends Dataset> T sort(T a)

      Parameters:
        `a` -
      Returns:
        sorted flattened copy of dataset

    - #### sort

          public static <T extends Dataset> T sort(T a,
                                   Integer axis)

      Parameters:
        `a` -
        `axis` - to sort along, if null then dataset is first flattened
      Returns:
        dataset sorted along axis

    - #### sort

          public static void sort(Dataset a,
                  Dataset... b)

      Sort in place given dataset and reorder ancillary datasets too
      Parameters:
        `a` - dataset to be sorted
        `b` - ancillary datasets

    - #### indexSort

          public static IntegerDataset indexSort(Dataset a,
                                 Integer axis)

      Indirectly sort along given axis
      Parameters:
        `a` - dataset whose indexes will be sorted
        `axis` - to sort along, if null then dataset is first flattened
      Returns:
        indexes
      Since:
        2.1

    - #### concatenate

          public static Dataset concatenate(IDataset[] as,
                            int axis)

      Concatenate the set of datasets along given axis
      Parameters:
        `as` -
        `axis` -
      Returns:
        concatenated dataset

    - #### split

          public static List<Dataset> split(Dataset a,
                            int sections,
                            int axis,
                            boolean checkEqual)

      Split a dataset into equal sections along given axis
      Parameters:
        `a` -
        `sections` -
        `axis` -
        `checkEqual` - makes sure the division is into equal parts
      Returns:
        list of split datasets

    - #### split

          public static List<Dataset> split(Dataset a,
                            int[] indices,
                            int axis)

      Split a dataset into parts along given axis
      Parameters:
        `a` -
        `indices` -
        `axis` -
      Returns:
        list of split datasets

    - #### repeat

          public static <T extends Dataset> T repeat(T a,
                                     int[] repeats,
                                     int axis)

      Constructs a dataset which has its elements along an axis replicated from the original dataset by the number of times given in the repeats array. By default, axis=-1 implies using a flattened version of the input dataset
      Parameters:
        `a` -
        `repeats` -
        `axis` -
      Returns:
        dataset

    - #### resize

          public static <T extends Dataset> T resize(T a,
                                     int... shape)

      Resize a dataset
      Parameters:
        `a` -
        `shape` -
      Returns:
        new dataset with new shape and items that are truncated or repeated, as necessary

    - #### copy

          public static Dataset copy(IDataset d,
                     int dtype)

      Copy and cast a dataset
      Parameters:
        `d` - The dataset to be copied
        `dtype` - dataset type
      Returns:
        copied dataset of given type

    - #### copy

          public static <T extends Dataset> T copy(Class<T> clazz,
                                   IDataset d)

      Copy and cast a dataset
      Parameters:
        `clazz` - dataset class
        `d` - The dataset to be copied
      Returns:
        copied dataset of given type

    - #### cast

          public static Dataset cast(IDataset d,
                     int dtype)

      Cast a dataset
      Parameters:
        `d` - The dataset to be cast.
        `dtype` - dataset type
      Returns:
        dataset of given type (or same dataset if already of the right type)

    - #### cast

          public static <T extends Dataset> T cast(Class<T> clazz,
                                   IDataset d)

      Cast a dataset
      Parameters:
        `clazz` - dataset class
        `d` - The dataset to be cast.
      Returns:
        dataset of given type (or same dataset if already of the right type)

    - #### cast

          public static Dataset cast(IDataset d,
                     boolean repeat,
                     int dtype,
                     int isize)

      Cast a dataset
      Parameters:
        `d` - The dataset to be cast.
        `repeat` - repeat elements over item
        `dtype` - dataset type
        `isize` - item size

    - #### cast

          public static CompoundDataset cast(Dataset[] a,
                             int dtype)

      Cast array of datasets to a compound dataset
      Parameters:
        `a` - The datasets to be cast.

    - #### makeUnsigned

          public static Dataset makeUnsigned(IDataset a)

      Make a dataset unsigned by promoting it to a wider dataset type and unwrapping the signs of its contents
      Parameters:
        `a` -
      Returns:
        unsigned dataset or original if it is not an integer dataset

    - #### makeUnsigned

          public static Dataset makeUnsigned(IDataset a,
                             boolean check)

      Make a dataset unsigned by promoting it to a wider dataset type and unwrapping the signs of its contents
      Parameters:
        `a` -
        `check` - if true, then check for negative values
      Returns:
        unsigned dataset or original if it is not an integer dataset or it has been check for negative numbers
      Since:
        2.1

    - #### unwrapUnsigned

          public static void unwrapUnsigned(Dataset a,
                            int bitWidth)

      Unwrap dataset elements so that all elements are unsigned
      Parameters:
        `a` - dataset
        `bitWidth` - width of original primitive in bits

    - #### eye

          public static Dataset eye(int rows,
                    int cols,
                    int offset,
                    int dtype)

      Parameters:
        `rows` -
        `cols` -
        `offset` -
        `dtype` -
      Returns:
        a new 2d dataset of given shape and type, filled with ones on the (offset) diagonal

    - #### diag

          public static <T extends Dataset> T diag(T a,
                                   int offset)

      Create a (off-)diagonal matrix from items in dataset
      Parameters:
        `a` -
        `offset` -
      Returns:
        diagonal matrix

    - #### sliceAndConvertLazyDataset

          public static Dataset sliceAndConvertLazyDataset(ILazyDataset lazy)
                                                    throws DatasetException

      Slice (or fully load), if necessary, a lazy dataset, otherwise take a slice view and convert to our dataset implementation. If a slice is necessary, this may cause resource problems when used on large datasets and throw runtime exceptions
      Parameters:
        `lazy` - can be null
      Returns:
        Converted dataset or null
      Throws:
        `DatasetException`

    - #### convertToDataset

          public static Dataset convertToDataset(IDataset data)

      Convert (if necessary) a dataset obeying the interface to our implementation
      Parameters:
        `data` - can be null
      Returns:
        Converted dataset or null

    - #### createCompoundDataset

          public static CompoundDataset createCompoundDataset(Dataset... datasets)

      Create a compound dataset from given datasets
      Parameters:
        `datasets` -
      Returns:
        compound dataset or null if none given

    - #### createCompoundDataset

          public static CompoundDataset createCompoundDataset(int dtype,
                                              Dataset... datasets)

      Create a compound dataset from given datasets
      Parameters:
        `dtype` -
        `datasets` -
      Returns:
        compound dataset or null if none given

    - #### createCompoundDataset

          public static <T extends CompoundDataset> T createCompoundDataset(Class<T> clazz,
                                                            Dataset... datasets)

      Create a compound dataset from given datasets
      Parameters:
        `clazz` - dataset class
        `datasets` -
      Returns:
        compound dataset or null if none given

    - #### createCompoundDataset

          public static CompoundDataset createCompoundDataset(Dataset dataset,
                                              int itemSize)

      Create a compound dataset from given dataset
      Parameters:
        `dataset` -
        `itemSize` -
      Returns:
        compound dataset

    - #### createCompoundDatasetFromLastAxis

          public static CompoundDataset createCompoundDatasetFromLastAxis(Dataset a,
                                                          boolean shareData)

      Create a compound dataset by using last axis as elements of an item
      Parameters:
        `a` -
        `shareData` - if true, then share data
      Returns:
        compound dataset

    - #### createDatasetFromCompoundDataset

          public static Dataset createDatasetFromCompoundDataset(CompoundDataset a,
                                                 boolean shareData)

      Create a dataset from a compound dataset by using elements of an item as last axis

      In the case where the number of elements is one, the last axis is squeezed out.

      Parameters:
        `a` -
        `shareData` - if true, then share data
      Returns:
        non-compound dataset

    - #### coerce

          public static Dataset coerce(Dataset a,
                       Object obj)

      Create a copy that has been coerced to an appropriate dataset type depending on the input object's class
      Parameters:
        `a` -
        `obj` -
      Returns:
        coerced copy of dataset

    - #### norm

          public static Dataset norm(Dataset a)

      Function that returns a normalised dataset which is bounded between 0 and 1
      Parameters:
        `a` - dataset
      Returns:
        normalised dataset

    - #### norm

          public static CompoundDataset norm(CompoundDataset a,
                             boolean overAllElements)

      Function that returns a normalised compound dataset which is bounded between 0 and 1. There are (at least) two ways to normalise a compound dataset: per element - extrema for each element in a compound item is used, i.e. many min/max pairs; over all elements - extrema for all elements is used, i.e. one min/max pair.
      Parameters:
        `a` - dataset
        `overAllElements` - if true, then normalise over all elements in each item
      Returns:
        normalised dataset

    - #### lognorm

          public static Dataset lognorm(Dataset a)

      Function that returns a normalised dataset which is bounded between 0 and 1 and has been distributed on a log10 scale
      Parameters:
        `a` - dataset
      Returns:
        normalised dataset

    - #### lnnorm

          public static Dataset lnnorm(Dataset a)

      Function that returns a normalised dataset which is bounded between 0 and 1 and has been distributed on a natural log scale
      Parameters:
        `a` - dataset
      Returns:
        normalised dataset

    - #### meshGrid

          public static List<Dataset> meshGrid(Dataset... axes)

      Construct a list of datasets where each represents a coordinate varying over the hypergrid formed by the input list of axes
      Parameters:
        `axes` - an array of 1D datasets representing axes
      Returns:
        a list of coordinate datasets

    - #### indices

          public static IntegerDataset indices(int... shape)

      Generate an index dataset for given dataset where sub-datasets contain index values
      Returns:
        an index dataset

    - #### centroid

          public static double[] centroid(Dataset a,
                          Dataset... bases)

      Get the centroid value of a dataset, this function works out the centroid in every direction
      Parameters:
        `a` - the dataset to be analysed
        `bases` - the optional array of base coordinates to use as weights. This defaults to the mid-point of indices
      Returns:
        a double array containing the centroid for each dimension

    - #### crossings

          public static List<Double> crossings(Dataset d,
                               double value)

      Find linearly-interpolated crossing points where the given dataset crosses the given value
      Parameters:
        `d` -
        `value` -
      Returns:
        list of interpolated indices

    - #### crossings

          public static List<Double> crossings(Dataset xAxis,
                               Dataset yAxis,
                               double yValue)

      Find x values of all the crossing points of the dataset with the given y value
      Parameters:
        `xAxis` - Dataset of the X axis that needs to be looked at
        `yAxis` - Dataset of the Y axis that needs to be looked at
        `yValue` - The y value the X values are required for
      Returns:
        An list of doubles containing all the X coordinates of where the line crosses

    - #### crossings

          public static List<Double> crossings(Dataset xAxis,
                               Dataset yAxis,
                               double yValue,
                               double xRangeProportion)

      Function that uses the crossings function but prunes the result, so that multiple crossings within a certain proportion of the overall range of the x values
      Parameters:
        `xAxis` - Dataset of the X axis
        `yAxis` - Dataset of the Y axis
        `yValue` - The y value the x values are required for
        `xRangeProportion` - The proportion of the overall x spread used to prune result
      Returns:
        A list containing all the unique crossing points

    - #### createJavaArray

          public static Object createJavaArray(Dataset a)

      Create Java array (of arrays) from dataset
      Parameters:
        `a` - dataset
      Returns:
        Java array (of arrays...)

    - #### removeNansAndInfinities

          public static void removeNansAndInfinities(Dataset a,
                                     Number value)

      Removes NaNs and infinities from floating point datasets. All other dataset types are ignored.
      Parameters:
        `a` - dataset
        `value` - replacement value

    - #### makeFinite

          public static void makeFinite(Dataset a)

      Make floating point datasets contain only finite values. Infinities and NaNs are replaced by +/- MAX_VALUE and 0, respectively. All other dataset types are ignored.
      Parameters:
        `a` - dataset

    - #### findIndexEqualTo

          public static int findIndexEqualTo(Dataset a,
                             double n)

      Find absolute index of first value in dataset that is equal to given number
      Parameters:
        `a` -
        `n` -
      Returns:
        absolute index (if greater than a.getSize() then no value found)

    - #### findIndexGreaterThan

          public static int findIndexGreaterThan(Dataset a,
                                 double n)

      Find absolute index of first value in dataset that is greater than given number
      Parameters:
        `a` -
        `n` -
      Returns:
        absolute index (if greater than a.getSize() then no value found)

    - #### findIndexGreaterThanOrEqualTo

          public static int findIndexGreaterThanOrEqualTo(Dataset a,
                                          double n)

      Find absolute index of first value in dataset that is greater than or equal to given number
      Parameters:
        `a` -
        `n` -
      Returns:
        absolute index (if greater than a.getSize() then no value found)

    - #### findIndexLessThan

          public static int findIndexLessThan(Dataset a,
                              double n)

      Find absolute index of first value in dataset that is less than given number
      Parameters:
        `a` -
        `n` -
      Returns:
        absolute index (if greater than a.getSize() then no value found)

    - #### findIndexLessThanOrEqualTo

          public static int findIndexLessThanOrEqualTo(Dataset a,
                                       double n)

      Find absolute index of first value in dataset that is less than or equal to given number
      Parameters:
        `a` -
        `n` -
      Returns:
        absolute index (if greater than a.getSize() then no value found)

    - #### findFirstOccurrences

          public static IntegerDataset findFirstOccurrences(Dataset a,
                                            Dataset values)

      Find first occurrences in one dataset of values given in another sorted dataset
      Parameters:
        `a` -
        `values` - sorted 1D dataset of values to find
      Returns:
        absolute indexes of those first occurrences (-1 is used to indicate value not found)

    - #### findIndexesForValues

          public static IntegerDataset findIndexesForValues(Dataset a,
                                            Dataset values)

      Find indexes in sorted dataset of values for each value in other dataset
      Parameters:
        `a` -
        `values` - sorted 1D dataset of values to find
      Returns:
        absolute indexes of values (-1 is used to indicate value not found)

    - #### roll

          public static <T extends Dataset> T roll(T a,
                                   int shift,
                                   Integer axis)

      Roll items over given axis by given amount
      Parameters:
        `a` -
        `shift` -
        `axis` - if null, then roll flattened dataset
      Returns:
        rolled dataset

    - #### rollAxis

          public static <T extends Dataset> T rollAxis(T a,
                                       int axis,
                                       int start)

      Roll the specified axis backwards until it lies in given position
      Parameters:
        `a` -
        `axis` - The rolled axis (index in shape array). Other axes are left unchanged in relative positions
        `start` - The position with it right of the destination of the rolled axis
      Returns:
        dataset with rolled axis

    - #### flipLeftRight

          public static <T extends Dataset> T flipLeftRight(T a)

      Flip items in left/right direction, column-wise, or along second axis
      Parameters:
        `a` - dataset must be at least 2D
      Returns:
        view of flipped dataset

    - #### flipUpDown

          public static <T extends Dataset> T flipUpDown(T a)

      Flip items in up/down direction, row-wise, or along first axis
      Parameters:
        `a` - dataset
      Returns:
        view of flipped dataset

    - #### rotate90

          public static <T extends Dataset> T rotate90(T a)

      Rotate items in first two dimension by 90 degrees anti-clockwise
      Parameters:
        `a` - dataset must be at least 2D
      Returns:
        view of flipped dataset

    - #### rotate90

          public static <T extends Dataset> T rotate90(T a,
                                       int k)

      Rotate items in first two dimension by 90 degrees anti-clockwise
      Parameters:
        `a` - dataset must be at least 2D
        `k` - number of 90-degree rotations
      Returns:
        view of flipped dataset

    - #### select

          public static Dataset select(BooleanDataset condition,
                       Object x,
                       Object y)

      Select content according where condition is true. All inputs are broadcasted to a maximum shape
      Parameters:
        `condition` - boolean dataset
        `x` -
        `y` -
      Returns:
        dataset where content is x or y depending on whether condition is true or otherwise

    - #### select

          public static Dataset select(BooleanDataset[] conditions,
                       Object[] choices,
                       Object def)

      Select content from choices where condition is true, otherwise use default. All inputs are broadcasted to a maximum shape
      Parameters:
        `conditions` - array of boolean datasets
        `choices` - array of datasets or objects
        `def` - default value (can be a dataset)
      Returns:
        dataset

    - #### choose

          public static Dataset choose(IntegerDataset index,
                       Object[] choices,
                       boolean throwAIOOBE,
                       boolean clip)

      Choose content from choices where condition is true, otherwise use default. All inputs are broadcasted to a maximum shape
      Parameters:
        `index` - integer dataset (ideally, items should be in [0, n) range, if there are n choices)
        `choices` - array of datasets or objects
        `throwAIOOBE` - if true, throw array index out of bound exception
        `clip` - true to clip else wrap indices out of bounds; only used when throwAOOBE is false
      Returns:
        dataset

    - #### calcPositionsFromIndexes

          public static List<IntegerDataset> calcPositionsFromIndexes(Dataset indices,
                                                      int[] shape)

      Calculate positions in given shape from a dataset of 1-D indexes
      Parameters:
        `indices` -
        `shape` -
      Returns:
        list of positions as integer datasets

    - #### calcIndexesFromPositions

          public static IntegerDataset calcIndexesFromPositions(List<? extends Dataset> positions,
                                                int[] shape,
                                                int... mode)

      Calculate indexes in given shape from datasets of position
      Parameters:
        `positions` - as a list of datasets where each holds the position in a dimension
        `shape` -
        `mode` - either null, zero-length, unit length or length of rank of shape where 0 = raise exception, 1 = wrap, 2 = clip
      Returns:
        indexes as an integer dataset

    - #### serializeDataset

          public static Serializable serializeDataset(IDataset data)

      Serialize dataset by flattening it. Discards metadata
      Parameters:
        `data` -
      Returns:
        some java array

    - #### extract

          public static Dataset extract(IDataset data,
                        IDataset condition)

      Extract values where condition is non-zero. This is similar to Dataset#getByBoolean but supports broadcasting
      Parameters:
        `data` -
        `condition` - should be broadcastable to data
      Returns:
        1-D dataset of values

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