@@ -8,7 +8,7 @@ Matrix type for storing symmetric sparse matrices in the
8
8
Compressed Sparse Row format with `Bi`-based indexing (typically 0 or 1).
9
9
Only the upper triangle is stored (including the non zero diagonal entries),
10
10
which is represented by a `SparseMatrixCSR`.
11
- The standard way of constructing a `SymSparseMatrixCSR` is through the
11
+ The standard way of constructing a `SymSparseMatrixCSR` is through the
12
12
[`symsparsecsr`](@ref) function.
13
13
"""
14
14
struct SymSparseMatrixCSR{Bi,T,Ti<: Integer } <: AbstractSparseMatrix{T,Ti}
@@ -90,10 +90,10 @@ nnz(S::SymSparseMatrixCSR) = nnz(S.uppertrian)
90
90
"""
91
91
nonzeros(S::SymSparseMatrixCSR)
92
92
93
- Return a vector (1-based) of the structural nonzero values in sparse array S.
93
+ Return a vector (1-based) of the structural nonzero values in sparse array S.
94
94
This includes zeros that are explicitly stored in the sparse array,
95
95
which correspond to the nonzero entries in the upper triangle and diagonal.
96
- The returned vector points directly to the internal nonzero storage of S,
96
+ The returned vector points directly to the internal nonzero storage of S,
97
97
and any modifications to the returned vector will mutate S as well.
98
98
"""
99
99
nonzeros (S:: SymSparseMatrixCSR ) = nonzeros (S. uppertrian)
@@ -104,17 +104,17 @@ nonzeros(S::SymSparseMatrixCSR) = nonzeros(S.uppertrian)
104
104
Return a vector of the col indices of `S`. The stored values are indexes to arrays
105
105
with `Bi`-based indexing, but the `colvals(S)` array itself is a standard 1-based
106
106
Julia `Vector`.
107
- Any modifications to the returned vector will mutate S as well.
108
- Providing access to how the col indices are stored internally
109
- can be useful in conjunction with iterating over structural
107
+ Any modifications to the returned vector will mutate S as well.
108
+ Providing access to how the col indices are stored internally
109
+ can be useful in conjunction with iterating over structural
110
110
nonzero values. See also [`nonzeros`](@ref) and [`nzrange`](@ref).
111
111
"""
112
112
colvals (S:: SymSparseMatrixCSR ) = colvals (S. uppertrian)
113
113
114
114
"""
115
115
nzrange(S::SymSparseMatrixCSR, row::Integer)
116
116
117
- Return the range of indices to the structural nonzero values of a
117
+ Return the range of indices to the structural nonzero values of a
118
118
sparse matrix row section being in the diagonal or upper triangle.
119
119
The returned range of indices is always 1-based even for `Bi != 1`.
120
120
"""
@@ -123,8 +123,8 @@ nzrange(S::SymSparseMatrixCSR, row::Integer) = nzrange(S.uppertrian, row)
123
123
"""
124
124
findnz(S::SymSparseMatrixCSR)
125
125
126
- Return a tuple `(I, J, V)` where `I` and `J` are the row and column 1-based indices
127
- of the stored ("structurally non-zero in diagonal + upper trianle") values in sparse matrix A,
126
+ Return a tuple `(I, J, V)` where `I` and `J` are the row and column 1-based indices
127
+ of the stored ("structurally non-zero in diagonal + upper trianle") values in sparse matrix A,
128
128
and V is a vector of the values. The returned vectors are newly allocated
129
129
and are unrelated to the internal storage of matrix `S`.
130
130
"""
@@ -134,12 +134,16 @@ findnz(S::SymSparseMatrixCSR) = findnz(S.uppertrian)
134
134
count(pred, S::SymSparseMatrixCSR)
135
135
count(S::SymSparseMatrixCSR)
136
136
137
- Count the number of elements in `nonzeros(S)` for which predicate `pred` returns `true`.
137
+ Count the number of elements in `nonzeros(S)` for which predicate `pred` returns `true`.
138
138
If `pred` not given, it counts the number of `true` values.
139
139
"""
140
140
count (pred, S:: SymSparseMatrixCSR ) = count (pred, S. uppertrian)
141
141
count (S:: SymSparseMatrixCSR ) = count (i-> true , S)
142
142
143
+ function LinearAlgebra. fillstored! (a:: SymSparseMatrixCSR ,v)
144
+ LinearAlgebra. fillstored! (a. uppertrian,v)
145
+ end
146
+
143
147
function mul! (y:: AbstractVector ,A:: SymSparseMatrixCSR ,v:: AbstractVector , α:: Number , β:: Number )
144
148
A. uppertrian. n == size (v, 1 ) || throw (DimensionMismatch ())
145
149
A. uppertrian. m == size (y, 1 ) || throw (DimensionMismatch ())
177
181
178
182
function show (io:: IO , :: MIME"text/plain" , S:: SymSparseMatrixCSR )
179
183
xnnz = nnz (S)
180
- print (io, S. uppertrian. m, " ×" , S. uppertrian. n, " " ,
184
+ print (io, S. uppertrian. m, " ×" , S. uppertrian. n, " " ,
181
185
typeof (S), " with " , xnnz, " stored " ,
182
186
xnnz == 1 ? " entry" : " entries" )
183
187
if xnnz != 0
0 commit comments