org.eclipse.january.dataset

## Class Maths

- java.lang.Object
- - org.eclipse.january.dataset.internal.GeneratedMaths
  - - org.eclipse.january.dataset.Maths

-     public class Maths
      extends org.eclipse.january.dataset.internal.GeneratedMaths

  Mathematics class

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `Maths()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static Dataset` | `abs(Object a)` abs - absolute value of each element
    `static Dataset` | `abs(Object a, Dataset o)` abs - absolute value of each element
    `static Dataset` | `add(Collection<IDataset> sets, boolean requireClone)` Adds all sets passed in together The first IDataset must cast to Dataset For memory efficiency sake if add(...) is called with a set of size one, no clone is done, the original object is returned directly.
    `static Dataset` | `angle(Object a)` Create a dataset of the arguments from a complex dataset
    `static Dataset` | `angle(Object a, boolean inDegrees)` Create a dataset of the arguments from a complex dataset
    `static Dataset` | `angle(Object a, boolean inDegrees, Dataset o)` Create a dataset of the arguments from a complex dataset
    `static Dataset` | `angle(Object a, Dataset o)` Create a dataset of the arguments from a complex dataset
    `static Dataset` | `arctan2(Object a, Object b)`
    `static Dataset` | `arctan2(Object a, Object b, Dataset o)`
    `static Dataset` | `centralDifference(Dataset a, int axis)` Discrete difference of dataset along axis using finite central difference
    `static Dataset` | `conjugate(Object a)`
    `static Dataset` | `conjugate(Object a, Dataset o)`
    `static Dataset` | `derivative(Dataset x, Dataset y, int n)` Calculates the derivative of a line described by two datasets (x,y) given a spread of n either side of the point
    `static Dataset` | `difference(Dataset a, int n, int axis)` Discrete difference of dataset along axis using finite difference
    `static Dataset` | `floorDivide(Object a, Object b)`
    `static Dataset` | `floorDivide(Object a, Object b, Dataset o)`
    `static Dataset` | `floorRemainder(Object a, Object b)`
    `static Dataset` | `floorRemainder(Object a, Object b, Dataset o)`
    `static void` | `getBilinear(double[] values, CompoundDataset d, double x0, double x1)` Deprecated. Use `interpolate(double[], CompoundDataset, double, double)`
    `static double` | `getBilinear(IDataset d, double x0, double x1)` Deprecated. Use `interpolate(Dataset, double, double)`
    `static double` | `getBilinear(IDataset d, IDataset m, double x0, double x1)` Deprecated. Use `interpolate(Dataset, Dataset, double, double)`
    `static void` | `getLinear(double[] values, CompoundDataset d, double x0)` Deprecated. Use `interpolate(double[], CompoundDataset, double)`
    `static double` | `getLinear(IDataset d, double x0)` Deprecated. Use `interpolate(Dataset, double)`
    `static List<Dataset>` | `gradient(Dataset y, Dataset... x)` Calculate gradient (or partial derivatives) by central difference
    `static Dataset` | `hypot(Object a, Object b)`
    `static Dataset` | `hypot(Object a, Object b, Dataset o)`
    `static double` | `interpolate(Dataset d, Dataset m, double... x)` Linearly interpolate a value at a point in a n-D dataset with a mask.
    `static double` | `interpolate(Dataset d, Dataset m, double x0)` Linearly interpolate a value at a point in a 1D dataset with a mask.
    `static double` | `interpolate(Dataset d, Dataset m, double x0, double x1)` Linearly interpolate a value at a point in a 2D dataset with a mask.
    `static Dataset` | `interpolate(Dataset x, Dataset d, IDataset x0, Number left, Number right)` Linearly interpolate values at points in a 1D dataset corresponding to given coordinates.
    `static double` | `interpolate(Dataset d, double... x)` Linearly interpolate a value at a point in a n-D dataset.
    `static double` | `interpolate(Dataset d, double x0)` Linearly interpolate a value at a point in a 1D dataset.
    `static double` | `interpolate(Dataset d, double x0, double x1)` Linearly interpolate a value at a point in a 2D dataset.
    `static void` | `interpolate(double[] values, CompoundDataset d, double... x)` Linearly interpolate an array of values at a point in a compound n-D dataset.
    `static void` | `interpolate(double[] values, CompoundDataset d, double x0)` Linearly interpolate an array of values at a point in a compound 1D dataset.
    `static void` | `interpolate(double[] values, CompoundDataset d, double x0, double x1)` Linearly interpolate an array of values at a point in a compound 2D dataset.
    `static Dataset` | `multiply(Collection<IDataset> sets, boolean requireClone)` Multiplies all sets passed in together The first IDataset must cast to Dataset
    `static Dataset` | `phaseAsComplexNumber(Object a, boolean keepZeros)` Create a phase only dataset.
    `static Dataset` | `phaseAsComplexNumber(Object a, Dataset o, boolean keepZeros)` Create a phase only dataset.
    `static Dataset` | `reciprocal(Object a)` Find reciprocal from dataset
    `static Dataset` | `reciprocal(Object a, Dataset o)` Find reciprocal from dataset
    `static Object` | `unwrap(Dataset o, Object... a)` Unwrap result from mathematical methods if necessary
    `static Object` | `unwrap(Dataset o, Object a)` Unwrap result from mathematical methods if necessary
    `static Object` | `unwrap(Dataset o, Object a, Object b)` Unwrap result from mathematical methods if necessary

    - ### Methods inherited from class org.eclipse.january.dataset.internal.GeneratedMaths

      `add, add, addBinaryOperatorName, addFunctionName, addFunctionName, arccos, arccos, arccosh, arccosh, arcsin, arcsin, arcsinh, arcsinh, arctan, arctan, arctanh, arctanh, bitwiseAnd, bitwiseAnd, bitwiseInvert, bitwiseInvert, bitwiseOr, bitwiseOr, bitwiseXor, bitwiseXor, cbrt, cbrt, ceil, ceil, clip, clip, cos, cos, cosh, cosh, divide, divide, divideTowardsFloor, divideTowardsFloor, dividez, dividez, exp, exp, expm1, expm1, floor, floor, leftShift, leftShift, log, log, log10, log10, log1p, log1p, log2, log2, maximum, maximum, minimum, minimum, multiply, multiply, negative, negative, power, power, remainder, remainder, rightShift, rightShift, rint, rint, signum, signum, sin, sin, sinh, sinh, sqrt, sqrt, square, square, subtract, subtract, tan, tan, tanh, tanh, toDegrees, toDegrees, toLong, toRadians, toRadians, truncate, truncate, unsignedRightShift, unsignedRightShift`

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

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

