Skip to content

Commit 8aec3b5

Browse files
authored
LowRankOperator: change vector convert to map over eltype (#438)
* LowRankOperator: change vector convert to map over eltype * remove unused constructor
1 parent d9dae13 commit 8aec3b5

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

src/Operators/almostbanded/LowRankOperator.jl

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,14 @@ function LowRankOperator(U::Vector{VFun{S,T1}}, V::Vector{<:Operator}) where {S,
3232
LowRankOperator(strictconvert(Vector{VFun{S,T}},U), map(Operator{T}, V))
3333
end
3434

35+
LowRankOperator(A::Fun, B::Operator) = LowRankOperator([A], [B])
3536

36-
LowRankOperator(B::AbstractVector,S...) = LowRankOperator(strictconvert(Vector{Operator{Float64}},B),S...)
3737

38-
LowRankOperator(A::Fun,B::Operator) = LowRankOperator([A],[B])
39-
40-
41-
convert(::Type{Operator{T}},L::LowRankOperator{S}) where {S,T} =
38+
function convert(::Type{Operator{T}},L::LowRankOperator{S}) where {S,T}
39+
L isa Operator{T} && return L
4240
LowRankOperator{S,T}(strictconvert(Vector{VFun{S,T}},L.U),
43-
strictconvert(Vector{Operator{T}},L.V))
41+
map(Operator{T}, L.V))
42+
end
4443

4544

4645
datasize(L::LowRankOperator,k) =
@@ -55,9 +54,9 @@ promotedomainspace(L::LowRankOperator,sp::Space) = LowRankOperator(L.U,map(v->pr
5554

5655
function Base.getindex(L::LowRankOperator, k::Integer,j::Integer)
5756
ret=zero(eltype(L))
58-
for p in eachindex(L.U)
59-
if k ncoefficients(L.U[p])
60-
ret += coefficient(L.U[p], k) * L.V[p][j]
57+
for (p, LUp) in enumerate(L.U)
58+
if k ncoefficients(LUp)
59+
ret += coefficient(LUp, k) * L.V[p][j]
6160
end
6261
end
6362
ret

0 commit comments

Comments
 (0)