Solve 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.
A multi dimensional data container.
AFAPI array solve(const array &a, const array &b, const matProp options=AF_MAT_NONE)
C++ Interface to solve a system of equations.
The results can be verified by reconstructing the output matrix using af::matmul in the following manner,
AFAPI array matmul(const array &lhs, const array &rhs, const matProp optLhs=AF_MAT_NONE, const matProp optRhs=AF_MAT_NONE)
C++ Interface to multiply two matrices.
The sample output can be seen below.
A [3 3 1 1]
0.1000 3.1000 6.1000
1.1000 4.1000 7.0000
2.0000 5.0000 8.0000
B0 [3 1 1 1]
21.9000
30.7000
39.0000
X1 [3 1 1 1]
4.0000
3.0000
2.0000
B1 [3 1 1 1]
21.9000
30.7000
39.0000
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.
@ AF_MAT_LOWER
Matrix is lower triangular.
Similarily, the code snippet for solving an upper triangular matrix can be seen below.
@ AF_MAT_UPPER
Matrix is upper triangular.
See also: af::solveLU
◆ af_solve()C Interface to solve a system of equations.
The options
parameter must be one of AF_MAT_NONE, AF_MAT_LOWER or AF_MAT_UPPER.
This function is not supported in GFOR.
a
C++ Interface to solve a system of equations.
The options
parameter must be one of AF_MAT_NONE, AF_MAT_LOWER or AF_MAT_UPPER.
This function is not supported in GFOR.
a
x
, the matrix of unknown variables
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4