Skip to content

Commit 0fb6a1f

Browse files
committed
Added Map::lessImage, upgraded PWMap::minMap
1 parent af9060b commit 0fb6a1f

13 files changed

Lines changed: 261 additions & 266 deletions

algorithms/scc/decreasing_edges_mrv.cpp

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -42,11 +42,8 @@ Set LtEdgesMRV::decreasingRepresentative(const PWMap& rmap) const
4242
PWMap rmapB = rmap.composition(mapB);
4343
PWMap rmapD = rmap.composition(mapD);
4444

45-
Set less_eq1 = rmapD.lessEqImage(rmapB);
46-
Set less_eq2 = rmapB.lessEqImage(rmapD);
47-
less_eq1 = less_eq1.difference(less_eq2);
48-
49-
return less_eq1;
45+
Set result = rmapD.lessImage(rmapB);
46+
return result;
5047
}
5148

5249
Set LtEdgesMRV::edgesInPaths(const PWMap& smap) const

algorithms/scc/minadj_mrv.cpp

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,7 @@ PWMap MinAdjMRV::calculate(const DSBG& dsbg)
9191
}
9292
PWMap dmapB = dmap.composition(mapB), dmapD = dmap.composition(mapD);
9393
// Get edges where the end is closer to the rep than the beginning
94-
Set not_cycle_edges = dmapD.lessEqImage(dmapB);
95-
Set less_eq2 = dmapB.lessEqImage(dmapD);
96-
not_cycle_edges = not_cycle_edges.difference(less_eq2);
94+
Set not_cycle_edges = dmapD.lessImage(dmapB);
9795
ER = ER.intersection(not_cycle_edges);
9896

9997
// Extend to subset-edge

eval/eval_exec.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@ EvalExecutor::EvalExecutor() : scc_impl_(1)
7979
"\n - 2 for domain ordered PWMaps")
8080
("scc_impl", Util::prog_opts::value(&scc_impl_),
8181
"Desired SCC algorithm implementation:"
82-
"\n - 0 for V1 of minimum reachable SCC (default option)"
83-
"\n - 1 for V2 of minimum reachable SCC");
82+
"\n - 0 for V1 of minimum reachable SCC"
83+
"\n - 1 for V2 of minimum reachable SCC (default option)");
8484

8585
cmd_line_opts_.add(generic_).add(config_).add(hidden_);
8686
cfg_file_opts_.add(config_).add(hidden_);

sbg/dom_ord_pwmap.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ PWMapStratPtr DomOrdPWMap::operator+(const PWMapStrategy& other) const
188188
Set set_in = SET_FACT.createSet();
189189
Set set_out = SET_FACT.createSet();
190190
OrdMapCollection res;
191-
processMapsOrd(other,set_in, set_out, res, &DomOrdPWMap::processAdd, false);
191+
processMapsOrd(other,set_in, set_out, res,& DomOrdPWMap::processAdd, false);
192192
return std::make_unique<DomOrdPWMap>(res);
193193
}
194194

@@ -602,7 +602,7 @@ PWMapStratPtr DomOrdPWMap::minMap(const PWMapStrategy& other) const
602602
if (isEmpty() || other.isEmpty())
603603
return std::make_unique<DomOrdPWMap>();
604604

605-
Set min_in_pw1 = lessEqImage(other);
605+
Set min_in_pw1 = lessImage(other);
606606
return restrict(min_in_pw1)->combine(*other.restrict(dom()));
607607
}
608608

@@ -611,7 +611,7 @@ PWMapStratPtr DomOrdPWMap::minAdjMap(const PWMapStrategy& other) const
611611
Set set_in = SET_FACT.createSet();
612612
Set set_out = SET_FACT.createSet();
613613
OrdMapCollection res;
614-
processMapsOrd(other, set_in, set_out, res, &DomOrdPWMap::processMinAdjMap, true);
614+
processMapsOrd(other, set_in, set_out, res,& DomOrdPWMap::processMinAdjMap, true);
615615
std::sort(res.begin(), res.end(), operator<);
616616
return std::make_unique<DomOrdPWMap>(res);
617617
}
@@ -722,7 +722,7 @@ Set DomOrdPWMap::equalImage(const PWMapStrategy& other) const
722722
Set set_in = SET_FACT.createSet();
723723
Set set_out = SET_FACT.createSet();
724724
OrdMapCollection no_used;
725-
processMapsOrd(other, set_in, set_out, no_used, &DomOrdPWMap::processEqualImage
725+
processMapsOrd(other, set_in, set_out, no_used,& DomOrdPWMap::processEqualImage
726726
, false);
727727
return set_out;
728728
}
@@ -741,7 +741,7 @@ void DomOrdPWMap::processEqualImage(const Map& m1, const Map& m2,
741741
}
742742
}
743743

