* Port of AVX2 MDS impl
* Bugfixes
* Inline ASM to the rescue
* remove debug printsln + minor formatting
* Work around NEON intrinsic bug without inline ASM
* Minor error in doc
* Daniel comments
* More Daniel comments
Co-authored-by: Jakub Nabaglo <jakub@mirprotocol.org>
* Poseidon: vectorized MDS matrix multiplication
* Lints
* This is a bit cleaner
* More cleanup
* Width 12
* Replace the unaligned load trick with something nicer
* Simplify conversion between CrandallField and u64
* Make things more concise with const generics
* Minor documentation
* Minor: unused import
* Daniel comments + consistency with #230 + errors in docs
* Remove dependence on feature(stdsimd)
* Daniel comments
* Replace `CrandallQuarticField` with a more generic `QuarticExtension`
And likewise for `CrandallQuadraticField`.
There are a few parameters which we can't automatically derive (in const Rust), so I specified them in a `AutoExtendable` trait.
This would make it fairly easy to add extension fields for `GoldilocksField` and any future fields.
* Attempt to derive 2-adicity, see Hamish's feedback
* Simplify TWO_ADICITY based on chat with Hamish
* PR feedback
* Merge AutoExtendable into Extendable (#235)
* Prepare for the switch to Poseidon
Everything will now select a permutation based on the `PERMUTATION_FAMILY` const.
The `Poseidon` variant won't work quite yet since the gate isn't in place; I left that as a `todo!()`
* fix
* Goldilocks field
Based on Hamish's old branch, but I updated it with a few missing things like generators.
Pulled the inversion code into a shared helper method to avoid redundancy.
Just the base field for now. We can add a quartic extension field later.
* typo
* PR feedback
* More overflowing -> wrapping
* fmt
* cleanup
* Refactor GMiMC code
Adds a sub-trait of `Field` called `GMiMCInterface`, which is similar to `PoseidonInterface`.
This lets us have different fields with different GMiMC constants in a type-safe way.
* Remove `Interface`
* Const generic for width
- Split it into two files, one for general `Field` tests and one for `PrimeField` tests.
- Replace most uses of `BigUint` in tests with `u64`. These uses were only applicable for `PrimeField`s, which are 64-bit fields anyway. This lets us delete the `BigUInt` conversion methods.
- Simplify `test_inputs`, which was originally written for large prime fields. Now that it's only used for 64-bit fields, I think interesting inputs are just the smallest and largest elements, and those close to 2^32 etc.
* Move some Field members to a Field64 subtrait
I.e. move anything specific to 64-bit fields.
Also, relatedly,
- Tweak a bunch of prover code to require `Field64`, since 64-bit stuff is used in a couple places, like the FRI proof-of-work
- Remove `bits()`, which was unused and assumed a 64-bit field
- Rename a couple methods to reflect that they're u64 variants
There are no functional changes.
* Field64 -> PrimeField
* Remove `exp_u32`, `kth_root_u32`
* PrimeField: PrimeField
* Move `to_canonical_biguint` as well
* Add back from_noncanonical_u128