Skip to content

Commit

Permalink
Introduce utility function iter_nonzero_stem
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeyBF committed Oct 3, 2024
1 parent 87377b1 commit 2e4b2fc
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 16 deletions.
4 changes: 2 additions & 2 deletions ext/examples/massey.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn main() -> anyhow::Result<()> {
b_hom.extend_through_stem(shift);

let offset_a = unit.module(a.s()).generator_offset(a.t(), a.t(), 0);
for c in resolution.iter_stem() {
for c in resolution.iter_nonzero_stem() {
if !resolution.has_computed_bidegree(c + shift) {
continue;
}
Expand All @@ -76,7 +76,7 @@ fn main() -> anyhow::Result<()> {
let num_gens = resolution.number_of_gens_in_bidegree(c);
let product_num_gens = resolution.number_of_gens_in_bidegree(b + c);
let target_num_gens = resolution.number_of_gens_in_bidegree(tot);
if num_gens == 0 || target_num_gens == 0 {
if target_num_gens == 0 {
continue;
}

Expand Down
5 changes: 1 addition & 4 deletions ext/examples/secondary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,17 +71,14 @@ fn main() -> anyhow::Result<()> {
let d2_shift = Bidegree::n_s(-1, 2);

// Iterate through target of the d2
for b in lift.underlying().iter_stem() {
for b in lift.underlying().iter_nonzero_stem() {
if b.s() < 3 {
continue;
}

if b.t() - 1 > resolution.module(b.s() - 2).max_computed_degree() {
continue;
}
if resolution.number_of_gens_in_bidegree(b) == 0 {
continue;
}
let homotopy = lift.homotopy(b.s());
let m = homotopy.homotopies.hom_k(b.t() - 1);

Expand Down
6 changes: 1 addition & 5 deletions ext/examples/secondary_product.rs
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ fn main() -> anyhow::Result<()> {

let name = hom_lift.name();
// Iterate through the multiplicand
for b in unit.iter_stem() {
for b in unit.iter_nonzero_stem() {
// The potential target has to be hit, and we need to have computed (the data need for) the
// d2 that hits the potential target.
if !resolution.has_computed_bidegree(b + shift + TAU_BIDEGREE) {
Expand All @@ -137,10 +137,6 @@ fn main() -> anyhow::Result<()> {
continue;
}

if unit.number_of_gens_in_bidegree(b) == 0 {
continue;
}

let page_data = get_page_data(unit_sseq.as_ref(), b);

let target_num_gens = resolution.number_of_gens_in_bidegree(b + shift);
Expand Down
6 changes: 1 addition & 5 deletions ext/examples/sq0.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,16 +36,12 @@ fn main() -> anyhow::Result<()> {
);
hom.extend_all();

for b in res.iter_stem() {
for b in res.iter_nonzero_stem() {
let doubled_b = Bidegree::s_t(b.s(), 2 * b.t());
if !res.has_computed_bidegree(doubled_b) {
continue;
}

let num_gens = res.number_of_gens_in_bidegree(b);
if num_gens == 0 {
continue;
}
let source_num_gens = res.number_of_gens_in_bidegree(doubled_b);
let module = res.module(b.s());
let offset = module.generator_offset(b.t(), b.t(), 0);
Expand Down
6 changes: 6 additions & 0 deletions ext/src/chain_complex/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,12 @@ where
self.module(b.s()).number_of_gens_in_degree(b.t())
}

/// Iterate through all nonzero bidegrees in increasing order of stem.
fn iter_nonzero_stem(&self) -> impl Iterator<Item = Bidegree> + '_ {
self.iter_stem()
.filter(move |&b| self.number_of_gens_in_bidegree(b) > 0)
}

/// Get a string representation of d(gen), where d is the differential of the resolution.
fn boundary_string(&self, gen: BidegreeGenerator, compact: bool) -> String {
let d = self.differential(gen.s());
Expand Down

0 comments on commit 2e4b2fc

Please sign in to comment.