lsp::nnls< M, V > Class Template Reference

A functor for solving Non-Negative Least Squares problem. More...

#include <nnls.h>

List of all members.

Public Types

typedef M matrix_type
typedef V vector_type
typedef matrix_type::value_type value_type
typedef matrix_type::size_type size_type

Public Member Functions

 nnls (const matrix_type &matrix, const vector_type &vector)
 An object constructor.
template<class sV , class sM >
void solve (sV &ret, sM &cov) const
 Solving operaton.
template<class sV >
void solve (sV &ret) const


Detailed Description

template<class M, class V>
class lsp::nnls< M, V >

A functor for solving Non-Negative Least Squares problem.

The Non-Negative Least Squares problem is very simular to the Least Squares Problem and has many applications in physics. The NNLS consists of finding vector $ {\bf \hat x} $ such that euclidean norm $ ||A {\bf \hat x} - {\bf b}|| $ is minimal but $ \forall i \quad {\hat x}_i \ge 0 $. Where matrix $ A $ and vector $ {\bf b} $ are given. It is trivial that $ {\bf \hat x} $ for these two problems may be the same but not always.


Constructor & Destructor Documentation

template<class M , class V >
lsp::nnls< M, V >::nnls ( const matrix_type &  matrix,
const vector_type &  vector 
) [inline]

An object constructor.

Parameters:
[in,out] matrix The given matrix $ A $
[in,out] vector The given vector $ {\bf b} $
References to matrix and vector object are stored here. Actual solving will be performed as soon as solve( sV& ret, sM& cov ) will be called. Pay attention that your objects will not be altered but only copyed.


Member Function Documentation

template<class M , class V >
template<class sV , class sM >
void lsp::nnls< M, V >::solve ( sV &  ret,
sM &  cov 
) const [inline]

Solving operaton.

Parameters:
[out] ret Desired vector $ {\bf \hat x} $
[out] cov The covariation matrix of the $ {\bf \hat x} $
Pay attention that covatiation matrix is calculated for Least Squares Problem composed from your matrices that gives answer for Non-Negative Least Squares problem.

References lsp::is_vector_elem(), and lsp::swap_indexes().


The documentation for this class was generated from the following file:

doxygen