744-
Set DomOrdPWMap::lessEqImage(const PWMapStrategy& other) const
744+
Set DomOrdPWMap::lessImage(const PWMapStrategy& other) const
745745
{
746746
if (isEmpty() || other.isEmpty())
747747
return SET_FACT.createSet();
@@ -750,7 +750,7 @@ Set DomOrdPWMap::lessEqImage(const PWMapStrategy& other) const
750750
Set min_in_pw1 = SET_FACT.createSet();
751751
for (const MapEntry& me1 : pieces_) {
752752
for (const MapEntry& me2 : othr.pieces_) {
753-
min_in_pw1 = min_in_pw1.disjointCup(me1.first.lessEqImage(me2.first));
753+
min_in_pw1 = min_in_pw1.disjointCup(me1.first.lessImage(me2.first));
754754
}
755755
}
756756

@@ -761,7 +761,7 @@ void DomOrdPWMap::processMapsOrd(
761761
const PWMapStrategy& other,
762762
Set& set_in,
763763
Set& set_out,
764-
OrdMapCollection & ord_map,
764+
OrdMapCollection& ord_map,
765765
ProcessFunc process,
766766
bool order_mts
767767
) const

sbg/dom_ord_pwmap.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ struct DomOrdPWMap : public OrdPWMap {
108108
PWMapStratPtr filterMap(bool (*f)(const Map& )) const override;
109109

110110
Set equalImage(const PWMapStrategy& other) const override;
111-
Set lessEqImage(const PWMapStrategy& other) const override;
111+
Set lessImage(const PWMapStrategy& other) const override;
112112
Set sharedImage() const override;
113113

114114
PWMapStratPtr offsetDom(const MD_NAT& off) const override;

sbg/map.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ bool Map::isId() const
254254
return exp_.isId();
255255
}
256256

257-
Set Map::lessEqImage(const Map& other) const
257+
Set Map::lessImage(const Map& other) const
258258
{
259259
Set result = SET_FACT.createSet();
260260

@@ -264,7 +264,7 @@ Set Map::lessEqImage(const Map& other) const
264264
Exp exp2 = other.exp_;
265265

266266
Set cap_dom = dom_.intersection(other.dom_);
267-
if (exp1 == exp2)
267+
if (cap_dom.isEmpty())
268268
return cap_dom;
269269

270270
for (int k = 0; k < ar; ++k) {
@@ -276,7 +276,7 @@ Set Map::lessEqImage(const Map& other) const
276276
if (m1 == m2) {
277277
RATIONAL h1 = linear_exp1.offset();
278278
RATIONAL h2 = linear_exp2.offset();
279-
if (h2 >= h1) {
279+
if (h1 < h2) {
280280
result.emplaceBack(min_in_m1);
281281
}
282282
break;

sbg/map.hpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -146,11 +146,11 @@ struct Map {
146146
bool isId() const;
147147

148148
/**
149-
* @brief Returns the set of elements of the domain that have a lesser or
150-
* equal image in the first argument.
151-
* For example: lessEqImage({[1:100]} -> x, {[1:100]} -> -x+100) = {[1:50]}.
149+
* @brief Returns the set of elements of the domain that have a lesser
150+
* image in the first argument.
151+
* For example: lessImage({[1:100]} -> x, {[1:100]} -> -x+100) = {[1:49]}.
152152
*/
153-
Set lessEqImage(const Map& other) const;
153+
Set lessImage(const Map& other) const;
154154

155155
/**
156156
* @brief Compact the domain of two maps if both share the same expression. If

0 commit comments

Comments
 (0)