From 15543fc9edf01443cb90d763a2cf19226b588e58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20S=C3=B8lvsten?= Date: Wed, 6 Mar 2024 09:40:40 +0100 Subject: [PATCH] Format latest changes --- src/adiar/bdd.h | 7 +-- src/adiar/bdd/apply.cpp | 6 +-- src/adiar/bdd/quantify.cpp | 3 +- src/adiar/internal/algorithms/prod2.h | 15 ++++--- src/adiar/internal/bool_op.h | 43 +++++++++++-------- src/adiar/zdd/binop.cpp | 6 +-- test/adiar/internal/test_bool_op.cpp | 62 +++++++++++---------------- test/adiar/zdd/test_binop.cpp | 6 +-- test/test.cpp | 2 +- 9 files changed, 75 insertions(+), 75 deletions(-) diff --git a/src/adiar/bdd.h b/src/adiar/bdd.h index 41c4d0df2..f89927186 100644 --- a/src/adiar/bdd.h +++ b/src/adiar/bdd.h @@ -105,7 +105,8 @@ namespace adiar /// \brief The BDD representing the i'th variable. /// /// \param var - /// The label of the desired variable. This value must be smaller or equals to `bdd::max_label`. + /// The label of the desired variable. This value must be smaller or equals to + /// `bdd::max_label`. /// /// \returns \f$ x_{var} \f$ /// @@ -853,8 +854,8 @@ namespace adiar /// BDD to be quantified. /// /// \param vars - /// Generator function, that produces variables to be quantified in \em descending order. These - /// values have to be smaller than or equals to `bdd::max_label`. + /// Generator function, that produces variables to be quantified in \em descending order. + /// These values have to be smaller than or equals to `bdd::max_label`. /// /// \returns \f$ \exists x_i \in \texttt{gen()} : f \f$ ////////////////////////////////////////////////////////////////////////////////////////////////// diff --git a/src/adiar/bdd/apply.cpp b/src/adiar/bdd/apply.cpp index cd9ecf5a9..7f79b161f 100644 --- a/src/adiar/bdd/apply.cpp +++ b/src/adiar/bdd/apply.cpp @@ -13,7 +13,7 @@ namespace adiar { ////////////////////////////////////////////////////////////////////////////////////////////////// // BDD product construction policy - template>> + template >> class apply_prod2_policy : public bdd_policy , public internal::prod2_mixed_level_merger @@ -108,9 +108,9 @@ namespace adiar /// \brief Hook for applying an operator to a pair of terminals. bdd::pointer_type - operator() (const bdd::pointer_type& a, const bdd::pointer_type& b) const + operator()(const bdd::pointer_type& a, const bdd::pointer_type& b) const { - return this->_op(a,b); + return this->_op(a, b); } public: diff --git a/src/adiar/bdd/quantify.cpp b/src/adiar/bdd/quantify.cpp index 8fd2a84ee..3fcd22d72 100644 --- a/src/adiar/bdd/quantify.cpp +++ b/src/adiar/bdd/quantify.cpp @@ -18,7 +18,8 @@ namespace adiar class bdd_quantify_policy : public bdd_policy { private: - // Inherit from `predicate` to hide these compile-time simplifications `bool_op` (see #162) + // Inherit from `predicate` to hide these compile-time simplifications `bool_op` + // (see #162) static constexpr bdd::pointer_type shortcutting_terminal = bdd::pointer_type(ShortcuttingValue); static constexpr bdd::pointer_type irrelevant_terminal = bdd::pointer_type(!ShortcuttingValue); diff --git a/src/adiar/internal/algorithms/prod2.h b/src/adiar/internal/algorithms/prod2.h index 909e55ca0..c1410245d 100644 --- a/src/adiar/internal/algorithms/prod2.h +++ b/src/adiar/internal/algorithms/prod2.h @@ -743,8 +743,7 @@ namespace adiar::internal const size_t max_pq_1_size = internal_only ? std::min(pq_1_memory_fits, pq_1_bound) : pq_1_bound; - const size_t pq_2_bound = - __prod2_ilevel_upper_bound(in_0, in_1, policy); + const size_t pq_2_bound = __prod2_ilevel_upper_bound(in_0, in_1, policy); const size_t max_pq_2_size = internal_only ? std::min(pq_2_memory_fits, pq_2_bound) : pq_2_bound; @@ -772,8 +771,14 @@ namespace adiar::internal using pq_1_type = prod_priority_queue_1_t; using pq_2_type = prod_priority_queue_2_t; - return __prod2_pq( - ep, in_0, in_1, policy, pq_1_internal_memory, max_pq_1_size, pq_2_internal_memory, max_pq_2_size); + return __prod2_pq(ep, + in_0, + in_1, + policy, + pq_1_internal_memory, + max_pq_1_size, + pq_2_internal_memory, + max_pq_2_size); } else { #ifdef ADIAR_STATS stats_prod2.lpq.external += 1u; @@ -781,7 +786,7 @@ namespace adiar::internal using pq_1_type = prod_priority_queue_1_t; const size_t pq_1_memory = aux_available_memory / 2; - using pq_2_type = prod_priority_queue_2_t; + using pq_2_type = prod_priority_queue_2_t; const size_t pq_2_memory = pq_1_memory; return __prod2_pq( diff --git a/src/adiar/internal/bool_op.h b/src/adiar/internal/bool_op.h index 831fc16a2..a0ea25b68 100644 --- a/src/adiar/internal/bool_op.h +++ b/src/adiar/internal/bool_op.h @@ -95,7 +95,7 @@ namespace adiar::internal ////////////////////////////////////////////////////////////////////////////////////////////////// /// \brief Specialization for boolean operators, i.e. any `predicate`. ////////////////////////////////////////////////////////////////////////////////////////////////// - template<> + template <> class binary_op> { private: @@ -130,28 +130,35 @@ namespace adiar::internal /// \brief Construction from `predicate` //////////////////////////////////////////////////////////////////////////////////////////////// binary_op(const predicate& op) - : _op{{ {{op(false,false), op(false, true)}}, {{op(true,false), op(true,true)}} }} - , _left_shortcutting{ adiar::internal::can_left_shortcut(op, false), adiar::internal::can_left_shortcut(op, true) } - , _right_shortcutting{ adiar::internal::can_right_shortcut(op, false), adiar::internal::can_right_shortcut(op, true) } - , _left_idempotent{ adiar::internal::is_left_idempotent(op, false), adiar::internal::is_left_idempotent(op, true) } - , _right_idempotent{ adiar::internal::is_right_idempotent(op, false), adiar::internal::is_right_idempotent(op, true) } - , _left_negating{ adiar::internal::is_left_negating(op, false), adiar::internal::is_left_negating(op, true) } - , _right_negating{ adiar::internal::is_right_negating(op, false), adiar::internal::is_right_negating(op, true) } + : _op{ { { { op(false, false), op(false, true) } }, + { { op(true, false), op(true, true) } } } } + , _left_shortcutting{ adiar::internal::can_left_shortcut(op, false), + adiar::internal::can_left_shortcut(op, true) } + , _right_shortcutting{ adiar::internal::can_right_shortcut(op, false), + adiar::internal::can_right_shortcut(op, true) } + , _left_idempotent{ adiar::internal::is_left_idempotent(op, false), + adiar::internal::is_left_idempotent(op, true) } + , _right_idempotent{ adiar::internal::is_right_idempotent(op, false), + adiar::internal::is_right_idempotent(op, true) } + , _left_negating{ adiar::internal::is_left_negating(op, false), + adiar::internal::is_left_negating(op, true) } + , _right_negating{ adiar::internal::is_right_negating(op, false), + adiar::internal::is_right_negating(op, true) } , _commutative(adiar::internal::is_commutative(op)) - { } + {} public: //////////////////////////////////////////////////////////////////////////////////////////////// bool - operator ()(const bool lhs, const bool rhs) const + operator()(const bool lhs, const bool rhs) const { return this->_op[lhs][rhs]; } //////////////////////////////////////////////////////////////////////////////////////////////// - template + template Pointer - operator ()(const Pointer& lhs, const Pointer& rhs) const + operator()(const Pointer& lhs, const Pointer& rhs) const { static_assert(std::is_same::value); return (*this)(lhs.value(), rhs.value()); @@ -164,7 +171,7 @@ namespace adiar::internal return this->_left_shortcutting[p]; } - template + template bool can_left_shortcut(const Pointer& p) const { @@ -178,7 +185,7 @@ namespace adiar::internal return this->_right_shortcutting[p]; } - template + template bool can_right_shortcut(const Pointer& p) const { @@ -192,7 +199,7 @@ namespace adiar::internal return this->_left_idempotent[p]; } - template + template bool is_left_idempotent(const Pointer& p) const { @@ -206,7 +213,7 @@ namespace adiar::internal return this->_right_idempotent[p]; } - template + template bool is_right_idempotent(const Pointer& p) const { @@ -220,7 +227,7 @@ namespace adiar::internal return this->_left_negating[p]; } - template + template bool is_left_negating(const Pointer& p) const { @@ -234,7 +241,7 @@ namespace adiar::internal return this->_right_negating[p]; } - template + template bool is_right_negating(const Pointer& p) const { diff --git a/src/adiar/zdd/binop.cpp b/src/adiar/zdd/binop.cpp index c84effef3..2d541432c 100644 --- a/src/adiar/zdd/binop.cpp +++ b/src/adiar/zdd/binop.cpp @@ -93,7 +93,7 @@ namespace adiar public: /// \brief Hook for case of two BDDs with the same node file. __zdd - resolve_same_file(const zdd& zdd_1, const zdd&/*zdd_2*/) const + resolve_same_file(const zdd& zdd_1, const zdd& /*zdd_2*/) const { // Compute the results on all children. const bool op_F = this->_op(false, false); @@ -180,9 +180,9 @@ namespace adiar /// \brief Hook for applying an operator to a pair of terminals. zdd::pointer_type - operator() (const zdd::pointer_type& a, const zdd::pointer_type& b) const + operator()(const zdd::pointer_type& a, const zdd::pointer_type& b) const { - return this->_op(a,b); + return this->_op(a, b); } public: diff --git a/test/adiar/internal/test_bool_op.cpp b/test/adiar/internal/test_bool_op.cpp index 24c5ac99a..2bad9005f 100644 --- a/test/adiar/internal/test_bool_op.cpp +++ b/test/adiar/internal/test_bool_op.cpp @@ -140,49 +140,38 @@ go_bandit([]() { }); describe("is_commutative(...)", []() { - it("is true for 'adiar::and_op'", []() { - AssertThat(is_commutative(adiar::and_op), Is().True()); - }); + it("is true for 'adiar::and_op'", + []() { AssertThat(is_commutative(adiar::and_op), Is().True()); }); - it("is true for 'adiar::nand_op'", []() { - AssertThat(is_commutative(adiar::nand_op), Is().True()); - }); + it("is true for 'adiar::nand_op'", + []() { AssertThat(is_commutative(adiar::nand_op), Is().True()); }); - it("is true for 'adiar::or_op'", []() { - AssertThat(is_commutative(adiar::or_op), Is().True()); - }); + it("is true for 'adiar::or_op'", + []() { AssertThat(is_commutative(adiar::or_op), Is().True()); }); - it("is true for 'adiar::nor_op'", []() { - AssertThat(is_commutative(adiar::nor_op), Is().True()); - }); + it("is true for 'adiar::nor_op'", + []() { AssertThat(is_commutative(adiar::nor_op), Is().True()); }); - it("is true for 'adiar::xor_op'", []() { - AssertThat(is_commutative(adiar::xor_op), Is().True()); - }); + it("is true for 'adiar::xor_op'", + []() { AssertThat(is_commutative(adiar::xor_op), Is().True()); }); - it("is true for 'adiar::xnor_op'", []() { - AssertThat(is_commutative(adiar::xnor_op), Is().True()); - }); + it("is true for 'adiar::xnor_op'", + []() { AssertThat(is_commutative(adiar::xnor_op), Is().True()); }); - it("is true for 'adiar::equiv_op'", []() { - AssertThat(is_commutative(adiar::equiv_op), Is().True()); - }); + it("is true for 'adiar::equiv_op'", + []() { AssertThat(is_commutative(adiar::equiv_op), Is().True()); }); - it("is false for 'adiar::imp_op'", []() { - AssertThat(is_commutative(adiar::imp_op), Is().False()); - }); + it("is false for 'adiar::imp_op'", + []() { AssertThat(is_commutative(adiar::imp_op), Is().False()); }); - it("is false for 'adiar::invimp_op'", []() { - AssertThat(is_commutative(adiar::invimp_op), Is().False()); - }); + it("is false for 'adiar::invimp_op'", + []() { AssertThat(is_commutative(adiar::invimp_op), Is().False()); }); - it("is false for 'adiar::diff_op'", []() { - AssertThat(is_commutative(adiar::diff_op), Is().False()); - }); + it("is false for 'adiar::diff_op'", + []() { AssertThat(is_commutative(adiar::diff_op), Is().False()); }); - it("is false for 'adiar::less_op'", []() { - AssertThat(is_commutative(adiar::less_op), Is().False()); - }); + it("is false for 'adiar::less_op'", + []() { AssertThat(is_commutative(adiar::less_op), Is().False()); }); }); describe("flip(...)", []() { @@ -207,9 +196,8 @@ go_bandit([]() { }); describe("binary_op>", []() { - it("uses expected number of bytes", []() { - AssertThat(sizeof(binary_op>), Is().EqualTo(17u)); - }); + it("uses expected number of bytes", + []() { AssertThat(sizeof(binary_op>), Is().EqualTo(17u)); }); constexpr ptr_uint64 ptr_false(false); constexpr ptr_uint64 ptr_true(true); @@ -572,4 +560,4 @@ go_bandit([]() { }); }); }); - }); +}); diff --git a/test/adiar/zdd/test_binop.cpp b/test/adiar/zdd/test_binop.cpp index b7ded532e..05d03d645 100644 --- a/test/adiar/zdd/test_binop.cpp +++ b/test/adiar/zdd/test_binop.cpp @@ -1755,8 +1755,7 @@ go_bandit([]() { Is().EqualTo(arc{ ptr_uint64(0, 0), false, terminal_F })); AssertThat(arcs.can_pull_terminal(), Is().True()); - AssertThat(arcs.pull_terminal(), - Is().EqualTo(arc{ ptr_uint64(0, 0), true, terminal_T })); + AssertThat(arcs.pull_terminal(), Is().EqualTo(arc{ ptr_uint64(0, 0), true, terminal_T })); AssertThat(arcs.can_pull_terminal(), Is().False()); @@ -3536,8 +3535,7 @@ go_bandit([]() { Is().EqualTo(arc{ ptr_uint64(0, 0), false, terminal_F })); AssertThat(arcs.can_pull_terminal(), Is().True()); - AssertThat(arcs.pull_terminal(), - Is().EqualTo(arc{ ptr_uint64(0, 0), true, terminal_T })); + AssertThat(arcs.pull_terminal(), Is().EqualTo(arc{ ptr_uint64(0, 0), true, terminal_T })); AssertThat(arcs.can_pull_terminal(), Is().False()); diff --git a/test/test.cpp b/test/test.cpp index ebe89bf3b..b12c75d7f 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -67,8 +67,8 @@ go_bandit([]() { //////////////////////////////////////////////////////////////////////////////// // Adiar Core unit tests -#include "adiar/test_bool_op.cpp" #include "adiar/internal/test_bool_op.cpp" +#include "adiar/test_bool_op.cpp" #include "adiar/test_builder.cpp" #include "adiar/test_domain.cpp"