This commit is contained in:
2018-10-21 14:30:11 +02:00
parent df49bc9441
commit c6c8a6a5ba
2 changed files with 7 additions and 6 deletions

View File

@@ -36,7 +36,10 @@ impl Default for Rating {
}
fn quality(rating_groups: &[&[Rating]]) -> f32 {
let flatten_ratings = rating_groups.iter().flat_map(|group| group.iter()).collect::<Vec<_>>();
let flatten_ratings = rating_groups
.iter()
.flat_map(|group| group.iter())
.collect::<Vec<_>>();
let flatten_weights = vec![1.0; flatten_ratings.len()].into_boxed_slice();
let length = flatten_ratings.len();
@@ -88,7 +91,6 @@ fn quality(rating_groups: &[&[Rating]]) -> f32 {
e_arg.exp() * s_arg.sqrt()
}
#[cfg(test)]
mod tests {
use super::*;

View File

@@ -14,7 +14,8 @@ fn det(m: &[f32], x: usize) -> f32 {
.enumerate()
.skip(x)
.filter(|(i, _)| (i % x) != n)
.map(|(_, v)| *v).collect::<Vec<_>>();
.map(|(_, v)| *v)
.collect::<Vec<_>>();
d += (-1.0f32).powi(n as i32) * m[n] * det(&ms, x - 1);
}
@@ -120,8 +121,6 @@ impl Matrix {
}
}
impl ops::Index<(usize, usize)> for Matrix {
type Output = f32;