Skip to content

Commit b74e415

Browse files
committed
multiplication
1 parent 9fee83f commit b74e415

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/Spaces/ProductSpaceOperators.jl

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,24 @@ end
220220
## Derivative
221221

222222
#TODO: do in @calculus_operator?
223+
_spacename(::SumSpace) = SumSpace
224+
_spacename(::PiecewiseSpace) = PiecewiseSpace
225+
226+
function InterlaceOperator_Diagonal(t, S)
227+
allbanded = all(isbanded, t)
228+
ds, rs = S, _spacename(S)(map(rangespace, t))
229+
D = Diagonal(convert_vector_or_svector(t))
230+
bw = interlace_bandwidths(D, ds, rs, allbanded)
231+
InterlaceOperator(D, ds, rs, bw)
232+
end
223233

224234
for (Op,OpWrap) in ((:Derivative,:DerivativeWrapper),(:Integral,:IntegralWrapper))
225235
_Op = Symbol(:_, Op)
226236
@eval begin
227237
@inline function $_Op(S::PiecewiseSpace, k::Number)
228238
assert_integer(k)
229239
t = map(s->$Op(s,k),components(S))
230-
allbanded = all(isbanded, t)
231-
ds, rs = S, PiecewiseSpace(map(rangespace, t))
232-
D = Diagonal(convert_vector_or_svector(t))
233-
bw = interlace_bandwidths(D, ds, rs, allbanded)
234-
O = InterlaceOperator(D, ds, rs, bw)
240+
O = InterlaceOperator_Diagonal(t, S)
235241
$OpWrap(O,k)
236242
end
237243
@inline function $_Op(S::ArraySpace, k::Number)
@@ -257,11 +263,7 @@ end
257263
# mixed bases.
258264
if typeof(canonicaldomain(S))==typeof(domain(S))
259265
t = map(s->Derivative(s,k),components(S))
260-
allbanded = all(isbanded, t)
261-
D = Diagonal(convert_vector_or_svector(t))
262-
ds, rs = S, SumSpace(map(rangespace, t))
263-
bw = interlace_bandwidths(D, ds, rs, allbanded)
264-
O = InterlaceOperator(D, ds, rs, bw)
266+
O = InterlaceOperator_Diagonal(t, S)
265267
DerivativeWrapper(O,k)
266268
else
267269
DefaultDerivative(S,k)
@@ -297,8 +299,7 @@ function Multiplication(f::Fun{<:PiecewiseSpace}, sp::PiecewiseSpace)
297299
p=perm(domain(f).domains,domain(sp).domains) # sort f
298300
vf=components(f)[p]
299301
t = map(Multiplication,vf,sp.spaces)
300-
D = Diagonal(convert_vector_or_svector(t))
301-
O = InterlaceOperator(D, PiecewiseSpace)
302+
O = InterlaceOperator_Diagonal(t, sp)
302303
MultiplicationWrapper(f, O)
303304
end
304305

@@ -307,8 +308,7 @@ Multiplication(f::Fun{SumSpace{SV1,D,R1}},sp::SumSpace{SV2,D,R2}) where {SV1,SV2
307308

308309
function Multiplication(f::Fun, sp::SumSpace)
309310
t = map(s->Multiplication(f,s),components(sp))
310-
D = Diagonal(convert_vector_or_svector(t))
311-
O = InterlaceOperator(D, SumSpace)
311+
O = InterlaceOperator_Diagonal(t, sp)
312312
MultiplicationWrapper(f, O)
313313
end
314314

0 commit comments

Comments
 (0)