Do more. Code less. Free software for GPU computing.
<scroll to top>
Functions

Matrix ops: inverse, power, determinant, norm, rank

Linear Algebra

Functions

template<typename ty >
ty norm (const array &in, float p=af::nan)
 Matrix or vector norm.
array inv (const array &in)
 Matrix inversion.
array pinv (const array &in)
 Pseudo inverse.
array mpow (const array &base, double exponent)
 Matrix power.
unsigned rank (const array &in, double tolerance=1e-5)
 Rank of matrix.
template<typename T >
det (const array &in)
 Matrix determinant.

Function Documentation

ty af::norm ( const array &  in,
float  p = af::nan 
)

Matrix or vector norm.

Some options require ArrayFire Pro.

Parameters:
[in]in
[in]ptype of norm:

  • p == inf returns max(abs(in)) for vectors, infinity norm for matrices
  • p == -inf returns min(abs(in)) for vectors, not supported for matrices
  • p == nan (default) returns Euclidean norm for both vectors and matrices
  • p (anything else) returns p norm of the input
Note:
if p is 2 and the input is vector, ArrayFire Pro license is required.
array af::inv ( const array &  in)

Matrix inversion.

Double-precision or complex input requires ArrayFire Pro.

Parameters:
[in]insquare system matrix
Returns:
inverse system
array af::pinv ( const array &  in)

Pseudo inverse.

Double-precision or complex input requires ArrayFire Pro.

Parameters:
[in]insystem matrix (possibly nonsquare)
Returns:
pseudo inverse of the input
array af::mpow ( const array &  base,
double  exponent 
)

Matrix power.

Double-precision or complex input requires ArrayFire Pro.

Parameters:
[in]basesquare
[in]exponent
Returns:
base raised to exponent
unsigned af::rank ( const array &  in,
double  tolerance = 1e-5 
)

Rank of matrix.

Double-precision or complex input requires ArrayFire Pro.

Parameters:
[in]in
[in]toleranceonly consider singular values greater than this
Returns:
maximum of linearly independent column vectors
T af::det ( const array &  in)

Matrix determinant.

Double-precision or complex input requires ArrayFire Pro.

Parameters:
[in]insquare
Returns:
scalar determinant
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Defines