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

@ -26,7 +26,7 @@
namespace dpf
{
/// Sharing scheme tag.
/// @brief Sharing scheme tag.
enum class sharing : unsigned char
{
additive = 0,
@ -94,8 +94,14 @@ using share_value_type_t = typename share_value_type<std::decay_t<T>>::type;
namespace detail
{
/// Party coefficient of the secret for this scheme: additive always +1;
/// @brief Party coefficient of the secret for this scheme: additive always +1;
/// subtractive is +1 for party 0 and −1 for party 1.
/// @tparam Scheme scheme
/// @tparam Party party index, `0` or `1`
/// @tparam T value type
/// @param v the `v`
/// @return Party coefficient of the secret for this scheme: additive always +1; subtractive is +1
/// for party 0 and −1 for party 1
template <sharing Scheme, std::size_t Party, typename T>
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
@ -141,7 +147,9 @@ struct secret_share
secret_share & operator=(secret_share &&) noexcept = default;
~secret_share() = default;
/// Bit-preserving construction. Does not apply a party coefficient.
/// @brief Bit-preserving construction. Does not apply a party coefficient.
/// @param v the `v`
/// @return Bit-preserving construction
HEDLEY_NO_THROW
HEDLEY_ALWAYS_INLINE
HEDLEY_CONST
@ -162,7 +170,8 @@ struct secret_share
HEDLEY_PURE
constexpr T & raw() noexcept { return value; }
/// Secret-preserving conversion to an additive share of the same party.
/// @brief Secret-preserving conversion to an additive share of the same party.
/// @return Secret-preserving conversion to an additive share of the same party
HEDLEY_NO_THROW
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
@ -175,7 +184,8 @@ struct secret_share
detail::party_coeff_times<sharing::subtractive, Party>(value));
}
/// Secret-preserving conversion to a subtractive share of the same party.
/// @brief Secret-preserving conversion to a subtractive share of the same party.
/// @return Secret-preserving conversion to a subtractive share of the same party
HEDLEY_NO_THROW
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
@ -188,7 +198,10 @@ struct secret_share
detail::party_coeff_times<sharing::additive, Party>(value));
}
/// Bit-preserving retag (no secret-preserving sign fix).
/// @brief Bit-preserving retag (no secret-preserving sign fix).
/// @tparam NewScheme new scheme
/// @tparam NewParty new party
/// @return Bit-preserving retag (no secret-preserving sign fix)
template <sharing NewScheme, std::size_t NewParty = Party>
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
@ -239,7 +252,11 @@ struct secret_share
return *this;
}
/// Absorb a public plaintext on party 0 only.
/// @brief Absorb a public plaintext on party 0 only.
/// @tparam Plain plain
/// @tparam T value type
/// @param c the `c`
/// @return `*this`
template <typename Plain,
std::enable_if_t<!is_secret_share_v<Plain>
&& std::is_convertible_v<Plain, T>, int> = 0>
@ -525,7 +542,8 @@ struct party_key : Key
HEDLEY_ALWAYS_INLINE
const Key & key() const noexcept { return static_cast<const Key &>(*this); }
/// Party-tagged additive share of the comparison absorb addend.
/// @brief Party-tagged additive share of the comparison absorb addend.
/// @return Party-tagged additive share of the comparison absorb addend
HEDLEY_NO_THROW
HEDLEY_ALWAYS_INLINE
auto cmp_addend() const noexcept
@ -555,9 +573,10 @@ struct party_of<party_key<Party, Key>>
template <typename T>
inline constexpr std::size_t party_of_v = party_of<std::decay_t<T>>::value;
/// Strip a `party_key` wrapper; bare keys are unchanged. Memoizers and other
/// @brief Strip a `party_key` wrapper; bare keys are unchanged. Memoizers and other
/// tree-layout helpers key on the underlying DPF key type so a memoizer built
/// for party 0 also accepts party 1.
/// @tparam T value type
template <typename T>
struct unwrap_party_key
{