public class BooleanIndexing extends Object
Constructor and Description |
---|
BooleanIndexing() |
Modifier and Type | Method and Description |
---|---|
static boolean |
and(INDArray n,
Condition cond)
And over the whole ndarray given some condition
|
static boolean[] |
and(INDArray n,
Condition condition,
int... dimension)
And over the whole ndarray given some condition, with respect to dimensions
|
static INDArray |
applyMask(INDArray arr,
INDArray mask)
A minor shortcut for applying a bitmask to
a matrix
|
static INDArray |
applyMaskInPlace(INDArray arr,
INDArray mask)
A minor shortcut for applying a bitmask to
a matrix
|
static void |
assignIf(@NonNull INDArray to,
@NonNull INDArray from,
@NonNull Condition condition)
This method does element-wise comparison
for 2 equal-sized matrices, for each element that matches Condition.
|
static INDArray |
chooseFrom(@NonNull INDArray[] input,
@NonNull Condition condition)
Choose from the inputs based on the given condition.
|
static INDArray |
chooseFrom(@NonNull INDArray[] input,
@NonNull List<Double> tArgs,
@NonNull List<Integer> iArgs,
@NonNull Condition condition)
Choose from the inputs based on the given condition.
|
static INDArray |
firstIndex(INDArray array,
Condition condition)
This method returns first index matching given condition
PLEASE NOTE: This method will return -1 value if condition wasn't met
|
static INDArray |
firstIndex(INDArray array,
Condition condition,
int... dimension)
This method returns first index matching given condition along given dimensions
PLEASE NOTE: This method will return -1 values for missing conditions
|
static INDArray |
lastIndex(INDArray array,
Condition condition)
This method returns last index matching given condition
PLEASE NOTE: This method will return -1 value if condition wasn't met
|
static INDArray |
lastIndex(INDArray array,
Condition condition,
int... dimension)
This method returns first index matching given condition along given dimensions
PLEASE NOTE: This method will return -1 values for missing conditions
|
static boolean |
or(INDArray n,
Condition cond)
Or over the whole ndarray given some condition
|
static boolean[] |
or(INDArray n,
Condition condition,
int... dimension)
Or over the whole ndarray given some condition, with respect to dimensions
|
static void |
replaceWhere(@NonNull INDArray to,
@NonNull INDArray from,
@NonNull Condition condition)
This method does element-wise comparison for 2 equal-sized matrices, for each element that matches Condition
|
static void |
replaceWhere(@NonNull INDArray to,
@NonNull Number set,
@NonNull Condition condition)
This method does element-wise assessing for 2 equal-sized matrices, for each element that matches Condition
|
public static boolean and(INDArray n, Condition cond)
n
- the ndarray to testcond
- the condition to test againstpublic static boolean[] and(INDArray n, Condition condition, int... dimension)
n
- the ndarray to testcondition
- the condition to test againstpublic static boolean[] or(INDArray n, Condition condition, int... dimension)
n
- the ndarray to testcondition
- the condition to test againstpublic static boolean or(INDArray n, Condition cond)
n
- cond
- public static void assignIf(@NonNull @NonNull INDArray to, @NonNull @NonNull INDArray from, @NonNull @NonNull Condition condition)
INDArray.gt(Number)
,INDArray.gte(Number)
,
INDArray.lt(Number)
,..to
- the array to apply the condition tofrom
- the mask arraycondition
- the condition to applypublic static void replaceWhere(@NonNull @NonNull INDArray to, @NonNull @NonNull INDArray from, @NonNull @NonNull Condition condition)
to
- from
- condition
- public static INDArray chooseFrom(@NonNull @NonNull INDArray[] input, @NonNull @NonNull Condition condition)
input
- the input to filtercondition
- the condition to filter based onpublic static INDArray applyMask(INDArray arr, INDArray mask)
arr
- The array to apply the mask tomask
- the mask to applypublic static INDArray applyMaskInPlace(INDArray arr, INDArray mask)
arr
- The array to apply the mask tomask
- the mask to applypublic static INDArray chooseFrom(@NonNull @NonNull INDArray[] input, @NonNull @NonNull List<Double> tArgs, @NonNull @NonNull List<Integer> iArgs, @NonNull @NonNull Condition condition)
input
- the input to filtertArgs
- the double argsiArgs
- the integer argscondition
- the condition to filter based onpublic static void replaceWhere(@NonNull @NonNull INDArray to, @NonNull @NonNull Number set, @NonNull @NonNull Condition condition)
to
- set
- condition
- public static INDArray firstIndex(INDArray array, Condition condition)
array
- condition
- public static INDArray firstIndex(INDArray array, Condition condition, int... dimension)
array
- condition
- dimension
- public static INDArray lastIndex(INDArray array, Condition condition)
array
- condition
- public static INDArray lastIndex(INDArray array, Condition condition, int... dimension)
array
- condition
- dimension
- Copyright © 2020. All rights reserved.