pub fn sea(ec: &elliptic_curve::EllipticCurve, l: i32) -> SEAResult {
    let mut mpol = modular_polynomial::modular_polynomial(l);
    mpol.modular_assign(&ec.p);
    let mut mpol = mpol.eval_y(&ec.j_invariant());
    mpol.modular_assign(&ec.p);
    let pp: i32 = ec.p.to_i32().unwrap();
    let pol = term_builder::TermBuilder::new().xpow(pp).build()
            - term_builder::TermBuilder::new().xpow(1).build();
    let gcd = pol.gcd(&mpol, &ec.p);
    // elkies prime for degree 1, 2, l+1
    // atkins prime for degree 0
    let degree = gcd.clone().degree_x();
    let is_elkies_prime = gcd.degree_x() > Zero::zero();
    let mut isogeny_j_invariants: Vec<BigInt> = Vec::new();
    if is_elkies_prime {
        for j in num_iter::range(BigInt::from(0), ec.p.clone()) {
            let mut tmp = gcd.clone().eval_x(&j.clone());
            tmp.modular_assign(&ec.p);
            if tmp.is_zero() {
                isogeny_j_invariants.push(j);
                if degree.clone() == isogeny_j_invariants.len().try_into().unwrap() ||
                   isogeny_j_invariants.len() == 2
                {
                    break;
                }
            }
        }
    }
    SEAResult {
        gcd: gcd.clone(),
        degree_of_gcd: degree.clone(),
        is_elkies_prime: is_elkies_prime,
        isogeny_j_invariants: isogeny_j_invariants,
    }
}
/// SEA algorithm
/// TODO: in implementation
SEA algorithm
TODO: in implementation
SEA algorithm TODO : in implementation
pub fn sea(ec: &elliptic_curve::EllipticCurve, l: i32) -> SEAResult {
    let mut mpol = modular_polynomial::modular_polynomial(l);
    mpol.modular_assign(&ec.p);
    let mut mpol = mpol.eval_y(&ec.j_invariant());
    mpol.modular_assign(&ec.p);
    let pp: i32 = ec.p.to_i32().unwrap();
    let pol = term_builder::TermBuilder::new().xpow(pp).build()
            - term_builder::TermBuilder::new().xpow(1).build();
    let gcd = pol.gcd(&mpol, &ec.p);
    // elkies prime for degree 1, 2, l+1
    // atkins prime for degree 0
    let degree = gcd.clone().degree_x();
    let is_elkies_prime = gcd.degree_x() > Zero::zero();
    let mut isogeny_j_invariants: Vec<BigInt> = Vec::new();
    if is_elkies_prime {
        for j in num_iter::range(BigInt::from(0), ec.p.clone()) {
            let mut tmp = gcd.clone().eval_x(&j.clone());
            tmp.modular_assign(&ec.p);
            if tmp.is_zero() {
                isogeny_j_invariants.push(j);
                if degree.clone() == isogeny_j_invariants.len().try_into().unwrap() ||
                   isogeny_j_invariants.len() == 2
                {
                    break;
                }
            }
        }
    }
    SEAResult {
        gcd: gcd.clone(),
        degree_of_gcd: degree.clone(),
        is_elkies_prime: is_elkies_prime,
        isogeny_j_invariants: isogeny_j_invariants,
    }
}
pub fn sea ( ec : & elliptic_curve :: EllipticCurve , l : i32 ) -> SEAResult { let mut mpol = modular_polynomial :: modular_polynomial ( l ) ; mpol . modular_assign ( & ec . p ) ; let mut mpol = mpol . eval_y ( & ec . j_invariant ( ) ) ; mpol . modular_assign ( & ec . p ) ; let pp : i32 = ec . p . to_i32 ( ) . unwrap ( ) ; let pol = term_builder :: TermBuilder :: new ( ) . xpow ( pp ) . build ( ) - term_builder :: TermBuilder :: new ( ) . xpow ( 1 ) . build ( ) ; let gcd = pol . gcd ( & mpol , & ec . p ) ; // elkies prime for degree 1, 2, l+1 // atkins prime for degree 0 let degree = gcd . clone ( ) . degree_x ( ) ; let is_elkies_prime = gcd . degree_x ( ) > Zero :: zero ( ) ; let mut isogeny_j_invariants : Vec < BigInt > = Vec :: new ( ) ; if is_elkies_prime { for j in num_iter :: range ( BigInt :: from ( 0 ) , ec . p . clone ( ) ) { let mut tmp = gcd . clone ( ) . eval_x ( & j . clone ( ) ) ; tmp . modular_assign ( & ec . p ) ; if tmp . is_zero ( ) { isogeny_j_invariants . push ( j ) ; if degree . clone ( ) == isogeny_j_invariants . len ( ) . try_into ( ) . unwrap ( ) || isogeny_j_invariants . len ( ) == 2 { break ; } } } } SEAResult { gcd : gcd . clone ( ) , degree_of_gcd : degree . clone ( ) , is_elkies_prime : is_elkies_prime , isogeny_j_invariants : isogeny_j_invariants , } }
SEA algorithm
TODO: in implementation
SEA algorithm TODO : in implementation
ec
&elliptic_curve::EllipticCurve
l
i32