@@ -184,10 +184,13 @@ bandwidths(A::Operator) = opbandwidths(A)
184
184
# the gcd with any number < 10 is the number
185
185
stride (A:: Operator ) = opstride (A:: Operator )
186
186
187
- isdiag (A:: Operator ) = bandwidths (A)== (0 ,0 )
187
+ isdiag (A:: Operator ) = opisdiag (A)
188
+
188
189
istriu (A:: Operator ) = bandwidth (A, 1 ) <= 0
189
190
istril (A:: Operator ) = bandwidth (A, 2 ) <= 0
190
191
192
+ issymmetric (A:: Operator ) = opissymmetric (A)
193
+
191
194
192
195
# # Construct operators
193
196
@@ -523,15 +526,19 @@ defaultsize(A, k) = k==1 ? dimension(rangespace(A)) : dimension(domainspace(A))
523
526
@traitfn opsize (A:: X , k:: Integer ) where {X; ! HasWrapperStructure{X}} =
524
527
defaultsize (A, k)
525
528
529
+ @traitfn opisdiag (A:: X ) where {X; ! HasWrapperStructure{X}} = bandwidths (A)== (0 ,0 )
530
+ @traitfn opissymmetric (A:: X ) where {X; ! HasWrapperStructure{X}} = false
531
+
526
532
for f in [:size , :stride , :bandwidths , :blockbandwidths , :subblockbandwidths ,
527
- :israggedbelow , :isbanded , :isblockbanded , :isbandedblockbanded ]
533
+ :israggedbelow , :isbanded , :isblockbanded , :isbandedblockbanded ,
534
+ :issymmetric , :isdiag ]
528
535
opf = Symbol (:op , f)
529
536
@eval begin
530
537
@traitfn $ opf (A:: X ) where {X; HasWrapperStructure{X}} = $ f (A. op)
531
538
end
532
539
end
533
540
534
- for f in [:size ]
541
+ for f in [:size , :bandwidth , :blockbandwidth , :subblockbandwidth ]
535
542
opf = Symbol (:op , f)
536
543
@eval begin
537
544
@traitfn $ opf (A:: X , k:: Integer ) where {X; HasWrapperStructure{X}} = $ f (A. op, k)
@@ -543,17 +550,10 @@ end
543
550
#
544
551
# Ex: c*op or real(op)
545
552
macro wrapperstructure (Wrap)
546
- fns = [:(LinearAlgebra. issymmetric)]
553
+ fns2 = [:(ApproxFunBase. colstart),:(ApproxFunBase. colstop),
554
+ :(ApproxFunBase. rowstart),:(ApproxFunBase. rowstop)]
547
555
548
- v1 = map (fns) do func
549
- :($ func (D:: $Wrap ) = $ func (D. op))
550
- end
551
-
552
- fns2 = [:(ApproxFunBase. bandwidth),:(ApproxFunBase. colstart),:(ApproxFunBase. colstop),
553
- :(ApproxFunBase. rowstart),:(ApproxFunBase. rowstop),:(ApproxFunBase. blockbandwidth),
554
- :(ApproxFunBase. subblockbandwidth)]
555
-
556
- v2 = map (fns2) do func
556
+ v = map (fns2) do func
557
557
quote
558
558
$ func (D:: $Wrap ,k:: Integer ) = $ func (D. op,k)
559
559
$ func (A:: $Wrap ,i:: ApproxFunBase.PosInfinity ) = ℵ₀ # $func(A.op,i) | see PR #42
@@ -562,8 +562,7 @@ macro wrapperstructure(Wrap)
562
562
563
563
ret = quote
564
564
ApproxFunBase. haswrapperstructure (:: Type{<:$Wrap} ) = true
565
- $ (v1... )
566
- $ (v2... )
565
+ $ (v... )
567
566
end
568
567
569
568
esc (ret)
@@ -606,8 +605,6 @@ macro wrappergetindex(Wrap)
606
605
ApproxFunBase. mul_coefficients (A:: ApproxFunBase.SubOperator{T,OP} ,b) where {T,OP<: $Wrap } =
607
606
ApproxFunBase. mul_coefficients (view (parent (A). op,A. indexes[1 ],A. indexes[2 ]),b)
608
607
609
- LinearAlgebra. isdiag (W:: $Wrap ) = LinearAlgebra. isdiag (W. op)
610
-
611
608
# fast converts to banded matrices would be based on indices, not blocks
612
609
function ApproxFunBase. BandedMatrix (S:: ApproxFunBase.SubOperator{T,OP,NTuple{2,ApproxFunBase.BlockRange1}} ) where {T,OP<: $Wrap }
613
610
A = parent (S)
0 commit comments