#include <LinearSolver.hpp>
|
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
|
|
Definition at line 82 of file LinearSolver.hpp.
◆ solve()
template<typename matrix_type , typename vector_type >
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.
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
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 }
KernelTraitsBase< Kernel >::space_type::ordinate_type y
void qr(const matrix_type &A, matrix_type &Q, matrix_type &R)
References A, pwiz::math::qr(), and y.
The documentation for this class was generated from the following file:
- /data/libpwiz-dev3648559106/libpwiz-3.0.18342/pwiz/utility/math/LinearSolver.hpp