The SparseMatrixCSC type is immutable, which I understand to mean that I must respect the types of the attributes of SparseMatrixCSC types, as well as not changing the attributes themselves.
The following gives a loadError (type is immutable). I am confused that I can modify the colptr and rowval attributes of A, but not the A.n attribute. Why is this? I am trying to change the size of a sparse matrix after removing the data from a row and column. I have checked that both A.n and A.n - 1 are type Int. function rmCol(A::SparseMatrixCSC, rmCol::Int) colRmRange = A.colptr[rmCol]:(A.colptr[rmCol+1]-1) filter!(e -> e != rmCol, A.colptr) deleteat!(A.rowval, rowval[colRmRange]) deleteat!(A.nzval, colRmRange) A.n -= 1 # inclusion of this line throws error end