Skip to content
This repository was archived by the owner on Jul 19, 2023. It is now read-only.

Commit 710492c

Browse files
sparse concretizations
1 parent a74edce commit 710492c

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/derivative_operators/BC_operators.jl

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,9 +121,19 @@ function LinearAlgebra.Array(Q::AffineBC{T,V}, N::Int) where {T,V}
121121
return (Array(Q_L), Q_b)
122122
end
123123

124-
LinearAlgebra.Array(Q::PeriodicBC{T}, N::Int) where T = [transpose(zeros(T, N-1)) one(T); Diagonal(ones(T,N)); one(T) transpose(zeros(T, N-1))]
125-
#TODO: Concretize DirichletBC
124+
function SparseArrays.SparseMatrixCSC(Q::AffineBC{T,V}, N::Int) where {T,V}
125+
Q_L = [transpose(Q.a_l) transpose(zeros(T, N-length(Q.a_l))); Diagonal(ones(T,N)); transpose(zeros(T, N-length(Q.a_r))) transpose(Q.a_r)]
126+
Q_b = [Q.b_l; zeros(T,N); Q.b_r]
127+
return (Q_L, Q_b)
128+
end
129+
130+
function SparseArrays.sparse(Q::AffineBC{T,V}, N::Int) where {T,V}
131+
SparseMatrixCSC(Q,N)
132+
end
126133

134+
LinearAlgebra.Array(Q::PeriodicBC{T}, N::Int) where T = Array([transpose(zeros(T, N-1)) one(T); Diagonal(ones(T,N)); one(T) transpose(zeros(T, N-1))])
135+
SparseArrays.SparseMatrixCSC(Q::PeriodicBC{T}, N::Int) where T = [transpose(zeros(T, N-1)) one(T); Diagonal(ones(T,N)); one(T) transpose(zeros(T, N-1))]
136+
SparseArrays.sparse(Q::PeriodicBC{T}, N::Int) where T = SparseMatrixCSC(Q,N)
127137

128138
function LinearAlgebra.Array(Q::BoundaryPaddedVector)
129139
return [Q.l; Q.u; Q.r]

0 commit comments

Comments
 (0)