File tree Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Expand file tree Collapse file tree 3 files changed +11
-1
lines changed Original file line number Diff line number Diff line change 11[package ]
22name = " sparse-bin-mat"
3- version = " 0.2.1 "
3+ version = " 0.2.2 "
44authors = [" maxtremblay <maxtremblay>" ]
55edition = " 2018"
66description = " A sparse implementation of a binary matrix optimized for row operations"
Original file line number Diff line number Diff line change @@ -170,6 +170,11 @@ impl SparseBinMat {
170170 self . number_of_elements ( ) == 0
171171 }
172172
173+ /// Returns true if the all elements of the matrix are 0.
174+ pub fn is_zero ( & self ) -> bool {
175+ self . number_of_ones ( ) == 0
176+ }
177+
173178 /// Returns the value at the given row and column
174179 /// or None if one of the index is out of bound.
175180 ///
Original file line number Diff line number Diff line change @@ -197,6 +197,11 @@ impl<T: Deref<Target = [usize]>> SparseBinVecBase<T> {
197197 self . len ( ) == 0
198198 }
199199
200+ /// Returns true of all the element in the vector are 0.
201+ pub fn is_zero ( & self ) -> bool {
202+ self . weight ( ) == 0
203+ }
204+
200205 /// Returns the value at the given position
201206 /// or None if the position is out of bound.
202207 ///
You can’t perform that action at this time.
0 commit comments