Skip to content

Commit 40013e8

Browse files
committed
Support 2D Clenshaw on rectangles
1 parent 00b7a65 commit 40013e8

File tree

3 files changed

+35
-4
lines changed

3 files changed

+35
-4
lines changed

Project.toml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "MultivariateOrthogonalPolynomials"
22
uuid = "4f6956fd-4f93-5457-9149-7bfc4b2ce06d"
3-
version = "0.7.2"
3+
version = "0.7.3"
44

55
[deps]
66
ArrayLayouts = "4c555306-a7a7-4459-81d9-ec55ddd5c99a"
@@ -19,6 +19,8 @@ LazyArrays = "5078a376-72f3-5289-bfd5-ec5146d43c02"
1919
LazyBandedMatrices = "d7e5e226-e90b-4449-9968-0f923699bf6f"
2020
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
2121
QuasiArrays = "c4ea9172-b204-11e9-377d-29865faadc5c"
22+
RecurrenceRelationshipArrays = "b889d2dc-af3c-4820-88a8-238fa91d3518"
23+
RecurrenceRelationships = "807425ed-42ea-44d6-a357-6771516d7b2c"
2224
SpecialFunctions = "276daf66-3868-5448-9aa4-cd146d93841b"
2325
StaticArrays = "90137ffa-7385-5640-81b9-e52037218182"
2426
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40"
@@ -31,7 +33,7 @@ BlockBandedMatrices = "0.13"
3133
ClassicalOrthogonalPolynomials = "0.14"
3234
ContinuumArrays = "0.18"
3335
DomainSets = "0.6, 0.7"
34-
FastTransforms = "0.16"
36+
FastTransforms = "0.17"
3537
FillArrays = "1.0"
3638
HarmonicOrthogonalPolynomials = "0.6"
3739
InfiniteArrays = "0.15"

src/rect.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ function Base.unsafe_getindex(f::Mul{MultivariateOPLayout{2},<:DiagTravLayout{<:
148148
P,c = f.A, f.B
149149
A,B = P.args
150150
x,y = 𝐱
151-
clenshaw(clenshaw(paddeddata(c.array), recurrencecoefficients(A)..., x), recurrencecoefficients(B)..., y)
151+
clenshaw(vec(clenshaw(paddeddata(c.array), recurrencecoefficients(A)..., x; dims=1)), recurrencecoefficients(B)..., y)
152152
end
153153

154154
Base.@propagate_inbounds function getindex(f::Mul{MultivariateOPLayout{2},<:DiagTravLayout{<:PaddedLayout}}, x::SVector, j...)

test/test_rect.jl

Lines changed: 30 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using MultivariateOrthogonalPolynomials, ClassicalOrthogonalPolynomials, StaticArrays, LinearAlgebra, BlockArrays, FillArrays, Base64, LazyBandedMatrices, Test
2-
using ClassicalOrthogonalPolynomials: expand
2+
using ClassicalOrthogonalPolynomials: expand, coefficients, recurrencecoefficients
33
using MultivariateOrthogonalPolynomials: weaklaplacian
44
using ContinuumArrays: plotgridvalues
55

@@ -154,4 +154,33 @@ using ContinuumArrays: plotgridvalues
154154
Dₓ = KronTrav(D²,M)
155155
@test Dₓ[Block.(1:1),Block.(1:1)] == Dₓ[Block(1,1)]
156156
end
157+
158+
@testset "variable coefficients" begin
159+
T,U = ChebyshevT(), ChebyshevU()
160+
P = RectPolynomial(T, U)
161+
𝐱 = axes(P,1)
162+
x,y = first.(𝐱), last.(𝐱)
163+
X = P\(x .* P)
164+
Y = P\(y .* P)
165+
166+
@test X isa KronTrav
167+
@test Y isa KronTrav
168+
169+
a = (x,y) -> I + x + 2y + 3x^2 +4x*y + 5y^2
170+
𝐚 = expand(P,splat(a))
171+
A = a(X,Y)
172+
173+
C = LazyBandedMatrices.paddeddata(LazyBandedMatrices.invdiagtrav(coefficients(𝐚)))
174+
m,n = size(C)
175+
using RecurrenceRelationshipArrays
176+
X_T = jacobimatrix(T)
177+
X_U = jacobimatrix(U)
178+
cfs = [Clenshaw(C[1:m-j+1,j], recurrencecoefficients(T)..., X_T) for j=1:n]
179+
180+
181+
KR = Block.(1:3)
182+
183+
@test (KronTrav(Eye(∞),cfs[1]) + KronTrav(2X_U,cfs[2]) + KronTrav((4X_U^2 - I),cfs[3]))[KR,KR]
184+
KronTrav(Eye(3),cfs[1][1:3,1:3]) + KronTrav(2X_U[1:3,1:3],cfs[2][1:3,1:3])+ KronTrav((4X_U^2 - I)[1:3,1:3],cfs[3][1:3,1:3]) A[KR,KR]
185+
end
157186
end

0 commit comments

Comments
 (0)