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

@ -25,7 +25,7 @@
namespace grotto
{
/// Appendix D gadgets whose polynomial degree is 0 and whose max error is 0.
/// @brief Appendix D gadgets whose polynomial degree is 0 and whose max error is 0.
enum class exact_constant
{
signum,
@ -36,7 +36,7 @@ enum class exact_constant
zero,
nonzero,
ilogb,
/// `ceil(log2(|x|))`. Exact powers of two agree with `ilogb`; every other
/// @brief `ceil(log2(|x|))`. Exact powers of two agree with `ilogb`; every other
/// positive magnitude is one larger. Zero uses the same `-64` sentinel.
ceil_ilogb,
ilog10,
@ -51,20 +51,21 @@ struct constant_lut
using raw_type = Raw;
/// Signed piece starts. `bounds.front()` is `numeric_limits<Raw>::min()`,
/// @brief Signed piece starts. `bounds.front()` is `numeric_limits<Raw>::min()`,
/// and the starts are strictly increasing.
std::vector<Raw> bounds;
/// `values[i]` is the function on `[bounds[i], next)`, where `next` is
/// @brief `values[i]` is the function on `[bounds[i], next)`, where `next` is
/// `bounds[i + 1]` or one past `numeric_limits<Raw>::max()` for the last piece.
std::vector<std::int64_t> values;
HEDLEY_NO_THROW
std::size_t linear_parts() const noexcept { return values.size(); }
/// Pieces after joining the first and last when they carry the same value.
/// Those two meet across the signed wrap, which is how the paper counts
/// @brief Pieces after joining the first and last when they carry the same value.
/// @details Those two meet across the signed wrap, which is how the paper counts
/// parts for `zero` and `nonzero` (2, not 3).
/// @return Pieces after joining the first and last when they carry the same value
HEDLEY_NO_THROW
std::size_t wrapped_parts() const noexcept
{
@ -115,7 +116,7 @@ constexpr bool shift_fits(u128 value, unsigned shift) noexcept
return shift < 128 && value <= (~u128{0} >> shift);
}
/// 10^0 .. 10^19. Every ilog10 projection reads this one table.
/// @brief 10^0 .. 10^19. Every ilog10 projection reads this one table.
inline constexpr std::uint64_t pow10[] = {
1ull,
10ull,
@ -159,7 +160,10 @@ inline bool magnitude_ge_pow10(u128 mag, int k, unsigned fractional_bits) noexce
return mag * scale >= (u128{1} << fractional_bits);
}
/// Smallest positive magnitude whose base-10 log is at least `k`.
/// @brief Smallest positive magnitude whose base-10 log is at least `k`.
/// @param k the `k`
/// @param fractional_bits the number of fractional bits
/// @return Smallest positive magnitude whose base-10 log is at least `k`
HEDLEY_NO_THROW
inline u128 first_magnitude_at_least_pow10(int k, unsigned fractional_bits) noexcept
{
@ -315,8 +319,8 @@ void push_pow2_cuts(std::vector<Raw> & cuts)
detail::push_both_signs<Raw>(detail::u128{1} << k, cuts);
}
/// floor(log2(|raw|)) - F, with -64 on the |x| <= 2^{-64} class (including 0).
/// One exponent program; fractional precision only shifts the stored exponent.
/// @brief floor(log2(|raw|)) - F, with -64 on the |x| <= 2^{-64} class (including 0).
/// @details One exponent program; fractional precision only shifts the stored exponent.
template <>
struct exact_lut<exact_constant::ilogb>
{
@ -347,7 +351,7 @@ struct exact_lut<exact_constant::ilogb>
}
};
/// ceil(log2(|x|)). Same powers-of-two cuts as `ilogb`; exact powers keep the
/// @brief ceil(log2(|x|)). Same powers-of-two cuts as `ilogb`; exact powers keep the
/// floor exponent and every other magnitude steps up by one.
template <>
struct exact_lut<exact_constant::ceil_ilogb>
@ -387,7 +391,7 @@ struct exact_lut<exact_constant::ceil_ilogb>
}
};
/// floor(log10(|x|)), with -19 on |x| <= 10^{-19}. Thresholds come from `pow10`.
/// @brief floor(log10(|x|)), with -19 on |x| <= 10^{-19}. Thresholds come from `pow10`.
template <>
struct exact_lut<exact_constant::ilog10>
{
@ -424,8 +428,8 @@ struct exact_lut<exact_constant::ilog10>
}
};
/// 64-bit leading-zero count of trunc(x). Negatives are 0; a zero integer part is 64.
/// Exponent k of the integer part maps to 63-k after a shift of `fractional_bits`.
/// @brief 64-bit leading-zero count of trunc(x). Negatives are 0; a zero integer part is 64.
/// @details Exponent k of the integer part maps to 63-k after a shift of `fractional_bits`.
template <>
struct exact_lut<exact_constant::clz>
{
@ -461,8 +465,8 @@ struct exact_lut<exact_constant::clz>
}
};
/// 64-bit redundant sign bits of trunc(x) toward zero.
/// Positive q uses 62-floor(log2(q)); negative q uses 62-floor(log2(q-1)).
/// @brief 64-bit redundant sign bits of trunc(x) toward zero.
/// @details Positive q uses 62-floor(log2(q)); negative q uses 62-floor(log2(q-1)).
template <>
struct exact_lut<exact_constant::clrsb>
{
@ -564,7 +568,7 @@ constant_lut<Raw> make_exact_constant_lut(exact_constant which, unsigned fractio
throw std::invalid_argument("unknown exact constant");
}
/// Comparison against a public threshold. Two pieces; the cut sits on `bound`
/// @brief Comparison against a public threshold. Two pieces; the cut sits on `bound`
/// (`lt` / `geq`) or just after it (`leq` / `gt`).
enum class threshold_cmp
{
@ -600,7 +604,12 @@ constant_lut<Raw> make_threshold_lut(Raw bound, threshold_cmp kind)
[=](Raw raw) { return evaluate_threshold(raw, bound, kind); });
}
/// `1` on the inclusive clip window `[low, high]`, `0` outside it.
/// @brief `1` on the inclusive clip window `[low, high]`, `0` outside it.
/// @tparam Raw underlying representation
/// @param low the lower endpoint
/// @param high the upper endpoint
/// @return `1` on the inclusive clip window `[low, high]`, `0` outside it
/// @throws std::invalid_argument if `low > high`
template <typename Raw>
constant_lut<Raw> make_interval_lut(Raw low, Raw high)
{
@ -614,13 +623,20 @@ constant_lut<Raw> make_interval_lut(Raw low, Raw high)
[=](Raw raw) { return raw >= low && raw <= high ? std::int64_t{1} : std::int64_t{0}; });
}
/// `floor(min(max(raw, low), high) / modulus)`, division toward -infinity.
/// @brief `floor(min(max(raw, low), high) / modulus)`, division toward -infinity.
///
/// `modulus`, `low`, and `high` are in the same raw units as the domain, so
/// one program covers every fractional precision: a mathematical step `M`
/// with `F` fractional bits is the raw modulus `M << F`. The paper's
/// `quot(M, T1, T2)` is this function. Piece count is about `(high-low)/modulus`;
/// the build rejects windows that would need more than 2^16 pieces.
/// @tparam Raw underlying representation
/// @param raw the underlying integer
/// @param modulus the public modulus
/// @param low the lower endpoint
/// @param high the upper endpoint
/// @return `floor(min(max(raw, low), high) / modulus)`, division toward -infinity
/// @throws std::invalid_argument if `modulus must be positive`
template <typename Raw>
std::int64_t evaluate_clipped_quotient(Raw raw, Raw modulus, Raw low, Raw high)
{

View file

@ -26,12 +26,12 @@
namespace grotto
{
/// Sentinel raw value for `ilogb(0)` and `ilog10(0)`.
/// @brief Sentinel raw value for `ilogb(0)` and `ilog10(0)`.
inline constexpr std::int64_t ilog_of_zero =
std::numeric_limits<std::int64_t>::min();
/// `make_msb_lut(i)` allows `i` in `[0, msb_bit_limit)`.
/// Bit 0 is two intervals; bit 7 is 256.
/// @brief `make_msb_lut(i)` allows `i` in `[0, msb_bit_limit)`.
/// @details Bit 0 is two intervals; bit 7 is 256.
inline constexpr unsigned msb_bit_limit = 8;
namespace detail
@ -162,7 +162,11 @@ inline u128 pow10_u128(int exponent)
return p;
}
/// `mag / 2^k >= 10^e`.
/// @brief `mag / 2^k >= 10^e`.
/// @param mag the magnitude
/// @param fractional_bits the number of fractional bits
/// @param exponent the exponent
/// @return `mag / 2^k >= 10^e`
inline bool magnitude_ge_pow10(u128 mag, unsigned fractional_bits, int exponent)
{
if (mag == 0)
@ -393,9 +397,14 @@ easy_lut<Raw> make_ilog10_lut(unsigned fractional_bits = 0)
});
}
/// Bit `index` counting down from the most significant bit of `Raw`.
/// Index 0 is the sign bit. Larger indexes are refused: the bit is constant
/// @brief Bit `index` counting down from the most significant bit of `Raw`.
/// @details Index 0 is the sign bit. Larger indexes are refused: the bit is constant
/// on `2^{index+1}` intervals.
/// @tparam Raw underlying representation
/// @param index the index
/// @param fractional_bits the number of fractional bits
/// @return Bit `index` counting down from the most significant bit of `Raw`
/// @throws std::invalid_argument if `only the most significant bits are piecewise-cheap`
template <typename Raw>
HEDLEY_WARN_UNUSED_RESULT
easy_lut<Raw> make_msb_lut(unsigned index, unsigned fractional_bits = 0)

