67 Commits

Author SHA1 Message Date
wborgeaud
b64a5fab46 Addition and multiplication for ExtensionTarget 2021-05-24 16:36:21 +02:00
wborgeaud
655bcd8eac Minor 2021-05-24 15:31:52 +02:00
wborgeaud
66d6f3c338 Remove useless Qua(d)r(a)ticFieldExtension traits 2021-05-24 14:12:08 +02:00
wborgeaud
b438760f72 Use bits_u64 2021-05-19 20:22:20 +02:00
wborgeaud
78f71672a3 Change Field::exp to using a u64 power. 2021-05-19 12:17:43 +02:00
wborgeaud
e806d86f86 Remove custom primitive_root_of_unity in extension fields by modifying the generators. 2021-05-19 09:35:39 +02:00
wborgeaud
1cbd12edbd Fixes based on PR comments 2021-05-18 22:22:15 +02:00
wborgeaud
8737c8d5b9 revert extension field order 2021-05-18 16:37:21 +02:00
wborgeaud
4f6f2192ab Minor fixes 2021-05-18 16:23:44 +02:00
wborgeaud
96a880193c Clippy 2021-05-18 16:09:22 +02:00
wborgeaud
37f6ee53cc Merge branch 'main' into fri-extension-field 2021-05-18 15:28:42 +02:00
wborgeaud
a2cf2c03b6 Working FRI with field extensions 2021-05-18 15:22:06 +02:00
BGluth
949fb879cc Switched over from OsRng --> thread_rng
- At least on my Linux machine, a signiciant amount of time (> 50%) was spent inside
  OsRng.
- Likely due to blocking behaviour of the rng devices on Linux.
- thread_rng should not block, but at the same time should provide good
  enough rng.
2021-05-14 20:15:03 -06:00
wborgeaud
1e45b0b1c0 Move Frobenius to default trait implementation. 2021-05-11 20:58:04 +02:00
wborgeaud
f1d812812e Added field order test 2021-05-11 15:26:20 +02:00
wborgeaud
04664a54ee Binary extension fields 2021-05-11 14:21:21 +02:00
wborgeaud
5e86e7dc06 Rand + fix mul + tests 2021-05-11 14:06:35 +02:00
wborgeaud
e670ec3ff0 Multiplication + Frobenius + Inverse 2021-05-11 11:46:01 +02:00
wborgeaud
5abcd85f84 Started extension field implementation 2021-05-10 18:45:48 +02:00
wborgeaud
477fe1ea4a Minor fixes 2021-05-06 15:14:43 +02:00
wborgeaud
e7c37dfa00 Merge pull request #31 from mir-protocol/fix-subtraction
Fixes a bug in the field subtraction
2021-05-04 17:59:23 +02:00
wborgeaud
20dae028d8 fix subtraction 2021-05-04 17:57:59 +02:00
Daniel Lubarov
116f92eade Merge pull request #28 from mir-protocol/mds
Add methods for MDS matrices
2021-04-29 07:03:57 -07:00
Daniel Lubarov
6db30c6db3 Precomputed MDS matrix for CrandallField 2021-04-28 14:42:21 -07:00
Daniel Lubarov
5913fd71b9 Add methods for MDS matrices
The defaults are quite slow, but we will override them with fast, precomputed, field-specific matrices; see #4.
2021-04-28 13:59:58 -07:00
wborgeaud
79a8ccd9a0 Working bit-reversed version 2021-04-28 18:38:05 +02:00
wborgeaud
d5da6308b5 Merge pull request #24 from mir-protocol/fri-reduction-arity
Fri reduction arity
2021-04-27 12:34:20 +02:00
Daniel Lubarov
cf98d7bccb Merge pull request #22 from mir-protocol/field_tweaks
Tweaks to CrandallField
2021-04-26 11:42:12 -07:00
wborgeaud
a8c23a357e Merge branch 'main' into fri-reduction-arity 2021-04-26 19:20:10 +02:00
wborgeaud
f40aba3205 Cleaning and commens 2021-04-26 19:19:27 +02:00
wborgeaud
67aa704f6a Working reduction arity 2021-04-26 18:24:57 +02:00
wborgeaud
49c116d7f6 Montgomery inversion in computation of barycentric weights + clean eval_naive method. 2021-04-26 09:13:28 +02:00
Daniel Lubarov
110a7bc6d9 Fill in a few missing field methods 2021-04-25 18:09:43 -07:00
Daniel Lubarov
872673702e Tweaks to CrandallField 2021-04-25 17:14:26 -07:00
Daniel Lubarov
06bb902f23 Barycentric formula 2021-04-24 20:11:00 -07:00
Daniel Lubarov
035d15bc3d Interpolants of arbitrary (point, value) lists
Closes #10. This combines Lagrange interpolation with FFTs as mentioned there.

