|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjbil.util.ArrayUtilities
public class ArrayUtilities
Assorted array utility functions.
Constructor Summary | |
---|---|
ArrayUtilities()
|
Method Summary | |
---|---|
static void |
fillInSequence(int[] a,
int startValue)
Fills a vector with successive values starting from a given value. |
static char[] |
intersection(char[] a,
char[] b)
Computes the intersection between two char arrays. |
static int |
max(int[] a)
Returns the maximum of an int array. |
static int |
min(int[] a)
Returns the minimum of an int array. |
static double[] |
normalize(double[] v)
Returns the normalised values of an array so that they sum up to one. |
static int[] |
sequence(int start,
int length)
Returns an int array with succesive elements. |
static int[] |
sortIndexes(double[] a)
Sorts the elements of an array and returns their indexes in order. |
static double[] |
subArray(double[] v,
boolean[] indexMask)
Return the subarray of a double array by picking the entries indicated by true entries of a boolean mask array of the same size. |
static int[] |
subArray(int[] v,
boolean[] indexMask)
Return the subarray of an int array by picking the entries indicated by true entries of a boolean mask array of the same size. |
static int |
sum(int[] a)
Returns the sum of the elements of an int array. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ArrayUtilities()
Method Detail |
---|
public static char[] intersection(char[] a, char[] b)
a
- The first vector.b
- The second vector.
public static int min(int[] a)
public static int max(int[] a)
public static int sum(int[] a)
public static double[] normalize(double[] v)
public static void fillInSequence(int[] a, int startValue)
a
- The vector to be filled.startValue
- The value of the first element of the array.public static int[] sequence(int start, int length)
start
- The start value of the sequence.length
- The length of the sequence.
public static int[] subArray(int[] v, boolean[] indexMask)
v
- The base array.indexMask
- The indexes boolean mask.public static double[] subArray(double[] v, boolean[] indexMask)
subArray(int[], boolean[])
public static int[] sortIndexes(double[] a)
Example: for (3,1,5,4,2) returns (1,4,0,3,2)
a
- a double[] array.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |