Package org.jblas
Class MatrixFunctions
java.lang.Object
org.jblas.MatrixFunctions
This class provides the functions from java.lang.Math for matrices. The
functions are applied to each element of the matrix.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic double
abs
(double x) static float
abs
(float x) static DoubleMatrix
abs
(DoubleMatrix x) Returns a copy of this matrix where all elements are set to their absolute values.static FloatMatrix
abs
(FloatMatrix x) Returns a copy of this matrix where all elements are set to their absolute values.static ComplexDoubleMatrix
static ComplexFloatMatrix
static DoubleMatrix
absi
(DoubleMatrix x) Sets all elements in this matrix to their absolute values.static FloatMatrix
absi
(FloatMatrix x) Sets all elements in this matrix to their absolute values.static double
acos
(double x) static float
acos
(float x) static DoubleMatrix
acos
(DoubleMatrix x) Returns a copy of this matrix where the trigonometric acos function is applied element wise.static FloatMatrix
acos
(FloatMatrix x) Returns a copy of this matrix where the trigonometric acos function is applied element wise.static DoubleMatrix
Applies the trigonometric arccosine function element wise on this matrix.static FloatMatrix
acosi
(FloatMatrix x) Applies the trigonometric arccosine function element wise on this matrix.static double
asin
(double x) static float
asin
(float x) static DoubleMatrix
asin
(DoubleMatrix x) static FloatMatrix
asin
(FloatMatrix x) static DoubleMatrix
Applies the trigonometric arcsine function element wise on this matrix.static FloatMatrix
asini
(FloatMatrix x) Applies the trigonometric arcsine function element wise on this matrix.static double
atan
(double x) static float
atan
(float x) static DoubleMatrix
atan
(DoubleMatrix x) static FloatMatrix
atan
(FloatMatrix x) static DoubleMatrix
Applies the trigonometric arctangend function element wise on this matrix.static FloatMatrix
atani
(FloatMatrix x) Applies the trigonometric arctangend function element wise on this matrix.static double
cbrt
(double x) static float
cbrt
(float x) static DoubleMatrix
cbrt
(DoubleMatrix x) static FloatMatrix
cbrt
(FloatMatrix x) static DoubleMatrix
Applies the cube root function element wise on this matrix.static FloatMatrix
cbrti
(FloatMatrix x) Applies the cube root function element wise on this matrix.static double
ceil
(double x) static float
ceil
(float x) static DoubleMatrix
ceil
(DoubleMatrix x) static FloatMatrix
ceil
(FloatMatrix x) static DoubleMatrix
Element-wise round up by applying the ceil function on each element.static FloatMatrix
ceili
(FloatMatrix x) Element-wise round up by applying the ceil function on each element.static double
cos
(double x) static float
cos
(float x) static DoubleMatrix
cos
(DoubleMatrix x) static FloatMatrix
cos
(FloatMatrix x) static double
cosh
(double x) static float
cosh
(float x) static DoubleMatrix
cosh
(DoubleMatrix x) static FloatMatrix
cosh
(FloatMatrix x) static DoubleMatrix
Applies the hyperbolic cosine function element-wise on this matrix.static FloatMatrix
coshi
(FloatMatrix x) Applies the hyperbolic cosine function element-wise on this matrix.static DoubleMatrix
cosi
(DoubleMatrix x) Applies the cosine function element-wise on this matrix.static FloatMatrix
cosi
(FloatMatrix x) Applies the cosine function element-wise on this matrix.static FloatMatrix
static double
exp
(double x) static float
exp
(float x) static DoubleMatrix
exp
(DoubleMatrix x) static FloatMatrix
exp
(FloatMatrix x) static DoubleMatrix
expi
(DoubleMatrix x) Applies the exponential function element-wise on this matrix.static FloatMatrix
expi
(FloatMatrix x) Applies the exponential function element-wise on this matrix.static DoubleMatrix
expm
(DoubleMatrix A) Calculate matrix exponential of a square matrix.static FloatMatrix
expm
(FloatMatrix A) Calculate matrix exponential of a square matrix.static DoubleMatrix
static double
floor
(double x) static float
floor
(float x) static DoubleMatrix
static FloatMatrix
floor
(FloatMatrix x) static DoubleMatrix
Element-wise round down by applying the floor function on each element.static FloatMatrix
Element-wise round down by applying the floor function on each element.static double
log
(double x) static float
log
(float x) static DoubleMatrix
log
(DoubleMatrix x) static FloatMatrix
log
(FloatMatrix x) static double
log10
(double x) static float
log10
(float x) static DoubleMatrix
static FloatMatrix
log10
(FloatMatrix x) static DoubleMatrix
Applies the logarithm with basis to 10 element-wise on this matrix.static FloatMatrix
Applies the logarithm with basis to 10 element-wise on this matrix.static DoubleMatrix
logi
(DoubleMatrix x) Applies the natural logarithm function element-wise on this matrix.static FloatMatrix
logi
(FloatMatrix x) Applies the natural logarithm function element-wise on this matrix.static double
pow
(double x, double y) static DoubleMatrix
pow
(double b, DoubleMatrix x) static float
pow
(float x, float y) static FloatMatrix
pow
(float b, FloatMatrix x) static DoubleMatrix
pow
(DoubleMatrix x, double e) static DoubleMatrix
pow
(DoubleMatrix x, DoubleMatrix e) static FloatMatrix
pow
(FloatMatrix x, float e) static FloatMatrix
pow
(FloatMatrix x, FloatMatrix e) static DoubleMatrix
powi
(double base, DoubleMatrix x) static FloatMatrix
powi
(float base, FloatMatrix x) static DoubleMatrix
powi
(DoubleMatrix x, double d) Element-wise power function.static DoubleMatrix
powi
(DoubleMatrix x, DoubleMatrix e) static FloatMatrix
powi
(FloatMatrix x, float d) Element-wise power function.static FloatMatrix
powi
(FloatMatrix x, FloatMatrix e) static double
signum
(double x) static float
signum
(float x) static DoubleMatrix
static FloatMatrix
static DoubleMatrix
static FloatMatrix
static double
sin
(double x) static float
sin
(float x) static DoubleMatrix
sin
(DoubleMatrix x) static FloatMatrix
sin
(FloatMatrix x) static double
sinh
(double x) static float
sinh
(float x) static DoubleMatrix
sinh
(DoubleMatrix x) static FloatMatrix
sinh
(FloatMatrix x) static DoubleMatrix
static FloatMatrix
sinhi
(FloatMatrix x) static DoubleMatrix
sini
(DoubleMatrix x) static FloatMatrix
sini
(FloatMatrix x) static double
sqrt
(double x) static float
sqrt
(float x) static DoubleMatrix
sqrt
(DoubleMatrix x) static FloatMatrix
sqrt
(FloatMatrix x) static DoubleMatrix
static FloatMatrix
sqrti
(FloatMatrix x) static double
tan
(double x) static float
tan
(float x) static DoubleMatrix
tan
(DoubleMatrix x) static FloatMatrix
tan
(FloatMatrix x) static double
tanh
(double x) static float
tanh
(float x) static DoubleMatrix
tanh
(DoubleMatrix x) static FloatMatrix
tanh
(FloatMatrix x) static DoubleMatrix
static FloatMatrix
tanhi
(FloatMatrix x) static DoubleMatrix
tani
(DoubleMatrix x) static FloatMatrix
tani
(FloatMatrix x)
-
Constructor Details
-
MatrixFunctions
public MatrixFunctions()
-
-
Method Details
-
absi
Sets all elements in this matrix to their absolute values. Note that this operation is in-place.- Returns:
- this matrix
- See Also:
-
absi
-
acosi
Applies the trigonometric arccosine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
asini
Applies the trigonometric arcsine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
atani
Applies the trigonometric arctangend function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
cbrti
Applies the cube root function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
ceili
Element-wise round up by applying the ceil function on each element. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
cosi
Applies the cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
coshi
Applies the hyperbolic cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
expi
Applies the exponential function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
floori
Element-wise round down by applying the floor function on each element. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
logi
Applies the natural logarithm function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
log10i
Applies the logarithm with basis to 10 element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
powi
Element-wise power function. Replaces each element with its power of d.Note that this is an in-place operation.- Parameters:
d
- the exponent- Returns:
- this matrix
- See Also:
-
powi
-
powi
-
signumi
-
sini
-
sinhi
-
sqrti
-
tani
-
tanhi
-
abs
Returns a copy of this matrix where all elements are set to their absolute values.- Returns:
- copy of this matrix
- See Also:
-
acos
Returns a copy of this matrix where the trigonometric acos function is applied element wise.- Returns:
- copy of this matrix
- See Also:
-
asin
-
atan
-
cbrt
-
ceil
-
cos
-
cosh
-
exp
-
floor
-
log
-
log10
-
pow
public static double pow(double x, double y) -
pow
-
pow
-
pow
-
signum
-
sin
-
sinh
-
sqrt
-
tan
-
tanh
-
abs
public static double abs(double x) -
acos
public static double acos(double x) -
asin
public static double asin(double x) -
atan
public static double atan(double x) -
cbrt
public static double cbrt(double x) -
ceil
public static double ceil(double x) -
cos
public static double cos(double x) -
cosh
public static double cosh(double x) -
exp
public static double exp(double x) -
floor
public static double floor(double x) -
log
public static double log(double x) -
log10
public static double log10(double x) -
signum
public static double signum(double x) -
sin
public static double sin(double x) -
sinh
public static double sinh(double x) -
sqrt
public static double sqrt(double x) -
tan
public static double tan(double x) -
tanh
public static double tanh(double x) -
expm
Calculate matrix exponential of a square matrix. A scaled Pade approximation algorithm is used. The algorithm has been directly translated from Golub & Van Loan "Matrix Computations", algorithm 11.3.1. Special Horner techniques from 11.2 are also used to minimize the number of matrix multiplications.- Parameters:
A
- square matrix- Returns:
- matrix exponential of A
-
floatToDouble
-
doubleToFloat
-
absi
Sets all elements in this matrix to their absolute values. Note that this operation is in-place.- Returns:
- this matrix
- See Also:
-
absi
-
acosi
Applies the trigonometric arccosine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
asini
Applies the trigonometric arcsine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
atani
Applies the trigonometric arctangend function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
cbrti
Applies the cube root function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
ceili
Element-wise round up by applying the ceil function on each element. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
cosi
Applies the cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
coshi
Applies the hyperbolic cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
expi
Applies the exponential function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
floori
Element-wise round down by applying the floor function on each element. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
logi
Applies the natural logarithm function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
log10i
Applies the logarithm with basis to 10 element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
-
powi
Element-wise power function. Replaces each element with its power of d.Note that this is an in-place operation.- Parameters:
d
- the exponent- Returns:
- this matrix
- See Also:
-
powi
-
powi
-
signumi
-
sini
-
sinhi
-
sqrti
-
tani
-
tanhi
-
abs
Returns a copy of this matrix where all elements are set to their absolute values.- Returns:
- copy of this matrix
- See Also:
-
acos
Returns a copy of this matrix where the trigonometric acos function is applied element wise.- Returns:
- copy of this matrix
- See Also:
-
asin
-
atan
-
cbrt
-
ceil
-
cos
-
cosh
-
exp
-
floor
-
log
-
log10
-
pow
public static float pow(float x, float y) -
pow
-
pow
-
pow
-
signum
-
sin
-
sinh
-
sqrt
-
tan
-
tanh
-
abs
public static float abs(float x) -
acos
public static float acos(float x) -
asin
public static float asin(float x) -
atan
public static float atan(float x) -
cbrt
public static float cbrt(float x) -
ceil
public static float ceil(float x) -
cos
public static float cos(float x) -
cosh
public static float cosh(float x) -
exp
public static float exp(float x) -
floor
public static float floor(float x) -
log
public static float log(float x) -
log10
public static float log10(float x) -
signum
public static float signum(float x) -
sin
public static float sin(float x) -
sinh
public static float sinh(float x) -
sqrt
public static float sqrt(float x) -
tan
public static float tan(float x) -
tanh
public static float tanh(float x) -
expm
Calculate matrix exponential of a square matrix. A scaled Pade approximation algorithm is used. The algorithm has been directly translated from Golub & Van Loan "Matrix Computations", algorithm 11.3f.1. Special Horner techniques from 11.2f are also used to minimize the number of matrix multiplications.- Parameters:
A
- square matrix- Returns:
- matrix exponential of A
-