Skip to content

Commit ca44d15

Browse files
committed
Fix tests
1 parent b90d8ad commit ca44d15

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

src/Operators/SubOperator.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -189,6 +189,8 @@ end
189189
view(V::SubOperator, kr, jr) = view(V.parent,reindex(V,parentindices(V),(kr,jr))...)
190190
view(V::SubOperator,kr::InfRanges,jr::InfRanges) = view(V.parent,reindex(V,parentindices(V),(kr,jr))...)
191191

192+
view(A::SubOperator,::Colon,jr) = view(A,1:size(A,1),jr)
193+
192194
bandwidths(S::SubOperator) = S.bandwidths
193195
function colstop(S::SubOperator{<:Any,<:Any,NTuple{2,UnitRange{Int}}},j::Integer)
194196
cs = colstop(parent(S),parentindices(S)[2][j])

test/runtests.jl

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -373,18 +373,20 @@ end
373373
f = Fun(PointSpace(1:10))
374374
M = Multiplication(f, space(f))
375375
T = TimesOperator([M,M])
376-
S = view(T, 1:2:7, 1:2:7)
377-
B = BandedMatrix(S)
378-
for I in CartesianIndices(B)
379-
@test B[I] S[Tuple(I)...]
376+
for S in (view(T, 1:2:7, 1:2:7), view(M, :, 1:3), view(M, 1:3, :))
377+
B = BandedMatrix(S)
378+
for I in CartesianIndices(B)
379+
@test B[I] S[Tuple(I)...]
380+
end
380381
end
381382
end
382383
@testset "mul_coefficients" begin
383384
sp1 = PointSpace(1:3)
384385
sp2 = PointSpace(2:4)
385386
S = ApproxFunBase.SpaceOperator(Conversion(sp1, sp1), sp2, sp2)
386-
@test mul_coefficients(view(S, 1:3, 1:3), [1.0, 1.0, 1.0]) == [1.0, 1.0]
387-
@test mul_coefficients(view(S, Block(1), Block(1)), [1.0, 1.0, 1.0]) == [1.0, 1.0]
387+
v = [1.0, 2.0, 2.0]
388+
@test mul_coefficients(view(S, axes(S)...), v) == v
389+
@test mul_coefficients(view(S, Block(1), Block(1)), v) == v
388390
end
389391
end
390392
@testset "conversion to a matrix" begin

0 commit comments

Comments
 (0)