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>
43 lines
1.3 KiB
C++
43 lines
1.3 KiB
C++
#include <cstdint>
|
|
#include <iostream>
|
|
#include <vector>
|
|
|
|
#include "grotto.hpp"
|
|
|
|
/// Two piecewise LUTs, one comparison, one prefix walk of the union.
|
|
int main()
|
|
{
|
|
//! [lut-union]
|
|
grotto::piecewise_lut<std::uint8_t> low{{0, 10}, {{1, 0}, {0, 2}}};
|
|
grotto::piecewise_lut<std::uint8_t> high{{0, 4, 12}, {{3, 0}, {1, 1}, {9, 4}}};
|
|
const std::uint8_t center = 12;
|
|
const std::uint8_t eta = 3;
|
|
|
|
auto plan = grotto::make_lut_union_plan({low, high}, eta);
|
|
auto mat = grotto::make_offset_poly_keys<std::uint8_t>(center, plan.degree);
|
|
auto s0 = grotto::lut_union_eval<0>(mat, plan);
|
|
auto s1 = grotto::lut_union_eval<1>(mat, plan);
|
|
|
|
dpf::protocol::composer composer(0);
|
|
grotto::schedule_lut_union(composer, plan);
|
|
//! [lut-union]
|
|
|
|
if (plan.comparisons != 1 || plan.prefix_walks != 1)
|
|
{
|
|
std::cerr << "plan shape\n";
|
|
return 1;
|
|
}
|
|
if (composer.default_plan().rounds() != plan.depth)
|
|
{
|
|
std::cerr << "geneval rounds\n";
|
|
return 1;
|
|
}
|
|
const std::uint64_t opened[2] = {s0[0] + s1[0], s0[1] + s1[1]};
|
|
if (opened[0] != grotto::offset_poly_clear<std::uint8_t>(center, low.knots, low.coeff, eta)
|
|
|| opened[1] != grotto::offset_poly_clear<std::uint8_t>(center, high.knots, high.coeff, eta))
|
|
{
|
|
std::cerr << "opened value\n";
|
|
return 1;
|
|
}
|
|
return 0;
|
|
}
|