FastTransforms.Elliptic
— ModuleFastTransforms
submodule for the computation of some elliptic integrals and functions.
Complete elliptic integrals of the first and second kinds:
\[K(k) = \int_0^{\frac{\pi}{2}} \frac{{\rm d}\theta}{\sqrt{1-k^2\sin^2\theta}},\quad{\rm and},\]
\[E(k) = \int_0^{\frac{\pi}{2}} \sqrt{1-k^2\sin^2\theta} {\rm\,d}\theta.\]
Jacobian elliptic functions:
\[x = \int_0^{\operatorname{sn}(x,k)} \frac{{\rm d}t}{\sqrt{(1-t^2)(1-k^2t^2)}},\]
\[x = \int_{\operatorname{cn}(x,k)}^1 \frac{{\rm d}t}{\sqrt{(1-t^2)[1-k^2(1-t^2)]}},\]
\[x = \int_{\operatorname{dn}(x,k)}^1 \frac{{\rm d}t}{\sqrt{(1-t^2)(t^2-1+k^2)}},\]
and the remaining nine are defined by:
\[\operatorname{pq}(x,k) = \frac{\operatorname{pr}(x,k)}{\operatorname{qr}(x,k)} = \frac{1}{\operatorname{qp}(x,k)}.\]
FastTransforms.IPaduaTransformPlan
— TypePre-plan an Inverse Padua Transform.
FastTransforms.NUFFT2DPlan
— TypePre-computes a 2D nonuniform fast Fourier transform.
For best performance, choose the right number of threads by FFTW.set_num_threads(4)
, for example.
FastTransforms.NUFFTPlan
— TypePre-computes a nonuniform fast Fourier transform of type N
.
For best performance, choose the right number of threads by FFTW.set_num_threads(4)
, for example.
FastTransforms.PaduaTransformPlan
— TypePre-plan a Padua Transform.
FastTransforms.ToeplitzHankelPlan
— TypeRepresent a scaled Toeplitz∘Hankel matrix:
DL(T∘H)DR
where the Hankel matrix H
is non-negative definite, via
∑_{k=1}^r Diagonal(L[:,k])*T*Diagonal(R[:,k])
where L
and R
are determined by doing a rank-r pivoted Cholesky decomposition of H
, which in low rank form is
H ≈ ∑_{k=1}^r C[:,k]C[:,k]'
so that L[:,k] = DL*C[:,k]
and R[:,k] = DR*C[:,k]
.
This allows a Cholesky decomposition in 𝒪(K²N) operations and 𝒪(KN) storage, K = log N log ɛ⁻¹. The tuple storage allows plans applied to each dimension.
FastTransforms.iNUFFTPlan
— TypePre-computes an inverse nonuniform fast Fourier transform of type N
.
For best performance, choose the right number of threads by FFTW.set_num_threads(4)
, for example.
FastTransforms.mpfr_t
— Typempfr_t <: AbstractFloat
A Julia struct that exactly matches mpfr_t
.
FastTransforms._nearest_jacobi_par
— Methodnearestjacobi_par(α, γ)
returns a number that is an integer different than γ but less than 1 away from α.
FastTransforms.associatedjac2jac
— Functionassociatedjac2jac(v::AbstractVector, c::Integer, α, β, γ, δ; norm1::Bool=false, norm2::Bool=false)
Convert the vector of expansions coefficients v
from an associated Jacobi basis of orders (α,β)
to a Jacobi basis of order (γ,δ)
. The keyword arguments denote whether the bases are normalized.
FastTransforms.cheb2jac
— Functioncheb2jac(v::AbstractVector, α, β; normcheb::Bool=false, normjac::Bool=false)
Convert the vector of expansions coefficients v
from a Chebyshev basis to a Jacobi basis of order (α,β)
. The keyword arguments denote whether the bases are normalized.
FastTransforms.cheb2leg
— Functioncheb2leg(v::AbstractVector; normcheb::Bool=false, normleg::Bool=false)
Convert the vector of expansions coefficients v
from a Chebyshev to a Legendre basis. The keyword arguments denote whether the bases are normalized.
FastTransforms.cheb2ultra
— Functioncheb2ultra(v::AbstractVector, λ; normcheb::Bool=false, normultra::Bool=false)
Convert the vector of expansions coefficients v
from a Chebyshev basis to an Ultraspherical basis of order λ
. The keyword arguments denote whether the bases are normalized.
FastTransforms.chebyshevabsmoments1
— MethodModified Chebyshev moments of the first kind with respect to the absolute value weight:
\[ \int_{-1}^{+1} T_n(x) |x|{\rm\,d}x.\]
FastTransforms.chebyshevabsmoments2
— MethodModified Chebyshev moments of the second kind with respect to the absolute value weight:
\[ \int_{-1}^{+1} U_n(x) |x|{\rm\,d}x.\]
FastTransforms.chebyshevjacobimoments1
— MethodModified Chebyshev moments of the first kind with respect to the Jacobi weight:
\[ \int_{-1}^{+1} T_n(x) (1-x)^\alpha(1+x)^\beta{\rm\,d}x.\]
FastTransforms.chebyshevjacobimoments2
— MethodModified Chebyshev moments of the second kind with respect to the Jacobi weight:
\[ \int_{-1}^{+1} U_n(x) (1-x)^\alpha(1+x)^\beta{\rm\,d}x.\]
FastTransforms.chebyshevlogmoments1
— MethodModified Chebyshev moments of the first kind with respect to the logarithmic weight:
\[ \int_{-1}^{+1} T_n(x) \log\left(\frac{1-x}{2}\right){\rm\,d}x.\]
FastTransforms.chebyshevlogmoments2
— MethodModified Chebyshev moments of the second kind with respect to the logarithmic weight:
\[ \int_{-1}^{+1} U_n(x) \log\left(\frac{1-x}{2}\right){\rm\,d}x.\]
FastTransforms.chebyshevmoments1
— MethodModified Chebyshev moments of the first kind:
\[ \int_{-1}^{+1} T_n(x) {\rm\,d}x.\]
FastTransforms.chebyshevmoments2
— MethodModified Chebyshev moments of the second kind:
\[ \int_{-1}^{+1} U_n(x) {\rm\,d}x.\]
FastTransforms.chebyshevtransform!
— Methodchebyshevtransform!(x, kind=Val(1))
transforms from values on a Chebyshev grid of the first or second kind to Chebyshev coefficients, in-place
FastTransforms.chebyshevtransform
— Methodchebyshevtransform(x, kind=Val(1))
transforms from values on a Chebyshev grid of the first or second kind to Chebyshev coefficients.
FastTransforms.chebyshevutransform
— Methodchebyshevutransform(x, ::Val{kind}=Val(1))
transforms from values on a Chebyshev grid of the first or second kind to Chebyshev coefficients of the 2nd kind (Chebyshev U expansion).
FastTransforms.clenshaw!
— Methodclenshaw!(c, A, B, C, x)
evaluates the orthogonal polynomial expansion with coefficients c
at points x
, where A
, B
, and C
are AbstractVector
s containing the recurrence coefficients as defined in DLMF, overwriting x
with the results.
If c
is a matrix this treats each column as a separate vector of coefficients, returning a vector if x
is a number and a matrix if x
is a vector.
FastTransforms.clenshaw!
— Methodclenshaw!(c, A, B, C, x, ϕ₀, f)
evaluates the orthogonal polynomial expansion with coefficients c
at points x
, where A
, B
, and C
are AbstractVector
s containing the recurrence coefficients as defined in DLMF and ϕ₀ is the zeroth polynomial, overwriting f
with the results.
FastTransforms.clenshaw!
— Methodclenshaw!(c, x, f)
evaluates the first-kind Chebyshev (T) expansion with coefficients c
at points x
, overwriting f
with the results.
FastTransforms.clenshaw!
— Methodclenshaw!(c, x)
evaluates the first-kind Chebyshev (T) expansion with coefficients c
at points x
, overwriting x
with the results.
FastTransforms.clenshaw
— Methodclenshaw(c, x)
evaluates the first-kind Chebyshev (T) expansion with coefficients c
at the points x
. x
may also be a single Number
.
FastTransforms.clenshawcurtisnodes
— MethodCompute nodes of the Clenshaw—Curtis quadrature rule.
FastTransforms.clenshawcurtisweights
— MethodCompute weights of the Clenshaw—Curtis quadrature rule with modified Chebyshev moments of the first kind $\mu$.
FastTransforms.fejernodes1
— MethodCompute nodes of Fejer's first quadrature rule.
FastTransforms.fejernodes2
— MethodCompute nodes of Fejer's second quadrature rule.
FastTransforms.fejerweights1
— MethodCompute weights of Fejer's first quadrature rule with modified Chebyshev moments of the first kind $\mu$.
FastTransforms.fejerweights2
— MethodCompute weights of Fejer's second quadrature rule with modified Chebyshev moments of the second kind $\mu$.
FastTransforms.forwardrecurrence!
— Methodforwardrecurrence!(v, A, B, C, x)
evaluates the orthogonal polynomials at points x
, where A
, B
, and C
are AbstractVector
s containing the recurrence coefficients as defined in DLMF, overwriting v
with the results.
FastTransforms.gaunt
— MethodCalculates the Gaunt coefficients in 64-bit floating-point arithmetic.
FastTransforms.gaunt
— MethodCalculates the Gaunt coefficients, defined by:
\[a(m,n,\mu,\nu,q) = \frac{2(n+\nu-2q)+1}{2} \frac{(n+\nu-2q-m-\mu)!}{(n+\nu-2q+m+\mu)!} \int_{-1}^{+1} P_n^m(x) P_\nu^\mu(x) P_{n+\nu-2q}^{m+\mu}(x) {\rm\,d}x.\]
or defined by:
\[P_n^m(x) P_\nu^\mu(x) = \sum_{q=0}^{q_{\rm max}} a(m,n,\mu,\nu,q) P_{n+\nu-2q}^{m+\mu}(x)\]
This is a Julia implementation of the stable recurrence described in:
Y.-l. Xu, Fast evaluation of Gaunt coefficients: recursive approach, J. Comp. Appl. Math., 85:53–65, 1997.
FastTransforms.half
— MethodCompute a typed 0.5.
FastTransforms.inufft1
— MethodComputes an inverse nonuniform fast Fourier transform of type I.
FastTransforms.inufft2
— MethodComputes an inverse nonuniform fast Fourier transform of type II.
FastTransforms.ipaduatransform
— MethodInverse Padua Transform maps the 2D Chebyshev coefficients to the values of the interpolation polynomial at the Padua points.
FastTransforms.jac2cheb
— Functionjac2cheb(v::AbstractVector, α, β; normjac::Bool=false, normcheb::Bool=false)
Convert the vector of expansions coefficients v
from a Jacobi basis of order (α,β)
to a Chebyshev basis. The keyword arguments denote whether the bases are normalized.
FastTransforms.jac2jac
— Functionjac2jac(v::AbstractVector, α, β, γ, δ; norm1::Bool=false, norm2::Bool=false)
Convert the vector of expansions coefficients v
from a Jacobi basis of order (α,β)
to a Jacobi basis of order (γ,δ)
. The keyword arguments denote whether the bases are normalized.
FastTransforms.jac2ultra
— Functionjac2ultra(v::AbstractVector, α, β, λ; normjac::Bool=false, normultra::Bool=false)
Convert the vector of expansions coefficients v
from a Jacobi basis of order (α,β)
to an Ultraspherical basis of order λ
. The keyword arguments denote whether the bases are normalized.
FastTransforms.lag2lag
— Functionlag2lag(v::AbstractVector, α, β; norm1::Bool=false, norm2::Bool=false)
Convert the vector of expansions coefficients v
from a Laguerre basis of order α
to a La basis of order β
. The keyword arguments denote whether the bases are normalized.
FastTransforms.lambertw
— MethodThe principal branch of the Lambert-W function, defined by $x = W_0(x) e^{W_0(x)}$, computed using Halley's method for $x \in [-e^{-1},\infty)$.
FastTransforms.leg2cheb
— Functionleg2cheb(v::AbstractVector; normleg::Bool=false, normcheb::Bool=false)
Convert the vector of expansions coefficients v
from a Legendre to a Chebyshev basis. The keyword arguments denote whether the bases are normalized.
FastTransforms.maybereal
— Methodmaybereal(::Type{T}, x)
Return real-valued part of x
if T
is a type of a real number, and x
otherwise.
FastTransforms.modifiedherm2herm
— Functionmodifiedherm2herm(v::AbstractVector{T}, u::Vector{T}; verbose::Bool=false)
modifiedherm2herm(v::AbstractVector{T}, u::Vector{T}, v::Vector{T}; verbose::Bool=false) where {T}
FastTransforms.modifiedjac2jac
— Functionmodifiedjac2jac(v::AbstractVector{T}, α, β, u::Vector{T}; verbose::Bool=false) where {T}
modifiedjac2jac(v::AbstractVector{T}, α, β, u::Vector{T}, v::Vector{T}; verbose::Bool=false) where {T}
FastTransforms.modifiedlag2lag
— Functionmodifiedlag2lag(v::AbstractVector{T}, α, u::Vector{T}; verbose::Bool=false)
modifiedlag2lag(v::AbstractVector{T}, α, u::Vector{T}, v::Vector{T}; verbose::Bool=false) where {T}
FastTransforms.nufft1
— MethodComputes a nonuniform fast Fourier transform of type I:
\[f_j = \sum_{k=0}^{N-1} c_k e^{-2\pi{\rm i} \frac{j}{N} \omega_k},\quad{\rm for}\quad 0 \le j \le N-1.\]
FastTransforms.nufft1
— MethodComputes a 2D nonuniform fast Fourier transform of type I-I:
\[F_{i,j} = \sum_{k=0}^{M-1}\sum_{\ell=0}^{N-1} C_{k,\ell} e^{-2\pi{\rm i} (\frac{i}{M} \omega_k + \frac{j}{N} \pi_{\ell})},\quad{\rm for}\quad 0 \le i \le M-1,\quad 0 \le j \le N-1.\]
FastTransforms.nufft2
— MethodComputes a nonuniform fast Fourier transform of type II:
\[f_j = \sum_{k=0}^{N-1} c_k e^{-2\pi{\rm i} x_j k},\quad{\rm for}\quad 0 \le j \le N-1.\]
FastTransforms.nufft2
— MethodComputes a 2D nonuniform fast Fourier transform of type II-II:
\[F_{i,j} = \sum_{k=0}^{M-1}\sum_{\ell=0}^{N-1} C_{k,\ell} e^{-2\pi{\rm i} (x_i k + y_j \ell)},\quad{\rm for}\quad 0 \le i \le M-1,\quad 0 \le j \le N-1.\]
FastTransforms.nufft3
— MethodComputes a nonuniform fast Fourier transform of type III:
\[f_j = \sum_{k=0}^{N-1} c_k e^{-2\pi{\rm i} x_j \omega_k},\quad{\rm for}\quad 0 \le j \le N-1.\]
FastTransforms.paduapoints
— MethodReturns coordinates of the $(n+1)(n+2)/2$ Padua points.
FastTransforms.paduatransform
— MethodPadua Transform maps from interpolant values at the Padua points to the 2D Chebyshev coefficients.
FastTransforms.paduavalsmat
— MethodCreates $(n+2)x(n+1)$ matrix of interpolant values on the tensor grid at the $(n+1)(n+2)/2$ Padua points.
FastTransforms.paduavec!
— MethodVectorizes the function values at the Padua points.
FastTransforms.plan_inufft1
— MethodPre-computes an inverse nonuniform fast Fourier transform of type I.
FastTransforms.plan_inufft2
— MethodPre-computes an inverse nonuniform fast Fourier transform of type II.
FastTransforms.plan_ipaduatransform!
— MethodPre-plan an Inverse Padua Transform.
FastTransforms.plan_nufft1
— MethodPre-computes a 2D nonuniform fast Fourier transform of type I-I.
FastTransforms.plan_nufft1
— MethodPre-computes a nonuniform fast Fourier transform of type I.
FastTransforms.plan_nufft2
— MethodPre-computes a 2D nonuniform fast Fourier transform of type II-II.
FastTransforms.plan_nufft2
— MethodPre-computes a nonuniform fast Fourier transform of type II.
FastTransforms.plan_nufft3
— MethodPre-computes a nonuniform fast Fourier transform of type III.
FastTransforms.plan_paduatransform!
— MethodPre-plan a Padua Transform.
FastTransforms.pochhammer
— MethodPochhammer symbol $(x)_n = \frac{\Gamma(x+n)}{\Gamma(x)}$ for the rising factorial.
FastTransforms.renew!
— MethodBigFloat
is a mutable struct and there is no guarantee that each entry in an AbstractArray{BigFloat}
is unique. For example, looking at the Limb
s,
Id = Matrix{BigFloat}(I, 3, 3)
map(x->x.d, Id)
shows that the ones and the zeros all share the same pointers. If a C function assumes unicity of each datum, then the array must be renewed with a deepcopy
.
FastTransforms.sphevaluate
— MethodPointwise evaluation of real orthonormal spherical harmonic:
\[Y_\ell^m(\theta,\varphi) = (-1)^{|m|}\sqrt{(\ell+\frac{1}{2})\frac{(\ell-|m|)!}{(\ell+|m|)!}} P_\ell^{|m|}(\cos\theta) \sqrt{\frac{2-\delta_{m,0}}{2\pi}} \left\{\begin{array}{ccc} \cos m\varphi & {\rm for} & m \ge 0,\\ \sin(-m\varphi) & {\rm for} & m < 0.\end{array}\right.\]
FastTransforms.stirlingseries
— MethodStirling's asymptotic series for $\Gamma(z)$.
FastTransforms.trianglecfsmat
— MethodCreates $(n+2)x(n+1)$ Chebyshev coefficient matrix from triangle coefficients.
FastTransforms.trianglecfsvec!
— MethodCreates length $(n+1)(n+2)/2$ vector from matrix of triangle Chebyshev coefficients.
FastTransforms.trievaluate
— MethodPointwise evaluation of triangular harmonic:
\[\tilde{P}_{\ell,m}^{(\alpha,\beta,\gamma)}(x,y).\]
FastTransforms.two
— MethodCompute a typed 2.
FastTransforms.ultra2cheb
— Functionultra2cheb(v::AbstractVector, λ; normultra::Bool=false, normcheb::Bool=false)
Convert the vector of expansions coefficients v
from an Ultraspherical basis of order λ
to a Chebyshev basis. The keyword arguments denote whether the bases are normalized.
FastTransforms.ultra2jac
— Functionultra2jac(v::AbstractVector, λ, α, β; normultra::Bool=false, normjac::Bool=false)
Convert the vector of expansions coefficients v
from an Ultraspherical basis of order λ
to a Jacobi basis of order (α,β)
. The keyword arguments denote whether the bases are normalized.
FastTransforms.ultra2ultra
— Functionultra2ultra(v::AbstractVector, λ, μ; norm1::Bool=false, norm2::Bool=false)
Convert the vector of expansions coefficients v
from an Ultraspherical basis of order λ
to an Ultraspherical basis of order μ
. The keyword arguments denote whether the bases are normalized.
FastTransforms.Λ
— MethodFor 64-bit floating-point arithmetic, the Lambda function uses the asymptotic series for $\tau$ in Appendix B of
I. Bogaert and B. Michiels and J. Fostier, 𝒪(1) computation of Legendre polynomials and Gauss–Legendre nodes and weights for parallel computing, SIAM J. Sci. Comput., 34:C83–C101, 2012.
FastTransforms.Λ
— MethodThe Lambda function $\Lambda(z) = \frac{\Gamma(z+\frac{1}{2})}{\Gamma(z+1)}$ for the ratio of gamma functions.
FastTransforms.Λ
— MethodThe Lambda function $\Lambda(z,λ₁,λ₂) = \frac{\Gamma(z+\lambda_1)}{Γ(z+\lambda_2)}$ for the ratio of gamma functions.
FastTransforms.δ
— MethodThe Kronecker $\delta$ function:
\[\delta_{k,j} = \left\{\begin{array}{ccc} 1 & {\rm for} & k = j,\\ 0 & {\rm for} & k \ne j.\end{array}\right.\]