Skip to content

Commit

Permalink
Revert "Fix up rest of code"
Browse files Browse the repository at this point in the history
This reverts commit 519103f62a1a78141056f853888c796f34e7fc33.
  • Loading branch information
JoeyBF committed May 20, 2022
1 parent 9ffec13 commit aa58872
Show file tree
Hide file tree
Showing 52 changed files with 64 additions and 136 deletions.
7 changes: 2 additions & 5 deletions ext/crates/algebra/src/algebra/adem_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,8 @@ use nom::{
IResult,
};

use fp::vector::{BaseVector, FpVector, SliceMut};
use fp::{
prime::{BinomialIterator, BitflagIterator, ValidPrime},
vector::BaseVectorMut,
};
use fp::prime::{BinomialIterator, BitflagIterator, ValidPrime};
use fp::vector::{FpVector, SliceMut};
use once::OnceVec;

use crate::algebra::combinatorics::{self, MAX_XI_TAU};
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/algebra/algebra_trait.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use fp::prime::ValidPrime;
use fp::vector::{BaseVector, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};

#[cfg(doc)]
use fp::vector::FpVector;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/algebra/combinatorics.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use fp::vector::{BaseVector, BaseVectorMut, FpVector};
use fp::vector::FpVector;
use once::OnceVec;

use fp::prime::{minus_one_to_the_n, Binomial, ValidPrime};
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/algebra/field.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use crate::algebra::{Algebra, Bialgebra};
use fp::prime::ValidPrime;
use fp::vector::{BaseVector, BaseVectorMut, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};

/// $\mathbb{F}_p$, viewed as an [`Algebra`] over itself.
///
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/algebra/milnor_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use std::sync::Mutex;
use crate::algebra::combinatorics;
use crate::algebra::{Algebra, Bialgebra, GeneratedAlgebra};
use fp::prime::{integer_power, Binomial, BitflagIterator, ValidPrime};
use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};
use once::OnceVec;

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/algebra/polynomial_algebra.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use rustc_hash::FxHashMap as HashMap;
use std::fmt;

use fp::prime::ValidPrime;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, SliceMut};
use fp::vector::{FpVector, SliceMut};
use once::OnceVec;

use crate::algebra::combinatorics::TruncatedPolynomialMonomialBasis;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/change_of_basis.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::algebra::adem_algebra::AdemBasisElement;
use crate::algebra::milnor_algebra::{MilnorBasisElement, PPart, PPartEntry};
use crate::algebra::{AdemAlgebra, Algebra, MilnorAlgebra};
use fp::vector::{BaseVector, BaseVectorMut, FpVector};
use fp::vector::FpVector;

// use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/bcp.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use fp::prime::ValidPrime;
use fp::vector::{BaseVectorMut, FpVector};
use fp::vector::FpVector;
use once::OnceVec;

use crate::algebra::combinatorics::TruncatedPolynomialMonomialBasis;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/block_structure.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// we have to pull out each block and multiply each block separately by the steenrod operation.

use bivec::BiVec;
use fp::vector::{BaseVector, BaseVectorMut, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};

#[derive(Debug)]
pub struct GeneratorBasisEltPair {
Expand Down
1 change: 0 additions & 1 deletion ext/crates/algebra/src/module/bounded_module.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
use bivec::BiVec;
use fp::vector::BaseVectorMut;
use fp::vector::FpVector;

use crate::module::FDModule;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/dickson2.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use fp::prime::ValidPrime;
use fp::vector::{BaseVectorMut, FpVector};
use fp::vector::FpVector;
use once::OnceVec;

use crate::algebra::{
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/finite_dimensional_module.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::algebra::Algebra;
use crate::module::{BoundedModule, Module, ZeroModule};
use bivec::BiVec;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, SliceMut};
use fp::vector::{FpVector, SliceMut};
use std::sync::Arc;

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/finitely_presented_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::algebra::Algebra;
use crate::module::homomorphism::{FreeModuleHomomorphism, ModuleHomomorphism};
use crate::module::{FreeModule, Module, ZeroModule};
use fp::matrix::Matrix;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, SliceMut};
use fp::vector::{FpVector, SliceMut};
use once::OnceBiVec;

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/free_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use crate::algebra::Algebra;
use crate::module::Module;
use fp::vector::{BaseVector, BaseVectorMut, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};
use once::{OnceBiVec, OnceVec};

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/free_unstable_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::algebra::{AdemAlgebra, AdemAlgebraT};
use crate::module::Module;
use crate::module::OperationGeneratorPair;
use fp::vector::{BaseVector, BaseVectorMut, SliceMut};
use fp::vector::SliceMut;
use once::{OnceBiVec, OnceVec};

