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:
Ryan Henry 2026-09-28 05:59:19 -06:00
parent 695f8e84f7
commit 0d22946a0e
1835 changed files with 170291 additions and 2849 deletions

View file

@ -21,9 +21,19 @@ namespace gadgets
{
static constexpr double celu_default_alpha = 1;
/// @brief Cleartext `celu`.
/// @see grotto::eval_closed
/// @tparam alpha functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & alpha = celu_default_alpha>
struct celu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,8 +25,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `elish`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) elish
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -21,9 +21,19 @@ namespace gadgets
{
static constexpr double elu_default_alpha = 1;
/// @brief Cleartext `elu`.
/// @see grotto::eval_closed
/// @tparam alpha functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & alpha = elu_default_alpha>
struct elu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `gelu`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) gelu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -20,8 +20,17 @@ namespace grotto
namespace gadgets
{
/// @brief Cleartext `hardelish`.
/// @see grotto::eval_window with `window::hardelish`
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct hardelish
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,9 +25,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double hardshrink_default_lambda = 0.5;
/// @brief Cleartext `hardshrink`.
/// @see grotto::make_hardshrink_lut
/// @tparam lambda functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & lambda = hardshrink_default_lambda>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardshrink_lut) hardshrink
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `hardsigmoid`.
/// @see grotto::make_hardsigmoid_lut
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardsigmoid_lut) hardsigmoid
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `hardswish`.
/// @see grotto::make_hardswish_lut
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardswish_lut) hardswish
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `hardtanh`.
/// @see grotto::make_hardtanh_lut
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardtanh_lut) hardtanh
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -26,9 +26,21 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double leakyrelu_default_negative_slope = 0.01;
static constexpr double leakyrelu_zero_negative_slope = 0.0;
/// @brief Cleartext `leakyrelu`. The default slope `0.01` is
/// `make_leaky_relu_hundredth_lut`. A power-of-two slope is
/// `make_leaky_relu_lut`.
/// @see grotto::make_leaky_relu_hundredth_lut
/// @tparam negative_slope functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & negative_slope = leakyrelu_default_negative_slope>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_leaky_relu_lut) leakyrelu
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_leaky_relu_hundredth_lut) leakyrelu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -21,8 +21,17 @@ namespace grotto
namespace gadgets
{
/// @brief Cleartext `lecun_tanh`.
/// @see grotto::eval_window with `window::lecun_tanh`
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct lecun_tanh
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,8 +25,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `logsigmoid`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) logsigmoid
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return std::log(sigmoid{}(x)); }
};

View file

@ -25,8 +25,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `mish`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) mish
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ namespace gadgets
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `one_minus_sigmoid`.
/// @see grotto::eval_window with `window::one_minus_sigmoid`
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) one_minus_sigmoid
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -23,6 +23,9 @@ namespace gadgets
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Alias of another cleartext functor, under the name `relu`.
/// @see grotto::make_relu_lut
/// \complexity Same as the functor it aliases: one straight-line `operator()`. `Θ(1)`.
using relu HEDLEY_DEPRECATED_FOR(2026, grotto::make_relu_lut) = leakyrelu<leakyrelu_zero_negative_slope>;
HEDLEY_DIAGNOSTIC_POP

View file

@ -25,9 +25,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double relu6_default_clip = 6;
/// @brief Cleartext `relu6`.
/// @see grotto::make_relu6_lut
/// @tparam clip functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & clip = 6>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_relu6_lut) relu6
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -22,10 +22,21 @@ namespace gadgets
static constexpr double selu_default_alpha = 1.6732632423543772848170429916717;
static constexpr double selu_default_scale = 1.0507009873554804934193349852946;
/// @brief Cleartext `selu`.
/// @see grotto::eval_closed
/// @tparam scale functor parameter (a `double` bound or scale)
/// @tparam alpha functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & alpha = selu_default_alpha,
double const & scale = selu_default_scale>
struct selu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,8 +25,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `serf`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) serf
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `sigmoid`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) sigmoid
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return 1/(1+std::exp(-x)); }
};

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `silu`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) silu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return x*sigmoid{}(x); }
};

View file

@ -25,9 +25,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double smoothstep_default_gamma = 1;
/// @brief Cleartext `smoothstep`.
/// @see grotto::eval_window
/// @tparam gamma functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & gamma = smoothstep_default_gamma>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) smoothstep
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -26,9 +26,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softminus_default_beta = 1;
/// @brief Cleartext `softminus`.
/// @see grotto::eval_window
/// @tparam beta functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & beta = softminus_default_beta>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) softminus
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,9 +25,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softplus_default_beta = 1;
/// @brief Cleartext `softplus`.
/// @see grotto::eval_window
/// @tparam beta functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & beta = softplus_default_beta>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) softplus
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -25,9 +25,19 @@ HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softshrink_default_lambda = 0.5;
/// @brief Cleartext `softshrink`.
/// @see grotto::make_softshrink_lut
/// @tparam lambda functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template <double const & lambda = softshrink_default_lambda>
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_softshrink_lut) softshrink
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -20,8 +20,17 @@ namespace grotto
namespace gadgets
{
/// @brief Cleartext `hardsign`.
/// @see grotto::eval_closed
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct hardsign
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return x/(1+std::abs(x)); }
};

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `squared_relu`.
/// @see grotto::make_squared_relu_lut
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_squared_relu_lut) squared_relu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -22,10 +22,21 @@ namespace gadgets
static constexpr double starrelu_default_scale = 0.8944;
static constexpr double starrelu_default_shift = -0.4472;
/// @brief Cleartext `starrelu`.
/// @see grotto::make_relu_lut
/// @tparam shift functor parameter (a `double` bound or scale)
/// @tparam scale functor parameter (a `double` bound or scale)
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
template<double const & scale = starrelu_default_scale,
double const & shift = starrelu_default_shift>
struct starrelu
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x)
{

View file

@ -24,8 +24,17 @@ HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
/// @brief Cleartext `tanhexp`.
/// @see grotto::eval_window
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) tanhexp
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return x*std::tanh(std::exp(x)); }
};

View file

@ -20,8 +20,17 @@ namespace grotto
namespace gadgets
{
/// @brief Cleartext `tanhshrink`.
/// @see grotto::eval_closed
/// @note Straight-line cleartext. Fixed-point evaluation is the symbol in `@see` when that symbol is a LUT or an `eval_*` function.
/// \complexity One evaluation of `operator()` as written in this header. There is no domain scan and no loop. `Θ(1)` time and extra space relative to that expression.
struct tanhshrink
{
/// @brief Evaluate the cleartext map.
/// @tparam T argument and result type
/// @param x the input
/// @return the cleartext image of `x`
/// \complexity The body is straight-line. `Θ(1)` time and extra space.
template <typename T>
T operator()(T x) { return x -std::tanh(x); }
};