For storing explicit zeros you're best off modifying nzvals directly.

In what way are you specializing your banded getindex method? Is this a 
classical banded but dense-within-the-band matrix, or general CSC sparse 
but with additional knowledge that no nonzeros ever have i and j different 
by more than the bandwidth? You're probably better off either making a new 
type for this that just wraps a SparseMatrixCSC for storage and either 
stores or is parameterized by the bandwidth, or using a different method 
other than getindex for this. If you'll miss the syntax, you could write a 
macro to locally replace getindex with your specialized version.


On Tuesday, August 11, 2015 at 1:00:58 PM UTC-7, Jared Crean wrote:
>
> For a problem I am working on, I need to be able to store explicit zeros 
> in a SparseMatrixCSC.  While the storage format supports this, the 
> setindex! method does not. Also, for banded sparse matricies I can define a 
> much more efficient getindex method than the generic one.  When I define my 
> own method (importing the one from Base and then creating a method with the 
> same signature as the existing one) I get warnings of the type:
>
>
> Warning: Method definition 
> getindex(Base.SparseMatrix.SparseMatrixCSC{#T<:Any, Ti<:Integer}, Integer, 
> Integer) in module SparseMatrix at sparse/sparsematrix.jl:1232 overwritten 
> in module PDESolverCommon at 
> /users/creanj/.julia/v0.4/PDESolverCommon/src/sparse.jl:63.
>
> My question is in what contexts is the method overwritten?  In my local 
> context (the REPL session where I use the one I created).  Do functions 
> within Base use the one in Base or the local one?
>
> Jared Crean
>
>
>

Reply via email to