From 942096620f07194d61d2a91868e6c814d980fb34 Mon Sep 17 00:00:00 2001 From: inthar-raven Date: Thu, 12 Sep 2024 13:05:03 -0400 Subject: [PATCH] Issue #43 --- src/guide.rs | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/guide.rs b/src/guide.rs index 298124d..ec790b5 100644 --- a/src/guide.rs +++ b/src/guide.rs @@ -163,6 +163,7 @@ impl GuideFrame { let co_d = scale.len() / d; if co_d % multiplicity != 0 { if d == multiplicity { + println!("interleaved"); // It's an interleaved scale. let subscales = (0..d) .map(|degree| rotate(scale, degree)) @@ -227,10 +228,10 @@ impl GuideFrame { vec![] } } else { + println!("not interleaved"); // stack at most this many k-steps - let chain_length: usize = co_d / multiplicity; + let chain_length: usize = scale.len() / multiplicity; if chain_length == 1 { - // check that all chain lengths of 1 are equal vec![] } else { // For every degree of `scale`, get stack of gs_length_limit-many k-steps on that degree. @@ -250,6 +251,8 @@ impl GuideFrame { // `init` will be nonempty, so the following check won't be vacuous. init.all(|k_step| *k_step != *last) }); + let g: Vec<_> = gen_chains_enumerated.clone().collect(); + println!("gen_chains_enumerated: {:?}", g); let gses: Vec>> = gen_chains_enumerated .clone() // Take prefix of gs_length_limit - 1 elements and get what GS it is generated by @@ -257,6 +260,7 @@ impl GuideFrame { .sorted() .dedup() .collect(); + println!("{:?}", gses); gses.iter() .map(|gs| { ( @@ -265,6 +269,11 @@ impl GuideFrame { .clone() // Check only the prefix of gs_length_limit - 1 elements, because that's what the guided GS is based on. .filter(|(_, gen_chain)| { + println!("gen_chain: {:?}", gen_chain); + println!( + "weak_period: {:?}", + weak_period(&gen_chain[..chain_length - 1]) + ); weak_period(&gen_chain[..chain_length - 1]) == *gs.clone() }) // Get all indices on which this particular GS occurs. @@ -285,10 +294,13 @@ impl GuideFrame { .collect(); union_of_chains.sort(); union_of_chains.dedup(); + println!("union_of_chains: {:?}", union_of_chains); let chains_are_disjoint: bool = union_of_chains.len() == scale.len(); chains_are_disjoint && polyoffset_indices.len() == multiplicity }) .map(|(gs, polyoffset_indices)| { + println!("gs: {:?}", gs); + println!("polyoffset_indices: {:?}", polyoffset_indices); let first_deg = polyoffset_indices[0]; let polyoffset: Vec> = polyoffset_indices .iter() @@ -330,7 +342,7 @@ impl GuideFrame { let mut guide_frames = [simple_guide_moses, multiple_guide_moses].concat(); guide_frames.sort_by_key(GuideFrame::complexity); - println!("{:?}", guide_frames); + // println!("{:?}", guide_frames); guide_frames } } @@ -350,6 +362,14 @@ mod tests { use crate::words::{CountVector, Letter}; use super::*; + #[test] + fn test_lllmllms() { + let bad_scale: [usize; 8] = [0, 0, 0, 1, 0, 0, 1, 2]; + let complexity_2_gses = GuideFrame::try_multiple(&bad_scale, 2, 2); + println!("{:?}", complexity_2_gses); + assert!(complexity_2_gses.is_empty()); + } + #[test] fn test_blackdye() { let blackdye: [usize; 10] = [0, 1, 0, 2, 0, 1, 0, 2, 0, 2];