BlockBandedMatrices.jl
BlockBandedMatrices.jl copied to clipboard
Incompatible with spy
using FillArrays, BlockBandedMatrices
l,u = 1,1 # block bandwidths
N = M = 2 # number of row/column blocks
cols = rows = 1:N # block sizes
jac_bbm = BlockBandedMatrix(Ones(sum(rows),sum(cols)), (rows,cols), (l,u)) # creates a block-banded matrix with ones in the non-zero entries # creates a block-banded identity matrix
using Plots
spy(jac_bbm,markersize=1,colorbar=false,color=:deep)
MethodError: no method matching findnz(::BlockSkylineMatrix{Float64,Array{Float64,1},BlockBandedMatrices.BlockSkylineSizes{BlockArrays.BlockSizes{2,Tuple{Array{Int64,1},Array{Int64,1}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},BandedMatrices.BandedMatrix{Int64,Array{Int64,2},Base.OneTo{Int64}},Array{Int64,1}}})
Closest candidates are:
findnz(!Matched::SparseMatrixCSC{Tv,Ti}) where {Tv, Ti} at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\SparseArrays\src\sparsematrix.jl:1299
findnz(!Matched::SparseVector{Tv,Ti}) where {Tv, Ti} at C:\cygwin\home\Administrator\buildbot\worker\package_win64\build\usr\share\julia\stdlib\v1.2\SparseArrays\src\sparsevector.jl:738
macro expansion at recipes.jl:1064 [inlined]
apply_recipe(::Dict{Symbol,Any}, ::Type{Val{:spy}}, ::Array{Float64,1}, ::Array{Float64,1}, ::Surface{BlockSkylineMatrix{Float64,Array{Float64,1},BlockBandedMatrices.BlockSkylineSizes{BlockArrays.BlockSizes{2,Tuple{Array{Int64,1},Array{Int64,1}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},BandedMatrices.BandedMatrix{Int64,Array{Int64,2},Base.OneTo{Int64}},Array{Int64,1}}}}) at RecipesBase.jl:275
_process_seriesrecipe(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}) at pipeline.jl:408
_plot!(::Plots.Plot{Plots.GRBackend}, ::Dict{Symbol,Any}, ::Tuple{Plots.Spy}) at plot.jl:234
#plot#137(::Base.Iterators.Pairs{Symbol,Any,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:markersize, :colorbar, :color),Tuple{Int64,Bool,Symbol}}}, ::typeof(plot), ::Plots.Spy) at plot.jl:57
#plot at none:0 [inlined]
#spy#230 at RecipesBase.jl:350 [inlined]
(::getfield(Plots, Symbol("#kw##spy")))(::NamedTuple{(:markersize, :colorbar, :color),Tuple{Int64,Bool,Symbol}}, ::typeof(spy), ::BlockSkylineMatrix{Float64,Array{Float64,1},BlockBandedMatrices.BlockSkylineSizes{BlockArrays.BlockSizes{2,Tuple{Array{Int64,1},Array{Int64,1}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},Fill{Int64,1,Tuple{Base.OneTo{Int64}}},BandedMatrices.BandedMatrix{Int64,Array{Int64,2},Base.OneTo{Int64}},Array{Int64,1}}}) at none:0
top-level scope at advanced_ode_example.jmd:328
Does this help:
SparseArrays.findnz(A::BlockBandedMatrix) = findnz(sparse(A))
It'll be slow but perhaps that's OK?
Yeah, that's a fine workaround. Or spy(sparse(A)) is good too.
Let's leave this open until that work around is added