View file

@ -23,7 +23,8 @@
namespace grotto
{
/// Piece `y_raw = round((c0 + c1·raw + c2·raw²) / den)`.
/// @brief Piece `y_raw = round((c0 + c1·raw + c2·raw²) / den)`.
/// @tparam Raw underlying representation
template <typename Raw>
struct easy_lut
{
@ -176,8 +177,11 @@ easy_lut<Raw> make_relu_lut(unsigned fractional_bits = 0)
});
}
/// Negative side is `x / 2^shift`, rounded to nearest, ties away from zero.
/// `shift == 0` is the identity. The slope does not depend on fractional width.
/// @brief Negative side is `x / 2^shift`, rounded to nearest, ties away from zero.
/// @details `shift == 0` is the identity. The slope does not depend on fractional width.
/// @tparam Raw underlying representation
/// @param shift the bit shift
/// @return Negative side is `x / 2^shift`, rounded to nearest, ties away from zero
template <typename Raw>
easy_lut<Raw> make_leaky_relu_lut(unsigned shift)
{
@ -248,7 +252,10 @@ easy_lut<Raw> make_hardtanh_lut(unsigned fractional_bits)
return make_clip_lut<Raw>(fractional_bits, -1, 1);
}
/// `0` on `[-1, 1]`, `x - 1` above, `x + 1` below.
/// @brief `0` on `[-1, 1]`, `x - 1` above, `x + 1` below.
/// @tparam Raw underlying representation
/// @param fractional_bits the number of fractional bits
/// @return `0` on `[-1, 1]`, `x - 1` above, `x + 1` below
template <typename Raw>
easy_lut<Raw> make_softshrink_lut(unsigned fractional_bits)
{
@ -270,7 +277,10 @@ easy_lut<Raw> make_softshrink_lut(unsigned fractional_bits)
});
}
/// `0` on `[-1, 1]`, identity outside. Lambda is the integer 1.
/// @brief `0` on `[-1, 1]`, identity outside. Lambda is the integer 1.
/// @tparam Raw underlying representation
/// @param fractional_bits the number of fractional bits
/// @return `0` on `[-1, 1]`, identity outside
template <typename Raw>
easy_lut<Raw> make_hardshrink_lut(unsigned fractional_bits)
{
@ -290,7 +300,11 @@ easy_lut<Raw> make_hardshrink_lut(unsigned fractional_bits)
});
}
/// `0` left of `-3`, `1` right of `3`, `(x + 3) / 6` between, rounded.
/// @brief `0` left of `-3`, `1` right of `3`, `(x + 3) / 6` between, rounded.
/// @tparam Raw underlying representation
/// @param fractional_bits the number of fractional bits
/// @return `0` left of `-3`, `1` right of `3`, `(x + 3) / 6` between, rounded
/// @throws std::invalid_argument if `fractional width does not fit`
template <typename Raw>
easy_lut<Raw> make_hardsigmoid_lut(unsigned fractional_bits)
{
@ -316,7 +330,11 @@ easy_lut<Raw> make_hardsigmoid_lut(unsigned fractional_bits)
});
}
/// `0` left of `-3`, `x` right of `3`, `x(x + 3) / 6` between, rounded.
/// @brief `0` left of `-3`, `x` right of `3`, `x(x + 3) / 6` between, rounded.
/// @tparam Raw underlying representation
/// @param fractional_bits the number of fractional bits
/// @return `0` left of `-3`, `x` right of `3`, `x(x + 3) / 6` between, rounded
/// @throws std::invalid_argument if `fractional width does not fit the denominator`
template <typename Raw>
easy_lut<Raw> make_hardswish_lut(unsigned fractional_bits)
{

View file

@ -1,6 +1,5 @@
/// @file grotto/fixedpoint.hpp
/// @brief
/// @details
/// @brief Fixed-point values stored in an integer backend.
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
@ -40,6 +39,8 @@ namespace detail
/// @brief Integer value of an already-rounded finite double, as a 256-bit word.
/// Values that do not fit saturate to all-ones.
/// @param rounded the `rounded`
/// @return Integer value of an already-rounded finite double, as a 256-bit word
HEDLEY_NO_THROW
inline uint256_t uint256_from_rounded_double(double rounded) noexcept
{
@ -98,7 +99,11 @@ struct is_static_castable<To, From,
std::void_t<decltype(static_cast<To>(std::declval<From>()))>>
: std::true_type {};
/// Low `bits` of `wide`, saturated to all-ones when `wide` does not fit.
/// @brief Low `bits` of `wide`, saturated to all-ones when `wide` does not fit.
/// @tparam Raw underlying representation
/// @tparam Bits bits
/// @param wide the `wide`
/// @return Low `bits` of `wide`, saturated to all-ones when `wide` does not fit
template <typename Raw, std::size_t Bits>
HEDLEY_NO_THROW
Raw saturate_low_bits(uint256_t wide) noexcept
@ -202,8 +207,13 @@ inline IntegralType rounded_double_to_integral(double rounded) noexcept
}
}
/// Shift an integer into fixed-point raw form: `value * 2^FractionalBits`,
/// @brief Shift an integer into fixed-point raw form: `value * 2^FractionalBits`,
/// wrapping in the backend's two's-complement encoding. One shift; no `double`.
/// @tparam IntegralType underlying integral type
/// @tparam FractionalBits number of fractional bits
/// @tparam T value type
/// @param integer_value the `integer_value`
/// @return the returned `IntegralType`
template <typename IntegralType,
unsigned FractionalBits,
typename T>
@ -227,8 +237,11 @@ inline constexpr bool is_signed_rep_v =
std::is_signed_v<IntegralType>
|| std::is_same_v<IntegralType, simde_int128>;
/// Two's-complement negate via the unsigned width. Defined for the
/// @brief Two's-complement negate via the unsigned width. Defined for the
/// most-negative value (wraps); signed `-x` would be UB there.
/// @tparam IntegralType underlying integral type
/// @param x the `x`
/// @return Two's-complement negate via the unsigned width
template <typename IntegralType>
HEDLEY_ALWAYS_INLINE
HEDLEY_CONST
@ -253,8 +266,12 @@ constexpr IntegralType raw_abs(IntegralType x) noexcept
return x;
}
/// Remainder with the sign of `a` and magnitude `< |b|` (C++ `%` /
/// @brief Remainder with the sign of `a` and magnitude `< |b|` (C++ `%` /
/// `std::fmod`). Zero divisor → 0; this type has no NaN.
/// @tparam IntegralType underlying integral type
/// @param a the `a`
/// @param b the `b`
/// @return Remainder with the sign of `a` and magnitude `< |b|` (C++ `%` / `std::fmod`)
template <typename IntegralType>
HEDLEY_ALWAYS_INLINE
HEDLEY_CONST
@ -276,7 +293,7 @@ HEDLEY_NO_THROW
auto constexpr make_fixed_from_integral_type(IntegralType value) noexcept;
/// @tparam FractionalBits Number of fractional bits used in the fixed-point
/// representation.
/// @brief representation.
/// @tparam IntegralType The underlying integral type used for the fixed-point
/// representation.
template <unsigned FractionalBits,
@ -310,18 +327,21 @@ public:
/// @brief Copy c'tor
/// @details Constructs a fixed-point with the value copied from `other`.
/// @param other the value to compare or copy
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint(const fixedpoint & other) noexcept = default;
/// @brief Move c'tor
/// @details Constructs a fixed-point with the value copied from `other` using move semantics.
/// @param other the value to compare or copy
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint(fixedpoint && other) noexcept = default;
/// @brief Value c'tor
/// @details Initializes the fixed-point with the value determined by `desired`, using the <a href="https://en.cppreference.com/w/cpp/numeric/fenv/FE_round">current rounding mode</a> for the least-significant bit.
/// @param desired the `desired`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint(double desired) noexcept // NOLINT (implicit c'tor)
@ -333,6 +353,9 @@ public:
/// @details `fixedpoint(3)` is the mathematical value 3 (raw encoding
/// `3 << fractional_bits`), not a raw word. One shift; no `double`.
/// Use `from_raw` for a bit-exact encoding.
/// @tparam T value type
/// @tparam T value type
/// @param integer_value the `integer_value`
template <typename T,
std::enable_if_t<
std::is_integral_v<T>
@ -345,6 +368,8 @@ public:
{ }
/// @brief Bit-exact construction from the backend integer encoding.
/// @param raw the underlying integer
/// @return Bit-exact construction from the backend integer encoding
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
static constexpr fixedpoint from_raw(integral_type raw) noexcept
@ -354,24 +379,30 @@ public:
/// @}
/// @name Assignment operators
/// @brief Assign a new value to a fixed-point number
/// {@
/// @name Assignment operators
/// @brief Assign a new value to a fixed-point number
/// @{
/// @brief Copy assignment
/// @details Assigns the fixed-point with a copy of `other`
/// @param other the value to compare or copy
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator=(const fixedpoint & other) noexcept = default;
/// @brief Move assignment
/// @details Assigns the fixed-point with a copy of `other` using move semantics.
/// @param other the value to compare or copy
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator=(fixedpoint && other) noexcept = default;
/// @brief Value assignment
/// @details Assigns the fixed-point with a value determined by `desired`, using the <a href="https://en.cppreference.com/w/cpp/numeric/fenv/FE_round">current rounding mode</a> for the least-significant bit..
/// @param desired the `desired`
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator=(const double & desired) noexcept
@ -386,6 +417,7 @@ public:
~fixedpoint() = default;
/// @brief Cast to `double`
/// @return Cast to `double`
HEDLEY_NO_THROW
HEDLEY_ALWAYS_INLINE
HEDLEY_PURE
@ -402,8 +434,11 @@ public:
return static_cast<bool>(this->integral_representation() & mask);
}
/// Bit test against another encoding (DPF writes `mask & x` with both
/// @brief Bit test against another encoding (DPF writes `mask & x` with both
/// sides the input type when `msb_mask` is a `fixedpoint`).
/// @param mask the bit mask
/// @return Bit test against another encoding (DPF writes `mask & x` with both sides the input
/// type when `msb_mask` is a `fixedpoint`)
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -412,7 +447,8 @@ public:
return static_cast<bool>(value & mask.value);
}
/// Bitwise complement of the encoding. `std::bit_not` uses this.
/// @brief Bitwise complement of the encoding. `std::bit_not` uses this.
/// @return Bitwise complement of the encoding
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -423,7 +459,8 @@ public:
~static_cast<unsigned_type>(value)));
}
/// Next / previous representable encoding (one ULP).
/// @brief Next / previous representable encoding (one ULP).
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator++() noexcept
@ -458,7 +495,7 @@ public:
return tmp;
}
/// Logical shift of the encoding. DPF walks `msb_mask` with `>>`; a
/// @brief Logical shift of the encoding. DPF walks `msb_mask` with `>>`; a
/// signed arithmetic shift would sign-extend the MSB and break that.
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
@ -497,6 +534,7 @@ public:
/// @brief Access underlying integral representation
/// @details If the represented fixed-point number is `x`, then this
/// function returns an `integral_type` whose value is `x*2**fractional_bits`.
/// @return Access underlying integral representation
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -506,6 +544,7 @@ public:
}
/// @brief Unary negation operator
/// @return Unary negation operator
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -516,6 +555,8 @@ public:
/// @brief Binary addition operator
/// @details Computes the sum of two fixed-point numbers
/// @param rhs the right-hand operand
/// @return Binary addition operator
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -525,6 +566,8 @@ public:
}
/// @brief Binary addition assignment operator
/// @param rhs the right-hand operand
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator+=(fixedpoint rhs) noexcept
@ -534,6 +577,8 @@ public:
}
/// @brief Binary subtraction operator
/// @param rhs the right-hand operand
/// @return Binary subtraction operator
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
HEDLEY_PURE
@ -543,6 +588,8 @@ public:
}
/// @brief Binary addition assignment operator
/// @param rhs the right-hand operand
/// @return `*this`
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
constexpr fixedpoint & operator-=(fixedpoint rhs) noexcept
@ -552,6 +599,9 @@ public:
}
/// @brief Binary multiplication operator
/// @tparam FractionalBits1 fractional bits1
/// @param rhs the right-hand operand
/// @return Binary multiplication operator
template <unsigned FractionalBits1>
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
@ -701,6 +751,8 @@ public:
// struct make_fixed_from_integral_type_tag {};
/// @brief Determine if a floating-point is within range
/// @param d the `d`
/// @return Determine if a floating-point is within range
HEDLEY_ALWAYS_INLINE
HEDLEY_NO_THROW
static constexpr bool is_in_range(double d) noexcept
@ -734,6 +786,12 @@ public:
/// @brief Bit test with the mask on the left. DPF key generation and
/// evaluation write `mask & x`.
/// @tparam FractionalBits number of fractional bits
/// @tparam IntegralType underlying integral type
/// @tparam Mask mask
/// @param mask the bit mask
/// @param x the `x`
/// @return Bit test with the mask on the left
template <unsigned FractionalBits,
typename IntegralType,
typename Mask>
@ -797,7 +855,11 @@ static constexpr auto make_fixed(double d)
}
/// @brief Creates a fixed-point number from a double with bounds checking.
/// @throws std::range_error If the input double is outside the representable
/// @tparam FractionalBits number of fractional bits
/// @tparam IntegralType underlying integral type
/// @param d the `d`
/// @return Creates a fixed-point number from a double with bounds checking
/// @throws std::range_error if the input double is outside the representable
/// range of the fixed-point number.
template <unsigned FractionalBits,
typename IntegralType = GROTTO_FIXED_DEFAULT_INTEGRAL_REPRESENTATION>
@ -1562,6 +1624,8 @@ struct flip_msb_for_input<grotto::fixedpoint<FractionalBits, IntegralType>>
namespace dpf::leaf_arithmetic
{
HEDLEY_PRAGMA(GCC diagnostic push)
HEDLEY_PRAGMA(GCC diagnostic ignored "-Wignored-attributes")
template <unsigned FractionalBits, typename IntegralType>
struct add_t<grotto::fixedpoint<FractionalBits, IntegralType>, simde__m128i>
{
@ -1617,6 +1681,7 @@ struct multiply_t<grotto::fixedpoint<FractionalBits, IntegralType>, simde__m256i
return multiply_t<IntegralType, simde__m256i>{}(a, b.integral_representation());
}
};
HEDLEY_PRAGMA(GCC diagnostic pop)
} // namespace dpf::leaf_arithmetic

