@@ -165,25 +165,23 @@ function chebyshev_filter(k)
165
165
Φ1 = zeros (k, k)
166
166
ϕ, ψ1, ψ2 = chebyshev_ϕ_ψ (k)
167
167
168
- # ----------------------------------------------------------
169
-
170
- # x = Symbol('x')
171
- # kUse = 2*k
172
- # roots = Poly(chebyshevt(kUse, 2*x-1)).all_roots()
173
- # x_m = np.array([rt.evalf(20) for rt in roots]).astype(np.float64)
174
- # # x_m[x_m==0.5] = 0.5 + 1e-8 # add small noise to avoid the case of 0.5 belonging to both phi(2x) and phi(2x-1)
175
- # # not needed for our purpose here, we use even k always to avoid
176
- # wm = np.pi / kUse / 2
177
-
178
- # for ki in range(k):
179
- # for kpi in range(k):
180
- # H0[ki, kpi] = 1/np.sqrt(2) * (wm * phi[ki](x_m/2) * phi[kpi](x_m)).sum()
181
- # G0[ki, kpi] = 1/np.sqrt(2) * (wm * psi(psi1, psi2, ki, x_m/2) * phi[kpi](x_m)).sum()
182
- # H1[ki, kpi] = 1/np.sqrt(2) * (wm * phi[ki]((x_m+1)/2) * phi[kpi](x_m)).sum()
183
- # G1[ki, kpi] = 1/np.sqrt(2) * (wm * psi(psi1, psi2, ki, (x_m+1)/2) * phi[kpi](x_m)).sum()
184
-
185
- # PHI0[ki, kpi] = (wm * phi[ki](2*x_m) * phi[kpi](2*x_m)).sum() * 2
186
- # PHI1[ki, kpi] = (wm * phi[ki](2*x_m-1) * phi[kpi](2*x_m-1)).sum() * 2
168
+ k_use = 2 k
169
+ c = convert (Polynomial, gen_poly (Chebyshev, k_use))
170
+ x_m = roots (c (Polynomial ([- 1 , 2 ]))) # 2x-1
171
+ # x_m[x_m==0.5] = 0.5 + 1e-8 # add small noise to avoid the case of 0.5 belonging to both phi(2x) and phi(2x-1)
172
+ # not needed for our purpose here, we use even k always to avoid
173
+ wm = π / k_use / 2
174
+
175
+ for ki in 0 : (k- 1 )
176
+ for kpi in 0 : (k- 1 )
177
+ H0[ki+ 1 , kpi+ 1 ] = 1 / sqrt (2 ) * sum (wm .* ϕ[ki+ 1 ]. (x_m/ 2 ) .* ϕ[kpi+ 1 ]. (x_m))
178
+ H1[ki+ 1 , kpi+ 1 ] = 1 / sqrt (2 ) * sum (wm .* ϕ[ki+ 1 ]. ((x_m.+ 1 )/ 2 ) .* ϕ[kpi+ 1 ]. (x_m))
179
+ G0[ki+ 1 , kpi+ 1 ] = 1 / sqrt (2 ) * sum (wm .* ψ (ψ1, ψ2, ki, x_m/ 2 ) .* ϕ[kpi+ 1 ]. (x_m))
180
+ G1[ki+ 1 , kpi+ 1 ] = 1 / sqrt (2 ) * sum (wm .* ψ (ψ1, ψ2, ki, (x_m.+ 1 )/ 2 ) .* ϕ[kpi+ 1 ]. (x_m))
181
+ Φ0[ki+ 1 , kpi+ 1 ] = 2 * sum (wm .* ϕ[ki+ 1 ]. (2 x_m) .* ϕ[kpi+ 1 ]. (2 x_m))
182
+ Φ1[ki+ 1 , kpi+ 1 ] = 2 * sum (wm .* ϕ[ki+ 1 ]. (2 .* x_m .- 1 ) .* ϕ[kpi+ 1 ]. (2 .* x_m .- 1 ))
183
+ end
184
+ end
187
185
188
186
zero_out! (H0)
189
187
zero_out! (H1)
0 commit comments