|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectde.jstacs.utils.ToolBox
public class ToolBox
This class is a collection of methods which might be useful for the programmer.
Constructor Summary | |
---|---|
ToolBox()
|
Method Summary | ||
---|---|---|
static int |
getMaxIndex(double[] w)
Returns the index with maximal value in a double array. |
|
static int |
getMaxIndex(int start,
int end,
double[] w)
Returns the index with maximal value in a double array. |
|
static double[] |
getUniqueHueValues(int number)
Creates an array of hue values that can be used for the representation of probabilities. |
|
static double |
max(double... array)
This method returns the maximum of the elements of an array . |
|
static double |
max(int start,
int end,
double[] array)
This method returns the maximum of the elements of an array
between start and end . |
|
static double |
median(double... array)
This method returns the median of the elements of array . |
|
static double |
median(int start,
int end,
double[] array)
This method returns the medin of the elements of an array
between start and end . |
|
static double |
min(double... array)
This method returns the minimum of the elements of an array . |
|
static double |
min(int start,
int end,
double[] array)
This method returns the minimum of the elements of an array
between start and end . |
|
static
|
parseHashSet2IndexHashtable(HashSet<K> set)
This method converts a HashSet in a Hashtable with unique indices starting at 0. |
|
static double |
pearsonCorrelation(double[] v1,
double[] v2)
The method computes the Pearson correlation of two vectors. |
|
static int[] |
rank(double[] values,
boolean sameRank)
Ranks the values in values , where the greatest value obtains the lowest rank. |
|
static double |
spearmanCorrelation(double[] v1,
double[] v2)
The method computes the Spearman correlation of two vectors. |
|
static double |
sum(double... array)
Computes the sum of the values in array |
|
static double |
sum(int start,
int end,
double[] array)
Computes the sum of the values in array starting at
start until end . |
|
static double[][] |
transpose(double[][] sp)
Transpose a double matrix. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public ToolBox()
Method Detail |
---|
public static <K> Hashtable<K,Integer> parseHashSet2IndexHashtable(HashSet<K> set)
HashSet
in a Hashtable
with unique indices starting at 0.
The indices are derived from the order of the Iterator
of the HashSet
.
K
- the type of the keysset
- the set of keys
Hashtable
with keys and unique indices starting at 0public static double max(double... array)
array
.
array
- the array of values
public static double min(double... array)
array
.
array
- the array of values
public static double max(int start, int end, double[] array)
array
between start
and end
.
start
- start position (inclusive)end
- end position (exclusive)array
- the array of values
public static double min(int start, int end, double[] array)
array
between start
and end
.
start
- start position (inclusive)end
- end position (exclusive)array
- the array of values
public static final int getMaxIndex(double[] w)
double
array.
w
- the given double
array
public static final int getMaxIndex(int start, int end, double[] w)
double
array.
w
- the given double
arraystart
- start position (inclusive)end
- end position (exclusive)
public static double median(double... array)
array
.
array
- the array of values
public static double median(int start, int end, double[] array)
array
between start
and end
.
start
- start position (inclusive)end
- end position (exclusive)array
- the array of values
public static final int[] rank(double[] values, boolean sameRank)
values
, where the greatest value obtains the lowest rank.
The boolean sameRank
allows to decide whether tied values should obtain the same rank.
values
- the valuessameRank
- a switch whether tied values obtain the same rank.
public static double spearmanCorrelation(double[] v1, double[] v2) throws Exception
v1
- the first vectorv2
- the second vector
Exception
- if the vectors have different lengthpublic static double pearsonCorrelation(double[] v1, double[] v2) throws Exception
v1
- the first vectorv2
- the second vector
Exception
- if the vectors have different lengthpublic static double sum(double... array)
array
array
- the array
array
public static double sum(int start, int end, double[] array)
array
starting at
start
until end
.
start
- the index of the first element in the sum (inclusive)end
- the end index (exclusive)array
- the array
array
from start
to end
public static double[][] transpose(double[][] sp) throws Exception
double
matrix.
sp
- the array
Exception
- if sp
is no matrixpublic static double[] getUniqueHueValues(int number)
number
- the number of colors
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES All Classes | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |