Skip to content

Commit

Permalink
Update README for new API
Browse files Browse the repository at this point in the history
  • Loading branch information
arcresu committed Jan 11, 2023
1 parent e0b26bd commit cac762d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ fn main() {
let matrix1 = DistMatrix::from_pw_distances(&[1, 5, 3]);
assert_eq!(matrix1.get(1, 2), Some(&2));
assert_eq!(matrix1.get(2, 1), None);
assert_eq!(matrix1.get_symmetric(2, 1), Some(2));
assert_eq!(
matrix1.get_symmetric(2, 1).map(|x| x.get_or_default()),
Some(2)
);

// A square matrix stored in row major order:
// _1___5___3
Expand Down
5 changes: 4 additions & 1 deletion src/symmetric.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,6 +934,9 @@ mod tests {
let matrix1 = DistMatrix::from_pw_distances(&[1, 5, 3]);
assert_eq!(matrix1.get(1, 2), Some(&2));
assert_eq!(matrix1.get(2, 1), None);
assert_eq!(matrix1.get_symmetric(2, 1), Some(Entry::Explicit(&2)));
assert_eq!(
matrix1.get_symmetric(2, 1).map(|x| x.get_or_default()),
Some(2)
);
}
}

0 comments on commit cac762d

Please sign in to comment.