Skip to content

Commit 8d0b725

Browse files
committed
Debugger minAdj + sbg_algorithms cleanup
1 parent c34fec3 commit 8d0b725

33 files changed

+141
-524
lines changed

Makefile.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ boost_libdir ?= $(prefix)
2222

2323
# Flags, Libraries and Includes
2424
INCLUDES := -I. -I$(boost_libdir)/include
25-
CXXFLAGS := -std=c++17 -Wall -Werror -Wno-reorder -O3 -D BOOST_PHOENIX_STL_TUPLE_H_ -D BOOST_MPL_LIMIT_LIST_SIZE=30 -D BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
25+
CXXFLAGS := -std=c++17 -Wall -Werror -Wno-reorder -O2 -D BOOST_PHOENIX_STL_TUPLE_H_ -D BOOST_MPL_LIMIT_LIST_SIZE=30 -D BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
2626
ifeq ($(MODE),Debug)
2727
CXXFLAGS += -ggdb
2828
endif

eval/visitors/eval_expr.cpp

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -246,15 +246,15 @@ auto connected_visitor_ = Util::Overload {
246246
};
247247

248248
auto matching_visitor_ = Util::Overload {
249-
[](LIB::BaseSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
250-
LIB::BaseMatch match(a.copy(b[0]), d);
251-
return InfoBaseType(match.calculate(c[0]));
249+
[](LIB::BaseSBG a, Util::MD_NAT b, bool c) {
250+
LIB::BaseMatch match(a.copy(b[0]), c);
251+
return InfoBaseType(match.calculate());
252252
},
253-
[](LIB::CanonSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
254-
LIB::CanonMatch match(a.copy(b[0]), d);
255-
return InfoBaseType(match.calculate(c[0]));
253+
[](LIB::CanonSBG a, Util::MD_NAT b, bool c) {
254+
LIB::CanonMatch match(a.copy(b[0]), c);
255+
return InfoBaseType(match.calculate());
256256
},
257-
[](auto a, auto b, auto c, auto d) {
257+
[](auto a, auto b, auto c) {
258258
Util::ERROR("Wrong arguments for matching");
259259
return InfoBaseType();
260260
}
@@ -304,46 +304,46 @@ auto first_inv_visitor_ = Util::Overload {
304304
};
305305

306306
auto match_scc_visitor_ = Util::Overload {
307-
[](LIB::BaseSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
308-
LIB::BaseMatch match(a.copy(b[0]), d);
309-
match.calculate(c[0]);
310-
LIB::BaseSCC scc(buildSCCFromMatching(match), d);
307+
[](LIB::BaseSBG a, Util::MD_NAT b, bool c) {
308+
LIB::BaseMatch match(a.copy(b[0]), c);
309+
match.calculate();
310+
LIB::BaseSCC scc(buildSCCFromMatching(match), c);
311311
return MapBaseType(scc.calculate());
312312
},
313-
[](LIB::CanonSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
314-
LIB::CanonMatch match(a.copy(b[0]), d);
315-
match.calculate(c[0]);
316-
LIB::CanonSCC scc(buildSCCFromMatching(match), d);
313+
[](LIB::CanonSBG a, Util::MD_NAT b, bool c) {
314+
LIB::CanonMatch match(a.copy(b[0]), c);
315+
match.calculate();
316+
LIB::CanonSCC scc(buildSCCFromMatching(match), c);
317317
return MapBaseType(scc.calculate());
318318
},
319-
[](auto a, auto b, auto c, auto d) {
319+
[](auto a, auto b, auto c) {
320320
Util::ERROR("Wrong arguments for matching+scc");
321321
return MapBaseType();
322322
}
323323
};
324324

325325
auto match_scc_ts_visitor_ = Util::Overload {
326-
[](LIB::BaseSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
327-
LIB::BaseMatch match(a.copy(b[0]), d);
328-
LIB::UnordSet match_res = match.calculate(c[0]).matched_edges();
329-
LIB::BaseSCC scc(buildSCCFromMatching(match), d);
326+
[](LIB::BaseSBG a, Util::MD_NAT b, bool c) {
327+
LIB::BaseMatch match(a.copy(b[0]), c);
328+
LIB::UnordSet match_res = match.calculate().matched_edges();
329+
LIB::BaseSCC scc(buildSCCFromMatching(match), c);
330330
LIB::BasePWMap scc_res = scc.calculate();
331-
LIB::BaseTopSort ts(buildSortFromSCC(scc, scc_res), d);
331+
LIB::BaseTopSort ts(buildSortFromSCC(scc, scc_res), c);
332332
LIB::BasePWMap ts_res = ts.calculate();
333333
buildJson(match_res, scc_res, ts_res);
334334
return MapBaseType(ts_res);
335335
},
336-
[](LIB::CanonSBG a, Util::MD_NAT b, Util::MD_NAT c, bool d) {
337-
LIB::CanonMatch match(a.copy(b[0]), d);
338-
LIB::OrdSet match_res = match.calculate(c[0]).matched_edges();
339-
LIB::CanonSCC scc(buildSCCFromMatching(match), d);
336+
[](LIB::CanonSBG a, Util::MD_NAT b, bool c) {
337+
LIB::CanonMatch match(a.copy(b[0]), c);
338+
LIB::OrdSet match_res = match.calculate().matched_edges();
339+
LIB::CanonSCC scc(buildSCCFromMatching(match), c);
340340
LIB::CanonPWMap scc_res = scc.calculate();
341-
LIB::CanonTopSort ts(buildSortFromSCC(scc, scc_res), d);
341+
LIB::CanonTopSort ts(buildSortFromSCC(scc, scc_res), c);
342342
LIB::CanonPWMap ts_res = ts.calculate();
343343
buildJson(match_res, scc_res, ts_res);
344344
return MapBaseType(ts_res);
345345
},
346-
[](auto a, auto b, auto c, auto d) {
346+
[](auto a, auto b, auto c) {
347347
Util::ERROR("Wrong arguments for matching+scc+ts");
348348
return MapBaseType();
349349
}
@@ -675,14 +675,13 @@ ExprBaseType EvalExpression::operator()(AST::Call v) const
675675
break;
676676

677677
case Eval::Func::matching:
678-
if (eval_args.size() == 3) {
678+
if (eval_args.size() == 2) {
679679
arity_ok = true;
680680

681681
SBGBaseType g = std::visit(EvalGraph{}, eval_args[0]);
682682
NatBaseType copies = std::visit(EvalNatBT{}, eval_args[1]);
683-
NatBaseType k = std::visit(EvalNatBT{}, eval_args[2]);
684683
InfoBaseType result = std::visit(
685-
matching_visitor_, g, copies, k, std::variant<bool>(debug_)
684+
matching_visitor_, g, copies, std::variant<bool>(debug_)
686685
);
687686
return result;
688687
}
@@ -723,28 +722,26 @@ ExprBaseType EvalExpression::operator()(AST::Call v) const
723722
}
724723

725724
case Eval::Func::match_scc:
726-
if (eval_args.size() == 3) {
725+
if (eval_args.size() == 2) {
727726
arity_ok = true;
728727

729728
SBGBaseType g = std::visit(EvalGraph{}, eval_args[0]);
730729
NatBaseType copies = std::visit(EvalNatBT{}, eval_args[1]);
731-
NatBaseType k = std::visit(EvalNatBT{}, eval_args[2]);
732730
MapBaseType result = std::visit(
733-
match_scc_visitor_, g, copies, k, std::variant<bool>(debug_)
731+
match_scc_visitor_, g, copies, std::variant<bool>(debug_)
734732
);
735733
return result;
736734
}
737735
break;
738736

739737
case Eval::Func::match_scc_ts:
740-
if (eval_args.size() == 3) {
738+
if (eval_args.size() == 2) {
741739
arity_ok = true;
742740

743741
SBGBaseType g = std::visit(EvalGraph{}, eval_args[0]);
744742
NatBaseType copies = std::visit(EvalNatBT{}, eval_args[1]);
745-
NatBaseType k = std::visit(EvalNatBT{}, eval_args[2]);
746743
MapBaseType result = std::visit(
747-
match_scc_ts_visitor_, g, copies, k, std::variant<bool>(debug_)
744+
match_scc_ts_visitor_, g, copies, std::variant<bool>(debug_)
748745
);
749746
return result;
750747
}

sbg/pw_map.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -717,9 +717,10 @@ PWMap<Set> PWMap<Set>::minAdjMap(const PWMap &other2, const PWMap &other3) const
717717
PWMap ith_pw(ith);
718718
Set again = dom_res.intersection(visited);
719719
if (!again.isEmpty()) {
720-
PWMap<Set> min_map = other3.minMap(res, ith_pw, other3);
720+
PWMap aux_res = res.restrict(dom_res);
721+
PWMap min_map = other3.minMap(aux_res, ith_pw, other3);
721722
res = min_map.combine(ith_pw).combine(res);
722-
visited = visited.cup(min_map.dom());
723+
visited = visited.cup(ith_pw.dom());
723724
}
724725
else {
725726
res.emplaceBack(ith);

0 commit comments

Comments
 (0)