- Main Page
- Tutorials
- Functions
- Release Notes
- Examples

Functions
solveLU
Complete List of ArrayFire Functions ArrayFire Functions by Category » Linear Algebra » | Linear solve and least squares

Solve a system of equations. More...

## Functions
AFAPI array | solveLU (const array &a, const array &piv, const array &b, const matProp options=AF_MAT_NONE)
| C++ Interface for solving a system of equations. More...
AFAPI af_err | af_solve_lu (af_array *x, const af_array a, const af_array piv, const af_array b, const af_mat_prop options)
| C Interface for solving a system of equations. More...

## Detailed Description

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.

af::array A_lu, pivot;
af::lu(A_lu, pivot, A);
af::array X1 = af::solveLU(A_lu, pivot, B0);

This function along with af::lu split up the task af::solve performs for square matrices.

Note
  This function is beneficial over af::solve only in long running application where the coefficient matrix A stays the same, but the observed variables keep changing.

## Function Documentation

AFAPI af_err af_solve_lu | ( | af_array * | x,
|  | const af_array | a,
|  | const af_array | piv,
|  | const af_array | b,
|  | const af_mat_prop | options
| ) |  |

C Interface for solving a system of equations.

Parameters

  [out] | x | will contain the matrix of unknown variables
  [in] | a | is the output matrix from packed LU decomposition of the coefficient matrix
  [in] | piv | is the pivot array from packed LU decomposition of the coefficient matrix
  [in] | b | is the matrix of measured values
  [in] | options | determining various properties of matrix `a`

Note
  `options` currently needs to be AF_MAT_NONE
  This function is not supported in GFOR

AFAPI array af::solveLU | ( | const array & | a,
|  | const array & | piv,
|  | const array & | b,
|  | const matProp | options = `AF_MAT_NONE`
| ) |  |

C++ Interface for solving a system of equations.

Parameters

  [in] | a | is the output matrix from packed LU decomposition of the coefficient matrix
  [in] | piv | is the pivot array from packed LU decomposition of the coefficient matrix
  [in] | b | is the matrix of measured values
  [in] | options | determining various properties of matrix `a`

Returns
  `x`, the matrix of unknown variables

Note
  `options` currently needs to be AF_MAT_NONE
  This function is not supported in GFOR