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,51 @@
/// @file grotto/gadgets/trigonometric/acos.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_TRIGONOMETRIC_ACOS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ACOS_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct acos
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= 1) return 0; //TODO
if (x >= 0) return std::max(std::acos(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x < 0) return std::min(std::acos(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<acos>
{
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_TRIGONOMETRIC_ACOS_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/trigonometric/acot.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_TRIGONOMETRIC_ACOT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ACOT_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct acot
{
template <typename T>
T operator()(T x)
{
if (x == 0) return 0; //TODO
return std::atan(1/static_cast<double>(x));
}
};
template <>
struct gadget_hints<acot>
{
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_TRIGONOMETRIC_ACOT_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/trigonometric/acsc.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_TRIGONOMETRIC_ACSC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ACSC_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct acsc
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) <= 1) return 0; //TODO
if (x>0) return std::min(std::asin(1/static_cast<double>(x)), std::numeric_limits<T>::max());
if (x<0) return std::max(std::asin(1/static_cast<double>(x)), std::numeric_limits<T>::min());
}
};
template <>
struct gadget_hints<acsc>
{
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_TRIGONOMETRIC_ACSC_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/trigonometric/asec.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_TRIGONOMETRIC_ASEC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ASEC_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct asec
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) <= 1) return 0; //TODO
if (x>0) return std::max(std::acos(1/static_cast<double>(x)), std::numeric_limits<T>::min());
if (x<0) return std::min(std::acos(1/static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<asec>
{
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_TRIGONOMETRIC_ASEC_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/trigonometric/asin.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_TRIGONOMETRIC_ASIN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ASIN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct asin
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= 1) return 0; //TODO
if (x < 0) return std::max(std::asin(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x >= 0) return std::min(std::asin(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<asin>
{
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_TRIGONOMETRIC_ASIN_HPP__

View file

@ -0,0 +1,46 @@
/// @file grotto/gadgets/trigonometric/atan.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_TRIGONOMETRIC_ATAN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_ATAN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct atan
{
template <typename T>
T operator()(T x) { return std::atan(static_cast<double>(x)); }
};
template <>
struct gadget_hints<atan>
{
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_TRIGONOMETRIC_ATAN_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/trigonometric/cos.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_TRIGONOMETRIC_COS_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_COS_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct cos
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= M_PI) return 0; // TODO
return std::cos(static_cast<double>(x));
}
};
template <>
struct gadget_hints<cos>
{
static constexpr double min = -M_PI;
static constexpr double max = M_PI;
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_TRIGONOMETRIC_COS_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/trigonometric/cot.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_TRIGONOMETRIC_COT_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_COT_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct csc
{
template <typename T>
T operator()(T x)
{
if (x == M_PI) return 0; // TODO
if (x == 0) return 0; // TODO
if (x < M_PI/2) return std::min(std::cos(static_cast<double>(x))/std::sin(static_cast<double>(x)), std::numeric_limits<T>::max());
if (x <= M_PI/2) return std::max(std::cos(static_cast<double>(x))/std::sin(static_cast<double>(x)), std::numeric_limits<T>::min());
}
};
template <>
struct gadget_hints<csc>
{
static constexpr double min = 0;
static constexpr double max = M_PI;
static constexpr double poles[] = { 0, M_PI };
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_TRIGONOMETRIC_COT_HPP__

View file

@ -0,0 +1,52 @@
/// @file grotto/gadgets/trigonometric/csc.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_TRIGONOMETRIC_CSC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_CSC_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct csc
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) == M_PI/2) return 0; // TODO
if (x == 0) return 0; // TODO
if (x < 0) return std::max(1/std::sin(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x > 0) return std::min(1/std::sin(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<csc>
{
static constexpr double min = -M_PI;
static constexpr double max = M_PI;
static constexpr double poles[] = { -M_PI, 0, M_PI };
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_TRIGONOMETRIC_CSC_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/trigonometric/deg2rad.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_TRIGONOMETRY_DEG2RAD_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRY_DEG2RAD_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct deg2rad
{
template <typename T>
T operator()(T x) {
double X = std::fmod(static_cast<double>(x), 360);
if (X < 0) X += 360;
return X*180/M_PI;
}
};
template <>
struct gadget_hints<deg2rad>
{
static constexpr double min = -180;
static constexpr double max = 180;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
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[] = { { 180/M_PI, 0 } };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRY_DEG2RAD_HPP__

View file

@ -0,0 +1,56 @@
/// @file grotto/gadgets/trigonometric/rad2deg.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_TRIGONOMETRY_RAD2DEG_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRY_RAD2DEG_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct rad2deg
{
template <typename T>
T operator()(T x) {
double X = std::fmod(static_cast<double>(x), 2*M_PI);
if (X < 0) X += 2*M_PI;
return X * M_PI / 180;
}
};
template <>
struct gadget_hints<rad2deg>
{
static constexpr double min = -M_PI;
static constexpr double max = M_PI;
static constexpr double poles[] = { };
static constexpr double interesting_points[] = { };
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[] = { { M_PI/180, 0 } };
};
} // namespace gadgets
} // namespace grotto
#endif // LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRY_RAD2DEG_HPP__
// radians = degrees / 180 * M_PI
// degrees = radians / M_PI * 180

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/trigonometric/sec.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_TRIGONOMETRIC_SEC_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_SEC_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sec
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) == M_PI/2) return 0; // TODO
if (std::abs(x) < M_PI/2) return std::min(1/std::cos(static_cast<double>(x)), std::numeric_limits<T>::max());
if (std::abs(x) > M_PI/2) return std::max(1/std::cos(static_cast<double>(x)), std::numeric_limits<T>::min());
}
};
template <>
struct gadget_hints<sec>
{
static constexpr double min = -M_PI;
static constexpr double max = M_PI;
static constexpr double poles[] = { -M_PI/2, M_PI/2 };
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_TRIGONOMETRIC_SEC_HPP__

View file

@ -0,0 +1,50 @@
/// @file grotto/gadgets/trigonometric/sin.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_TRIGONOMETRIC_SIN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_SIN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct sin
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= M_PI) return 0; // TODO
return std::sin(static_cast<double>(x));
}
};
template <>
struct gadget_hints<sin>
{
static constexpr double min = -M_PI;
static constexpr double max = M_PI;
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_TRIGONOMETRIC_SIN_HPP__

View file

@ -0,0 +1,51 @@
/// @file grotto/gadgets/trigonometric/tan.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_TRIGONOMETRIC_TAN_HPP__
#define LIBDPF_INCLUDE_GROTTO_GADGETS_TRIGONOMETRIC_TAN_HPP__
#include <cmath>
#include <array>
#include <limits>
#include "../../gadget_hints.hpp"
namespace grotto
{
namespace gadgets
{
struct tan
{
template <typename T>
T operator()(T x)
{
if (std::abs(x) >= M_PI/2) return 0; // TODO
if (x < 0) return std::max(std::tan(static_cast<double>(x)), std::numeric_limits<T>::min());
if (x >- 0) return std::min(std::tan(static_cast<double>(x)), std::numeric_limits<T>::max());
}
};
template <>
struct gadget_hints<tan>
{
static constexpr double min = -M_PI/2;
static constexpr double max = M_PI/2;
static constexpr double poles[] = { -M_PI/2, M_PI/2 };
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_TRIGONOMETRIC_TAN_HPP__