#include "Linear.hh" typedef cadabra::multiplier_t multiplier_t; bool linear::gaussian_elimination_inplace(std::vector >& a, std::vector& b) { assert(a.size() == b.size()); // If there are more equations than unknowns, we first reduce the form to // xxx = x // xx = x // x = x // 000 = 0 // 000 = 0 unsigned int number_of_eqs = a.size(); unsigned int number_of_unk = a[0].size(); unsigned int mineu=std::min(number_of_eqs, number_of_unk); // Loop over rows, creating upper-triangular matrix 'a' for(unsigned row=0; row=0; --row) { assert(a[row][row]!=0); for(int col=mineu-1; col>row; --col) { b[row] -= a[row][col]*b[col]; for(unsigned allcol=col; allcol