fn lll_lattice(lattice: [[f64; 3]; 3]) -> [[f64; 3]; 3] {
        let delta = 0.75;
        let mut a = lattice;
        let (mut b, mut mu) = ReducedLattice::gram_schmidt(&a);
        let mut i = 1usize;
        while i <= 2 {
            for j in (0..i).rev() {
                match mu[i][j] {
                    q if q.abs() <= 0.5 => (),
                    q => {
                        for k in 0..3 {
                            a[i][k] -= q.round() * a[j][k];
                        }
                        let (b_temp, mu_temp) =
                            ReducedLattice::gram_schmidt(&a);
                        b = b_temp;
                        mu = mu_temp;
                    }
                }
            }
            if utils::vdot(b[i], b[i])
               >= (delta - mu[i][i - 1].powi(2))
                  * utils::vdot(b[i - 1], b[i - 1])
            {
                i += 1;
            } else {
                for j in 0..3 {
                    b[0][0] = a[i][j];
                    a[i][j] = a[i - 1][j];
                    a[i - 1][j] = b[0][0];
                }
                let (b_temp, mu_temp) = ReducedLattice::gram_schmidt(&a);
                b = b_temp;
                mu = mu_temp;
                i = 1usize.max(i - 1);
            }
        }
        a
    }
/// Calculates the lll reduction of a lattice.
Calculates the lll reduction of a lattice.
Calculates the lll reduction of a lattice .
fn lll_lattice(lattice: [[f64; 3]; 3]) -> [[f64; 3]; 3] {
        let delta = 0.75;
        let mut a = lattice;
        let (mut b, mut mu) = ReducedLattice::gram_schmidt(&a);
        let mut i = 1usize;
        while i <= 2 {
            for j in (0..i).rev() {
                match mu[i][j] {
                    q if q.abs() <= 0.5 => (),
                    q => {
                        for k in 0..3 {
                            a[i][k] -= q.round() * a[j][k];
                        }
                        let (b_temp, mu_temp) =
                            ReducedLattice::gram_schmidt(&a);
                        b = b_temp;
                        mu = mu_temp;
                    }
                }
            }
            if utils::vdot(b[i], b[i])
               >= (delta - mu[i][i - 1].powi(2))
                  * utils::vdot(b[i - 1], b[i - 1])
            {
                i += 1;
            } else {
                for j in 0..3 {
                    b[0][0] = a[i][j];
                    a[i][j] = a[i - 1][j];
                    a[i - 1][j] = b[0][0];
                }
                let (b_temp, mu_temp) = ReducedLattice::gram_schmidt(&a);
                b = b_temp;
                mu = mu_temp;
                i = 1usize.max(i - 1);
            }
        }
        a
    }
fn lll_lattice ( lattice : [ [ f64 ; 3 ] ; 3 ] ) -> [ [ f64 ; 3 ] ; 3 ] { let delta = 0.75 ; let mut a = lattice ; let ( mut b , mut mu ) = ReducedLattice :: gram_schmidt ( & a ) ; let mut i = 1usize ; while i <= 2 { for j in ( 0 .. i ) . rev ( ) { match mu [ i ] [ j ] { q if q . abs ( ) <= 0.5 => ( ) , q => { for k in 0 .. 3 { a [ i ] [ k ] -= q . round ( ) * a [ j ] [ k ] ; } let ( b_temp , mu_temp ) = ReducedLattice :: gram_schmidt ( & a ) ; b = b_temp ; mu = mu_temp ; } } } if utils :: vdot ( b [ i ] , b [ i ] ) >= ( delta - mu [ i ] [ i - 1 ] . powi ( 2 ) ) * utils :: vdot ( b [ i - 1 ] , b [ i - 1 ] ) { i += 1 ; } else { for j in 0 .. 3 { b [ 0 ] [ 0 ] = a [ i ] [ j ] ; a [ i ] [ j ] = a [ i - 1 ] [ j ] ; a [ i - 1 ] [ j ] = b [ 0 ] [ 0 ] ; } let ( b_temp , mu_temp ) = ReducedLattice :: gram_schmidt ( & a ) ; b = b_temp ; mu = mu_temp ; i = 1usize . max ( i - 1 ) ; } } a }
Calculates the lll reduction of a lattice.
Calculates the lll reduction of a lattice .
lattice
[[f64; 3]; 3]
lattice
[[f64; 3]; 3]