org.eclipse.january.dataset

## Class DatasetUtils

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

-     public class DatasetUtils
      extends Object

  Utilities for manipulating datasets

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `DatasetUtils()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated 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 CompoundDataset` | `cast(Class<? extends Dataset> clazz, Dataset... a)` Cast array of datasets to a compound dataset
    `static <T extends Dataset> T` | `cast(Class<T> clazz, IDataset d)` Cast a dataset
    `static CompoundDataset` | `cast(Dataset[] a, int dtype)` Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, Dataset...)`
    `static Dataset` | `cast(IDataset d, boolean repeat, int dtype, int isize)` Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, IDataset)`
    `static Dataset` | `cast(IDataset d, int dtype)` Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, IDataset)`
    `static <T extends Dataset> T` | `cast(int isize, Class<T> clazz, IDataset d, boolean repeat)` 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 <T extends CompoundDataset> T` | `compoundCast(Class<T> clazz, Dataset... a)` Cast array of datasets to a compound dataset
    `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)` Cast a dataset
    `static Dataset` | `copy(IDataset d, int dtype)` Deprecated. Please use the class-based methods in DatasetUtils, such as `copy(Class, IDataset)`
    `static <T extends CompoundDataset> T` | `createCompoundDataset(Class<T> clazz, Dataset... datasets)` Create a compound dataset from copying 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, sharing data
    `static CompoundDataset` | `createCompoundDataset(int dtype, Dataset... datasets)` Deprecated. Please use the class-based methods in DatasetUtils, such as `createCompoundDataset(Class, Dataset...)`
    `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 <T extends Dataset> T` | `eye(Class<T> clazz, int rows, int cols, int offset)`
    `static Dataset` | `eye(int rows, int cols, int offset, int dtype)` Deprecated. Please use the class-based methods in DatasetUtils, such as `eye(Class, int, int, int)`
    `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 shape 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 void` | `setShapeToOriginalRank(ILazyDataset a, int[] originalShape, int... axes)` Set shape to keep original rank
    `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`