#[cfg(feature = "json")]
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/hom_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::algebra::{Algebra, Field};
use crate::module::block_structure::BlockStructure;
use crate::module::homomorphism::FreeModuleHomomorphism;
use crate::module::{BoundedModule, FreeModule, Module};
use fp::vector::{BaseVector, BaseVectorMut, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};
use once::OnceBiVec;

pub struct HomModule<M: BoundedModule> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::module::homomorphism::{IdentityHomomorphism, ModuleHomomorphism, Zero
use crate::module::{BoundedModule, Module};
use bivec::BiVec;
use fp::matrix::{Matrix, QuasiInverse, Subspace};
use fp::vector::{BaseVector, BaseVectorMut, SliceMut};
use fp::vector::SliceMut;
use once::OnceBiVec;

pub struct BoundedModuleHomomorphism<S: BoundedModule, T: Module<Algebra = S::Algebra>> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
use fp::vector::BaseVector;

use super::{FreeModuleHomomorphism, ModuleHomomorphism};
use crate::module::{FreeModule, Module};
use std::sync::Arc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::module::homomorphism::{
};
use crate::module::{FPModule, FreeModule, Module};
use fp::matrix::Matrix;
use fp::vector::{BaseVectorMut, SliceMut};
use fp::vector::SliceMut;

pub struct FPModuleHomomorphism<N: FPModuleT, M: Module<Algebra = N::Algebra>> {
source: Arc<N>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::module::free_module::OperationGeneratorPair;
use crate::module::homomorphism::{CompositionHomomorphism, ModuleHomomorphism};
use crate::module::{FreeModule, Module};
use fp::matrix::{MatrixSliceMut, QuasiInverse, Subspace};
use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};
use once::OnceBiVec;

pub struct FreeModuleHomomorphism<M: Module> {
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/homomorphism/hom_pullback.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use std::sync::Arc;

use crate::module::block_structure::BlockStart;
use fp::matrix::{QuasiInverse, Subspace};
use fp::vector::{BaseVector, BaseVectorMut, SliceMut};
use fp::vector::SliceMut;
use once::OnceBiVec;
// use crate::algebra::SteenrodAlgebra;
// use crate::field::Field;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/homomorphism/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use std::sync::Arc;
use crate::module::Module;
use fp::matrix::{AugmentedMatrix, MatrixSliceMut, QuasiInverse, Subspace};
use fp::prime::ValidPrime;
use fp::vector::{BaseVector, Slice, SliceMut};
use fp::vector::{Slice, SliceMut};

mod bounded_module_homomorphism;
mod composition_homomorphism;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use crate::module::{Module, QuotientModule};
use fp::vector::{BaseVector, BaseVectorMut, FpVector, SliceMut};
use fp::vector::{FpVector, SliceMut};
use std::sync::Arc;

use crate::module::homomorphism::ModuleHomomorphism;
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/kfpn.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use std::sync::Arc;

use fp::prime::ValidPrime;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, SliceMut};
use fp::vector::{FpVector, SliceMut};
use once::OnceVec;

use crate::algebra::{
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/module_trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use itertools::Itertools;
use std::sync::Arc;

use fp::prime::ValidPrime;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};

use crate::algebra::Algebra;
use {crate::module::BoundedModule, crate::module::FDModule, crate::module::TruncatedModule};
Expand Down
6 changes: 3 additions & 3 deletions ext/crates/algebra/src/module/polynomial_algebra_module.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use std::sync::Arc;

use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};
use once::OnceVec;

