@@ -493,33 +493,30 @@ haswrapperstructure(_) = false
493
493
#
494
494
# Ex: c*op or real(op)
495
495
macro wrapperstructure (Wrap)
496
- ret = quote
497
- ApproxFunBase. haswrapperstructure (:: $Wrap ) = true
498
- end
499
-
500
- for func in (:(ApproxFunBase. bandwidths),:(LinearAlgebra. stride),
496
+ v1 = map ((:(ApproxFunBase. bandwidths),:(LinearAlgebra. stride),
501
497
:(ApproxFunBase. isbandedblockbanded),:(ApproxFunBase. isblockbanded),
502
498
:(ApproxFunBase. israggedbelow),:(Base. size),:(ApproxFunBase. isbanded),
503
499
:(ApproxFunBase. blockbandwidths),:(ApproxFunBase. subblockbandwidths),
504
- :(LinearAlgebra. issymmetric))
505
- ret = quote
506
- $ ret
500
+ :(LinearAlgebra. issymmetric))) do func
507
501
508
- $ func (D:: $Wrap ) = $ func (D. op)
509
- end
502
+ :($ func (D:: $Wrap ) = $ func (D. op))
510
503
end
511
504
512
- for func in (:(ApproxFunBase. bandwidth),:(ApproxFunBase. colstart),:(ApproxFunBase. colstop),
505
+ v2 = map ( (:(ApproxFunBase. bandwidth),:(ApproxFunBase. colstart),:(ApproxFunBase. colstop),
513
506
:(ApproxFunBase. rowstart),:(ApproxFunBase. rowstop),:(ApproxFunBase. blockbandwidth),
514
- :(Base. size),:(ApproxFunBase. subblockbandwidth))
515
- ret = quote
516
- $ ret
517
-
507
+ :(Base. size),:(ApproxFunBase. subblockbandwidth))) do func
508
+ quote
518
509
$ func (D:: $Wrap ,k:: Integer ) = $ func (D. op,k)
519
510
$ func (A:: $Wrap ,i:: ApproxFunBase.PosInfinity ) = ℵ₀ # $func(A.op,i) | see PR #42
520
- end
511
+ end
521
512
end
522
513
514
+ ret = quote
515
+ ApproxFunBase. haswrapperstructure (:: $Wrap ) = true
516
+ $ (v1... )
517
+ $ (v2... )
518
+ end
519
+
523
520
esc (ret)
524
521
end
525
522
529
526
# not necessarily the same spaces
530
527
#
531
528
macro wrappergetindex (Wrap)
529
+ v = map ((:(ApproxFunBase. BandedMatrix),:(ApproxFunBase. RaggedMatrix),
530
+ :Matrix ,:Vector ,:AbstractVector )) do TYP
531
+ quote
532
+ $ TYP (P:: ApproxFunBase.SubOperator{T,OP} ) where {T,OP<: $Wrap } =
533
+ $ TYP (view (parent (P). op,P. indexes[1 ],P. indexes[2 ]))
534
+ $ TYP (P:: ApproxFunBase.SubOperator{T,OP,NTuple{2,UnitRange{Int}}} ) where {T,OP<: $Wrap } =
535
+ $ TYP (view (parent (P). op,P. indexes[1 ],P. indexes[2 ]))
536
+ end
537
+ end
538
+
532
539
ret = quote
540
+ $ (v... )
541
+
533
542
Base. getindex (OP:: $Wrap ,k:: Integer... ) =
534
543
OP. op[k... ]:: eltype (OP)
535
544
@@ -549,22 +558,6 @@ macro wrappergetindex(Wrap)
549
558
ApproxFunBase. mul_coefficients (view (parent (A). op,S. indexes[1 ],S. indexes[2 ]),b)
550
559
551
560
isdiag (W:: $Wrap ) = isdiag (W. op)
552
- end
553
-
554
- for TYP in (:(ApproxFunBase. BandedMatrix),:(ApproxFunBase. RaggedMatrix),
555
- :Matrix ,:Vector ,:AbstractVector )
556
- ret = quote
557
- $ ret
558
-
559
- $ TYP (P:: ApproxFunBase.SubOperator{T,OP} ) where {T,OP<: $Wrap } =
560
- $ TYP (view (parent (P). op,P. indexes[1 ],P. indexes[2 ]))
561
- $ TYP (P:: ApproxFunBase.SubOperator{T,OP,NTuple{2,UnitRange{Int}}} ) where {T,OP<: $Wrap } =
562
- $ TYP (view (parent (P). op,P. indexes[1 ],P. indexes[2 ]))
563
- end
564
- end
565
-
566
- ret = quote
567
- $ ret
568
561
569
562
# fast converts to banded matrices would be based on indices, not blocks
570
563
function ApproxFunBase. BandedMatrix (S:: ApproxFunBase.SubOperator{T,OP,NTuple{2,ApproxFunBase.BlockRange1}} ) where {T,OP<: $Wrap }
@@ -618,16 +611,16 @@ end
618
611
# use this for wrapper operators that have the same spaces but
619
612
# not necessarily the same entries or structure
620
613
#
621
- macro wrapperspaces (Wrap)
622
- ret = quote end
623
-
624
- for func in ( :(ApproxFunBase. rangespace),:(ApproxFunBase . domain),
625
- :(ApproxFunBase . domainspace),:(ApproxFunBase . isconstop))
626
- ret = quote
627
- $ ret
628
-
629
- $ func (D :: $Wrap ) = $ func (D . op)
630
- end
614
+ macro wrapperspaces (Wrap, forwarddomain = true )
615
+ fns = [:(ApproxFunBase . rangespace),:(ApproxFunBase . domain), :(ApproxFunBase . isconstop)]
616
+ if forwarddomain
617
+ fns = [fns; :(ApproxFunBase. domainspace)]
618
+ end
619
+ v = map (fns) do func
620
+ :( $ func (D :: $Wrap ) = $ func (D . op))
621
+ end
622
+ ret = quote
623
+ $ (v ... )
631
624
end
632
625
633
626
esc (ret)
@@ -636,10 +629,10 @@ end
636
629
637
630
# use this for wrapper operators that have the same entries and same spaces
638
631
#
639
- macro wrapper (Wrap)
632
+ macro wrapper (Wrap, forwarddomain = true )
640
633
ret = quote
641
634
ApproxFunBase. @wrappergetindex ($ Wrap)
642
- ApproxFunBase. @wrapperspaces ($ Wrap)
635
+ ApproxFunBase. @wrapperspaces ($ Wrap, $ forwarddomain )
643
636
644
637
ApproxFunBase. iswrapper (:: $Wrap ) = true
645
638
end
0 commit comments