Initial import of libdpf.
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
commit
e4e666f459
4563 changed files with 1690372 additions and 0 deletions
46
include/grotto/gadgets/elementary/abs.hpp
Normal file
46
include/grotto/gadgets/elementary/abs.hpp
Normal 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__
|
||||
52
include/grotto/gadgets/elementary/approx.hpp
Normal file
52
include/grotto/gadgets/elementary/approx.hpp
Normal 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__
|
||||
56
include/grotto/gadgets/elementary/boxcar.hpp
Normal file
56
include/grotto/gadgets/elementary/boxcar.hpp
Normal 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__
|
||||
50
include/grotto/gadgets/elementary/clip.hpp
Normal file
50
include/grotto/gadgets/elementary/clip.hpp
Normal 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__
|
||||
47
include/grotto/gadgets/elementary/eq.hpp
Normal file
47
include/grotto/gadgets/elementary/eq.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/elementary/geq.hpp
Normal file
46
include/grotto/gadgets/elementary/geq.hpp
Normal 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__
|
||||
47
include/grotto/gadgets/elementary/gt.hpp
Normal file
47
include/grotto/gadgets/elementary/gt.hpp
Normal 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__
|
||||
23
include/grotto/gadgets/elementary/identity.hpp
Normal file
23
include/grotto/gadgets/elementary/identity.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/elementary/leq.hpp
Normal file
46
include/grotto/gadgets/elementary/leq.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/elementary/lt.hpp
Normal file
46
include/grotto/gadgets/elementary/lt.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/negative.hpp
Normal file
26
include/grotto/gadgets/elementary/negative.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/elementary/neq.hpp
Normal file
46
include/grotto/gadgets/elementary/neq.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/nonnegative.hpp
Normal file
26
include/grotto/gadgets/elementary/nonnegative.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/nonpositive.hpp
Normal file
26
include/grotto/gadgets/elementary/nonpositive.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/nonzero.hpp
Normal file
26
include/grotto/gadgets/elementary/nonzero.hpp
Normal 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__
|
||||
23
include/grotto/gadgets/elementary/pmone.hpp
Normal file
23
include/grotto/gadgets/elementary/pmone.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/positive.hpp
Normal file
26
include/grotto/gadgets/elementary/positive.hpp
Normal 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__
|
||||
45
include/grotto/gadgets/elementary/rect.hpp
Normal file
45
include/grotto/gadgets/elementary/rect.hpp
Normal 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__
|
||||
54
include/grotto/gadgets/elementary/step.hpp
Normal file
54
include/grotto/gadgets/elementary/step.hpp
Normal 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__
|
||||
23
include/grotto/gadgets/elementary/ternary.hpp
Normal file
23
include/grotto/gadgets/elementary/ternary.hpp
Normal 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__
|
||||
26
include/grotto/gadgets/elementary/zero.hpp
Normal file
26
include/grotto/gadgets/elementary/zero.hpp
Normal 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__
|
||||
Loading…
Add table
Add a link
Reference in a new issue