API Reference

High-Level API

These functions provide the easiest interface for integration with automatic adaptation.

FastTanhSinhQuadrature.quadFunction
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 low and up are absent, integrates over [-1, 1] (1D).
  • Uses SIMD-accelerated (_avx) implementation for Float32/Float64.
  • Uses higher-precision implementation for other types (e.g., BigFloat).
  • Automatically converts AbstractVector to SVector for multi-dimensional integration.
source
FastTanhSinhQuadrature.quad_splitFunction
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.

source

1D Integration

Functions for integrating over 1D domains using pre-computed nodes and weights.

FastTanhSinhQuadrature.integrate1DFunction
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.

source
integrate1D(f, x, w, h)

Calculate the integral of f over [-1, 1] using pre-computed nodes x, weights w, and step size h.

source
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.

source
FastTanhSinhQuadrature.integrate1D_avxFunction
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.

source
integrate1D_avx(f, low, up, x, w, h)

SIMD-accelerated 1D integration over [low, up] Using LoopVectorization.

source
FastTanhSinhQuadrature.adaptive_integrate_1DFunction
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.

source

2D Integration

Functions for integrating over 2D rectangular domains.

FastTanhSinhQuadrature.integrate2DFunction
integrate2D(f, x, w, h)

Calculate the 2D integral of f over [-1, 1]^2 using pre-computed nodes/weights.

source
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.

source
FastTanhSinhQuadrature.adaptive_integrate_2DFunction
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.

source

3D Integration

Functions for integrating over 3D box domains.

FastTanhSinhQuadrature.integrate3DFunction
integrate3D(f, x, w, h)

Calculate the 3D integral of f over [-1, 1]^3 using pre-computed nodes/weights.

source
integrate3D(f, low, up, x, w, h)

Calculate the 3D integral of f over [low, up] (with low, up::SVector{3}).

source
FastTanhSinhQuadrature.adaptive_integrate_3DFunction
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.

source

Node Generation

FastTanhSinhQuadrature.tanhsinhFunction
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.

source

All Exported Symbols

FastTanhSinhQuadrature.adaptive_integrate_1DMethod
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.

source
FastTanhSinhQuadrature.adaptive_integrate_2DMethod
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.

source
FastTanhSinhQuadrature.adaptive_integrate_3DMethod
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.

source
FastTanhSinhQuadrature.integrate1DMethod
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.

source
FastTanhSinhQuadrature.integrate1D_avxMethod
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.

source
FastTanhSinhQuadrature.quadMethod
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 low and up are absent, integrates over [-1, 1] (1D).
  • Uses SIMD-accelerated (_avx) implementation for Float32/Float64.
  • Uses higher-precision implementation for other types (e.g., BigFloat).
  • Automatically converts AbstractVector to SVector for multi-dimensional integration.
source
FastTanhSinhQuadrature.t_w_maxMethod
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).

source
FastTanhSinhQuadrature.t_x_maxMethod
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).

source
FastTanhSinhQuadrature.tanhsinhMethod
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.

source
FastTanhSinhQuadrature.tmaxMethod
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).

source