Skip to content

Commit 6b7cbb1

Browse files
authored
size for infinite bandwidth plusoperator (#148)
1 parent 8f1a381 commit 6b7cbb1

File tree

2 files changed

+12
-1
lines changed

2 files changed

+12
-1
lines changed

src/Operators/general/algebra.jl

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,9 @@ struct PlusOperator{T,BI} <: Operator{T}
1616
end
1717
end
1818

19-
Base.size(P::PlusOperator,k::Integer) = size(first(P.ops),k)
19+
_size(::PlusOperator{<:Any, NTuple{2,InfiniteCardinal{0}}}, k) = InfiniteCardinal{0}()
20+
_size(P, k) = size(first(P.ops),k)
21+
Base.size(P::PlusOperator,k::Integer) = _size(P, k)
2022

2123
bandwidthsmax(ops) = mapreduce(bandwidths, (t1,t2) -> max.(t1, t2), ops, init = (-720, -720) #= approximate (-∞,-∞) =#)
2224

test/SpacesTest.jl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,15 @@ using ApproxFunOrthogonalPolynomials
7676
@test union(s, s, s, s) == s
7777
end
7878
end
79+
80+
M = Multiplication(Fun(PointSpace(1:3), [1:3;]), PointSpace(1:3))
81+
@test (@inferred size(M)) == (3,3)
82+
M2 = M + M
83+
@test size(M2) == (3,3)
84+
M = Multiplication(Fun(PointSpace(1:3), [1:3;]))
85+
M2 = M + M
86+
infty = ApproxFunBase.InfiniteCardinal{0}()
87+
@test (@inferred size(M2)) == (infty, infty)
7988
end
8089

8190
@testset "Derivative operator for HeavisideSpace" begin

0 commit comments

Comments
 (0)