|
Solve a system of equations. More...
Functions | |
AFAPI array | solve (const array &a, const array &b, const matProp options=AF_MAT_NONE) |
C++ Interface for solving a system of equations. More... | |
AFAPI af_err | af_solve (af_array *x, const af_array a, const af_array b, const af_mat_prop options) |
C Interface for solving a system of equations. More... | |
Solve a system of equations.
This function takes a co-efficient matrix A and an output matrix B as inputs to solve the following equation for X
\(A * X = B\)
This operation can be done in ArrayFire using the following code snippet.
The results can be verified by reconstructing the output matrix using af::matmul in the following manner.
The sample output can be seen below
If the coefficient matrix is known to be a triangular matrix, AF_MAT_LOWER or AF_MAT_UPPER can be passed to make solve faster.
The sample code snippets for solving a lower triangular matrix can be seen below.
Similarily, the code snippet for solving an upper triangular matrix can be seen below.
See also: af::solveLU
AFAPI af_err af_solve | ( | af_array * | x, |
const af_array | a, | ||
const af_array | b, | ||
const af_mat_prop | options | ||
) |
C Interface for solving a system of equations.
[out] | x | is the matrix of unknown variables |
[in] | a | is the coefficient matrix |
[in] | b | is the measured values |
[in] | options | determining various properties of matrix a |
options
needs to be one of AF_MAT_NONE, AF_MAT_LOWER or AF_MAT_UPPER AFAPI array af::solve | ( | const array & | a, |
const array & | b, | ||
const matProp | options = AF_MAT_NONE |
||
) |
C++ Interface for solving a system of equations.
[in] | a | is the coefficient matrix |
[in] | b | is the measured values |
[in] | options | determining various properties of matrix a |
x
, the matrix of unknown variablesoptions
needs to be one of AF_MAT_NONE, AF_MAT_LOWER or AF_MAT_UPPER