-
Notifications
You must be signed in to change notification settings - Fork 2
Closed
Labels
enhancementNew feature or requestNew feature or request
Description
Currently:
julia> using BlockSparseArrays: BlockSparseArray
julia> using SparseArraysBase: isstored
julia> a = BlockSparseArray{Float64}([2, 2], [2, 2])
2×2-blocked 4×4 BlockSparseMatrix{Float64, Matrix{Float64}, SparseMatrixDOK{Matrix{Float64}, BlockSparseArrays.GetUnstoredBlock{Tuple{BlockedOneTo{Int64, Vector{Int64}}, BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}, BlockedOneTo{Int64, Vector{Int64}}}}:
. . │ . .
. . │ . .
──────┼──────
. . │ . .
. . │ . .
julia> a[1, 2] = 12
12
julia> a
2×2-blocked 4×4 BlockSparseMatrix{Float64, Matrix{Float64}, SparseMatrixDOK{Matrix{Float64}, BlockSparseArrays.GetUnstoredBlock{Tuple{BlockedOneTo{Int64, Vector{Int64}}, BlockedOneTo{Int64, Vector{Int64}}}}}, Tuple{BlockedOneTo{Int64, Vector{Int64}}, BlockedOneTo{Int64, Vector{Int64}}}}:
0.0 12.0 │ . .
0.0 0.0 │ . .
───────────┼──────
. . │ . .
. . │ . .
julia> isstored(a, 1, 1) # Correct
true
julia> isstored(a, 1, 4) # Should be false
true
and:
julia> isstored(a, Block(1, 1)) # Not defined
ERROR: MethodError: no method matching isstored(::BlockSparseMatrix{Float64, Matrix{…}, SparseMatrixDOK{…}, Tuple{…}}, ::Block{2, Int64})
The function `isstored` exists, but no method is defined for this combination of argument types.
Closest candidates are:
isstored(::AbstractArray, ::Int64...)
@ SparseArraysBase none:0
isstored(::AbstractArray, ::CartesianIndex)
@ SparseArraysBase ~/.julia/packages/SparseArraysBase/9oYN7/src/abstractsparsearrayinterface.jl:58
isstored(::BlockSparseArrays.SparsePermutedDimsArrayBlocks{var"#s16", N, BlockType, Array} where {var"#s16", BlockType<:AbstractArray{var"#s16", N}, Array<:(PermutedDimsArray{var"#s16", N})}, ::Int64...) where N
@ BlockSparseArrays ~/.julia/dev/BlockSparseArrays/src/blocksparsearrayinterface/blocksparsearrayinterface.jl:253
...
Stacktrace:
[1] top-level scope
@ REPL[18]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> isstored(a, Block(1), Block(1)) # Not defined
ERROR: MethodError: no method matching isstored(::BlockSparseMatrix{Float64, Matrix{…}, SparseMatrixDOK{…}, Tuple{…}}, ::Block{1, Int64}, ::Block{1, Int64})
The function `isstored` exists, but no method is defined for this combination of argument types.
Closest candidates are:
isstored(::AbstractArray, ::Int64...)
@ SparseArraysBase none:0
isstored(::AbstractArray, ::CartesianIndex)
@ SparseArraysBase ~/.julia/packages/SparseArraysBase/9oYN7/src/abstractsparsearrayinterface.jl:58
isstored(::BlockSparseArrays.SparsePermutedDimsArrayBlocks{var"#s16", N, BlockType, Array} where {var"#s16", BlockType<:AbstractArray{var"#s16", N}, Array<:(PermutedDimsArray{var"#s16", N})}, ::Int64...) where N
@ BlockSparseArrays ~/.julia/dev/BlockSparseArrays/src/blocksparsearrayinterface/blocksparsearrayinterface.jl:253
...
Stacktrace:
[1] top-level scope
@ REPL[19]:1
Some type information was truncated. Use `show(err)` to see complete types.
julia> isstored(a, Block(1, 1)[1, 1]) # Not defined
ERROR: MethodError: no method matching isstored(::BlockSparseMatrix{Float64, Matrix{…}, SparseMatrixDOK{…}, Tuple{…}}, ::BlockIndex{2, Tuple{…}, Tuple{…}})
The function `isstored` exists, but no method is defined for this combination of argument types.
Closest candidates are:
isstored(::AbstractArray, ::Int64...)
@ SparseArraysBase none:0
isstored(::AbstractArray, ::CartesianIndex)
@ SparseArraysBase ~/.julia/packages/SparseArraysBase/9oYN7/src/abstractsparsearrayinterface.jl:58
isstored(::BlockSparseArrays.SparsePermutedDimsArrayBlocks{var"#s16", N, BlockType, Array} where {var"#s16", BlockType<:AbstractArray{var"#s16", N}, Array<:(PermutedDimsArray{var"#s16", N})}, ::Int64...) where N
@ BlockSparseArrays ~/.julia/dev/BlockSparseArrays/src/blocksparsearrayinterface/blocksparsearrayinterface.jl:253
...
Stacktrace:
[1] top-level scope
@ REPL[21]:1
Some type information was truncated. Use `show(err)` to see complete types.
using:
julia> pkgversion(BlockSparseArrays)
v"0.2.5"
julia> pkgversion(SparseArraysBase)
v"0.2.6"
We could also consider defining isblockstored(a, 1, 1) == isstored(a, Block(1, 1))
though maybe the isstored
interface is sufficient.
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request