2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-19 04:22:09 +00:00

Fix undefined types with new GCC

This commit is contained in:
Matt Borland
2025-10-23 13:21:55 +02:00
parent 975672b7b1
commit 1d7afe18f7
9 changed files with 51 additions and 42 deletions

View File

@@ -8,6 +8,7 @@
#define BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP #define BOOST_MATH_INTERPOLATORS_CUBIC_HERMITE_HPP
#include <memory> #include <memory>
#include <boost/math/interpolators/detail/cubic_hermite_detail.hpp> #include <boost/math/interpolators/detail/cubic_hermite_detail.hpp>
#include <cstdint>
namespace boost { namespace boost {
namespace math { namespace math {
@@ -41,7 +42,7 @@ public:
impl_->push_back(x, y, dydx); impl_->push_back(x, y, dydx);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -80,7 +81,7 @@ public:
return os; return os;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -121,7 +122,7 @@ public:
return os; return os;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }

View File

@@ -12,6 +12,7 @@
#include <utility> // for std::move #include <utility> // for std::move
#include <algorithm> // for std::is_sorted #include <algorithm> // for std::is_sorted
#include <string> #include <string>
#include <cstdint>
#include <boost/math/special_functions/fpclassify.hpp> #include <boost/math/special_functions/fpclassify.hpp>
#include <boost/math/tools/assert.hpp> #include <boost/math/tools/assert.hpp>
@@ -100,22 +101,22 @@ template<class Real>
void barycentric_rational_imp<Real>::calculate_weights(size_t approximation_order) void barycentric_rational_imp<Real>::calculate_weights(size_t approximation_order)
{ {
using std::abs; using std::abs;
int64_t n = m_x.size(); std::int64_t n = m_x.size();
m_w.resize(n, 0); m_w.resize(n, 0);
for(int64_t k = 0; k < n; ++k) for(std::int64_t k = 0; k < n; ++k)
{ {
int64_t i_min = (std::max)(k - static_cast<int64_t>(approximation_order), static_cast<int64_t>(0)); std::int64_t i_min = (std::max)(k - static_cast<std::int64_t>(approximation_order), static_cast<std::int64_t>(0));
int64_t i_max = k; std::int64_t i_max = k;
if (k >= n - (std::ptrdiff_t)approximation_order) if (k >= n - (std::ptrdiff_t)approximation_order)
{ {
i_max = n - approximation_order - 1; i_max = n - approximation_order - 1;
} }
for(int64_t i = i_min; i <= i_max; ++i) for(std::int64_t i = i_min; i <= i_max; ++i)
{ {
Real inv_product = 1; Real inv_product = 1;
int64_t j_max = (std::min)(static_cast<int64_t>(i + approximation_order), static_cast<int64_t>(n - 1)); std::int64_t j_max = (std::min)(static_cast<std::int64_t>(i + approximation_order), static_cast<std::int64_t>(n - 1));
for(int64_t j = i; j <= j_max; ++j) for(std::int64_t j = i; j <= j_max; ++j)
{ {
if (j == k) if (j == k)
{ {

View File

@@ -7,6 +7,7 @@
#ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP #ifndef BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP
#define BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_CARDINAL_QUINTIC_B_SPLINE_DETAIL_HPP
#include <cmath> #include <cmath>
#include <cstdint>
#include <vector> #include <vector>
#include <utility> #include <utility>
#include <boost/math/special_functions/cardinal_b_spline.hpp> #include <boost/math/special_functions/cardinal_b_spline.hpp>
@@ -157,7 +158,7 @@ public:
m_alpha[n+3] = rhs[n+3]/diagonal[n+3]; m_alpha[n+3] = rhs[n+3]/diagonal[n+3];
m_alpha[n+2] = rhs[n+2] - first_superdiagonal[n+2]*m_alpha[n+3]; m_alpha[n+2] = rhs[n+2] - first_superdiagonal[n+2]*m_alpha[n+3];
for (int64_t i = int64_t(n+1); i >= 0; --i) { for (std::int64_t i = std::int64_t(n+1); i >= 0; --i) {
m_alpha[i] = rhs[i] - first_superdiagonal[i]*m_alpha[i+1] - second_superdiagonal[i]*m_alpha[i+2]; m_alpha[i] = rhs[i] - first_superdiagonal[i]*m_alpha[i+1] - second_superdiagonal[i]*m_alpha[i+2];
} }
@@ -176,10 +177,10 @@ public:
Real x = (t-m_t0)*m_inv_h; Real x = (t-m_t0)*m_inv_h;
// Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5. // Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5.
// TODO: Zero pad m_alpha so that only the domain check is necessary. // TODO: Zero pad m_alpha so that only the domain check is necessary.
int64_t j_min = (std::max)(int64_t(0), int64_t(ceil(x-1))); std::int64_t j_min = (std::max)(std::int64_t(0), std::int64_t(ceil(x-1)));
int64_t j_max = (std::min)(int64_t(m_alpha.size() - 1), int64_t(floor(x+5)) ); std::int64_t j_max = (std::min)(std::int64_t(m_alpha.size() - 1), std::int64_t(floor(x+5)) );
Real s = 0; Real s = 0;
for (int64_t j = j_min; j <= j_max; ++j) { for (std::int64_t j = j_min; j <= j_max; ++j) {
// TODO: Use Cox 1972 to generate all integer translates of B5 simultaneously. // TODO: Use Cox 1972 to generate all integer translates of B5 simultaneously.
s += m_alpha[j]*cardinal_b_spline<5, Real>(x - j + 2); s += m_alpha[j]*cardinal_b_spline<5, Real>(x - j + 2);
} }
@@ -196,10 +197,10 @@ public:
} }
Real x = (t-m_t0)*m_inv_h; Real x = (t-m_t0)*m_inv_h;
// Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5 // Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5
int64_t j_min = (std::max)(int64_t(0), int64_t(ceil(x-1))); std::int64_t j_min = (std::max)(std::int64_t(0), std::int64_t(ceil(x-1)));
int64_t j_max = (std::min)(int64_t(m_alpha.size() - 1), int64_t(floor(x+5)) ); std::int64_t j_max = (std::min)(std::int64_t(m_alpha.size() - 1), std::int64_t(floor(x+5)) );
Real s = 0; Real s = 0;
for (int64_t j = j_min; j <= j_max; ++j) { for (std::int64_t j = j_min; j <= j_max; ++j) {
s += m_alpha[j]*cardinal_b_spline_prime<5, Real>(x - j + 2); s += m_alpha[j]*cardinal_b_spline_prime<5, Real>(x - j + 2);
} }
return s*m_inv_h; return s*m_inv_h;
@@ -216,10 +217,10 @@ public:
} }
Real x = (t-m_t0)*m_inv_h; Real x = (t-m_t0)*m_inv_h;
// Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5 // Support of B_5 is [-3, 3]. So -3 < x - j + 2 < 3, so x-1 < j < x+5
int64_t j_min = (std::max)(int64_t(0), int64_t(ceil(x-1))); std::int64_t j_min = (std::max)(std::int64_t(0), std::int64_t(ceil(x-1)));
int64_t j_max = (std::min)(int64_t(m_alpha.size() - 1), int64_t(floor(x+5)) ); std::int64_t j_max = (std::min)(std::int64_t(m_alpha.size() - 1), std::int64_t(floor(x+5)) );
Real s = 0; Real s = 0;
for (int64_t j = j_min; j <= j_max; ++j) { for (std::int64_t j = j_min; j <= j_max; ++j) {
s += m_alpha[j]*cardinal_b_spline_double_prime<5, Real>(x - j + 2); s += m_alpha[j]*cardinal_b_spline_double_prime<5, Real>(x - j + 2);
} }
return s*m_inv_h*m_inv_h; return s*m_inv_h*m_inv_h;

View File

@@ -12,6 +12,7 @@
#include <iostream> #include <iostream>
#include <sstream> #include <sstream>
#include <limits> #include <limits>
#include <cstdint>
namespace boost { namespace boost {
namespace math { namespace math {
@@ -154,7 +155,7 @@ public:
return x_.size(); return x_.size();
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return 3*x_.size()*sizeof(Real) + 3*sizeof(x_); return 3*x_.size()*sizeof(Real) + 3*sizeof(x_);
} }
@@ -278,7 +279,7 @@ public:
return y_.size(); return y_.size();
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return 2*y_.size()*sizeof(Real) + 2*sizeof(y_) + 2*sizeof(Real); return 2*y_.size()*sizeof(Real) + 2*sizeof(y_) + 2*sizeof(Real);
} }
@@ -413,7 +414,7 @@ public:
return dat_.size(); return dat_.size();
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return dat_.size()*dat_[0].size()*sizeof(Real) + sizeof(dat_) + 2*sizeof(Real); return dat_.size()*dat_[0].size()*sizeof(Real) + sizeof(dat_) + 2*sizeof(Real);
} }

View File

@@ -11,6 +11,7 @@
#include <sstream> #include <sstream>
#include <limits> #include <limits>
#include <cmath> #include <cmath>
#include <cstdint>
namespace boost { namespace boost {
namespace math { namespace math {
@@ -193,7 +194,7 @@ public:
return os; return os;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return 4*x_.size()*sizeof(x_); return 4*x_.size()*sizeof(x_);
} }
@@ -380,7 +381,7 @@ public:
return d2ydx2; return d2ydx2;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return 3*y_.size()*sizeof(Real) + 2*sizeof(Real); return 3*y_.size()*sizeof(Real) + 2*sizeof(Real);
} }
@@ -561,7 +562,7 @@ public:
return d2ydx2; return d2ydx2;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return data_.size()*data_[0].size()*sizeof(Real) + 2*sizeof(Real); return data_.size()*data_[0].size()*sizeof(Real) + 2*sizeof(Real);
} }

View File

@@ -11,6 +11,7 @@
#include <sstream> #include <sstream>
#include <limits> #include <limits>
#include <cmath> #include <cmath>
#include <cstdint>
namespace boost { namespace boost {
namespace math { namespace math {
@@ -189,7 +190,7 @@ public:
return os; return os;
} }
int64_t bytes() std::int64_t bytes()
{ {
return 5*x_.size()*sizeof(Real) + 5*sizeof(x_); return 5*x_.size()*sizeof(Real) + 5*sizeof(x_);
} }
@@ -419,7 +420,7 @@ public:
return d2ydx2; return d2ydx2;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return 4*y_.size()*sizeof(Real) + 2*sizeof(Real) + 4*sizeof(y_); return 4*y_.size()*sizeof(Real) + 2*sizeof(Real) + 4*sizeof(y_);
} }
@@ -629,7 +630,7 @@ public:
return d2ydx2; return d2ydx2;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return data_.size()*data_[0].size()*sizeof(Real) + 2*sizeof(Real) + sizeof(data_); return data_.size()*data_[0].size()*sizeof(Real) + 2*sizeof(Real) + sizeof(data_);
} }

View File

@@ -8,6 +8,7 @@
#ifndef BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP #ifndef BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP
#define BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP #define BOOST_MATH_INTERPOLATORS_VECTOR_BARYCENTRIC_RATIONAL_DETAIL_HPP
#include <cstdint>
#include <cmath> #include <cmath>
#include <vector> #include <vector>
#include <utility> // for std::move #include <utility> // for std::move
@@ -64,22 +65,22 @@ void vector_barycentric_rational_imp<TimeContainer, SpaceContainer>::calculate_w
{ {
using Real = typename TimeContainer::value_type; using Real = typename TimeContainer::value_type;
using std::abs; using std::abs;
int64_t n = t_.size(); std::int64_t n = t_.size();
w_.resize(n, Real(0)); w_.resize(n, Real(0));
for(int64_t k = 0; k < n; ++k) for(std::int64_t k = 0; k < n; ++k)
{ {
int64_t i_min = (std::max)(k - static_cast<int64_t>(approximation_order), static_cast<int64_t>(0)); std::int64_t i_min = (std::max)(k - static_cast<std::int64_t>(approximation_order), static_cast<std::int64_t>(0));
int64_t i_max = k; std::int64_t i_max = k;
if (k >= n - (std::ptrdiff_t)approximation_order) if (k >= n - (std::ptrdiff_t)approximation_order)
{ {
i_max = n - approximation_order - 1; i_max = n - approximation_order - 1;
} }
for(int64_t i = i_min; i <= i_max; ++i) for(std::int64_t i = i_min; i <= i_max; ++i)
{ {
Real inv_product = 1; Real inv_product = 1;
int64_t j_max = (std::min)(static_cast<int64_t>(i + approximation_order), static_cast<int64_t>(n - 1)); std::int64_t j_max = (std::min)(static_cast<std::int64_t>(i + approximation_order), static_cast<std::int64_t>(n - 1));
for(int64_t j = i; j <= j_max; ++j) for(std::int64_t j = i; j <= j_max; ++j)
{ {
if (j == k) if (j == k)
{ {

View File

@@ -10,6 +10,7 @@
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <memory> #include <memory>
#include <cstdint>
#include <boost/math/interpolators/detail/quintic_hermite_detail.hpp> #include <boost/math/interpolators/detail/quintic_hermite_detail.hpp>
namespace boost { namespace boost {
@@ -50,7 +51,7 @@ public:
impl_->push_back(x, y, dydx, d2ydx2); impl_->push_back(x, y, dydx, d2ydx2);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -85,7 +86,7 @@ public:
return impl_->double_prime(x); return impl_->double_prime(x);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -123,7 +124,7 @@ public:
return impl_->double_prime(x); return impl_->double_prime(x);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }

View File

@@ -9,6 +9,7 @@
#include <algorithm> #include <algorithm>
#include <stdexcept> #include <stdexcept>
#include <memory> #include <memory>
#include <cstdint>
#include <boost/math/interpolators/detail/septic_hermite_detail.hpp> #include <boost/math/interpolators/detail/septic_hermite_detail.hpp>
namespace boost { namespace boost {
@@ -47,7 +48,7 @@ public:
return os; return os;
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -87,7 +88,7 @@ public:
return impl_->double_prime(x); return impl_->double_prime(x);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_->bytes() + sizeof(impl_); return impl_->bytes() + sizeof(impl_);
} }
@@ -126,7 +127,7 @@ public:
return impl_->double_prime(x); return impl_->double_prime(x);
} }
int64_t bytes() const std::int64_t bytes() const
{ {
return impl_.size() + sizeof(impl_); return impl_.size() + sizeof(impl_);
} }