use crate::algebra::{AdemAlgebraT, Algebra};
Expand Down Expand Up @@ -335,7 +335,7 @@ pub trait PolynomialAlgebraModule: PolynomialAlgebra {
result_degree,
i32::max_value(),
));
result.add(&*reducer_a, 1);
result.add(reducer_a, 1);
}
result
}
Expand Down Expand Up @@ -388,7 +388,7 @@ pub trait PolynomialAlgebraModule: PolynomialAlgebra {
result_degree,
i32::max_value(),
));
result.add(&*reducer_a, 1);
result.add(reducer_a, 1);
}
result
}
Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/quotient_module.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::module::{BoundedModule, Module};
use fp::matrix::Subspace;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};
use once::OnceBiVec;
use std::sync::Arc;

Expand Down
5 changes: 1 addition & 4 deletions ext/crates/algebra/src/module/rpn.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,8 @@ use crate::algebra::{
AdemAlgebra, MilnorAlgebra, SteenrodAlgebraBorrow, SteenrodAlgebraT,
};
use crate::module::{BoundedModule, Module, ZeroModule};
use fp::prime::{Binomial, ValidPrime};
use fp::vector::SliceMut;
use fp::{
prime::{Binomial, ValidPrime},
vector::BaseVectorMut,
};

use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/sum_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use once::OnceBiVec;

use crate::module::block_structure::{BlockStart, BlockStructure, GeneratorBasisEltPair};
use crate::module::{BoundedModule, Module, ZeroModule};
use fp::vector::{BaseVectorMut, SliceMut};
use fp::vector::SliceMut;

use std::sync::Arc;

Expand Down
2 changes: 1 addition & 1 deletion ext/crates/algebra/src/module/tensor_module.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::algebra::{Algebra, Bialgebra};
use crate::module::block_structure::BlockStructure;
use crate::module::{BoundedModule, Module, ZeroModule};
use fp::prime::minus_one_to_the_n;
use fp::vector::{BaseVector, BaseVectorMut, FpVector, Slice, SliceMut};
use fp::vector::{FpVector, Slice, SliceMut};

use std::sync::Arc;

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 @@ -4,7 +4,7 @@ use crate::change_of_basis;
use crate::module::Module;
use crate::steenrod_parser::BocksteinOrSq;
use crate::steenrod_parser::*;
use fp::vector::{BaseVector, BaseVectorMut, FpVector};
use fp::vector::FpVector;
use rustc_hash::FxHashMap as HashMap;

// Outputs in the Adem basis.
Expand Down
8 changes: 0 additions & 8 deletions ext/crates/fp/src/vector/generic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ impl<const P: u32> FpVectorP<P> {
}
}

pub fn from_raw_parts(len: usize, limbs: Vec<Limb>) -> Self {
debug_assert_eq!(limbs.len(), limb::number::<P>(len));
Self {
len: LimbLength::from_logical(len),
limbs,
}
}

