-
Notifications
You must be signed in to change notification settings - Fork 65
Open
Description
findnz on a regular sparse matrix or vector is working fine, but as for the adjoint of the sparse matrix, it would error about missing dispatches.
MWE:
julia> using SparseArrays
julia> a = sprand(5, 5, 0.3)
5×5 SparseMatrixCSC{Float64, Int64} with 10 stored entries:
0.0427685 0.200511 0.671743 0.218248 ⋅
⋅ ⋅ ⋅ ⋅ 0.187924
⋅ 0.550776 ⋅ 0.575211 ⋅
0.818149 ⋅ ⋅ 0.765981 ⋅
⋅ ⋅ ⋅ ⋅ 0.67016
julia> findnz(a)
([1, 4, 1, 3, 1, 1, 3, 4, 2, 5], [1, 1, 2, 2, 3, 4, 4, 4, 5, 5], [0.04276845834332266, 0.8181492402324447, 0.20051143143705996, 0.5507758664465765, 0.671743090935252, 0.21824817491559279, 0.5752107151129244, 0.7659814619199559, 0.18792429490108353, 0.6701601805330932])
julia> findnz(a')
ERROR: MethodError: no method matching findnz(::LinearAlgebra.Adjoint{Float64, SparseMatrixCSC{Float64, Int64}})
The function `findnz` exists, but no method is defined for this combination of argument types.
Closest candidates are:
findnz(::Union{SparseArrays.AbstractCompressedVector{Tv, Ti}, SubArray{Tv, 1, <:SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}, Int64}, false}, SubArray{Tv, 1, <:AbstractSparseVector{Tv, Ti}, Tuple{Base.Slice{Base.OneTo{Int64}}}, false}} where {Tv, Ti})
@ SparseArrays ~/.julia/juliaup/julia-1.11.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/SparseArrays/src/sparsevector.jl:904
findnz(::SparseArrays.AbstractSparseMatrixCSC{Tv, Ti}) where {Tv, Ti}
@ SparseArrays ~/.julia/juliaup/julia-1.11.4+0.aarch64.apple.darwin14/share/julia/stdlib/v1.11/SparseArrays/src/sparsematrix.jl:1930
Stacktrace:
[1] top-level scope
@ REPL[11]:1Metadata
Metadata
Assignees
Labels
No labels