summaryrefslogtreecommitdiff
path: root/impl/EquationSystem.hpp
diff options
context:
space:
mode:
authorCarlo Zancanaro <carlo@carlo-laptop>2012-04-26 16:15:17 +1000
committerCarlo Zancanaro <carlo@carlo-laptop>2012-04-26 16:15:17 +1000
commit63a10756032fa5c677787fba209706b8bf1e4bef (patch)
tree705ee15011d9aaeec3b921c3f808427c8aa00589 /impl/EquationSystem.hpp
parenta9de4273bf8377aeab7d3f76a6d8bc0c89b42f79 (diff)
A bunch of modifications working to a good solver.
Diffstat (limited to 'impl/EquationSystem.hpp')
-rw-r--r--impl/EquationSystem.hpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/impl/EquationSystem.hpp b/impl/EquationSystem.hpp
index efd34b3..3232620 100644
--- a/impl/EquationSystem.hpp
+++ b/impl/EquationSystem.hpp
@@ -10,6 +10,9 @@ struct EquationSystem {
void add(std::string k, Expression<T> v) {
equations.insert(std::pair<std::string, Expression<T> >(k, v));
}
+ unsigned int count() const {
+ return equations.size();
+ }
/**
init is the value where it STARTS, it's working the other way
if there's no stability then it ends with -init
@@ -42,6 +45,16 @@ struct EquationSystem {
return result;
}
+ std::string output() const {
+ std::string output = "";
+ for (typename std::map<std::string, Expression<T> >::const_iterator it = equations.begin();
+ it != equations.end();
+ ++it) {
+ output += it->first + " = " + it->second.output() + "\n";
+ }
+ return output;
+ }
+
private:
std::map<std::string, T> eval(const std::map<std::string, T>& assignment, bool infinity, const T& infValue) const {
std::map<std::string, T> result;