Skip to content

Commit 19376c5

Browse files
committed
Ensure non-overlapping restrictions work as well
1 parent 68f8625 commit 19376c5

File tree

2 files changed

+8
-3
lines changed

2 files changed

+8
-3
lines changed

src/restricted_bases.jl

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,13 @@ end
4141

4242
function combined_restriction(A,B)
4343
lsel,rsel = combined_restriction_selection(A,B)
44-
l = lsel[1]-rsel[1]
45-
BandedMatrices._BandedMatrix(Ones{Int}(1,size(B,2)), axes(A,2), l,-l)
44+
l,u,r = if !isempty(lsel)
45+
l = lsel[1]-rsel[1]
46+
l, -l, 1
47+
else
48+
-1, -1, 0
49+
end
50+
BandedMatrices._BandedMatrix(Ones{Int}(r,size(B,2)), axes(A,2), l,u)
4651
end
4752

4853
function show(io::IO, B̃::RestrictedQuasiArray{<:Any,2})

test/restricted_bases.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
(FEDVR(range(0, stop=1.0, length=30), 6), "FE-DVR")
44
(StaggeredFiniteDifferences(100, 0.1), "Finite-differences")
55
]
6-
for (A,B) in [(R,R), (R,R[:,6:20]), (R[:,6:20],R[:,3:80])]
6+
for (A,B) in [(R,R), (R,R[:,6:20]), (R[:,6:20],R[:,3:80]), (R[:,6:20],R[:,30:80])]
77
rA = CompactBases.restriction(A)
88
rB = CompactBases.restriction(B)
99

0 commit comments

Comments
 (0)