OpenMS
NonNegativeLeastSquaresSolver Class Reference

Wrapper for a non-negative least squares (NNLS) solver. More...

#include <OpenMS/ML/NNLS/NonNegativeLeastSquaresSolver.h>

Public Types

enum  RETURN_STATUS { SOLVED , ITERATION_EXCEEDED }
 

Static Public Member Functions

static Int solve (const Matrix< double > &A, const Matrix< double > &b, Matrix< double > &x)
 This is a wrapper for the external nnls library for the non-negative least square problem Ax=b, where x>0. More...
 
static Int solve (Matrix< double >::EigenMatrixType &A, std::vector< double > &b, std::vector< double > &x)
 This is a wrapper for the external nnls library for the non-negative least square problem Ax=b, where x>0. Works without copies but inputs will be modified. More...
 

Detailed Description

Wrapper for a non-negative least squares (NNLS) solver.

It solves Ax=b, where x>0 in the least squares sense (i.e. minimum residual)

Member Enumeration Documentation

◆ RETURN_STATUS

Enumerator
SOLVED 
ITERATION_EXCEEDED 

Member Function Documentation

◆ solve() [1/2]

static Int solve ( const Matrix< double > &  A,
const Matrix< double > &  b,
Matrix< double > &  x 
)
static

This is a wrapper for the external nnls library for the non-negative least square problem Ax=b, where x>0.

Parameters
AInput matrix A of size m x n
bInput vector (OpenMS::Matrix with one column) b of size m x 1
xOutput vector (OpenMS::Matrix with one column) with non-negative least square solution of size n x 1
Returns
status of solution (either NonNegativeLeastSquaresSolver::SOLVED, NonNegativeLeastSquaresSolver::ITERATION_EXCEEDED)
Exceptions
Exception::InvalidParametersif Matrix dimensions do not fit

◆ solve() [2/2]

static Int solve ( Matrix< double >::EigenMatrixType &  A,
std::vector< double > &  b,
std::vector< double > &  x 
)
static

This is a wrapper for the external nnls library for the non-negative least square problem Ax=b, where x>0. Works without copies but inputs will be modified.

Parameters
AInput pointer to Eigen::MatrixXd A of size m x n (Note: due to an in-place algorithm, A will be modified!)
bInput vector b of size m (Note: due to an in-place algorithm, b will be modified!)‚
xOutput vector with non-negative least square solution of size n. Contents will be overwritten!‚
Returns
status of solution (either NonNegativeLeastSquaresSolver::SOLVED, NonNegativeLeastSquaresSolver::ITERATION_EXCEEDED)
Exceptions
Exception::InvalidParametersif Matrix dimensions do not fit