API Reference
FastTanhSinhQuadrature.adaptive_integrate_1DFastTanhSinhQuadrature.adaptive_integrate_1DFastTanhSinhQuadrature.adaptive_integrate_2DFastTanhSinhQuadrature.adaptive_integrate_2DFastTanhSinhQuadrature.adaptive_integrate_3DFastTanhSinhQuadrature.adaptive_integrate_3DFastTanhSinhQuadrature.integrate1DFastTanhSinhQuadrature.integrate1DFastTanhSinhQuadrature.integrate1DFastTanhSinhQuadrature.integrate1DFastTanhSinhQuadrature.integrate1D_avxFastTanhSinhQuadrature.integrate1D_avxFastTanhSinhQuadrature.integrate1D_avxFastTanhSinhQuadrature.integrate2DFastTanhSinhQuadrature.integrate2DFastTanhSinhQuadrature.integrate2DFastTanhSinhQuadrature.integrate2D_avxFastTanhSinhQuadrature.integrate2D_avxFastTanhSinhQuadrature.integrate3DFastTanhSinhQuadrature.integrate3DFastTanhSinhQuadrature.integrate3DFastTanhSinhQuadrature.integrate3D_avxFastTanhSinhQuadrature.integrate3D_avxFastTanhSinhQuadrature.integrate3D_avxFastTanhSinhQuadrature.quadFastTanhSinhQuadrature.quadFastTanhSinhQuadrature.quad_splitFastTanhSinhQuadrature.quad_splitFastTanhSinhQuadrature.t_w_maxFastTanhSinhQuadrature.t_x_maxFastTanhSinhQuadrature.tanhsinhFastTanhSinhQuadrature.tanhsinhFastTanhSinhQuadrature.tmax
High-Level API
These functions provide the easiest interface for integration with automatic adaptation.
FastTanhSinhQuadrature.quad — Function
quad(f::Function, [low, up]; tol=1e-12, max_levels=10)High-level interface for Tanh-Sinh quadrature. Automatically detects dimensions (1D, 2D, or 3D) and chooses the most efficient implementation.
- If
lowandupare absent, integrates over[-1, 1](1D). - Uses SIMD-accelerated (
_avx) implementation forFloat32/Float64. - Uses higher-precision implementation for other types (e.g.,
BigFloat). - Automatically converts
AbstractVectortoSVectorfor multi-dimensional integration.
FastTanhSinhQuadrature.quad_split — Function
quad_split(f, c, [low, up]; tol=1e-12, max_levels=10)Split the integration domain at point c (singularity) and integrate sub-domains separately.
1D Integration
Functions for integrating over 1D domains using pre-computed nodes and weights.
FastTanhSinhQuadrature.integrate1D — Function
integrate1D(::Type{T}, f::Function, N::Int) where {T<:Real}Calculate the integral of f over [-1, 1] using N Tanh-Sinh quadrature points in precision T.
integrate1D(f, x, w, h)Calculate the integral of f over [-1, 1] using pre-computed nodes x, weights w, and step size h.
integrate1D(f, low, up, x, w, h)Calculate the integral of f over [low, up] using pre-computed nodes x, weights w, and step size h.
FastTanhSinhQuadrature.integrate1D_avx — Function
integrate1D_avx(f, x, w, h)SIMD-accelerated 1D integration over [-1, 1] Using LoopVectorization. Requires f to be compatible with @turbo. Only beneficial for Float32/Float64.
integrate1D_avx(f, low, up, x, w, h)SIMD-accelerated 1D integration over [low, up] Using LoopVectorization.
FastTanhSinhQuadrature.adaptive_integrate_1D — Function
adaptive_integrate_1D(::Type{T}, f::Function, a, b; tol::Real=1e-12, max_levels::Int=10)Adaptive 1D Tanh-Sinh integration over [a, b]. Starts with a coarse grid (h ≈ tmax/2) and halves the step size at each level. Reuses function evaluations from previous levels by only computing new (odd-indexed) nodes. Exploits symmetry around the center of the interval.
2D Integration
Functions for integrating over 2D rectangular domains.
FastTanhSinhQuadrature.integrate2D — Function
integrate2D(f, x, w, h)Calculate the 2D integral of f over [-1, 1]^2 using pre-computed nodes/weights.
integrate2D(f, low, up, x, w, h)Calculate the 2D integral of f over [low, up] (with low, up::SVector{2}) using pre-computed nodes/weights.
FastTanhSinhQuadrature.integrate2D_avx — Function
integrate2D_avx(f, low, up, x, w, h)SIMD-accelerated 2D integration over [low, up] Using LoopVectorization.
FastTanhSinhQuadrature.adaptive_integrate_2D — Function
adaptive_integrate_2D(::Type{T}, f::Function, low::SVector{2,T}, up::SVector{2,T}; tol::Real=1e-10, max_levels::Int=8)Adaptive 2D Tanh-Sinh integration over a rectangle. Reuses indices by only evaluating new points where at least one coordinate corresponds to an odd multiple of the halved step size h. Exploits 4-way quadrant symmetry and 2-way axis symmetry.
3D Integration
Functions for integrating over 3D box domains.
FastTanhSinhQuadrature.integrate3D — Function
integrate3D(f, x, w, h)Calculate the 3D integral of f over [-1, 1]^3 using pre-computed nodes/weights.
integrate3D(f, low, up, x, w, h)Calculate the 3D integral of f over [low, up] (with low, up::SVector{3}).
FastTanhSinhQuadrature.integrate3D_avx — Function
integrate3D_avx(f, x, w, h)SIMD-accelerated 3D integral over [-1, 1]^3.
integrate3D_avx(f, low, up, x, w, h)SIMD-accelerated 3D integral over [low, up].
FastTanhSinhQuadrature.adaptive_integrate_3D — Function
adaptive_integrate_3D(::Type{T}, f::Function, low::SVector{3,T}, up::SVector{3,T}; tol::Real=1e-8, max_levels::Int=5)Adaptive 3D Tanh-Sinh integration over a box. Reuses old points and exploits 8-way octant symmetry, 4-way plane symmetry, and 2-way axis symmetry to minimize function evaluations.
Node Generation
FastTanhSinhQuadrature.tanhsinh — Function
tanhsinh(::Type{T}, N::Int) where {T<:AbstractFloat}Generate Tanh-Sinh quadrature nodes x, weights w, and step size h for a given floating point type T and number of points N.
All Exported Symbols
FastTanhSinhQuadrature.adaptive_integrate_1D — Method
adaptive_integrate_1D(::Type{T}, f::Function, a, b; tol::Real=1e-12, max_levels::Int=10)Adaptive 1D Tanh-Sinh integration over [a, b]. Starts with a coarse grid (h ≈ tmax/2) and halves the step size at each level. Reuses function evaluations from previous levels by only computing new (odd-indexed) nodes. Exploits symmetry around the center of the interval.
FastTanhSinhQuadrature.adaptive_integrate_2D — Method
adaptive_integrate_2D(::Type{T}, f::Function, low::SVector{2,T}, up::SVector{2,T}; tol::Real=1e-10, max_levels::Int=8)Adaptive 2D Tanh-Sinh integration over a rectangle. Reuses indices by only evaluating new points where at least one coordinate corresponds to an odd multiple of the halved step size h. Exploits 4-way quadrant symmetry and 2-way axis symmetry.
FastTanhSinhQuadrature.adaptive_integrate_3D — Method
adaptive_integrate_3D(::Type{T}, f::Function, low::SVector{3,T}, up::SVector{3,T}; tol::Real=1e-8, max_levels::Int=5)Adaptive 3D Tanh-Sinh integration over a box. Reuses old points and exploits 8-way octant symmetry, 4-way plane symmetry, and 2-way axis symmetry to minimize function evaluations.
FastTanhSinhQuadrature.integrate1D — Method
integrate1D(::Type{T}, f::Function, N::Int) where {T<:Real}Calculate the integral of f over [-1, 1] using N Tanh-Sinh quadrature points in precision T.
FastTanhSinhQuadrature.integrate1D — Method
integrate1D(f, low, up, x, w, h)Calculate the integral of f over [low, up] using pre-computed nodes x, weights w, and step size h.
FastTanhSinhQuadrature.integrate1D — Method
integrate1D(f, x, w, h)Calculate the integral of f over [-1, 1] using pre-computed nodes x, weights w, and step size h.
FastTanhSinhQuadrature.integrate1D_avx — Method
integrate1D_avx(f, x, w, h)SIMD-accelerated 1D integration over [-1, 1] Using LoopVectorization. Requires f to be compatible with @turbo. Only beneficial for Float32/Float64.
FastTanhSinhQuadrature.integrate1D_avx — Method
integrate1D_avx(f, low, up, x, w, h)SIMD-accelerated 1D integration over [low, up] Using LoopVectorization.
FastTanhSinhQuadrature.integrate2D — Method
integrate2D(f, low, up, x, w, h)Calculate the 2D integral of f over [low, up] (with low, up::SVector{2}) using pre-computed nodes/weights.
FastTanhSinhQuadrature.integrate2D — Method
integrate2D(f, x, w, h)Calculate the 2D integral of f over [-1, 1]^2 using pre-computed nodes/weights.
FastTanhSinhQuadrature.integrate2D_avx — Method
integrate2D_avx(f, low, up, x, w, h)SIMD-accelerated 2D integration over [low, up] Using LoopVectorization.
FastTanhSinhQuadrature.integrate3D — Method
integrate3D(f, low, up, x, w, h)Calculate the 3D integral of f over [low, up] (with low, up::SVector{3}).
FastTanhSinhQuadrature.integrate3D — Method
integrate3D(f, x, w, h)Calculate the 3D integral of f over [-1, 1]^3 using pre-computed nodes/weights.
FastTanhSinhQuadrature.integrate3D_avx — Method
integrate3D_avx(f, low, up, x, w, h)SIMD-accelerated 3D integral over [low, up].
FastTanhSinhQuadrature.integrate3D_avx — Method
integrate3D_avx(f, x, w, h)SIMD-accelerated 3D integral over [-1, 1]^3.
FastTanhSinhQuadrature.quad — Method
quad(f::Function, [low, up]; tol=1e-12, max_levels=10)High-level interface for Tanh-Sinh quadrature. Automatically detects dimensions (1D, 2D, or 3D) and chooses the most efficient implementation.
- If
lowandupare absent, integrates over[-1, 1](1D). - Uses SIMD-accelerated (
_avx) implementation forFloat32/Float64. - Uses higher-precision implementation for other types (e.g.,
BigFloat). - Automatically converts
AbstractVectortoSVectorfor multi-dimensional integration.
FastTanhSinhQuadrature.quad_split — Method
quad_split(f, c, [low, up]; tol=1e-12, max_levels=10)Split the integration domain at point c (singularity) and integrate sub-domains separately.
FastTanhSinhQuadrature.t_w_max — Method
t_w_max(::Type{T}, D::Int=1) where {T<:Real}Calculate the maximum t to avoid weight underflow (Eq. 15 in arXiv:2007.15057). Ensures (ψ'(t))^calD >= floatmin(T) where calD = max(1, D-1).
FastTanhSinhQuadrature.t_x_max — Method
t_x_max(::Type{T}) where {T<:Real}Calculate the maximum t to avoid abscissae underflow (Eq. 13 in arXiv:2007.15057). Ensures 1 - |t| >= floatmin(T).
FastTanhSinhQuadrature.tanhsinh — Method
tanhsinh(::Type{T}, N::Int) where {T<:AbstractFloat}Generate Tanh-Sinh quadrature nodes x, weights w, and step size h for a given floating point type T and number of points N.
FastTanhSinhQuadrature.tmax — Method
tmax(::Type{T}, D::Int=1) where {T<:Real}Find the optimal window limit tmax considering abscissae and weight underflow (Eq. 14 in arXiv:2007.15057).