org.eclipse.january.dataset

## Class Comparisons

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

-     public class Comparisons
      extends Object

  Comparison and logical methods

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `Comparisons.Monotonicity` Enumeration of monotonicity.

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `Comparisons()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `allCloseTo(Object a, Object b, double relTolerance, double absTolerance)` Compare item-wise for whether a's element is almost equal to b's
    `static BooleanDataset` | `allTrue(IDataset a, int axis)`
    `static boolean` | `allTrue(Object a)`
    `static BooleanDataset` | `almostEqualTo(Object a, Object b, BooleanDataset o, double relTolerance, double absTolerance)` Compare item-wise for whether a's element is equal b's
    `static BooleanDataset` | `almostEqualTo(Object a, Object b, double relTolerance, double absTolerance)` Compare item-wise for whether a's element is equal b's
    `static BooleanDataset` | `anyTrue(IDataset a, int axis)`
    `static boolean` | `anyTrue(Object a)`
    `static BooleanDataset` | `equalTo(Object a, Object b)` Compare item-wise for whether a's element is equal b's
    `static BooleanDataset` | `equalTo(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's element is equal b's
    `static Comparisons.Monotonicity` | `findMonotonicity(Object a)` Find monotonicity.
    `static BooleanDataset` | `greaterThan(Object a, Object b)` Compare item-wise for whether a's element is greater than b's
    `static BooleanDataset` | `greaterThan(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's element is greater than b's
    `static BooleanDataset` | `greaterThanOrEqualTo(Object a, Object b)` Compare item-wise for whether a's element is greater than or equal to b's
    `static BooleanDataset` | `greaterThanOrEqualTo(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's element is greater than or equal to b's
    `static boolean` | `isClose(double a, double b, double relTol, double absTol)`
    `static BooleanDataset` | `isFinite(Object a)` Check item-wise for whether any a's elements are finite (or not infinite and not Not-a-Number)
    `static BooleanDataset` | `isFinite(Object a, BooleanDataset o)` Check item-wise for whether any a's elements are finite (or not infinite and not Not-a-Number)
    `static BooleanDataset` | `isInfinite(Object a)` Check item-wise for whether any a's elements are infinite
    `static BooleanDataset` | `isInfinite(Object a, BooleanDataset o)` Check item-wise for whether any a's elements are infinite
    `static boolean` | `isMonotonic(Object a)`
    `static boolean` | `isMonotonic(Object a, Comparisons.Monotonicity monotonicity)`
    `static BooleanDataset` | `isNaN(Object a)` Check item-wise for whether any a's elements are Not-a-Numbers
    `static BooleanDataset` | `isNaN(Object a, BooleanDataset o)` Check item-wise for whether any a's elements are Not-a-Numbers
    `static BooleanDataset` | `isNegativeInfinite(Object a)` Check item-wise for whether any a's elements are negative infinite
    `static BooleanDataset` | `isNegativeInfinite(Object a, BooleanDataset o)` Check item-wise for whether any a's elements are negative infinite
    `static BooleanDataset` | `isPositiveInfinite(Object a)` Check item-wise for whether any a's elements are positive infinite
    `static BooleanDataset` | `isPositiveInfinite(Object a, BooleanDataset o)` Check item-wise for whether any a's elements are positive infinite
    `static boolean` | `isStrictlyMonotonic(Object a)`
    `static BooleanDataset` | `lessThan(Object a, Object b)` Compare item-wise for whether a's element is less than b's
    `static BooleanDataset` | `lessThan(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's element is less than b's
    `static BooleanDataset` | `lessThanOrEqualTo(Object a, Object b)` Compare item-wise for whether a's element is less than or equal to b's
    `static BooleanDataset` | `lessThanOrEqualTo(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's element is less than or equal to b's
    `static BooleanDataset` | `logicalAnd(Object a, Object b)` Compare item-wise for whether a's item is true and b's true too.
    `static BooleanDataset` | `logicalAnd(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's item is true and b's true too.
    `static BooleanDataset` | `logicalNot(Object a)` Negate item-wise
    `static BooleanDataset` | `logicalNot(Object a, BooleanDataset o)` Negate item-wise
    `static BooleanDataset` | `logicalOr(Object a, Object b)` Compare item-wise for whether a's item is true or b's true.
    `static BooleanDataset` | `logicalOr(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's item is true or b's true.
    `static BooleanDataset` | `logicalXor(Object a, Object b)` Compare item-wise for whether a's item is true or b's true exclusively.
    `static BooleanDataset` | `logicalXor(Object a, Object b, BooleanDataset o)` Compare item-wise for whether a's item is true or b's true exclusively.
    `static List<IntegerDataset>` | `nonZero(Dataset a)` Create a list of indices of positions where items are non-zero
    `static BooleanDataset` | `withinRange(Object a, BooleanDataset o, Number lo, Number hi)`
    `static BooleanDataset` | `withinRange(Object a, Number lo, Number hi)`

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

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

- - ### Constructor Detail

    - #### Comparisons

          public Comparisons()

  - ### Method Detail

    - #### equalTo

          public static BooleanDataset equalTo(Object a,
                               Object b)

      Compare item-wise for whether a's element is equal b's

      For multi-element items, comparison is true if all elements in an item are equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a == b

    - #### equalTo

          public static BooleanDataset equalTo(Object a,
                               Object b,
                               BooleanDataset o)

      Compare item-wise for whether a's element is equal b's

      For multi-element items, comparison is true if all elements in an item are equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a == b

    - #### almostEqualTo

          public static BooleanDataset almostEqualTo(Object a,
                                     Object b,
                                     double relTolerance,
                                     double absTolerance)

      Compare item-wise for whether a's element is equal b's

      For multi-element items, comparison is true if all elements in an item are equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `relTolerance` -
        `absTolerance` -
      Returns:
        dataset where item is true if abs(a - b) <= absTol + relTol*max(abs(a),abs(b))

    - #### isClose

          public static final boolean isClose(double a,
                        double b,
                        double relTol,
                        double absTol)

      Parameters:
        `a` -
        `b` -
        `relTol` -
        `absTol` -
      Returns:
        true if abs(a - b) <= max(absTol, relTol*max(abs(a),abs(b)))

    - #### almostEqualTo

          public static BooleanDataset almostEqualTo(Object a,
                                     Object b,
                                     BooleanDataset o,
                                     double relTolerance,
                                     double absTolerance)

      Compare item-wise for whether a's element is equal b's

      For multi-element items, comparison is true if all elements in an item are equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
        `relTolerance` -
        `absTolerance` -
      Returns:
        dataset where item is true if abs(a - b) <= absTol + relTol*max(abs(a),abs(b))

    - #### greaterThan

          public static BooleanDataset greaterThan(Object a,
                                   Object b)

      Compare item-wise for whether a's element is greater than b's

      For multi-element items, comparison is true if all elements in an item are greater. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a > b

    - #### greaterThan

          public static BooleanDataset greaterThan(Object a,
                                   Object b,
                                   BooleanDataset o)

      Compare item-wise for whether a's element is greater than b's

      For multi-element items, comparison is true if all elements in an item are greater. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a > b

    - #### greaterThanOrEqualTo

          public static BooleanDataset greaterThanOrEqualTo(Object a,
                                            Object b)

      Compare item-wise for whether a's element is greater than or equal to b's

      For multi-element items, comparison is true if all elements in an item are greater or equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a >= b

    - #### greaterThanOrEqualTo

          public static BooleanDataset greaterThanOrEqualTo(Object a,
                                            Object b,
                                            BooleanDataset o)

      Compare item-wise for whether a's element is greater than or equal to b's

      For multi-element items, comparison is true if all elements in an item are greater or equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a >= b

    - #### lessThan

          public static BooleanDataset lessThan(Object a,
                                Object b)

      Compare item-wise for whether a's element is less than b's

      For multi-element items, comparison is true if all elements in an item are lesser. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a < b

    - #### lessThan

          public static BooleanDataset lessThan(Object a,
                                Object b,
                                BooleanDataset o)

      Compare item-wise for whether a's element is less than b's

      For multi-element items, comparison is true if all elements in an item are lesser. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a < b

    - #### lessThanOrEqualTo

          public static BooleanDataset lessThanOrEqualTo(Object a,
                                         Object b)

      Compare item-wise for whether a's element is less than or equal to b's

      For multi-element items, comparison is true if all elements in an item are lesser or equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a <= b

    - #### lessThanOrEqualTo

          public static BooleanDataset lessThanOrEqualTo(Object a,
                                         Object b,
                                         BooleanDataset o)

      Compare item-wise for whether a's element is less than or equal to b's

      For multi-element items, comparison is true if all elements in an item are lesser or equal. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a <= b

    - #### withinRange

          public static BooleanDataset withinRange(Object a,
                                   Number lo,
                                   Number hi)

      Parameters:
        `a` -
        `lo` - lower bound
        `hi` - upper bound
      Returns:
        dataset where item is true if l <= a <= h

    - #### withinRange

          public static BooleanDataset withinRange(Object a,
                                   BooleanDataset o,
                                   Number lo,
                                   Number hi)

      Parameters:
        `a` -
        `lo` - lower bound
        `hi` - upper bound
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if l <= a <= h

    - #### allCloseTo

          public static boolean allCloseTo(Object a,
                           Object b,
                           double relTolerance,
                           double absTolerance)

      Compare item-wise for whether a's element is almost equal to b's

      For multi-element items, comparison is true if all elements in an item are equal up to a tolerance. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `relTolerance` -
        `absTolerance` -
      Returns:
        true if all items satisfy abs(a - b) <= absTol + relTol*max(abs(a),abs(b))

    - #### allTrue

          public static boolean allTrue(Object a)

      Parameters:
        `a` -
      Returns:
        true if all elements are true

    - #### allTrue

          public static BooleanDataset allTrue(IDataset a,
                               int axis)

      Parameters:
        `a` -
      Returns:
        true if all elements are true

    - #### anyTrue

          public static boolean anyTrue(Object a)

      Parameters:
        `a` -
      Returns:
        true if any element is true

    - #### anyTrue

          public static BooleanDataset anyTrue(IDataset a,
                               int axis)

      Parameters:
        `a` -
      Returns:
        true if any element is true

    - #### logicalNot

          public static BooleanDataset logicalNot(Object a)

      Negate item-wise

      For multi-element items, negation is false if all elements in a pair of items are true.

      Parameters:
        `a` -
      Returns:
        dataset where item is true when a is false

    - #### logicalNot

          public static BooleanDataset logicalNot(Object a,
                                  BooleanDataset o)

      Negate item-wise

      For multi-element items, negation is false if all elements in a pair of items are true.

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true when a is false

    - #### logicalAnd

          public static BooleanDataset logicalAnd(Object a,
                                  Object b)

      Compare item-wise for whether a's item is true and b's true too.

      For multi-element items, comparison is true if all elements in a pair of items are true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a && b is true

    - #### logicalAnd

          public static BooleanDataset logicalAnd(Object a,
                                  Object b,
                                  BooleanDataset o)

      Compare item-wise for whether a's item is true and b's true too.

      For multi-element items, comparison is true if all elements in a pair of items are true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a && b is true

    - #### logicalOr

          public static BooleanDataset logicalOr(Object a,
                                 Object b)

      Compare item-wise for whether a's item is true or b's true.

      For multi-element items, comparison is true if any elements in a pair of items are true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a || b is true

    - #### logicalOr

          public static BooleanDataset logicalOr(Object a,
                                 Object b,
                                 BooleanDataset o)

      Compare item-wise for whether a's item is true or b's true.

      For multi-element items, comparison is true if any elements in a pair of items are true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a || b is true

    - #### logicalXor

          public static BooleanDataset logicalXor(Object a,
                                  Object b)

      Compare item-wise for whether a's item is true or b's true exclusively.

      For multi-element items, comparison is true if one element in a pair of items is true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
      Returns:
        dataset where item is true if a ^ b is true

    - #### logicalXor

          public static BooleanDataset logicalXor(Object a,
                                  Object b,
                                  BooleanDataset o)

      Compare item-wise for whether a's item is true or b's true exclusively.

      For multi-element items, comparison is true if one element in a pair of items is true. Where the datasets have mismatched item sizes, the first element of the dataset with smaller items is used for comparison.

      Parameters:
        `a` -
        `b` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if a ^ b is true

    - #### nonZero

          public static List<IntegerDataset> nonZero(Dataset a)

      Create a list of indices of positions where items are non-zero
      Parameters:
        `a` -
      Returns:
        list of positions as integer datasets

    - #### isNaN

          public static BooleanDataset isNaN(Object a)

      Check item-wise for whether any a's elements are Not-a-Numbers

      For multi-element items, check is true if any elements in an item is Not-a-Number.

      Parameters:
        `a` -
      Returns:
        dataset where item is true if any of its elements are NaNs

    - #### isNaN

          public static BooleanDataset isNaN(Object a,
                             BooleanDataset o)

      Check item-wise for whether any a's elements are Not-a-Numbers

      For multi-element items, check is true if any elements in an item is Not-a-Number.

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if any of its elements are NaNs

    - #### isInfinite

          public static BooleanDataset isInfinite(Object a)

      Check item-wise for whether any a's elements are infinite

      For multi-element items, check is true if any elements in an item is infinite

      Parameters:
        `a` -
      Returns:
        dataset where item is true if any of its elements are infinite

    - #### isInfinite

          public static BooleanDataset isInfinite(Object a,
                                  BooleanDataset o)

      Check item-wise for whether any a's elements are infinite

      For multi-element items, check is true if any elements in an item is infinite

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if any of its elements are infinite

    - #### isPositiveInfinite

          public static BooleanDataset isPositiveInfinite(Object a)

      Check item-wise for whether any a's elements are positive infinite

      For multi-element items, the check is true if any elements in an item is positive infinite

      Parameters:
        `a` -
      Returns:
        dataset where items are true if any of its elements are positive infinite

    - #### isPositiveInfinite

          public static BooleanDataset isPositiveInfinite(Object a,
                                          BooleanDataset o)

      Check item-wise for whether any a's elements are positive infinite

      For multi-element items, the check is true if any elements in an item is positive infinite

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where items are true if any of its elements are positive infinite

    - #### isNegativeInfinite

          public static BooleanDataset isNegativeInfinite(Object a)

      Check item-wise for whether any a's elements are negative infinite

      For multi-element items, the check is true if any elements in an item is negative infinite

      Parameters:
        `a` -
      Returns:
        dataset where items are true if any of its elements are negative infinite

    - #### isNegativeInfinite

          public static BooleanDataset isNegativeInfinite(Object a,
                                          BooleanDataset o)

      Check item-wise for whether any a's elements are negative infinite

      For multi-element items, the check is true if any elements in an item is negative infinite

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where items are true if any of its elements are negative infinite

    - #### isFinite

          public static BooleanDataset isFinite(Object a)

      Check item-wise for whether any a's elements are finite (or not infinite and not Not-a-Number)

      For multi-element items, check is true if any elements in an item is finite

      Parameters:
        `a` -
      Returns:
        dataset where item is true if any of its elements are finite

    - #### isFinite

          public static BooleanDataset isFinite(Object a,
                                BooleanDataset o)

      Check item-wise for whether any a's elements are finite (or not infinite and not Not-a-Number)

      For multi-element items, check is true if any elements in an item is finite

      Parameters:
        `a` -
        `o` - output can be null - in which case, a new dataset is created
      Returns:
        dataset where item is true if any of its elements are finite

    - #### isMonotonic

          public static boolean isMonotonic(Object a)

      Parameters:
        `a` -
      Returns:
        true if all elements are in a monotonic order
      See Also:
        `findMonotonicity(Object)`

    - #### isMonotonic

          public static boolean isMonotonic(Object a,
                            Comparisons.Monotonicity monotonicity)

      Parameters:
        `a` -
        `monotonicity` -
      Returns:
        true if all elements are in given monotonic ordering

    - #### isStrictlyMonotonic

          public static boolean isStrictlyMonotonic(Object a)

      Parameters:
        `a` -
      Returns:
        true if all elements are in a strictly monotonic order
      See Also:
        `findMonotonicity(Object)`

    - #### findMonotonicity

          public static Comparisons.Monotonicity findMonotonicity(Object a)

      Find monotonicity. NaNs are ignored or considered not equal
      Parameters:
        `a` -
      Returns:
        monotonicity

Copyright © 2017. All rights reserved.