@@ -48,7 +48,7 @@ SparseVector(n::Integer, nzind::Vector{Ti}, nzval::Vector{Tv}) where {Tv,Ti} =
48
48
# union of such a view and a SparseVector so we define an alias for such a union as well
49
49
const SparseColumnView{Tv,Ti} = SubArray{Tv,1 ,<: AbstractSparseMatrixCSC{Tv,Ti} ,Tuple{Base. Slice{Base. OneTo{Int}},Int},false }
50
50
const SparseVectorView{Tv,Ti} = SubArray{Tv,1 ,<: AbstractSparseVector{Tv,Ti} ,Tuple{Base. Slice{Base. OneTo{Int}}},false }
51
- const SparseVectorUnion{Tv,Ti} = Union{SparseVector {Tv,Ti}, SparseColumnView{Tv,Ti}, SparseVectorView{Tv,Ti}}
51
+ const SparseVectorUnion{Tv,Ti} = Union{AbstractSparseVector {Tv,Ti}, SparseColumnView{Tv,Ti}, SparseVectorView{Tv,Ti}}
52
52
const AdjOrTransSparseVectorUnion{Tv,Ti} = LinearAlgebra. AdjOrTrans{Tv, <: SparseVectorUnion{Tv,Ti} }
53
53
54
54
# ## Basic properties
@@ -779,7 +779,7 @@ findall(p::Base.Fix2{typeof(in)}, x::SparseVector{<:Any,Ti}) where {Ti} =
779
779
findnz(x::SparseVector)
780
780
781
781
Return a tuple `(I, V)` where `I` is the indices of the stored ("structurally non-zero")
782
- values in sparse vector `x` and `V` is a vector of the values.
782
+ values in sparse vector-like `x` and `V` is a vector of the values.
783
783
784
784
# Examples
785
785
```jldoctest
@@ -794,7 +794,7 @@ julia> findnz(x)
794
794
([1, 4, 6, 8], [1, 2, 4, 3])
795
795
```
796
796
"""
797
- function findnz (x:: SparseVector {Tv,Ti} ) where {Tv,Ti}
797
+ function findnz (x:: SparseVectorUnion {Tv,Ti} ) where {Tv,Ti}
798
798
numnz = nnz (x)
799
799
800
800
I = Vector {Ti} (undef, numnz)
@@ -1405,10 +1405,10 @@ for (fun, mode) in [(:+, 1), (:-, 1), (:*, 0), (:min, 2), (:max, 2)]
1405
1405
end
1406
1406
1407
1407
# ## Reduction
1408
- Base. reducedim_initarray (A:: AbstractSparseVector , region, v0, :: Type{R} ) where {R} =
1408
+ Base. reducedim_initarray (A:: SparseVectorUnion , region, v0, :: Type{R} ) where {R} =
1409
1409
fill! (Array {R} (undef, Base. to_shape (Base. reduced_indices (A, region))), v0)
1410
1410
1411
- function Base. _mapreduce (f, op, :: IndexCartesian , A:: AbstractSparseVector {T} ) where {T}
1411
+ function Base. _mapreduce (f, op, :: IndexCartesian , A:: SparseVectorUnion {T} ) where {T}
1412
1412
isempty (A) && return Base. mapreduce_empty (f, op, T)
1413
1413
z = nnz (A)
1414
1414
rest, ini = if z == 0
@@ -1419,7 +1419,7 @@ function Base._mapreduce(f, op, ::IndexCartesian, A::AbstractSparseVector{T}) wh
1419
1419
_mapreducezeros (f, op, T, rest, ini)
1420
1420
end
1421
1421
1422
- function Base. mapreducedim! (f, op, R:: AbstractVector , A:: AbstractSparseVector )
1422
+ function Base. mapreducedim! (f, op, R:: AbstractVector , A:: SparseVectorUnion )
1423
1423
# dim1 reduction could be safely replaced with a mapreduce
1424
1424
if length (R) == 1
1425
1425
I = firstindex (R)
0 commit comments