A high-performance general-purpose compute library

- Main Page
- Tutorials
- Release Notes
- Examples

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

## Functions
AFAPI array | solveLU (const array &a, const array &piv, const array &b, const matProp options=AF_MAT_NONE)
| C++ Interface to solve a system of equations.
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 to solve a system of equations.

## 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.

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

## ◆ af_solve_lu()

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 to solve a system of equations.

The `options` parameter currently must be AF_MAT_NONE.

Parameters

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

Returns
  AF_SUCCESS, if function returns successfully, else an af_err code is given

## ◆ solveLU()

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

C++ Interface to solve a system of equations.

The `options` parameter currently must be AF_MAT_NONE.

This function is not supported in GFOR.

Parameters

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

Returns
  `x`, the matrix of unknown variables