Constructs a nonnegative least squares solution for the given linear system
Ax = y, optionally adding an intercept parameter to the
model.
Namespace:
CenterSpace.NMath.CoreAssembly: NMath (in NMath.dll) Version: 5.1.0.0
Syntax
| C# |
|---|
public FloatNonnegativeLeastSquares( FloatMatrix A, FloatVector y, bool addIntercept, float tolerance ) |
| Visual Basic (Declaration) |
|---|
Public Sub New ( _ A As FloatMatrix, _ y As FloatVector, _ addIntercept As Boolean, _ tolerance As Single _ ) |
| Visual C++ |
|---|
public: FloatNonnegativeLeastSquares( FloatMatrix^ A, FloatVector^ y, bool addIntercept, float tolerance ) |
Parameters
- A
- Type: CenterSpace.NMath.Core..::.FloatMatrix
The matrix.
- y
- Type: CenterSpace.NMath.Core..::.FloatVector
The right hand side.
- addIntercept
- Type: System..::.Boolean
If true, a column of ones is prepended to a deep copy of matrix A before solving for the nonnegative least squares solution. This corresponds to adding an intercept parameter to the model. Note: the input matrix A is not changed.
- tolerance
- Type: System..::.Single
Specifies a tolerance for detecting rank deficiency while solving the nonnegative least squares problem.
Remarks
The nonnegative least squares
algorithm is an iterative algorithm which may solve an unconstrained least
least squares problem, Bx = y, during an iteration. If the matrix
B is rank deficient (has less than full rank) the solution is not
unique and is somewhat suspect. If such a rank deficiency is detetected
while performing the nonnegative least squares algorithm the
RankDeficiencyDetected property will return true.
Exceptions
| Exception | Condition |
|---|---|
| CenterSpace.NMath.Core..::.MismatchedSizeException | Thrown if the number of rows in A is not equal to the length of y. |