- - ### Constructor Detail

    - #### Maths

          public Maths()

  - ### Method Detail

    - #### unwrap

          public static Object unwrap(Dataset o,
                      Object a)

      Unwrap result from mathematical methods if necessary
      Parameters:
        `o` -
        `a` -
      Returns:
        a dataset if a is a dataset or an object of the same class as o

    - #### unwrap

          public static Object unwrap(Dataset o,
                      Object a,
                      Object b)

      Unwrap result from mathematical methods if necessary
      Parameters:
        `o` -
        `a` -
      Returns:
        a dataset if either a and b are datasets or an object of the same class as o

    - #### unwrap

          public static Object unwrap(Dataset o,
                      Object... a)

      Unwrap result from mathematical methods if necessary
      Parameters:
        `o` -
        `a` -
      Returns:
        a dataset if any inputs are datasets or an object of the same class as o

    - #### floorDivide

          public static Dataset floorDivide(Object a,
                            Object b)

      Parameters:
        `a` -
        `b` -
      Returns:
        floor divide of a and b

    - #### floorDivide

          public static Dataset floorDivide(Object a,
                            Object b,
                            Dataset o)

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        floor divide of a and b

    - #### floorRemainder

          public static Dataset floorRemainder(Object a,
                               Object b)

      Parameters:
        `a` -
        `b` -
      Returns:
        floor remainder of a and b

    - #### floorRemainder

          public static Dataset floorRemainder(Object a,
                               Object b,
                               Dataset o)

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        floor remainder of a and b

    - #### reciprocal

          public static Dataset reciprocal(Object a)

      Find reciprocal from dataset
      Parameters:
        `a` -
      Returns:
        reciprocal dataset

    - #### reciprocal

          public static Dataset reciprocal(Object a,
                           Dataset o)

      Find reciprocal from dataset
      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        reciprocal dataset

    - #### abs

          public static Dataset abs(Object a)

      abs - absolute value of each element
      Parameters:
        `a` -
      Returns:
        dataset

    - #### abs

          public static Dataset abs(Object a,
                    Dataset o)

      abs - absolute value of each element
      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset

    - #### conjugate

          public static Dataset conjugate(Object a)

      Parameters:
        `a` -
      Returns:
        a^*, complex conjugate of a

    - #### conjugate

          public static Dataset conjugate(Object a,
                          Dataset o)

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        a^*, complex conjugate of a

    - #### hypot

          public static Dataset hypot(Object a,
                      Object b)

      Parameters:
        `a` - side of right-angled triangle
        `b` - side of right-angled triangle
      Returns:
        hypotenuse of right-angled triangle: sqrt(a^2 + a^2)

    - #### hypot

          public static Dataset hypot(Object a,
                      Object b,
                      Dataset o)

      Parameters:
        `a` - side of right-angled triangle
        `b` - side of right-angled triangle
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        hypotenuse of right-angled triangle: sqrt(a^2 + a^2)

    - #### arctan2

          public static Dataset arctan2(Object a,
                        Object b)

      Parameters:
        `a` - opposite side of right-angled triangle
        `b` - adjacent side of right-angled triangle
      Returns:
        angle of triangle: atan(b/a)

    - #### arctan2

          public static Dataset arctan2(Object a,
                        Object b,
                        Dataset o)

      Parameters:
        `a` - opposite side of right-angled triangle
        `b` - adjacent side of right-angled triangle
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        angle of triangle: atan(b/a)

    - #### angle

          public static Dataset angle(Object a)

      Create a dataset of the arguments from a complex dataset
      Parameters:
        `a` -
      Returns:
        dataset of angles in radians

    - #### angle

          public static Dataset angle(Object a,
                      boolean inDegrees)

      Create a dataset of the arguments from a complex dataset
      Parameters:
        `a` -
        `inDegrees` - if true then return angles in degrees else in radians
      Returns:
        dataset of angles

    - #### angle

          public static Dataset angle(Object a,
                      Dataset o)

      Create a dataset of the arguments from a complex dataset
      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset of angles in radians

    - #### angle

          public static Dataset angle(Object a,
                      boolean inDegrees,
                      Dataset o)

      Create a dataset of the arguments from a complex dataset
      Parameters:
        `a` -
        `inDegrees` - if true then return angles in degrees else in radians
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset of angles

    - #### phaseAsComplexNumber

          public static Dataset phaseAsComplexNumber(Object a,
                                     boolean keepZeros)

      Create a phase only dataset. NB it will contain NaNs if there are any items with zero amplitude
      Parameters:
        `a` - dataset
        `keepZeros` - if true then zero items are returned as zero rather than NaNs
      Returns:
        complex dataset where items have unit amplitude

    - #### phaseAsComplexNumber

          public static Dataset phaseAsComplexNumber(Object a,
                                     Dataset o,
                                     boolean keepZeros)

      Create a phase only dataset. NB it will contain NaNs if there are any items with zero amplitude
      Parameters:
        `a` - dataset
        `o` - output can be null - in which case, a new dataset is created
        `keepZeros` - if true then zero items are returned as zero rather than NaNs
      Returns:
        complex dataset where items have unit amplitude

    - #### add

          public static Dataset add(Collection<IDataset> sets,
                    boolean requireClone)

      Adds all sets passed in together The first IDataset must cast to Dataset For memory efficiency sake if add(...) is called with a set of size one, no clone is done, the original object is returned directly. Otherwise a new data set is returned, the sum of those passed in.
      Parameters:
        `sets` -
        `requireClone` -
      Returns:
        sum of collection

    - #### multiply

          public static Dataset multiply(Collection<IDataset> sets,
                         boolean requireClone)

      Multiplies all sets passed in together The first IDataset must cast to Dataset
      Parameters:
        `sets` -
        `requireClone` -
      Returns:
        product of collection

    - #### interpolate

          public static Dataset interpolate(Dataset x,
                            Dataset d,
                            IDataset x0,
                            Number left,
                            Number right)

      Linearly interpolate values at points in a 1D dataset corresponding to given coordinates.
      Parameters:
        `x` - input 1-D coordinate dataset (must be ordered)
        `d` - input 1-D dataset
        `x0` - coordinate values
        `left` - value to use when x0 lies left of domain. If null, then interpolate to zero by using leftmost interval
        `right` - value to use when x0 lies right of domain. If null, then interpolate to zero by using rightmost interval
      Returns:
        interpolated values

    - #### interpolate

          public static double interpolate(Dataset d,
                           double x0)

      Linearly interpolate a value at a point in a 1D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `d` - input dataset
        `x0` - coordinate
      Returns:
        interpolated value

    - #### interpolate

          public static double interpolate(Dataset d,
                           Dataset m,
                           double x0)

      Linearly interpolate a value at a point in a 1D dataset with a mask. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `d` - input dataset
        `m` - mask dataset
        `x0` - coordinate
      Returns:
        interpolated value

    - #### interpolate

          public static void interpolate(double[] values,
                         CompoundDataset d,
                         double x0)

      Linearly interpolate an array of values at a point in a compound 1D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `values` - interpolated array
        `d` - input dataset
        `x0` - coordinate

    - #### interpolate

          public static double interpolate(Dataset d,
                           double x0,
                           double x1)

      Linearly interpolate a value at a point in a 2D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `d` - input dataset
        `x0` - coordinate
        `x1` - coordinate
      Returns:
        bilinear interpolation

    - #### interpolate

          public static double interpolate(Dataset d,
                           Dataset m,
                           double x0,
                           double x1)

      Linearly interpolate a value at a point in a 2D dataset with a mask. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `d` - input dataset
        `m` - mask dataset
        `x0` - coordinate
        `x1` - coordinate
      Returns:
        bilinear interpolation

    - #### interpolate

          public static void interpolate(double[] values,
                         CompoundDataset d,
                         double x0,
                         double x1)

      Linearly interpolate an array of values at a point in a compound 2D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `values` - bilinear interpolated array
        `d` -
        `x0` -
        `x1` -

    - #### interpolate

          public static double interpolate(Dataset d,
                           double... x)

      Linearly interpolate a value at a point in a n-D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero. The number of coordinates must match the rank of the dataset.
      Parameters:
        `d` - input dataset
        `x` - coordinates
      Returns:
        interpolated value

    - #### interpolate

          public static double interpolate(Dataset d,
                           Dataset m,
                           double... x)

      Linearly interpolate a value at a point in a n-D dataset with a mask. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero. The number of coordinates must match the rank of the dataset.
      Parameters:
        `d` - input dataset
        `m` - mask dataset (can be null)
        `x` - coordinates
      Returns:
        interpolated value

    - #### interpolate

          public static void interpolate(double[] values,
                         CompoundDataset d,
                         double... x)

      Linearly interpolate an array of values at a point in a compound n-D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `values` - linearly interpolated array
        `d` -
        `x` -

    - #### getLinear

          @Deprecated
          public static double getLinear(IDataset d,
                                    double x0)

      Deprecated. Use `interpolate(Dataset, double)`
      Linearly interpolate a value at a point in a 1D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `d` - input dataset
        `x0` - coordinate
      Returns:
        interpolated value

    - #### getLinear

          @Deprecated
          public static void getLinear(double[] values,
                                  CompoundDataset d,
                                  double x0)

      Deprecated. Use `interpolate(double[], CompoundDataset, double)`
      Linearly interpolate a value at a point in a compound 1D dataset. The dataset is considered to have zero support outside its bounds. Thus points just outside are interpolated from the boundary value to zero.
      Parameters:
        `values` - interpolated array
        `d` - input dataset
        `x0` - coordinate

    - #### getBilinear

          @Deprecated
          public static double getBilinear(IDataset d,
                                      double x0,
                                      double x1)

      Deprecated. Use `interpolate(Dataset, double, double)`
      Interpolated a value from 2D dataset
      Parameters:
        `d` - input dataset
        `x0` - coordinate
        `x1` - coordinate
      Returns:
        bilinear interpolation

    - #### getBilinear

          @Deprecated
          public static double getBilinear(IDataset d,
                                      IDataset m,
                                      double x0,
                                      double x1)

      Deprecated. Use `interpolate(Dataset, Dataset, double, double)`
      Interpolated a value from 2D dataset with mask
      Parameters:
        `d` - input dataset
        `m` - mask dataset
        `x0` - coordinate
        `x1` - coordinate
      Returns:
        bilinear interpolation

    - #### getBilinear

          @Deprecated
          public static void getBilinear(double[] values,
                                    CompoundDataset d,
                                    double x0,
                                    double x1)

      Deprecated. Use `interpolate(double[], CompoundDataset, double, double)`
      Interpolated a value from 2D compound dataset
      Parameters:
        `values` - bilinear interpolated array
        `d` -
        `x0` -
        `x1` -

    - #### difference

          public static Dataset difference(Dataset a,
                           int n,
                           int axis)

      Discrete difference of dataset along axis using finite difference
      Parameters:
        `a` -
        `n` - order of difference
        `axis` -
      Returns:
        difference

    - #### derivative

          public static Dataset derivative(Dataset x,
                           Dataset y,
                           int n)

      Calculates the derivative of a line described by two datasets (x,y) given a spread of n either side of the point
      Parameters:
        `x` - The x values of the function to take the derivative of.
        `y` - The y values of the function to take the derivative of.
        `n` - The spread the derivative is calculated from, i.e. the smoothing, the higher the value, the more smoothing occurs.
      Returns:
        A dataset which contains all the derivative point for point.

    - #### centralDifference

          public static Dataset centralDifference(Dataset a,
                                  int axis)

      Discrete difference of dataset along axis using finite central difference
      Parameters:
        `a` -
        `axis` -
      Returns:
        difference

    - #### gradient

          public static List<Dataset> gradient(Dataset y,
                               Dataset... x)

      Calculate gradient (or partial derivatives) by central difference
      Parameters:
        `y` -
        `x` - one or more datasets for dependent variables
      Returns:
        a list of datasets (one for each dimension in y)

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