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

# ILMathAddLanguageSpecificTextSet("LST69074EC8_0?cpp=::|nu=.");linsolve Method (InArrayAddLanguageSpecificTextSet("LST69074EC8_1?cs=&lt;|vb=(Of |cpp=&lt;|fs=&lt;'|nu=(");DoubleAddLanguageSpecificTextSet("LST69074EC8_2?cs=&gt;|vb=)|cpp=&gt;|fs=&gt;|nu=)");, InArrayAddLanguageSpecificTextSet("LST69074EC8_3?cs=&lt;|vb=(Of |cpp=&lt;|fs=&lt;'|nu=(");DoubleAddLanguageSpecificTextSet("LST69074EC8_4?cs=&gt;|vb=)|cpp=&gt;|fs=&gt;|nu=)");)

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

#### Parameters

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

#### Return Value

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

See Also

#### Reference

MathInternal.linsolve(InArrayDouble, InArrayDouble, MatrixProperties, Boolean)
MathInternal.lu(InArrayDouble)
MathInternal.qr(InArrayDouble)
MathInternal.pinv(InArrayDouble, NullableDouble)
MathInternal.svd(InArrayDouble, OutArrayDouble, Boolean)