Skip to content

Commit e68ef94

Browse files
committed
fix multiplication, add in
1 parent 2949750 commit e68ef94

File tree

3 files changed

+23
-4
lines changed

3 files changed

+23
-4
lines changed

src/MultivariateOrthogonalPolynomials.jl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ using Base, RecipesBase, ApproxFun, BandedMatrices, BlockArrays,
77

88
# package code goes here
99
import Base: values,getindex,setindex!,*, +, -, ==,<,<=,>,
10-
>=,/,^,\,,transpose
10+
>=,/,^,\,,transpose, in
1111

1212

1313
import BandedMatrices: inbands_getindex, inbands_setindex!
@@ -33,7 +33,7 @@ import ApproxFun: bandwidths,SpaceOperator, ConversionWrapper, DerivativeWrap
3333

3434
# Spaces import
3535
import ApproxFun: PolynomialSpace, ConstantSpace, NoSpace, prectype,
36-
SumSpace,PiecewiseSpace, ArraySpace,
36+
SumSpace,PiecewiseSpace, ArraySpace, @containsconstants,
3737
UnsetSpace, canonicalspace, canonicaldomain, domain, evaluate,
3838
AnyDomain, plan_transform,plan_itransform,
3939
transform,itransform,transform!,itransform!,

src/Triangle.jl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ end
1111

1212
Triangle() = Triangle(Vec(0,0), Vec(1,0), Vec(0,1))
1313
canonicaldomain(::Triangle) = Triangle()
14+
function in(p::Vec{2,Float64}, d::Triangle)
15+
x,y = tocanonical(d, p)
16+
0  x  x + y  1
17+
end
18+
1419

1520
for op in (:-, :+)
1621
@eval begin
@@ -77,6 +82,8 @@ struct JacobiTriangle <: Space{Triangle,Float64}
7782
domain::Triangle
7883
end
7984

85+
@containsconstants JacobiTriangle
86+
8087
JacobiTriangle() = JacobiTriangle(0,0,0)
8188

8289
points(K::JacobiTriangle, n::Integer) =
@@ -1301,7 +1308,9 @@ function operator_clenshaw2D(Jx,Jy,cfs::Vector{Vector{T}},x,y) where T
13011308
Abk2x=Array{Operator{T}}(undef,N+1); fill!(Abk2x , Z)
13021309
Abk2y=Array{Operator{T}}(undef,N+1); fill!(Abk2y , Z)
13031310

1304-
for K=Block(N):-1:Block(2)
1311+
for= N:-1:2
1312+
K = Block(K̃)
1313+
13051314
Bx,By=view(Jx,K,K),view(Jy,K,K)
13061315
Cx,Cy=view(Jx,K,K+1),view(Jy,K,K+1)
13071316
JxK=view(Jx,K+1,K)
@@ -1355,6 +1364,6 @@ end
13551364

13561365
function Multiplication(f::Fun{JacobiTriangle},S::JacobiTriangle)
13571366
S1=space(f)
1358-
op=operator_clenshaw2D(Lowering{1}(S1)S1,Lowering{2}(S1)S1,plan_evaluate(f).coefficients,Lowering{1}(S)S,Lowering{2}(S)S)
1367+
op=operator_clenshaw2D(jacobioperators(S1)...,plan_evaluate(f).coefficients,jacobioperators(S)...)
13591368
MultiplicationWrapper(f,op)
13601369
end

test/TriangleTest.jl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,3 +407,13 @@ end
407407
@time g=Fun(f,rangespace(QR))
408408
@time \(QR,g;tolerance=1E-7)
409409
end
410+
411+
@testset "Multiplication" begin
412+
x,y = Fun(Triangle())
413+
M_0 = Multiplication(one(x), space(x))
414+
testbandedblockbandedoperator(M_0)
415+
@test M_0*x x
416+
@test space(1+x) isa JacobiTriangle
417+
M = Multiplication(1+x, space(x))
418+
@test (M*y)(0.1,0.2) (1+0.1)*0.2
419+
end

0 commit comments

Comments
 (0)