Fmt.
This commit is contained in:
@@ -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::*;
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
@@ -52,7 +53,7 @@ impl Matrix {
|
||||
}
|
||||
|
||||
pub fn minor(&self, row_n: usize, col_n: usize) -> Matrix {
|
||||
let mut matrix = Matrix::new(self.height - 1 , self.width - 1);
|
||||
let mut matrix = Matrix::new(self.height - 1, self.width - 1);
|
||||
|
||||
let mut nr = 0;
|
||||
|
||||
@@ -120,8 +121,6 @@ impl Matrix {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
impl ops::Index<(usize, usize)> for Matrix {
|
||||
type Output = f32;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user