Skip to content

Commit

Permalink
fix: fixed small issues
Browse files Browse the repository at this point in the history
  • Loading branch information
ariostas committed May 18, 2024
1 parent 6aa96cf commit 1933c2c
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 20 deletions.
6 changes: 2 additions & 4 deletions src/fundamental_period.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,7 @@ fn compute_c_0neg<T>(
+ 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();
Expand Down Expand Up @@ -367,8 +366,7 @@ where
+ SubAssign<&'a T>
+ Send
+ Sync
+ RecipMut
+ std::fmt::Display,
+ RecipMut,
{
let curves = &sg.elements;
let h11 = q.ncols();
Expand Down
18 changes: 13 additions & 5 deletions src/instanton.rs
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ fn compute_inst_thread<T>(
poly_props: &PolynomialProperties<T>,
np: &mut NumberPool<T>,
intnum_dict: &HashMap<(usize, usize, usize), i32>,
cy_dim: u32,
is_threefold: bool,
) where
for<'a> T: Clone
+ AddAssign<&'a T>
Expand Down Expand Up @@ -171,7 +171,7 @@ fn compute_inst_thread<T>(
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]))
Expand Down Expand Up @@ -250,7 +250,7 @@ pub fn compute_instanton_data<T>(
intnum_idxpairs: &HashSet<(usize, usize)>,
n_indices: usize,
intnum_dict: &HashMap<(usize, usize, usize), i32>,
cy_dim: u32,
is_threefold: bool,
) -> Result<InstantonData<T>, PolynomialError>
where
for<'a> T: Clone
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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();

Expand Down
29 changes: 18 additions & 11 deletions src/series_inversion.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down Expand Up @@ -215,6 +215,7 @@ where
+ MulAssign<u32>
+ PartialEq<i32>
+ PartialOrd<T>
+ PartialOrd<f32>
+ SubAssign<&'a T>
+ Send
+ Sync
Expand Down Expand Up @@ -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);
}
Expand Down Expand Up @@ -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();
Expand All @@ -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 {
Expand All @@ -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());
Expand Down Expand Up @@ -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);
Expand Down

0 comments on commit 1933c2c

Please sign in to comment.