From 52950089811ccc66487c7283bc2fb574a99d3ed2 Mon Sep 17 00:00:00 2001 From: Olivier Verdier Date: Mon, 2 Oct 2023 22:49:26 +0200 Subject: [PATCH] Allow adddiag to work with abstract vectors --- src/utils.jl | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/utils.jl b/src/utils.jl index 3e1453f..1ea5fef 100644 --- a/src/utils.jl +++ b/src/utils.jl @@ -30,7 +30,7 @@ function _adddiag!(a::Union{Matrix, SparseMatrixCSC}, v::Real) return a end -function _adddiag!(a::Union{Matrix, SparseMatrixCSC}, v::Vector, c::Real) +function _adddiag!(a::Union{Matrix, SparseMatrixCSC}, v::AbstractVector, c::Real) @check_argdims eachindex(v) == axes(a, 1) == axes(a, 2) if c == one(c) for i in eachindex(v) @@ -46,7 +46,7 @@ end _adddiag(a::Union{Matrix, SparseMatrixCSC}, v::Real) = _adddiag!(copy(a), v) _adddiag(a::Union{Matrix, SparseMatrixCSC}, v::Vector, c::Real) = _adddiag!(copy(a), v, c) -_adddiag(a::Union{Matrix, SparseMatrixCSC}, v::Vector{T}) where {T<:Real} = _adddiag!(copy(a), v, one(T)) +_adddiag(a::Union{Matrix, SparseMatrixCSC}, v::AbstractVector{T}) where {T<:Real} = _adddiag!(copy(a), v, one(T)) function wsumsq(w::AbstractVector, a::AbstractVector)