public final class ArrayLikeUtil extends Object
Modifier and Type | Field and Description |
---|---|
static ArrayDBIDsAdapter |
ARRAYDBIDADAPTER
Use ArrayDBIDs as array.
|
static NumberArrayAdapter<Double,double[]> |
DOUBLEARRAYADAPTER
Use a double array in the array API.
|
static FeatureVectorAdapter<?> |
FEATUREVECTORADAPTER
Static instance.
|
static FlatMatrixAdapter |
FLATMATRIXADAPTER
Adapter for matrixes, reinterpreted as flat arrays.
|
static NumberArrayAdapter<Float,float[]> |
FLOATARRAYADAPTER
Use a float array in the array API.
|
private static IdentityArrayAdapter<?> |
IDENTITYADAPTER
Static instance.
|
private static ListArrayAdapter<Object> |
LISTADAPTER
Static instance for lists.
|
private static NumberListArrayAdapter<Number> |
NUMBERLISTADAPTER
Static instance for lists of numbers.
|
static NumberVectorAdapter |
NUMBERVECTORADAPTER
Use a number vector in the array API.
|
static NumberArrayAdapter<Double,Vector> |
VECTORADAPTER
Adapter for vectors.
|
Modifier | Constructor and Description |
---|---|
private |
ArrayLikeUtil()
Fake constructor.
|
Modifier and Type | Method and Description |
---|---|
static NumberArrayAdapter<Double,double[]> |
doubleArrayAdapter()
Get the adapter for double arrays.
|
static <F> FeatureVectorAdapter<F> |
featureVectorAdapter(FeatureVector<F> prototype)
Get the static instance.
|
static <A> int |
getIndexOfMaximum(A array,
NumberArrayAdapter<?,A> adapter)
Returns the index of the maximum of the given values.
|
static int |
getIndexOfMaximum(double[] array)
Returns the index of the maximum of the given values.
|
static <T> IdentityArrayAdapter<T> |
identityAdapter(T dummy)
Get the static instance.
|
static <T> ArrayAdapter<T,List<? extends T>> |
listAdapter(List<? extends T> dummy)
Cast the static instance.
|
static <T extends Number> |
numberListAdapter(List<? extends T> dummy)
Cast the static instance.
|
static NumberVectorAdapter |
numberVectorAdapter(NumberVector prototype)
Get the static instance.
|
static <A> double[] |
toPrimitiveDoubleArray(A array,
NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a
double[] . |
static double[] |
toPrimitiveDoubleArray(List<? extends Number> array)
Convert a list of numbers to
double[] . |
static double[] |
toPrimitiveDoubleArray(NumberVector obj)
Convert a number vector to
double[] . |
static <A> float[] |
toPrimitiveFloatArray(A array,
NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a
float[] . |
static float[] |
toPrimitiveFloatArray(List<? extends Number> array)
Convert a list of numbers to
float[] . |
static float[] |
toPrimitiveFloatArray(NumberVector obj)
Convert a number vector to
float[] . |
static <A> int[] |
toPrimitiveIntegerArray(A array,
NumberArrayAdapter<?,? super A> adapter)
Convert a numeric array-like to a
int[] . |
static int[] |
toPrimitiveIntegerArray(List<? extends Number> array)
Convert a list of numbers to
int[] . |
static int[] |
toPrimitiveIntegerArray(NumberVector obj)
Convert a number vector to
int[] . |
private static final ListArrayAdapter<Object> LISTADAPTER
private static final NumberListArrayAdapter<Number> NUMBERLISTADAPTER
private static final IdentityArrayAdapter<?> IDENTITYADAPTER
public static final FeatureVectorAdapter<?> FEATUREVECTORADAPTER
public static final NumberVectorAdapter NUMBERVECTORADAPTER
public static final FlatMatrixAdapter FLATMATRIXADAPTER
public static final NumberArrayAdapter<Double,double[]> DOUBLEARRAYADAPTER
public static final NumberArrayAdapter<Float,float[]> FLOATARRAYADAPTER
public static final ArrayDBIDsAdapter ARRAYDBIDADAPTER
public static final NumberArrayAdapter<Double,Vector> VECTORADAPTER
public static <T> ArrayAdapter<T,List<? extends T>> listAdapter(List<? extends T> dummy)
dummy
- Dummy variable, for type inferencepublic static <T extends Number> NumberArrayAdapter<T,List<? extends T>> numberListAdapter(List<? extends T> dummy)
dummy
- Dummy variable, for type inferencepublic static <T> IdentityArrayAdapter<T> identityAdapter(T dummy)
dummy
- Dummy object for type inferencepublic static <F> FeatureVectorAdapter<F> featureVectorAdapter(FeatureVector<F> prototype)
prototype
- Prototype value, for type inferencepublic static NumberVectorAdapter numberVectorAdapter(NumberVector prototype)
prototype
- Prototype value, for type inferencepublic static NumberArrayAdapter<Double,double[]> doubleArrayAdapter()
public static <A> int getIndexOfMaximum(A array, NumberArrayAdapter<?,A> adapter) throws IndexOutOfBoundsException
A
- array typearray
- Array to inspectadapter
- API adapter classIndexOutOfBoundsException
- if the length of the array is 0.public static int getIndexOfMaximum(double[] array) throws IndexOutOfBoundsException
array
- Array to inspectIndexOutOfBoundsException
- if the length of the array is 0.public static <A> double[] toPrimitiveDoubleArray(A array, NumberArrayAdapter<?,? super A> adapter)
double[]
.array
- Array-likeadapter
- Adapterpublic static double[] toPrimitiveDoubleArray(List<? extends Number> array)
double[]
.array
- List of numberspublic static double[] toPrimitiveDoubleArray(NumberVector obj)
double[]
.obj
- Object to convertpublic static <A> float[] toPrimitiveFloatArray(A array, NumberArrayAdapter<?,? super A> adapter)
float[]
.array
- Array-likeadapter
- Adapterpublic static float[] toPrimitiveFloatArray(List<? extends Number> array)
float[]
.array
- List of numberspublic static float[] toPrimitiveFloatArray(NumberVector obj)
float[]
.obj
- Object to convertpublic static <A> int[] toPrimitiveIntegerArray(A array, NumberArrayAdapter<?,? super A> adapter)
int[]
.array
- Array-likeadapter
- Adapterpublic static int[] toPrimitiveIntegerArray(List<? extends Number> array)
int[]
.array
- List of numberspublic static int[] toPrimitiveIntegerArray(NumberVector obj)
int[]
.obj
- Object to convertCopyright © 2015 ELKI Development Team, Lehr- und Forschungseinheit für Datenbanksysteme, Ludwig-Maximilians-Universität München. License information.