SparseMatricesCSR.jl
SparseMatricesCSR.SparseMatricesCSR
SparseMatricesCSR.SparseMatrixCSR
SparseMatricesCSR.SymSparseMatrixCSR
Base.convert
Base.convert
Base.convert
Base.count
Base.count
LinearAlgebra.mul!
LinearAlgebra.mul!
SparseArrays.findnz
SparseArrays.findnz
SparseArrays.nnz
SparseArrays.nnz
SparseArrays.nonzeros
SparseArrays.nonzeros
SparseArrays.nzrange
SparseArrays.nzrange
SparseArrays.rowvals
SparseMatricesCSR.finalize_coo!
SparseMatricesCSR.finalize_coo!
SparseMatricesCSR.finalize_coo!
SparseMatricesCSR.finalize_coo!
SparseMatricesCSR.getindices
SparseMatricesCSR.getindices
SparseMatricesCSR.getindices
SparseMatricesCSR.getptr
SparseMatricesCSR.getptr
SparseMatricesCSR.getptr
SparseMatricesCSR.hascolmajororder
SparseMatricesCSR.hascolmajororder
SparseMatricesCSR.hascolmajororder
SparseMatricesCSR.hasrowmajororder
SparseMatricesCSR.hasrowmajororder
SparseMatricesCSR.hasrowmajororder
SparseMatricesCSR.push_coo!
SparseMatricesCSR.push_coo!
SparseMatricesCSR.push_coo!
SparseMatricesCSR.push_coo!
SparseMatricesCSR.sparsecsr
SparseMatricesCSR.symsparsecsr
SparseMatricesCSR.SparseMatricesCSR
— Module.This module contains:
Data types:
SparseMatrixCSR
:Compressed Sparse Row (CSR) sparse matrix implementation with Bi-based indexing.SymSparseMatrixCSR
: Symmetric Compressed Sparse Row sparse matrix implementation with Bi-based indexing.
Procedures:
push_coo!
: Helper function to build COO arrays for further building a SparseMatrixfinalize_coo!
: Finalization of COO arrays building.sparsecsr
: Analogous method tosparse
function to build a SparseMatrixCSR.symsparsecsr
: Analogous method tosparse
function to build a SymSparseMatrixCSR.colvals
: Analogous method torowvals
to returncolvals
array.hasrowmajororder
: Returntrue
if matrix values are ordered by row.hascolmajororder
: Returntrue
if matrix values are ordered by column.getptr
: Return the pointer array of a SparseMatrix (rowptr
orcolptr
depending on the SparseMatrix type)getindices
: Return the indices array of a SparseMatrix (rowval
orcolval
depending on the SparseMatrix type)
Overloaded procedures:
*
: SparseMatrix-Vector product.mul!
: SparseMatrix-Vector product.nnz
: Return the number of stored (filled) elements in a sparse array.nonzeros
: Returnnzval
array.nzrange
: Return the range of indices for a particular row or column (Depending on the SparseMatrix type)findnz
: Return a tuple (I, J, V) where I and J are the row and column indices.rowvals
: Return row indices or raises an error (Depending on the SparseMatrix type)convert
: Type conversion
struct SparseMatrixCSR{Bi,Tv,Ti<:Integer} <: AbstractSparseMatrix{Tv,Ti}
Matrix type for storing Bi-based sparse matrices in the Compressed Sparse Row format. The standard way of constructing SparseMatrixCSR is through the sparsecsr
function.
struct SymSparseMatrixCSR{T,Ti<:Integer} <: AbstractSparseMatrix{T,Ti}
Matrix type for storing symmetric sparse matrices in the Compressed Sparse Row format. The standard way of constructing SparseMatrixCSR is through the symsparsecsr
function.
SparseMatricesCSR.finalize_coo!
— Method.function finalize_coo!(I,J,V,m,n)
Finalize COO arrays for building a SparseMatrixCSC.
SparseMatricesCSR.finalize_coo!
— Method.function finalize_coo!(::Type{SparseMatrixCSC},I,J,V,m,n)
Check and insert diagonal entries in COO vectors if needed.
SparseMatricesCSR.finalize_coo!
— Method.function finalize_coo!(::Type{SparseMatrixCSR},I,J,V,m,n)
Finalize COO arrays for building a SparseMatrixCSR.
SparseMatricesCSR.finalize_coo!
— Method.function finalize_coo!(::Type{SymSparseMatrixCSR},I,J,V,m,n)
Finalize COO arrays for building a SymSparseMatrixCSR. Check and insert diagonal entries in COO vectors if needed.
SparseMatricesCSR.getindices
— Method.function getvals(S::SparseMatrixCSC)
Return row indices.
SparseMatricesCSR.getindices
— Method.function getindices(S::SparseMatrixCSR)
Return column indices.
SparseMatricesCSR.getindices
— Method.function getindices(S::SymSparseMatrixCSR)
Return column indices.
SparseMatricesCSR.getptr
— Method.function getptr(S::SparseMatrixCSC)
Return columns pointer.
SparseMatricesCSR.getptr
— Method.function getptr(S::SparseMatrixCSR)
Return rows pointer.
SparseMatricesCSR.getptr
— Method.function getptr(S::SymSparseMatrixCSR)
Return rows pointer.
SparseMatricesCSR.hascolmajororder
— Method.function hascolmajororder(::Type{SparseMatrixCSC})
Check if values are stored in col-major order. Return true.
SparseMatricesCSR.hascolmajororder
— Method.function hascolmajororder(::Type{SparseMatrixCSR})
Check if values are stored in col-major order. Return false.
SparseMatricesCSR.hascolmajororder
— Method.function hascolmajororder(::Type{SymSparseMatrixCSR})
Check if values are stored in col-major order. Return false.
SparseMatricesCSR.hasrowmajororder
— Method.function hasrowmajororder(::Type{SparseMatrixCSC})
Check if values are stored in row-major order. Return false.
SparseMatricesCSR.hasrowmajororder
— Method.function hasrowmajororder(::Type{SparseMatrixCSR})
Check if values are stored in row-major order. Return true.
SparseMatricesCSR.hasrowmajororder
— Method.function hasrowmajororder(::Type{SymSparseMatrixCSR})
Check if values are stored in row-major order. Return true.
SparseMatricesCSR.push_coo!
— Method.function push_coo!(I,J,V,ik,jk,vk)
Inserts entries in COO vectors for further building a SparseMatrixCSC.
SparseMatricesCSR.push_coo!
— Method.function push_coo!(::Type{SparseMatrixCSC},I,J,V,ik,jk,vk)
Inserts entries in COO vectors for further building a SparseMatrixCSC.
SparseMatricesCSR.push_coo!
— Method.function push_coo!(::Type{SymSparseMatrixCSR},I,J,V,ik,jk,vk)
Inserts entries in COO vectors for further building a SymSparseMatrixCSR. It stores only the upper triangle, ignoring entries with (ik>jk) coordinates.
SparseMatricesCSR.push_coo!
— Method.function push_coo!(::Type{SparseMatrixCSR},I,J,V,ik,jk,vk)
Inserts entries in COO vectors for further building a SparseMatrixCSR.
SparseMatricesCSR.sparsecsr
— Method.sparsecsr(I, J, V, [m, n, combine])
Create a sparse matrix S of dimensions m x n such that S[I[k], J[k]] = V[k]. The combine function is used to combine duplicates. If m and n are not specified, they are set to maximum(I) and maximum(J) respectively. If the combine function is not supplied, combine defaults to + unless the elements of V are Booleans in which case combine defaults to |. All elements of I must satisfy 1 <= I[k] <= m, and all elements of J must satisfy 1 <= J[k] <= n. Numerical zeros in (I, J, V) are retained as structural nonzeros.
SparseMatricesCSR.symsparsecsr
— Method.symsparsecsr(I, J, V, [m, n, combine])
Create a Symmetric sparse matrix S of dimensions m x n such that S[I[k], J[k]] = V[k], and m=n. The combine function is used to combine duplicates. If m and n are not specified, they are set to maximum(I) and maximum(J) respectively. If the combine function is not supplied, combine defaults to +. All elements of I must satisfy 1 <= I[k] <= m, and all elements of J must satisfy 1 <= J[k] <= n. Numerical zeros in (I, J, V) are retained as structural nonzeros.
Base.convert
— Method.function convert(::Type{SparseMatrixCSR}, x::AbstractSparseMatrix)
Convert x to a value of type SymSparseMatrixCSR.
Base.convert
— Method.function convert(::Type{SymSparseMatrixCSR}, x::SymSparseMatrixCSR)
Convert x to a value of type SymSparseMatrixCSR.
Base.convert
— Method.function convert(::Type{SparseMatrixCSC}, x::SparseMatrixCSR)
Convert x to a value of type SparseMatrixCSC.
Base.count
— Method.count(pred, S::SparseMatrixCSR) -> Integer
Count the number of elements in nonzeros(S) for which predicate pred returns true.
Base.count
— Method.count(pred, S::SymSparseMatrixCSR) -> Integer
Count the number of elements in nonzeros(S) for which predicate pred returns true.
LinearAlgebra.mul!
— Method.function mul!(y::AbstractVector,A::SparseMatrixCSR,v::AbstractVector{T}) where {T}
Calculates the matrix-vector product $Av$ and stores the result in y
, overwriting the existing value of y
.
LinearAlgebra.mul!
— Method.function mul!(y::AbstractVector,A::SymSparseMatrixCSR,v::AbstractVector{T}) where {T}
Calculates the matrix-vector product $Av$ and stores the result in y
, overwriting the existing value of y
.
SparseArrays.findnz
— Method.findnz(S::SymSparseMatrixCSR)
Return a tuple (I, J, V) where I and J are the row and column indices of the stored ("structurally non-zero") values in sparse matrix A, and V is a vector of the values.
SparseArrays.findnz
— Method.function findnz(S::SparseMatrixCSR{Bi,Tv,Ti})
Return a tuple (I, J, V) where I and J are the row and column indices of the stored ("structurally non-zero") values in sparse matrix A, and V is a vector of the values.
SparseArrays.nnz
— Method.nnz(S::SymSparseMatrixCSR)
Returns the number of stored (filled) elements in a sparse array.
SparseArrays.nnz
— Method.nnz(S::SparseMatrixCSR{Bi}) where {Bi}
Returns the number of stored (filled) elements in a sparse array.
SparseArrays.nonzeros
— Method.nonzeros(S::SparseMatrixCSR)
Return a vector 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 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 A, and any modifications to the returned vector will mutate A 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.
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.
SparseArrays.rowvals
— Method.rowvals(S::SparseMatrixCSR)
Return an error. CSR sparse matrices does not contain raw row values. It contains row pointers instead that can be accessed by using nzrange
.