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
50
include/grotto/gadgets/hyperbolic/acosh.hpp
Normal file
50
include/grotto/gadgets/hyperbolic/acosh.hpp
Normal 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__
|
||||
48
include/grotto/gadgets/hyperbolic/acoth.hpp
Normal file
48
include/grotto/gadgets/hyperbolic/acoth.hpp
Normal 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__
|
||||
51
include/grotto/gadgets/hyperbolic/acsch.hpp
Normal file
51
include/grotto/gadgets/hyperbolic/acsch.hpp
Normal 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__
|
||||
51
include/grotto/gadgets/hyperbolic/asech.hpp
Normal file
51
include/grotto/gadgets/hyperbolic/asech.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/hyperbolic/asinh.hpp
Normal file
46
include/grotto/gadgets/hyperbolic/asinh.hpp
Normal 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__
|
||||
50
include/grotto/gadgets/hyperbolic/atanh.hpp
Normal file
50
include/grotto/gadgets/hyperbolic/atanh.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/hyperbolic/cosh.hpp
Normal file
46
include/grotto/gadgets/hyperbolic/cosh.hpp
Normal 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__
|
||||
51
include/grotto/gadgets/hyperbolic/coth.hpp
Normal file
51
include/grotto/gadgets/hyperbolic/coth.hpp
Normal 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__
|
||||
51
include/grotto/gadgets/hyperbolic/csch.hpp
Normal file
51
include/grotto/gadgets/hyperbolic/csch.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/hyperbolic/sech.hpp
Normal file
46
include/grotto/gadgets/hyperbolic/sech.hpp
Normal 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__
|
||||
50
include/grotto/gadgets/hyperbolic/sinh.hpp
Normal file
50
include/grotto/gadgets/hyperbolic/sinh.hpp
Normal 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__
|
||||
46
include/grotto/gadgets/hyperbolic/tanh.hpp
Normal file
46
include/grotto/gadgets/hyperbolic/tanh.hpp
Normal 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__
|
||||
Loading…
Add table
Add a link
Reference in a new issue