Skip to content

Commit

Permalink
Issue #43
Browse files Browse the repository at this point in the history
  • Loading branch information
inthar-raven committed Sep 12, 2024
1 parent c8b703e commit 9420966
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions src/guide.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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))
Expand Down Expand Up @@ -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.
Expand All @@ -250,13 +251,16 @@ 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<Vec<CountVector<Letter>>> = gen_chains_enumerated
.clone()
// Take prefix of gs_length_limit - 1 elements and get what GS it is generated by
.map(|(_, chain)| weak_period(&chain[0..chain_length - 1]))
.sorted()
.dedup()
.collect();
println!("{:?}", gses);
gses.iter()
.map(|gs| {
(
Expand All @@ -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.
Expand All @@ -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<CountVector<Letter>> = polyoffset_indices
.iter()
Expand Down Expand Up @@ -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
}
}
Expand All @@ -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];
Expand Down

0 comments on commit 9420966

Please sign in to comment.