Switch return type to just T
This commit is contained in:
parent
b90dc7c042
commit
bcc5527baa
|
@ -214,7 +214,7 @@ impl<T> CooMatrix<T> {
|
||||||
/// Remove a single triplet from the matrix.
|
/// Remove a single triplet from the matrix.
|
||||||
///
|
///
|
||||||
/// This removes the value `v` from the `i`th row and `j`th column in the matrix.
|
/// This removes the value `v` from the `i`th row and `j`th column in the matrix.
|
||||||
pub fn clear_triplet(&mut self, i: usize, j: usize, v: T) -> Option<(usize, usize, T)>
|
pub fn clear_triplet(&mut self, i: usize, j: usize, v: T) -> Option<T>
|
||||||
where
|
where
|
||||||
T: PartialEq,
|
T: PartialEq,
|
||||||
{
|
{
|
||||||
|
@ -224,8 +224,8 @@ impl<T> CooMatrix<T> {
|
||||||
if let Some(triple_idx) = triple_idx {
|
if let Some(triple_idx) = triple_idx {
|
||||||
self.row_indices.remove(triple_idx);
|
self.row_indices.remove(triple_idx);
|
||||||
self.col_indices.remove(triple_idx);
|
self.col_indices.remove(triple_idx);
|
||||||
let retv = self.values.remove(triple_idx);
|
let removed_value = self.values.remove(triple_idx);
|
||||||
Some((i, j, retv))
|
Some(removed_value)
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
}
|
}
|
||||||
|
|
|
@ -242,16 +242,16 @@ fn coo_clear_triplet_valid_entries() {
|
||||||
vec![(0, 0, &1), (0, 0, &2), (2, 2, &3)]
|
vec![(0, 0, &1), (0, 0, &2), (2, 2, &3)]
|
||||||
);
|
);
|
||||||
let triplet = coo.clear_triplet(0, 0, 1);
|
let triplet = coo.clear_triplet(0, 0, 1);
|
||||||
assert_eq!(triplet, Some((0, 0, 1)));
|
assert_eq!(triplet, Some(1));
|
||||||
assert_eq!(
|
assert_eq!(
|
||||||
coo.triplet_iter().collect::<Vec<_>>(),
|
coo.triplet_iter().collect::<Vec<_>>(),
|
||||||
vec![(0, 0, &2), (2, 2, &3)]
|
vec![(0, 0, &2), (2, 2, &3)]
|
||||||
);
|
);
|
||||||
let triplet = coo.clear_triplet(0, 0, 2);
|
let triplet = coo.clear_triplet(0, 0, 2);
|
||||||
assert_eq!(triplet, Some((0, 0, 2)));
|
assert_eq!(triplet, Some(2));
|
||||||
assert_eq!(coo.triplet_iter().collect::<Vec<_>>(), vec![(2, 2, &3)]);
|
assert_eq!(coo.triplet_iter().collect::<Vec<_>>(), vec![(2, 2, &3)]);
|
||||||
let triplet = coo.clear_triplet(2, 2, 3);
|
let triplet = coo.clear_triplet(2, 2, 3);
|
||||||
assert_eq!(triplet, Some((2, 2, 3)));
|
assert_eq!(triplet, Some(3));
|
||||||
assert_eq!(coo.triplet_iter().collect::<Vec<_>>(), vec![]);
|
assert_eq!(coo.triplet_iter().collect::<Vec<_>>(), vec![]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue