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
|
|
@ -1,4 +1,5 @@
|
|||
#include <gtest/gtest.h>
|
||||
#include <tuple>
|
||||
|
||||
#include "grotto/window_lut.hpp"
|
||||
|
||||
|
|
@ -77,6 +78,18 @@ long double reference(grotto::window which, unsigned k, long double x)
|
|||
return acosl(x);
|
||||
case grotto::window::probit:
|
||||
return 0;
|
||||
case grotto::window::hardelish:
|
||||
if (x <= -1.0L)
|
||||
return 0;
|
||||
if (x >= 1.0L)
|
||||
return x;
|
||||
if (x >= 0.0L)
|
||||
return x * (x + 1.0L) / 2.0L;
|
||||
return expm1l(x) * (x + 1.0L) / 2.0L;
|
||||
case grotto::window::lecun_tanh:
|
||||
return 1.7159L * tanhl(2.0L * x / 3.0L);
|
||||
case grotto::window::one_minus_sigmoid:
|
||||
return 1.0L - sigmoid(x);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
@ -154,6 +167,51 @@ TEST(WindowLut, ExhaustiveLowPrecision)
|
|||
expect_close(grotto::window::asin, k, raw);
|
||||
expect_close(grotto::window::acos, k, raw);
|
||||
}
|
||||
const std::int64_t step = k == 8 ? 1 : 17;
|
||||
for (std::int64_t raw = -2 * one; raw <= 2 * one; raw += step)
|
||||
expect_close(grotto::window::hardelish, k, raw);
|
||||
const std::int64_t lecun_span = std::int64_t{20} << k;
|
||||
for (std::int64_t raw = -lecun_span; raw <= lecun_span; raw += step)
|
||||
{
|
||||
expect_close(grotto::window::lecun_tanh, k, raw);
|
||||
expect_close(grotto::window::one_minus_sigmoid, k, raw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
TEST(WindowLut, HighPrecisionSamples)
|
||||
{
|
||||
for (unsigned k : {16u, 24u, 32u})
|
||||
{
|
||||
const auto one = std::int64_t{1} << k;
|
||||
const auto step = std::int64_t{1} << (k - 8);
|
||||
for (std::int64_t raw = -2 * one; raw <= 2 * one; raw += step)
|
||||
expect_close(grotto::window::hardelish, k, raw);
|
||||
const std::int64_t span = std::int64_t{20} << k;
|
||||
const auto wide = std::int64_t{1} << (k - 6);
|
||||
for (std::int64_t raw = -span; raw <= span; raw += wide)
|
||||
{
|
||||
expect_close(grotto::window::lecun_tanh, k, raw);
|
||||
expect_close(grotto::window::one_minus_sigmoid, k, raw);
|
||||
}
|
||||
expect_close(grotto::window::hardelish, k, -one + 1);
|
||||
expect_close(grotto::window::hardelish, k, -1);
|
||||
expect_close(grotto::window::lecun_tanh, k, 1);
|
||||
expect_close(grotto::window::lecun_tanh, k, span);
|
||||
}
|
||||
}
|
||||
|
||||
TEST(WindowLut, OneMinusSigmoidComplementsSigmoid)
|
||||
{
|
||||
for (unsigned k : {8u, 16u, 32u})
|
||||
{
|
||||
const auto one = std::int64_t{1} << k;
|
||||
for (std::int64_t raw : {std::int64_t{-8} * one, -one, std::int64_t{0}, one, std::int64_t{8} * one})
|
||||
{
|
||||
const auto sig = grotto::eval_window(grotto::window::sigmoid, k, raw);
|
||||
const auto comp = grotto::eval_window(grotto::window::one_minus_sigmoid, k, raw);
|
||||
EXPECT_EQ(sig + comp, one) << k << " " << raw;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue