public class ArrayUtils
extends java.lang.Object
Modifier and Type | Class and Description |
---|---|
static class |
ArrayUtils.CopyArrayToFrame |
static class |
ArrayUtils.FrameToArray |
Constructor and Description |
---|
ArrayUtils() |
Modifier and Type | Method and Description |
---|---|
static byte[] |
add(byte[] a,
byte[] b) |
static double[][][] |
add(double[][][] a,
double[][][] b) |
static double[][] |
add(double[][] a,
double[][] b) |
static double[] |
add(double[] a,
double b) |
static double[] |
add(double[] a,
double[] b) |
static double[] |
add(double[] a,
double[] b,
double[] c) |
static float[][] |
add(float[][] a,
float[][] b) |
static float[] |
add(float[] a,
float[] b) |
static float[] |
add(float ca,
float[] a,
float cb,
float[] b) |
static int[][] |
add(int[][] a,
int[][] b) |
static int[] |
add(int[] a,
int b) |
static int[] |
add(int[] a,
int[] b) |
static long[][][] |
add(long[][][] a,
long[][][] b) |
static long[][] |
add(long[][] a,
long[][] b) |
static long[] |
add(long[] nums,
long a) |
static long[] |
add(long[] a,
long[] b) |
static byte[] |
append(byte[] a,
byte... b) |
static double[][] |
append(double[][] a,
double[][] b) |
static double[] |
append(double[] a,
double b) |
static double[] |
append(double[] a,
double[] b) |
static int[] |
append(int[] a,
int b) |
static int[] |
append(int[] a,
int[] b) |
static long[] |
append(long[] a,
long[] b) |
static java.lang.String[] |
append(java.lang.String[] a,
java.lang.String[] b) |
static <T> T[] |
append(T[] a,
T... b) |
static java.lang.String |
arrayToString(int[] ary) |
static double |
avg(double[] nums) |
static double |
avg(long[] nums) |
static java.lang.Character[] |
box(char[] arr)
Convert an array of primitive types into an array of corresponding boxed types.
|
static <T> T[] |
cloneOrNull(T[] ary) |
static byte[] |
constAry(int len,
byte b) |
static double[] |
constAry(int len,
double c) |
static boolean |
contains(byte[] a,
byte d) |
static boolean |
contains(int[] a,
int d) |
static <T> boolean |
contains(T[] arr,
T target) |
static double[][] |
convertTo2DMatrix(double[] x,
int N) |
static double[] |
copyAndFillOf(double[] original,
int newLength,
double padding) |
static int[] |
copyAndFillOf(int[] original,
int newLength,
int padding) |
static long[] |
copyAndFillOf(long[] original,
int newLength,
long padding) |
static <T> T[] |
copyAndFillOf(T[] original,
int newLength,
T padding) |
static double[] |
copyFromIntArray(int[] a) |
static int |
countNonzeros(double[] beta) |
static <K,V> int |
crossProductSize(java.util.Map<K,V[]> hyperSpace) |
static int[] |
cumsum(int[] from) |
static byte[] |
decodeAsInt(int what,
byte[] bs,
int at) |
static double[][] |
deepClone(double[][] ary) |
static <T extends Iced> |
deepClone(T[] ary) |
static <T extends Iced> |
deepClone(T[][] ary) |
static double[] |
diagArray(double[][] ary) |
static int[] |
difference(int[] a,
int[] b) |
static java.lang.String[] |
difference(java.lang.String[] a,
java.lang.String[] b) |
static long[] |
distinctLongs(int n,
long bound,
java.util.Random rng)
Generates a random array of n distinct non-negative long values.
|
static double[][] |
div(double[][] ds,
double[] n) |
static double[][] |
div(double[][] ds,
long[] n) |
static double[] |
div(double[] nums,
double n) |
static double[] |
div(double[] ds,
double[] n) |
static double[] |
div(double[] ds,
long[] n) |
static float[] |
div(float[] nums,
float n) |
static float[] |
div(float[] nums,
int n) |
static java.lang.String[] |
domainUnion(java.lang.String[] a,
java.lang.String[] b)
Clever union of String arrays.
|
static int |
encodeAsInt(byte[] b) |
static int |
encodeAsInt(byte[] bs,
int at) |
static long |
encodeAsLong(byte[] b) |
static long |
encodeAsLong(byte[] b,
int off,
int len) |
static boolean |
equalsAny(long value,
long... lhs) |
static double[] |
expandAndScatter(double[] ary,
int N,
int[] ids) |
static double[][] |
expandArray(double[][] ary,
int newColNum) |
static double[] |
extractCol(int i,
double[][] ary) |
static int |
find(int[] ls,
int elem) |
static int |
find(long[] ls,
long elem) |
static <T> int |
find(T[] ts,
T elem) |
static <T> int |
find(T[] ts,
T elem,
int off) |
static java.lang.String |
findLongestCommonPrefix(java.lang.String[] inputArray) |
static int |
findWithPrefix(java.lang.String[] array,
java.lang.String prefix)
Find an element with prefix with linear search & return it's index if find exactly,
-index-2 if find first occurrence with prefix or -1
|
static int |
findWithPrefix(java.lang.String[] array,
java.lang.String prefix,
int off)
Find an element with prefix with linear search & return it's index if find exactly,
-index-2 if find first occurrence with prefix or -1
|
static <T> T[] |
flat(T[][] arr)
Flatenize given array (skips null arrays)
Example: [[1,2], null, [3,null], [4]] -> [1,2,3,null,4]
|
static double[][] |
formGram(double[][] x) |
static double[][] |
formGram(double[][] x,
boolean transpose)
Given a n by k matrix X, form its Gram matrix
|
static Frame |
frame(double[]... rows) |
static Frame |
frame(Key<Frame> key,
java.lang.String[] names,
double[]... rows)
Create a new frame based on given row data.
|
static Frame |
frame(java.lang.String[] names,
double[]... rows) |
static Frame |
frame(java.lang.String name,
Vec vec) |
static double[][] |
gaussianArray(int n,
int m) |
static double[][] |
gaussianArray(int n,
int m,
long seed) |
static double[] |
gaussianVector(int n) |
static double[] |
gaussianVector(int n,
long seed) |
static double[] |
gaussianVector(int n,
java.util.Random random)
Make a new array initialized to random Gaussian N(0,1) values with the given seed.
|
static double[] |
gaussianVector(long seed,
double[] vseed)
Remove the array allocation in this one
|
static double[][] |
generateLineSearchVecs(double[] srcVec,
double[] gradient,
int n,
double step) |
static boolean |
hasNaNs(double[] ary) |
static boolean |
hasNaNsOrInfs(double[] ary) |
static boolean |
hasNaNsOrInfs(float[] ary) |
static boolean |
hasNzs(double[] x) |
static double |
innerProduct(double[] x,
double[] y) |
static double |
innerProductPartial(double[] x,
int[] x_index,
double[] y) |
static java.lang.String[] |
insert(java.lang.String[] a,
java.lang.String[] b,
int pos) |
static void |
interpolateLinear(double[] array) |
static java.lang.Double[] |
interval(java.lang.Double start,
java.lang.Double end,
java.lang.Double step) |
static java.lang.Float[] |
interval(java.lang.Float start,
java.lang.Float end,
java.lang.Float step) |
static java.lang.Integer[] |
interval(java.lang.Integer start,
java.lang.Integer end) |
static java.lang.Integer[] |
interval(java.lang.Integer start,
java.lang.Integer end,
java.lang.Integer step) |
static double[] |
invert(double[] ary) |
static boolean |
isInstance(java.lang.Object object,
java.lang.Class[] comparedClasses) |
static boolean |
isInt(java.lang.String... ary) |
static boolean |
isSorted(double[] vals) |
static boolean |
isSorted(int[] vals) |
static float[] |
join(float[] a,
float[] b) |
static long[] |
join(long[] a,
long[] b) |
static <T> T[] |
join(T[] a,
T[] b) |
static double |
l1norm(double[] x) |
static double |
l1norm(double[] x,
boolean skipLast) |
static double |
l2norm(double[] x) |
static double |
l2norm(double[][] x,
double[][] y) |
static double |
l2norm(double[] x,
boolean skipLast) |
static double |
l2norm(double[] x,
double[] y) |
static double |
l2norm2(double[] x) |
static double |
l2norm2(double[][] xs,
boolean skipLast) |
static double |
l2norm2(double[][] x,
double[][] y) |
static double |
l2norm2(double[] x,
boolean skipLast) |
static double |
l2norm2(double[] x,
double[] y) |
static double[] |
limitToRange(double[] sortedSplitPoints,
double min,
double maxEx) |
static int |
linearSearch(double[] vals,
double v) |
static double |
linfnorm(double[] x,
boolean skipLast) |
static int |
locate(double[] arr,
double val,
double tol)
Return the index of an element val that is less than tol array from an element of the array arr.
|
static double[] |
makeUniqueAndLimitToRange(double[] splitPoints,
double min,
double maxEx) |
static int |
maxIndex(double[] from) |
static int |
maxIndex(double[] from,
java.util.Random rand) |
static int |
maxIndex(float[] from) |
static int |
maxIndex(float[] from,
java.util.Random rand) |
static int |
maxIndex(int[] from) |
static int |
maxIndex(int[] from,
java.util.Random rand)
Returns the index of the largest value in the array.
|
static int |
maxIndex(long[] from) |
static int |
maxIndex(long[] from,
int off) |
static double |
maxValue(double[] ary) |
static double |
maxValue(double[] ary,
int from,
int to) |
static float |
maxValue(float[] ary) |
static float |
maxValue(float[] ary,
int from,
int to) |
static int |
maxValue(int[] from) |
static int |
maxValue(java.lang.Integer[] from) |
static long |
maxValue(long[] from) |
static int |
minIndex(double[] from) |
static int |
minIndex(float[] from) |
static int |
minIndex(int[] from) |
static double[] |
minMaxValue(double[] from)
Find minimum and maximum in array in the same time
|
static double |
minValue(double[] from) |
static double |
minValue(double[] ary,
int from,
int to) |
static float |
minValue(float[] from) |
static long |
minValue(int[] from) |
static long |
minValue(long[] from) |
static double[] |
mmul(double[][] M,
double[] V) |
static double[][] |
mult(double[][] ary,
double n) |
static double[][] |
mult(double[][] ds,
double[] n) |
static double[] |
mult(double[] nums,
double n) |
static double[] |
mult(double[] nums,
double[] nums2) |
static float[] |
mult(float[] nums,
float n) |
static double[][] |
multArrArr(double[][] ary1,
double[][] ary2) |
static double[][] |
multArrArr(double[][] ary1,
double[][] ary2,
double[][] res) |
static double[] |
multArrVec(double[][] ary,
double[] nums) |
static double[] |
multArrVec(double[][] ary,
double[] nums,
double[] res) |
static double[] |
multArrVecPartial(double[][] ary,
double[] nums,
int[] numColInd) |
static double[] |
multVecArr(double[] nums,
double[][] ary) |
static int |
numInts(java.lang.String... a)
Returns number of strings which represents a number.
|
static int |
occurrenceCount(byte[] array,
byte element)
Count number of occurrences of element in given array.
|
static boolean[] |
or(boolean[] a,
boolean[] b) |
static double[][] |
outerProduct(double[][] result,
double[] x,
double[] y) |
static double[][] |
outerProduct(double[] x,
double[] y) |
static double[] |
padUniformly(double[] origPoints,
int newLength) |
static double[] |
permute(double[] vec,
int[] idx) |
static double[][] |
permuteCols(double[][] ary,
int[] idx) |
static double[][] |
permuteRows(double[][] ary,
int[] idx) |
static java.lang.String |
pprint(double[][] arr) |
static java.lang.String |
pprint(double[][] arr,
java.text.DecimalFormat dformat) |
static java.lang.String[] |
prepend(java.lang.String[] ary,
java.lang.String s) |
static int[] |
range(int start,
int end)
Provide array from start to end in steps of 1
|
static float[] |
reduceMax(float[] a,
float[] b) |
static float[] |
reduceMin(float[] a,
float[] b) |
static byte[] |
remove(byte[] ary,
int id) |
static int[] |
remove(int[] ary,
int id) |
static long[] |
remove(long[] ary,
int id) |
static java.lang.String[] |
remove(java.lang.String[] ary,
java.lang.String s) |
static <T> T[] |
remove(T[] ary,
int id) |
static double[] |
removeIds(double[] x,
int[] ids) |
static int[] |
removeIds(int[] x,
int[] ids) |
static int[] |
removeSorted(int[] a,
int[] b)
Remove b from a, both a,b are assumed to be sorted.
|
static double |
rNorm(double[][] arr,
char type)
Like the R norm for matrices, this function will calculate the maximum absolute col sum if type='o' or
return the maximum absolute row sum otherwise
|
static byte[] |
select(byte[] array,
int[] idxs) |
static double[] |
select(double[] ary,
int[] idxs) |
static int[] |
select(int[] ary,
int[] idxs) |
static java.lang.String[] |
select(java.lang.String[] ary,
byte[] idxs) |
static java.lang.String[] |
select(java.lang.String[] ary,
int[] idxs) |
static int[] |
seq(int start,
int stop)
Generates sequence (start, stop) of integers: (start, start+1, ...., stop-1)
|
static int[] |
shuffleArray(int[] a,
int n,
int[] result,
long seed,
int startIndex)
Extract a shuffled array of integers
|
static void |
shuffleArray(int[] a,
java.util.Random rng) |
static void |
sort(int[] idxs,
double[] values)
Sort an integer array of indices based on values
Updates indices in place, keeps values the same
|
static void |
sort(int[] idxs,
double[] values,
int cutoff) |
static void |
sort(int[] idxs,
double[] values,
int cutoff,
int increasing) |
static int[] |
sorted_set_diff(int[] x,
int[] y) |
static double[] |
sortedMerge(double[] a,
double[] b) |
static void |
sortedMerge(int[] aIds,
double[] aVals,
int[] bIds,
double[] bVals,
int[] resIds,
double[] resVals) |
static int[] |
sortedMerge(int[] a,
int[] b) |
static double[] |
sqrtArr(double[] x) |
static double |
subAndMul(double[] data,
double[] p,
double[] n) |
static byte[] |
subarray(byte[] a,
int off,
int len) |
static <T> T[] |
subarray(T[] a,
int off,
int len) |
static <T> T[][] |
subarray2DLazy(T[][] a,
int columnOffset,
int len) |
static double[][] |
subtract(double[][] a,
double[][] b) |
static double[] |
subtract(double[] a,
double[] b) |
static double[] |
subtract(double[] a,
double[] b,
double[] c) |
static int[] |
subtract(int[] a,
int[] b) |
static long[] |
subtract(long n,
long[] nums) |
static double |
sum(double[] from) |
static float |
sum(float[] from) |
static int |
sum(int[] from) |
static long |
sum(long[] from) |
static long |
sum(long[] from,
int startIdx,
int endIdx) |
static long |
suml(int[] from) |
static byte[] |
toByteArray(int[] ary) |
static byte[] |
toByteArray(long... nums)
Transform given long numbers into byte array.
|
static double[] |
toDouble(float[] floats) |
static double[] |
toDouble(int[] ints) |
static int[] |
toInt(java.lang.Integer[] a,
int off,
int len) |
static int[] |
toInt(java.lang.String[] a,
int off,
int len) |
static java.lang.Integer[] |
toIntegers(int[] a,
int off,
int len) |
static int[] |
toPrimitive(java.util.ArrayList<java.lang.Integer> arr)
Convert an ArrayList of Integers to a primitive int[] array.
|
static java.lang.String[] |
toString(int[] dom) |
static java.lang.String[] |
toString(long[] dom) |
static java.lang.String[] |
toString(java.lang.Object[] ary) |
static java.lang.String |
toStringQuotedElements(java.lang.Object[] a) |
static java.lang.String |
toStringQuotedElements(java.lang.Object[] a,
int maxItems) |
static double[][] |
transpose(double[][] ary) |
static <T> T[][] |
transpose(T[][] ary) |
static double[][] |
transposeTriangular(double[][] ary,
boolean upperTriangular)
This function will perform transpose of triangular matrices only.
|
static double[] |
uniformDistFromArray(double[][] array,
long seed) |
static int[] |
union(int[] a,
int[] b)
Returns a union of given sorted arrays.
|
static java.lang.String[] |
union(java.lang.String[] a,
java.lang.String[] b,
boolean lexo)
Union of given String arrays.
|
static java.lang.String[] |
union(java.lang.String[] a,
java.lang.String[] b,
int aoff,
int alen,
int boff,
int blen,
boolean lexo) |
static int[] |
unpackInts(long... longs) |
static double[] |
wadd(double[] a,
double[] b,
double w) |
static double[] |
wadd(double[] a,
double[] b,
double[] c,
double w) |
static java.lang.Object[][] |
zip(java.lang.Object[] a,
java.lang.Object[] b) |
public static int[] cumsum(int[] from)
public static long sum(long[] from)
public static long sum(long[] from, int startIdx, int endIdx)
public static int sum(int[] from)
public static long suml(int[] from)
public static float sum(float[] from)
public static double sum(double[] from)
public static float[] reduceMin(float[] a, float[] b)
public static float[] reduceMax(float[] a, float[] b)
public static double innerProduct(double[] x, double[] y)
public static double innerProductPartial(double[] x, int[] x_index, double[] y)
public static double[] mmul(double[][] M, double[] V)
public static double[][] outerProduct(double[] x, double[] y)
public static double[][] outerProduct(double[][] result, double[] x, double[] y)
public static double[] sqrtArr(double[] x)
public static double l2norm2(double[] x)
public static double l2norm2(double[][] xs, boolean skipLast)
public static double l2norm2(double[] x, boolean skipLast)
public static double l2norm2(double[] x, double[] y)
public static double l2norm2(double[][] x, double[][] y)
public static double l1norm(double[] x)
public static double l1norm(double[] x, boolean skipLast)
public static double rNorm(double[][] arr, char type)
arr
- type
- public static double linfnorm(double[] x, boolean skipLast)
public static double l2norm(double[] x)
public static double l2norm(double[] x, boolean skipLast)
public static double l2norm(double[] x, double[] y)
public static double l2norm(double[][] x, double[][] y)
public static byte[] add(byte[] a, byte[] b)
public static int[] add(int[] a, int[] b)
public static int[][] add(int[][] a, int[][] b)
public static long[] add(long[] a, long[] b)
public static long[][] add(long[][] a, long[][] b)
public static long[][][] add(long[][][] a, long[][][] b)
public static float[] add(float[] a, float[] b)
public static float[] add(float ca, float[] a, float cb, float[] b)
public static float[][] add(float[][] a, float[][] b)
public static boolean[] or(boolean[] a, boolean[] b)
public static double[][] deepClone(double[][] ary)
public static <T extends Iced> T[][] deepClone(T[][] ary)
public static <T extends Iced> T[] deepClone(T[] ary)
public static double[] add(double[] a, double[] b)
public static double[] add(double[] a, double b)
public static int[] add(int[] a, int b)
public static double[] wadd(double[] a, double[] b, double w)
public static double[] wadd(double[] a, double[] b, double[] c, double w)
public static double[] add(double[] a, double[] b, double[] c)
public static double[][] add(double[][] a, double[][] b)
public static double[][][] add(double[][][] a, double[][][] b)
public static double avg(double[] nums)
public static double avg(long[] nums)
public static long[] add(long[] nums, long a)
public static float[] div(float[] nums, int n)
public static float[] div(float[] nums, float n)
public static double[] div(double[] nums, double n)
public static double[][] div(double[][] ds, long[] n)
public static double[][] div(double[][] ds, double[] n)
public static double[] div(double[] ds, long[] n)
public static double[] div(double[] ds, double[] n)
public static double[][] mult(double[][] ds, double[] n)
public static float[] mult(float[] nums, float n)
public static double[][] mult(double[][] ary, double n)
public static double[] mult(double[] nums, double n)
public static double[] mult(double[] nums, double[] nums2)
public static double subAndMul(double[] data, double[] p, double[] n)
data
- vector (1 x n)p
- vector (1 x n)n
- vector (1 x n)public static double[] invert(double[] ary)
public static double[] multArrVec(double[][] ary, double[] nums)
public static double[] multArrVecPartial(double[][] ary, double[] nums, int[] numColInd)
public static double[] diagArray(double[][] ary)
public static int locate(double[] arr, double val, double tol)
arr:
- double array possibly containing an element of interest.val:
- val to be found in array arrtol:
- maximum difference between value of interest val and an element of arraypublic static double[] multArrVec(double[][] ary, double[] nums, double[] res)
public static double[] multVecArr(double[] nums, double[][] ary)
public static double[][] multArrArr(double[][] ary1, double[][] ary2, double[][] res)
public static double[][] multArrArr(double[][] ary1, double[][] ary2)
public static double[][] transpose(double[][] ary)
public static double[][] expandArray(double[][] ary, int newColNum)
public static double[][] transposeTriangular(double[][] ary, boolean upperTriangular)
ary
- public static <T> T[] cloneOrNull(T[] ary)
public static <T> T[][] transpose(T[][] ary)
public static int[] range(int start, int end)
start
- beginning value (inclusive)end
- ending value (inclusive)public static double[][] formGram(double[][] x, boolean transpose)
x
- Matrix of real numberstranspose
- If true, compute n by n Gram of rows = XX'
If false, compute k by k Gram of cols = X'Xpublic static double[][] formGram(double[][] x)
public static double[] permute(double[] vec, int[] idx)
public static double[][] permuteCols(double[][] ary, int[] idx)
public static double[][] permuteRows(double[][] ary, int[] idx)
public static double[][] generateLineSearchVecs(double[] srcVec, double[] gradient, int n, double step)
public static java.lang.String arrayToString(int[] ary)
public static java.lang.String[] toString(long[] dom)
public static java.lang.String[] toString(int[] dom)
public static java.lang.String[] toString(java.lang.Object[] ary)
public static java.lang.String toStringQuotedElements(java.lang.Object[] a)
public static java.lang.String toStringQuotedElements(java.lang.Object[] a, int maxItems)
public static <T> boolean contains(T[] arr, T target)
public static boolean contains(byte[] a, byte d)
public static boolean contains(int[] a, int d)
public static byte[] subarray(byte[] a, int off, int len)
public static <T> T[] subarray(T[] a, int off, int len)
public static <T> T[][] subarray2DLazy(T[][] a, int columnOffset, int len)
public static int maxIndex(int[] from, java.util.Random rand)
public static int maxIndex(float[] from, java.util.Random rand)
public static int maxIndex(double[] from, java.util.Random rand)
public static int maxIndex(int[] from)
public static int maxIndex(long[] from)
public static int maxIndex(long[] from, int off)
public static int maxIndex(float[] from)
public static int maxIndex(double[] from)
public static int minIndex(int[] from)
public static int minIndex(float[] from)
public static int minIndex(double[] from)
public static double maxValue(double[] ary)
public static double maxValue(double[] ary, int from, int to)
public static float maxValue(float[] ary)
public static float maxValue(float[] ary, int from, int to)
public static float minValue(float[] from)
public static double minValue(double[] ary, int from, int to)
public static double minValue(double[] from)
public static double[] minMaxValue(double[] from)
public static long maxValue(long[] from)
public static int maxValue(java.lang.Integer[] from)
public static int maxValue(int[] from)
public static long minValue(long[] from)
public static long minValue(int[] from)
public static <T> int find(T[] ts, T elem)
public static <T> int find(T[] ts, T elem, int off)
public static int findWithPrefix(java.lang.String[] array, java.lang.String prefix)
public static int findWithPrefix(java.lang.String[] array, java.lang.String prefix, int off)
public static int find(long[] ls, long elem)
public static int find(int[] ls, int elem)
public static int linearSearch(double[] vals, double v)
public static java.lang.String pprint(double[][] arr)
public static java.lang.String pprint(double[][] arr, java.text.DecimalFormat dformat)
public static int[] unpackInts(long... longs)
public static int[] shuffleArray(int[] a, int n, int[] result, long seed, int startIndex)
a
- input arrayn
- number of elements to extractresult
- array to store the results into (will be of size n)seed
- random number seedstartIndex
- offset into apublic static void shuffleArray(int[] a, java.util.Random rng)
public static long[] distinctLongs(int n, long bound, java.util.Random rng)
n
- desired size of the arraybound
- (exclusive) upper bound of maximum long-value that can be includedrng
- random generatorpublic static double[][] gaussianArray(int n, int m)
public static double[][] gaussianArray(int n, int m, long seed)
public static double[] gaussianVector(int n)
public static double[] gaussianVector(int n, long seed)
public static double[] gaussianVector(int n, java.util.Random random)
n
- length of generated vectorzeroNum
item values are zeros.public static double[] gaussianVector(long seed, double[] vseed)
public static int numInts(java.lang.String... a)
public static boolean isInt(java.lang.String... ary)
public static int[] toInt(java.lang.String[] a, int off, int len)
public static java.lang.Integer[] toIntegers(int[] a, int off, int len)
public static int[] toInt(java.lang.Integer[] a, int off, int len)
public static java.lang.String[] domainUnion(java.lang.String[] a, java.lang.String[] b)
a
- a set of stringsb
- a set of stringspublic static java.lang.String[] union(java.lang.String[] a, java.lang.String[] b, boolean lexo)
a
- first arrayb
- second arraylexo
- - true if domains are sorted in lexicographical order or false for numeric domainspublic static java.lang.String[] union(java.lang.String[] a, java.lang.String[] b, int aoff, int alen, int boff, int blen, boolean lexo)
public static int[] union(int[] a, int[] b)
public static long[] join(long[] a, long[] b)
public static float[] join(float[] a, float[] b)
public static <T> T[] join(T[] a, T[] b)
public static boolean hasNaNsOrInfs(double[] ary)
public static boolean hasNaNs(double[] ary)
public static boolean hasNaNsOrInfs(float[] ary)
public static int[] seq(int start, int stop)
public static int[] difference(int[] a, int[] b)
public static java.lang.String[] difference(java.lang.String[] a, java.lang.String[] b)
public static double[][] append(double[][] a, double[][] b)
public static byte[] append(byte[] a, byte... b)
public static int[] append(int[] a, int[] b)
public static long[] append(long[] a, long[] b)
public static double[] append(double[] a, double[] b)
public static java.lang.String[] append(java.lang.String[] a, java.lang.String[] b)
public static java.lang.String[] insert(java.lang.String[] a, java.lang.String[] b, int pos)
public static <T> T[] append(T[] a, T... b)
public static int[] append(int[] a, int b)
public static double[] append(double[] a, double b)
public static java.lang.String[] prepend(java.lang.String[] ary, java.lang.String s)
public static <T> T[] copyAndFillOf(T[] original, int newLength, T padding)
public static double[] copyAndFillOf(double[] original, int newLength, double padding)
public static long[] copyAndFillOf(long[] original, int newLength, long padding)
public static int[] copyAndFillOf(int[] original, int newLength, int padding)
public static double[] copyFromIntArray(int[] a)
public static int[] sortedMerge(int[] a, int[] b)
public static double[] sortedMerge(double[] a, double[] b)
public static void sortedMerge(int[] aIds, double[] aVals, int[] bIds, double[] bVals, int[] resIds, double[] resVals)
public static java.lang.String[] select(java.lang.String[] ary, int[] idxs)
public static java.lang.String[] select(java.lang.String[] ary, byte[] idxs)
public static double[] select(double[] ary, int[] idxs)
public static int[] select(int[] ary, int[] idxs)
public static byte[] select(byte[] array, int[] idxs)
public static double[] expandAndScatter(double[] ary, int N, int[] ids)
public static void sort(int[] idxs, double[] values)
idxs
- indicesvalues
- valuespublic static void sort(int[] idxs, double[] values, int cutoff)
public static void sort(int[] idxs, double[] values, int cutoff, int increasing)
public static double[] subtract(double[] a, double[] b)
public static double[][] subtract(double[][] a, double[][] b)
public static int[] subtract(int[] a, int[] b)
public static double[] subtract(double[] a, double[] b, double[] c)
public static <T> T[] flat(T[][] arr)
T
- any typearr
- array of arrayspublic static double[][] convertTo2DMatrix(double[] x, int N)
public static java.lang.Object[][] zip(java.lang.Object[] a, java.lang.Object[] b)
public static <K,V> int crossProductSize(java.util.Map<K,V[]> hyperSpace)
public static java.lang.Integer[] interval(java.lang.Integer start, java.lang.Integer end)
public static java.lang.Integer[] interval(java.lang.Integer start, java.lang.Integer end, java.lang.Integer step)
public static java.lang.Float[] interval(java.lang.Float start, java.lang.Float end, java.lang.Float step)
public static java.lang.Double[] interval(java.lang.Double start, java.lang.Double end, java.lang.Double step)
public static java.lang.String[] remove(java.lang.String[] ary, java.lang.String s)
public static int[] sorted_set_diff(int[] x, int[] y)
public static Frame frame(Key<Frame> key, java.lang.String[] names, double[]... rows)
key
- Key for the framenames
- names of frame columnsrows
- data given in the form of rowspublic static Frame frame(double[]... rows)
public static Frame frame(java.lang.String[] names, double[]... rows)
public static int[] removeSorted(int[] a, int[] b)
public static int[] removeIds(int[] x, int[] ids)
public static double[] removeIds(double[] x, int[] ids)
public static boolean hasNzs(double[] x)
public static int countNonzeros(double[] beta)
public static long[] subtract(long n, long[] nums)
public static <T> T[] remove(T[] ary, int id)
public static byte[] remove(byte[] ary, int id)
public static int[] remove(int[] ary, int id)
public static long[] remove(long[] ary, int id)
public static double[] padUniformly(double[] origPoints, int newLength)
public static double[] makeUniqueAndLimitToRange(double[] splitPoints, double min, double maxEx)
public static double[] limitToRange(double[] sortedSplitPoints, double min, double maxEx)
public static double[] extractCol(int i, double[][] ary)
public static long encodeAsLong(byte[] b)
public static long encodeAsLong(byte[] b, int off, int len)
public static int encodeAsInt(byte[] b)
public static int encodeAsInt(byte[] bs, int at)
public static byte[] decodeAsInt(int what, byte[] bs, int at)
public static byte[] toByteArray(long... nums)
public static byte[] toByteArray(int[] ary)
public static boolean equalsAny(long value, long... lhs)
public static java.lang.Character[] box(char[] arr)
arr
- input array of `char`spublic static int[] toPrimitive(java.util.ArrayList<java.lang.Integer> arr)
public static boolean isSorted(int[] vals)
public static boolean isSorted(double[] vals)
public static byte[] constAry(int len, byte b)
public static double[] constAry(int len, double c)
public static double[] toDouble(float[] floats)
public static double[] toDouble(int[] ints)
public static boolean isInstance(java.lang.Object object, java.lang.Class[] comparedClasses)
public static int occurrenceCount(byte[] array, byte element)
array
- array in which number of occurrences should be counted.element
- element whose occurrences should be counted.public static java.lang.String findLongestCommonPrefix(java.lang.String[] inputArray)
public static double[] uniformDistFromArray(double[][] array, long seed)
public static void interpolateLinear(double[] array)