Document the new DPF surfaces in one command set, and test the field, half-tree, and multipoint edges.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
0d8a5a8131
commit
0dff6df8ed
250 changed files with 12199 additions and 1981 deletions
|
|
@ -22,6 +22,7 @@
|
|||
|
||||
#include "dpf/dcf.hpp"
|
||||
#include "dpf/path_memoizer.hpp"
|
||||
#include "dpf/tree_traits.hpp"
|
||||
#include "dpf/twiddle.hpp"
|
||||
#include "dpf/utils.hpp"
|
||||
|
||||
|
|
@ -79,11 +80,11 @@ struct schedule
|
|||
};
|
||||
|
||||
template <typename PRG, typename Node>
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
uint64_t rho_of(const Node & node, uint64_t mask) noexcept
|
||||
{
|
||||
auto kids = PRG::eval01(dpf::unset_lo_2bits(node));
|
||||
auto kids = dpf::tree_traits<PRG>::expand_value(node);
|
||||
return dcf_impl::convert_node(kids[0], mask);
|
||||
}
|
||||
|
||||
|
|
@ -107,7 +108,10 @@ constexpr uint64_t mul_sgn(int sgn, uint64_t v, uint64_t mask) noexcept
|
|||
return 0;
|
||||
}
|
||||
|
||||
/// Group element `sgn` (`+1`, `-1`, or `0`) used as an `assign_cmp` coefficient.
|
||||
/// @brief Group element `sgn` (`+1`, `-1`, or `0`) used as an `assign_cmp` coefficient.
|
||||
/// @param sgn the `sgn`
|
||||
/// @param mask the bit mask
|
||||
/// @return Group element `sgn` (`+1`, `-1`, or `0`) used as an `assign_cmp` coefficient
|
||||
HEDLEY_CONST
|
||||
HEDLEY_NO_THROW
|
||||
HEDLEY_ALWAYS_INLINE
|
||||
|
|
@ -136,6 +140,7 @@ uint64_t checkpoint_word(const Node & n0, const Node & n1, uint64_t beta,
|
|||
}
|
||||
|
||||
template <typename Node>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
uint64_t checkpoint_coeff(const Node & n0, const Node & n1,
|
||||
uint64_t mask) noexcept
|
||||
|
|
@ -160,7 +165,7 @@ void suffix_masks(const Node & seed, std::size_t q, uint64_t mask,
|
|||
std::size_t m = 0;
|
||||
for (std::size_t i = 0; i < n; ++i)
|
||||
{
|
||||
auto kids = PRG::eval01(dpf::unset_lo_2bits(cur[i]));
|
||||
auto kids = dpf::tree_traits<PRG>::expand_value(cur[i]);
|
||||
nxt[m++] = kids[0];
|
||||
nxt[m++] = kids[1];
|
||||
}
|
||||
|
|
@ -219,8 +224,11 @@ uint64_t add_frontier(uint64_t acc, const typename KeyT::interior_node & seed,
|
|||
uint64_t mask, int party)
|
||||
{
|
||||
using node = typename KeyT::interior_node;
|
||||
HEDLEY_PRAGMA(GCC diagnostic push)
|
||||
HEDLEY_PRAGMA(GCC diagnostic ignored "-Wignored-attributes")
|
||||
std::vector<node> cur;
|
||||
std::vector<node> nxt;
|
||||
HEDLEY_PRAGMA(GCC diagnostic pop)
|
||||
cur.push_back(seed);
|
||||
for (std::size_t lvl = from_depth; lvl < to_depth; ++lvl)
|
||||
{
|
||||
|
|
@ -228,9 +236,10 @@ uint64_t add_frontier(uint64_t acc, const typename KeyT::interior_node & seed,
|
|||
nxt.reserve(cur.size() * 2);
|
||||
const node cw0 = dpf.correction_word(lvl, false);
|
||||
const node cw1 = dpf.correction_word(lvl, true);
|
||||
const bool is_last = KeyT::tree::is_last_level(lvl, KeyT::depth);
|
||||
for (const node & fs : cur)
|
||||
{
|
||||
auto kids = KeyT::traverse_interior01(fs, cw0, cw1);
|
||||
auto kids = KeyT::traverse_interior01(fs, cw0, cw1, is_last);
|
||||
nxt.push_back(kids[0]);
|
||||
nxt.push_back(kids[1]);
|
||||
}
|
||||
|
|
@ -334,7 +343,8 @@ uint64_t eval_share(const KeyT & dpf, InputT tx, PathMemoizer & path)
|
|||
const bool xi = !!(bit_mask & tx);
|
||||
const node & parent = path[level];
|
||||
const node right = KeyT::traverse_interior(parent,
|
||||
dpf.correction_word(level, true), true);
|
||||
dpf.correction_word(level, true), true,
|
||||
KeyT::tree::is_last_level(level, KeyT::depth));
|
||||
if (!xi)
|
||||
{
|
||||
pend[npend].seed = right;
|
||||
|
|
@ -358,6 +368,7 @@ uint64_t eval_share(const KeyT & dpf, InputT tx, PathMemoizer & path)
|
|||
}
|
||||
|
||||
template <typename KeyT, typename Integral, typename Memo>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
bool memo_has(const Memo & memo, Integral prefix, std::size_t depth,
|
||||
Integral from_lane, Integral to_excl) noexcept
|
||||
|
|
@ -422,7 +433,8 @@ uint64_t eval_share_memo(const KeyT & dpf, Integral lane,
|
|||
if (!xi)
|
||||
{
|
||||
const node right = KeyT::traverse_interior(parent,
|
||||
dpf.correction_word(level, true), true);
|
||||
dpf.correction_word(level, true), true,
|
||||
KeyT::tree::is_last_level(level, KeyT::depth));
|
||||
pend[npend].seed = right;
|
||||
pend[npend].prefix = sib;
|
||||
pend[npend].depth = level + 1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue