| FloatNonnegativeLeastSquares(FloatMatrix, FloatVector, Boolean, Single, Int32) Constructor |
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: 7.4
Syntax public FloatNonnegativeLeastSquares(
FloatMatrix A,
FloatVector y,
bool addIntercept,
float tolerance,
int maxIterations
)
Public Sub New (
A As FloatMatrix,
y As FloatVector,
addIntercept As Boolean,
tolerance As Single,
maxIterations As Integer
)
public:
FloatNonnegativeLeastSquares(
FloatMatrix^ A,
FloatVector^ y,
bool addIntercept,
float tolerance,
int maxIterations
)
new :
A : FloatMatrix *
y : FloatVector *
addIntercept : bool *
tolerance : float32 *
maxIterations : int -> FloatNonnegativeLeastSquares
Parameters
- A FloatMatrix
- The matrix.
- y FloatVector
- The right hand side.
- addIntercept 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 Single
- Specifies a tolerance for detecting rank deficiency while
solving the nonnegative least squares problem.
- maxIterations Int32
- Maximum number of iterations to perform.
Exceptions Exception | Condition |
---|
MismatchedSizeException | Thrown if the number of rows
in A is not equal to the length of y. |
NMathException | Thrown if the specified maximum number of
iterations performed by the algorithm was exceeded. |
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.
See Also