View file

@ -34,6 +34,12 @@ namespace grotto
/// zero-extend. Sign-extending a narrower signed operand, and replicating the
/// product sign when `modulus_bits > multiply_bits`, are plaintext steps the
/// MPC protocol has to reproduce (they are not local on additive shares).
/// @tparam IntegerBits number of integer bits, including the sign
/// @tparam FractionalBits number of fractional bits
/// @tparam LhsFractionalBits lhs fractional bits
/// @tparam LhsIntegral lhs integral
/// @tparam RhsFractionalBits rhs fractional bits
/// @tparam RhsIntegral rhs integral
template <unsigned IntegerBits,
unsigned FractionalBits,
unsigned LhsFractionalBits,
@ -51,12 +57,12 @@ struct fixed_mul_plan
static constexpr bool rhs_signed = std::is_signed_v<RhsIntegral>;
static constexpr bool operands_signed = lhs_signed || rhs_signed;
/// Right shift applied to the raw product. Negative means a left shift.
/// @brief Right shift applied to the raw product. Negative means a left shift.
static constexpr int align_shift = static_cast<int>(LhsFractionalBits)
+ static_cast<int>(RhsFractionalBits)
- static_cast<int>(FractionalBits);
/// Bits of the product that the shift reads. Zero when a left shift
/// @brief Bits of the product that the shift reads. Zero when a left shift
/// moves every product bit out of the output.
static constexpr int modulus_bits_signed = align_shift >= 0
? align_shift + static_cast<int>(out_bits)
@ -64,14 +70,14 @@ struct fixed_mul_plan
static constexpr unsigned modulus_bits = modulus_bits_signed > 0
? static_cast<unsigned>(modulus_bits_signed) : 0u;
/// Full two's-complement product fits in this many bits.
/// @brief Full two's-complement product fits in this many bits.
static constexpr unsigned product_bits = lhs_width + rhs_width;
static constexpr unsigned multiply_bits = modulus_bits < product_bits
? modulus_bits : product_bits;
static constexpr unsigned limbs = multiply_bits == 0u
? 0u : (multiply_bits + 63u) / 64u;
/// Signed storage exists through 128 bits. A wider window is the same
/// @brief Signed storage exists through 128 bits. A wider window is the same
/// residue held in an unsigned fixed-point.
static constexpr bool result_is_signed = operands_signed && out_bits <= 128u;
@ -197,7 +203,14 @@ constexpr void store_raw_limbs(const T & value, std::uint64_t out[4]) noexcept
}
}
/// Low `dest_bits` of `value`, sign-extended when `value` is a narrower signed integer.
/// @brief Low `dest_bits` of `value`, sign-extended when `value` is a narrower signed integer.
/// @tparam T value type
/// @param value the value to convert or store
/// @param src_bits the `src_bits`
/// @param is_signed the `is_signed`
/// @param dest_bits the `dest_bits`
/// @param dest the destination
/// @param nlimbs the `nlimbs`
template <typename T>
HEDLEY_NO_THROW
constexpr void reduce_operand(const T & value, unsigned src_bits, bool is_signed,
@ -222,7 +235,11 @@ constexpr void reduce_operand(const T & value, unsigned src_bits, bool is_signed
mask_to_bits(dest, nlimbs, dest_bits);
}
/// Product modulo `2^(64*nlimbs)`, using exactly `nlimbs` limbs of each operand.
/// @brief Product modulo `2^(64*nlimbs)`, using exactly `nlimbs` limbs of each operand.
/// @param out the output buffer
/// @param lhs the left-hand operand
/// @param rhs the right-hand operand
/// @param nlimbs the `nlimbs`
HEDLEY_NO_THROW
constexpr void mul_low_limbs(std::uint64_t * out, const std::uint64_t * lhs,
const std::uint64_t * rhs, unsigned nlimbs) noexcept
@ -328,15 +345,21 @@ constexpr T limbs_to_integral(const std::uint64_t * limbs) noexcept
} // namespace detail
/// @brief Multiply two fixed-point values into a chosen integer and fraction width.
/// @tparam IntegerBits Integer bits kept in the result, including the sign bit
/// when the result is signed. Bits above this wrap.
/// @details The result is held in the smallest fixed-point word that can store
/// `IntegerBits + FractionalBits`. A signed word is used when either operand
/// is signed and the window is at most 128 bits; otherwise the window is the
/// unsigned residue.
/// @tparam IntegerBits Integer bits kept in the result, including the sign bit
/// when the result is signed. Bits above this wrap.
/// @tparam FractionalBits Fraction bits kept in the result. Lower fraction bits
/// of the exact product are discarded (floored).
///
/// The result is held in the smallest fixed-point word that can store
/// `IntegerBits + FractionalBits`. A signed word is used when either operand
/// is signed and the window is at most 128 bits; otherwise the window is the
/// unsigned residue.
/// of the exact product are discarded (floored).
/// @tparam LhsFractionalBits fractional bits of the left operand
/// @tparam LhsIntegral integral type of the left operand
/// @tparam RhsFractionalBits fractional bits of the right operand
/// @tparam RhsIntegral integral type of the right operand
/// @param lhs the left-hand operand
/// @param rhs the right-hand operand
/// @return the product at the requested width
template <unsigned IntegerBits,
unsigned FractionalBits,
unsigned LhsFractionalBits,

