I'm trying to rewrite some Julia code into python code. And I just found colptr attached to sparse matrix. I searched it but I still don't understand what it is.
Could someone provide me the information about it and counterpart in python 3? Thank you in advance.
[edit] this is from Julia's references
struct SparseMatrixCSC{Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
m::Int # Number of rows
n::Int # Number of columns
colptr::Vector{Ti} # Column j is in colptr[j]:(colptr[j+1]-1)
rowval::Vector{Ti} # Row indices of stored values
nzval::Vector{Tv} # Stored values, typically nonzeros
for instance, A.colptr[j] is referring all the elements of j-th column of CSC matrix A?
I tried to figure it out by running some simple code below,
A = sparse([1, 1, 2, 3], [1, 3, 2, 3], [0, 1, 2, 0])
for i=1:4
println(A.colptr[i])
end
and the result was
1 2 3 5
I still have no idea why the result would be like this. explanation says
Ti is the integer type for storing column pointers