- - ### 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` - first dataset
        `b` - second dataset
        `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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `indices` - dataset interpreted as integers where to put items
        `values` - to set
      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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `indices` - where to put items
        `values` - to set
      Returns:
        changed dataset

    - #### take

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

      Take items from dataset along an axis
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `indices` - dataset interpreted as integers where to take items
        `axis` - if null, then use flattened view
      Returns:
        a sub-dataset

    - #### take

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

      Take items from dataset along an axis
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `indices` - where to take items
        `axis` - if null, then use flattened view
      Returns:
        a sub-dataset

    - #### 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` - dataset
        `reps` - repetitions in each dimension
      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` - dataset
        `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` - dataset
        `axis1` - first axis
        `axis2` - second axis
      Returns:
        swapped dataset

    - #### sort

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

      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
      Returns:
        sorted flattened copy of dataset

    - #### sort

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

      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `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` - datasets
        `axis` - to concatenate along
      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` - dataset
        `sections` - number of sections
        `axis` - to split along
        `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` - dataset
        `indices` - where to split
        `axis` - to split along
      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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `repeats` - number of repetitions
        `axis` - to repeat
      Returns:
        dataset

    - #### resize

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

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

    - #### copy

          @Deprecated
          public static Dataset copy(IDataset d,
                                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetUtils, such as `copy(Class, IDataset)`
      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)

      Cast a dataset
      Type Parameters:
        `T` - dataset sub-interface
      Parameters:
        `clazz` - dataset sub-interface
        `d` - The dataset to be copied
      Returns:
        dataset of given class (or same dataset if already of the right class)

    - #### cast

          @Deprecated
          public static Dataset cast(IDataset d,
                                                 int dtype)

      Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, IDataset)`
      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
      Type Parameters:
        `T` - dataset sub-interface
      Parameters:
        `clazz` - dataset sub-interface
        `d` - The dataset to be cast
      Returns:
        dataset of given class

    - #### cast

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

      Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, IDataset)`
      Cast a dataset
      Parameters:
        `d` - The dataset to be cast
        `repeat` - repeat elements over item
        `dtype` - dataset type
        `isize` - item size
      Returns:
        dataset of given type

    - #### cast

          public static <T extends Dataset> T cast(int isize,
                                                   Class<T> clazz,
                                                   IDataset d,
                                                   boolean repeat)

      Cast a dataset
      Type Parameters:
        `T` - dataset sub-interface
      Parameters:
        `isize` - item size
        `clazz` - dataset sub-interface
        `d` - The dataset to be cast.
        `repeat` - repeat elements over item
      Returns:
        dataset of given class
      Since:
        2.3

    - #### compoundCast

          public static <T extends CompoundDataset> T compoundCast(Class<T> clazz,
                                                                   Dataset... a)

      Cast array of datasets to a compound dataset
      Type Parameters:
        `T` - compound dataset sub-interface
      Parameters:
        `clazz` - compound dataset sub-interface
        `a` - The datasets to be cast.
      Returns:
        dataset of given class
      Since:
        2.3

    - #### cast

          public static CompoundDataset cast(Class<? extends Dataset> clazz,
                                             Dataset... a)

      Cast array of datasets to a compound dataset
      Parameters:
        `clazz` - dataset class
        `a` - The datasets to be cast.
      Returns:
        compound dataset of given class
      Since:
        2.3

    - #### cast

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

      Deprecated. Please use the class-based methods in DatasetUtils, such as `cast(Class, Dataset...)`
      Cast array of datasets to a compound dataset
      Parameters:
        `a` - The datasets to be cast.
        `dtype` - dataset type
      Returns:
        compound dataset of given type

    - #### 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` - dataset
      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` - dataset
        `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 <T extends Dataset> T eye(Class<T> clazz,
                                                  int rows,
                                                  int cols,
                                                  int offset)

      Type Parameters:
        `T` - dataset sub-interface
      Parameters:
        `clazz` - dataset sub-interface
        `rows` - number of rows
        `cols` - number of columns
        `offset` - row offset
      Returns:
        a new 2d dataset of given shape and class, filled with ones on the (offset) diagonal
      Since:
        2.3

    - #### eye

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

      Deprecated. Please use the class-based methods in DatasetUtils, such as `eye(Class, int, int, int)`
      Parameters:
        `rows` - number of rows
        `cols` - number of columns
        `offset` - row offset
        `dtype` - dataset type
      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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `offset` - distance right of diagonal
      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` - when cannot retrieve data

    - #### 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` - inputs
      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 copying given datasets
      Type Parameters:
        `T` - compound dataset sub-interface
      Parameters:
        `clazz` - compound dataset sub-interface
        `datasets` - inputs
      Returns:
        compound dataset or null if none given

    - #### createCompoundDataset

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

      Deprecated. Please use the class-based methods in DatasetUtils, such as `createCompoundDataset(Class, Dataset...)`
      Create a compound dataset from given datasets
      Parameters:
        `dtype` - dataset type
        `datasets` - for each element
      Returns:
        compound dataset or null if none given

    - #### createCompoundDataset

          public static CompoundDataset createCompoundDataset(Dataset dataset,
                                                              int itemSize)

      Create a compound dataset from given dataset, sharing data
      Parameters:
        `dataset` - input
        `itemSize` - item size
      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` - dataset
        `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` - dataset
        `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` - dataset
        `obj` - input object
      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 shape where sub-datasets contain index values
      Parameters:
        `shape` - for indexing
      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` - dataset
        `value` - crossing 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` - dataset
        `n` - value
      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` - dataset
        `n` - value
      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` - dataset
        `n` - value
      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` - dataset
        `n` - value
      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` - dataset
        `n` - value
      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` - dataset
        `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` - dataset
        `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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `shift` - amount to 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
      Type Parameters:
        `T` - dataset class
      Parameters:
        `a` - dataset
        `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
      Type Parameters:
        `T` - dataset class
      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
      Type Parameters:
        `T` - dataset class
      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
      Type Parameters:
        `T` - dataset class
      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
      Type Parameters:
        `T` - dataset class
      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` - first input
        `y` - second input
      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` - dataset values taken as integers for index
        `shape` - dataset 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` - dataset 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` - dataset
      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` - dataset
        `condition` - should be broadcastable to data
      Returns:
        1-D dataset of values

    - #### setShapeToOriginalRank

          public static void setShapeToOriginalRank(ILazyDataset a,
                                                    int[] originalShape,
                                                    int... axes)

      Set shape to keep original rank
      Parameters:
        `a` - dataset
        `originalShape` - original shape
        `axes` - dimensions in original shape to set to 1
      Since:
        2.2

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