38#ifndef __SIM_LINEAR_SOLVER_HH__
39#define __SIM_LINEAR_SOLVER_HH__
59 eq = std::vector <double> (unknowns + 1, 0);
64 assert(this->
eq.size() == rhs.
eq.size());
68 for (
unsigned i = 0;
i < res.
eq.size();
i++)
69 res.
eq[
i] = this->eq[
i] + rhs.
eq[
i];
84 assert(unkw <
eq.size());
90 std::ostringstream oss;
91 for (
unsigned i = 0;
i <
eq.size();
i++) {
95 if (
i !=
eq.size() - 1)
103 unsigned cnt()
const {
return eq.size() - 1; }
108 std::vector <double>
eq;
115 for (
unsigned i = 0;
i < unknowns;
i++)
127 r +=
eq.toStr() +
"\n";
131 std::vector <double>
solve()
const;
This class describes a linear equation with constant coefficients.
LinearEquation & operator*=(const double cnt)
std::string toStr() const
std::vector< double > eq
Coefficients.
double & operator[](unsigned unkw)
LinearEquation operator+(const LinearEquation &rhs)
LinearEquation(unsigned unknowns)
LinearSystem(unsigned unknowns)
LinearEquation & operator[](unsigned eq)
std::string toStr() const
std::vector< double > solve() const
std::vector< LinearEquation > matrix
Copyright (c) 2024 - Pranith Kumar Copyright (c) 2020 Inria All rights reserved.