Least Squares Solver<T> Class
Definition
Assembly: Numerics.NET (in Numerics.NET.dll) Version: 9.0.3
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
Least | 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. |
Solution | Gets or sets the LeastSquaresSolutionMethod used to calculate this LeastSquaresSolver<T>. |
Methods
Equals | Determines whether the specified object is equal to the current object. (Inherited from Object) |
Get | Serves as the default hash function. (Inherited from Object) |
Get | Returns a vector containing the predicted outcomes of the least squares solution. |
Get | Returns a vector containing the residuals of the least squares solution. |
Get | Returns the sum of the squares of the residuals of the least squares solution. |
Get | Gets the Type of the current instance. (Inherited from Object) |
Solve | Solves the least squares problem and returns the least norm solution. |
ToString | Returns a string that represents the current object. (Inherited from Object) |