Skip to content

Commit d77bd32

Browse files
committed
Back to empty array as sentinel
1 parent 619593a commit d77bd32

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

src/abstract.jl

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ mutable struct LinearOperator{T, S, I <: Integer, F, Ft, Fct} <: AbstractLinearO
5454
nprod::I
5555
ntprod::I
5656
nctprod::I
57-
Mv::Union{S, Nothing}
58-
Mtu::Union{S, Nothing}
57+
Mv::S
58+
Mtu::S
5959
end
6060

6161
function LinearOperator{T, S}(
@@ -81,8 +81,8 @@ function LinearOperator{T, S}(
8181
nprod,
8282
ntprod,
8383
nctprod,
84-
nothing,
85-
nothing,
84+
S(undef, 0),
85+
S(undef, 0),
8686
)
8787
end
8888

@@ -161,7 +161,7 @@ No additional vectors are generated when using the 3-args `mul!`.
161161
"""
162162
has_args5(op::AbstractLinearOperator) = get_nargs(op.prod!) == 4
163163

164-
isallocated5(op::LinearOperator) = !(isnothing(op.Mv) || isnothing(op.Mtu))
164+
isallocated5(op::LinearOperator) = !(isempty(op.Mv) || isempty(op.Mtu))
165165

166166
has_args5(op::AbstractMatrix) = true # Needed for BlockDiagonalOperator
167167

src/adjtrans.jl

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ function mul!(
112112
if hasmethod(ctprod!, Tuple{typeof(res), typeof(v), typeof(α), typeof(β)})
113113
return ctprod!(res, v, α, β)
114114
else
115-
iszero(β) || (p.Mtu !== nothing) || allocate_vectors_args3!(p)
115+
iszero(β) || !isempty(p.Mtu) || allocate_vectors_args3!(p)
116116
return prod3!(res, ctprod!, v, α, β, p.Mtu)
117117
end
118118
end
@@ -135,7 +135,7 @@ function mul!(
135135
if hasmethod(tprod!, Tuple{typeof(res), typeof(v), typeof(α), typeof(β)})
136136
tprod!(res, conj.(v), conj(α), conj(β))
137137
else
138-
iszero(β) || (p.Mtu !== nothing) || allocate_vectors_args3!(p)
138+
iszero(β) || !isempty(p.Mtu) || allocate_vectors_args3!(p)
139139
prod3!(res, tprod!, conj.(v), conj(α), conj(β), p.Mtu)
140140
end
141141
conj!(res)
@@ -179,7 +179,7 @@ function mul!(
179179
if hasmethod(tprod!, Tuple{typeof(res), typeof(v), typeof(α), typeof(β)})
180180
return tprod!(res, v, α, β)
181181
else
182-
iszero(β) || (p.Mtu !== nothing) || allocate_vectors_args3!(p)
182+
iszero(β) || !isempty(p.Mtu) || allocate_vectors_args3!(p)
183183
return prod3!(res, tprod!, v, α, β, p.Mtu)
184184
end
185185
end
@@ -202,7 +202,7 @@ function mul!(
202202
if hasmethod(ctprod!, Tuple{typeof(res), typeof(v), typeof(α), typeof(β)})
203203
ctprod!(res, conj.(v), conj(α), conj(β))
204204
else
205-
iszero(β) || (p.Mtu !== nothing) || allocate_vectors_args3!(p)
205+
iszero(β) || !isempty(p.Mtu) || allocate_vectors_args3!(p)
206206
prod3!(res, ctprod!, conj.(v), conj(α), conj(β), p.Mtu)
207207
end
208208
conj!(res)

src/operations.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ function mul!(res::AbstractVector, op::AbstractLinearOperator{T}, v::AbstractVec
2626
if hasmethod(op.prod!, Tuple{typeof(res), typeof(v), typeof(α), typeof(β)})
2727
op.prod!(res, v, α, β)
2828
else
29-
iszero(β) || (op.Mv !== nothing) || allocate_vectors_args3!(op)
29+
iszero(β) || !isempty(op.Mv) || allocate_vectors_args3!(op)
3030
prod3!(res, op.prod!, v, α, β, op.Mv)
3131
end
3232
end

0 commit comments

Comments
 (0)