// this corresponds to the explicit for loops in py_perm_trans_symmetrize_compact_fc
// in _phonopy.c: https://github.com/atztogo/phonopy/blob/4fbd156b705c/c/_phonopy.c#L564-L577
//
/// Imposes that the sum over each row is the zero matrix, by subtracting the mean for each row.
/// (i.e. setting the 0th fourier component to zero)
///
/// **Warning:** This causes the ForceConstants matrix to effectively become dense!


Imposes that the sum over each row is the zero matrix, by subtracting the mean for each row.

This causes the ForceConstants matrix to effectively become dense!
Imposes that the sum over each row is the zero matrix by subtracting the mean for each row . This causes the ForceConstants matrix to effectively become dense!
fn cancel_row_averages(&mut self, sc: SupercellWrapper<'_>) {
        let mut bee = self.0.to_coo().into_bee();
        for row in bee.map.values_mut() {
            let mean = row.values().fold(M33::zero(), |acc, m| &acc + m) / sc.raw.num_supercell_atoms() as f64;
            for super_c in sc.super_indices() {
                *row.entry(super_c).or_insert_with(M33::zero) -= mean;
            }
        }
        self.0 = bee.into_csr();
    }
fn cancel_row_averages ( & mut self , sc : SupercellWrapper < ' _ > ) { let mut bee = self . 0 . to_coo ( ) . into_bee ( ) ; for row in bee . map . values_mut ( ) { let mean = row . values ( ) . fold ( M33 :: zero ( ) , | acc , m | & acc + m ) / sc . raw . num_supercell_atoms ( ) as f64 ; for super_c in sc . super_indices ( ) { * row . entry ( super_c ) . or_insert_with ( M33 :: zero ) -= mean ; } } self . 0 = bee . into_csr ( ) ; }
this corresponds to the explicit for loops in py_perm_trans_symmetrize_compact_fc
in _phonopy.c: https://github.com/atztogo/phonopy/blob/4fbd156b705c/c/_phonopy.c#L564-L577
this corresponds to the explicit for loops in py_perm_trans_symmetrize_compact_fc in _phonopy . c : https : // github . com / atztogo / phonopy / blob / 4fbd156b705c / c / _phonopy . c#L564 - L577
&mut self
sc
SupercellWrapper<'_>