org.jblas

## Class MatrixFunctions

• public class MatrixFunctions
extends Object
This class provides the functions from java.lang.Math for matrices. The functions are applied to each element of the matrix.
Author:
Mikio Braun
• ### Constructor Detail

• #### MatrixFunctions

public MatrixFunctions()
• ### 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
abs(DoubleMatrix)
• #### 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
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
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
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
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
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
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
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
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
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
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
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
pow(DoubleMatrix,double)
• #### 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
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
acosi(DoubleMatrix)
• #### pow

public static double pow(double x,
double y)
• #### 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
• #### 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
abs(FloatMatrix)
• #### 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
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
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
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
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
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
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
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
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
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
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
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
pow(FloatMatrix,float)
• #### 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
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
acosi(FloatMatrix)
• #### pow

public static float pow(float x,
float y)
• #### 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