public class Math
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
static int |
DIGITS
The number of digits (in radix base) in the mantissa.
|
static double |
E
The base of the natural logarithms.
|
static double |
EPSILON
The machine precision for the double type, which is the difference between 1
and the smallest value greater than 1 that is representable for the double type.
|
static int |
MACHEP
The largest negative integer such that 1.0 + RADIXMACHEP ≠ 1.0,
except that machep is bounded below by -(DIGITS+3)
|
static int |
NEGEP
The largest negative integer such that 1.0 - RADIXNEGEP ≠ 1.0,
except that negeps is bounded below by -(DIGITS+3)
|
static double |
PI
The ratio of the circumference of a circle to its diameter.
|
static int |
RADIX
The base of the exponent of the double type.
|
static int |
ROUND_STYLE
Rounding style.
|
| Modifier and Type | Method and Description |
|---|---|
static double[][] |
aatmm(double[][] A)
Matrix multiplication A * A' according to the rules of linear algebra.
|
static void |
aatmm(double[][] A,
double[][] C)
Matrix multiplication C = A * A' according to the rules of linear algebra.
|
static double[][] |
abmm(double[][] A,
double[][] B)
Matrix multiplication A * B according to the rules of linear algebra.
|
static void |
abmm(double[][] A,
double[][] B,
double[][] C)
Matrix multiplication C = A * B according to the rules of linear algebra.
|
static double |
abs(double a)
Returns the absolute value of a double value.
|
static float |
abs(float a)
Returns the absolute value of a float value.
|
static int |
abs(int a)
Returns the absolute value of an int value.
|
static long |
abs(long a)
Returns the absolute value of a long value.
|
static double[][] |
abtmm(double[][] A,
double[][] B)
Matrix multiplication A * B' according to the rules of linear algebra.
|
static void |
abtmm(double[][] A,
double[][] B,
double[][] C)
Matrix multiplication C = A * B' according to the rules of linear algebra.
|
static double |
acos(double a)
Returns the arc cosine of an angle, in the range of 0.0 through pi.
|
static boolean |
all(boolean[] x)
Given a set of boolean values, are all of the values true?
|
static boolean |
any(boolean[] x)
Given a set of boolean values, is at least one of the values true?
|
static double |
asin(double a)
Returns the arc sine of an angle, in the range of -pi/2 through pi/2.
|
static double[][] |
atamm(double[][] A)
Matrix multiplication A' * A according to the rules of linear algebra.
|
static void |
atamm(double[][] A,
double[][] C)
Matrix multiplication C = A' * A according to the rules of linear algebra.
|
static double |
atan(double a)
Returns the arc tangent of an angle, in the range of -pi/2 through pi/2.
|
static double |
atan2(double y,
double x)
Converts rectangular coordinates (x, y) to polar (r, theta).
|
static double[][] |
atbmm(double[][] A,
double[][] B)
Matrix multiplication A' * B according to the rules of linear algebra.
|
static void |
atbmm(double[][] A,
double[][] B,
double[][] C)
Matrix multiplication C = A' * B according to the rules of linear algebra.
|
static double[][] |
atbtmm(double[][] A,
double[][] B)
Matrix multiplication A' * B' according to the rules of linear algebra.
|
static void |
atbtmm(double[][] A,
double[][] B,
double[][] C)
Matrix multiplication C = A' * B' according to the rules of linear algebra.
|
static double[] |
atx(double[][] A,
double[] x,
double[] y)
Product of a matrix and a vector y = AT * x according to the rules of linear algebra.
|
static double[] |
atxpy(double[][] A,
double[] x,
double[] y)
Product of a matrix and a vector y = AT * x + y according to the rules of linear algebra.
|
static double[] |
atxpy(double[][] A,
double[] x,
double[] y,
double b)
Product of a matrix and a vector y = AT * x + b * y according to the rules of linear algebra.
|
static double[] |
ax(double[][] A,
double[] x,
double[] y)
Product of a matrix and a vector y = A * x according to the rules of linear algebra.
|
static double[] |
axpy(double[][] A,
double[] x,
double[] y)
Product of a matrix and a vector y = A * x + y according to the rules of linear algebra.
|
static double[] |
axpy(double[][] A,
double[] x,
double[] y,
double b)
Product of a matrix and a vector y = A * x + b * y according to the rules of linear algebra.
|
static double[] |
axpy(double a,
double[] x,
double[] y)
Update an array by adding a multiple of another array y = a * x + y.
|
static double |
cbrt(double a)
Returns the cube root of a double value.
|
static double |
ceil(double a)
Returns the smallest (closest to negative infinity) double value that
is greater than or equal to the argument and is equal to a mathematical
integer.
|
static double |
choose(int n,
int k)
n choose k.
|
static double[][] |
clone(double[][] x)
Deep clone a two-dimensional array.
|
static float[][] |
clone(float[][] x)
Deep clone a two-dimensional array.
|
static int[][] |
clone(int[][] x)
Deep clone a two-dimensional array.
|
static double[] |
colMax(double[][] data)
Returns the column maximum for a matrix.
|
static double[] |
colMean(double[][] data)
Returns the column sums for a matrix.
|
static double[] |
colMin(double[][] data)
Returns the column minimum for a matrix.
|
static double[] |
colSd(double[][] data)
Returns the column deviations for a matrix.
|
static double[] |
colSum(double[][] data)
Returns the column sums for a matrix.
|
static boolean |
contains(double[][] polygon,
double[] point)
Determines if the polygon contains the specified coordinates.
|
static boolean |
contains(double[][] polygon,
double x,
double y)
Determines if the polygon contains the specified coordinates.
|
static void |
copy(double[][] x,
double[][] y)
Copy x into y.
|
static void |
copy(double[] x,
double[] y)
Copy x into y.
|
static void |
copy(float[][] x,
float[][] y)
Copy x into y.
|
static void |
copy(float[] x,
float[] y)
Copy x into y.
|
static void |
copy(int[][] x,
int[][] y)
Copy x into y.
|
static void |
copy(int[] x,
int[] y)
Copy x into y.
|
static double |
copySign(double magnitude,
double sign)
Returns the first floating-point argument with the sign of the second
floating-point argument.
|
static float |
copySign(float magnitude,
float sign)
Returns the first floating-point argument with the sign of the second
floating-point argument.
|
static double[][] |
cor(double[][] data)
Returns the sample correlation matrix.
|
static double[][] |
cor(double[][] data,
double[] mu)
Returns the sample correlation matrix.
|
static double |
cor(double[] x,
double[] y)
Returns the correlation coefficient between two vectors.
|
static double |
cor(float[] x,
float[] y)
Returns the correlation coefficient between two vectors.
|
static double |
cor(int[] x,
int[] y)
Returns the correlation coefficient between two vectors.
|
static double |
cos(double a)
Returns the trigonometric cosine of an angle.
|
static double |
cosh(double x)
Returns the hyperbolic cosine of a double value.
|
static double[][] |
cov(double[][] data)
Returns the sample covariance matrix.
|
static double[][] |
cov(double[][] data,
double[] mu)
Returns the sample covariance matrix.
|
static double |
cov(double[] x,
double[] y)
Returns the covariance between two vectors.
|
static double |
cov(float[] x,
float[] y)
Returns the covariance between two vectors.
|
static double |
cov(int[] x,
int[] y)
Returns the covariance between two vectors.
|
static double |
det(double[][] A)
Returns the matrix determinant
|
static double |
distance(double[] x,
double[] y)
The Euclidean distance.
|
static double |
distance(float[] x,
float[] y)
The Euclidean distance.
|
static double |
distance(int[] x,
int[] y)
The Euclidean distance.
|
static double |
distance(SparseArray x,
SparseArray y)
The Euclidean distance.
|
static double |
dot(double[] x,
double[] y)
Returns the dot product between two vectors.
|
static double |
dot(float[] x,
float[] y)
Returns the dot product between two vectors.
|
static double |
dot(int[] x,
int[] y)
Returns the dot product between two vectors.
|
static double |
dot(SparseArray x,
SparseArray y)
Returns the dot product between two sparse arrays.
|
static EigenValueDecomposition |
eigen(double[][] A)
Returns the eigen value decomposition of a square matrix.
|
static EigenValueDecomposition |
eigen(double[][] A,
boolean symmetric)
Returns the eigen value decomposition of a square matrix.
|
static EigenValueDecomposition |
eigen(double[][] A,
boolean symmetric,
boolean onlyValues)
Returns the eigen value decomposition of a square matrix.
|
static double |
eigen(double[][] A,
double[] v)
Returns the largest eigen pair of matrix with the power iteration
under the assumptions A has an eigenvalue that is strictly greater
in magnitude than its other its other eigenvalues and the starting
vector has a nonzero component in the direction of an eigenvector
associated with the dominant eigenvalue.
|
static double |
eigen(double[][] A,
double[] v,
double tol)
Returns the largest eigen pair of matrix with the power iteration
under the assumptions A has an eigenvalue that is strictly greater
in magnitude than its other its other eigenvalues and the starting
vector has a nonzero component in the direction of an eigenvector
associated with the dominant eigenvalue.
|
static EigenValueDecomposition |
eigen(double[][] A,
int k)
Find k largest approximate eigen pairs of a symmetric matrix by an
iterative Lanczos algorithm.
|
static double |
eigen(Matrix A,
double[] v)
Returns the largest eigen pair of matrix with the power iteration
under the assumptions A has an eigenvalue that is strictly greater
in magnitude than its other its other eigenvalues and the starting
vector has a nonzero component in the direction of an eigenvector
associated with the dominant eigenvalue.
|
static double |
eigen(Matrix A,
double[] v,
double tol)
Returns the largest eigen pair of matrix with the power iteration
under the assumptions A has an eigenvalue that is strictly greater
in magnitude than its other its other eigenvalues and the starting
vector has a nonzero component in the direction of an eigenvector
associated with the dominant eigenvalue.
|
static EigenValueDecomposition |
eigen(Matrix A,
int k)
Find k largest approximate eigen pairs of a symmetric matrix by an
iterative Lanczos algorithm.
|
static boolean |
equals(double[][] x,
double[][] y)
Check if x element-wisely equals y with default epsilon 1E-10.
|
static boolean |
equals(double[][] x,
double[][] y,
double eps)
Check if x element-wisely equals y.
|
static boolean |
equals(double[] x,
double[] y)
Check if x element-wisely equals y with default epsilon 1E-10.
|
static boolean |
equals(double[] x,
double[] y,
double eps)
Check if x element-wisely equals y.
|
static boolean |
equals(double a,
double b)
Returns true if two double values equals to each other in the system precision.
|
static boolean |
equals(float[][] x,
float[][] y)
Check if x element-wisely equals y with default epsilon 1E-7.
|
static boolean |
equals(float[][] x,
float[][] y,
float epsilon)
Check if x element-wisely equals y.
|
static boolean |
equals(float[] x,
float[] y)
Check if x element-wisely equals y with default epsilon 1E-7.
|
static boolean |
equals(float[] x,
float[] y,
float epsilon)
Check if x element-wisely equals y.
|
static boolean |
equals(int[][] x,
int[][] y)
Check if x element-wisely equals y.
|
static boolean |
equals(int[] x,
int[] y)
Check if x element-wisely equals y.
|
static <T extends java.lang.Comparable<? super T>> |
equals(T[][] x,
T[][] y)
Check if x element-wisely equals y.
|
static <T extends java.lang.Comparable<? super T>> |
equals(T[] x,
T[] y)
Check if x element-wisely equals y.
|
static double |
exp(double a)
Returns Euler's number e raised to the power of a double value.
|
static double |
expm1(double x)
Returns ex-1.
|
static double[][] |
eye(int n)
Returns a square identity matrix of size n.
|
static double[][] |
eye(int m,
int n)
Returns an identity matrix of size m by n.
|
static double |
factorial(int n)
factorial of n
|
static double |
floor(double a)
Returns the largest (closest to positive infinity) double value that
is less than or equal to the argument and is equal to a mathematical
integer.
|
static int |
getExponent(double d)
Returns the unbiased exponent used in the representation of a double.
|
static int |
getExponent(float f)
Returns the unbiased exponent used in the representation of a float.
|
static double |
GoodTuring(int[] r,
int[] Nr,
double[] p)
Takes a set of (frequency, frequency-of-frequency) pairs, and applies
the "Simple Good-Turing" technique for estimating the probabilities
corresponding to the observed frequencies, and P0, the joint
probability of all unobserved species.
|
static double |
hypot(double x,
double y)
Returns sqrt(x2 +y2) without intermediate overflow or underflow.
|
static double |
IEEEremainder(double f1,
double f2)
Computes the remainder operation on two arguments as prescribed by the IEEE 754 standard.
|
static DenseMatrix |
inverse(double[][] A)
Returns the matrix inverse or pseudo inverse.
|
static boolean |
isPower2(int x)
Returns true if x is a power of 2.
|
static boolean |
isZero(double x)
Tests if a floating number is zero.
|
static boolean |
isZero(double x,
double epsilon)
Tests if a floating number is zero with given epsilon.
|
static boolean |
isZero(float x)
Tests if a floating number is zero.
|
static boolean |
isZero(float x,
float epsilon)
Tests if a floating number is zero with given epsilon.
|
static double |
JensenShannonDivergence(double[] x,
double[] y)
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where
M = (P+Q)/2.
|
static double |
JensenShannonDivergence(double[] x,
SparseArray y)
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where
M = (P+Q)/2.
|
static double |
JensenShannonDivergence(SparseArray x,
double[] y)
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where
M = (P+Q)/2.
|
static double |
JensenShannonDivergence(SparseArray x,
SparseArray y)
Jensen-Shannon divergence JS(P||Q) = (KL(P||M) + KL(Q||M)) / 2, where
M = (P+Q)/2.
|
static double |
kendall(double[] x,
double[] y)
The Kendall Tau Rank Correlation Coefficient is used to measure the
degree of correspondence between sets of rankings where the measures
are not equidistant.
|
static double |
kendall(float[] x,
float[] y)
The Kendall Tau Rank Correlation Coefficient is used to measure the
degree of correspondence between sets of rankings where the measures
are not equidistant.
|
static double |
kendall(int[] x,
int[] y)
The Kendall Tau Rank Correlation Coefficient is used to measure the
degree of correspondence between sets of rankings where the measures
are not equidistant.
|
static double |
KullbackLeiblerDivergence(double[] x,
double[] y)
Kullback-Leibler divergence.
|
static double |
KullbackLeiblerDivergence(double[] x,
SparseArray y)
Kullback-Leibler divergence.
|
static double |
KullbackLeiblerDivergence(SparseArray x,
double[] y)
Kullback-Leibler divergence.
|
static double |
KullbackLeiblerDivergence(SparseArray x,
SparseArray y)
Kullback-Leibler divergence.
|
static double |
log(double a)
Returns the natural logarithm (base e) of a double value.
|
static double |
log10(double a)
Returns the base 10 logarithm of a double value.
|
static double |
log1p(double x)
Returns the natural logarithm of the sum of the argument and 1.
|
static double |
log2(double x)
Log of base 2.
|
static double |
logChoose(int n,
int k)
log of n choose k
|
static double |
logFactorial(int n)
log of factorial of n
|
static double |
logistic(double x)
Logistic sigmoid function.
|
static double |
mad(double[] x)
Returns the median absolute deviation (MAD).
|
static double |
mad(float[] x)
Returns the median absolute deviation (MAD).
|
static double |
mad(int[] x)
Returns the median absolute deviation (MAD).
|
static double |
max(double[] x)
Returns the maximum value of an array.
|
static double |
max(double[][] matrix)
Returns the maximum of a matrix.
|
static double |
max(double a,
double b)
Returns the greater of two double values.
|
static double |
max(double a,
double b,
double c)
maximum of 3 doubles
|
static float |
max(float[] x)
Returns the maximum value of an array.
|
static float |
max(float a,
float b)
Returns the greater of two float values.
|
static float |
max(float a,
float b,
float c)
maximum of 3 floats
|
static int |
max(int[] x)
Returns the maximum value of an array.
|
static int |
max(int[][] matrix)
Returns the maximum of a matrix.
|
static int |
max(int a,
int b)
Returns the greater of two int values.
|
static int |
max(int a,
int b,
int c)
maximum of 3 integers
|
static long |
max(long a,
long b)
Returns the greater of two long values.
|
static double |
mean(double[] x)
Returns the mean of an array.
|
static double |
mean(float[] x)
Returns the mean of an array.
|
static double |
mean(int[] x)
Returns the mean of an array.
|
static double |
median(double[] a)
Find the median of an array of type double.
|
static float |
median(float[] a)
Find the median of an array of type float.
|
static int |
median(int[] a)
Find the median of an array of type int.
|
static <T extends java.lang.Comparable<? super T>> |
median(T[] a)
Find the median of an array of type double.
|
static double |
min(DifferentiableMultivariateFunction func,
double[] x,
double gtol)
This method solves the unconstrained minimization problem
|
static double |
min(DifferentiableMultivariateFunction func,
double[] x,
double gtol,
int maxIter)
This method solves the unconstrained minimization problem
|
static double |
min(DifferentiableMultivariateFunction func,
int m,
double[] x,
double gtol)
This method solves the unconstrained minimization problem
|
static double |
min(DifferentiableMultivariateFunction func,
int m,
double[] x,
double gtol,
int maxIter)
This method solves the unconstrained minimization problem
|
static double |
min(double[] x)
Returns the minimum value of an array.
|
static double |
min(double[][] matrix)
Returns the minimum of a matrix.
|
static double |
min(double a,
double b)
Returns the smaller of two double values.
|
static double |
min(double a,
double b,
double c)
minimum of 3 doubles
|
static float |
min(float[] x)
Returns the minimum value of an array.
|
static float |
min(float a,
float b)
Returns the smaller of two float values.
|
static double |
min(float a,
float b,
float c)
minimum of 3 floats
|
static int |
min(int[] x)
Returns the minimum value of an array.
|
static int |
min(int[][] matrix)
Returns the minimum of a matrix.
|
static int |
min(int a,
int b)
Returns the smaller of two int values.
|
static int |
min(int a,
int b,
int c)
minimum of 3 integers
|
static long |
min(long a,
long b)
Returns the smaller of two long values.
|
static void |
minus(double[][] y,
double[][] x)
Element-wise subtraction of two matrices y = y - x.
|
static void |
minus(double[] y,
double[] x)
Element-wise subtraction of two arrays y = y - x.
|
static double |
nextAfter(double start,
double direction)
Returns the floating-point number adjacent to the first argument in
the direction of the second argument.
|
static float |
nextAfter(float start,
double direction)
Returns the floating-point number adjacent to the first argument in
the direction of the second argument.
|
static double |
nextUp(double d)
Returns the floating-point value adjacent to d in the direction
of positive infinity.
|
static float |
nextUp(float f)
Returns the floating-point value adjacent to f in the direction
of positive infinity.
|
static double |
norm(double[] x)
L2 vector norm.
|
static double |
norm(double[][] x)
L2 matrix norm.
|
static double |
norm1(double[] x)
L1 vector norm.
|
static double |
norm1(double[][] x)
L1 matrix norm.
|
static double |
norm2(double[] x)
L2 vector norm.
|
static double |
norm2(double[][] x)
L2 matrix norm.
|
static java.util.function.Function<double[],double[]> |
normalize(double[][] x,
boolean centerizing)
Unitizes each column of a matrix to unit length (L_2 norm).
|
static double |
normFro(double[][] x)
Frobenius matrix norm.
|
static double |
normInf(double[] x)
L-infinity vector norm.
|
static double |
normInf(double[][] x)
Infinity matrix norm.
|
static void |
permutate(double[] x)
Generates a permutation of given array.
|
static void |
permutate(float[] x)
Generates a permutation of given array.
|
static int[] |
permutate(int n)
Generates a permutation of 0, 1, 2, ..., n-1, which is useful for
sampling without replacement.
|
static void |
permutate(int[] x)
Generates a permutation of given array.
|
static void |
permutate(java.lang.Object[] x)
Generates a permutation of given array.
|
static void |
plus(double[][] y,
double[][] x)
Element-wise sum of two matrices y = x + y.
|
static void |
plus(double[] y,
double[] x)
Element-wise sum of two arrays y = x + y.
|
static double[][] |
pow(double[][] x,
double n)
Raise each element of a matrix to a scalar power.
|
static double[] |
pow(double[] x,
double n)
Raise each element of an array to a scalar power.
|
static double |
pow(double a,
double b)
Returns the value of the first argument raised to the power of the second argument.
|
static double |
q1(double[] a)
Find the first quantile (p = 1/4) of an array of type double.
|
static float |
q1(float[] a)
Find the first quantile (p = 1/4) of an array of type float.
|
static int |
q1(int[] a)
Find the first quantile (p = 1/4) of an array of type int.
|
static <T extends java.lang.Comparable<? super T>> |
q1(T[] a)
Find the first quantile (p = 1/4) of an array of type double.
|
static double |
q3(double[] a)
Find the third quantile (p = 3/4) of an array of type double.
|
static float |
q3(float[] a)
Find the third quantile (p = 3/4) of an array of type float.
|
static int |
q3(int[] a)
Find the third quantile (p = 3/4) of an array of type int.
|
static <T extends java.lang.Comparable<? super T>> |
q3(T[] a)
Find the third quantile (p = 3/4) of an array of type double.
|
static double |
random()
Generate a random number in [0, 1).
|
static int |
random(double[] prob)
Given a set of n probabilities, generate a random number in [0, n).
|
static int[] |
random(double[] prob,
int n)
Given a set of m probabilities, draw with replacement a set of n random
number in [0, m).
|
static double |
random(double lo,
double hi)
Generate a uniform random number in the range [lo, hi).
|
static double[] |
random(double lo,
double hi,
int n)
Generate n uniform random numbers in the range [lo, hi).
|
static double[] |
random(int n)
Generate n random numbers in [0, 1).
|
static int |
randomInt(int n)
Returns a random integer in [0, n).
|
static int |
randomInt(int lo,
int hi)
Returns a random integer in [lo, hi).
|
static int |
rank(double[][] A)
Returns the matrix rank.
|
static java.util.function.Function<double[],double[]> |
rescale(double[][] x)
Rescales each column of a matrix to range [0, 1].
|
static java.util.function.Function<double[],double[]> |
rescale(double[][] x,
double lo,
double hi)
Rescales each column of a matrix to range [lo, hi].
|
static void |
reverse(double[] a)
Reverses the order of the elements in the specified array.
|
static void |
reverse(float[] a)
Reverses the order of the elements in the specified array.
|
static void |
reverse(int[] a)
Reverses the order of the elements in the specified array.
|
static <T> void |
reverse(T[] a)
Reverses the order of the elements in the specified array.
|
static double |
rint(double a)
Returns the double value that is closest in value to the argument and is equal to a mathematical integer.
|
static double |
root(DifferentiableFunction func,
double x1,
double x2,
double tol)
Returns the root of a function whose derivative is available known
to lie between x1 and x2 by Newton-Raphson method.
|
static double |
root(DifferentiableFunction func,
double x1,
double x2,
double tol,
int maxIter)
Returns the root of a function whose derivative is available known
to lie between x1 and x2 by Newton-Raphson method.
|
static double |
root(Function func,
double x1,
double x2,
double tol)
Returns the root of a function known to lie between x1 and x2 by
Brent's method.
|
static double |
root(Function func,
double x1,
double x2,
double tol,
int maxIter)
Returns the root of a function known to lie between x1 and x2 by
Brent's method.
|
static long |
round(double a)
Returns the closest long to the argument.
|
static double |
round(double x,
int decimal)
Round a double vale to given digits such as 10^n, where n is a positive
or negative integer.
|
static int |
round(float a)
Returns the closest int to the argument.
|
static double[] |
rowMax(double[][] data)
Returns the row maximum for a matrix.
|
static double[] |
rowMean(double[][] data)
Returns the row means for a matrix.
|
static double[] |
rowMin(double[][] data)
Returns the row minimum for a matrix.
|
static double[] |
rowSd(double[][] data)
Returns the row standard deviations for a matrix.
|
static double[] |
rowSum(double[][] data)
Returns the row sums for a matrix.
|
static double |
scalb(double d,
int scaleFactor)
Returns d x 2scaleFactor rounded as if performed by a single
correctly rounded floating-point multiply to a member of the double value
set.
|
static float |
scalb(float f,
int scaleFactor)
Returns f x 2scaleFactor rounded as if performed by a single
correctly rounded floating-point multiply to a member of the float value
set.
|
static void |
scale(double a,
double[] x)
Scale each element of an array by a constant x = a * x.
|
static void |
scale(double a,
double[] x,
double[] y)
Scale each element of an array by a constant y = a * x.
|
static double |
sd(double[] x)
Returns the standard deviation of an array.
|
static double |
sd(float[] x)
Returns the standard deviation of an array.
|
static double |
sd(int[] x)
Returns the standard deviation of an array.
|
static void |
setSeed(long seed)
Initialize the random generator with a seed.
|
static double |
signum(double d)
Returns the signum of the argument; zero if the argument is
zero, 1.0 if the argument is greater than zero, -1.0 if the argument
is less than zero.
|
static float |
signum(float f)
Returns the signum function of the argument; zero if the argument is
zero, 1.0f if the argument is greater than zero, -1.0f if the argument
is less than zero.
|
static double |
sin(double a)
Returns the trigonometric sine of an angle.
|
static double |
sinh(double x)
Returns the hyperbolic sine of a double value.
|
static double[] |
slice(double[] data,
int[] index)
Returns a slice of data for given indices.
|
static <E> E[] |
slice(E[] data,
int[] index)
Returns a slice of data for given indices.
|
static float[] |
slice(float[] data,
int[] index)
Returns a slice of data for given indices.
|
static int[] |
slice(int[] data,
int[] index)
Returns a slice of data for given indices.
|
static double[] |
solve(double[][] A,
double[] b)
Solve A*x = b (exact solution if A is square, least squares
solution otherwise), which means the LU or QR decomposition will take
place in A and the results will be stored in b.
|
static DenseMatrix |
solve(double[][] A,
double[][] B)
Solve A*X = B (exact solution if A is square, least squares
solution otherwise), which means the LU or QR decomposition will take
place in A and the results will be stored in B.
|
static double[] |
solve(double[] a,
double[] b,
double[] c,
double[] r)
Solve the tridiagonal linear set which is of diagonal dominance
|bi| > |ai| + |ci|.
|
static int[][] |
sort(double[][] x)
Sorts each variable and returns the index of values in ascending order.
|
static double |
spearman(double[] x,
double[] y)
The Spearman Rank Correlation Coefficient is a form of the Pearson
coefficient with the data converted to rankings (ie.
|
static double |
spearman(float[] x,
float[] y)
The Spearman Rank Correlation Coefficient is a form of the Pearson
coefficient with the data converted to rankings (ie.
|
static double |
spearman(int[] x,
int[] y)
The Spearman Rank Correlation Coefficient is a form of the Pearson
coefficient with the data converted to rankings (ie.
|
static double |
sqr(double x)
Returns x * x.
|
static double |
sqrt(double a)
Returns the correctly rounded positive square root of a double value.
|
static double |
squaredDistance(double[] x,
double[] y)
The squared Euclidean distance.
|
static double |
squaredDistance(float[] x,
float[] y)
The squared Euclidean distance.
|
static double |
squaredDistance(int[] x,
int[] y)
The squared Euclidean distance.
|
static double |
squaredDistance(SparseArray x,
SparseArray y)
The Euclidean distance.
|
static void |
standardize(double[] x)
Standardizes an array to mean 0 and variance 1.
|
static java.util.function.Function<double[],double[]> |
standardize(double[][] x)
Standardizes each column of a matrix to 0 mean and unit variance.
|
static double |
sum(double[] x)
Returns the sum of an array.
|
static double |
sum(float[] x)
Returns the sum of an array.
|
static int |
sum(int[] x)
Returns the sum of an array.
|
static SingularValueDecomposition |
svd(double[][] A)
Returns the singular value decomposition.
|
static void |
swap(double[] x,
double[] y)
Swap two arrays.
|
static void |
swap(double[] x,
int i,
int j)
Swap two elements of an array.
|
static <E> void |
swap(E[] x,
E[] y)
Swap two arrays.
|
static void |
swap(float[] x,
float[] y)
Swap two arrays.
|
static void |
swap(float[] x,
int i,
int j)
Swap two elements of an array.
|
static void |
swap(int[] x,
int[] y)
Swap two arrays.
|
static void |
swap(int[] x,
int i,
int j)
Swap two elements of an array.
|
static void |
swap(java.lang.Object[] x,
int i,
int j)
Swap two elements of an array.
|
static double |
tan(double a)
Returns the trigonometric tangent of an angle.
|
static double |
tanh(double x)
Returns the hyperbolic tangent of a double value.
|
static double |
toDegrees(double angrad)
Converts an angle measured in radians to an approximately equivalent
angle measured in degrees.
|
static double |
toRadians(double angdeg)
Converts an angle measured in degrees to an approximately equivalent
angle measured in radians.
|
static double |
trace(double[][] A)
Returns the matrix trace.
|
static double[][] |
transpose(double[][] A)
Returns the matrix transpose.
|
static double |
ulp(double d)
Returns the size of an ulp of the argument.
|
static float |
ulp(float f)
* Returns the size of an ulp of the argument.
|
static int[] |
unique(int[] x)
Find unique elements of vector.
|
static java.lang.String[] |
unique(java.lang.String[] x)
Find unique elements of vector.
|
static void |
unitize(double[] x)
Unitize an array so that L2 norm of x = 1.
|
static void |
unitize1(double[] x)
Unitize an array so that L1 norm of x is 1.
|
static void |
unitize2(double[] x)
Unitize an array so that L2 norm of x = 1.
|
static double |
var(double[] x)
Returns the variance of an array.
|
static double |
var(float[] x)
Returns the variance of an array.
|
static double |
var(int[] x)
Returns the variance of an array.
|
static int |
whichMax(double[] x)
Returns the index of maximum value of an array.
|
static int |
whichMax(float[] x)
Returns the index of maximum value of an array.
|
static int |
whichMax(int[] x)
Returns the index of maximum value of an array.
|
static int |
whichMin(double[] x)
Returns the index of minimum value of an array.
|
static int |
whichMin(float[] x)
Returns the index of minimum value of an array.
|
static int |
whichMin(int[] x)
Returns the index of minimum value of an array.
|
static double |
xax(double[][] A,
double[] x)
Returns x' * A * x.
|
public static final double E
public static final double PI
public static double EPSILON
public static int RADIX
public static int DIGITS
public static int ROUND_STYLE
public static int MACHEP
public static int NEGEP
public static double abs(double a)
public static float abs(float a)
public static int abs(int a)
public static long abs(long a)
public static double acos(double a)
public static double asin(double a)
public static double atan(double a)
public static double atan2(double y,
double x)
public static double cbrt(double a)
public static double ceil(double a)
public static double copySign(double magnitude,
double sign)
public static float copySign(float magnitude,
float sign)
public static double cos(double a)
public static double cosh(double x)
public static double exp(double a)
public static double expm1(double x)
public static double floor(double a)
public static int getExponent(double d)
public static int getExponent(float f)
public static double hypot(double x,
double y)
public static double IEEEremainder(double f1,
double f2)
public static double log(double a)
public static double log10(double a)
public static double log1p(double x)
public static double max(double a,
double b)
public static float max(float a,
float b)
public static int max(int a,
int b)
public static long max(long a,
long b)
public static double min(double a,
double b)
public static float min(float a,
float b)
public static int min(int a,
int b)
public static long min(long a,
long b)
public static double nextAfter(double start,
double direction)
public static float nextAfter(float start,
double direction)
public static double nextUp(double d)
public static float nextUp(float f)
public static double pow(double a,
double b)
public static double rint(double a)
public static long round(double a)
public static int round(float a)
public static double scalb(double d,
int scaleFactor)
public static float scalb(float f,
int scaleFactor)
public static double signum(double d)
public static float signum(float f)
public static double sin(double a)
public static double sinh(double x)
public static double sqrt(double a)
public static double tan(double a)
public static double tanh(double x)
public static double toDegrees(double angrad)
public static double toRadians(double angdeg)
public static double ulp(double d)
public static float ulp(float f)
public static double log2(double x)
public static boolean equals(double a,
double b)
a - a double value.b - a double value.public static double logistic(double x)
public static double sqr(double x)
public static boolean isPower2(int x)
public static double round(double x,
int decimal)
public static double factorial(int n)
public static double logFactorial(int n)
public static double choose(int n,
int k)
public static double logChoose(int n,
int k)
public static void setSeed(long seed)
public static int random(double[] prob)
prob - probabilities of size n. The prob argument can be used to
give a vector of weights for obtaining the elements of the vector being
sampled. They need not sum to one, but they should be nonnegative and
not all zero.public static int[] random(double[] prob,
int n)
prob - probabilities of size n. The prob argument can be used to
give a vector of weights for obtaining the elements of the vector being
sampled. They need not sum to one, but they should be nonnegative and
not all zero.public static double random()
public static double[] random(int n)
public static double random(double lo,
double hi)
lo - lower limit of rangehi - upper limit of rangepublic static double[] random(double lo,
double hi,
int n)
n - size of the arraylo - lower limit of rangehi - upper limit of rangepublic static int randomInt(int n)
public static int randomInt(int lo,
int hi)
public static int[] permutate(int n)
public static void permutate(int[] x)
public static void permutate(float[] x)
public static void permutate(double[] x)
public static void permutate(java.lang.Object[] x)
public static <E> E[] slice(E[] data,
int[] index)
public static int[] slice(int[] data,
int[] index)
public static float[] slice(float[] data,
int[] index)
public static double[] slice(double[] data,
int[] index)
public static boolean contains(double[][] polygon,
double[] point)
point - the coordinates of specified point to be tested.public static boolean contains(double[][] polygon,
double x,
double y)
x - the specified x coordinate.y - the specified y coordinate.public static void reverse(int[] a)
a - an array to reverse.public static void reverse(float[] a)
a - an array to reverse.public static void reverse(double[] a)
a - an array to reverse.public static <T> void reverse(T[] a)
a - an array to reverse.public static int min(int a,
int b,
int c)
public static double min(float a,
float b,
float c)
public static double min(double a,
double b,
double c)
public static int max(int a,
int b,
int c)
public static float max(float a,
float b,
float c)
public static double max(double a,
double b,
double c)
public static int min(int[] x)
public static float min(float[] x)
public static double min(double[] x)
public static int whichMin(int[] x)
public static int whichMin(float[] x)
public static int whichMin(double[] x)
public static int max(int[] x)
public static float max(float[] x)
public static double max(double[] x)
public static int whichMax(int[] x)
public static int whichMax(float[] x)
public static int whichMax(double[] x)
public static int min(int[][] matrix)
public static double min(double[][] matrix)
public static int max(int[][] matrix)
public static double max(double[][] matrix)
public static double[] rowMin(double[][] data)
public static double[] rowMax(double[][] data)
public static double[] rowSum(double[][] data)
public static double[] rowMean(double[][] data)
public static double[] rowSd(double[][] data)
public static double[] colMin(double[][] data)
public static double[] colMax(double[][] data)
public static double[] colSum(double[][] data)
public static double[] colMean(double[][] data)
public static double[] colSd(double[][] data)
public static int sum(int[] x)
public static double sum(float[] x)
public static double sum(double[] x)
public static int median(int[] a)
public static float median(float[] a)
public static double median(double[] a)
public static <T extends java.lang.Comparable<? super T>> T median(T[] a)
public static int q1(int[] a)
public static float q1(float[] a)
public static double q1(double[] a)
public static <T extends java.lang.Comparable<? super T>> T q1(T[] a)
public static int q3(int[] a)
public static float q3(float[] a)
public static double q3(double[] a)
public static <T extends java.lang.Comparable<? super T>> T q3(T[] a)
public static double mean(int[] x)
public static double mean(float[] x)
public static double mean(double[] x)
public static double var(int[] x)
public static double var(float[] x)
public static double var(double[] x)
public static double sd(int[] x)
public static double sd(float[] x)
public static double sd(double[] x)
public static double mad(int[] x)
MAD(X) = median(|Xi - median(Xi)|)
that is, starting with the residuals (deviations) from the data's median, the MAD is the median of their absolute values.
MAD is a more robust estimator of scale than the sample variance or standard deviation. For instance, MAD is more resilient to outliers in a data set than the standard deviation. It thus behaves better with distributions without a mean or variance, such as the Cauchy distribution.
In order to use the MAD as a consistent estimator for the estimation of the standard deviation σ, one takes σ = K * MAD, where K is a constant scale factor, which depends on the distribution. For normally distributed data K is taken to be 1.4826. Other distributions behave differently: for example for large samples from a uniform continuous distribution, this factor is about 1.1547.
public static double mad(float[] x)
MAD(X) = median(|Xi - median(Xi)|)
that is, starting with the residuals (deviations) from the data's median, the MAD is the median of their absolute values.
MAD is a more robust estimator of scale than the sample variance or standard deviation. For instance, MAD is more resilient to outliers in a data set than the standard deviation. It thus behaves better with distributions without a mean or variance, such as the Cauchy distribution.
In order to use the MAD as a consistent estimator for the estimation of the standard deviation σ, one takes σ = K * MAD, where K is a constant scale factor, which depends on the distribution. For normally distributed data K is taken to be 1.4826. Other distributions behave differently: for example for large samples from a uniform continuous distribution, this factor is about 1.1547.
public static double mad(double[] x)
MAD(X) = median(|Xi - median(Xi)|)
that is, starting with the residuals (deviations) from the data's median, the MAD is the median of their absolute values.
MAD is a more robust estimator of scale than the sample variance or standard deviation. For instance, MAD is more resilient to outliers in a data set than the standard deviation. It thus behaves better with distributions without a mean or variance, such as the Cauchy distribution.
In order to use the MAD as a consistent estimator for the estimation of the standard deviation σ, one takes σ = K * MAD, where K is a constant scale factor, which depends on the distribution. For normally distributed data K is taken to be 1.4826. Other distributions behave differently: for example for large samples from a uniform continuous distribution, this factor is about 1.1547.
public static boolean all(boolean[] x)
public static boolean any(boolean[] x)
public static double distance(int[] x,
int[] y)
public static double distance(float[] x,
float[] y)
public static double distance(double[] x,
double[] y)
public static double distance(SparseArray x, SparseArray y)
public static double squaredDistance(int[] x,
int[] y)
public static double squaredDistance(float[] x,
float[] y)
public static double squaredDistance(double[] x,
double[] y)
public static double squaredDistance(SparseArray x, SparseArray y)
public static double KullbackLeiblerDivergence(double[] x,
double[] y)
Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P.
public static double KullbackLeiblerDivergence(SparseArray x, SparseArray y)
Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P.
public static double KullbackLeiblerDivergence(double[] x,
SparseArray y)
Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P.
public static double KullbackLeiblerDivergence(SparseArray x, double[] y)
Although it is often intuited as a distance metric, the KL divergence is not a true metric - for example, the KL from P to Q is not necessarily the same as the KL from Q to P.
public static double JensenShannonDivergence(double[] x,
double[] y)
public static double JensenShannonDivergence(SparseArray x, SparseArray y)
public static double JensenShannonDivergence(double[] x,
SparseArray y)
public static double JensenShannonDivergence(SparseArray x, double[] y)
public static double dot(int[] x,
int[] y)
public static double dot(float[] x,
float[] y)
public static double dot(double[] x,
double[] y)
public static double dot(SparseArray x, SparseArray y)
public static double cov(int[] x,
int[] y)
public static double cov(float[] x,
float[] y)
public static double cov(double[] x,
double[] y)
public static double[][] cov(double[][] data)
public static double[][] cov(double[][] data,
double[] mu)
mu - the known mean of data.public static double cor(int[] x,
int[] y)
public static double cor(float[] x,
float[] y)
public static double cor(double[] x,
double[] y)
public static double[][] cor(double[][] data)
public static double[][] cor(double[][] data,
double[] mu)
mu - the known mean of data.public static double spearman(int[] x,
int[] y)
public static double spearman(float[] x,
float[] y)
public static double spearman(double[] x,
double[] y)
public static double kendall(int[] x,
int[] y)
public static double kendall(float[] x,
float[] y)
public static double kendall(double[] x,
double[] y)
public static double norm1(double[] x)
public static double norm2(double[] x)
public static double normInf(double[] x)
public static double norm(double[] x)
public static double norm1(double[][] x)
public static double norm2(double[][] x)
public static double norm(double[][] x)
public static double normInf(double[][] x)
public static double normFro(double[][] x)
public static void standardize(double[] x)
public static java.util.function.Function<double[],double[]> rescale(double[][] x)
public static java.util.function.Function<double[],double[]> rescale(double[][] x,
double lo,
double hi)
lo - lower limit of rangehi - upper limit of rangepublic static java.util.function.Function<double[],double[]> standardize(double[][] x)
public static java.util.function.Function<double[],double[]> normalize(double[][] x,
boolean centerizing)
centerizing - If true, centerize each column to 0 mean.public static void unitize(double[] x)
x - the array of doublepublic static void unitize1(double[] x)
x - an array of nonnegative doublepublic static void unitize2(double[] x)
x - the array of doublepublic static double GoodTuring(int[] r,
int[] Nr,
double[] p)
r - the frequency in ascending order.Nr - the frequency of frequencies.p - on output, it is the estimated probabilities.public static boolean equals(int[] x,
int[] y)
public static boolean equals(float[] x,
float[] y)
public static boolean equals(float[] x,
float[] y,
float epsilon)
public static boolean equals(double[] x,
double[] y)
public static boolean equals(double[] x,
double[] y,
double eps)
public static <T extends java.lang.Comparable<? super T>> boolean equals(T[] x,
T[] y)
public static boolean equals(int[][] x,
int[][] y)
public static boolean equals(float[][] x,
float[][] y)
public static boolean equals(float[][] x,
float[][] y,
float epsilon)
public static boolean equals(double[][] x,
double[][] y)
public static boolean equals(double[][] x,
double[][] y,
double eps)
public static boolean isZero(float x)
public static boolean isZero(float x,
float epsilon)
public static boolean isZero(double x)
public static boolean isZero(double x,
double epsilon)
public static <T extends java.lang.Comparable<? super T>> boolean equals(T[][] x,
T[][] y)
public static int[][] clone(int[][] x)
public static float[][] clone(float[][] x)
public static double[][] clone(double[][] x)
public static void swap(int[] x,
int i,
int j)
public static void swap(float[] x,
int i,
int j)
public static void swap(double[] x,
int i,
int j)
public static void swap(java.lang.Object[] x,
int i,
int j)
public static void swap(int[] x,
int[] y)
public static void swap(float[] x,
float[] y)
public static void swap(double[] x,
double[] y)
public static <E> void swap(E[] x,
E[] y)
public static void copy(int[] x,
int[] y)
public static void copy(float[] x,
float[] y)
public static void copy(double[] x,
double[] y)
public static void copy(int[][] x,
int[][] y)
public static void copy(float[][] x,
float[][] y)
public static void copy(double[][] x,
double[][] y)
public static void plus(double[] y,
double[] x)
public static void plus(double[][] y,
double[][] x)
public static void minus(double[] y,
double[] x)
y - minuend matrixx - subtrahend matrixpublic static void minus(double[][] y,
double[][] x)
y - minuend matrixx - subtrahend matrixpublic static void scale(double a,
double[] x)
public static void scale(double a,
double[] x,
double[] y)
public static double[] axpy(double a,
double[] x,
double[] y)
public static double[] ax(double[][] A,
double[] x,
double[] y)
public static double[] axpy(double[][] A,
double[] x,
double[] y)
public static double[] axpy(double[][] A,
double[] x,
double[] y,
double b)
public static double[] atx(double[][] A,
double[] x,
double[] y)
public static double[] atxpy(double[][] A,
double[] x,
double[] y)
public static double[] atxpy(double[][] A,
double[] x,
double[] y,
double b)
public static double xax(double[][] A,
double[] x)
public static double[][] aatmm(double[][] A)
public static void aatmm(double[][] A,
double[][] C)
public static double[][] atamm(double[][] A)
public static void atamm(double[][] A,
double[][] C)
public static double[][] abmm(double[][] A,
double[][] B)
public static void abmm(double[][] A,
double[][] B,
double[][] C)
public static double[][] atbmm(double[][] A,
double[][] B)
public static void atbmm(double[][] A,
double[][] B,
double[][] C)
public static double[][] abtmm(double[][] A,
double[][] B)
public static void abtmm(double[][] A,
double[][] B,
double[][] C)
public static double[][] atbtmm(double[][] A,
double[][] B)
public static void atbtmm(double[][] A,
double[][] B,
double[][] C)
public static double[] pow(double[] x,
double n)
x - arrayn - scalar exponentpublic static double[][] pow(double[][] x,
double n)
x - matrixn - exponentpublic static int[] unique(int[] x)
x - an integer array.public static java.lang.String[] unique(java.lang.String[] x)
x - an array of strings.public static int[][] sort(double[][] x)
x - a set of variables to be sorted. Each row is an instance. Each
column is a variable.public static double[][] eye(int n)
public static double[][] eye(int m,
int n)
m - the number of rows.n - the number of columns.public static double trace(double[][] A)
public static double[][] transpose(double[][] A)
public static DenseMatrix inverse(double[][] A)
public static double det(double[][] A)
public static int rank(double[][] A)
public static double eigen(double[][] A,
double[] v)
v - on input, it is the non-zero initial guess of the eigen vector.
On output, it is the eigen vector corresponding largest eigen value.public static double eigen(double[][] A,
double[] v,
double tol)
v - on input, it is the non-zero initial guess of the eigen vector.
On output, it is the eigen vector corresponding largest eigen value.tol - the desired convergence tolerance.public static double eigen(Matrix A, double[] v)
v - on input, it is the non-zero initial guess of the eigen vector.
On output, it is the eigen vector corresponding largest eigen value.public static double eigen(Matrix A, double[] v, double tol)
v - on input, it is the non-zero initial guess of the eigen vector.
On output, it is the eigen vector corresponding largest eigen value.tol - the desired convergence tolerance.public static EigenValueDecomposition eigen(double[][] A, int k)
public static EigenValueDecomposition eigen(Matrix A, int k)
public static EigenValueDecomposition eigen(double[][] A)
A - square matrix which will be altered after decomposition.public static EigenValueDecomposition eigen(double[][] A, boolean symmetric)
A - square matrix which will be altered after decomposition.symmetric - if the matrix A is symmetric.public static EigenValueDecomposition eigen(double[][] A, boolean symmetric, boolean onlyValues)
A - square matrix which will be altered after decomposition.symmetric - if the matrix A is symmetric.onlyValues - true if only compute eigenvalues; the default is to compute eigenvectors also.public static SingularValueDecomposition svd(double[][] A)
public static double[] solve(double[][] A,
double[] b)
public static DenseMatrix solve(double[][] A, double[][] B)
public static double[] solve(double[] a,
double[] b,
double[] c,
double[] r)
| b0 c0 0 0 0 ... | | a1 b1 c1 0 0 ... | | 0 a2 b2 c2 0 ... | | ... | | ... a(n-2) b(n-2) c(n-2) | | ... 0 a(n-1) b(n-1) |
a - the lower part of tridiagonal matrix. a[0] is undefined and not
referenced by the method.b - the diagonal of tridiagonal matrix.c - the upper of tridiagonal matrix. c[n-1] is undefined and not
referenced by the method.r - the right-hand side of linear equations.public static double root(Function func, double x1, double x2, double tol)
func - the function to be evaluated.x1 - the left end of search interval.x2 - the right end of search interval.tol - the accuracy tolerance.public static double root(Function func, double x1, double x2, double tol, int maxIter)
func - the function to be evaluated.x1 - the left end of search interval.x2 - the right end of search interval.tol - the accuracy tolerance.maxIter - the maximum number of allowed iterations.public static double root(DifferentiableFunction func, double x1, double x2, double tol)
func - the function to be evaluated.x1 - the left end of search interval.x2 - the right end of search interval.tol - the accuracy tolerance.public static double root(DifferentiableFunction func, double x1, double x2, double tol, int maxIter)
func - the function to be evaluated.x1 - the left end of search interval.x2 - the right end of search interval.tol - the accuracy tolerance.maxIter - the maximum number of allowed iterations.public static double min(DifferentiableMultivariateFunction func, int m, double[] x, double gtol)
min f(x), x = (x1,x2,...,x_n),
using the limited-memory BFGS method. The method is especially
effective on problems involving a large number of variables. In
a typical iteration of this method an approximation Hk to the
inverse of the Hessian is obtained by applying m BFGS updates to
a diagonal matrix Hk0, using information from the previous M steps.
The user specifies the number m, which determines the amount of
storage required by the routine. The algorithm is described in "On the
limited memory BFGS method for large scale optimization", by D. Liu and J. Nocedal,
Mathematical Programming B 45 (1989) 503-528.func - the function to be minimized.m - the number of corrections used in the L-BFGS update.
Values of m less than 3 are not recommended;
large values of m will result in excessive
computing time. 3 <= m <= 7 is recommended.x - on initial entry this must be set by the user to the values
of the initial estimate of the solution vector. On exit with
iflag = 0, it contains the values of the variables
at the best point found (usually a solution).gtol - the convergence requirement on zeroing the gradient.public static double min(DifferentiableMultivariateFunction func, int m, double[] x, double gtol, int maxIter)
min f(x), x = (x1,x2,...,x_n),
using the limited-memory BFGS method. The method is especially
effective on problems involving a large number of variables. In
a typical iteration of this method an approximation Hk to the
inverse of the Hessian is obtained by applying m BFGS updates to
a diagonal matrix Hk0, using information from the previous M steps.
The user specifies the number m, which determines the amount of
storage required by the routine. The algorithm is described in "On the
limited memory BFGS method for large scale optimization", by D. Liu and J. Nocedal,
Mathematical Programming B 45 (1989) 503-528.func - the function to be minimized.m - the number of corrections used in the L-BFGS update.
Values of m less than 3 are not recommended;
large values of m will result in excessive
computing time. 3 <= m <= 7 is recommended.
A common choice for m is m = 5.x - on initial entry this must be set by the user to the values
of the initial estimate of the solution vector. On exit with
iflag = 0, it contains the values of the variables
at the best point found (usually a solution).gtol - the convergence requirement on zeroing the gradient.maxIter - the maximum allowed number of iterations.public static double min(DifferentiableMultivariateFunction func, double[] x, double gtol)
min f(x), x = (x1,x2,...,x_n),
using the BFGS method.func - the function to be minimized.x - on initial entry this must be set by the user to the values
of the initial estimate of the solution vector. On exit, it
contains the values of the variables at the best point found
(usually a solution).gtol - the convergence requirement on zeroing the gradient.public static double min(DifferentiableMultivariateFunction func, double[] x, double gtol, int maxIter)
min f(x), x = (x1,x2,...,x_n),
using the BFGS method.func - the function to be minimized.x - on initial entry this must be set by the user to the values
of the initial estimate of the solution vector. On exit, it
contains the values of the variables at the best point found
(usually a solution).gtol - the convergence requirement on zeroing the gradient.maxIter - the maximum allowed number of iterations.