public class Utilities
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
Utilities.RankTies |
Constructor and Description |
---|
Utilities() |
Modifier and Type | Method and Description |
---|---|
static boolean |
any(boolean... x) |
static boolean |
anyNA(double... x) |
static double[] |
c(double... x) |
static double[] |
c(double[]... x) |
static int[] |
c(int... x) |
static int[] |
c(int[]... x) |
static double[] |
colon(double from,
double to) |
static int[] |
colon(int from,
int to) |
static double[] |
index_min1(double[] x,
int[] idx)
Mimic x[idx] behavior of R
|
static double[] |
index(double[] x,
int[] idx)
Mimic x[idx] behavior of R
|
static boolean[] |
is_duplicated(double[] e) |
static <S> boolean[] |
is_duplicated(S[] e) |
static int[] |
match(double[] x,
double[] y)
Mimic the behavior of match function in R.
|
static int[] |
match(int[] x,
int[] y) |
static <S> int[] |
match(S[] x,
S[] y) |
static int[] |
order(double[] e)
Returns the order of the elements of array e
|
static void |
permute(double[] e)
Permute the array e
|
static void |
permute(double[] e,
RandomEngine random)
Permute the array e
|
static void |
print(double... val) |
static void |
print(java.lang.String format,
double... val) |
static double[] |
rank(double[] e)
Returns the ranks of the elements of array e, resolve ties by averaging
|
static double[] |
rank(double[] e,
Utilities.RankTies ties)
Returns the ranks of the elements of array e.
|
static double[] |
rec(double[] e) |
static double[] |
rep_each(double[] v,
int n) |
static int[] |
rep_each(int[] v,
int n) |
static double[] |
rep(double[] v,
int n) |
static double[] |
rep(double v,
int n) |
static double[] |
rev(double[] e) |
static double[][] |
rle(double[] e)
Compute RLE
|
static double[] |
sample_int(int n,
int s)
Sample from 1 to n, with size s, without replacement---with default random engine
|
static double[] |
sample_int(int n,
int s,
RandomEngine random)
Sample from 1 to n, with size s, without replacement
|
static int[] |
seq_along(double[] z) |
static double[] |
seq_int(double from,
double to,
int length_out) |
static double[] |
seq(double from,
double to,
double by) |
static int[] |
seq(int from,
int to,
int by) |
static void |
sort(double[] data)
Sort data using radix sort
|
static void |
sort(double[] data,
int[] idx)
Sort using radix sort
|
static <T> void |
sort(double[] data,
T[] obj)
Sort using radix sort
|
static void |
sort(int[] a)
Radix sort
|
static void |
sort(int[] data,
int[] idx) |
static <T> void |
sort(int[] data,
T[] idx) |
static void |
sort(long[] a)
Radix sort
|
static void |
sort(long[] data,
int[] idx) |
static <T> void |
sort(long[] data,
T[] idx) |
static int[] |
tabulate(int[] x,
int n)
Mimic the tabulate function in R
|
static double[] |
to_double_array(java.util.Collection<java.lang.Double> s) |
static double[] |
to_double(int[] e)
Converts the integer array e into a double array
|
static int[] |
to_int_array(java.util.Collection<java.lang.Integer> s) |
static double[] |
unique(double[] e) |
static <S> S[] |
unique(S[] e) |
static int[] |
which(boolean[] e) |
public static final int[] colon(int from, int to)
public static final double[] colon(double from, double to)
public static final int[] seq(int from, int to, int by)
public static final double[] seq_int(double from, double to, int length_out)
public static final double[] seq(double from, double to, double by)
public static final int[] c(int[]... x)
public static final int[] c(int... x)
public static final double[] c(double[]... x)
public static final double[] c(double... x)
public static final double[] rep(double v, int n)
public static final double[] rep(double[] v, int n)
public static final double[] rep_each(double[] v, int n)
public static final int[] rep_each(int[] v, int n)
public static final double[] rec(double[] e)
public static final double[] rev(double[] e)
public static final void print(double... val)
public static final void print(java.lang.String format, double... val)
public static final void sort(double[] data)
data
- public static final void sort(double[] data, int[] idx)
data
- idx
- an index of data, of the same length, useful to sort an entire tablepublic static final <T> void sort(double[] data, T[] obj)
data
- obj
- an auxiliary array of objectspublic static final void sort(int[] a)
a
- public static final void sort(int[] data, int[] idx)
public static final <T> void sort(int[] data, T[] idx)
public static final void sort(long[] a)
a
- public static final void sort(long[] data, int[] idx)
public static final <T> void sort(long[] data, T[] idx)
public static final double[] to_double(int[] e)
e
- public static final int[] order(double[] e)
e
- public static final double[] rank(double[] e)
e
- public static final double[] rank(double[] e, Utilities.RankTies ties)
e
- ties
- Ties resolution: Average, Min, or Maxpublic static final void permute(double[] e)
e
- public static final void permute(double[] e, RandomEngine random)
e
- random
- public static final double[] sample_int(int n, int s)
n
- s
- public static final double[] sample_int(int n, int s, RandomEngine random)
n
- s
- random
- random enginepublic static final double[] unique(double[] e)
public static final <S> S[] unique(S[] e)
public static final boolean[] is_duplicated(double[] e)
public static final <S> boolean[] is_duplicated(S[] e)
public static final int[] which(boolean[] e)
public static final double[][] rle(double[] e)
e
- public static final int[] match(double[] x, double[] y)
x
- y
- public static final int[] match(int[] x, int[] y)
public static final <S> int[] match(S[] x, S[] y)
public static final int[] tabulate(int[] x, int n)
x
- n
- public static final int[] seq_along(double[] z)
public static final double[] index(double[] x, int[] idx)
x
- idx
- public static final double[] index_min1(double[] x, int[] idx)
x
- idx
- public static final int[] to_int_array(java.util.Collection<java.lang.Integer> s)
public static final double[] to_double_array(java.util.Collection<java.lang.Double> s)
public static final boolean any(boolean... x)
public static final boolean anyNA(double... x)