Fix bugs, docs, and structure in unsupported/ public headers

libeigen/eigen!2254

Co-authored-by: Rasmus Munk Larsen <rmlarsen@gmail.com>
This commit is contained in:
Rasmus Munk Larsen
2026-03-29 17:06:40 -07:00
parent bd276fbb28
commit 255f522e2e
17 changed files with 69 additions and 50 deletions

View File

@@ -7,8 +7,8 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
#ifndef EIGEN_ADLOC_FORWARD_MODULE_H
#define EIGEN_ADLOC_FORWARD_MODULE_H
#ifndef EIGEN_ADOLC_FORWARD_MODULE_H
#define EIGEN_ADOLC_FORWARD_MODULE_H
//--------------------------------------------------------------------------------
//
@@ -42,6 +42,8 @@
#include "../../Eigen/Core"
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
namespace Eigen {
/**
@@ -57,7 +59,7 @@ namespace Eigen {
* the preprocessor token NUMBER_DIRECTIONS. The default is 2.
*
* \code
* #include <unsupported/Eigen/AdolcSupport>
* #include <unsupported/Eigen/AdolcForward>
* \endcode
*/
//@{
@@ -111,7 +113,7 @@ class AdolcForwardJacobian : public Functor {
template <typename T0, typename T1>
AdolcForwardJacobian(const T0& a0, const T1& a1) : Functor(a0, a1) {}
template <typename T0, typename T1, typename T2>
AdolcForwardJacobian(const T0& a0, const T1& a1, const T1& a2) : Functor(a0, a1, a2) {}
AdolcForwardJacobian(const T0& a0, const T1& a1, const T2& a2) : Functor(a0, a1, a2) {}
typedef typename Functor::InputType InputType;
typedef typename Functor::ValueType ValueType;
@@ -150,4 +152,6 @@ class AdolcForwardJacobian : public Functor {
} // namespace Eigen
#endif // EIGEN_ADLOC_FORWARD_MODULE_H
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_ADOLC_FORWARD_MODULE_H

View File

@@ -16,7 +16,7 @@
* This module provides a wrapper to Arpack, a library for sparse eigenvalue decomposition.
*
* \code
* #include <Eigen/ArpackSupport>
* #include <unsupported/Eigen/ArpackSupport>
* \endcode
*/

View File

@@ -17,7 +17,7 @@ namespace Eigen {
/**
* \defgroup AutoDiff_Module Auto Diff module
*
* This module features forward automatic differentation via a simple
* This module features forward automatic differentiation via a simple
* templated scalar type wrapper AutoDiffScalar.
*
* Warning : this should NOT be confused with numerical differentiation, which
@@ -35,7 +35,6 @@ namespace Eigen {
// IWYU pragma: begin_exports
#include "src/AutoDiff/CoherentPadOp.h"
#include "src/AutoDiff/AutoDiffScalar.h"
// #include "src/AutoDiff/AutoDiffVector.h"
#include "src/AutoDiff/AutoDiffJacobian.h"
// IWYU pragma: end_exports

View File

@@ -98,11 +98,15 @@ namespace Eigen {
//@{
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
// IWYU pragma: begin_exports
#include "src/BVH/BVAlgorithms.h"
#include "src/BVH/KdBVH.h"
// IWYU pragma: end_exports
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
//@}
#endif // EIGEN_BVH_MODULE_H

View File

@@ -37,14 +37,15 @@
* - fftw (http://www.fftw.org) : faster, GPL -- incompatible with Eigen in LGPL form, bigger code size.
* - MKL (https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl-download.html) : fastest, free -- may be
* incompatible with Eigen in GPL form.
* - PocketFFT/DUCC (https://gitlab.mpcdf.mpg.de/mtr/pocketfft, https://gitlab.mpcdf.mpg.de/mtr/ducc) : faster than kissfft, BSD 3-clause.
* It is a heavily modified implementation of FFTPack, with the following advantages:
* 1.strictly C++11 compliant
* 2.more accurate twiddle factor computation
* 3.very fast plan generation
* 4.worst case complexity for transform sizes with large prime factors is N*log(N), because Bluestein's algorithm is
* - PocketFFT/DUCC (https://gitlab.mpcdf.mpg.de/mtr/pocketfft, https://gitlab.mpcdf.mpg.de/mtr/ducc) : faster than
* kissfft, BSD 3-clause. A heavily modified implementation of FFTPack with the following advantages:
* -# strictly C++11 compliant
* -# more accurate twiddle factor computation
* -# very fast plan generation
* -# worst case complexity for transform sizes with large prime factors is N*log(N),
* because Bluestein's algorithm is used for these cases.
* .
* According to the author, DUCC contains the "evolution" of pocketfft, though the interface is very similar.
* used for these cases
*
* \section FFTDesign Design
*
@@ -88,7 +89,6 @@
#include <fftw3.h>
#include "src/FFT/fftw_impl.h"
namespace Eigen {
// template <typename T> typedef struct internal::fftw_impl default_fft_impl; this does not work
template <typename T>
struct default_fft_impl : public internal::fftw_impl<T> {};
} // namespace Eigen
@@ -110,7 +110,6 @@ struct default_fft_impl : public internal::pocketfft_impl<T> {};
#elif defined EIGEN_DUCCFFT_DEFAULT
#include <ducc0/fft/fft.h>
#include <ducc0/infra/string_utils.h>
#include <ducc0/fft/fft.h>
#include <ducc0/fft/fftnd_impl.h>
#include "src/FFT/duccfft_impl.h"
namespace Eigen {
@@ -149,7 +148,7 @@ struct traits<fft_inv_proxy<T_SrcMat, T_FftIfc> > {
template <typename T_SrcMat, typename T_FftIfc>
struct fft_fwd_proxy : public ReturnByValue<fft_fwd_proxy<T_SrcMat, T_FftIfc> > {
typedef DenseIndex Index;
typedef Eigen::Index Index;
fft_fwd_proxy(const T_SrcMat& src, T_FftIfc& fft, Index nfft) : m_src(src), m_ifc(fft), m_nfft(nfft) {}
@@ -167,7 +166,7 @@ struct fft_fwd_proxy : public ReturnByValue<fft_fwd_proxy<T_SrcMat, T_FftIfc> >
template <typename T_SrcMat, typename T_FftIfc>
struct fft_inv_proxy : public ReturnByValue<fft_inv_proxy<T_SrcMat, T_FftIfc> > {
typedef DenseIndex Index;
typedef Eigen::Index Index;
fft_inv_proxy(const T_SrcMat& src, T_FftIfc& fft, Index nfft) : m_src(src), m_ifc(fft), m_nfft(nfft) {}
@@ -187,7 +186,7 @@ template <typename T_Scalar, typename T_Impl = default_fft_impl<T_Scalar> >
class FFT {
public:
typedef T_Impl impl_type;
typedef DenseIndex Index;
typedef Eigen::Index Index;
typedef typename impl_type::Scalar Scalar;
typedef typename impl_type::Complex Complex;
@@ -391,14 +390,7 @@ class FFT {
private:
template <typename T_Data>
inline void scale(T_Data* x, Scalar s, Index nx) {
#if 1
for (int k = 0; k < nx; ++k) *x++ *= s;
#else
if (((ptrdiff_t)x) & 15)
Matrix<T_Data, Dynamic, 1>::Map(x, nx) *= s;
else
Matrix<T_Data, Dynamic, 1>::MapAligned(x, nx) *= s;
#endif
}
inline void ReflectSpectrum(Complex* freq, Index nfft) {
@@ -427,4 +419,4 @@ inline void fft_inv_proxy<T_SrcMat, T_FftIfc>::evalTo(T_DestMat& dst) const {
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif
#endif // EIGEN_FFT_MODULE_H

View File

@@ -20,12 +20,14 @@ namespace Eigen {
* This module contains an experimental Kronecker product implementation.
*
* \code
* #include <Eigen/KroneckerProduct>
* #include <unsupported/Eigen/KroneckerProduct>
* \endcode
*/
} // namespace Eigen
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
// IWYU pragma: begin_exports
#include "src/KroneckerProduct/KroneckerTensorProduct.h"
// IWYU pragma: end_exports

View File

@@ -10,27 +10,23 @@
#ifndef EIGEN_LEVENBERGMARQUARDT_MODULE_H
#define EIGEN_LEVENBERGMARQUARDT_MODULE_H
// #include <vector>
#include "../../Eigen/Core"
#include "../../Eigen/Jacobi"
#include "../../Eigen/QR"
#include "NumericalDiff"
#include "../../Eigen/SparseCore"
#include "../../Eigen/SparseQR"
#include "NumericalDiff"
/**
* \defgroup LevenbergMarquardt_Module Levenberg-Marquardt module
*
* \code
* #include </Eigen/LevenbergMarquardt>
* #include <unsupported/Eigen/LevenbergMarquardt>
* \endcode
*
*
*/
#include "../../Eigen/SparseCore"
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
// IWYU pragma: begin_exports

View File

@@ -15,12 +15,14 @@
#include "../../Eigen/Core"
#include <mpreal.h>
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
namespace Eigen {
/**
* \defgroup MPRealSupport_Module MPFRC++ Support module
* \code
* #include <Eigen/MPRealSupport>
* #include <unsupported/Eigen/MPRealSupport>
* \endcode
*
* This module provides support for multi precision floating point numbers
@@ -35,7 +37,7 @@ namespace Eigen {
*
\code
#include <iostream>
#include <Eigen/MPRealSupport>
#include <unsupported/Eigen/MPRealSupport>
#include <Eigen/LU>
using namespace mpfr;
using namespace Eigen;
@@ -95,7 +97,7 @@ struct NumTraits<mpfr::mpreal> : GenericNumTraits<mpfr::mpreal> {
return std::numeric_limits<Real>::digits10(Precision);
}
static inline int digits10(const Real& x) { return std::numeric_limits<Real>::digits10(x); }
static inline int max_digits10(long Precision = mpfr::mpreal::get_default_prec()) {
return std::numeric_limits<Real>::max_digits10(Precision);
}
@@ -211,4 +213,6 @@ struct gebp_kernel<mpfr::mpreal, mpfr::mpreal, Index, DataMapper, 1, 1, Conjugat
} // end namespace internal
} // namespace Eigen
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_MPREALSUPPORT_MODULE_H

View File

@@ -26,14 +26,16 @@
*
*/
#ifndef EIGEN_NNLS_H
#define EIGEN_NNLS_H
#ifndef EIGEN_NNLS_MODULE_H
#define EIGEN_NNLS_MODULE_H
#include "../../Eigen/Core"
#include "../../Eigen/QR"
#include <limits>
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
namespace Eigen {
/** \ingroup nnls
@@ -385,4 +387,6 @@ void NNLS<MatrixType>::solveInactiveSet_(const RhsVectorType &b) {
} // namespace Eigen
#endif // EIGEN_NNLS_H
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_NNLS_MODULE_H

View File

@@ -118,6 +118,8 @@
* unsupported/test/NonLinearOptimization.cpp.
*/
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
// IWYU pragma: begin_exports
#ifndef EIGEN_PARSED_BY_DOXYGEN
@@ -138,4 +140,6 @@
#include "src/NonLinearOptimization/LevenbergMarquardt.h"
// IWYU pragma: end_exports
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_NONLINEAROPTIMIZATION_MODULE_H

View File

@@ -48,10 +48,14 @@ namespace Eigen {
//@{
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
// IWYU pragma: begin_exports
#include "src/NumericalDiff/NumericalDiff.h"
// IWYU pragma: end_exports
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
//@}
#endif // EIGEN_NUMERICALDIFF_MODULE_H

View File

@@ -18,10 +18,12 @@
#include <GL/gl.h>
#endif
#include "../../Eigen/src/Core/util/DisableStupidWarnings.h"
namespace Eigen {
/**
* \defgroup OpenGLSUpport_Module OpenGL Support module
* \defgroup OpenGLSupport_Module OpenGL Support module
*
* This module provides wrapper functions for a couple of OpenGL functions
* which simplify the way to pass Eigen's object to openGL.
@@ -29,7 +31,7 @@ namespace Eigen {
*
* \code
* // You need to add path_to_eigen/unsupported to your include path.
* #include <Eigen/OpenGLSupport>
* #include <unsupported/Eigen/OpenGLSupport>
* // ...
* Vector3f x, y;
* Matrix3f rot;
@@ -347,4 +349,6 @@ EIGEN_GL_FUNC1_SPECIALIZATION_VEC(glUniform, GLint, const, double, 4, 4dv_ei)
} // namespace Eigen
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
#endif // EIGEN_OPENGL_MODULE_H

View File

@@ -10,7 +10,7 @@
#ifndef EIGEN_SPECIALFUNCTIONS_MODULE_H
#define EIGEN_SPECIALFUNCTIONS_MODULE_H
#include <math.h>
#include <cmath>
#include "../../Eigen/Core"

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 20010-2011 Hauke Heibel <hauke.heibel@gmail.com>
// Copyright (C) 2010-2011 Hauke Heibel <hauke.heibel@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed
@@ -10,6 +10,8 @@
#ifndef EIGEN_SPLINES_MODULE_H
#define EIGEN_SPLINES_MODULE_H
#include "../../Eigen/Core"
namespace Eigen {
/**
* \defgroup Splines_Module Spline and spline fitting module

View File

@@ -8,7 +8,7 @@
// Public License v. 2.0. If a copy of the MPL was not distributed
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
// #ifndef EIGEN_CXX11_TENSOR_MODULE_H
#ifndef EIGEN_CXX11_TENSOR_MODULE_H
#define EIGEN_CXX11_TENSOR_MODULE_H
#include "../../Eigen/Core"
@@ -139,4 +139,4 @@
#include "../../Eigen/src/Core/util/ReenableStupidWarnings.h"
// #endif // EIGEN_CXX11_TENSOR_MODULE_H
#endif // EIGEN_CXX11_TENSOR_MODULE_H

View File

@@ -24,7 +24,7 @@
* Including this module will implicitly include the Tensor module.
*
* \code
* #include <Eigen/TensorSymmetry>
* #include <unsupported/Eigen/TensorSymmetry>
* \endcode
*/

View File

@@ -1,7 +1,7 @@
// This file is part of Eigen, a lightweight C++ template library
// for linear algebra.
//
// Copyright (C) 20010-2011 Hauke Heibel <hauke.heibel@gmail.com>
// Copyright (C) 2010-2011 Hauke Heibel <hauke.heibel@gmail.com>
//
// This Source Code Form is subject to the terms of the Mozilla
// Public License v. 2.0. If a copy of the MPL was not distributed