I was previously thinking that all our polynomial encodings might as well just use power-of-two length vectors, so they'll be "FFT-ready", with no need to trim/pad. This sort of breaks that assumption though, as e.g. I think we'll want to compute interpolants with three coefficients in the batch opening argument.

I think we can still skip trimming/padding in most cases, since it the majority of our polynomials will have power-of-two-minus-1 degrees with high probability. But we'll now have one or two uses where that's not the case.
2021-04-24 19:20:18 -07:00
Daniel Lubarov
7ffb9cf9b2 Merge pull request #17 from mir-protocol/rescue_bench
Make Rescue a bit faster
2021-04-24 10:53:52 -07:00
Daniel Lubarov
80775eadb1 Make Rescue a bit faster
... by switching to Rescue Prime (which has a smaller security margin), and precomputing an addition chain for the exponent used in the cubic root calculation. Also adds a benchmark.
2021-04-23 13:25:29 -07:00
Daniel Lubarov
af4c8734ce Address some clippy warnings 2021-04-23 12:35:19 -07:00
Daniel Lubarov
c684193033 Rename a couple vars 2021-04-23 09:24:01 -07:00
Daniel Lubarov
a5206f97a2 Better generator_order per William's comment 2021-04-22 23:59:37 -07:00
Daniel Lubarov
84a71c9ca5 A few more tests, ported (with some adaptations) from plonky1 2021-04-22 21:51:40 -07:00
wborgeaud
6b407e45ef Progress on FRI 2021-04-21 22:31:45 +02:00
Daniel Lubarov
5fe8d633b6 Split main into multiple binaries
... and other minor refactoring.

`bench_recursion` will be the default bin run by `cargo run`; the otheres can be selected with the `--bin` flag.

We could probably delete some of the other binaries later. E.g. `field_search` might not be useful any more. `bench_fft` should maybe be converted to a benchmark (although there are some pros and cons, e.g. the bench framework has a minimum number of runs, and isn't helpful in testing multi-core performance).
2021-04-06 13:23:47 -07:00
Daniel Lubarov
74ce37250e Avoid separate exp calls 2021-04-05 11:39:16 -07:00
Daniel Lubarov
37761a32e8 Simplify as per William's comment 2021-04-04 15:26:38 -07:00
Daniel Lubarov
cb1c69e50f Validate that the cosets for Plonk's permutation argument are disjoint
When we had a large field, we could just pick random shifts, and get disjoint cosets with high probability. With a 64-bit field, I think the probability of a collision is non-negligible (something like 1 in a million), so we should probably verify that the cosets are disjoint.

If there are any concerns with this method (or if it's just confusing), I think it would also be reasonable to use the brute force approach of explicitly computing the cosets and checking that they're disjoint. I coded that as well, and it took like 80ms, so not really a big deal since it's a one-time preprocessing cost.

Also fixes some overflow bugs in the inversion code.
2021-04-04 14:34:33 -07:00
Daniel Lubarov
facbe117fb Move some stuff into Field 2021-04-02 19:04:26 -07:00
Daniel Lubarov
78860cc3db Final fixes 2021-04-02 18:29:33 -07:00
Daniel Lubarov
572a55ed29 Fix to_canonical_u64 2021-04-02 18:23:22 -07:00