
public final class Util extends Object
de.lmu.ifi.dbs.elki.utilities| Modifier and Type | Class and Description |
|---|---|
private static class |
Util.ForwardComparator
Regular comparator.
|
| Modifier and Type | Field and Description |
|---|---|
private static Comparator<?> |
FORWARD
Static instance
|
| Constructor and Description |
|---|
Util() |
| Modifier and Type | Method and Description |
|---|---|
static double[] |
copy(double[] array)
Returns a new double array containing the same objects as are contained in
the given array.
|
static <T> Comparator<T> |
forwardOrder()
Compare two objects, forward.
|
static int |
mixHashCodes(int... hash)
Mix multiple hashcodes into one.
|
static double[] |
parseDoubles(String s)
Returns a new
Double array initialized to the values
represented by the specified String and separated by comma, as
performed by the valueOf method of class Double. |
static <O> void |
print(List<O> list,
String separator,
PrintStream out)
Prints the given list to the specified PrintStream.
|
static DoubleVector |
project(DoubleVector v,
BitSet selectedAttributes)
Provides a new DoubleVector as a projection on the specified attributes.
|
static <V extends SparseNumberVector<V,?>> |
project(V v,
BitSet selectedAttributes)
Provides a new SparseFloatVector as a projection on the specified
attributes.
|
static BitSet |
randomBitSet(int cardinality,
int capacity,
Random random)
Creates a new BitSet of fixed cardinality with randomly set bits.
|
private static final Comparator<?> FORWARD
public static double[] copy(double[] array)
array - an array to copypublic static double[] parseDoubles(String s)
Double array initialized to the values
represented by the specified String and separated by comma, as
performed by the valueOf method of class Double.s - the string to be parsed.Double array represented by spublic static <O> void print(List<O> list, String separator, PrintStream out)
O - object classlist - the list to be printedseparator - the separator to separate entries of the listout - the target PrintStreampublic static BitSet randomBitSet(int cardinality, int capacity, Random random)
cardinality - the cardinality of the BitSet to createcapacity - the capacity of the BitSet to create - the randomly
generated indices of the bits set to true will be uniformly
distributed between 0 (inclusive) and capacity (exclusive)random - a Random Object to create the sequence of indices set to true
- the same number occurring twice or more is ignored but the already
selected bit remains truepublic static DoubleVector project(DoubleVector v, BitSet selectedAttributes)
null, the same
ID is set in the returned new DoubleVector. Nevertheless, the returned
DoubleVector is not backed by the given DoubleVector, i.e., any changes
affecting v after calling this method will not affect the
newly returned DoubleVector.v - a DoubleVector to projectselectedAttributes - the attributes selected for projectionIllegalArgumentException - if the given selected attributes specify
an attribute as selected which is out of range for the given
DoubleVector.DoubleVector.doubleValue(int)public static <V extends SparseNumberVector<V,?>> V project(V v, BitSet selectedAttributes)
null, the
same ID is set in the returned new SparseFloatVector. Nevertheless, the
returned SparseFloatVector is not backed by the given SparseFloatVector,
i.e., any changes affecting v after calling this method will
not affect the newly returned SparseFloatVector.v - a SparseFloatVector to projectselectedAttributes - the attributes selected for projectionIllegalArgumentException - if the given selected attributes specify
an attribute as selected which is out of range for the given
SparseFloatVector.public static final int mixHashCodes(int... hash)
hash - Hashcodes to mixpublic static final <T> Comparator<T> forwardOrder()
Collections.reverseOrder() for a reverse comparator.