Skip to content
Snippets Groups Projects
Commit a2da36b8 authored by Radek Hušek's avatar Radek Hušek Committed by Radek Hušek
Browse files

Simplify combine() operation

parent 1e3cfb71
No related branches found
No related tags found
No related merge requests found
......@@ -17,13 +17,11 @@ struct Mapping {
inline T operator[] (size_t i) const { return data[i]; }
inline void assign(size_t i, T val) { data[i] = val; }
Mapping& combine(T alpha, T beta, const Mapping& b) {
Mapping &a = *this;
size_t size = a.size();
for (size_t i = 0; i < size; i++)
data[i] = Ring::plus(Ring::multiply(alpha, a.data[i]),
Ring::multiply(beta, b.data[i]));
return a;
Mapping& combine(T beta, const Mapping& b) {
size_t _size = size();
for (size_t i = 0; i < _size; i++)
data[i] = Ring::plus(data[i], Ring::multiply(beta, b.data[i]));
return *this;
}
};
......
......@@ -91,7 +91,7 @@ struct Tester : public AbstractTester {
Mapping& cannonize(Mapping& map) {
for (const auto &i : nonClassEdges) {
if (map[i.first] != Ring::zero)
map.combine(Ring::one, map[i.first], i.second);
map.combine(map[i.first], i.second);
}
return map;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment