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:
Ryan Henry 2026-09-24 23:18:10 -06:00
parent 0d8a5a8131
commit 0dff6df8ed
250 changed files with 12199 additions and 1981 deletions

View file

@ -1,6 +1,5 @@
/// @file dpf/eval_common.hpp
/// @brief
/// @details
/// @brief Shared evaluation types, party tags, and output cursors.
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @copyright Copyright (c) 2019-2024 Ryan Henry and [others](@ref authors)
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
@ -23,11 +22,13 @@
namespace dpf
{
/// Sentinel: `dpf_output` converts to a bare `OutputT` (no party tag).
/// @brief Sentinel: `dpf_output` converts to a bare `OutputT` (no party tag).
inline constexpr std::size_t no_party = std::numeric_limits<std::size_t>::max();
/// Eval result type for a leaf output of `KeyT`: subtractive share when the
/// @brief Eval result type for a leaf output of `KeyT`: subtractive share when the
/// key is party-tagged, otherwise the concrete output type.
/// @tparam KeyT key type
/// @tparam OutputT output type
template <typename KeyT, typename OutputT, bool = is_party_key_v<KeyT>>
struct eval_leaf_result
{
@ -41,8 +42,10 @@ struct eval_leaf_result<KeyT, OutputT, true>
template <typename KeyT, typename OutputT>
using eval_leaf_result_t = typename eval_leaf_result<KeyT, OutputT>::type;
/// Eval result type for a comparison output of `KeyT`: additive share when
/// @brief Eval result type for a comparison output of `KeyT`: additive share when
/// the key is party-tagged, otherwise `Beta`.
/// @tparam KeyT key type
/// @tparam Beta payload type
template <typename KeyT, typename Beta, bool = is_party_key_v<KeyT>>
struct eval_cmp_result
{
@ -112,9 +115,14 @@ struct alignas(utils::max_align_v) dpf_output
friend auto make_dpf_output(const Node & node, Input x);
};
/// Copy one packed leaf into a buffer whose element type may differ
/// @brief Copy one packed leaf into a buffer whose element type may differ
/// from `LeafT` (bit arrays store `word_type`, not the exterior node).
/// Byte destination keeps the store free of strict-aliasing UB.
/// @details Byte destination keeps the store free of strict-aliasing UB.
/// @tparam LeafT leaf type
/// @tparam Buffer output buffer type
/// @param buf the output buffer
/// @param index the index
/// @param leaf the leaf value
template <typename LeafT, typename Buffer>
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
@ -144,8 +152,16 @@ auto make_dpf_output(const Node & node, Input x)
offset_within_block<concrete_type_t<Output>, Node>(x)};
}
/// Wrap a raw leaf node into a party-tagged `dpf_output` when `KeyT` is a
/// @brief Wrap a raw leaf node into a party-tagged `dpf_output` when `KeyT` is a
/// `party_key`, otherwise a bare `dpf_output`.
/// @tparam KeyT key type
/// @tparam Output output
/// @tparam Input input domain type
/// @tparam Node node
/// @param node the GGM node
/// @param x the `x`
/// @return Wrap a raw leaf node into a party-tagged `dpf_output` when `KeyT` is a `party_key`,
/// otherwise a bare `dpf_output`
template <typename KeyT, typename Output, typename Input, typename Node>
auto make_eval_dpf_output(const Node & node, Input x)
{
@ -155,8 +171,12 @@ auto make_eval_dpf_output(const Node & node, Input x)
return make_dpf_output<Output>(node, x);
}
/// Wrap a raw comparison `Beta` value as an additive share when `KeyT` is a
/// @brief Wrap a raw comparison `Beta` value as an additive share when `KeyT` is a
/// `party_key`.
/// @tparam KeyT key type
/// @tparam Beta payload type
/// @param raw the underlying integer
/// @return Wrap a raw comparison `Beta` value as an additive share when `KeyT` is a `party_key`
template <typename KeyT, typename Beta>
HEDLEY_NO_THROW
auto make_eval_cmp_result(Beta raw) noexcept