Initial import of libdpf.

Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
Ryan Henry 2026-09-24 14:08:32 -06:00
commit e4e666f459
4563 changed files with 1690372 additions and 0 deletions

View file

@ -0,0 +1,42 @@
/// @file grotto/gadgets/activations.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HPP__
#include "grotto/gadgets/activations/celu.hpp"
#include "grotto/gadgets/activations/elish.hpp"
#include "grotto/gadgets/activations/elu.hpp"
#include "grotto/gadgets/activations/gelu.hpp"
#include "grotto/gadgets/activations/hardelish.hpp"
#include "grotto/gadgets/activations/hardshrink.hpp"
#include "grotto/gadgets/activations/hardsigmoid.hpp"
#include "grotto/gadgets/activations/hardswish.hpp"
#include "grotto/gadgets/activations/hardtanh.hpp"
#include "grotto/gadgets/activations/leakyrelu.hpp"
#include "grotto/gadgets/activations/lecun_tanh.hpp"
#include "grotto/gadgets/activations/logsigmoid.hpp"
#include "grotto/gadgets/activations/mish.hpp"
#include "grotto/gadgets/activations/one_minus_sigmoid.hpp"
#include "grotto/gadgets/activations/relu.hpp"
#include "grotto/gadgets/activations/relu6.hpp"
#include "grotto/gadgets/activations/selu.hpp"
#include "grotto/gadgets/activations/serf.hpp"
#include "grotto/gadgets/activations/sigmoid.hpp"
#include "grotto/gadgets/activations/silu.hpp"
#include "grotto/gadgets/activations/smoothstep.hpp"
#include "grotto/gadgets/activations/softminus.hpp"
#include "grotto/gadgets/activations/softplus.hpp"
#include "grotto/gadgets/activations/softshrink.hpp"
#include "grotto/gadgets/activations/softsign.hpp"
#include "grotto/gadgets/activations/squared_relu.hpp"
#include "grotto/gadgets/hyperbolic/tanh.hpp"
#include "grotto/gadgets/activations/starrelu.hpp"
#include "grotto/gadgets/activations/tanhexp.hpp"
#include "grotto/gadgets/activations/tanhshrink.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATION_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/celu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_CELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_CELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double celu_default_alpha = 1;
template <double const & alpha = celu_default_alpha>
struct celu
{
template <typename T>
T operator()(T x)
{
return std::min(std::max(0, x) + std::min(0, alpha * std::expm1(x / alpha)), std::numeric_limits<T>::max());
}
};
template <double const & alpha>
struct gadget_hints<celu<alpha>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_CELU_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/elish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELISH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELISH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "sigmoid.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct elish
{
template <typename T>
T operator()(T x)
{
if (x < 0) return std::expm1(x)*sigmoid{}(x);
if (x >= 0) return std::min(x*sigmoid{}(x), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<elish>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELISH_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/activations/elu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double elu_default_alpha = 1;
template <double const & alpha = elu_default_alpha>
struct elu
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return alpha * std::expm1(x);
if (x > 0) return std::min(x, std::numeric_limits<T>::max());
}
};
template <double const & alpha>
struct gadget_hints<elu<alpha>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ELU_HPP__

View file

@ -0,0 +1,49 @@
/// @file grotto/gadgets/activations/gelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_GELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_GELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct gelu
{
template <typename T>
T operator()(T x)
{
return std::min(x*(1+std::erf(x/std::sqrt(2)))/2, std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<gelu>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_GELU_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/hardelish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDELISH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDELISH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct hardelish
{
template <typename T>
T operator()(T x)
{
if (x < 0) return std::expm1(x)*std::max(0, std::min(1,(x+1)/2));
if (x >= 0) return std::min(x*std::max(0,std::min(1,(x+1)/2)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<hardelish>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDELISH_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/activations/hardshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSHRINK_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSHRINK_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double hardshrink_default_lambda = 0.5;
template <double const & lambda = hardshrink_default_lambda>
struct hardshrink
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) <= lambda) return 0;
return x;
}
};
template <double const & lambda>
struct gadget_hints<hardshrink<lambda>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -lambda, lambda };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -lambda, lambda };
static constexpr std::array<double, degree+1> canonical_polys[] = { {0,1}, {0}, {0,1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSHRINK_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/hardsigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSIGMOID_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSIGMOID_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct hardsigmoid
{
template <typename T>
T operator()(T x)
{
if (x <= -3) return 0;
if (x >= 3) return 1;
return (x+3)/6;
}
};
template <>
struct gadget_hints<hardsigmoid>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -3, 3 };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -3, 3 };
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0.5,1/6.0}, {1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSIGMOID_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/hardswish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSWISH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSWISH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct hardswish
{
template <typename T>
T operator()(T x)
{
if (x <= -3) return 0;
if (x >= 3) return x;
return x*(x+3)/6;
}
};
template <>
struct gadget_hints<hardswish>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -3, 3 };
static constexpr unsigned degree = 2;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -3, 3 };
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0,0.5,1/6.0}, {0,1,0} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDSWISH_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/hardtanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDTANH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDTANH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct hardtanh
{
template <typename T>
T operator()(T x)
{
if (x <= -1) return -1;
if (x >= 1) return 1;
return x;
}
};
template <>
struct gadget_hints<hardtanh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -1, 1 };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -1, 1 };
static constexpr std::array<double, degree+1> canonical_polys[] = { {-1}, {0,1}, {1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_HARDTANH_HPP__

View file

@ -0,0 +1,53 @@
/// @file grotto/gadgets/activations/leakyrelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LEAKYRELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LEAKYRELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
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
{
template <typename T>
T operator()(T x)
{
if (x >= 0) return x;
return negative_slope * x;
}
};
template <double const & negative_slope>
struct gadget_hints<leakyrelu<negative_slope>>
{
inline static constexpr double min = std::numeric_limits<double>::lowest();
inline static constexpr double max = std::numeric_limits<double>::max();
inline static constexpr double poles[] = { };
inline static constexpr double interesting_points[] = { 0 };
inline static constexpr unsigned degree = 1;
inline static constexpr bool has_canonical_representation = true;
inline static constexpr double canonical_bounds[] = { 0 };
inline static constexpr std::array<double, degree+1> canonical_polys[] = { {0,negative_slope}, {0,1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LEAKYRELU_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/lecun_tanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LECUNTANH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LECUNTANH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct lecun_tanh
{
template <typename T>
T operator()(T x)
{
return 1.7159*std::tanh(2*x/3);
}
};
template <>
struct gadget_hints<lecun_tanh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LECUNTANH_HPP__

View file

@ -0,0 +1,47 @@
/// @file grotto/gadgets/activations/logsigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LOGSIGMOID_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LOGSIGMOID_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "sigmoid.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct logsigmoid
{
template <typename T>
T operator()(T x) { return std::log(sigmoid{}(x)); }
};
template <>
struct gadget_hints<logsigmoid>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_LOGSIGMOID_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/mish.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_MISH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_MISH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "softplus.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct mish
{
template <typename T>
T operator()(T x)
{
return x*std::tanh(softplus<>{}(x));
}
};
template <>
struct gadget_hints<mish>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_MISH_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/one_minus_relu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ONE_MINUS_SIGMOID_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ONE_MINUS_SIGMOID_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "sigmoid.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct one_minus_sigmoid
{
template <typename T>
T operator()(T x)
{
return 1-sigmoid{}(x);
}
};
template <>
struct gadget_hints<one_minus_sigmoid>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_ONE_MINUS_SIGMOID_HPP__

View file

@ -0,0 +1,30 @@
/// @file grotto/gadgets/activations/relu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "leakyrelu.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
using relu = leakyrelu<leakyrelu_zero_negative_slope>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/activations/relu6.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU6_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU6_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double relu6_default_clip = 6;
template <double const & clip = 6>
struct relu6
{
template <typename T>
T operator()(T x)
{
return std::min(std::max(0, x), clip);
}
};
template <double const & clip>
struct gadget_hints<relu6<clip>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0, clip };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { 0, clip };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, {0,1}, clip };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_RELU6_HPP__

View file

@ -0,0 +1,53 @@
/// @file grotto/gadgets/activations/selu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double selu_default_alpha = 1.6732632423543772848170429916717;
static constexpr double selu_default_scale = 1.0507009873554804934193349852946;
template <double const & alpha = selu_default_alpha,
double const & scale = selu_default_scale>
struct selu
{
template <typename T>
T operator()(T x)
{
return scale*(std::max(0,x)+std::min(0,alpha*std::expm1(x)));
}
};
template <double const & alpha, double const & scale>
struct gadget_hints<selu<alpha, scale>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SELU_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/serf.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SERF_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SERF_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "softplus.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct serf
{
template <typename T>
T operator()(T x)
{
return x*std::erf(softplus<>{}(x));
}
};
template <>
struct gadget_hints<serf>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SERF_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/activations/sigmoid.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SIGMOID_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SIGMOID_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sigmoid
{
template <typename T>
T operator()(T x) { return 1/(1+std::exp(-x)); }
};
template <>
struct gadget_hints<sigmoid>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SIGMOID_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/activations/silu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SILU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SILU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct silu
{
template <typename T>
T operator()(T x) { return x*sigmoid{}(x); }
};
template <>
struct gadget_hints<silu>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SILU_HPP__

View file

@ -0,0 +1,53 @@
/// @file grotto/gadgets/activations/smoothstep.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SMOOTHSTEP_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SMOOTHSTEP_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double smoothstep_default_gamma = 1;
template <double const & gamma = smoothstep_default_gamma>
struct smoothstep
{
template <typename T>
T operator()(T x)
{
if (x <= -gamma/2) return 0;
if (x <= gamma/2) return 1;
if (std::abs(x) < gamma/2) return (-2/(gamma*gamma*gamma))*x*x*x+(3/(2*gamma))*x+0.5;
}
};
template <double const & gamma>
struct gadget_hints<smoothstep<gamma>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -gamma/2, gamma/2 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -gamma/2, gamma/2 };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, {-2/(gamma*gamma*gamma),0,3/(2*gamma),0.5}, 1 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SMOOTHSTEP_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/activations/softminus.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTMINUS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTMINUS_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "softplus.hpp"
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double softminus_default_beta = 1;
template <double const & beta = softminus_default_beta>
struct softminus
{
template <typename T>
T operator()(T x)
{
return beta*x-softplus<beta>{}(x);
}
};
template <double const & beta>
struct gadget_hints<softminus<beta>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 20 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTMINUS_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/activations/softplus.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTPLUS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTPLUS_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double softplus_default_beta = 1;
template <double const & beta = softplus_default_beta>
struct softplus
{
template <typename T>
T operator()(T x)
{
if (x > 20) return x*beta;
return (std::log1p(std::exp(beta*x)))/beta;
}
};
template <double const & beta>
struct gadget_hints<softplus<beta>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 20 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTPLUS_HPP__

View file

@ -0,0 +1,53 @@
/// @file grotto/gadgets/activations/softshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSHRINK_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSHRINK_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double softshrink_default_lambda = 0.5;
template <double const & lambda = softshrink_default_lambda>
struct softshrink
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) <= lambda) return 0;
if (x < lambda) return x+lambda;
if (x > lambda) return x-lambda;
}
};
template <double const & lambda>
struct gadget_hints<softshrink<lambda>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -lambda, lambda };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -lambda, lambda };
static constexpr std::array<double, degree+1> canonical_polys[] = { {lambda,1}, {0}, {-lambda,1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSHRINK_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/activations/softsign.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSIGN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSIGN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct hardsign
{
template <typename T>
T operator()(T x) { return x/(1+std::abs(x)); }
};
template <>
struct gadget_hints<hardsign>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SOFTSIGN_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/activations/squared_relu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SQUAREDRELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SQUAREDRELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct squared_relu
{
template <typename T>
T operator()(T x)
{
if (x >= 0) return x*x;
return 0;
}
};
template <>
struct gadget_hints<squared_relu>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 2;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { 0 };
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0,0,1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_SQUAREDRELU_HPP__

View file

@ -0,0 +1,54 @@
/// @file grotto/gadgets/activations/starrelu.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_STARRELU_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_STARRELU_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double starrelu_default_scale = 0.8944;
static constexpr double starrelu_default_shift = -0.4472;
template<double const & scale = starrelu_default_scale,
double const & shift = starrelu_default_shift>
struct starrelu
{
template <typename T>
T operator()(T x)
{
if (x < 0) return 0;
return scale*x*x+shift;
}
};
template <double const & scale, double const & shift>
struct gadget_hints<starrelu<shift, scale>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 2;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { 0 };
static constexpr std::array<double, degree+1> canonical_polys[] = { {0}, {0,0,1} };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_STARRELU_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/activations/tanhexp.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHEXP_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHEXP_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct tanhexp
{
template <typename T>
T operator()(T x) { return x*std::tanh(std::exp(x)); }
};
template <>
struct gadget_hints<tanhexp>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHEXP_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/activations/tanhshrink.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHSHRINK_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHSHRINK_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct tanhshrink
{
template <typename T>
T operator()(T x) { return x -std::tanh(x); }
};
template <>
struct gadget_hints<tanhshrink>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ACTIVATIONS_TANHSHRINK_HPP__

View file

@ -0,0 +1,22 @@
/// @file grotto/gadgets/binary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HPP__
// #include "binary/bit.hpp"
// #include "binary/bit_ceil.hpp"
// #include "binary/bit_floor.hpp"
// #include "binary/bit_width.hpp"
// #include "binary/clrsb.hpp"
// #include "binary/countl_one.hpp"
// #include "binary/countl_zero.hpp"
#include "grotto/gadgets/binary/has_single_bit.hpp"
// #include "elementary/prefix.hpp"
#include "grotto/gadgets/binary/sgn.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/bt.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/bit_ceil.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::bit_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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_CEIL_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_CEIL_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_CEIL_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/bit_floor.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::bit_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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_FLOOR_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_FLOOR_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_FLOOR_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/bit_width.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::bit_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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_WIDTH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_WIDTH_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_BIT_WIDTH_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/clrsb.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `__builtin_clzll`
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_CLRSB_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_CLRSB_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_CLRSB_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/binary/countl_one.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::countl_one`
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ONE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ONE_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ONE_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/binary/countl_zero.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::countl_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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ZERO_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ZERO_HPP__
#include <array>
#include <limits>
#include <portable-snippets/builtin/builtin.h>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct countl_zero
{
template <typename T>
T operator()(T x)
{
if (x == 0) return std::numeric_limits<T>::bits();
return psnip_builtin_clz64(static_cast<uint64_t>(static_cast<double>(x)));
}
};
template <>
struct gadget_hints<countl_zero>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
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[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_COUNTL_ZERO_HPP__

View file

@ -0,0 +1,255 @@
/// @file grotto/gadgets/binary/has_single_bit.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::has_single_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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HAS_SINGLE_BIT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HAS_SINGLE_BIT_HPP__
#include <array>
#include <limits>
#include <portable-snippets/builtin/builtin.h>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct has_single_bit
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0;
uint64_t x_ = static_cast<uint64_t>(static_cast<double>(x > 0 ? x : 1.0 / x));
return psnip_builtin_popcount64(x_) == 1 ? 1 : 0;
}
};
template <>
struct gadget_hints<has_single_bit>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = {
-0x1.0000000000000p+0063, +0x1.0000000000000p-0063,
+0x1.0000000000000p-0062, +0x1.0000000000000p-0061,
+0x1.0000000000000p-0060, +0x1.0000000000000p-0059,
+0x1.0000000000000p-0058, +0x1.0000000000000p-0057,
+0x1.0000000000000p-0056, +0x1.0000000000000p-0055,
+0x1.0000000000000p-0054, +0x1.0000000000000p-0053,
+0x1.0000000000000p-0052, +0x1.0000000000000p-0051,
+0x1.0000000000000p-0050, +0x1.0000000000000p-0049,
+0x1.0000000000000p-0048, +0x1.0000000000000p-0047,
+0x1.0000000000000p-0046, +0x1.0000000000000p-0045,
+0x1.0000000000000p-0044, +0x1.0000000000000p-0043,
+0x1.0000000000000p-0042, +0x1.0000000000000p-0041,
+0x1.0000000000000p-0040, +0x1.0000000000000p-0039,
+0x1.0000000000000p-0038, +0x1.0000000000000p-0037,
+0x1.0000000000000p-0036, +0x1.0000000000000p-0035,
+0x1.0000000000000p-0034, +0x1.0000000000000p-0033,
+0x1.0000000000000p-0032, +0x1.0000000000000p-0031,
+0x1.0000000000000p-0030, +0x1.0000000000000p-0029,
+0x1.0000000000000p-0028, +0x1.0000000000000p-0027,
+0x1.0000000000000p-0026, +0x1.0000000000000p-0025,
+0x1.0000000000000p-0024, +0x1.0000000000000p-0023,
+0x1.0000000000000p-0022, +0x1.0000000000000p-0021,
+0x1.0000000000000p-0020, +0x1.0000000000000p-0019,
+0x1.0000000000000p-0018, +0x1.0000000000000p-0017,
+0x1.0000000000000p-0016, +0x1.0000000000000p-0015,
+0x1.0000000000000p-0014, +0x1.0000000000000p-0013,
+0x1.0000000000000p-0012, +0x1.0000000000000p-0011,
+0x1.0000000000000p-0010, +0x1.0000000000000p-0009,
+0x1.0000000000000p-0008, +0x1.0000000000000p-0007,
+0x1.0000000000000p-0006, +0x1.0000000000000p-0005,
+0x1.0000000000000p-0004, +0x1.0000000000000p-0003,
+0x1.0000000000000p-0002, +0x1.0000000000000p-0001,
+0x1.0000000000000p+0000, +0x1.0000000000000p+0001,
+0x1.0000000000000p+0002, +0x1.0000000000000p+0003,
+0x1.0000000000000p+0004, +0x1.0000000000000p+0005,
+0x1.0000000000000p+0006, +0x1.0000000000000p+0007,
+0x1.0000000000000p+0008, +0x1.0000000000000p+0009,
+0x1.0000000000000p+0010, +0x1.0000000000000p+0011,
+0x1.0000000000000p+0012, +0x1.0000000000000p+0013,
+0x1.0000000000000p+0014, +0x1.0000000000000p+0015,
+0x1.0000000000000p+0016, +0x1.0000000000000p+0017,
+0x1.0000000000000p+0018, +0x1.0000000000000p+0019,
+0x1.0000000000000p+0020, +0x1.0000000000000p+0021,
+0x1.0000000000000p+0022, +0x1.0000000000000p+0023,
+0x1.0000000000000p+0024, +0x1.0000000000000p+0025,
+0x1.0000000000000p+0026, +0x1.0000000000000p+0027,
+0x1.0000000000000p+0028, +0x1.0000000000000p+0029,
+0x1.0000000000000p+0030, +0x1.0000000000000p+0031,
+0x1.0000000000000p+0032, +0x1.0000000000000p+0033,
+0x1.0000000000000p+0034, +0x1.0000000000000p+0035,
+0x1.0000000000000p+0036, +0x1.0000000000000p+0037,
+0x1.0000000000000p+0038, +0x1.0000000000000p+0039,
+0x1.0000000000000p+0040, +0x1.0000000000000p+0041,
+0x1.0000000000000p+0042, +0x1.0000000000000p+0043,
+0x1.0000000000000p+0044, +0x1.0000000000000p+0045,
+0x1.0000000000000p+0046, +0x1.0000000000000p+0047,
+0x1.0000000000000p+0048, +0x1.0000000000000p+0049,
+0x1.0000000000000p+0050, +0x1.0000000000000p+0051,
+0x1.0000000000000p+0052, +0x1.0000000000000p+0053,
+0x1.0000000000000p+0054, +0x1.0000000000000p+0055,
+0x1.0000000000000p+0056, +0x1.0000000000000p+0057,
+0x1.0000000000000p+0058, +0x1.0000000000000p+0059,
+0x1.0000000000000p+0060, +0x1.0000000000000p+0061,
+0x1.0000000000000p+0062 };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = {
-0x1.0000000000000p+0063, -0x1.0000000000000p+0063,
+0x1.0000000000000p-0063, +0x1.0000000000000p-0063,
+0x1.0000000000000p-0062, +0x1.0000000000000p-0062,
+0x1.0000000000000p-0061, +0x1.0000000000000p-0061,
+0x1.0000000000000p-0060, +0x1.0000000000000p-0060,
+0x1.0000000000000p-0059, +0x1.0000000000000p-0059,
+0x1.0000000000000p-0058, +0x1.0000000000000p-0058,
+0x1.0000000000000p-0057, +0x1.0000000000000p-0057,
+0x1.0000000000000p-0056, +0x1.0000000000000p-0056,
+0x1.0000000000000p-0055, +0x1.0000000000000p-0055,
+0x1.0000000000000p-0054, +0x1.0000000000000p-0054,
+0x1.0000000000000p-0053, +0x1.0000000000000p-0053,
+0x1.0000000000000p-0052, +0x1.0000000000000p-0052,
+0x1.0000000000000p-0051, +0x1.0000000000000p-0051,
+0x1.0000000000000p-0050, +0x1.0000000000000p-0050,
+0x1.0000000000000p-0049, +0x1.0000000000000p-0049,
+0x1.0000000000000p-0048, +0x1.0000000000000p-0048,
+0x1.0000000000000p-0047, +0x1.0000000000000p-0047,
+0x1.0000000000000p-0046, +0x1.0000000000000p-0046,
+0x1.0000000000000p-0045, +0x1.0000000000000p-0045,
+0x1.0000000000000p-0044, +0x1.0000000000000p-0044,
+0x1.0000000000000p-0043, +0x1.0000000000000p-0043,
+0x1.0000000000000p-0042, +0x1.0000000000000p-0042,
+0x1.0000000000000p-0041, +0x1.0000000000000p-0041,
+0x1.0000000000000p-0040, +0x1.0000000000000p-0040,
+0x1.0000000000000p-0039, +0x1.0000000000000p-0039,
+0x1.0000000000000p-0038, +0x1.0000000000000p-0038,
+0x1.0000000000000p-0037, +0x1.0000000000000p-0037,
+0x1.0000000000000p-0036, +0x1.0000000000000p-0036,
+0x1.0000000000000p-0035, +0x1.0000000000000p-0035,
+0x1.0000000000000p-0034, +0x1.0000000000000p-0034,
+0x1.0000000000000p-0033, +0x1.0000000000000p-0033,
+0x1.0000000000000p-0032, +0x1.0000000000000p-0032,
+0x1.0000000000000p-0031, +0x1.0000000000000p-0031,
+0x1.0000000000000p-0030, +0x1.0000000000000p-0030,
+0x1.0000000000000p-0029, +0x1.0000000000000p-0029,
+0x1.0000000000000p-0028, +0x1.0000000000000p-0028,
+0x1.0000000000000p-0027, +0x1.0000000000000p-0027,
+0x1.0000000000000p-0026, +0x1.0000000000000p-0026,
+0x1.0000000000000p-0025, +0x1.0000000000000p-0025,
+0x1.0000000000000p-0024, +0x1.0000000000000p-0024,
+0x1.0000000000000p-0023, +0x1.0000000000000p-0023,
+0x1.0000000000000p-0022, +0x1.0000000000000p-0022,
+0x1.0000000000000p-0021, +0x1.0000000000000p-0021,
+0x1.0000000000000p-0020, +0x1.0000000000000p-0020,
+0x1.0000000000000p-0019, +0x1.0000000000000p-0019,
+0x1.0000000000000p-0018, +0x1.0000000000000p-0018,
+0x1.0000000000000p-0017, +0x1.0000000000000p-0017,
+0x1.0000000000000p-0016, +0x1.0000000000000p-0016,
+0x1.0000000000000p-0015, +0x1.0000000000000p-0015,
+0x1.0000000000000p-0014, +0x1.0000000000000p-0014,
+0x1.0000000000000p-0013, +0x1.0000000000000p-0013,
+0x1.0000000000000p-0012, +0x1.0000000000000p-0012,
+0x1.0000000000000p-0011, +0x1.0000000000000p-0011,
+0x1.0000000000000p-0010, +0x1.0000000000000p-0010,
+0x1.0000000000000p-0009, +0x1.0000000000000p-0009,
+0x1.0000000000000p-0008, +0x1.0000000000000p-0008,
+0x1.0000000000000p-0007, +0x1.0000000000000p-0007,
+0x1.0000000000000p-0006, +0x1.0000000000000p-0006,
+0x1.0000000000000p-0005, +0x1.0000000000000p-0005,
+0x1.0000000000000p-0004, +0x1.0000000000000p-0004,
+0x1.0000000000000p-0003, +0x1.0000000000000p-0003,
+0x1.0000000000000p-0002, +0x1.0000000000000p-0002,
+0x1.0000000000000p-0001, +0x1.0000000000000p-0001,
+0x1.0000000000000p+0000, +0x1.0000000000000p+0000,
+0x1.0000000000000p+0001, +0x1.0000000000000p+0001,
+0x1.0000000000000p+0002, +0x1.0000000000000p+0002,
+0x1.0000000000000p+0003, +0x1.0000000000000p+0003,
+0x1.0000000000000p+0004, +0x1.0000000000000p+0004,
+0x1.0000000000000p+0005, +0x1.0000000000000p+0005,
+0x1.0000000000000p+0006, +0x1.0000000000000p+0006,
+0x1.0000000000000p+0007, +0x1.0000000000000p+0007,
+0x1.0000000000000p+0008, +0x1.0000000000000p+0008,
+0x1.0000000000000p+0009, +0x1.0000000000000p+0009,
+0x1.0000000000000p+0010, +0x1.0000000000000p+0010,
+0x1.0000000000000p+0011, +0x1.0000000000000p+0011,
+0x1.0000000000000p+0012, +0x1.0000000000000p+0012,
+0x1.0000000000000p+0013, +0x1.0000000000000p+0013,
+0x1.0000000000000p+0014, +0x1.0000000000000p+0014,
+0x1.0000000000000p+0015, +0x1.0000000000000p+0015,
+0x1.0000000000000p+0016, +0x1.0000000000000p+0016,
+0x1.0000000000000p+0017, +0x1.0000000000000p+0017,
+0x1.0000000000000p+0018, +0x1.0000000000000p+0018,
+0x1.0000000000000p+0019, +0x1.0000000000000p+0019,
+0x1.0000000000000p+0020, +0x1.0000000000000p+0020,
+0x1.0000000000000p+0021, +0x1.0000000000000p+0021,
+0x1.0000000000000p+0022, +0x1.0000000000000p+0022,
+0x1.0000000000000p+0023, +0x1.0000000000000p+0023,
+0x1.0000000000000p+0024, +0x1.0000000000000p+0024,
+0x1.0000000000000p+0025, +0x1.0000000000000p+0025,
+0x1.0000000000000p+0026, +0x1.0000000000000p+0026,
+0x1.0000000000000p+0027, +0x1.0000000000000p+0027,
+0x1.0000000000000p+0028, +0x1.0000000000000p+0028,
+0x1.0000000000000p+0029, +0x1.0000000000000p+0029,
+0x1.0000000000000p+0030, +0x1.0000000000000p+0030,
+0x1.0000000000000p+0031, +0x1.0000000000000p+0031,
+0x1.0000000000000p+0032, +0x1.0000000000000p+0032,
+0x1.0000000000000p+0033, +0x1.0000000000000p+0033,
+0x1.0000000000000p+0034, +0x1.0000000000000p+0034,
+0x1.0000000000000p+0035, +0x1.0000000000000p+0035,
+0x1.0000000000000p+0036, +0x1.0000000000000p+0036,
+0x1.0000000000000p+0037, +0x1.0000000000000p+0037,
+0x1.0000000000000p+0038, +0x1.0000000000000p+0038,
+0x1.0000000000000p+0039, +0x1.0000000000000p+0039,
+0x1.0000000000000p+0040, +0x1.0000000000000p+0040,
+0x1.0000000000000p+0041, +0x1.0000000000000p+0041,
+0x1.0000000000000p+0042, +0x1.0000000000000p+0042,
+0x1.0000000000000p+0043, +0x1.0000000000000p+0043,
+0x1.0000000000000p+0044, +0x1.0000000000000p+0044,
+0x1.0000000000000p+0045, +0x1.0000000000000p+0045,
+0x1.0000000000000p+0046, +0x1.0000000000000p+0046,
+0x1.0000000000000p+0047, +0x1.0000000000000p+0047,
+0x1.0000000000000p+0048, +0x1.0000000000000p+0048,
+0x1.0000000000000p+0049, +0x1.0000000000000p+0049,
+0x1.0000000000000p+0050, +0x1.0000000000000p+0050,
+0x1.0000000000000p+0051, +0x1.0000000000000p+0051,
+0x1.0000000000000p+0052, +0x1.0000000000000p+0052,
+0x1.0000000000000p+0053, +0x1.0000000000000p+0053,
+0x1.0000000000000p+0054, +0x1.0000000000000p+0054,
+0x1.0000000000000p+0055, +0x1.0000000000000p+0055,
+0x1.0000000000000p+0056, +0x1.0000000000000p+0056,
+0x1.0000000000000p+0057, +0x1.0000000000000p+0057,
+0x1.0000000000000p+0058, +0x1.0000000000000p+0058,
+0x1.0000000000000p+0059, +0x1.0000000000000p+0059,
+0x1.0000000000000p+0060, +0x1.0000000000000p+0060,
+0x1.0000000000000p+0061, +0x1.0000000000000p+0061,
+0x1.0000000000000p+0062, +0x1.0000000000000p+0062
};
static constexpr std::array<double, degree+1> canonical_polys[] = {
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1,
0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0,
1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0
};
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_HAS_SINGLE_BIT_HPP__

View file

@ -0,0 +1,25 @@
/// @file grotto/gadgets/binary/prefix.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PREFIX_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PREFIX_HPP__
#include "gt.hpp"
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PREFIX_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/binary/sg.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_SGN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_SGN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sgn
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0;
else return std::signbit(static_cast<double>(x));
}
};
template <>
struct gadget_hints<sgn>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { 0, 0 };
static constexpr std::array<double, degree+1> canonical_polys[] = { -1, 0, 1 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_BINARY_SGN_HPP__

View file

@ -0,0 +1,16 @@
/// @file grotto/gadgets/decimal.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HPP__
#include "grotto/gadgets/decimal/dec_ceil.hpp"
#include "grotto/gadgets/decimal/dec_floor.hpp"
#include "grotto/gadgets/decimal/dec_width.hpp"
#include "grotto/gadgets/decimal/has_single_digit.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/decimal/dec_ceil.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_CEIL_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_CEIL_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_CEIL_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/decimal/dec_floor.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_FLOOR_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_FLOOR_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_FLOOR_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/decimal/dec_width.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_WIDTH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_WIDTH_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_DEC_WIDTH_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/decimal/has_single_digit.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HAS_SINGLE_DIGIT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HAS_SINGLE_DIGIT_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_DECIMAL_HAS_SINGLE_DIGIT_HPP__

View file

@ -0,0 +1,32 @@
/// @file grotto/gadgets/elementary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_HPP__
#include "grotto/gadgets/elementary/abs.hpp"
#include "grotto/gadgets/elementary/approx.hpp"
#include "grotto/gadgets/elementary/boxcar.hpp"
#include "grotto/gadgets/elementary/clip.hpp"
#include "grotto/gadgets/elementary/eq.hpp"
#include "grotto/gadgets/elementary/geq.hpp"
#include "grotto/gadgets/elementary/gt.hpp"
// #include "grotto/gadgets/elementary/identity.hpp"
#include "grotto/gadgets/elementary/leq.hpp"
#include "grotto/gadgets/elementary/lt.hpp"
#include "grotto/gadgets/elementary/negative.hpp"
#include "grotto/gadgets/elementary/neq.hpp"
#include "grotto/gadgets/elementary/nonnegative.hpp"
#include "grotto/gadgets/elementary/nonpositive.hpp"
// #include "grotto/gadgets/elementary/pmone.hpp"
#include "grotto/gadgets/elementary/positive.hpp"
#include "grotto/gadgets/elementary/rect.hpp"
#include "grotto/gadgets/elementary/step.hpp"
// #include "grotto/gadgets/elementary/ternary.hpp"
#include "grotto/gadgets/elementary/zero.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/elementary/abs.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ABS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ABS_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct abs
{
template <typename T>
T operator()(T x) { return std::abs(static_cast<double>(x)); }
};
template <>
struct gadget_hints<abs>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 1;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { 0 };
static constexpr std::array<double, degree+1> canonical_polys[] = { { -1, 0 }, { 1, 0 } };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ABS_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/elementary/approx.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_APPROX_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_APPROX_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double approx_default_target = 0;
static constexpr unsigned approx_default_ULPs = 1;
template <double const & target = approx_default_target,
unsigned const & ULPs = approx_default_ULPs>
struct approx
{
template <typename T>
T operator()(T x) { return std::abs(x - target) <= ULPs * ulp_of(target) ? 1 : 0; }
};
template <double const & target,
unsigned const & ULPs>
struct gadget_hints<approx<target, ULPs>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr bool has_canonical_representation = true;
static constexpr double interesting_points[] = { target - ULPs * ulp_of(target), target + ULPs * ulp_of(target) };
static constexpr double canonical_bounds[] = { target - ULPs * ulp_of(target), target + ULPs * ulp_of(target), target + ULPs * ulp_of(target) };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, 1, 1, 0 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_APPROX_HPP__

View file

@ -0,0 +1,56 @@
/// @file grotto/gadgets/elementary/boxcar.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_BOXCAR_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_BOXCAR_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double boxcar_default_outside = 0;
static constexpr double boxcar_default_inside = 1;
template <double const & from,
double const & to,
double const & outside = boxcar_default_outside,
double const & inside = boxcar_default_inside>
struct boxcar
{
template <typename T>
T operator()(T x) { return (x < from || x > to) ? outside : inside; }
};
template <double const & from,
double const & to,
double const & outside,
double const & inside>
struct gadget_hints<boxcar<from, to, inside, outside>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr bool has_canonical_representation = true;
static constexpr double interesting_points[] = { from, to };
static constexpr double canonical_bounds[] = { from, to };
static constexpr std::array<double, degree+1> canonical_polys[] = { outside, inside, outside };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_BOXCAR_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/elemwntary/clip.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_CLIP_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_CLIP_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & lower,
double const & upper>
struct clip
{
static_assert(lower <= upper);
template <typename T>
T operator()(T x) { return std::max(std::min(x, upper), lower); }
};
template <double const & lower,
double const & upper>
struct gadget_hints<clip<lower, upper>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 1;
static constexpr double poles[] = { };
static constexpr bool has_canonical_representation = true;
static constexpr double interesting_points[] = { lower, upper };
static constexpr double canonical_bounds[] = { lower, upper };
static constexpr std::array<double, degree+1> canonical_polys[] = { { lower, 0 }, { 0, 1 }, { upper, 0 } };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_CLIP_HPP__

View file

@ -0,0 +1,47 @@
/// @file grotto/gadgets/elementary/eq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_EQ_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_EQ_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct eq
{
template <typename T>
T operator()(T x) { return x == target; }
};
template <double const & target>
struct gadget_hints<eq<target>>
{
static constexpr double min = std::numeric_limits<double>::lowest();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { target };
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, 1, 0 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_EQ_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/elementary/geq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GEQ_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GEQ_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct geq
{
template <typename T>
T operator()(T x) { return x >= target; }
};
template <double const & target>
struct gadget_hints<geq<target>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { target };
static constexpr bool has_canonical_representation = true;
static constexpr unsigned degree = 0;
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, 1, 1 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GEQ_HPP__

View file

@ -0,0 +1,47 @@
/// @file grotto/gadgets/elementary/gt.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GT_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct gt
{
template <typename T>
T operator()(T x) { return x > target; }
};
template <double const & target>
struct gadget_hints<gt<target>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { target };
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, 0, 1 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_GT_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/elementary/identity.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_IDENTITY_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_IDENTITY_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_IDENTITY_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/elementary/leqw.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LEQ_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LEQ_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct leq
{
template <typename T>
T operator()(T x) { return x <= target; }
};
template <double const & target>
struct gadget_hints<leq<target>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { target };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 1, 1, 0 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LEQ_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/elementary/lt.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LT_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct lt
{
template <typename T>
T operator()(T x) { return x < target; }
};
template <double const & target>
struct gadget_hints<lt<target>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { target };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 1, 0, 0 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_LT_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/negative.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEGATIVE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEGATIVE_HPP__
#include "lt.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double lt_target_zero = 0;
using negative = lt<lt_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEGATIVE_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/elementary/neq.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEQ_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEQ_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
template <double const & target>
struct neq
{
template <typename T>
T operator()(T x) { return x != target; }
};
template <double const & target>
struct gadget_hints<neq<target>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr bool has_canonical_representation = true;
static constexpr double interesting_points[] = { target };
static constexpr double canonical_bounds[] = { target, target };
static constexpr std::array<double, degree+1> canonical_polys[] = { 1, 0, 1 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NEQ_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/nonnegative.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONNEGATIVE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONNEGATIVE_HPP__
#include "geq.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double geq_target_zero = 0;
using nonnegative = geq<geq_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONNEGATIVE_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/nonpositive.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONPOSITIVE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONPOSITIVE_HPP__
#include "leq.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double leq_target_zero = 0;
using nonpositive = leq<leq_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONPOSITIVE_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/nonzero.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONZERO_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONZERO_HPP__
#include "neq.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double neq_target_zero = 0;
using nonzero = neq<neq_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_NONZERO_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/elementary/pmone.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PMONE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PMONE_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_PMONE_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/positive.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_POSITIVE_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_POSITIVE_HPP__
#include "gt.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double gt_target_zero = 0;
using positive = gt<gt_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_POSITIVE_HPP__

View file

@ -0,0 +1,45 @@
/// @file grotto/gadgets/elementary/rect.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_RECT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_RECT_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct rect
{
template <typename T>
T operator()(T x) { return x == 0; }
};
template <>
struct gadget_hints<rect>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { -0.5, 0.5 };
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { -0.5, -0.5, 0.5, 0.5 };
static constexpr std::array<double, degree+1> canonical_polys[] = { 0, 0.5, 1, 0.50, 0 };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_RECT_HPP__

View file

@ -0,0 +1,54 @@
/// @file grotto/gadgets/elementary/step.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_STEP_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_STEP_HPP__
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double step_default_before = 0;
static constexpr double step_default_after = 1;
template <double const & at,
double const & before = step_default_before,
double const & after = step_default_after>
struct step
{
template <typename T>
T operator()(T x) { return x < at ? before : after; }
};
template <double const & at,
double const & before,
double const & after>
struct gadget_hints<step<at, before, after>>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr unsigned degree = 0;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { at };
static constexpr bool has_canonical_representation = true;
static constexpr double canonical_bounds[] = { at };
static constexpr std::array<double, degree+1> canonical_polys[] = { before, after };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_STEP_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/elementary/ternary.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_TERNARY_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_TERNARY_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_TERNARY_HPP__

View file

@ -0,0 +1,26 @@
/// @file grotto/gadgets/elementary/zero.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ZERO_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ZERO_HPP__
#include "eq.hpp"
namespace grotto
{
namespace gadgets
{
static constexpr double eq_target_zero = 0;
using zero = eq<eq_target_zero>;
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_ELEMENTARY_ZERO_HPP__

View file

@ -0,0 +1,15 @@
/// @file grotto/gadgets/exponential.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_HPP__
#include "grotto/gadgets/exponential/exp.hpp"
#include "grotto/gadgets/exponential/exp2.hpp"
#include "grotto/gadgets/exponential/exp10.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/exponential/exp.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::exp`
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct exp
{
template <typename T>
T operator()(T x) { return std::min(std::exp(static_cast<double>(x)), std::numeric_limits<T>::max()); }
};
template <>
struct gadget_hints<exp>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double * poles = nullptr;
static constexpr double * interesting_points = nullptr;
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double * canonical_bounds = nullptr;
static constexpr std::array<double, degree+1> * canonical_polys = nullptr;
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/exponential/exp10.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::exp10`
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP10_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP10_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct exp10
{
template <typename T>
T operator()(T x) { return std::min(std::pow(10, static_cast<double>(x)), std::numeric_limits<T>::max()); }
};
template <>
struct gadget_hints<exp10>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double * poles = nullptr;
static constexpr double * interesting_points = nullptr;
static constexpr unsigned degree = 3;
static constexpr bool canonical_representation = false;
static constexpr double * canonical_bounds = nullptr;
static constexpr std::array<double, degree+1> * hint_canonical_polys = nullptr;
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP10_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/exponential/exp2.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief gadgetized form of `std::exp2`
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP2_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP2_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct exp2
{
template <typename T>
T operator()(T x) { return std::min(std::exp2(static_cast<double>(x)), std::numeric_limits<T>::max()); }
};
template <>
struct gadget_hints<exp2>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double * poles = nullptr;
static constexpr double * interesting_points = nullptr;
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double * canonical_bounds = nullptr;
static constexpr std::array<double, degree+1> * canonical_polys = nullptr;
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_EXPONENTIAL_EXP2_HPP__

View file

@ -0,0 +1,24 @@
/// @file grotto/gadgets/hyperbolic.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_HPP__
#include "grotto/gadgets/hyperbolic/acosh.hpp"
#include "grotto/gadgets/hyperbolic/acoth.hpp"
#include "grotto/gadgets/hyperbolic/acsch.hpp"
#include "grotto/gadgets/hyperbolic/asech.hpp"
#include "grotto/gadgets/hyperbolic/asinh.hpp"
#include "grotto/gadgets/hyperbolic/atanh.hpp"
#include "grotto/gadgets/hyperbolic/cosh.hpp"
#include "grotto/gadgets/hyperbolic/coth.hpp"
#include "grotto/gadgets/hyperbolic/csch.hpp"
#include "grotto/gadgets/hyperbolic/sech.hpp"
#include "grotto/gadgets/hyperbolic/sinh.hpp"
#include "grotto/gadgets/hyperbolic/tanh.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/hyperbolic/acosh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOSH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOSH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
// Returns the inverse hyperbolic cosine of a number.
// The number must be greater than or equal to 1.
struct acosh
{
template <typename T>
T operator()(T x) {
if (x < 1) return -1; // TODO
return std::acosh(static_cast<double>(x)); }
};
template <>
struct gadget_hints<acosh>
{
static constexpr double min = 1;
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOSH_HPP__

View file

@ -0,0 +1,48 @@
/// @file grotto/gadgets/hyperbolic/acoth.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOTH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOTH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct acoth
{
template <typename T>
T operator()(T x) {
if (std::abs(x) <= 1) return 0; // TODO
return std::atanh(1 / static_cast<double>(x)); }
};
template <>
struct gadget_hints<acoth>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { -1, 1 };
static constexpr double interesting_points[] = { -1, 1 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACOTH_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/hyperbolic/acsch.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACSCH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACSCH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct acsch
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0; // TODO
if (x < 0) return std::max(std::asinh(1/static_cast<double>(x)), std::numeric_limits<T>::min());
if (x > 0) return std::min(std::asinh(1/static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<acsch>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ACSCH_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/hyperbolic/asech.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASECH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASECH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct asech
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
if (x > 1) return 0; // TODO
return std::acosh(1/static_cast<double>(x));
}
};
template <>
struct gadget_hints<asech>
{
static constexpr double min = 0;
static constexpr double max = 1;
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASECH_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/hyperbolic/asinh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASINH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASINH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct asinh
{
template <typename T>
T operator()(T x) { return std::asinh(static_cast<double>(x)); }
};
template <>
struct gadget_hints<asinh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ASINH_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/hyperbolic/atanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ATANH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ATANH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct atanh
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= 1) return 0;
return std::atanh(static_cast<double>(x));
}
};
template <>
struct gadget_hints<atanh>
{
static constexpr double min = -1;
static constexpr double max = 1;
static constexpr double poles[] = { -1, 1 };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_ATANH_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/hyperbolic/cosh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COSH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COSH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct cosh
{
template <typename T>
T operator()(T x) { return std::min(std::cosh(static_cast<double>(x)), std::numeric_limits<T>::max()); }
};
template <>
struct gadget_hints<cosh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COSH_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/hyperbolic/coth.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COTH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COTH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct coth
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0;
if (x < 0) return std::max(std::cosh(static_cast<double>(x))/std::sinh(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x > 0) return std::min(std::cosh(static_cast<double>(x))/std::sinh(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<coth>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_COTH_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/hyperbolic/csch.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_CSCH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_CSCH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct csch
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0;
if (x < 0) return std::max(1/std::sinh(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x > 0) return std::min(1/std::sinh(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<csch>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_CSCH_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/hyperbolic/sech.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SECH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SECH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sech
{
template <typename T>
T operator()(T x) { return 1/std::cosh(static_cast<double>(x)); }
};
template <>
struct gadget_hints<sech>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SECH_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/hyperbolic/sinh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SINH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SINH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sinh
{
template <typename T>
T operator()(T x)
{
if (x < 0) return std::max(std::sinh(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x >= 0) return std::min(std::sinh(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<sinh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_SINH_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/hyperbolic/tanh.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_TANH_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_TANH_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct tanh
{
template <typename T>
T operator()(T x) { return std::tanh(static_cast<double>(x)); }
};
template <>
struct gadget_hints<tanh>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_HYPERBOLIC_TANH_HPP__

View file

@ -0,0 +1,21 @@
/// @file grotto/gadgets/logarithm.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_HPP__
// #include "grotto/gadgets/logarithm/ilog10.hpp"
#include "grotto/gadgets/logarithm/ilogb.hpp"
// #include "grotto/gadgets/logarithm/ilog16.hpp"
// #include "grotto/gadgets/logarithm/ilog256.hpp"
#include "grotto/gadgets/logarithm/lg.hpp"
#include "grotto/gadgets/logarithm/ln.hpp"
#include "grotto/gadgets/logarithm/log10.hpp"
// #include "grotto/gadgets/logarithm/logn.hpp"
// #include "grotto/gadgets/logarithm/logstar.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/ilog10.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG10_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG10_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct ilog256
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::ceil(std::log2(static_cast(x))/8);
}
};
template <>
struct gadget_hints<ilog256>
{
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 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[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG10_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/ilog16.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG16_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG16_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct ilog16
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::ceil(std::log2(static_cast(x))/4);
}
};
template <>
struct gadget_hints<ilog16>
{
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 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[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG16_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/ilog256.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG256_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG256_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct ilog256
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::ceil(std::log2(static_cast(x))/8);
}
};
template <>
struct gadget_hints<ilog256>
{
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 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[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOG256_HPP__

View file

@ -0,0 +1,307 @@
/// @file grotto/gadgets/logarithm/ilogb.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOGB_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOGB_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct ilogb
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::ilogb(static_cast<double>(x));
}
};
template <>
struct gadget_hints<grotto::gadgets::ilogb>
{
static constexpr double min = std::exp2(-63);
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 0;
static constexpr bool has_canonical_representation = true;
static constexpr std::array<double, 508> canonical_bounds = {
-0x1.0000000000000p+0063, -0x1.0000000000000p+0063,
-0x1.0000000000000p+0062, -0x1.0000000000000p+0062,
-0x1.0000000000000p+0061, -0x1.0000000000000p+0061,
-0x1.0000000000000p+0060, -0x1.0000000000000p+0060,
-0x1.0000000000000p+0059, -0x1.0000000000000p+0059,
-0x1.0000000000000p+0058, -0x1.0000000000000p+0058,
-0x1.0000000000000p+0057, -0x1.0000000000000p+0057,
-0x1.0000000000000p+0056, -0x1.0000000000000p+0056,
-0x1.0000000000000p+0055, -0x1.0000000000000p+0055,
-0x1.0000000000000p+0054, -0x1.0000000000000p+0054,
-0x1.0000000000000p+0053, -0x1.0000000000000p+0053,
-0x1.0000000000000p+0052, -0x1.0000000000000p+0052,
-0x1.0000000000000p+0051, -0x1.0000000000000p+0051,
-0x1.0000000000000p+0050, -0x1.0000000000000p+0050,
-0x1.0000000000000p+0049, -0x1.0000000000000p+0049,
-0x1.0000000000000p+0048, -0x1.0000000000000p+0048,
-0x1.0000000000000p+0047, -0x1.0000000000000p+0047,
-0x1.0000000000000p+0046, -0x1.0000000000000p+0046,
-0x1.0000000000000p+0045, -0x1.0000000000000p+0045,
-0x1.0000000000000p+0044, -0x1.0000000000000p+0044,
-0x1.0000000000000p+0043, -0x1.0000000000000p+0043,
-0x1.0000000000000p+0042, -0x1.0000000000000p+0042,
-0x1.0000000000000p+0041, -0x1.0000000000000p+0041,
-0x1.0000000000000p+0040, -0x1.0000000000000p+0040,
-0x1.0000000000000p+0039, -0x1.0000000000000p+0039,
-0x1.0000000000000p+0038, -0x1.0000000000000p+0038,
-0x1.0000000000000p+0037, -0x1.0000000000000p+0037,
-0x1.0000000000000p+0036, -0x1.0000000000000p+0036,
-0x1.0000000000000p+0035, -0x1.0000000000000p+0035,
-0x1.0000000000000p+0034, -0x1.0000000000000p+0034,
-0x1.0000000000000p+0033, -0x1.0000000000000p+0033,
-0x1.0000000000000p+0032, -0x1.0000000000000p+0032,
-0x1.0000000000000p+0031, -0x1.0000000000000p+0031,
-0x1.0000000000000p+0030, -0x1.0000000000000p+0030,
-0x1.0000000000000p+0029, -0x1.0000000000000p+0029,
-0x1.0000000000000p+0028, -0x1.0000000000000p+0028,
-0x1.0000000000000p+0027, -0x1.0000000000000p+0027,
-0x1.0000000000000p+0026, -0x1.0000000000000p+0026,
-0x1.0000000000000p+0025, -0x1.0000000000000p+0025,
-0x1.0000000000000p+0024, -0x1.0000000000000p+0024,
-0x1.0000000000000p+0023, -0x1.0000000000000p+0023,
-0x1.0000000000000p+0022, -0x1.0000000000000p+0022,
-0x1.0000000000000p+0021, -0x1.0000000000000p+0021,
-0x1.0000000000000p+0020, -0x1.0000000000000p+0020,
-0x1.0000000000000p+0019, -0x1.0000000000000p+0019,
-0x1.0000000000000p+0018, -0x1.0000000000000p+0018,
-0x1.0000000000000p+0017, -0x1.0000000000000p+0017,
-0x1.0000000000000p+0016, -0x1.0000000000000p+0016,
-0x1.0000000000000p+0015, -0x1.0000000000000p+0015,
-0x1.0000000000000p+0014, -0x1.0000000000000p+0014,
-0x1.0000000000000p+0013, -0x1.0000000000000p+0013,
-0x1.0000000000000p+0012, -0x1.0000000000000p+0012,
-0x1.0000000000000p+0011, -0x1.0000000000000p+0011,
-0x1.0000000000000p+0010, -0x1.0000000000000p+0010,
-0x1.0000000000000p+0009, -0x1.0000000000000p+0009,
-0x1.0000000000000p+0008, -0x1.0000000000000p+0008,
-0x1.0000000000000p+0007, -0x1.0000000000000p+0007,
-0x1.0000000000000p+0006, -0x1.0000000000000p+0006,
-0x1.0000000000000p+0005, -0x1.0000000000000p+0005,
-0x1.0000000000000p+0004, -0x1.0000000000000p+0004,
-0x1.0000000000000p+0003, -0x1.0000000000000p+0003,
-0x1.0000000000000p+0002, -0x1.0000000000000p+0002,
-0x1.0000000000000p+0001, -0x1.0000000000000p+0001,
-0x1.0000000000000p+0000, -0x1.0000000000000p+0000,
-0x1.0000000000000p-0001, -0x1.0000000000000p-0001,
-0x1.0000000000000p-0002, -0x1.0000000000000p-0002,
-0x1.0000000000000p-0003, -0x1.0000000000000p-0003,
-0x1.0000000000000p-0004, -0x1.0000000000000p-0004,
-0x1.0000000000000p-0005, -0x1.0000000000000p-0005,
-0x1.0000000000000p-0006, -0x1.0000000000000p-0006,
-0x1.0000000000000p-0007, -0x1.0000000000000p-0007,
-0x1.0000000000000p-0008, -0x1.0000000000000p-0008,
-0x1.0000000000000p-0009, -0x1.0000000000000p-0009,
-0x1.0000000000000p-0010, -0x1.0000000000000p-0010,
-0x1.0000000000000p-0011, -0x1.0000000000000p-0011,
-0x1.0000000000000p-0012, -0x1.0000000000000p-0012,
-0x1.0000000000000p-0013, -0x1.0000000000000p-0013,
-0x1.0000000000000p-0014, -0x1.0000000000000p-0014,
-0x1.0000000000000p-0015, -0x1.0000000000000p-0015,
-0x1.0000000000000p-0016, -0x1.0000000000000p-0016,
-0x1.0000000000000p-0017, -0x1.0000000000000p-0017,
-0x1.0000000000000p-0018, -0x1.0000000000000p-0018,
-0x1.0000000000000p-0019, -0x1.0000000000000p-0019,
-0x1.0000000000000p-0020, -0x1.0000000000000p-0020,
-0x1.0000000000000p-0021, -0x1.0000000000000p-0021,
-0x1.0000000000000p-0022, -0x1.0000000000000p-0022,
-0x1.0000000000000p-0023, -0x1.0000000000000p-0023,
-0x1.0000000000000p-0024, -0x1.0000000000000p-0024,
-0x1.0000000000000p-0025, -0x1.0000000000000p-0025,
-0x1.0000000000000p-0026, -0x1.0000000000000p-0026,
-0x1.0000000000000p-0027, -0x1.0000000000000p-0027,
-0x1.0000000000000p-0028, -0x1.0000000000000p-0028,
-0x1.0000000000000p-0029, -0x1.0000000000000p-0029,
-0x1.0000000000000p-0030, -0x1.0000000000000p-0030,
-0x1.0000000000000p-0031, -0x1.0000000000000p-0031,
-0x1.0000000000000p-0032, -0x1.0000000000000p-0032,
-0x1.0000000000000p-0033, -0x1.0000000000000p-0033,
-0x1.0000000000000p-0034, -0x1.0000000000000p-0034,
-0x1.0000000000000p-0035, -0x1.0000000000000p-0035,
-0x1.0000000000000p-0036, -0x1.0000000000000p-0036,
-0x1.0000000000000p-0037, -0x1.0000000000000p-0037,
-0x1.0000000000000p-0038, -0x1.0000000000000p-0038,
-0x1.0000000000000p-0039, -0x1.0000000000000p-0039,
-0x1.0000000000000p-0040, -0x1.0000000000000p-0040,
-0x1.0000000000000p-0041, -0x1.0000000000000p-0041,
-0x1.0000000000000p-0042, -0x1.0000000000000p-0042,
-0x1.0000000000000p-0043, -0x1.0000000000000p-0043,
-0x1.0000000000000p-0044, -0x1.0000000000000p-0044,
-0x1.0000000000000p-0045, -0x1.0000000000000p-0045,
-0x1.0000000000000p-0046, -0x1.0000000000000p-0046,
-0x1.0000000000000p-0047, -0x1.0000000000000p-0047,
-0x1.0000000000000p-0048, -0x1.0000000000000p-0048,
-0x1.0000000000000p-0049, -0x1.0000000000000p-0049,
-0x1.0000000000000p-0050, -0x1.0000000000000p-0050,
-0x1.0000000000000p-0051, -0x1.0000000000000p-0051,
-0x1.0000000000000p-0052, -0x1.0000000000000p-0052,
-0x1.0000000000000p-0053, -0x1.0000000000000p-0053,
-0x1.0000000000000p-0054, -0x1.0000000000000p-0054,
-0x1.0000000000000p-0055, -0x1.0000000000000p-0055,
-0x1.0000000000000p-0056, -0x1.0000000000000p-0056,
-0x1.0000000000000p-0057, -0x1.0000000000000p-0057,
-0x1.0000000000000p-0058, -0x1.0000000000000p-0058,
-0x1.0000000000000p-0059, -0x1.0000000000000p-0059,
-0x1.0000000000000p-0060, -0x1.0000000000000p-0060,
-0x1.0000000000000p-0061, -0x1.0000000000000p-0061,
-0x1.0000000000000p-0062, -0x1.0000000000000p-0062,
-0x1.0000000000000p-0063, -0x1.0000000000000p-0063,
+0x0.0000000000000p+0000, +0x0.0000000000000p+0000,
+0x1.0000000000000p-0063, +0x1.0000000000000p-0063,
+0x1.0000000000000p-0062, +0x1.0000000000000p-0062,
+0x1.0000000000000p-0061, +0x1.0000000000000p-0061,
+0x1.0000000000000p-0060, +0x1.0000000000000p-0060,
+0x1.0000000000000p-0059, +0x1.0000000000000p-0059,
+0x1.0000000000000p-0058, +0x1.0000000000000p-0058,
+0x1.0000000000000p-0057, +0x1.0000000000000p-0057,
+0x1.0000000000000p-0056, +0x1.0000000000000p-0056,
+0x1.0000000000000p-0055, +0x1.0000000000000p-0055,
+0x1.0000000000000p-0054, +0x1.0000000000000p-0054,
+0x1.0000000000000p-0053, +0x1.0000000000000p-0053,
+0x1.0000000000000p-0052, +0x1.0000000000000p-0052,
+0x1.0000000000000p-0051, +0x1.0000000000000p-0051,
+0x1.0000000000000p-0050, +0x1.0000000000000p-0050,
+0x1.0000000000000p-0049, +0x1.0000000000000p-0049,
+0x1.0000000000000p-0048, +0x1.0000000000000p-0048,
+0x1.0000000000000p-0047, +0x1.0000000000000p-0047,
+0x1.0000000000000p-0046, +0x1.0000000000000p-0046,
+0x1.0000000000000p-0045, +0x1.0000000000000p-0045,
+0x1.0000000000000p-0044, +0x1.0000000000000p-0044,
+0x1.0000000000000p-0043, +0x1.0000000000000p-0043,
+0x1.0000000000000p-0042, +0x1.0000000000000p-0042,
+0x1.0000000000000p-0041, +0x1.0000000000000p-0041,
+0x1.0000000000000p-0040, +0x1.0000000000000p-0040,
+0x1.0000000000000p-0039, +0x1.0000000000000p-0039,
+0x1.0000000000000p-0038, +0x1.0000000000000p-0038,
+0x1.0000000000000p-0037, +0x1.0000000000000p-0037,
+0x1.0000000000000p-0036, +0x1.0000000000000p-0036,
+0x1.0000000000000p-0035, +0x1.0000000000000p-0035,
+0x1.0000000000000p-0034, +0x1.0000000000000p-0034,
+0x1.0000000000000p-0033, +0x1.0000000000000p-0033,
+0x1.0000000000000p-0032, +0x1.0000000000000p-0032,
+0x1.0000000000000p-0031, +0x1.0000000000000p-0031,
+0x1.0000000000000p-0030, +0x1.0000000000000p-0030,
+0x1.0000000000000p-0029, +0x1.0000000000000p-0029,
+0x1.0000000000000p-0028, +0x1.0000000000000p-0028,
+0x1.0000000000000p-0027, +0x1.0000000000000p-0027,
+0x1.0000000000000p-0026, +0x1.0000000000000p-0026,
+0x1.0000000000000p-0025, +0x1.0000000000000p-0025,
+0x1.0000000000000p-0024, +0x1.0000000000000p-0024,
+0x1.0000000000000p-0023, +0x1.0000000000000p-0023,
+0x1.0000000000000p-0022, +0x1.0000000000000p-0022,
+0x1.0000000000000p-0021, +0x1.0000000000000p-0021,
+0x1.0000000000000p-0020, +0x1.0000000000000p-0020,
+0x1.0000000000000p-0019, +0x1.0000000000000p-0019,
+0x1.0000000000000p-0018, +0x1.0000000000000p-0018,
+0x1.0000000000000p-0017, +0x1.0000000000000p-0017,
+0x1.0000000000000p-0016, +0x1.0000000000000p-0016,
+0x1.0000000000000p-0015, +0x1.0000000000000p-0015,
+0x1.0000000000000p-0014, +0x1.0000000000000p-0014,
+0x1.0000000000000p-0013, +0x1.0000000000000p-0013,
+0x1.0000000000000p-0012, +0x1.0000000000000p-0012,
+0x1.0000000000000p-0011, +0x1.0000000000000p-0011,
+0x1.0000000000000p-0010, +0x1.0000000000000p-0010,
+0x1.0000000000000p-0009, +0x1.0000000000000p-0009,
+0x1.0000000000000p-0008, +0x1.0000000000000p-0008,
+0x1.0000000000000p-0007, +0x1.0000000000000p-0007,
+0x1.0000000000000p-0006, +0x1.0000000000000p-0006,
+0x1.0000000000000p-0005, +0x1.0000000000000p-0005,
+0x1.0000000000000p-0004, +0x1.0000000000000p-0004,
+0x1.0000000000000p-0003, +0x1.0000000000000p-0003,
+0x1.0000000000000p-0002, +0x1.0000000000000p-0002,
+0x1.0000000000000p-0001, +0x1.0000000000000p-0001,
+0x1.0000000000000p+0000, +0x1.0000000000000p+0000,
+0x1.0000000000000p+0001, +0x1.0000000000000p+0001,
+0x1.0000000000000p+0002, +0x1.0000000000000p+0002,
+0x1.0000000000000p+0003, +0x1.0000000000000p+0003,
+0x1.0000000000000p+0004, +0x1.0000000000000p+0004,
+0x1.0000000000000p+0005, +0x1.0000000000000p+0005,
+0x1.0000000000000p+0006, +0x1.0000000000000p+0006,
+0x1.0000000000000p+0007, +0x1.0000000000000p+0007,
+0x1.0000000000000p+0008, +0x1.0000000000000p+0008,
+0x1.0000000000000p+0009, +0x1.0000000000000p+0009,
+0x1.0000000000000p+0010, +0x1.0000000000000p+0010,
+0x1.0000000000000p+0011, +0x1.0000000000000p+0011,
+0x1.0000000000000p+0012, +0x1.0000000000000p+0012,
+0x1.0000000000000p+0013, +0x1.0000000000000p+0013,
+0x1.0000000000000p+0014, +0x1.0000000000000p+0014,
+0x1.0000000000000p+0015, +0x1.0000000000000p+0015,
+0x1.0000000000000p+0016, +0x1.0000000000000p+0016,
+0x1.0000000000000p+0017, +0x1.0000000000000p+0017,
+0x1.0000000000000p+0018, +0x1.0000000000000p+0018,
+0x1.0000000000000p+0019, +0x1.0000000000000p+0019,
+0x1.0000000000000p+0020, +0x1.0000000000000p+0020,
+0x1.0000000000000p+0021, +0x1.0000000000000p+0021,
+0x1.0000000000000p+0022, +0x1.0000000000000p+0022,
+0x1.0000000000000p+0023, +0x1.0000000000000p+0023,
+0x1.0000000000000p+0024, +0x1.0000000000000p+0024,
+0x1.0000000000000p+0025, +0x1.0000000000000p+0025,
+0x1.0000000000000p+0026, +0x1.0000000000000p+0026,
+0x1.0000000000000p+0027, +0x1.0000000000000p+0027,
+0x1.0000000000000p+0028, +0x1.0000000000000p+0028,
+0x1.0000000000000p+0029, +0x1.0000000000000p+0029,
+0x1.0000000000000p+0030, +0x1.0000000000000p+0030,
+0x1.0000000000000p+0031, +0x1.0000000000000p+0031,
+0x1.0000000000000p+0032, +0x1.0000000000000p+0032,
+0x1.0000000000000p+0033, +0x1.0000000000000p+0033,
+0x1.0000000000000p+0034, +0x1.0000000000000p+0034,
+0x1.0000000000000p+0035, +0x1.0000000000000p+0035,
+0x1.0000000000000p+0036, +0x1.0000000000000p+0036,
+0x1.0000000000000p+0037, +0x1.0000000000000p+0037,
+0x1.0000000000000p+0038, +0x1.0000000000000p+0038,
+0x1.0000000000000p+0039, +0x1.0000000000000p+0039,
+0x1.0000000000000p+0040, +0x1.0000000000000p+0040,
+0x1.0000000000000p+0041, +0x1.0000000000000p+0041,
+0x1.0000000000000p+0042, +0x1.0000000000000p+0042,
+0x1.0000000000000p+0043, +0x1.0000000000000p+0043,
+0x1.0000000000000p+0044, +0x1.0000000000000p+0044,
+0x1.0000000000000p+0045, +0x1.0000000000000p+0045,
+0x1.0000000000000p+0046, +0x1.0000000000000p+0046,
+0x1.0000000000000p+0047, +0x1.0000000000000p+0047,
+0x1.0000000000000p+0048, +0x1.0000000000000p+0048,
+0x1.0000000000000p+0049, +0x1.0000000000000p+0049,
+0x1.0000000000000p+0050, +0x1.0000000000000p+0050,
+0x1.0000000000000p+0051, +0x1.0000000000000p+0051,
+0x1.0000000000000p+0052, +0x1.0000000000000p+0052,
+0x1.0000000000000p+0053, +0x1.0000000000000p+0053,
+0x1.0000000000000p+0054, +0x1.0000000000000p+0054,
+0x1.0000000000000p+0055, +0x1.0000000000000p+0055,
+0x1.0000000000000p+0056, +0x1.0000000000000p+0056,
+0x1.0000000000000p+0057, +0x1.0000000000000p+0057,
+0x1.0000000000000p+0058, +0x1.0000000000000p+0058,
+0x1.0000000000000p+0059, +0x1.0000000000000p+0059,
+0x1.0000000000000p+0060, +0x1.0000000000000p+0060,
+0x1.0000000000000p+0061, +0x1.0000000000000p+0061,
+0x1.0000000000000p+0062, +0x1.0000000000000p+0062
};
static constexpr std::array<std::array<double, degree+1>, 510> canonical_polys = {
63, 63, 62, 62, 61, 61, 60, 60, 59, 59, 58, 58, 57, 57, 56, 56, 55, 55, 54, 54, 53, 53, 52, 52, 51, 51, 50, 50, 49, 49, 48, 48, 47, 47, 46, 46, 45, 45, 44, 44, 43, 43, 42, 42, 41, 41, 40, 40, 39, 39, 38, 38, 37, 37, 36, 36, 35, 35, 34, 34, 33, 33, 32, 32, 31, 31, 30, 30, 29, 29, 28, 28, 27, 27, 26, 26, 25, 25, 24, 24, 23, 23, 22, 22, 21, 21, 20, 20, 19, 19, 18, 18, 17, 17, 16, 16, 15, 15, 14, 14, 13, 13, 12, 12, 11, 11, 10, 10, 9, 9, 8, 8, 7, 7, 6, 6, 5, 5, 4, 4, 3, 3, 2, 2, 1, 1, 0, 0, -1, -1, -2, -2, -3, -3, -4, -4, -5, -5, -6, -6, -7, -7, -8, -8, -9, -9, -10, -10, -11, -11, -12, -12, -13, -13, -14, -14, -15, -15, -16, -16, -17, -17, -18, -18, -19, -19, -20, -20, -21, -21, -22, -22, -23, -23, -24, -24, -25, -25, -26, -26, -27, -27, -28, -28, -29, -29, -30, -30, -31, -31, -32, -32, -33, -33, -34, -34, -35, -35, -36, -36, -37, -37, -38, -38, -39, -39, -40, -40, -41, -41, -42, -42, -43, -43, -44, -44, -45, -45, -46, -46, -47, -47, -48, -48, -49, -49, -50, -50, -51, -51, -52, -52, -53, -53, -54, -54, -55, -55, -56, -56, -57, -57, -58, -58, -59, -59, -60, -60, -61, -61, -62, -62, -63, -63, -64, -64, -63, -63, -62, -62, -61, -61, -60, -60, -59, -59, -58, -58, -57, -57, -56, -56, -55, -55, -54, -54, -53, -53, -52, -52, -51, -51, -50, -50, -49, -49, -48, -48, -47, -47, -46, -46, -45, -45, -44, -44, -43, -43, -42, -42, -41, -41, -40, -40, -39, -39, -38, -38, -37, -37, -36, -36, -35, -35, -34, -34, -33, -33, -32, -32, -31, -31, -30, -30, -29, -29, -28, -28, -27, -27, -26, -26, -25, -25, -24, -24, -23, -23, -22, -22, -21, -21, -20, -20, -19, -19, -18, -18, -17, -17, -16, -16, -15, -15, -14, -14, -13, -13, -12, -12, -11, -11, -10, -10, -9, -9, -8, -8, -7, -7, -6, -6, -5, -5, -4, -4, -3, -3, -2, -2, -1, -1, 0, 0, 1, 1, 2, 2, 3, 3, 4, 4, 5, 5, 6, 6, 7, 7, 8, 8, 9, 9, 10, 10, 11, 11, 12, 12, 13, 13, 14, 14, 15, 15, 16, 16, 17, 17, 18, 18, 19, 19, 20, 20, 21, 21, 22, 22, 23, 23, 24, 24, 25, 25, 26, 26, 27, 27, 28, 28, 29, 29, 30, 30, 31, 31, 32, 32, 33, 33, 34, 34, 35, 35, 36, 36, 37, 37, 38, 38, 39, 39, 40, 40, 41, 41, 42, 42, 43, 43, 44, 44, 45, 45, 46, 46, 47, 47, 48, 48, 49, 49, 50, 50, 51, 51, 52, 52, 53, 53, 54, 54, 55, 55, 56, 56, 57, 57, 58, 58, 59, 59, 60, 60, 61, 61, 62, 62, 63, 63
};
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_ILOGB_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/lg.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LG_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LG_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct lg
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::log2(static_cast<double>(x));
}
};
template <>
struct gadget_hints<lg>
{
static constexpr double min = std::exp2(-63);
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LG_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/ln.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct ln
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::log(static_cast<double>(x));
}
};
template <>
struct gadget_hints<ln>
{
static constexpr double min = std::exp2(-63);
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double poles[] = { 0 };
static constexpr double interesting_points[] = { 0 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LN_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/logarithm/log10.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LOG10_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LOG10_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct log10
{
template <typename T>
T operator()(T x)
{
if (x <= 0) return 0; // TODO
return std::log10(static_cast<double>(x));
}
};
template <>
struct gadget_hints<log10>
{
static constexpr double min = std::exp2(-63);
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double hint_poles[] = { 0 };
static constexpr double hint_interesting_points[] = { 0 };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHM_LOG10_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/logarithm/logn.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGN_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGN_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/logarithm/logstar.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGSTAR_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGSTAR_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_LOGARITHMS_LOGSTAR_HPP__

View file

@ -0,0 +1,21 @@
/// @file grotto/gadgets/misc.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_HPP__
#include "grotto/gadgets/misc/entropy.hpp"
#include "grotto/gadgets/misc/erf.hpp"
#include "grotto/gadgets/misc/erfc.hpp"
// #include "grotto/gadgets/misc/expint.hpp"
// #include "grotto/gadgets/misc/gamma.hpp"
// #include "grotto/gadgets/misc/i0.hpp"
// #include "grotto/gadgets/misc/lgamma.hpp"
// #include "grotto/gadgets/misc/reimann_zeta.hpp"
// #include "grotto/gadgets/misc/sinc.hpp"
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/misc/entropy.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ENTROPY_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ENTROPY_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct entropy
{
template <typename T>
T operator()(T x)
{
if (x < 0) return 0; //TODO
if (x == 0) return 0;
return std::min(-x * std::log(x), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<entropy>
{
static constexpr double min = 0;
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double hint_poles[] = { };
static constexpr double hint_interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ENTROPY_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/misc/erf.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERF_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERF_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct erf
{
template <typename T>
T operator()(T x) { std::erf(static_cast<double>(x)); }
};
template <>
struct gadget_hints<erf>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double hint_poles[] = { };
static constexpr double hint_interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERF_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/misc/erfc.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERFC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERFC_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "grotto/gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct erf
{
template <typename T>
T operator()(T x) { std::erfc(static_cast<double>(x)); }
};
template <>
struct gadget_hints<erf>
{
static constexpr double min = std::numeric_limits<double>::min();
static constexpr double max = std::numeric_limits<double>::max();
static constexpr double hint_poles[] = { };
static constexpr double hint_interesting_points[] = { };
static constexpr unsigned degree = 3;
static constexpr bool has_canonical_representation = false;
static constexpr double canonical_bounds[] = { };
static constexpr std::array<double, degree+1> hint_canonical_polys[] = { };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_ERFC_HPP__

View file

@ -0,0 +1,23 @@
/// @file grotto/gadgets/misc/expint.hpp
/// @author Ryan Henry <ryan.henry@ucalgary.ca>
/// @brief
/// @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.
#ifndef LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_EXPINT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_EXPINT_HPP__
namespace grotto
{
namespace gadgets
{
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_MISC_EXPINT_HPP__

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