ProteoWizard
Public Member Functions | List of all members
pwiz::math::LinearLeastSquares< LinearLeastSquaresType_LU > Class Reference

#include <LinearLeastSquares.hpp>

Public Member Functions

template<typename T >
boost::numeric::ublas::vector< T > solve (const boost::numeric::ublas::matrix< T > &A, const boost::numeric::ublas::vector< T > &y)
 

Detailed Description

Definition at line 40 of file LinearLeastSquares.hpp.

Member Function Documentation

◆ solve()

template<typename T >
boost::numeric::ublas::vector< T > pwiz::math::LinearLeastSquares< LinearLeastSquaresType_LU >::solve ( const boost::numeric::ublas::matrix< T > &  A,
const boost::numeric::ublas::vector< T > &  y 
)
inline

Definition at line 44 of file LinearLeastSquares.hpp.

46 {
47 boost::numeric::ublas::permutation_matrix<std::size_t> m(A.size1());
48 boost::numeric::ublas::matrix<T> AtA = prod(trans(A), A);
49 boost::numeric::ublas::vector<T> b = y;
50 boost::numeric::ublas::vector<T> r;
51
52 // This serves as a sanity check. Note that an exception here
53 // probably indicates a data file error.
54 if (boost::numeric::ublas::lu_factorize(AtA, m) == 0.)
55 {
56 r = prod(trans(A), b);
57
58 boost::numeric::ublas::lu_substitute(AtA, m, r);
59 }
60
61 return r;
62 }
#define A
KernelTraitsBase< Kernel >::space_type::ordinate_type y

References A, and y.


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