mirror of
https://github.com/Z3Prover/z3
synced 2025-04-29 11:55:51 +00:00
rename
Signed-off-by: Lev <levnach@hotmail.com>
This commit is contained in:
parent
1ed9639898
commit
2fd32ce62d
6 changed files with 99 additions and 133 deletions
|
@ -1,33 +1,60 @@
|
|||
/*++
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
/*
|
||||
Copyright (c) 2017 Microsoft Corporation
|
||||
Author: Nikolaj Bjorner
|
||||
*/
|
||||
#include "util/lp/lp_settings.h"
|
||||
#include "util/vector.h"
|
||||
#include "util/lp/lar_solver.h"
|
||||
|
||||
Module Name:
|
||||
namespace nla {
|
||||
/*
|
||||
* represents definition m_v = v1*v2*...*vn,
|
||||
* where m_vs = [v1, v2, .., vn]
|
||||
*/
|
||||
class monomial {
|
||||
// fields
|
||||
lp::var_index m_v;
|
||||
svector<lp::var_index> m_vs;
|
||||
public:
|
||||
// constructors
|
||||
monomial(lp::var_index v, unsigned sz, lp::var_index const* vs):
|
||||
m_v(v), m_vs(sz, vs) {}
|
||||
monomial(lp::var_index v, const svector<lp::var_index> &vs):
|
||||
m_v(v), m_vs(vs) {}
|
||||
monomial() {}
|
||||
unsigned var() const { return m_v; }
|
||||
unsigned size() const { return m_vs.size(); }
|
||||
unsigned operator[](unsigned idx) const { return m_vs[idx]; }
|
||||
svector<lp::var_index>::const_iterator begin() const { return m_vs.begin(); }
|
||||
svector<lp::var_index>::const_iterator end() const { return m_vs.end(); }
|
||||
const svector<lp::var_index> vars() const { return m_vs; }
|
||||
};
|
||||
|
||||
<name>
|
||||
|
||||
Abstract:
|
||||
|
||||
<abstract>
|
||||
|
||||
Author:
|
||||
Nikolaj Bjorner (nbjorner)
|
||||
Lev Nachmanson (levnach)
|
||||
|
||||
Revision History:
|
||||
typedef std::unordered_map<lp::var_index, rational> variable_map_type;
|
||||
|
||||
bool check_assignment(monomial const& m, variable_map_type & vars);
|
||||
|
||||
bool check_assignments(const vector<monomial> & monomimials,
|
||||
const lp::lar_solver& s,
|
||||
variable_map_type & vars);
|
||||
|
||||
|
||||
--*/
|
||||
#pragma once
|
||||
namespace lp {
|
||||
struct monomial {
|
||||
mpq m_coeff; // the coefficient of the monomial
|
||||
var_index m_var; // the variable index
|
||||
public:
|
||||
monomial(const mpq& coeff, var_index var) : m_coeff(coeff), m_var(var) {}
|
||||
monomial(var_index var) : monomial(one_of_type<mpq>(), var) {}
|
||||
const mpq & coeff() const { return m_coeff; }
|
||||
mpq & coeff() { return m_coeff; }
|
||||
var_index var() const { return m_var; }
|
||||
std::pair<mpq, var_index> to_pair() const { return std::make_pair(coeff(), var());}
|
||||
};
|
||||
|
||||
/*
|
||||
* represents definition m_v = coeff* v1*v2*...*vn,
|
||||
* where m_vs = [v1, v2, .., vn]
|
||||
*/
|
||||
class monomial_coeff : public monomial {
|
||||
rational m_coeff;
|
||||
public:
|
||||
monomial_coeff(monomial const& eq, rational const& coeff):
|
||||
monomial(eq), m_coeff(coeff) {}
|
||||
|
||||
monomial_coeff(lp::var_index v, const svector<lp::var_index> &vs, rational const& coeff):
|
||||
monomial(v, vs),
|
||||
m_coeff(coeff) {}
|
||||
|
||||
rational const& coeff() const { return m_coeff; }
|
||||
};
|
||||
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue