SparseMatricesCSR.jl
SparseMatricesCSR.SparseMatrixCSRSparseMatricesCSR.SparseMatrixCSRSparseMatricesCSR.SparseMatrixCSRSparseMatricesCSR.SparseMatrixCSRSparseMatricesCSR.SparseMatrixCSRSparseMatricesCSR.SymSparseMatrixCSRBase.countBase.countSparseArrays.findnzSparseArrays.findnzSparseArrays.issparseSparseArrays.issparseSparseArrays.nnzSparseArrays.nnzSparseArrays.nonzerosSparseArrays.nonzerosSparseArrays.nzrangeSparseArrays.nzrangeSparseMatricesCSR.colvalsSparseMatricesCSR.colvalsSparseMatricesCSR.getBiSparseMatricesCSR.getBiSparseMatricesCSR.getoffsetSparseMatricesCSR.getoffsetSparseMatricesCSR.sparsecsrSparseMatricesCSR.symsparsecsr
SparseMatricesCSR.SparseMatrixCSR — Type
SparseMatrixCSR{Bi,Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}Matrix type for storing sparse matrices in the Compressed Sparse Row format with Bi-based indexing (typically 0 or 1). The standard way of constructing SparseMatrixCSR is through the sparsecsr function.
Properties
m::IntNumber of columnsn::IntNumber of rowsrowptr::Vector{Ti}Rowi(1-based) innzvalvector at indices (1-based)(rowptr[i]+(1-Bi)):(rowptr[i+1]+(1-Bi)-1)colval::Vector{Ti}Col indices (Bi-based) of stored valuesnzval::Vector{Tv}Stored values, typically non zeros
Inner constructor
SparseMatrixCSR{Bi}(
m::Integer,
n::Integer,
rowptr::Vector{Ti},
colval::Vector{Ti},
nzval::Vector{Tv}) where {Bi,Tv,Ti<:Integer}SparseMatricesCSR.SparseMatrixCSR — Method
SparseMatrixCSR(a::AbstractMatrix)Build a 1-based SparseMatrixCSR from an AbstractMatrix.
SparseMatricesCSR.SparseMatrixCSR — Method
SparseMatrixCSR(a::Transpose{Tv,<:SparseMatrixCSC} where Tv)Build a 1-based SparseMatrixCSR from the lazy transpose of a SparseMatrixCSC. The resulting matrix takes ownership of the internal storage of input matrix. Modifying the values of one, will mutate also the other.
SparseMatricesCSR.SparseMatrixCSR — Method
SparseMatrixCSR(a::SparseMatrixCSC)Build a 1-based SparseMatrixCSR from a SparseMatrixCSC.
SparseMatricesCSR.SparseMatrixCSR — Method
SparseMatrixCSR{Bi}(a::Transpose{Tv,<:SparseMatrixCSC} where Tv) where BiBuild a Bi-based SparseMatrixCSR from the lazy transpose of a SparseMatrixCSC. The resulting matrix takes ownership of the internal storage of input matrix for any Bi and modifies the internal storage when Bi != 1. The input matrix will become unusable in the latter case.
SparseMatricesCSR.SymSparseMatrixCSR — Type
struct SymSparseMatrixCSR{Bi,T,Ti<:Integer} <: AbstractSparseMatrix{T,Ti}
uppertrian :: SparseMatrixCSR{Bi,T,Ti}
endMatrix type for storing symmetric sparse matrices in the Compressed Sparse Row format with Bi-based indexing (typically 0 or 1). Only the upper triangle is stored (including the non zero diagonal entries), which is represented by a SparseMatrixCSR. The standard way of constructing a SymSparseMatrixCSR is through the symsparsecsr function.
Base.count — Method
count(pred, S::SparseMatrixCSR)
count(S::SparseMatrixCSR)Count the number of elements in nonzeros(S) for which predicate pred returns true. If pred not given, it counts the number of true values.
Base.count — Method
count(pred, S::SymSparseMatrixCSR)
count(S::SymSparseMatrixCSR)Count the number of elements in nonzeros(S) for which predicate pred returns true. If pred not given, it counts the number of true values.
SparseArrays.findnz — Method
findnz(S::SymSparseMatrixCSR)Return a tuple (I, J, V) where I and J are the row and column 1-based indices of the stored ("structurally non-zero in diagonal + upper trianle") values in sparse matrix A, and V is a vector of the values. The returned vectors are newly allocated and are unrelated to the internal storage of matrix S.
SparseArrays.findnz — Method
findnz(S::SparseMatrixCSR{Bi,Tv,Ti})Return a tuple (I, J, V) where I and J are the row and column 1-based indices of the stored ("structurally non-zero") values in sparse matrix A, and V is a vector of the values. The returned vectors are newly allocated and are unrelated to the internal storage of matrix S.
SparseArrays.issparse — Method
issparse(S::SparseMatrixCSR)Returns true.
SparseArrays.issparse — Method
issparse(S::SymSparseMatrixCSR)Returns true.
SparseArrays.nnz — Method
nnz(S::SymSparseMatrixCSR)Returns the number of stored elements in a sparse array, which correspond to the nonzero entries in the upper triangle and diagonal.
SparseArrays.nnz — Method
nnz(S::SparseMatrixCSR)Returns the number of stored (filled) elements in a sparse array.
SparseArrays.nonzeros — Method
nonzeros(S::SparseMatrixCSR)Return a vector (1-based) of the structural nonzero values in sparse array S. This includes zeros that are explicitly stored in the sparse array. The returned vector points directly to the internal nonzero storage of S, and any modifications to the returned vector will mutate S as well.
SparseArrays.nonzeros — Method
nonzeros(S::SymSparseMatrixCSR)Return a vector (1-based) of the structural nonzero values in sparse array S. This includes zeros that are explicitly stored in the sparse array, which correspond to the nonzero entries in the upper triangle and diagonal. The returned vector points directly to the internal nonzero storage of S, and any modifications to the returned vector will mutate S as well.
SparseArrays.nzrange — Method
nzrange(S::SymSparseMatrixCSR, row::Integer)Return the range of indices to the structural nonzero values of a sparse matrix row section being in the diagonal or upper triangle. The returned range of indices is always 1-based even for Bi != 1.
SparseArrays.nzrange — Method
nzrange(S::SparseMatrixCSR{Bi}, row::Integer) where {Bi}Return the range of indices to the structural nonzero values of a sparse matrix row. The returned range of indices is always 1-based even for Bi != 1.
SparseMatricesCSR.colvals — Method
colvals(S::SparseMatrixCSR{Bi}) where {Bi}Return a vector of the col indices of S. The stored values are indexes to arrays with Bi-based indexing, but the colvals(S) array itself is a standard 1-based Julia Vector. Any modifications to the returned vector will mutate S as well. Providing access to how the col indices are stored internally can be useful in conjunction with iterating over structural nonzero values. See also nonzeros and nzrange.
SparseMatricesCSR.colvals — Method
colvals(S::SparseMatrixCSR)Return a vector of the col indices of S. The stored values are indexes to arrays with Bi-based indexing, but the colvals(S) array itself is a standard 1-based Julia Vector. Any modifications to the returned vector will mutate S as well. Providing access to how the col indices are stored internally can be useful in conjunction with iterating over structural nonzero values. See also nonzeros and nzrange.
SparseMatricesCSR.getBi — Method
getBi(S::SparseMatrixCSR{Bi}) where {Bi}Return Bi.
SparseMatricesCSR.getBi — Method
getBi(S::SymSparseMatrixCSR{Bi}) where {Bi}Return Bi.
SparseMatricesCSR.getoffset — Method
getoffset(S::SparseMatrixCSR{Bi}) where {Bi}Return 1-Bi. Useful to convert from 1-based to Bi-based indexing (by subtracting the offset).
SparseMatricesCSR.getoffset — Method
getoffset(S::SymSparseMatrixCSR{Bi}) where {Bi}Return 1-Bi. Useful to convert from 1-based to Bi-based indexing (by subtracting the offset).
SparseMatricesCSR.sparsecsr — Method
sparsecsr(args...)
sparsecsr(::Val{Bi},args...) where BiCreate a SparseMatrixCSR with Bi-based indexing (1 by default) from the same args... as one constructs a SparseMatrixCSC with the SparseArrays.sparse function.
SparseMatricesCSR.symsparsecsr — Method
symsparsecsr(args...;symmetrize::Bool=false)
symsparsecsr(::Val{Bi},args...;symmetrize::Bool=false) where BiCreate a SymSparseMatrixCSR with Bi-based indexing (1 by default) from the same args... as one constructs a SparseMatrixCSC with the sparse function. If symmetrize == false (the default) the given arguments should only describe the upper triangle of the matrix (including non zero diagonal values). If symmetrize == true a non symmetric input is accepted and it will be symmetrized in-place (i.e., changing the input arguments).