﻿ILMath.linsolve Method (InArray(fcomplex), InArray(fcomplex))

ILNumerics Ultimate VS Documentation
ILNumerics - Technical Application Development
Solves a system of linear equations, B = A x.

[ILNumerics Computing Engine]

Namespace:  ILNumerics
Assembly:  ILNumerics.Computing (in ILNumerics.Computing.dll) Version: 5.5.0.0 (5.5.7503.3146)
Syntax

```public static RetArray<fcomplex> linsolve(
InArray<fcomplex> A,
InArray<fcomplex> B
)```

Parameters

A
Type: ILNumericsInArrayfcomplex
Input matrix A. Size [n, q].
B
Type: ILNumericsInArrayfcomplex
Right hand side B. Size [n, m].

Return Value

Type: RetArrayfcomplex
Solution x solving the equation multiply(A, x) = B. Size [q, m].
Remarks

Depending on the structure and properties of A the equation system is solved with different approaches:

• If A is square (q == n) and an upper or lower triangular matrix, the system is solved via backward- or forward substitution and the LAPACK function ?trtrs.
Examples

```Array<fcomplex> A = randn<fcomplex>(4,4); // construct 4 x 4 matrix
Array<fcomplex> B = vector<fcomplex>(1.0,2.0,3.0);
Array<fcomplex> x = linsolve(A,B);```
• if A is square, symmetric /hermitian and positive definite A is decomposed into a triangular equation system using cholesky factorization and solved via back-/ forward substitution.

• otherwise, if A is only square it will be decomposed into upper and lower triangular matrices using LU decomposition and the system than solved with the result.
• otherwise, if A is [n, q] with q != n, the system is solved using qr(InArrayfcomplex) decomposition. Note that A can be rank deficient.

The internal storage order of A and/or B may be silently changed when this function returns. The reason is that most functionality is performed in native LAPACK routines which require a certain storage layout (mostly ColumnMajor).

[ILNumerics Computing Engine]