Constructs a nonnegative least squares solution for the given linear system Ax = y, optionally adding an intercept parameter to the model.

Namespace:  CenterSpace.NMath.Core
Assembly:  NMath (in NMath.dll) Version: 5.1.0.0

Syntax

C#
public DoubleNonnegativeLeastSquares(
	DoubleMatrix A,
	DoubleVector y,
	bool addIntercept,
	double tolerance
)
Visual Basic (Declaration)
Public Sub New ( _
	A As DoubleMatrix, _
	y As DoubleVector, _
	addIntercept As Boolean, _
	tolerance As Double _
)
Visual C++
public:
DoubleNonnegativeLeastSquares(
	DoubleMatrix^ A, 
	DoubleVector^ y, 
	bool addIntercept, 
	double tolerance
)

Parameters

A
Type: CenterSpace.NMath.Core..::.DoubleMatrix
The matrix.
y
Type: CenterSpace.NMath.Core..::.DoubleVector
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..::.Double
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

ExceptionCondition
CenterSpace.NMath.Core..::.MismatchedSizeExceptionThrown if the number of rows in A is not equal to the length of y.

See Also