public class Comparisons extends Object
Modifier and Type | Class and Description |
---|---|
static class |
Comparisons.Monotonicity
Enumeration of monotonicity.
|
Constructor and Description |
---|
Comparisons() |
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)
Test if all items along given axis are true in the input dataset
|
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)
Test if any items along given axis are true in the input dataset
|
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) |
public Comparisons()
public static BooleanDataset equalTo(Object a, Object b)
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.
a
- b
- a == b
public static BooleanDataset equalTo(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda == b
public static BooleanDataset almostEqualTo(Object a, Object b, double relTolerance, double absTolerance)
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.
a
- b
- relTolerance
- absTolerance
- abs(a - b) <= absTol + relTol*max(abs(a),abs(b))
public static final boolean isClose(double a, double b, double relTol, double absTol)
a
- b
- relTol
- absTol
- abs(a - b) <= max(absTol, relTol*max(abs(a),abs(b)))
public static BooleanDataset almostEqualTo(Object a, Object b, BooleanDataset o, double relTolerance, double absTolerance)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createdrelTolerance
- absTolerance
- abs(a - b) <= absTol + relTol*max(abs(a),abs(b))
public static BooleanDataset greaterThan(Object a, Object b)
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.
a
- b
- a > b
public static BooleanDataset greaterThan(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda > b
public static BooleanDataset greaterThanOrEqualTo(Object a, Object b)
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.
a
- b
- a >= b
public static BooleanDataset greaterThanOrEqualTo(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda >= b
public static BooleanDataset lessThan(Object a, Object b)
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.
a
- b
- a < b
public static BooleanDataset lessThan(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda < b
public static BooleanDataset lessThanOrEqualTo(Object a, Object b)
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.
a
- b
- a <= b
public static BooleanDataset lessThanOrEqualTo(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda <= b
public static BooleanDataset withinRange(Object a, Number lo, Number hi)
a
- lo
- lower boundhi
- upper boundl <= a <= h
public static BooleanDataset withinRange(Object a, BooleanDataset o, Number lo, Number hi)
a
- lo
- lower boundhi
- upper boundo
- output can be null - in which case, a new dataset is createdl <= a <= h
public static boolean allCloseTo(Object a, Object b, double relTolerance, double absTolerance)
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.
a
- b
- relTolerance
- absTolerance
- abs(a - b) <= absTol + relTol*max(abs(a),abs(b))
public static boolean allTrue(Object a)
a
- public static BooleanDataset allTrue(IDataset a, int axis)
a
- axis
- axis to reducepublic static boolean anyTrue(Object a)
a
- public static BooleanDataset anyTrue(IDataset a, int axis)
a
- axis
- axis to reducepublic static BooleanDataset logicalNot(Object a)
For multi-element items, negation is false if all elements in a pair of items are true.
a
- public static BooleanDataset logicalNot(Object a, BooleanDataset o)
For multi-element items, negation is false if all elements in a pair of items are true.
a
- o
- output can be null - in which case, a new dataset is createdpublic static BooleanDataset logicalAnd(Object a, Object b)
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.
a
- b
- a && b
is truepublic static BooleanDataset logicalAnd(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda && b
is truepublic static BooleanDataset logicalOr(Object a, Object b)
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.
a
- b
- a || b
is truepublic static BooleanDataset logicalOr(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createda || b
is truepublic static BooleanDataset logicalXor(Object a, Object b)
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.
a
- b
- a ^ b
is truepublic static BooleanDataset logicalXor(Object a, Object b, BooleanDataset o)
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.
a
- b
- o
- output can be null - in which case, a new dataset is createdpublic static List<IntegerDataset> nonZero(Dataset a)
a
- public static BooleanDataset isNaN(Object a)
For multi-element items, check is true if any elements in an item is Not-a-Number.
a
- public static BooleanDataset isNaN(Object a, BooleanDataset o)
For multi-element items, check is true if any elements in an item is Not-a-Number.
a
- o
- output can be null - in which case, a new dataset is createdpublic static BooleanDataset isInfinite(Object a)
For multi-element items, check is true if any elements in an item is infinite
a
- public static BooleanDataset isInfinite(Object a, BooleanDataset o)
For multi-element items, check is true if any elements in an item is infinite
a
- o
- output can be null - in which case, a new dataset is createdpublic static BooleanDataset isPositiveInfinite(Object a)
For multi-element items, the check is true if any elements in an item is positive infinite
a
- public static BooleanDataset isPositiveInfinite(Object a, BooleanDataset o)
For multi-element items, the check is true if any elements in an item is positive infinite
a
- o
- output can be null - in which case, a new dataset is createdpublic static BooleanDataset isNegativeInfinite(Object a)
For multi-element items, the check is true if any elements in an item is negative infinite
a
- public static BooleanDataset isNegativeInfinite(Object a, BooleanDataset o)
For multi-element items, the check is true if any elements in an item is negative infinite
a
- o
- output can be null - in which case, a new dataset is createdpublic static BooleanDataset isFinite(Object a)
For multi-element items, check is true if any elements in an item is finite
a
- public static BooleanDataset isFinite(Object a, BooleanDataset o)
For multi-element items, check is true if any elements in an item is finite
a
- o
- output can be null - in which case, a new dataset is createdpublic static boolean isMonotonic(Object a)
a
- findMonotonicity(Object)
public static boolean isMonotonic(Object a, Comparisons.Monotonicity monotonicity)
a
- monotonicity
- public static boolean isStrictlyMonotonic(Object a)
a
- findMonotonicity(Object)
public static Comparisons.Monotonicity findMonotonicity(Object a)
a
- Copyright © 2014–2019 Eclipse Foundation. All rights reserved.