Checkpoint the party/runtime stack before share-program and malicious-mode work.
Ship the TLS mesh, composer, Beaver/Yao/leaf MPC, prep/online paths, apps, and docs so the tree is pushable before elevating share_expr, security_mode, and prep resume. Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
695f8e84f7
commit
0d22946a0e
1835 changed files with 170291 additions and 2849 deletions
|
|
@ -23,28 +23,59 @@ namespace grotto
|
|||
namespace polynomials
|
||||
{
|
||||
|
||||
/// @name Polynomial shapes
|
||||
/// @brief Coefficient arrays, constant term in element 0. Degree is `size - 1`.
|
||||
/// @{
|
||||
template <typename T> using poly_constant = std::array<T, 1>;
|
||||
template <typename T> using poly_linear = std::array<T, 2>;
|
||||
template <typename T> using poly_quadratic = std::array<T, 3>;
|
||||
template <typename T> using poly_cubic = std::array<T, 4>;
|
||||
/// @}
|
||||
|
||||
/// @brief Horner evaluation. The four overloads are degrees 0 through 3.
|
||||
/// @tparam T coefficient type
|
||||
/// @param f coefficients, constant term in `f[0]`
|
||||
/// @param x the evaluation point
|
||||
/// @return the polynomial value
|
||||
/// @see grotto::piecewise_eval
|
||||
/// \complexity Unrolled: 0, 1, 2, or 3 multiplies. `Θ(1)` time and extra space.
|
||||
template <typename T>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
constexpr auto eval_horner(const poly_constant<T> & f, T x) noexcept { return f[0]; }
|
||||
/// @brief Degree-1 Horner. Constant term in `f[0]`.
|
||||
/// @see grotto::eval_horner
|
||||
/// \complexity One multiply-add. `Θ(1)`.
|
||||
template <typename T>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
constexpr auto eval_horner(const poly_linear<T> & f, T x) noexcept { return f[1] * x + f[0]; }
|
||||
/// @brief Degree-2 Horner. Constant term in `f[0]`.
|
||||
/// @see grotto::eval_horner
|
||||
/// \complexity Two multiply-adds. `Θ(1)`.
|
||||
template <typename T>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
constexpr auto eval_horner(const poly_quadratic<T> & f, T x) noexcept { return (f[2] * x + f[1]) * x + f[0]; }
|
||||
/// @brief Degree-3 Horner. Constant term in `f[0]`.
|
||||
/// @see grotto::eval_horner
|
||||
/// \complexity Three multiply-adds. `Θ(1)`.
|
||||
template <typename T>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
constexpr auto eval_horner(const poly_cubic<T> & f, T x) noexcept { return ((f[3] * x + f[2]) * x + f[1]) * x + f[0]; }
|
||||
|
||||
/// @brief Select the piece whose upper bound is the first entry of `bounds` strictly greater than `x`, then Horner-evaluate it.
|
||||
/// @tparam T coefficient and bound type
|
||||
/// @tparam D coefficients per piece
|
||||
/// @tparam N1 number of pieces
|
||||
/// @tparam N2 number of bounds
|
||||
/// @param polys one coefficient array per piece, constant term first
|
||||
/// @param bounds upper bounds of the pieces
|
||||
/// @param x the query
|
||||
/// @return `eval_horner` of the selected piece
|
||||
/// @see grotto::eval_horner
|
||||
/// \complexity `upper_bound` on `bounds` (`Θ(log N2)`), then one `eval_horner` (`Θ(1)`, `D` is 1..4). Extra space `Θ(1)`.
|
||||
template <typename T, std::size_t D, std::size_t N1, std::size_t N2>
|
||||
HEDLEY_PURE
|
||||
HEDLEY_NO_THROW
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue