Solving Linear Systems

All decomposition classes inherit from the LinearOperator<T> abstract base class, which defines common methods for solving systems of simultaneous linear equations and related operations. All these methods call the Decompose method as needed. Unlike for matrix types, there is no performance penalty for calling several of these methods in succession. The decomposition is only calculated once.

The Solve method is overloaded. To solve for one right-hand side, pass this value as a Vector<T> as the first argument. To solve for multiple right-hand sides, store the vectors in the columns of a Matrix<T>. An optional second argument specifies whether the right-hand sides should be overwritten with the solution. By default, a new vector or matrix instance is created of the same dimensions as the right-hand side. The SolveInto method is the same, but lets you specify the array that is to hold the result.

To solve for the transpose of a matrix, use the SolveTranspose or SolveTransposeInto method.

To compute a least squares solution for an over-determined system, use the LeastSquaresSolve or LeastSquaresSolveInto method.

A matrix is singular when not all of its rows or columns are linearly independent. The IsSingular method returns a Boolean value that indicates this condition.

The inverse matrix is returned by the GetInverse method.

The condition number of a matrix is defined as the ratio of its largest to its smallest singular value. Because the calculation of singular values is a very expensive operation, an estimate that is cheaper to calculate is usually preferred. The EstimateConditionNumber method returns such an estimate.

The condition number gives an indication of the worst case loss of precision when solving a system of simultaneous linear equations. The condition number of a singular matrix is infinite, which is returned as Double.PositiveInfinity.

The determinant of a matrix is returned by the GetDeterminant method. The determinant is only defined for square matrices.