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

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<complex> linsolve(
InArray<complex> A,
InArray<complex> B
)```

#### Parameters

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

#### Return Value

Type: RetArraycomplex
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<complex> A = randn<complex>(4,4); // construct 4 x 4 matrix
Array<complex> B = vector<complex>(1.0,2.0,3.0);
Array<complex> 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(InArraycomplex) 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]