Skip to content

Commit

Permalink
fix conversion to BandedMAtrix for coupling of one Legendre operator
Browse files Browse the repository at this point in the history
  • Loading branch information
ranocha committed Apr 28, 2020
1 parent 32d2b47 commit d2fe719
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion Project.toml
@@ -1,7 +1,7 @@
name = "SummationByPartsOperators"
uuid = "9f78cca6-572e-554e-b819-917d2f1cf240"
author = ["Hendrik Ranocha"]
version = "0.4.0"
version = "0.4.1"

[deps]
ArgCheck = "dce04be8-c92d-5529-be00-80e4d2c0e197"
Expand Down
5 changes: 3 additions & 2 deletions src/banded_matrices.jl
Expand Up @@ -30,7 +30,7 @@ function BandedMatrix(D::BandedDerivativeOperator)
e[j] = 1
mul!(dest, D, e)
e[j] = 0
B.data[end-j-l+1:end,j] = dest[1:j+l]
B.data[end-j-l+1:end-j-l+min(j+l,length(e)),j] = dest[1:min(j+l,length(e))]
end
# inner part
for j in max(l,u)+1:length(e)-max(l,u)
Expand All @@ -44,7 +44,8 @@ function BandedMatrix(D::BandedDerivativeOperator)
e[j] = 1
mul!(dest, D, e)
e[j] = 0
B.data[1:length(e)+1-j+u,j] = dest[j-u:end]
# B.data[1:length(e)+1-j+u,j] = dest[j-u:end]
B.data[1+max(1,j-u)-(j-u):length(e)+1-j+u,j] = dest[max(1,j-u):end]
end

B
Expand Down
4 changes: 1 addition & 3 deletions test/coupling_test.jl
Expand Up @@ -36,9 +36,7 @@ using SummationByPartsOperators
@test u v
@test integrate(u, cD) sum(mass_matrix(cD) * u)
@test integrate(u->u^2, u, cD) sum(u' * mass_matrix(cD) * u)
if N > 1
@test cD * u BandedMatrix(cD) * u
end
@test cD * u BandedMatrix(cD) * u
@test cD * u Matrix(cD) * u
@test cD * u sparse(cD) * u
end
Expand Down

0 comments on commit d2fe719

Please sign in to comment.