Skip to content

Commit

Permalink
Bump webpack from 5.93.0 to 5.94.0
Browse files Browse the repository at this point in the history
Bumps [webpack](https://github.com/webpack/webpack) from 5.93.0 to 5.94.0.
- [Release notes](https://github.com/webpack/webpack/releases)
- [Commits](webpack/webpack@v5.93.0...v5.94.0)

---
updated-dependencies:
- dependency-name: webpack
  dependency-type: direct:development
  update-type: version-update:semver-minor
...

Signed-off-by: dependabot[bot] <[email protected]>
  • Loading branch information
dependabot[bot] authored and inthar-raven committed Aug 26, 2024
1 parent 4a47aa4 commit a0d5145
Show file tree
Hide file tree
Showing 4 changed files with 89 additions and 54 deletions.
44 changes: 10 additions & 34 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"@wasm-tool/wasm-pack-plugin": "1.7.0",
"html-webpack-plugin": "^5.6.0",
"prettier": "3.3.3",
"webpack": "^5.93.0",
"webpack": "^5.94.0",
"webpack-cli": "^5.1.4",
"webpack-dev-server": "^5.0.4"
}
Expand Down
84 changes: 65 additions & 19 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ pub mod words;

use itertools::Itertools;
use wasm_bindgen::prelude::*;
use words::countvector_to_slice;
use words::dyad_on_degree;
use words::Letter;

#[wasm_bindgen]
Expand Down Expand Up @@ -229,28 +231,70 @@ fn guide_frame_to_result(structure: &GuideFrame) -> GuideResult {

fn get_unimodular_basis(
structures: &[GuideFrame],
scale: &[usize],
step_sig: &[u8],
) -> Option<(Vec<Vec<u8>>, GuideResult)> {
/*
if (structure["multiplicity"] === 1) {
if (structure["polyoffset"].length === 1) {
// Check for two unequal step vectors.
outer: for (let i = 0; i < gs.length; ++i) {
for (let j = i; j < gs.length; ++j) {
if (!isEqual(gs[i], gs[j])) {
g = [...Object.values(gs[i])];
h = [...Object.values(gs[j])];
break outer;
}
}
}
} else {
g = [...Object.values(structure["aggregate"])];
h = [...Object.values(structure["polyoffset"][1])];
}
} else {
g = [...Object.values(structure["aggregate"])];
h = [...Object.values(dyadOnDegree(
scaleWord,
scaleWord.length / structure["multiplicity"],
scaleWord.length / structure["multiplicity"],
))];
}
*/
for structure in structures {
let structure = guide_frame_to_result(structure);
let gs = structure.clone().gs.clone();
for i in 0..gs.clone().len() {
for j in i..gs.clone().len() {
if det3(step_sig, &gs.clone()[i], &gs.clone()[j]).abs() == 1 {
return Some((
vec![gs.clone()[i].clone(), gs.clone()[j].clone()],
structure,
));
if structure.multiplicity == 1 {
let structure = guide_frame_to_result(structure);
let gs = structure.gs.clone();
for i in 0..gs.clone().len() {
for j in i..gs.clone().len() {
if det3(step_sig, &gs[i], &gs[j]).abs() == 1 {
return Some((vec![gs[i].clone(), gs[j].clone()], structure));
}
}
}
}
let polyoffset = structure.clone().polyoffset;
for v in polyoffset {
for w in structure.clone().gs {
if det3(step_sig, &v, &w).abs() == 1 {
return Some((vec![v, w], structure));
let polyoffset = structure.clone().polyoffset;
for v in polyoffset {
for w in structure.clone().gs {
if det3(step_sig, &v, &w).abs() == 1 {
return Some((vec![v, w], structure));
}
}
}
} else {
// this branch handles diregular scales
let structure = guide_frame_to_result(structure);
let vec_for_gs_element = structure.gs[0].clone();
let vec_for_detempered_period = countvector_to_slice(dyad_on_degree(
scale,
0,
scale.len() / structure.clone().multiplicity as usize,
))
.iter()
.map(|x| *x as u8)
.collect();
return Some((
vec![vec_for_gs_element, vec_for_detempered_period],
structure,
));
}
}
None
Expand All @@ -266,9 +310,11 @@ pub fn word_to_profile(query: &[usize]) -> ScaleProfile {
.iter()
.map(|x| *x as u8)
.collect::<Vec<u8>>();
let structures = guide_frames(query);
let some_guide_frame = structures.first();
if let Some(pair) = get_unimodular_basis(&guide_frames(query), &step_sig) {
if let Some(pair) = get_unimodular_basis(
&guide_frames(query),
&string_to_numbers(&brightest),
&step_sig,
) {
let (lattice_basis, structure) = pair;
ScaleProfile {
word: brightest,
Expand All @@ -283,7 +329,7 @@ pub fn word_to_profile(query: &[usize]) -> ScaleProfile {
ScaleProfile {
word: brightest,
lattice_basis: None,
structure: some_guide_frame.map(guide_frame_to_result),
structure: None,
lm,
ms,
s0,
Expand Down
13 changes: 13 additions & 0 deletions src/words.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,19 @@ impl<T> CountVector<T> {
}
}

pub fn countvector_to_slice(v: CountVector<usize>) -> Vec<i32> {
if v.is_empty() {
vec![]
} else {
let max = *v.into_inner().last_key_value().unwrap().0;
let mut result = vec![0; max + 1];
for key in v.into_inner().keys() {
result[*key] = *v.get(key).unwrap();
}
result
}
}

/// Treating `scale` as a circular string (that is, "scale[i] == scale[i % scale.len()]"),
/// take a slice of length `subword_length` from `degree`; assumes `subword_length` <= `scale`.len().
/// Reduce `degree` first.
Expand Down

0 comments on commit a0d5145

Please sign in to comment.