@@ -220,18 +220,24 @@ end
220
220
# # Derivative
221
221
222
222
# 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
223
233
224
234
for (Op,OpWrap) in ((:Derivative ,:DerivativeWrapper ),(:Integral ,:IntegralWrapper ))
225
235
_Op = Symbol (:_ , Op)
226
236
@eval begin
227
237
@inline function $_Op (S:: PiecewiseSpace , k:: Number )
228
238
assert_integer (k)
229
239
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)
235
241
$ OpWrap (O,k)
236
242
end
237
243
@inline function $_Op (S:: ArraySpace , k:: Number )
257
263
# mixed bases.
258
264
if typeof (canonicaldomain (S))== typeof (domain (S))
259
265
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)
265
267
DerivativeWrapper (O,k)
266
268
else
267
269
DefaultDerivative (S,k)
@@ -297,8 +299,7 @@ function Multiplication(f::Fun{<:PiecewiseSpace}, sp::PiecewiseSpace)
297
299
p= perm (domain (f). domains,domain (sp). domains) # sort f
298
300
vf= components (f)[p]
299
301
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)
302
303
MultiplicationWrapper (f, O)
303
304
end
304
305
@@ -307,8 +308,7 @@ Multiplication(f::Fun{SumSpace{SV1,D,R1}},sp::SumSpace{SV2,D,R2}) where {SV1,SV2
307
308
308
309
function Multiplication (f:: Fun , sp:: SumSpace )
309
310
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)
312
312
MultiplicationWrapper (f, O)
313
313
end
314
314
0 commit comments