ProteoWizard
Public Member Functions | List of all members
pwiz::math::LinearSolver< LinearSolverType_QR > Class Template Reference

#include <LinearSolver.hpp>

Public Member Functions

template<typename matrix_type , typename vector_type >
vector_type solve (const matrix_type &A, const vector_type &y)
 solve system of linear equations Ax = y using boost::ublas; note: extra copying inefficiencies for ease of client use More...
 

Detailed Description

template<>
class pwiz::math::LinearSolver< LinearSolverType_QR >

Definition at line 82 of file LinearSolver.hpp.

Member Function Documentation

§ solve()

template<typename matrix_type , typename vector_type >
vector_type pwiz::math::LinearSolver< LinearSolverType_QR >::solve ( const matrix_type &  A,
const vector_type &  y 
)
inline

solve system of linear equations Ax = y using boost::ublas; note: extra copying inefficiencies for ease of client use

Definition at line 89 of file LinearSolver.hpp.

References pwiz::math::qr().

Referenced by pwiz::math::LinearLeastSquares< LinearLeastSquaresType_QR >::solve(), and testDoubleQR().

90  {
91  typedef typename matrix_type::size_type size_type;
92  typedef typename matrix_type::value_type value_type;
93 
94  namespace ublas = boost::numeric::ublas;
95 
96  matrix_type Q(A.size1(), A.size2()), R(A.size1(), A.size2());
97 
98  qr (A, Q, R);
99 
100  vector_type b = prod(trans(Q), y);
101 
102  vector_type result;
103  if (R.size1() > R.size2())
104  {
105  size_type min = (R.size1() < R.size2() ? R.size1() : R.size2());
106 
107  result = ublas::solve(subrange(R, 0, min, 0, min),
108  subrange(b, 0, min),
109  ublas::upper_tag());
110  }
111  else
112  {
113  result = ublas::solve(R, b, ublas::upper_tag());
114  }
115  return result;
116  }
void qr(const matrix_type &A, matrix_type &Q, matrix_type &R)
Definition: qr.hpp:81
#define A
KernelTraitsBase< Kernel >::space_type::ordinate_type y

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