LeastSquaresSolver<T> Class

Represents the solution to a least squares problem.

Definition

Namespace: Extreme.Mathematics.LinearAlgebra
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
public sealed class LeastSquaresSolver<T>
Inheritance
Object  →  LeastSquaresSolver<T>

Type Parameters

T

Remarks

Use the LeastSquaresSolver<T> class to compute the least squares solution of a system of equations. When a system of linear equations is over-determined, an exact solution may not exist. The least squares solution is the vector that minimizes the sum of the squares of the residuals. To make sure the solution is uniquely defined, the solution with the smallest norm is returned.

The coefficient matrix and the right-hand side must be specified in the constructor. Several methods are available to compute the solution. These can be selected through the SolutionMethod property. This is a LeastSquaresSolutionMethod value. The default is to use a QR decomposition. For ill-conditioned problems, it may be better to use a singular value decomposition. If speed is the dominant factor, then the method using the normal equations is the fastest, at the expense of some accuracy.

A non-negative least squares solution is restricted by having only positive or zero entries in the solution. To compute the non-negative least squares solution, select the value NonNegative for the solution method.

Constructors

LeastSquaresSolver<T> Constructs a new LeastSquaresSolver<T> from the matrix of observations and the vector of outcomes.

Properties

Solution Gets the solution to the least squares problem.
SolutionMethod Gets or sets the LeastSquaresSolutionMethod used to calculate this LeastSquaresSolver<T>.

Methods

EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetPredictions Returns a vector containing the predicted outcomes of the least squares solution.
GetResiduals Returns a vector containing the residuals of the least squares solution.
GetResidualSumOfSquares Returns the sum of the squares of the residuals of the least squares solution.
GetTypeGets the Type of the current instance.
(Inherited from Object)
Solve Solves the least squares problem and returns the least norm solution.
ToStringReturns a string that represents the current object.
(Inherited from Object)

See Also