pub fn new_with_capacity_(len: usize, capacity: usize) -> Self {
let length = LimbLength::<P>::from_logical(len);
let mut limbs = Vec::with_capacity(limb::number::<P>(capacity));
Expand Down
34 changes: 17 additions & 17 deletions ext/crates/fp/src/vector/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -198,7 +198,7 @@ mod test {
(fn $name:ident($p:ident: ValidPrime) $body:tt $($rest:tt)*) => {
#[rstest]
#[trace]
fn $name(#[values(2, 3, 5, 7)] p: u32) {
fn $name(#[values(2)] p: u32) {
let $p = ValidPrime::new(p);

$body
Expand All @@ -208,7 +208,7 @@ mod test {
(fn $name:ident($p:ident: ValidPrime, $dim:ident: usize) $body:tt $($rest:tt)*) => {
#[rstest]
#[trace]
fn $name(#[values(2, 3, 5, 7)] p: u32, #[values(10, 20, 70, 100, 1000)] $dim: usize) {
fn $name(#[values(2)] p: u32, #[values(10, 20, 70, 100, 1000)] $dim: usize) {
let $p = ValidPrime::new(p);

$body
Expand All @@ -218,7 +218,7 @@ mod test {
(fn $name:ident($p:ident: ValidPrime, $dim:ident: usize, $slice_start:ident: usize, $slice_end:ident: usize) $body:tt $($rest:tt)*) => {
#[rstest]
#[trace]
fn $name(#[values(2, 3, 5, 7)] p: u32, #[values(10, 20, 70, 100, 1000)] $dim: usize) {
fn $name(#[values(2)] p: u32, #[values(10, 20, 70, 100, 1000)] $dim: usize) {
let $p = ValidPrime::new(p);

let $slice_start = match $dim {
Expand Down Expand Up @@ -435,34 +435,34 @@ mod test {
v.assert_list_eq(&v_arr);
}

fn test_add_shift_right(p: ValidPrime, dim: usize, slice_start: usize, slice_end: usize) {
fn test_add_shift_left(p: ValidPrime, dim: usize, slice_start: usize, slice_end: usize) {
let mut v_arr = random_vector(p, dim);
let w_arr = random_vector(p, dim);

let mut v = FpVector::from_slice(p, &v_arr);
let w = FpVector::from_slice(p, &w_arr);

v.slice_mut(slice_start + 2, slice_end + 2)
v.slice_mut(slice_start - 2, slice_end - 2)
.add(w.slice(slice_start, slice_end), 1);

println!("v : {}", v);
for i in slice_start + 2..slice_end + 2 {
v_arr[i] = (v_arr[i] + w_arr[i - 2]) % *p;
for i in slice_start - 2..slice_end - 2 {
v_arr[i] = (v_arr[i] + w_arr[i + 2]) % *p;
}
v.assert_list_eq(&v_arr);
}

fn test_add_shift_left(p: ValidPrime, dim: usize, slice_start: usize, slice_end: usize) {
fn test_add_shift_right(p: ValidPrime, dim: usize, slice_start: usize, slice_end: usize) {
let mut v_arr = random_vector(p, dim);
let w_arr = random_vector(p, dim);

let mut v = FpVector::from_slice(p, &v_arr);
let w = FpVector::from_slice(p, &w_arr);

v.slice_mut(slice_start - 2, slice_end - 2)
v.slice_mut(slice_start + 2, slice_end + 2)
.add(w.slice(slice_start, slice_end), 1);
for i in slice_start - 2..slice_end - 2 {
v_arr[i] = (v_arr[i] + w_arr[i + 2]) % *p;

println!("v : {}", v);
for i in slice_start + 2..slice_end + 2 {
v_arr[i] = (v_arr[i] + w_arr[i - 2]) % *p;
}
v.assert_list_eq(&v_arr);
}
Expand Down Expand Up @@ -1078,10 +1078,10 @@ mod test {
];
let mut diffs = Vec::new();
for &(in1_limb1, in1_limb2, in2_limb1, in2_limb2, res1, res2) in tests.iter() {
in1.limbs_mut()[1] = in1_limb1;
in1.limbs_mut()[0] = in1_limb2;
in2.limbs_mut()[1] = in2_limb1;
in2.limbs_mut()[0] = in2_limb2;
in1._limbs_mut()[1] = in1_limb1;
in1._limbs_mut()[0] = in1_limb2;
in2._limbs_mut()[1] = in2_limb1;
in2._limbs_mut()[0] = in2_limb2;
let test_res1 = in1.sign_rule(&in2);
let test_res2 = in2.sign_rule(&in1);
let res = (res1, res2);
Expand Down
Loading

0 comments on commit aa58872

Please sign in to comment.