Skip to content

Commit a920e89

Browse files
authored
Accept domainspace in MultiplcationWrapper (#341)
1 parent 5e94508 commit a920e89

File tree

3 files changed

+16
-6
lines changed

3 files changed

+16
-6
lines changed

Project.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "ApproxFunBase"
22
uuid = "fbd15aa5-315a-5a7d-a8a4-24992e37be05"
3-
version = "0.7.58"
3+
version = "0.7.59"
44

55
[deps]
66
AbstractFFTs = "621f4979-c628-5d54-868e-fcf4e3e8185c"

src/Operators/banded/Multiplication.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,8 +95,13 @@ struct MultiplicationWrapper{D<:Space,S<:Space,O<:Operator,T} <: Multiplication{
9595
op::O
9696
end
9797

98-
MultiplicationWrapper(T::Type,f::Fun{D,V},op::Operator) where {D<:Space,V} = MultiplicationWrapper{D,typeof(domainspace(op)),typeof(op),T}(f,op)
99-
MultiplicationWrapper(f::Fun{D,V},op::Operator) where {D<:Space,V} = MultiplicationWrapper(eltype(op),f,op)
98+
function MultiplicationWrapper(::Type{T}, f::Fun{D}, op::Operator,
99+
dspop::S = domainspace(op)) where {D,T,S<:Space}
100+
MultiplicationWrapper{D,S,typeof(op),T}(f,op)
101+
end
102+
function MultiplicationWrapper(f::Fun, op::Operator, dspop::Space = domainspace(op))
103+
MultiplicationWrapper(eltype(op), f, op, dspop)
104+
end
100105

101106
@wrapper MultiplicationWrapper
102107

test/runtests.jl

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -171,12 +171,17 @@ end
171171
sp = PointSpace(1:3)
172172
coeff = [1:3;]
173173
f = Fun(sp, coeff)
174-
for sp2 in Any[(), (sp,)]
174+
for sp2 in ((), (sp,))
175175
a = Multiplication(f, sp2...)
176176
b = Multiplication(f, sp2...)
177177
@test a == b
178178
@test bandwidths(a) == bandwidths(b)
179179
end
180+
M = Multiplication(f, sp) * Multiplication(f, sp)
181+
M1 = ApproxFunBase.MultiplicationWrapper(f, M)
182+
M2 = ApproxFunBase.MultiplicationWrapper(eltype(M), f, M)
183+
M3 = @inferred ApproxFunBase.MultiplicationWrapper(f, M, sp)
184+
@test M1 * f M2 * f M3 * f
180185
end
181186
@testset "TimesOperator" begin
182187
sp = PointSpace(1:3)
@@ -191,7 +196,7 @@ end
191196
end
192197
@testset "unwrap TimesOperator" begin
193198
M = Multiplication(f)
194-
for ops in Any[Operator{Float64}[M, M * M], Operator{Float64}[M*M, M]]
199+
for ops in (Operator{Float64}[M, M * M], Operator{Float64}[M*M, M])
195200
@test TimesOperator(ops).ops == [M, M, M]
196201
end
197202
end
@@ -219,7 +224,7 @@ end
219224
op = @inferred M + t * M
220225
@test bandwidths(op) == bandwidths(M)
221226
@test coefficients(op * f) == @. (1+t)*c^2
222-
for op2 in Any[M + M + t * M, op + M]
227+
for op2 in (M + M + t * M, op + M)
223228
@test bandwidths(op2) == bandwidths(M)
224229
@test coefficients(op2 * f) == @. (2+t)*c^2
225230
end

0 commit comments

Comments
 (0)