diff --git a/src/fundamental_period.rs b/src/fundamental_period.rs index 6bb3508..788cafb 100644 --- a/src/fundamental_period.rs +++ b/src/fundamental_period.rs @@ -61,8 +61,7 @@ fn compute_c_0neg( + Assign<&'a T> + AddAssign<&'a T> + SubAssign<&'a T> - + MulAssign<&'a T> - + std::fmt::Display, + + MulAssign<&'a T>, { let mut a: Vec<_> = (0..q.ncols()).map(|_| template_var.clone()).collect(); let mut tmp_num0 = template_var.clone(); @@ -367,8 +366,7 @@ where + SubAssign<&'a T> + Send + Sync - + RecipMut - + std::fmt::Display, + + RecipMut, { let curves = &sg.elements; let h11 = q.ncols(); diff --git a/src/instanton.rs b/src/instanton.rs index 4e93812..c610768 100644 --- a/src/instanton.rs +++ b/src/instanton.rs @@ -137,7 +137,7 @@ fn compute_inst_thread( poly_props: &PolynomialProperties, np: &mut NumberPool, intnum_dict: &HashMap<(usize, usize, usize), i32>, - cy_dim: u32, + is_threefold: bool, ) where for<'a> T: Clone + AddAssign<&'a T> @@ -171,7 +171,7 @@ fn compute_inst_thread( intnum_ind[0] = t; intnum_ind[1] = a; intnum_ind[2] = b; - if cy_dim == 3 { + if is_threefold { intnum_ind.sort_unstable(); } let Some(x) = intnum_dict.get(&(intnum_ind[0], intnum_ind[1], intnum_ind[2])) @@ -250,7 +250,7 @@ pub fn compute_instanton_data( intnum_idxpairs: &HashSet<(usize, usize)>, n_indices: usize, intnum_dict: &HashMap<(usize, usize, usize), i32>, - cy_dim: u32, + is_threefold: bool, ) -> Result, PolynomialError> where for<'a> T: Clone @@ -342,7 +342,15 @@ where let tx = tx.clone(); let tasks = Arc::clone(&tasks_inst_iter); s.spawn(|| { - compute_inst_thread(tasks, tx, &f_poly, poly_props, np, intnum_dict, cy_dim); + compute_inst_thread( + tasks, + tx, + &f_poly, + poly_props, + np, + intnum_dict, + is_threefold, + ); }); } drop(tx); @@ -418,7 +426,7 @@ mod tests { let (intnum_dict, intnum_idxpairs) = result.unwrap(); let inst_data = - compute_instanton_data(fp, &poly_props, &intnum_idxpairs, 2, &intnum_dict, 3); + compute_instanton_data(fp, &poly_props, &intnum_idxpairs, 2, &intnum_dict, true); assert!(inst_data.is_ok()); let inst_data = inst_data.unwrap(); diff --git a/src/series_inversion.rs b/src/series_inversion.rs index 7d699bc..e825764 100644 --- a/src/series_inversion.rs +++ b/src/series_inversion.rs @@ -81,7 +81,7 @@ where for (i, diff) in closest_curve_diff.iter().enumerate() { let tmp_poly = match diff.cmp(&0) { Ordering::Greater => expalpha[i].0.pow(*diff, poly_props, np).unwrap(), - Ordering::Less => expalpha[i].0.pow(-*diff, poly_props, np).unwrap(), + Ordering::Less => expalpha[i].1.pow(-*diff, poly_props, np).unwrap(), _ => { continue; } @@ -215,6 +215,7 @@ where + MulAssign + PartialEq + PartialOrd + + PartialOrd + SubAssign<&'a T> + Send + Sync @@ -246,18 +247,24 @@ where let InstantonData { mut inst, expalpha } = inst_data; - let all_degs: HashSet<_> = poly_props.semigroup.degrees.iter().cloned().collect(); + let all_degs: HashSet<_> = poly_props + .semigroup + .degrees + .iter() + .cloned() + .filter(|c| *c != 0) + .collect(); let mut distinct_degs: Vec<_> = all_degs.into_iter().collect(); distinct_degs.sort_unstable(); for d in distinct_degs.iter() { let mut vec_deg = Vec::new(); let mut qn_to_compute = Vec::new(); - let mut gv_qn_to_compute = Vec::new(); + let mut gv_qn_to_compute = HashMap::new(); let mut h22gv_qn_to_compute = HashMap::new(); // First find the points of interest for (i, dd) in poly_props.semigroup.degrees.iter().enumerate() { - match d.cmp(dd) { + match dd.cmp(d) { Ordering::Equal => { vec_deg.push(i); } @@ -288,17 +295,17 @@ where tmp_gv_rounded.round_mut(); tmp_gv -= &tmp_gv_rounded; tmp_gv.abs_mut(); - if tmp_gv > poly_props.zero_cutoff { + if tmp_gv > 1e-3 { return Err(SeriesInversionError::NonIntegerGVError); } tmp_gv.assign(&tmp_gv_rounded); tmp_gv.abs_mut(); - if tmp_gv <= poly_props.zero_cutoff { + if tmp_gv < 0.5 { continue; } final_gv.insert((j as u32, 0), tmp_gv_rounded.clone()); qn_to_compute.push(j); - gv_qn_to_compute.push(tmp_gv_rounded.clone()); + gv_qn_to_compute.insert(j, tmp_gv_rounded.clone()); } else { tmp_gv_rounded.assign(&tmp_gv); tmp_gv_rounded.abs_mut(); @@ -307,7 +314,7 @@ where } final_gv.insert((j as u32, 0), tmp_gv.clone()); qn_to_compute.push(j); - gv_qn_to_compute.push(tmp_gv.clone()); + gv_qn_to_compute.insert(j, tmp_gv.clone()); } } } else { @@ -321,12 +328,12 @@ where tmp_gv_rounded.round_mut(); tmp_gv -= &tmp_gv_rounded; tmp_gv.abs_mut(); - if tmp_gv > poly_props.zero_cutoff { + if tmp_gv > 1e-3 { return Err(SeriesInversionError::NonIntegerGVError); } tmp_gv.assign(&tmp_gv_rounded); tmp_gv.abs_mut(); - if tmp_gv <= poly_props.zero_cutoff { + if tmp_gv < 0.5 { continue; } final_gv.insert((j as u32, k as u32), tmp_gv_rounded.clone()); @@ -385,7 +392,7 @@ where continue; } let mut tmp_poly = li2qn.clone(&mut main_pool); - tmp_gv.assign(&gv_qn_to_compute[j as usize]); + tmp_gv.assign(&gv_qn_to_compute[&(j as usize)]); tmp_gv *= poly_props.semigroup.elements[(k, j as usize)]; tmp_poly.mul_scalar_assign(&tmp_gv); inst_k.sub_assign(&tmp_poly, &mut main_pool);