Skip to content

Commit

Permalink
Fix names of input/output types in dd_policy
Browse files Browse the repository at this point in the history
  • Loading branch information
SSoelvsten committed Sep 29, 2023
1 parent 0d7601b commit cb02e6b
Show file tree
Hide file tree
Showing 11 changed files with 84 additions and 86 deletions.
4 changes: 2 additions & 2 deletions src/adiar/builder.h
Original file line number Diff line number Diff line change
Expand Up @@ -378,7 +378,7 @@ namespace adiar
/// `builder_ptr` created by this object will be invalidated and
/// cannot be used anymore.
/////////////////////////////////////////////////////////////////////////////
typename dd_policy::reduced_t build()
typename dd_policy::dd_type build()
{
attach_if_needed();

Expand All @@ -395,7 +395,7 @@ namespace adiar
throw domain_error("Decision diagram has more than one root");
}

const typename dd_policy::reduced_t res(nf);
const typename dd_policy::dd_type res(nf);
detach();
return res;
}
Expand Down
4 changes: 2 additions & 2 deletions src/adiar/internal/algorithms/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,9 @@ namespace adiar::internal
};

template<typename chain_policy>
inline typename chain_policy::reduced_t
inline typename chain_policy::dd_type
build_chain(const chain_policy &policy,
const generator<typename chain_policy::reduced_t::label_type> &vars)
const generator<typename chain_policy::dd_type::label_type> &vars)
{
typename chain_policy::label_type next_label = vars();

Expand Down
24 changes: 12 additions & 12 deletions src/adiar/internal/algorithms/convert.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,17 @@ namespace adiar::internal
template<typename to_policy, typename from_policy>
class convert_dd_policy
{
static_assert(std::is_base_of<dd, typename from_policy::reduced_t>::value);
static_assert(std::is_base_of<__dd, typename from_policy::unreduced_t>::value);
static_assert(std::is_base_of<dd, typename to_policy::reduced_t>::value);
static_assert(std::is_base_of<__dd, typename to_policy::unreduced_t>::value);
static_assert(std::is_base_of<dd, typename from_policy::dd_type>::value);
static_assert(std::is_base_of<__dd, typename from_policy::__dd_type>::value);
static_assert(std::is_base_of<dd, typename to_policy::dd_type>::value);
static_assert(std::is_base_of<__dd, typename to_policy::__dd_type>::value);

public:
using reduced_t = typename from_policy::reduced_t;
using dd_type = typename from_policy::dd_type;
using pointer_type = typename from_policy::pointer_type;
using node_type = typename from_policy::node_type;

using unreduced_t = typename to_policy::unreduced_t;
using __dd_type = typename to_policy::__dd_type;
using label_type = typename to_policy::label_type;
using id_type = typename to_policy::id_type;

Expand All @@ -44,15 +44,15 @@ namespace adiar::internal
static constexpr size_t mult_factor = 2u;

public:
static typename to_policy::reduced_t
on_empty_labels(const typename from_policy::reduced_t& dd)
static typename to_policy::dd_type
on_empty_labels(const typename from_policy::dd_type& dd)
{
return typename to_policy::reduced_t(dd.file, dd.negate);
return typename to_policy::dd_type(dd.file, dd.negate);
}

static typename to_policy::reduced_t
static typename to_policy::dd_type
on_terminal_input(const bool terminal_value,
const typename from_policy::reduced_t& /*dd*/,
const typename from_policy::dd_type& /*dd*/,
const shared_file<typename from_policy::label_type> &dom)
{
adiar_assert(dom->size() > 0, "Emptiness check is before terminal check");
Expand Down Expand Up @@ -92,7 +92,7 @@ namespace adiar::internal
return nf;
}

static typename to_policy::reduced_t
static typename to_policy::dd_type
terminal(const bool terminal_value)
{
// Notice, that both bdd_t and zdd_t have bool constructors
Expand Down
4 changes: 2 additions & 2 deletions src/adiar/internal/algorithms/count.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ namespace adiar::internal

//////////////////////////////////////////////////////////////////////////////
template<typename count_policy, typename count_pq_t>
uint64_t __count(const typename count_policy::reduced_t &dd,
uint64_t __count(const typename count_policy::dd_type &dd,
const typename count_policy::label_type varcount,
const size_t pq_max_memory,
const size_t pq_max_size)
Expand Down Expand Up @@ -127,7 +127,7 @@ namespace adiar::internal
}

template<typename count_policy>
uint64_t count(const typename count_policy::reduced_t &dd,
uint64_t count(const typename count_policy::dd_type &dd,
const typename count_policy::label_type varcount)
{
adiar_assert(!dd_isterminal(dd),
Expand Down
6 changes: 3 additions & 3 deletions src/adiar/internal/algorithms/intercut.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ namespace adiar::internal
}

template<typename intercut_policy, typename pq_t>
typename intercut_policy::unreduced_t __intercut (const typename intercut_policy::reduced_t &dd,
typename intercut_policy::__dd_type __intercut (const typename intercut_policy::dd_type &dd,
const generator<typename intercut_policy::label_type> &xs,
const size_t pq_memory,
const size_t max_pq_size)
Expand Down Expand Up @@ -305,7 +305,7 @@ namespace adiar::internal
}

template<typename intercut_policy>
size_t __intercut_2level_upper_bound(const typename intercut_policy::reduced_t &dd)
size_t __intercut_2level_upper_bound(const typename intercut_policy::dd_type &dd)
{
const cut ct = cut(intercut_policy::cut_false_terminal,
intercut_policy::cut_true_terminal);
Expand All @@ -315,7 +315,7 @@ namespace adiar::internal
}

template<typename intercut_policy>
typename intercut_policy::unreduced_t intercut(const typename intercut_policy::reduced_t &dd,
typename intercut_policy::__dd_type intercut(const typename intercut_policy::dd_type &dd,
const generator<typename intercut_policy::label_type> &xs)
{
// Compute amount of memory available for auxiliary data structures after
Expand Down
24 changes: 12 additions & 12 deletions src/adiar/internal/algorithms/nested_sweeping.h
Original file line number Diff line number Diff line change
Expand Up @@ -809,7 +809,7 @@ namespace adiar::internal
/// Sorts and resets the given `outer_roots` sorter.
//////////////////////////////////////////////////////////////////////////
template<typename nesting_policy, typename outer_roots_t>
typename nesting_policy::unreduced_t
typename nesting_policy::__dd_type
down(nesting_policy &policy_impl,
const typename nesting_policy::shared_node_file_type &outer_file,
outer_roots_t &outer_roots,
Expand All @@ -827,7 +827,7 @@ namespace adiar::internal
//
// To avoid having to do the boiler-plate yourself, use
// `down__sweep_switch` below (assuming your algorithm fits).
const typename nesting_policy::unreduced_t res =
const typename nesting_policy::__dd_type res =
policy_impl.sweep(outer_file, outer_roots, inner_memory);

outer_roots.reset();
Expand All @@ -840,7 +840,7 @@ namespace adiar::internal
/// priority queue and the `roots_sorter`.
//////////////////////////////////////////////////////////////////////////
template<typename nesting_policy, typename outer_roots_t>
inline typename nesting_policy::unreduced_t
inline typename nesting_policy::__dd_type
down__sweep_switch(nesting_policy &policy_impl,
const typename nesting_policy::shared_node_file_type &outer_file,
outer_roots_t &outer_roots,
Expand Down Expand Up @@ -891,7 +891,7 @@ namespace adiar::internal
"'no_lookahead' implies it should (in practice) satisfy the '<='");

using inner_pq_t = typename nesting_policy::template pq_t<0, memory_mode_t::Internal>;
inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)},
inner_pq_t inner_pq({typename nesting_policy::dd_type(outer_file)},
inner_pq_memory, inner_pq_max_size,
stats.inner.down.lpq);

Expand All @@ -904,7 +904,7 @@ namespace adiar::internal
stats.inner.down.lpq.internal += 1u;
#endif
using inner_pq_t = typename nesting_policy::template pq_t<ADIAR_LPQ_LOOKAHEAD, memory_mode_t::Internal>;
inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)},
inner_pq_t inner_pq({typename nesting_policy::dd_type(outer_file)},
inner_pq_memory, inner_pq_max_size,
stats.inner.down.lpq);

Expand All @@ -917,7 +917,7 @@ namespace adiar::internal
stats.inner.down.lpq.external += 1u;
#endif
using inner_pq_t = typename nesting_policy::template pq_t<ADIAR_LPQ_LOOKAHEAD, memory_mode_t::External>;
inner_pq_t inner_pq({typename nesting_policy::reduced_t(outer_file)},
inner_pq_t inner_pq({typename nesting_policy::dd_type(outer_file)},
inner_pq_memory, inner_pq_max_size,
stats.inner.down.lpq);

Expand Down Expand Up @@ -1353,7 +1353,7 @@ namespace adiar::internal
template<typename nesting_policy,
size_t outer_look_ahead,
memory_mode_t outer_mem_mode>
typename nesting_policy::reduced_t
typename nesting_policy::dd_type
__nested_sweep(const typename nesting_policy::shared_arc_file_type &dag,
nesting_policy &policy_impl,
const size_t outer_pq_memory,
Expand All @@ -1362,8 +1362,8 @@ namespace adiar::internal
const size_t inner_memory)
{
using level_type = typename nesting_policy::label_type;
using reduced_t = typename nesting_policy::reduced_t;
using unreduced_t = typename nesting_policy::unreduced_t;
using reduced_t = typename nesting_policy::dd_type;
using unreduced_t = typename nesting_policy::__dd_type;
using request_t = typename nesting_policy::request_t;
using request_pred_t = typename nesting_policy::request_pred_t;
using shared_arc_file_type = typename nesting_policy::shared_arc_file_type;
Expand Down Expand Up @@ -1768,11 +1768,11 @@ namespace adiar::internal
/// that determines when to start the nested sweep.
//////////////////////////////////////////////////////////////////////////////
template<typename nesting_policy>
typename nesting_policy::reduced_t
nested_sweep(const typename nesting_policy::unreduced_t &input,
typename nesting_policy::dd_type
nested_sweep(const typename nesting_policy::__dd_type &input,
nesting_policy &policy_impl)
{
using reduced_t = typename nesting_policy::reduced_t;
using reduced_t = typename nesting_policy::dd_type;
using request_t = typename nesting_policy::request_t;
using request_pred_t = typename nesting_policy::request_pred_t;
using shared_arc_file_type = typename nesting_policy::shared_arc_file_type;
Expand Down
36 changes: 18 additions & 18 deletions src/adiar/internal/algorithms/prod2.h
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,9 @@ namespace adiar::internal
/// \pre `in_0` is the input to random access
//////////////////////////////////////////////////////////////////////////////
template<typename prod_policy, typename pq_1_t>
typename prod_policy::unreduced_t
__prod2_ra(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
typename prod_policy::__dd_type
__prod2_ra(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op,
const size_t pq_memory, const size_t max_pq_size)
{
Expand Down Expand Up @@ -350,9 +350,9 @@ namespace adiar::internal
}

template<typename prod_policy, typename pq_1_t, typename pq_2_t>
typename prod_policy::unreduced_t
__prod2_pq(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
typename prod_policy::__dd_type
__prod2_pq(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op,
const size_t pq_1_memory, const size_t max_pq_1_size,
const size_t pq_2_memory, const size_t max_pq_2_size)
Expand Down Expand Up @@ -505,8 +505,8 @@ namespace adiar::internal
/// product of the maximum i-level cut of both inputs.
//////////////////////////////////////////////////////////////////////////////
template<typename prod_policy, typename cut, size_t const_size_inc>
size_t __prod2_ilevel_upper_bound(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
size_t __prod2_ilevel_upper_bound(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op)
{
// Cuts for left-hand side
Expand All @@ -533,8 +533,8 @@ namespace adiar::internal
/// using the max 1 and 2-level cuts and the number of relevant terminals.
//////////////////////////////////////////////////////////////////////////////
template<typename prod_policy>
size_t __prod2_2level_upper_bound(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
size_t __prod2_2level_upper_bound(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op)
{
// Left-hand side
Expand Down Expand Up @@ -568,8 +568,8 @@ namespace adiar::internal
/// in the output.
//////////////////////////////////////////////////////////////////////////////
template<typename prod_policy>
size_t __prod2_ilevel_upper_bound(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
size_t __prod2_ilevel_upper_bound(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op)
{
const cut left_ct = prod_policy::left_cut(op);
Expand Down Expand Up @@ -629,9 +629,9 @@ namespace adiar::internal
/// the product of the two given DAGs.
//////////////////////////////////////////////////////////////////////////////
template<typename prod_policy>
typename prod_policy::unreduced_t
prod2(const typename prod_policy::reduced_t &in_0,
const typename prod_policy::reduced_t &in_1,
typename prod_policy::__dd_type
prod2(const typename prod_policy::dd_type &in_0,
const typename prod_policy::dd_type &in_1,
const bool_op &op)
{
// -------------------------------------------------------------------------
Expand All @@ -646,7 +646,7 @@ namespace adiar::internal
// -------------------------------------------------------------------------
// Case: At least one terminal.
if (dd_isterminal(in_0) || dd_isterminal(in_1)) {
typename prod_policy::unreduced_t maybe_resolved =
typename prod_policy::__dd_type maybe_resolved =
prod_policy::resolve_terminal_root(in_0, in_1, op);

if (!(maybe_resolved.template has<no_file>())) {
Expand Down Expand Up @@ -696,8 +696,8 @@ namespace adiar::internal
// Determine if to flip the inputs
// TODO: is the smallest or widest the best to random access on?
const bool ra_0 = in_0->canonical && (!in_1->canonical || in_0->width <= in_1->width);
const typename prod_policy::reduced_t& ra_in_0 = ra_0 ? in_0 : in_1;
const typename prod_policy::reduced_t& ra_in_1 = ra_0 ? in_1 : in_0;
const typename prod_policy::dd_type& ra_in_0 = ra_0 ? in_0 : in_1;
const typename prod_policy::dd_type& ra_in_1 = ra_0 ? in_1 : in_0;
const bool_op& ra_op = ra_0 ? op : flip(op);

#ifdef ADIAR_STATS
Expand Down
Loading

0 comments on commit cb02e6b

Please sign in to comment.