View file

@ -1,7 +1,6 @@
/// @file grotto/gadget_hints.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @details
/// @brief Domain, degree, and pole hints for cleartext gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -10,6 +9,8 @@
#ifndef LIBDPF_INCLUDE_GROTTO_GADGET_HINTS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGET_HINTS_HPP__
#include "hedley/hedley.h"
#include <cmath>
#include <array>
#include <limits>

View file

@ -1,7 +1,6 @@
/// @file grotto/gadgets.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @details
/// @brief Umbrella include for the gadget reference headers that are enabled.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -9,6 +8,10 @@
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HPP__
// Cleartext gadget functors are the 2019 reference layer. Fixed-point
// evaluation lives in the LUTs: `eval_reduced` (including `expm1` and
// `log1p`), `eval_window`, `make_*_lut`, and `exact_constant`. A functor
// whose map those tables implement is deprecated.
// #include "grotto/gadgets/activations.hpp"
// #include "grotto/gadgets/binary.hpp"
#include "grotto/gadgets/decimal.hpp"

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the activations gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/celu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `celu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/elish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `elish`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,11 @@ namespace grotto
namespace gadgets
{
struct elish
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) elish
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<elish>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/elu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `elu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/gelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `gelu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct gelu
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) gelu
{
template <typename T>
T operator()(T x)
@ -42,6 +46,8 @@ struct gadget_hints<gelu>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/hardelish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `hardelish`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/hardshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `hardshrink`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,9 +20,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double hardshrink_default_lambda = 0.5;
template <double const & lambda = hardshrink_default_lambda>
struct hardshrink
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardshrink_lut) hardshrink
{
template <typename T>
T operator()(T x)
@ -45,6 +49,8 @@ struct gadget_hints<hardshrink<lambda>>
static constexpr std::array<double, degree+1> canonical_polys[] = { {0,1}, {0}, {0,1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/hardsigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `hardsigmoid`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct hardsigmoid
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardsigmoid_lut) hardsigmoid
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<hardsigmoid>
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0.5,1/6.0}, {1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/hardswish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `hardswish`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct hardswish
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardswish_lut) hardswish
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<hardswish>
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0,0.5,1/6.0}, {0,1,0} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/hardtanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `hardtanh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct hardtanh
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_hardtanh_lut) hardtanh
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<hardtanh>
static constexpr std::array<double, degree+1> canonical_polys[] = { {-1}, {0,1}, {1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/leakyrelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `leakyrelu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,10 +20,14 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double leakyrelu_default_negative_slope = 0.01;
static constexpr double leakyrelu_zero_negative_slope = 0.0;
template <double const & negative_slope = leakyrelu_default_negative_slope>
struct leakyrelu
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_leaky_relu_lut) leakyrelu
{
template <typename T>
T operator()(T x)
@ -46,6 +50,8 @@ struct gadget_hints<leakyrelu<negative_slope>>
inline static constexpr std::array<double, degree+1> canonical_polys[] = { {0,negative_slope}, {0,1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/lecun_tanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `lecun_tanh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/logsigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `logsigmoid`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,11 @@ namespace grotto
namespace gadgets
{
struct logsigmoid
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) logsigmoid
{
template <typename T>
T operator()(T x) { return std::log(sigmoid{}(x)); }
@ -40,6 +44,8 @@ struct gadget_hints<logsigmoid>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/mish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `mish`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,11 @@ namespace grotto
namespace gadgets
{
struct mish
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) mish
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<mish>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/one_minus_relu.hpp
/// @file grotto/gadgets/activations/one_minus_sigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `one_minus_sigmoid`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,10 @@ namespace grotto
namespace gadgets
{
struct one_minus_sigmoid
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) one_minus_sigmoid
{
template <typename T>
T operator()(T x)
@ -43,6 +46,8 @@ struct gadget_hints<one_minus_sigmoid>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/relu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `relu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,10 @@ namespace grotto
namespace gadgets
{
using relu = leakyrelu<leakyrelu_zero_negative_slope>;
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
using relu HEDLEY_DEPRECATED_FOR(2026, grotto::make_relu_lut) = leakyrelu<leakyrelu_zero_negative_slope>;
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/relu6.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `relu6`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,9 +20,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double relu6_default_clip = 6;
template <double const & clip = 6>
struct relu6
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_relu6_lut) relu6
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<relu6<clip>>
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, {0,1}, clip };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/selu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `selu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/serf.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `serf`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,7 +21,11 @@ namespace grotto
namespace gadgets
{
struct serf
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) serf
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<serf>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/sigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `sigmoid`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct sigmoid
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) sigmoid
{
template <typename T>
T operator()(T x) { return 1/(1+std::exp(-x)); }
@ -39,6 +43,8 @@ struct gadget_hints<sigmoid>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/silu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `silu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct silu
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) silu
{
template <typename T>
T operator()(T x) { return x*sigmoid{}(x); }
@ -39,6 +43,8 @@ struct gadget_hints<silu>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/smoothstep.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `smoothstep`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,9 +20,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double smoothstep_default_gamma = 1;
template <double const & gamma = smoothstep_default_gamma>
struct smoothstep
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) smoothstep
{
template <typename T>
T operator()(T x)
@ -46,6 +50,8 @@ struct gadget_hints<smoothstep<gamma>>
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, {-2/(gamma*gamma*gamma),0,3/(2*gamma),0.5}, 1 };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/softminus.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `softminus`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -21,9 +21,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softminus_default_beta = 1;
template <double const & beta = softminus_default_beta>
struct softminus
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) softminus
{
template <typename T>
T operator()(T x)
@ -45,6 +49,8 @@ struct gadget_hints<softminus<beta>>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/softplus.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `softplus`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,9 +20,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softplus_default_beta = 1;
template <double const & beta = softplus_default_beta>
struct softplus
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) softplus
{
template <typename T>
T operator()(T x)
@ -45,6 +49,8 @@ struct gadget_hints<softplus<beta>>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/softshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `softshrink`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,9 +20,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
static constexpr double softshrink_default_lambda = 0.5;
template <double const & lambda = softshrink_default_lambda>
struct softshrink
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_softshrink_lut) softshrink
{
template <typename T>
T operator()(T x)
@ -46,6 +50,8 @@ struct gadget_hints<softshrink<lambda>>
static constexpr std::array<double, degree+1> canonical_polys[] = { {lambda,1}, {0}, {-lambda,1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/softsign.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `softsign`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/squared_relu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `squared_relu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct squared_relu
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_squared_relu_lut) squared_relu
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<squared_relu>
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0,0,1} };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/starrelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `starrelu`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/tanhexp.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `tanhexp`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct tanhexp
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) tanhexp
{
template <typename T>
T operator()(T x) { return x*std::tanh(std::exp(x)); }
@ -39,6 +43,8 @@ struct gadget_hints<tanhexp>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/activations/tanhshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `tanhshrink`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/binary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the binary gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/binary/bt.hpp
/// @file grotto/gadgets/binary/bit.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `bit`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct countl_zero
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) countl_zero
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<countl_zero>
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/binary/prefix.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `prefix`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/binary/sg.hpp
/// @file grotto/gadgets/binary/sgn.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `sgn`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct sgn
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) sgn
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<sgn>
static constexpr std::array<double, degree+1> canonical_polys[] = { -1, 0, 1 };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/decimal.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the decimal gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/decimal/dec_ceil.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `dec_ceil`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/decimal/dec_floor.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `dec_floor`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/decimal/dec_width.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `dec_width`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/decimal/has_single_digit.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `has_single_digit`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the elementary gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/abs.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `abs`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct abs
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_abs_lut) abs
{
template <typename T>
T operator()(T x) { return std::abs(static_cast<double>(x)); }
@ -39,6 +43,8 @@ struct gadget_hints<abs>
static constexpr std::array<double, degree+1> canonical_polys[] = { { -1, 0 }, { 1, 0 } };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/approx.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `approx`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/boxcar.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `boxcar`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elemwntary/clip.hpp
/// @file grotto/gadgets/elementary/clip.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `clip`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -19,9 +19,13 @@ namespace grotto
namespace gadgets
{
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
template <double const & lower,
double const & upper>
struct clip
struct HEDLEY_DEPRECATED_FOR(2026, grotto::make_clip_lut) clip
{
static_assert(lower <= upper);
template <typename T>
@ -43,6 +47,8 @@ struct gadget_hints<clip<lower, upper>>
static constexpr std::array<double, degree+1> canonical_polys[] = { { lower, 0 }, { 0, 1 }, { upper, 0 } };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/eq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `eq`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/geq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `geq`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/gt.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `gt`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/identity.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `identity`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/leqw.hpp
/// @file grotto/gadgets/elementary/leq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `leq`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/lt.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `lt`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/negative.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `negative`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double lt_target_zero = 0;
using negative = lt<lt_target_zero>;
using negative HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = lt<lt_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/neq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `neq`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/nonnegative.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `nonnegative`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double geq_target_zero = 0;
using nonnegative = geq<geq_target_zero>;
using nonnegative HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = geq<geq_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/nonpositive.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `nonpositive`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double leq_target_zero = 0;
using nonpositive = leq<leq_target_zero>;
using nonpositive HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = leq<leq_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/nonzero.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `nonzero`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double neq_target_zero = 0;
using nonzero = neq<neq_target_zero>;
using nonzero HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = neq<neq_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/pmone.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `pmone`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/positive.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `positive`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double gt_target_zero = 0;
using positive = gt<gt_target_zero>;
using positive HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = gt<gt_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/rect.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `rect`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/step.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `step`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/ternary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ternary`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/elementary/zero.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `zero`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -17,7 +17,7 @@ namespace gadgets
{
static constexpr double eq_target_zero = 0;
using zero = eq<eq_target_zero>;
using zero HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) = eq<eq_target_zero>;
} // namespace gadgets

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/exponential.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Deprecated cleartext `exp` / `exp2` / `exp10`. Use `eval_reduced`. Includes the exponential gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct exp
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) exp
{
template <typename T>
T operator()(T x) { return std::min(std::exp(static_cast<double>(x)), std::numeric_limits<T>::max()); }
@ -39,6 +43,8 @@ struct gadget_hints<exp>
static constexpr std::array<double, degree+1> * canonical_polys = nullptr;
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct exp10
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) exp10
{
template <typename T>
T operator()(T x) { return std::min(std::pow(10, static_cast<double>(x)), std::numeric_limits<T>::max()); }
@ -39,6 +43,8 @@ struct gadget_hints<exp10>
static constexpr std::array<double, degree+1> * hint_canonical_polys = nullptr;
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct exp2
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) exp2
{
template <typename T>
T operator()(T x) { return std::min(std::exp2(static_cast<double>(x)), std::numeric_limits<T>::max()); }
@ -39,6 +43,8 @@ struct gadget_hints<exp2>
static constexpr std::array<double, degree+1> * canonical_polys = nullptr;
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the hyperbolic gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/acosh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `acosh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/acoth.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `acoth`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/acsch.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `acsch`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/asech.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `asech`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/asinh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `asinh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/atanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `atanh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/cosh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `cosh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct cosh
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) cosh
{
template <typename T>
T operator()(T x) { return std::min(std::cosh(static_cast<double>(x)), std::numeric_limits<T>::max()); }
@ -39,6 +43,8 @@ struct gadget_hints<cosh>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/coth.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `coth`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct coth
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) coth
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<coth>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/csch.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `csch`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct csch
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) csch
{
template <typename T>
T operator()(T x)
@ -44,6 +48,8 @@ struct gadget_hints<csch>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/sech.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `sech`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct sech
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) sech
{
template <typename T>
T operator()(T x) { return 1/std::cosh(static_cast<double>(x)); }
@ -39,6 +43,8 @@ struct gadget_hints<sech>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/sinh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `sinh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct sinh
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) sinh
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<sinh>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/hyperbolic/tanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `tanh`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct tanh
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) tanh
{
template <typename T>
T operator()(T x) { return std::tanh(static_cast<double>(x)); }
@ -39,6 +43,8 @@ struct gadget_hints<tanh>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the logarithm gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,7 @@
/// @file grotto/gadgets/logarithm/ilog10.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ilog10`.
/// @details The previous body of this header defined a second `ilog256`.
/// Integer log10 is `exact_constant::ilog10`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,29 +21,34 @@ namespace grotto
namespace gadgets
{
struct ilog256
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) ilog10
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::ceil(std::log2(static_cast(x))/8);
if (x <= 0) return 0;
return std::floor(std::log10(static_cast<double>(x)));
}
};
template <>
struct gadget_hints<ilog256>
struct gadget_hints<ilog10>
{
static constexpr double min = std::exp2(-63);
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double hint_poles[] = { };
static constexpr double hint_interesting_points[] = { 0 };
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/ilog16.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ilog16`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/ilog256.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ilog256`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/ilogb.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ilogb`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct ilogb
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::exact_constant) ilogb
{
template <typename T>
T operator()(T x)
@ -300,6 +304,8 @@ struct gadget_hints<grotto::gadgets::ilogb>
};
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/lg.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `lg`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct lg
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) lg
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<lg>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/ln.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `ln`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct ln
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) ln
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<ln>
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/log10.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `log10`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct log10
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_reduced) log10
{
template <typename T>
T operator()(T x)
@ -43,6 +47,8 @@ struct gadget_hints<log10>
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/logn.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `logn`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/logarithm/logstar.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `logstar`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/misc.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Includes the misc gadget references.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/misc/entropy.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `entropy`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/misc/erf.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `erf`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,7 +20,11 @@ namespace grotto
namespace gadgets
{
struct erf
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) erf
{
template <typename T>
T operator()(T x) { std::erf(static_cast<double>(x)); }
@ -39,6 +43,8 @@ struct gadget_hints<erf>
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

View file

@ -1,6 +1,6 @@
/// @file grotto/gadgets/misc/erfc.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @brief Cleartext reference for `erfc`.
/// @copyright Copyright (c) 2019-2023 Ryan Henry and others
/// @license Released under a GNU General Public v2.0 (GPLv2) license;
/// see [LICENSE.md](@ref GPLv2) for details.
@ -20,14 +20,18 @@ namespace grotto
namespace gadgets
{
struct erf
HEDLEY_DIAGNOSTIC_PUSH
HEDLEY_DIAGNOSTIC_DISABLE_DEPRECATED
struct HEDLEY_DEPRECATED_FOR(2026, grotto::eval_window) erfc
{
template <typename T>
T operator()(T x) { std::erfc(static_cast<double>(x)); }
T operator()(T x) { return std::erfc(static_cast<double>(x)); }
};
template <>
struct gadget_hints<erf>
struct gadget_hints<erfc>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
@ -39,6 +43,8 @@ struct gadget_hints<erf>
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
HEDLEY_DIAGNOSTIC_POP
} // namespace gadgets
} // namespace grotto

Some files were not shown because too many files have changed in this diff Show more