Invert a matrix. More...

Functions

AFAPI array inverse (const array &in, const matProp options=AF_MAT_NONE)
 C++ Interface for inverting a matrix. More...
 
AFAPI af_err af_inverse (af_array *out, const af_array in, const af_mat_prop options)
 C Interface for inverting a matrix. More...
 

Detailed Description

Invert a matrix.

This function inverts a square matrix A. The code snippet to demonstrate this can be seen below.

af::array IA = inverse(A);
af::array I = af::matmul(A, IA);

The sample output can be seen below

A [3 3 1 1]
0.0100 3.0100 6.0100
1.0100 4.0100 7.0000
2.0000 5.0000 8.0000
IA [3 3 1 1]
48.9076 -99.9927 50.7518
-99.1552 199.9852 -100.4968
49.7451 -99.9926 50.2475
I [3 3 1 1]
1.0000 0.0001 -0.0000
0.0000 1.0000 0.0000
0.0000 0.0000 1.0000

Function Documentation

AFAPI af_err af_inverse ( af_array out,
const af_array  in,
const af_mat_prop  options 
)

C Interface for inverting a matrix.

Parameters
[out]outwill contain the inverse of matrix in
[in]inis input matrix
[in]optionsdetermining various properties of matrix in
Note
currently options needs to be AF_MAT_NONE
AFAPI array af::inverse ( const array in,
const matProp  options = AF_MAT_NONE 
)

C++ Interface for inverting a matrix.

Parameters
[in]inis input matrix
[in]optionsdetermining various properties of matrix in
Returns
x, the inverse of the input matrix
Note
options currently needs to be AF_MAT_NONE
This function is not supported in GFOR