### Setup FastTransforms and Plotting Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Initializes the FastTransforms library, sets up a directory for generated figures, and configures the plotting backend. Ensure FastTransforms is installed and accessible. ```julia using FastTransforms, LinearAlgebra, Plots const GENFIGS = joinpath(pkgdir(FastTransforms), "docs/src/generated") !isdir(GENFIGS) && mkdir(GENFIGS) plotlyjs() ``` ```julia Plots.PlotlyJSBackend() ``` -------------------------------- ### Spherical Harmonic Coefficients Example Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/sphere This represents a matrix of spherical harmonic coefficients. These values are typically used as input for transformations or evaluations. ```text 0.105958 -0.834521 -0.225101 -0.515565 0.886148 0.287159 0.290046 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.530802 -0.266039 -0.0717606 -0.261012 0.448626 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.668154 0.140073 0.0377829 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.390394 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 0.0 ``` -------------------------------- ### Load FastTransforms Package Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/dev Once the package is built from source, it can be loaded using the `using` keyword. This action may trigger pre-compilation if it hasn't been done already. ```julia julia> using FastTransforms [ Info: Precompiling FastTransforms [057dd010-8810-581a-b7be-e3fc3b93f78c] ``` -------------------------------- ### Import FastTransforms Package Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/padua Import the necessary FastTransforms package for numerical computations. ```julia using FastTransforms ``` -------------------------------- ### Plan FFTW Chebyshev-Fourier Analysis on Disk Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Creates an FFTW Chebyshev-Fourier analysis plan for data on the unit disk. This plan is used to analyze the function `F` on the disk. ```julia PA = plan_disk_analysis(F) ``` -------------------------------- ### Plan Disk to Chebyshev-Fourier Transform Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Precomputes a generalized Zernike-Chebyshev-Fourier plan for the given array `F`. This plan is used for transforming data on the disk to Chebyshev-Fourier coefficients. ```julia α, β = 0, 0 P = plan_disk2cxf(F, α, β) ``` -------------------------------- ### Import FastTransforms and LinearAlgebra Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/subspaceangles Imports necessary libraries for fast transforms and linear algebra operations. ```julia using FastTransforms, LinearAlgebra ``` -------------------------------- ### FastTransforms for Triangle Calculus Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle This snippet demonstrates the use of FastTransforms library for calculus on a triangle. It involves planning a transform and then applying it to compute Ux. ```julia Px = plan_tri2cheb(Fx, α+1, β, γ+1) Ux = Px\(PA*Fx) ``` -------------------------------- ### Precomputing an FFTW Chebyshev² analysis plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Creates a FastTransforms plan for FFTW Chebyshev analysis on a rectangularized disk. This is used for analyzing data on the disk using FFTW's Chebyshev transform capabilities. ```julia PA = plan_rectdisk_analysis(F) ``` -------------------------------- ### Build FastTransforms Package Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/dev After setting the environment variable, use the `build` command in the Julia package manager to compile FastTransforms.jl from source. This process also builds dependencies like FFTW and TimeZones. ```julia (@v1.5) pkg> build FastTransforms Building FFTW ──────────→ `~/.julia/packages/FFTW/ayqyZ/deps/build.log` Building TimeZones ─────→ `~/.julia/packages/TimeZones/K98G0/deps/build.log` Building FastTransforms → `~/.julia/dev/FastTransforms/deps/build.log` ``` -------------------------------- ### Sample Function on Mapped Grid Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Calculates the function samples on the N x M mapped tensor product grid. It uses the previously defined x and z grid points. ```julia F = [f(x[n], w[n]*z) for n in 1:N, z in z] ``` ```julia 30×30 Matrix{Float64}: 0.383725 0.383905 0.384264 0.384798 0.3855 0.386365 0.387383 0.388542 0.389832 0.391237 0.392744 0.394337 0.395997 0.397708 0.399451 0.401207 0.402957 0.404681 0.406361 0.407977 0.409512 0.410949 0.41227 0.413462 0.41451 0.415403 0.41613 0.416683 0.417055 0.417242 0.353509 0.354039 0.355094 0.356664 0.358732 0.36128 0.364281 0.367707 0.371524 0.375695 0.380177 0.384927 0.389897 0.395036 0.400292 0.405609 0.41093 0.416197 0.421352 0.426336 0.431089 0.435556 0.439683 0.443417 0.446713 0.449527 0.451824 0.453573 0.454752 0.455346 0.325652 0.32653 0.328275 0.330873 0.334296 0.338513 0.343483 0.349158 0.355488 0.362412 0.36987 0.377792 0.386108 0.394741 0.40361 0.412629 0.421708 0.43075 0.439655 0.44832 0.456637 0.464501 0.471805 0.478449 0.484336 0.489382 0.493512 0.496665 0.498793 0.499866 0.29943 0.300665 0.303122 0.306774 0.311585 0.317506 0.324478 0.332436 0.341308 0.351018 0.361484 0.372625 0.384354 0.396582 0.409213 0.422145 0.435264 0.448446 0.461551 0.474426 0.486904 0.498809 0.50996 0.520175 0.529284 0.537127 0.54357 0.548501 0.551834 0.553515 0.274261 0.275876 0.279088 0.283858 0.290132 0.297838 0.306895 0.317212 0.328692 0.341239 0.354758 0.36916 0.384358 0.400269 0.416811 0.43389 0.451401 0.469213 0.487163 0.505054 0.522647 0.539669 0.555819 0.570781 0.584246 0.595923 0.605564 0.612965 0.617979 0.620509 0.249651 0.251685 0.255724 0.261714 0.269574 0.279203 0.290482 0.303282 0.31747 0.332923 0.349529 0.367198 0.385862 0.405474 0.426001 0.44741 0.469656 0.492656 0.516277 0.540305 0.564443 0.588294 0.611378 0.633149 0.653036 0.670489 0.685018 0.696234 0.703855 0.707707 ``` -------------------------------- ### Calculate SHA256 of Release Tarball (Julia) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/dev Download the tarball using curl, then use Julia's SHA.jl package to compute the SHA256 hash of the downloaded file. Remember to clean up the tarball. ```shell shell> curl https://codeload.github.com/MikaelSlevinsky/FastTransforms/tar.gz/v0.6.2 --output FastTransforms.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 168k 0 168k 0 0 442k 0 --:--:-- --:--:-- --:--:-- 443k ``` ```julia julia> using SHA julia> open("FastTransforms.tar.gz") do f bytes2hex(sha256(f)) end "fd00befcb0c20ba962a8744a7b9139355071ee95be70420de005b7c0f6e023aa" shell> rm -f FastTransforms.tar.gz ``` -------------------------------- ### Function Samples Matrix Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Displays the resulting matrix of function samples on the tensor product grid. ```julia 10×19 Matrix{ComplexF64}: 0.628413+0.77788im 0.613246+0.789892im 0.603399+0.79744im 0.600106+0.79992im 0.603786+0.797146im 0.613972+0.789328im 0.629387+0.777092im 0.64815+0.761513im 0.668065+0.744103im 0.686931+0.726723im 0.702801+0.711386im 0.71416+0.699982im 0.720001+0.693973im 0.71983+0.694151im 0.713662+0.700491im 0.702017+0.71216im 0.685934+0.727664im 0.666955+0.745098im 0.647044+0.762452im 0.626742+0.779227im 0.582025+0.813171im 0.552374+0.833596im 0.542362+0.840145im 0.55355+0.832816im 0.584193+0.811615im 0.629571+0.776943im 0.68294+0.730474im 0.736952+0.675945im 0.785185+0.619262im 0.823211+0.567736im 0.848825+0.528674im 0.861428+0.507879im 0.861065+0.508495im 0.84773+0.530428im 0.821392+0.570364im 0.782715+0.62238im 0.734019+0.679129im 0.679858+0.733344im 0.690857+0.722991im 0.625071+0.780568im 0.580335+0.814378im 0.565059+0.82505im 0.582122+0.813101im 0.628309+0.777964im 0.694941+0.719066im 0.769832+0.638246im 0.840471+0.541857im 0.897514+0.440985im 0.936972+0.349406im 0.959893+0.280368im 0.969821+0.243819im 0.969549+0.244899im 0.958985+0.283457im 0.935221+0.354065im 0.894765+0.446538im 0.836798+0.547511im 0.76563+0.643282im 0.799876+0.600166im 0.729022+0.68449im 0.678871+0.734257im 0.661444+0.749994im 0.680901+0.732375im 0.732596+0.680663im 0.804139+0.594441im 0.878702+0.477371im 0.940401+0.340068im 0.97989+0.199537im 0.997175+0.0751106im 0.999864-0.0165003im 0.997938-0.0641824im 0.998027-0.062782im 0.999923-0.0124432im 0.996684+0.0813636im 0.978303+0.207181im 0.937478+0.348046im 0.874727+0.484617im 0.914598+0.404364im 0.858511+0.512795im 0.815749+0.578405im 0.800419+0.599441im 0.81752+0.5759im 0.861473+0.507803im 0.917769+0.397116im 0.967817+0.251653im 0.996186+0.0872572im 0.99722-0.07452im 0.977203-0.212305im 0.950621-0.310353im 0.93288-0.360187im 0.933439-0.358735im 0.952008-0.306074im 0.978656-0.205506im 0.997827-0.065887im 0.99532+0.0966353im 0.965471+0.260509im 0.989052+0.147569im 0.963701+0.266985im 0.939852+0.341582im 0.930644+0.365927im 0.940896+0.338696im 0.965234+0.261387im 0.990188+0.13974im 0.999905-0.0137846im 0.983699-0.179822im 0.94183-0.33609im 0.88602-0.463647im 0.834409-0.551146im 0.804097-0.594498im 0.805021-0.593247im 0.836879-0.547388im 0.889222-0.457475im 0.944703-0.327927im 0.985349-0.170549im 0.999989-0.00462386im 0.99096-0.134156im 0.999703-0.0243628im 0.998928+0.0462861im 0.997566+0.0697274im 0.999053+0.0435207im 0.999562-0.0295972im 0.989978-0.141225im 0.960887-0.276941im 0.908431-0.418034im 0.837893-0.545834im 0.762849-0.646576im 0.700449-0.713703im 0.665602-0.746307im 0.666649-0.745372im 0.703339-0.710855im 0.76689-0.641779im 0.842129-0.539276im 0.91195-0.410301im 0.963143-0.26899im 0.919472-0.393156im 0.950297-0.311346im 0.966254-0.257589im 0.970887-0.23954im 0.965686-0.259711im 0.948995-0.315292im 0.91723-0.398357im 0.867837-0.49685im 0.802371-0.596825im 0.727938-0.685643im 0.656033-0.754733im 0.599431-0.800426im 0.568692-0.82255im 0.569608-0.821916im 0.602006-0.798492im 0.659781-0.751458im 0.732172-0.68112im 0.806377-0.591401im 0.871077-0.491147im 0.80566-0.592379im 0.837633-0.546233im 0.856754-0.515725im 0.862863-0.505438im 0.856026-0.516933im 0.836173-0.548466im 0.8035-0.595305im 0.759389-0.650637im 0.707251-0.706962im 0.652712-0.757606im 0.602883-0.79783im 0.564968-0.825113im 0.544739-0.838606im 0.545338-0.838216im 0.566673-0.823943im 0.605429-0.795899im 0.655721-0.755004im 0.710305-0.703894im 0.762122-0.647434im ``` -------------------------------- ### Sample Function on Mapped Grid Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Samples the defined function f(x,y) on the mapped tensor product grid. The results are stored in a matrix F, representing the function values at the grid points. ```julia F = [f(x[n+1], x[N-n]*w[m+1]) for n in 0:N-1, m in 0:M-1] ``` -------------------------------- ### Sample Function on Tensor Product Grid Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Samples the function F(r) = exp(i k⋅r) on the defined tensor product grid of θ and φ. ```julia F = [exp(im*(k⋅r(θ,φ))) for θ in θ, φ in φ] ``` -------------------------------- ### Precomputing a Dunkl-Xu–Chebyshev plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Creates a FastTransforms plan for Dunkl-Xu–Chebyshev² transformations on a given array F. This plan is used for transforming data between the disk and Chebyshev coefficients. ```julia P = plan_rectdisk2cheb(F, β) ``` -------------------------------- ### Compare Grid Transformations Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Compares the generated x and u grids, and the w and v grids, to verify the relationship between the standard and mapped grids. This check ensures the transformation formulas are correctly applied. ```julia ((1 .+ u)./2 ≈ x) * ((1 .- u).*(1 .+ v')/4 ≈ reverse(x).*w') ``` -------------------------------- ### Apply Plan and Adjoint Plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/subspaceangles Applies the forward plan to the identity matrix and then the adjoint plan to compute the V^T V matrix, which is essential for calculating inner products. ```julia VtV = parent(P*I) lmul!(P', VtV) ``` -------------------------------- ### Plotting a surface on the unit disk Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Generates a 3D surface plot of a function fff over the unit disk and saves it as an HTML file. Requires pre-defined X, Y, and F variables. ```julia X = [x for x in x, z in z] Y = [w*z for w in w, z in z] scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:green) surface!(X, Y, F; legend=false, xlabel="x", ylabel="y", zlabel="f") savefig(joinpath(GENFIGS, "dunklxu.html")) ``` -------------------------------- ### Sample Function on Tensor Product Grid Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/sphere Samples a function on a tensor product grid using FastTransforms. This involves calculating a point on the grid and then using it to compute the function values. ```julia Pnxy = FastTransforms.clenshaw!([0.0], c, A, B, C, [x⋅y], [1.0])[1] F = [(F[n, m] - Pnxy)/(z(θ[n], φ[m])⋅y - x⋅y) for n in 1:N, m in 1:M] ``` -------------------------------- ### Precompute Spin-0 Spherical Harmonic-Fourier Plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Precomputes a plan for spin-0 spherical harmonic to Fourier transforms. This is useful for optimizing repeated transformations. ```julia P = plan_spinsph2fourier(F, 0) ``` -------------------------------- ### GramMatrix(cnm1::AbstractVector, cn::AbstractVector, X::AbstractMatrix) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Construct a GramMatrix from its last two columns and the multiplication operator. The recurrence is built from XᵀW=WX and is used when the moment method is unstable. ```APIDOC ## `GramMatrix(cnm1::AbstractVector, cn::AbstractVector, X::AbstractMatrix)` ### Description Construct a GramMatrix from its last two columns and the multiplication operator. The recurrence is built from XᵀW=WX and is used when the moment method is unstable (such as with Laguerre). ### Parameters - **cnm1** (AbstractVector) - The second to last column of the Gram matrix. - **cn** (AbstractVector) - The last column of the Gram matrix. - **X** (AbstractMatrix) - Multiplication operator. ``` -------------------------------- ### Set Environment Variable to Build from Source Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/dev Set the FT_BUILD_FROM_SOURCE environment variable to "true" to trigger the build script for FastTransforms.jl. This allows developers to experiment with bleeding-edge source code. ```julia julia> ENV["FT_BUILD_FROM_SOURCE"] = "true" "true" ``` -------------------------------- ### Initialize Chebyshev Transform Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/chebyshev Initializes the size `n` for Chebyshev transform operations. ```julia using FastTransforms n = 20 ``` -------------------------------- ### Precompute FFTW Chebyshev² Plan on Triangle Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Generates an FFTW Chebyshev² plan for analysis on a triangular domain. This plan is used for analyzing function representations on the triangle. ```julia PA = plan_tri_analysis(F) ``` -------------------------------- ### Construct GramMatrix with AbstractMatrix Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Constructs a symmetric positive-definite Gram matrix. Use when the inner product definition is available. ```julia GramMatrix(W::AbstractMatrix, X::AbstractMatrix) ``` -------------------------------- ### Create Function Approximation using Padua Coefficients Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/padua Construct an approximation function f̃(x, y) using the computed Padua transform coefficients. ```julia f̃ = (x,y) -> begin j = 1 ret = 0.0 for n in 0:N, k in 0:n ret += f̌[j]*cos((n-k)*acos(x)) * cos(k*acos(y)) j += 1 end ret end ``` -------------------------------- ### Initial guess for lambda Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/automaticdifferentiation Sets the initial guess for the parameter lambda, which will be optimized. ```julia λ = 1.0 ``` -------------------------------- ### Sample Function on Tensor Product Grid Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Samples the defined harmonic function 'f' on the mapped tensor product grid defined by the radial points 'r' and angular points 'θ'. ```julia F = [f(r*cospi(θ), r*sinpi(θ)) for r in r, θ in θ] ``` -------------------------------- ### Calculate Fx Gradient Samples Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle This code calculates the gradient samples for the Fx component over a grid defined by N and M. It uses a function `fx` and specific sampling points `x` and `w`. ```julia Fx = [fx(x[n+1], x[N-n]*w[m+1]) for n in 0:N-1, m in 0:M-1] ``` -------------------------------- ### Plotting Function on the Unit Disk Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Generates a 3D surface plot of the function `F` on the unit disk and saves it as an HTML file. Requires `X`, `Y`, and `F` to be defined. ```julia X = [r*cospi(θ) for r in r, θ in θ] Y = [r*sinpi(θ) for r in r, θ in θ] scatter3d(vec(X), vec(Y), vec(0F); markersize=0.75, markercolor=:red) surface!(X, Y, F; legend=false, xlabel="x", ylabel="y", zlabel="f") savefig(joinpath(GENFIGS, "zernike.html")) ``` -------------------------------- ### Precompute Laguerre-Laguerre Plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/subspaceangles Creates a plan for transforming between Laguerre polynomial bases, including normalization for inner product calculations. ```julia P = plan_lag2lag(Float64, N, α, β; norm2=true) ``` -------------------------------- ### Calculate SHA256 of Release Tarball (Shell) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/dev Use curl to download the tarball and shasum to calculate its SHA256 hash on macOS. Ensure to remove the downloaded file afterwards. ```shell shell> curl https://codeload.github.com/MikaelSlevinsky/FastTransforms/tar.gz/v0.6.2 --output FastTransforms.tar.gz % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 168k 0 168k 0 0 429k 0 --:--:-- --:--:-- --:--:-- 429k shell> shasum -a 256 FastTransforms.tar.gz fd00befcb0c20ba962a8744a7b9139355071ee95be70420de005b7c0f6e023aa FastTransforms.tar.gz shell> rm -f FastTransforms.tar.gz ``` -------------------------------- ### Verify Inverse Padua Transform Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/padua Confirm that applying the inverse Padua transform to the coefficients recovers the function values on the grid. ```julia ipaduatransform(f̌) ≈ f̃.(x,y) ``` -------------------------------- ### Compute Legendre Polynomial Coefficients and Grid Points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/sphere Calculates coefficients A, B, C for Legendre polynomial evaluation, sets up a constant vector 'c', and computes the dot products of grid points 'z' with vector 'y'. ```julia A = [(2k+1)/(k+1) for k in 0:N-1] B = zeros(N) C = [k/(k+1) for k in 0:N] c = zeros(N); c[N] = 1 pts = vec([z(θ, φ)⋅y for θ in θ, φ in φ]) phi0 = ones(N*M) F = reshape(FastTransforms.clenshaw!(zeros(N*M), c, A, B, C, pts, phi0), N, M) ``` ```julia 15×29 Matrix{Float64}: 0.264259 0.299171 0.304985 0.288068 0.261038 0.237692 0.228241 0.236528 0.259192 0.286391 0.304437 0.300462 0.26755 0.207601 0.130208 0.0483744 -0.0262845 -0.0865116 -0.129804 -0.156955 -0.170403 -0.170403 -0.158265 -0.132139 -0.0899937 -0.0308858 0.0429655 0.124641 0.202756 0.212068 0.303332 0.129215 -0.186607 -0.387155 -0.383993 -0.338172 -0.379747 -0.392602 -0.206438 0.109443 0.299961 0.225231 -0.0101802 -0.207053 -0.258628 -0.187516 -0.070652 0.0323131 0.0988479 0.12977 0.130741 0.102005 0.0380582 -0.0627707 -0.180155 -0.256899 -0.215501 -0.0267606 -0.115553 0.236712 0.221776 -0.251073 -0.32857 0.421619 0.986223 0.482429 -0.299585 -0.280602 0.198511 0.253762 -0.0930651 -0.258938 -0.0793421 0.160653 0.233501 0.154045 0.0336174 -0.0560314 -0.0990238 -0.100375 -0.0604041 0.0261339 0.145985 0.231751 0.1719 -0.0610864 -0.255787 -0.18454 -0.186901 0.216999 0.207436 -0.278408 -0.36511 -0.189358 -0.35156 -0.304334 0.180746 0.238643 -0.165767 -0.202157 0.128252 0.217098 -0.00943667 -0.200512 -0.194373 -0.0821865 0.0208264 0.0732008 0.0748654 0.0260895 -0.074028 -0.188494 -0.206184 -0.027257 0.20837 0.147067 0.233218 -0.0443128 -0.25662 0.0443223 0.302577 0.209245 0.107407 0.198264 0.305263 0.0716125 -0.25045 -0.0709297 0.228915 0.0560634 -0.209167 -0.109098 0.135993 0.209367 0.121014 0.0107106 -0.049922 -0.0518826 0.00472316 0.112882 0.206906 0.148044 -0.0921222 -0.214775 0.0327421 -0.14959 0.176398 0.159536 -0.157586 -0.253853 -0.135785 -0.0630475 -0.127292 -0.249419 -0.174706 0.141057 0.191837 -0.130845 -0.171771 0.128955 0.181407 -0.058914 -0.206946 -0.154207 -0.0410986 0.0276329 0.029906 -0.034464 -0.146673 -0.208687 -0.0754426 0.17029 0.145612 -0.156134 ``` -------------------------------- ### Generate Radial Grid Points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Creates the radial grid points 'r' for sampling the function on the unit disk. The points are distributed according to a specific formula related to Chebyshev polynomials. ```julia r = [sinpi((N-n-0.5)/(2N)) for n in 0:N-1] ``` -------------------------------- ### Plan Spin-Spherical Harmonic to Fourier Transform Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Use this function to create a plan for transforming spin-weighted spherical harmonic data to Fourier space. Requires the input data and the spin value. ```julia P = plan_spinsph2fourier(F, 1) ``` -------------------------------- ### Compute Proriol-(α,β,γ) Coefficients Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Calculates the Proriol-(α,β,γ) coefficients of a function F by applying a Proriol–Chebyshev² plan (P) and an FFTW Chebyshev² analysis plan (PA). ```julia U = P\(PA*F) ``` -------------------------------- ### Precompute spherical analysis plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/automaticdifferentiation Creates a plan for Fourier analysis on the sphere using FFTW. This is used to transform data from a grid to spherical harmonic coefficients. ```julia PA = plan_sph_analysis(Float64, N, M) ``` -------------------------------- ### Plan Spin-Spherical Harmonic Analysis Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Use this function to create a plan for analyzing spin-weighted spherical harmonic data. Requires the input data and the spin value. ```julia PA = plan_spinsph_analysis(F, 1) ``` -------------------------------- ### FastTransforms.stirlingseries Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Stirling's asymptotic series for Γ(z). ```APIDOC ## FastTransforms.stirlingseries — Function Stirling's asymptotic series for Γ(z)\Gamma(z)Γ(z). ``` -------------------------------- ### Generate Mapped W Grid Points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Generates the w grid points using a squared sinpi transformation, analogous to the x grid generation. These points are used in conjunction with the x grid for sampling. ```julia w = [sinpi((2M-2m-1)/(4M))^2 for m in 0:M-1] ``` -------------------------------- ### Precompute Spin-Weighted Spherical Harmonic Analysis Plan Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/spinweighted Precomputes a plan for spin-weighted spherical harmonic analysis using FFTW on the sphere. This plan is used for transforming data from spherical coordinates to spherical harmonic coefficients. ```julia PA = plan_spinsph_analysis(F, 0) ``` -------------------------------- ### FastTransforms.half Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Compute a typed 0.5. ```APIDOC ## FastTransforms.half — Function Compute a typed 0.5. ``` -------------------------------- ### Set Proriol Series Parameters Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle Defines the parameters alpha, beta, and gamma for the Proriol series. These parameters influence the series expansion. ```julia α, β, γ = 0, 0, 0 ``` -------------------------------- ### Integral Approximation on Unit Disk Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Approximates the integral of f(x,y)^2 over the disk using the squared norm of coefficients. The second value is a constant related to the integral. ```julia norm(U)^2, π/(2*sqrt(2))*log1p(sqrt(2)) ``` ```julia (0.9789599193439185, 0.9789599179781414) ``` -------------------------------- ### Calculate Integral of P0,0^2 * sqrt(pi) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk This code calculates the integral of P0,0^2 multiplied by the square root of pi, which should approximate pi/2 by harmonicity. ```julia U[1, 1]*sqrt(π) ``` ```julia 1.5707955409153043 ``` -------------------------------- ### Compute Partial Derivative with respect to y (Julia) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle This code calculates the partial derivative with respect to y for a function represented by a Proriol series. It initializes a matrix Gy and iterates through the series coefficients to compute the derivative values. ```julia Gy = zeros(Float64, N, M) for m = 0:M-2 for n = 0:N-2 Gy[n+1, m+1] = 4*sqrt((m+1)*(m+β+γ+2))*U[n+1, m+2] end end Py = plan_tri2cheb(Fy, α, β+1, γ+1) Uy = Py\(PA*Fy) ``` -------------------------------- ### GramMatrix(W::AbstractMatrix, X::AbstractMatrix) Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Construct a symmetric positive-definite Gram matrix with data stored in W. Given a family of orthogonal polynomials P(x) and an inner product ⟨f,g⟩, the Gram matrix is defined by W[i,j]=⟨pi−1,pj−1⟩. It satisfies a skew-symmetric rank-2 displacement equation. ```APIDOC ## `GramMatrix(W::AbstractMatrix, X::AbstractMatrix)` ### Description Construct a symmetric positive-definite Gram matrix with data stored in W. Given a family of orthogonal polynomials P(x) and an inner product ⟨f,g⟩, the Gram matrix is defined by W[i,j]=⟨pi−1,pj−1⟩. It satisfies a skew-symmetric rank-2 displacement equation (XᵀW−WX=GJGᵀ). ### Parameters - **W** (AbstractMatrix) - Data for the Gram matrix. - **X** (AbstractMatrix) - Transposed Jacobi matrix satisfying xP(x)=P(x)X. ``` -------------------------------- ### Calculate Fy Gradient Samples Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/triangle This code calculates the gradient samples for the Fy component over a grid defined by N and M. It uses a function `fy` and specific sampling points `x` and `w`. ```julia Fy = [fy(x[n+1], x[N-n]*w[m+1]) for n in 0:N-1, m in 0:M-1] ``` -------------------------------- ### Inverse Chebyshev Transform: First Kind Polynomials to Points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/chebyshev Performs the inverse transform from Chebyshev polynomials of the first kind back to Chebyshev points of the first kind. ```julia ichebyshevtransform(f̌, Val(1)) ≈ exp.(p_1) ``` -------------------------------- ### Construct GramMatrix with Last Two Columns and Multiplication Operator Source: https://juliaapproximation.github.io/FastTransforms.jl/dev Constructs a GramMatrix using the last two columns and the multiplication operator. This is suitable for cases where the moment method is unstable, such as with Laguerre polynomials. ```julia GramMatrix(cnm1::AbstractVector, cn::AbstractVector, X::AbstractMatrix) ``` -------------------------------- ### Calculate x-grid points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/disk Generates the x-coordinates for the grid using the sine function. This is used for sampling on the rectangularized disk. ```julia w = [sinpi((n+0.5)/N) for n in 0:N-1] x = [sinpi((N-2n-1)/(2N)) for n in 0:N-1] ``` ```julia 30-element Vector{Float64}: 0.9986295347545738 0.9876883405951378 0.9659258262890683 0.9335804264972017 0.8910065241883678 0.838670567945424 0.7771459614569709 0.7071067811865475 0.6293203910498375 0.5446390350150271 0.45399049973954675 0.35836794954530027 0.25881904510252074 0.15643446504023087 0.052335956242943835 -0.052335956242943835 -0.15643446504023087 -0.25881904510252074 -0.35836794954530027 -0.45399049973954675 -0.5446390350150271 -0.6293203910498375 -0.7071067811865475 -0.7771459614569709 -0.838670567945424 -0.8910065241883678 -0.9335804264972017 -0.9659258262890683 -0.9876883405951378 -0.9986295347545738 ``` -------------------------------- ### Inverse Chebyshev Transform: Second Kind Polynomials to First Kind Points Source: https://juliaapproximation.github.io/FastTransforms.jl/dev/generated/chebyshev Performs the inverse transform from Chebyshev polynomials of the second kind back to Chebyshev points of the first kind. ```julia ichebyshevutransform(f̌, Val(1)) ≈ exp.(p_1) ```