public class DoubleTuples extends Object
DoubleTuples.result
tuple as the last parameter. Unless otherwise noted, this tuple will be
returned by the function call. If the given result tuple is
null, then a new tuple will be created and returned.result tuple may be identical
to any of the input tuples.
null| Modifier and Type | Method and Description |
|---|---|
static MutableDoubleTuple |
add(DoubleTuple t0,
double value,
MutableDoubleTuple result)
Add the given value to all elements of the given input
tuples, and store the result in the given result tuple.
|
static MutableDoubleTuple |
add(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Add the given input tuples, and store the result in
the given result tuple.
|
static MutableDoubleTuple |
addScaled(DoubleTuple t0,
double factor,
DoubleTuple t1,
MutableDoubleTuple result)
Computes
t0+factor*t1, and stores the result in the given
result tuple. |
static boolean |
areElementsGreaterThan(DoubleTuple t,
double value)
Returns whether all elements of the given tuple
are greater than the given value.
|
static boolean |
areElementsGreaterThan(DoubleTuple t0,
DoubleTuple t1)
Returns whether one tuple is element-wise
greater than the other.
|
static boolean |
areElementsGreaterThanOrEqual(DoubleTuple t,
double value)
Returns whether all elements of the given tuple
are greater than or equal to the given value.
|
static boolean |
areElementsGreaterThanOrEqual(DoubleTuple t0,
DoubleTuple t1)
Returns whether one tuple is element-wise
greater than or equal to the other.
|
static boolean |
areElementsLessThan(DoubleTuple t,
double value)
Returns whether all elements of the given tuple
are less than the given value.
|
static boolean |
areElementsLessThan(DoubleTuple t0,
DoubleTuple t1)
Returns whether one tuple is element-wise
less than the other
|
static boolean |
areElementsLessThanOrEqual(DoubleTuple t,
double value)
Returns whether all elements of the given tuple
are less than or equal to the given value.
|
static boolean |
areElementsLessThanOrEqual(DoubleTuple t0,
DoubleTuple t1)
Returns whether one tuple is element-wise
less than or equal to the other
|
static double |
arithmeticMean(DoubleTuple t)
Returns the arithmetic mean of the given tuple
|
static List<Double> |
asList(DoubleTuple t)
Returns a view on the given tuple as an unmodifiable list.
|
static List<Double> |
asList(MutableDoubleTuple t)
Returns a view on the given tuple as a list that does not
allow structural modifications.
|
static MutableDoubleTuple |
clamp(DoubleTuple t,
double min,
double max,
MutableDoubleTuple result)
Clamp the components of the given tuple to be in the specified range,
and write the result into the given result tuple.
|
static MutableDoubleTuple |
clamp(DoubleTuple t,
DoubleTuple min,
DoubleTuple max,
MutableDoubleTuple result)
Clamp the components of the given tuple to be in the specified range,
and write the result into the given result tuple.
|
static Comparator<DoubleTuple> |
comparator(Order order)
Returns a comparator that compares tuples based on the specified
Order. |
static int |
compareColexicographically(DoubleTuple t0,
DoubleTuple t1)
Compares two tuples colexicographically, starting with
the elements of the highest index.
|
static int |
compareLexicographically(DoubleTuple t0,
DoubleTuple t1)
Compares two tuples lexicographically, starting with
the elements of the lowest index.
|
static double |
computeL2(DoubleTuple t)
Computes the L2 norm (euclidean length) of the given tuple
|
static DoubleTuple |
constant(int size,
double value)
Returns a tuple with the specified size, where each
element is the given value.
|
static boolean |
containsNaN(DoubleTuple tuple)
Returns whether the given tuple contains an element that
is Not A Number
|
static MutableDoubleTuple |
copy(DoubleTuple other)
Creates a new tuple which is a copy of
the given one.
|
static MutableDoubleTuple |
create(int size)
Creates a new tuple with the given size.
|
static MutableDoubleTuple |
createRandom(int size,
double min,
double max,
Random random)
Creates a tuple with the given size that
is filled with random values in the given range.
|
static MutableDoubleTuple |
createRandom(int size,
Random random)
Creates a tuple with the given size that
is filled with random values in [0,1)
|
static MutableDoubleTuple |
createRandomGaussian(int size,
Random random)
Creates a tuple with the given size
that was filled with values from a gaussian
distribution with mean 0.0 and standard deviation 1.0
|
static MutableDoubleTuple |
divide(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Divide the elements of the given input tuples, and store
the results in the given result tuple.
|
static double |
dot(DoubleTuple t0,
DoubleTuple t1)
Computes the dot product of the given tuples
|
static MutableDoubleTuple |
interpolate(DoubleTuple t0,
DoubleTuple t1,
double alpha,
MutableDoubleTuple result)
Computes
t0+alpha*(t1-t0), and stores the result in
the given result tuple. |
static double |
max(DoubleTuple t)
Computes the maximum value that occurs in the given tuple,
or
Double.NEGATIVE_INFINITY if the given tuple has a
size of 0. |
static MutableDoubleTuple |
max(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Compute the element-wise maximum of the the given input
tuples, and store the result in the given
result tuple.
|
static double |
min(DoubleTuple t)
Computes the minimum value that occurs in the given tuple,
or
Double.POSITIVE_INFINITY if the given tuple has a
size of 0. |
static MutableDoubleTuple |
min(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Compute the element-wise minimum of the the given input
tuples, and store the result in the given
result tuple.
|
static MutableDoubleTuple |
multiply(DoubleTuple t0,
double factor,
MutableDoubleTuple result)
Multiply the given input tuple with the given factor, and
store the result in the given result tuple.
|
static MutableDoubleTuple |
multiply(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Multiply the elements of the given input tuples, and store
the results in the given result tuple.
|
static MutableDoubleTuple |
negate(DoubleTuple t0,
MutableDoubleTuple result)
Negates the given tuple, and store the result in the given result tuple.
|
static MutableDoubleTuple |
normalize(DoubleTuple t,
MutableDoubleTuple result)
Normalize the given tuple and write the result into
the given result tuple.
|
static MutableDoubleTuple |
normalizeElements(DoubleTuple t,
double min,
double max,
MutableDoubleTuple result)
Normalize the elements of the given tuple, so that its minimum and
maximum elements match the given minimum and maximum values.
|
static MutableDoubleTuple |
normalizeElements(DoubleTuple t,
DoubleTuple min,
DoubleTuple max,
MutableDoubleTuple result)
Normalize the elements of the given tuple, so that each element
will be linearly rescaled to the interval defined by the corresponding
elements of the given minimum and maximum tuple.
|
static MutableDoubleTuple |
of(double... values)
Creates a new tuple with the given values.
|
static void |
randomize(MutableDoubleTuple t,
double min,
double max,
Random random)
Fill the given tuple with random values in
the specified range, using the given random number generator
|
static void |
randomize(MutableDoubleTuple t,
Random random)
Fill the given tuple with random values in
[0,1), using the given random number generator
|
static void |
randomizeGaussian(MutableDoubleTuple t,
Random random)
Randomize the given tuple with a gaussian
distribution with a mean of 0.0 and standard deviation of 1.0
|
static MutableDoubleTuple |
rescaleElements(DoubleTuple t,
double oldMin,
double oldMax,
double newMin,
double newMax,
MutableDoubleTuple result)
Rescale the elements of the given tuple, so that the specified
old range is mapped to the specified new range.
|
static MutableDoubleTuple |
reverse(DoubleTuple t,
MutableDoubleTuple result)
Reverse the given tuple.
|
static DoubleTuple |
reversed(DoubleTuple t)
Creates a new tuple that is a reversed view on the given
tuple.
|
static MutableDoubleTuple |
reversed(MutableDoubleTuple t)
Creates a new tuple that is a reversed view on the given
tuple.
|
static void |
set(MutableDoubleTuple t,
double v)
Set all elements of the given tuple to the given value
|
static double |
standardDeviation(DoubleTuple t)
Returns the standard deviation of the given tuple.
|
static double |
standardDeviationFromMean(DoubleTuple t,
double mean)
Returns the standard deviation of the given tuple.
|
static MutableDoubleTuple |
standardDeviationFromVariance(DoubleTuple variance,
MutableDoubleTuple result)
Returns the standard deviation of the given variances (that is,
a tuple containing the square roots of the values in the given
tuple).
|
static MutableDoubleTuple |
standardize(DoubleTuple t,
MutableDoubleTuple result)
Standardize the given tuple.
|
static MutableDoubleTuple |
subtract(DoubleTuple t0,
double value,
MutableDoubleTuple result)
Subtract the given value from all elements of the given input
tuple, and store the result in the given result tuple.
|
static MutableDoubleTuple |
subtract(DoubleTuple t0,
DoubleTuple t1,
MutableDoubleTuple result)
Subtract the given input tuples, and store the result in
the given result tuple.
|
static double[] |
toArray(DoubleTuple t)
Creates a new array from the contents of the given tuple
|
static String |
toString(DoubleTuple tuple,
int maxNumLeadingElements,
int maxNumTrailingElements)
Returns a string representation of the given tuple using
toString(DoubleTuple, Locale, String, int, int) with
the default locale and format. |
static String |
toString(DoubleTuple tuple,
Locale locale,
String format,
int maxNumLeadingElements,
int maxNumTrailingElements)
Returns a string representation of the given tuple.
|
static double |
variance(DoubleTuple t)
Returns the variance of the given tuple.
|
static double |
variance(DoubleTuple t,
double mean)
Returns the variance of the given tuple.
|
static MutableDoubleTuple |
wrap(double... values)
Creates a new tuple that is a view
on the given values.
|
static MutableDoubleTuple |
wrap(double[] data,
int offset,
int size)
Returns a new tuple that is a view on the
specified portion of the given array
|
static MutableDoubleTuple |
wrap(DoubleBuffer buffer)
Returns a new tuple that is a view on the given buffer.
|
static DoubleTuple |
zero(int size)
Returns a tuple with the specified size, containing
all zeros.
|
public static DoubleTuple zero(int size)
size - The sizeIllegalArgumentException - If the size is smaller than 0public static DoubleTuple constant(int size, double value)
size - The sizevalue - The valueIllegalArgumentException - If the size is smaller than 0public static MutableDoubleTuple create(int size)
size - The size.IllegalArgumentException - If the size is smaller than 0public static MutableDoubleTuple copy(DoubleTuple other)
other - The other tuple.NullPointerException - If the other tuple is nullpublic static MutableDoubleTuple of(double... values)
wrap(double...) may be
used.values - The valuesNullPointerException - If the given array is nullpublic static MutableDoubleTuple wrap(double... values)
values - The valuesNullPointerException - If the given array is nullpublic static MutableDoubleTuple wrap(DoubleBuffer buffer)
buffer - The buffer for the tupleNullPointerException - If the given buffer is nullpublic static MutableDoubleTuple wrap(double[] data, int offset, int size)
data - The data for the tupleoffset - The offset in the arraysize - The size of the tupleNullPointerException - If the given data array is nullIllegalArgumentException - If the given offset is negative,
or if offset+size >= data.lengthpublic static double[] toArray(DoubleTuple t)
t - The tuplepublic static List<Double> asList(DoubleTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static List<Double> asList(MutableDoubleTuple t)
null elements.t - The tupleNullPointerException - If the given tuple is nullpublic static void set(MutableDoubleTuple t, double v)
t - The tuplev - The valuepublic static MutableDoubleTuple reverse(DoubleTuple t, MutableDoubleTuple result)
t - The input tupleresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static DoubleTuple reversed(DoubleTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static MutableDoubleTuple reversed(MutableDoubleTuple t)
t - The tupleNullPointerException - If the given tuple is nullpublic static MutableDoubleTuple clamp(DoubleTuple t, double min, double max, MutableDoubleTuple result)
t - The input tuplemin - The minimum valuemax - The maximum valueresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple clamp(DoubleTuple t, DoubleTuple min, DoubleTuple max, MutableDoubleTuple result)
t - The input tuplemin - The minimum valuesmax - The maximum valuesresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple negate(DoubleTuple t0, MutableDoubleTuple result)
t0 - The tuple to negateresult - The tuple that will store the resultpublic static MutableDoubleTuple add(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple subtract(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple multiply(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple divide(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple add(DoubleTuple t0, double value, MutableDoubleTuple result)
t0 - The first input tuplevalue - The value to addresult - The tuple that will store the resultIllegalArgumentException - If the given tuple do not
have the same size
as the result tuplepublic static MutableDoubleTuple subtract(DoubleTuple t0, double value, MutableDoubleTuple result)
t0 - The first input tuplevalue - The value to addresult - The tuple that will store the resultIllegalArgumentException - If the given tuple do not
have the same size
as the result tuplepublic static MutableDoubleTuple multiply(DoubleTuple t0, double factor, MutableDoubleTuple result)
t0 - The input tuplefactor - The scaling factorresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple addScaled(DoubleTuple t0, double factor, DoubleTuple t1, MutableDoubleTuple result)
t0+factor*t1, and stores the result in the given
result tuple.t0 - The first input tuplefactor - The scaling factort1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static double dot(DoubleTuple t0, DoubleTuple t1)
t0 - The first input tuplet1 - The second input tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static double min(DoubleTuple t)
Double.POSITIVE_INFINITY if the given tuple has a
size of 0.t - The input tuplepublic static double max(DoubleTuple t)
Double.NEGATIVE_INFINITY if the given tuple has a
size of 0.t - The input tuplepublic static MutableDoubleTuple min(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple max(DoubleTuple t0, DoubleTuple t1, MutableDoubleTuple result)
t0 - The first input tuplet1 - The second input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static int compareLexicographically(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static int compareColexicographically(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static Comparator<DoubleTuple> comparator(Order order)
Order. If the given order is null, then
null will be returned.order - The Orderpublic static boolean areElementsGreaterThan(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsGreaterThanOrEqual(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsLessThan(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsLessThanOrEqual(DoubleTuple t0, DoubleTuple t1)
t0 - The first tuplet1 - The second tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static boolean areElementsGreaterThan(DoubleTuple t, double value)
t - The tuplevalue - The value to compare topublic static boolean areElementsGreaterThanOrEqual(DoubleTuple t, double value)
t - The tuplevalue - The value to compare topublic static boolean areElementsLessThan(DoubleTuple t, double value)
t - The tuplevalue - The value to compare topublic static boolean areElementsLessThanOrEqual(DoubleTuple t, double value)
t - The tuplevalue - The value to compare topublic static String toString(DoubleTuple tuple, int maxNumLeadingElements, int maxNumTrailingElements)
toString(DoubleTuple, Locale, String, int, int) with
the default locale and format.tuple - The tuplemaxNumLeadingElements - The maximum number of leading elementsmaxNumTrailingElements - The maximum number of trailing elementspublic static String toString(DoubleTuple tuple, Locale locale, String format, int maxNumLeadingElements, int maxNumTrailingElements)
size that is larger than
the sum of the given numbers of leading and trailing elements, then
the string contents will be abbreviated with an ellipsis: "...".toString(t, 3, 1) : (0, 0, 0, ..., 0)toString(t, 2, 0) : (0, 0, ...)toString(t, 0, 2) : (..., 0, 0)toString(t, 9, 9) : (0, 0, 0, 0, 0, 0)tuple - The tuplelocale - The locale. If this is null, then a
canonical string representation of the elements will be used.format - The format. If this is null, then a
canonical string representation of the elements will be used.maxNumLeadingElements - The maximum number of leading elementsmaxNumTrailingElements - The maximum number of trailing elementspublic static void randomize(MutableDoubleTuple t, double min, double max, Random random)
t - The tuple to fillmin - The minimum value, inclusivemax - The maximum value, exclusiverandom - The random number generatorpublic static void randomize(MutableDoubleTuple t, Random random)
t - The tuple to fillrandom - The random number generatorpublic static MutableDoubleTuple createRandom(int size, Random random)
size - The sizerandom - The random number generatorpublic static MutableDoubleTuple createRandom(int size, double min, double max, Random random)
size - The sizemin - The minimum value, inclusivemax - The maximum value, exclusiverandom - The random number generatorpublic static void randomizeGaussian(MutableDoubleTuple t, Random random)
t - The tuple to fillrandom - The random number generatorpublic static MutableDoubleTuple createRandomGaussian(int size, Random random)
size - The sizerandom - The random number generatorpublic static MutableDoubleTuple normalize(DoubleTuple t, MutableDoubleTuple result)
L2 norm.t - The input tupleresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static double computeL2(DoubleTuple t)
t - The tuplepublic static MutableDoubleTuple normalizeElements(DoubleTuple t, double min, double max, MutableDoubleTuple result)
t - The input tuplemin - The minimum valuemax - The maximum valueresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple normalizeElements(DoubleTuple t, DoubleTuple min, DoubleTuple max, MutableDoubleTuple result)
t - The input tuplemin - The minimum valuemax - The maximum valueresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple rescaleElements(DoubleTuple t, double oldMin, double oldMax, double newMin, double newMax, MutableDoubleTuple result)
t - The input tupleoldMin - The old minimum valueoldMax - The old maximum valuenewMin - The new minimum valuenewMax - The new maximum valueresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple interpolate(DoubleTuple t0, DoubleTuple t1, double alpha, MutableDoubleTuple result)
t0+alpha*(t1-t0), and stores the result in
the given result tuple.t0 - The first input tuplet1 - The second input tuplealpha - The interpolation valueresult - The tuple that will store the resultIllegalArgumentException - If the given tuples do not
have the same sizepublic static MutableDoubleTuple standardDeviationFromVariance(DoubleTuple variance, MutableDoubleTuple result)
variance - The input tupleresult - The result tupleIllegalArgumentException - If the given tuples do not have the
same sizepublic static MutableDoubleTuple standardize(DoubleTuple t, MutableDoubleTuple result)
t - The tupleresult - The result tupleIllegalArgumentException - If the given tuples do not
have the same sizepublic static double arithmeticMean(DoubleTuple t)
t - The input tuplepublic static double variance(DoubleTuple t)
variance(DoubleTuple, double) method.t - The input tuplevariance(DoubleTuple, double)public static double variance(DoubleTuple t, double mean)
t - The input tuplemean - The mean, which may have been computed before with
arithmeticMean(DoubleTuple)public static double standardDeviation(DoubleTuple t)
standardDeviationFromMean(DoubleTuple, double)
method.t - The input tuplepublic static double standardDeviationFromMean(DoubleTuple t, double mean)
variance(DoubleTuple), return
the square root of this value.t - The input tuplemean - The mean, which may have been computed before with
arithmeticMean(DoubleTuple)public static boolean containsNaN(DoubleTuple tuple)
tuple - The tupleCopyright © 2015. All Rights Reserved.