33 std::size_t n = _m.size();
35 for(std::size_t i = 0; i < n; i++) {
39 for(std::size_t i = 0; i < n; i++) {
40 for(std::size_t j = i+1; j < n; j++) {
41 auto ratio = _m[j][i]/_m[i][i];
42 for(std::size_t k = 0; k < _m[i].size(); k++) {
43 _m[j][k] = _m[j][k] - ratio*_m[i][k];
49 for(std::size_t i = 0; i < n; i++) {
54 x[n-1] = _m[n-1][n]/_m[n-1][n-1];
56 for(
int i = n-2; i>=0; i--) {
58 for(std::size_t j = i+1; j < n; j++) {
59 x[i] = x[i] - _m[i][j]*x[j];
64 for(std::size_t i = 0; i < x.size(); i++)
65 CHEM_LOG(TRACE) <<
"x[" << i <<
"]=" << x[i];
M< typename _M::value_type::value_type, std::tuple_size< _M >::value, std::tuple_size< typename _M::value_type >::value+1 > augment(const _M &m, const X< typename _M::value_type::value_type, std::tuple_size< _M >::value > &x)
Definition linear.h:164