38 #ifndef __SIM_LINEAR_SOLVER_HH__ 39 #define __SIM_LINEAR_SOLVER_HH__ 60 assert(this->
eq.size() == rhs.
eq.size());
64 for (
unsigned i = 0;
i < res.eq.size();
i++)
65 res.
eq[
i] = this->eq[
i] + rhs.
eq[
i];
80 assert(unkw <
eq.size());
86 std::ostringstream oss;
87 for (
unsigned i = 0;
i <
eq.size();
i++) {
91 if (
i != eq.size() - 1)
99 unsigned cnt()
const {
return eq.size() - 1; }
110 for (
unsigned i = 0;
i < unknowns;
i++)
115 assert(eq < matrix.size());
121 for (
auto &
eq: matrix)
122 r +=
eq.toStr() +
"\n";
LinearSystem(unsigned unknowns)
LinearEquation(unsigned unknowns)
LinearEquation operator+(const LinearEquation &rhs)
std::vector< LinearEquation > matrix
double & operator[](unsigned unkw)
std::string toStr() const
std::string toStr() const
This class describes a linear equation with constant coefficients.
std::vector< double > eq
Coefficients.
LinearEquation & operator*=(const double cnt)