Skip to content

Commit d3d3a27

Browse files
use the higher level planning
1 parent dd5bce3 commit d3d3a27

File tree

2 files changed

+10
-10
lines changed

2 files changed

+10
-10
lines changed

examples/disk.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,18 @@ using FastTransforms, LinearAlgebra
2222

2323
f = (x,y) -> (x^2-y^2+1)/((x^2-y^2+1)^2+(2x*y+1)^2)
2424

25-
N = 15
25+
N = 5
2626
M = 4N-3
2727

2828
r = [sinpi((N-n-0.5)/(2N)) for n in 0:N-1]
29-
θ = 2*(0:M-1)/M # mod π.
30-
31-
P = plan_disk2cxf(Float64, N)
32-
PA = plan_disk_analysis(Float64, N, M)
29+
θ = (0:M-1)*2/M # mod π.
3330

3431
# On the mapped tensor product grid, our function samples are:
3532
F = [f(r*cospi(θ), r*sinpi(θ)) for r in r, θ in θ]
3633

34+
P = plan_disk2cxf(F)
35+
PA = plan_disk_analysis(F)
36+
3737
# Its Zernike coefficients are:
3838
U = P\(PA*F)
3939

examples/triangle.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,6 @@ M = N
3434

3535
α, β, γ = 0, 0, 0
3636

37-
P = plan_tri2cheb(Float64, N, α, β, γ)
38-
Px = plan_tri2cheb(Float64, N, α+1, β, γ+1)
39-
Py = plan_tri2cheb(Float64, N, α, β+1, γ+1)
40-
PA = plan_tri_analysis(Float64, N, M)
41-
4237
u = [sinpi((N-2n-1)/(2N)) for n in 0:N-1]
4338
v = [sinpi((M-2m-1)/(2M)) for m in 0:M-1]
4439

@@ -52,6 +47,9 @@ w = [sinpi((2M-2m-1)/(4M))^2 for m in 0:M-1]
5247
# On the mapped tensor product grid, our function samples are:
5348
F = [f(x[n+1], x[N-n]*w[m+1]) for n in 0:N-1, m in 0:M-1]
5449

50+
P = plan_tri2cheb(F, α, β, γ)
51+
PA = plan_tri_analysis(F)
52+
5553
# Its Proriol-(α,β,γ) coefficients are:
5654
U = P\(PA*F)
5755

@@ -72,6 +70,7 @@ for m = 0:M-2
7270
Gx[n+1, m+1] = cf1*U[n+2, m+1] + cf2*U[n+1, m+2]
7371
end
7472
end
73+
Px = plan_tri2cheb(Fx, α+1, β, γ+1)
7574
Ux = Px\(PA*Fx)
7675

7776
Gy = zeros(Float64, N, M)
@@ -80,6 +79,7 @@ for m = 0:M-2
8079
Gy[n+1, m+1] = 4*sqrt((m+1)*(m+β+γ+2))*U[n+1, m+2]
8180
end
8281
end
82+
Py = plan_tri2cheb(Fy, α, β+1, γ+1)
8383
Uy = Py\(PA*Fy)
8484

8585
# The 2-norm relative error in differentiating the Proriol series

0 commit comments

Comments
 (0)