@@ -60,11 +60,43 @@ function getindex(Z::Zernike{T}, rθ::RadialCoordinate, B::BlockIndex{1}) where
60
60
if iszero (m)
61
61
sqrt (convert (T,2 )/ π) * Normalized (Legendre {T} ())[2 r^ 2 - 1 , ℓ ÷ 2 + 1 ]
62
62
else
63
- convert (T,2 ^ (( m+ 2 )/ 2 )) / π * r^ m * Normalized (Jacobi {T} (0 , m))[2 r^ 2 - 1 ,(ℓ- m) ÷ 2 + 1 ] * (isodd (k+ ℓ) ? cos (m* θ) : sin (m* θ))
63
+ sqrt ( convert (T,2 ) ^ ( m+ 2 )/ π) * r^ m * Normalized (Jacobi {T} (0 , m))[2 r^ 2 - 1 ,(ℓ- m) ÷ 2 + 1 ] * (isodd (k+ ℓ) ? cos (m* θ) : sin (m* θ))
64
64
end
65
65
end
66
66
67
67
68
68
getindex (Z:: Zernike , xy:: StaticVector{2} , B:: BlockIndex{1} ) = Z[RadialCoordinate (xy), B]
69
69
getindex (Z:: Zernike , xy:: StaticVector{2} , B:: Block{1} ) = [Z[xy, B[j]] for j= 1 : Int (B)]
70
- getindex (Z:: Zernike , xy:: StaticVector{2} , JR:: BlockOneTo ) = mortar ([Z[xy,Block (J)] for J = 1 : Int (JR[end ])])
70
+ getindex (Z:: Zernike , xy:: StaticVector{2} , JR:: BlockOneTo ) = mortar ([Z[xy,Block (J)] for J = 1 : Int (JR[end ])])
71
+
72
+
73
+ # ##
74
+ # Transforms
75
+ # ##
76
+
77
+ const FiniteZernike{T} = SubQuasiArray{T,2 ,Zernike{T},<: Tuple {<: Inclusion ,<: BlockSlice{BlockRange1{OneTo{Int}}} }}
78
+
79
+ function grid (S:: FiniteZernike{T} ) where T
80
+ N = blocksize (S,2 ) ÷ 2 + 1 # polynomial degree
81
+ M = 4 N- 3
82
+
83
+ r = sinpi .((N .- (0 : N- 1 ) .- one (T)/ 2 ) ./ (2 N))
84
+
85
+ # The angular grid:
86
+ θ = (0 : M- 1 )* convert (T,2 )/ M
87
+ RadialCoordinate .(r, π* θ' )
88
+ end
89
+
90
+ struct ZernikeTransform{T} <: Plan{T}
91
+ N:: Int
92
+ disk2cxf:: FastTransforms.FTPlan{T,2,FastTransforms.DISK}
93
+ analysis:: FastTransforms.FTPlan{T,2,FastTransforms.DISKANALYSIS}
94
+ end
95
+
96
+ function ZernikeTransform {T} (N:: Int ) where T<: Real
97
+ Ñ = N ÷ 2 + 1
98
+ ZernikeTransform {T} (N, plan_disk2cxf (T, Ñ, 0 , 0 ), plan_disk_analysis (T, Ñ, 4 Ñ- 3 ))
99
+ end
100
+ * (P:: ZernikeTransform{T} , f:: Matrix{T} ) where T = DiskTrav (P. disk2cxf \ (P. analysis * f))[Block .(1 : P. N)]
101
+
102
+ factorize (S:: FiniteZernike{T} ) where T = TransformFactorization (grid (S), ZernikeTransform {T} (blocksize (S,2 )))
0 commit comments