Skip to content
This repository has been archived by the owner on May 17, 2020. It is now read-only.

Commit

Permalink
Scalar operators in blocked form
Browse files Browse the repository at this point in the history
  • Loading branch information
jagot committed Nov 19, 2018
1 parent c8fe902 commit fbdf556
Showing 1 changed file with 19 additions and 1 deletion.
20 changes: 19 additions & 1 deletion src/basis.jl
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,31 @@ function (basis::Basis)(x::AbstractVector)
evaluate!(basis, x, χ)
end

DiagonalBlockDiagonal(A::AbstractMatrix, (rows,cols)::Tuple) =
BandedBlockBandedMatrix(A, (rows,cols), (0,0), (0,0))

DiagonalBlockDiagonal(A::AbstractMatrix, rows) =
DiagonalBlockDiagonal(A, (rows,rows))

"""
basis(f)
Generate the scalar operator corresponding to `f(x)` on the FEDVR
`basis`.
"""
(basis::Basis)(f::Function) = Diagonal(f.(locs(basis.grid)))
(basis::Basis)(f::Function) = basis(Diagonal(f.(locs(basis.grid))))

"""
basis(D)
Generate the diagonal matrix with the appropriate block structure for
the FEDVR `basis`.
"""
function (basis::Basis)(D::Diagonal)
n = basecount(basis)
@assert size(D) == (n,n)
DiagonalBlockDiagonal(D, block_structure(basis))
end

"""
basis(I)
Expand Down

0 comments on commit fbdf556

Please sign in to comment.