Skip to content

Commit

Permalink
Format latest changes
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed Mar 6, 2024
1 parent 08bda8c commit 15543fc
Show file tree
Hide file tree
Showing 9 changed files with 75 additions and 75 deletions.
7 changes: 4 additions & 3 deletions src/adiar/bdd.h
Original file line number Diff line number Diff line change
Expand Up @@ -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$
///
Expand Down Expand Up @@ -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$
//////////////////////////////////////////////////////////////////////////////////////////////////
Expand Down
6 changes: 3 additions & 3 deletions src/adiar/bdd/apply.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ namespace adiar
{
//////////////////////////////////////////////////////////////////////////////////////////////////
// BDD product construction policy
template<typename BinaryOp = internal::binary_op<predicate<bool, bool>>>
template <typename BinaryOp = internal::binary_op<predicate<bool, bool>>>
class apply_prod2_policy
: public bdd_policy
, public internal::prod2_mixed_level_merger<bdd_policy>
Expand Down Expand Up @@ -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:
Expand Down
3 changes: 2 additions & 1 deletion src/adiar/bdd/quantify.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ namespace adiar
class bdd_quantify_policy : public bdd_policy
{
private:
// Inherit from `predicate<bool, bool>` to hide these compile-time simplifications `bool_op` (see #162)
// Inherit from `predicate<bool, bool>` 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);

Expand Down
15 changes: 10 additions & 5 deletions src/adiar/internal/algorithms/prod2.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<get_1level_cut, 0u>(in_0, in_1, policy);
const size_t pq_2_bound = __prod2_ilevel_upper_bound<get_1level_cut, 0u>(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;
Expand Down Expand Up @@ -772,16 +771,22 @@ namespace adiar::internal
using pq_1_type = prod_priority_queue_1_t<ADIAR_LPQ_LOOKAHEAD, memory_mode::Internal>;
using pq_2_type = prod_priority_queue_2_t<memory_mode::Internal>;

return __prod2_pq<Policy, pq_1_type, pq_2_type>(
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<Policy, pq_1_type, pq_2_type>(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;
#endif
using pq_1_type = prod_priority_queue_1_t<ADIAR_LPQ_LOOKAHEAD, memory_mode::External>;
const size_t pq_1_memory = aux_available_memory / 2;

using pq_2_type = prod_priority_queue_2_t<memory_mode::External>;
using pq_2_type = prod_priority_queue_2_t<memory_mode::External>;
const size_t pq_2_memory = pq_1_memory;

return __prod2_pq<Policy, pq_1_type, pq_2_type>(
Expand Down
43 changes: 25 additions & 18 deletions src/adiar/internal/bool_op.h
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ namespace adiar::internal
//////////////////////////////////////////////////////////////////////////////////////////////////
/// \brief Specialization for boolean operators, i.e. any `predicate<bool, bool>`.
//////////////////////////////////////////////////////////////////////////////////////////////////
template<>
template <>
class binary_op<predicate<bool, bool>>
{
private:
Expand Down Expand Up @@ -130,28 +130,35 @@ namespace adiar::internal
/// \brief Construction from `predicate<bool, bool>`
////////////////////////////////////////////////////////////////////////////////////////////////
binary_op(const predicate<bool, bool>& 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<typename Pointer>
template <typename Pointer>
Pointer
operator ()(const Pointer& lhs, const Pointer& rhs) const
operator()(const Pointer& lhs, const Pointer& rhs) const
{
static_assert(std::is_same<typename Pointer::terminal_type, bool>::value);
return (*this)(lhs.value(), rhs.value());
Expand All @@ -164,7 +171,7 @@ namespace adiar::internal
return this->_left_shortcutting[p];
}

template<typename Pointer>
template <typename Pointer>
bool
can_left_shortcut(const Pointer& p) const
{
Expand All @@ -178,7 +185,7 @@ namespace adiar::internal
return this->_right_shortcutting[p];
}

template<typename Pointer>
template <typename Pointer>
bool
can_right_shortcut(const Pointer& p) const
{
Expand All @@ -192,7 +199,7 @@ namespace adiar::internal
return this->_left_idempotent[p];
}

template<typename Pointer>
template <typename Pointer>
bool
is_left_idempotent(const Pointer& p) const
{
Expand All @@ -206,7 +213,7 @@ namespace adiar::internal
return this->_right_idempotent[p];
}

template<typename Pointer>
template <typename Pointer>
bool
is_right_idempotent(const Pointer& p) const
{
Expand All @@ -220,7 +227,7 @@ namespace adiar::internal
return this->_left_negating[p];
}

template<typename Pointer>
template <typename Pointer>
bool
is_left_negating(const Pointer& p) const
{
Expand All @@ -234,7 +241,7 @@ namespace adiar::internal
return this->_right_negating[p];
}

template<typename Pointer>
template <typename Pointer>
bool
is_right_negating(const Pointer& p) const
{
Expand Down
6 changes: 3 additions & 3 deletions src/adiar/zdd/binop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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:
Expand Down
62 changes: 25 additions & 37 deletions test/adiar/internal/test_bool_op.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(...)", []() {
Expand All @@ -207,9 +196,8 @@ go_bandit([]() {
});

describe("binary_op<predicate<bool, bool>>", []() {
it("uses expected number of bytes", []() {
AssertThat(sizeof(binary_op<predicate<bool, bool>>), Is().EqualTo(17u));
});
it("uses expected number of bytes",
[]() { AssertThat(sizeof(binary_op<predicate<bool, bool>>), Is().EqualTo(17u)); });

constexpr ptr_uint64 ptr_false(false);
constexpr ptr_uint64 ptr_true(true);
Expand Down Expand Up @@ -572,4 +560,4 @@ go_bandit([]() {
});
});
});
});
});
6 changes: 2 additions & 4 deletions test/adiar/zdd/test_binop.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());

Expand Down Expand Up @@ -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());

Expand Down
2 changes: 1 addition & 1 deletion test/test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down

0 comments on commit 15543fc

Please sign in to comment.