Skip to content

Commit

Permalink
Make fields less pub
Browse files Browse the repository at this point in the history
  • Loading branch information
dalcde committed Mar 30, 2022
1 parent bd033ae commit 0f915d3
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 6 deletions.
8 changes: 6 additions & 2 deletions ext/crates/algebra/src/algebra/adem_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ unsafe fn shift_vec<T>(v: &mut Vec<T>, offset: isize) {
/// An [`Algebra`] implementing the Steenrod algebra, using the Adem basis.
pub struct AdemAlgebra {
p: ValidPrime,
pub generic: bool,
pub unstable_enabled: bool,
generic: bool,
unstable_enabled: bool,
lock: Mutex<()>,

even_basis_table: OnceVec<Vec<AdemBasisElement>>,
Expand Down Expand Up @@ -497,6 +497,10 @@ impl AdemAlgebra {
}
}

pub fn generic(&self) -> bool {
self.generic
}

pub fn q(&self) -> i32 {
if self.generic {
2 * (*self.prime() as i32 - 1)
Expand Down
10 changes: 8 additions & 2 deletions ext/crates/algebra/src/algebra/milnor_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -276,9 +276,9 @@ pub struct MilnorAlgebra {
p: ValidPrime,
#[cfg(feature = "odd-primes")]
generic: bool,
pub ppart_table: OnceVec<Vec<PPart>>,
ppart_table: OnceVec<Vec<PPart>>,
qpart_table: Vec<OnceVec<QPart>>,
pub basis_table: OnceVec<Vec<MilnorBasisElement>>,
basis_table: OnceVec<Vec<MilnorBasisElement>>,
basis_element_to_index_map: OnceVec<MilnorHashMap<usize>>, // degree -> MilnorBasisElement -> index
#[cfg(feature = "cache-multiplication")]
multiplication_table: OnceVec<OnceVec<Vec<Vec<FpVector>>>>, // source_deg -> target_deg -> source_op -> target_op
Expand Down Expand Up @@ -336,6 +336,7 @@ impl MilnorAlgebra {
pub fn profile(&self) -> &MilnorProfile {
&self.profile
}

pub fn basis_element_from_index(&self, degree: i32, idx: usize) -> &MilnorBasisElement {
&self.basis_table[degree as usize][idx]
}
Expand All @@ -350,6 +351,11 @@ impl MilnorAlgebra {
self.try_basis_element_to_index(elt)
.unwrap_or_else(|| panic!("Didn't find element: {:?}", elt))
}

/// Gives a list of PPart's in degree `t`.
pub fn ppart_table(&self, t: i32) -> &[PPart] {
&self.ppart_table[t as usize]
}
}

impl Algebra for MilnorAlgebra {
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/steenrod_evaluator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -338,7 +338,7 @@ impl SteenrodEvaluator {
fn adem_q(&self, result: &mut FpVector, coeff: u32, qi: u32) {
let p = self.prime();
let degree = crate::algebra::combinatorics::tau_degrees(p)[qi as usize];
let mbe = if self.adem.generic {
let mbe = if self.adem.generic() {
MilnorBasisElement {
degree,
q_part: 1 << qi,
Expand Down
3 changes: 2 additions & 1 deletion ext/src/nassau.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,8 @@ impl MilnorSubalgebra {
start: [offset],
end: _,
}| {
algebra.ppart_table[(degree - gen_deg) as usize]
algebra
.ppart_table(degree - gen_deg)
.iter()
.enumerate()
.filter_map(move |(n, op)| {
Expand Down

0 comments on commit 0f915d3

Please sign in to comment.