ILNumerics Ultimate VSILMathlinsolve Method (InArrayDouble, InArrayDouble)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.3.7131.2749)

public static RetArray<double> linsolve(
	InArray<double> A,
	InArray<double> B


Type: ILNumericsInArrayDouble
Input matrix A. Size [n, q].
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].

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.

    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


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