Package org.jblas
Class MatrixFunctions
- java.lang.Object
-
- org.jblas.MatrixFunctions
-
public class MatrixFunctions extends java.lang.ObjectThis class provides the functions from java.lang.Math for matrices. The functions are applied to each element of the matrix.
-
-
Constructor Summary
Constructors Constructor Description MatrixFunctions()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static doubleabs(double x)static floatabs(float x)static DoubleMatrixabs(DoubleMatrix x)Returns a copy of this matrix where all elements are set to their absolute values.static FloatMatrixabs(FloatMatrix x)Returns a copy of this matrix where all elements are set to their absolute values.static ComplexDoubleMatrixabsi(ComplexDoubleMatrix x)static ComplexFloatMatrixabsi(ComplexFloatMatrix x)static DoubleMatrixabsi(DoubleMatrix x)Sets all elements in this matrix to their absolute values.static FloatMatrixabsi(FloatMatrix x)Sets all elements in this matrix to their absolute values.static doubleacos(double x)static floatacos(float x)static DoubleMatrixacos(DoubleMatrix x)Returns a copy of this matrix where the trigonometric acos function is applied element wise.static FloatMatrixacos(FloatMatrix x)Returns a copy of this matrix where the trigonometric acos function is applied element wise.static DoubleMatrixacosi(DoubleMatrix x)Applies the trigonometric arccosine function element wise on this matrix.static FloatMatrixacosi(FloatMatrix x)Applies the trigonometric arccosine function element wise on this matrix.static doubleasin(double x)static floatasin(float x)static DoubleMatrixasin(DoubleMatrix x)static FloatMatrixasin(FloatMatrix x)static DoubleMatrixasini(DoubleMatrix x)Applies the trigonometric arcsine function element wise on this matrix.static FloatMatrixasini(FloatMatrix x)Applies the trigonometric arcsine function element wise on this matrix.static doubleatan(double x)static floatatan(float x)static DoubleMatrixatan(DoubleMatrix x)static FloatMatrixatan(FloatMatrix x)static DoubleMatrixatani(DoubleMatrix x)Applies the trigonometric arctangend function element wise on this matrix.static FloatMatrixatani(FloatMatrix x)Applies the trigonometric arctangend function element wise on this matrix.static doublecbrt(double x)static floatcbrt(float x)static DoubleMatrixcbrt(DoubleMatrix x)static FloatMatrixcbrt(FloatMatrix x)static DoubleMatrixcbrti(DoubleMatrix x)Applies the cube root function element wise on this matrix.static FloatMatrixcbrti(FloatMatrix x)Applies the cube root function element wise on this matrix.static doubleceil(double x)static floatceil(float x)static DoubleMatrixceil(DoubleMatrix x)static FloatMatrixceil(FloatMatrix x)static DoubleMatrixceili(DoubleMatrix x)Element-wise round up by applying the ceil function on each element.static FloatMatrixceili(FloatMatrix x)Element-wise round up by applying the ceil function on each element.static doublecos(double x)static floatcos(float x)static DoubleMatrixcos(DoubleMatrix x)static FloatMatrixcos(FloatMatrix x)static doublecosh(double x)static floatcosh(float x)static DoubleMatrixcosh(DoubleMatrix x)static FloatMatrixcosh(FloatMatrix x)static DoubleMatrixcoshi(DoubleMatrix x)Applies the hyperbolic cosine function element-wise on this matrix.static FloatMatrixcoshi(FloatMatrix x)Applies the hyperbolic cosine function element-wise on this matrix.static DoubleMatrixcosi(DoubleMatrix x)Applies the cosine function element-wise on this matrix.static FloatMatrixcosi(FloatMatrix x)Applies the cosine function element-wise on this matrix.static FloatMatrixdoubleToFloat(DoubleMatrix dm)static doubleexp(double x)static floatexp(float x)static DoubleMatrixexp(DoubleMatrix x)static FloatMatrixexp(FloatMatrix x)static DoubleMatrixexpi(DoubleMatrix x)Applies the exponential function element-wise on this matrix.static FloatMatrixexpi(FloatMatrix x)Applies the exponential function element-wise on this matrix.static DoubleMatrixexpm(DoubleMatrix A)Calculate matrix exponential of a square matrix.static FloatMatrixexpm(FloatMatrix A)Calculate matrix exponential of a square matrix.static DoubleMatrixfloatToDouble(FloatMatrix fm)static doublefloor(double x)static floatfloor(float x)static DoubleMatrixfloor(DoubleMatrix x)static FloatMatrixfloor(FloatMatrix x)static DoubleMatrixfloori(DoubleMatrix x)Element-wise round down by applying the floor function on each element.static FloatMatrixfloori(FloatMatrix x)Element-wise round down by applying the floor function on each element.static doublelog(double x)static floatlog(float x)static DoubleMatrixlog(DoubleMatrix x)static FloatMatrixlog(FloatMatrix x)static doublelog10(double x)static floatlog10(float x)static DoubleMatrixlog10(DoubleMatrix x)static FloatMatrixlog10(FloatMatrix x)static DoubleMatrixlog10i(DoubleMatrix x)Applies the logarithm with basis to 10 element-wise on this matrix.static FloatMatrixlog10i(FloatMatrix x)Applies the logarithm with basis to 10 element-wise on this matrix.static DoubleMatrixlogi(DoubleMatrix x)Applies the natural logarithm function element-wise on this matrix.static FloatMatrixlogi(FloatMatrix x)Applies the natural logarithm function element-wise on this matrix.static doublepow(double x, double y)static DoubleMatrixpow(double b, DoubleMatrix x)static floatpow(float x, float y)static FloatMatrixpow(float b, FloatMatrix x)static DoubleMatrixpow(DoubleMatrix x, double e)static DoubleMatrixpow(DoubleMatrix x, DoubleMatrix e)static FloatMatrixpow(FloatMatrix x, float e)static FloatMatrixpow(FloatMatrix x, FloatMatrix e)static DoubleMatrixpowi(double base, DoubleMatrix x)static FloatMatrixpowi(float base, FloatMatrix x)static DoubleMatrixpowi(DoubleMatrix x, double d)Element-wise power function.static DoubleMatrixpowi(DoubleMatrix x, DoubleMatrix e)static FloatMatrixpowi(FloatMatrix x, float d)Element-wise power function.static FloatMatrixpowi(FloatMatrix x, FloatMatrix e)static doublesignum(double x)static floatsignum(float x)static DoubleMatrixsignum(DoubleMatrix x)static FloatMatrixsignum(FloatMatrix x)static DoubleMatrixsignumi(DoubleMatrix x)static FloatMatrixsignumi(FloatMatrix x)static doublesin(double x)static floatsin(float x)static DoubleMatrixsin(DoubleMatrix x)static FloatMatrixsin(FloatMatrix x)static doublesinh(double x)static floatsinh(float x)static DoubleMatrixsinh(DoubleMatrix x)static FloatMatrixsinh(FloatMatrix x)static DoubleMatrixsinhi(DoubleMatrix x)static FloatMatrixsinhi(FloatMatrix x)static DoubleMatrixsini(DoubleMatrix x)static FloatMatrixsini(FloatMatrix x)static doublesqrt(double x)static floatsqrt(float x)static DoubleMatrixsqrt(DoubleMatrix x)static FloatMatrixsqrt(FloatMatrix x)static DoubleMatrixsqrti(DoubleMatrix x)static FloatMatrixsqrti(FloatMatrix x)static doubletan(double x)static floattan(float x)static DoubleMatrixtan(DoubleMatrix x)static FloatMatrixtan(FloatMatrix x)static doubletanh(double x)static floattanh(float x)static DoubleMatrixtanh(DoubleMatrix x)static FloatMatrixtanh(FloatMatrix x)static DoubleMatrixtanhi(DoubleMatrix x)static FloatMatrixtanhi(FloatMatrix x)static DoubleMatrixtani(DoubleMatrix x)static FloatMatrixtani(FloatMatrix x)
-
-
-
Method Detail
-
absi
public static DoubleMatrix absi(DoubleMatrix x)
Sets all elements in this matrix to their absolute values. Note that this operation is in-place.- Returns:
- this matrix
- See Also:
abs(DoubleMatrix)
-
absi
public static ComplexDoubleMatrix absi(ComplexDoubleMatrix x)
-
acosi
public static DoubleMatrix acosi(DoubleMatrix x)
Applies the trigonometric arccosine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
acos(DoubleMatrix)
-
asini
public static DoubleMatrix asini(DoubleMatrix x)
Applies the trigonometric arcsine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
asin(DoubleMatrix)
-
atani
public static DoubleMatrix atani(DoubleMatrix x)
Applies the trigonometric arctangend function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
atan(DoubleMatrix)
-
cbrti
public static DoubleMatrix cbrti(DoubleMatrix x)
Applies the cube root function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cbrt(DoubleMatrix)
-
ceili
public static DoubleMatrix ceili(DoubleMatrix x)
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:
ceil(DoubleMatrix)
-
cosi
public static DoubleMatrix cosi(DoubleMatrix x)
Applies the cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cos(DoubleMatrix)
-
coshi
public static DoubleMatrix coshi(DoubleMatrix x)
Applies the hyperbolic cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cosh(DoubleMatrix)
-
expi
public static DoubleMatrix expi(DoubleMatrix x)
Applies the exponential function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
exp(DoubleMatrix)
-
floori
public static DoubleMatrix floori(DoubleMatrix x)
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:
floor(DoubleMatrix)
-
logi
public static DoubleMatrix logi(DoubleMatrix x)
Applies the natural logarithm function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
log(DoubleMatrix)
-
log10i
public static DoubleMatrix log10i(DoubleMatrix x)
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:
log10(DoubleMatrix)
-
powi
public static DoubleMatrix powi(DoubleMatrix x, double d)
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:
pow(DoubleMatrix,double)
-
powi
public static DoubleMatrix powi(double base, DoubleMatrix x)
-
powi
public static DoubleMatrix powi(DoubleMatrix x, DoubleMatrix e)
-
signumi
public static DoubleMatrix signumi(DoubleMatrix x)
-
sini
public static DoubleMatrix sini(DoubleMatrix x)
-
sinhi
public static DoubleMatrix sinhi(DoubleMatrix x)
-
sqrti
public static DoubleMatrix sqrti(DoubleMatrix x)
-
tani
public static DoubleMatrix tani(DoubleMatrix x)
-
tanhi
public static DoubleMatrix tanhi(DoubleMatrix x)
-
abs
public static DoubleMatrix abs(DoubleMatrix x)
Returns a copy of this matrix where all elements are set to their absolute values.- Returns:
- copy of this matrix
- See Also:
absi(DoubleMatrix)
-
acos
public static DoubleMatrix acos(DoubleMatrix x)
Returns a copy of this matrix where the trigonometric acos function is applied element wise.- Returns:
- copy of this matrix
- See Also:
acosi(DoubleMatrix)
-
asin
public static DoubleMatrix asin(DoubleMatrix x)
-
atan
public static DoubleMatrix atan(DoubleMatrix x)
-
cbrt
public static DoubleMatrix cbrt(DoubleMatrix x)
-
ceil
public static DoubleMatrix ceil(DoubleMatrix x)
-
cos
public static DoubleMatrix cos(DoubleMatrix x)
-
cosh
public static DoubleMatrix cosh(DoubleMatrix x)
-
exp
public static DoubleMatrix exp(DoubleMatrix x)
-
floor
public static DoubleMatrix floor(DoubleMatrix x)
-
log
public static DoubleMatrix log(DoubleMatrix x)
-
log10
public static DoubleMatrix log10(DoubleMatrix x)
-
pow
public static double pow(double x, double y)
-
pow
public static DoubleMatrix pow(DoubleMatrix x, double e)
-
pow
public static DoubleMatrix pow(double b, DoubleMatrix x)
-
pow
public static DoubleMatrix pow(DoubleMatrix x, DoubleMatrix e)
-
signum
public static DoubleMatrix signum(DoubleMatrix x)
-
sin
public static DoubleMatrix sin(DoubleMatrix x)
-
sinh
public static DoubleMatrix sinh(DoubleMatrix x)
-
sqrt
public static DoubleMatrix sqrt(DoubleMatrix x)
-
tan
public static DoubleMatrix tan(DoubleMatrix x)
-
tanh
public static DoubleMatrix tanh(DoubleMatrix x)
-
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
public static DoubleMatrix expm(DoubleMatrix A)
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
public static DoubleMatrix floatToDouble(FloatMatrix fm)
-
doubleToFloat
public static FloatMatrix doubleToFloat(DoubleMatrix dm)
-
absi
public static FloatMatrix absi(FloatMatrix x)
Sets all elements in this matrix to their absolute values. Note that this operation is in-place.- Returns:
- this matrix
- See Also:
abs(FloatMatrix)
-
absi
public static ComplexFloatMatrix absi(ComplexFloatMatrix x)
-
acosi
public static FloatMatrix acosi(FloatMatrix x)
Applies the trigonometric arccosine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
acos(FloatMatrix)
-
asini
public static FloatMatrix asini(FloatMatrix x)
Applies the trigonometric arcsine function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
asin(FloatMatrix)
-
atani
public static FloatMatrix atani(FloatMatrix x)
Applies the trigonometric arctangend function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
atan(FloatMatrix)
-
cbrti
public static FloatMatrix cbrti(FloatMatrix x)
Applies the cube root function element wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cbrt(FloatMatrix)
-
ceili
public static FloatMatrix ceili(FloatMatrix x)
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:
ceil(FloatMatrix)
-
cosi
public static FloatMatrix cosi(FloatMatrix x)
Applies the cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cos(FloatMatrix)
-
coshi
public static FloatMatrix coshi(FloatMatrix x)
Applies the hyperbolic cosine function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
cosh(FloatMatrix)
-
expi
public static FloatMatrix expi(FloatMatrix x)
Applies the exponential function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
exp(FloatMatrix)
-
floori
public static FloatMatrix floori(FloatMatrix x)
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:
floor(FloatMatrix)
-
logi
public static FloatMatrix logi(FloatMatrix x)
Applies the natural logarithm function element-wise on this matrix. Note that this is an in-place operation.- Returns:
- this matrix
- See Also:
log(FloatMatrix)
-
log10i
public static FloatMatrix log10i(FloatMatrix x)
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:
log10(FloatMatrix)
-
powi
public static FloatMatrix powi(FloatMatrix x, float d)
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:
pow(FloatMatrix,float)
-
powi
public static FloatMatrix powi(float base, FloatMatrix x)
-
powi
public static FloatMatrix powi(FloatMatrix x, FloatMatrix e)
-
signumi
public static FloatMatrix signumi(FloatMatrix x)
-
sini
public static FloatMatrix sini(FloatMatrix x)
-
sinhi
public static FloatMatrix sinhi(FloatMatrix x)
-
sqrti
public static FloatMatrix sqrti(FloatMatrix x)
-
tani
public static FloatMatrix tani(FloatMatrix x)
-
tanhi
public static FloatMatrix tanhi(FloatMatrix x)
-
abs
public static FloatMatrix abs(FloatMatrix x)
Returns a copy of this matrix where all elements are set to their absolute values.- Returns:
- copy of this matrix
- See Also:
absi(FloatMatrix)
-
acos
public static FloatMatrix acos(FloatMatrix x)
Returns a copy of this matrix where the trigonometric acos function is applied element wise.- Returns:
- copy of this matrix
- See Also:
acosi(FloatMatrix)
-
asin
public static FloatMatrix asin(FloatMatrix x)
-
atan
public static FloatMatrix atan(FloatMatrix x)
-
cbrt
public static FloatMatrix cbrt(FloatMatrix x)
-
ceil
public static FloatMatrix ceil(FloatMatrix x)
-
cos
public static FloatMatrix cos(FloatMatrix x)
-
cosh
public static FloatMatrix cosh(FloatMatrix x)
-
exp
public static FloatMatrix exp(FloatMatrix x)
-
floor
public static FloatMatrix floor(FloatMatrix x)
-
log
public static FloatMatrix log(FloatMatrix x)
-
log10
public static FloatMatrix log10(FloatMatrix x)
-
pow
public static float pow(float x, float y)
-
pow
public static FloatMatrix pow(FloatMatrix x, float e)
-
pow
public static FloatMatrix pow(float b, FloatMatrix x)
-
pow
public static FloatMatrix pow(FloatMatrix x, FloatMatrix e)
-
signum
public static FloatMatrix signum(FloatMatrix x)
-
sin
public static FloatMatrix sin(FloatMatrix x)
-
sinh
public static FloatMatrix sinh(FloatMatrix x)
-
sqrt
public static FloatMatrix sqrt(FloatMatrix x)
-
tan
public static FloatMatrix tan(FloatMatrix x)
-
tanh
public static FloatMatrix tanh(FloatMatrix x)
-
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
public static FloatMatrix expm(FloatMatrix A)
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
-
-