Skip to content
Snippets Groups Projects
Commit d15448b3 authored by Martin Larralde's avatar Martin Larralde
Browse files

Avoid using option type in default `Maximum::argmax` implementation

parent 28b186f0
No related branches found
No related tags found
No related merge requests found
...@@ -141,14 +141,14 @@ pub trait Maximum<T: MatrixElement + PartialOrd, C: StrictlyPositive> { ...@@ -141,14 +141,14 @@ pub trait Maximum<T: MatrixElement + PartialOrd, C: StrictlyPositive> {
let mut best_row = 0; let mut best_row = 0;
let mut best_col = 0; let mut best_col = 0;
let mut best_score = None; let mut best_score = scores[0];
for (i, row) in scores.matrix().iter().enumerate() { for (i, row) in scores.matrix().iter().enumerate() {
for j in 0..C::USIZE { for j in 0..C::USIZE {
if best_score.as_ref().map(|s| &row[j] >= s).unwrap_or(true) { if row[j] >= best_score {
best_row = i; best_row = i;
best_col = j; best_col = j;
best_score = Some(row[j]); best_score = row[j];
} }
} }
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment