Skip to content

Commit a0e016b

Browse files
author
maxtremblay
committed
2 parents 166af32 + 8061cf0 commit a0e016b

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "sparse-bin-mat"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
authors = ["maxtremblay <maxtremblay>"]
55
edition = "2018"
66
description = "A sparse implementation of a binary matrix optimized for row operations"

src/matrix/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
///

src/vector/mod.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff 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
///

0 commit comments

Comments
 (0)