ProteoWizard
Public Member Functions
pwiz::math::LinearSolver< LinearSolverType_QR > Class Template Reference

#include <LinearSolver.hpp>

List of all members.

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

Detailed Description

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

Definition at line 82 of file LinearSolver.hpp.


Member Function Documentation

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 min(), and pwiz::math::qr().

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

{
typedef typename matrix_type::size_type size_type;
typedef typename matrix_type::value_type value_type;
namespace ublas = boost::numeric::ublas;
matrix_type Q(A.size1(), A.size2()), R(A.size1(), A.size2());
qr (A, Q, R);
vector_type b = prod(trans(Q), y);
vector_type result;
if (R.size1() > R.size2())
{
size_type min = (R.size1() < R.size2() ? R.size1() : R.size2());
result = ublas::solve(subrange(R, 0, min, 0, min),
subrange(b, 0, min),
ublas::upper_tag());
}
else
{
result = ublas::solve(R, b, ublas::upper_tag());
}
return result;
}

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