Make sure the noisy matrices are noninvertible#9
Conversation
src/algebra/m231.rs
Outdated
| const MODULUSI32: i32 = 2147483647i32; | ||
| const MODULUSI64: i64 = 2147483647i64; | ||
| const MODULUSU64: u64 = 2147483647u64; | ||
| const MAGIC229: usize = 536870912; // (MODULUS+1) / 4 = 2^29 |
There was a problem hiding this comment.
Could you add a note/comment explaining why such value and not something else?
There was a problem hiding this comment.
added comment referring to try_sqrt
| /// Try to solve the equation x^2 = a in our modular arithmetic | ||
| /// Since MODULUS = 3 (mod 4), the solution, if exists, is x = a^((MODULUS+1)/4) | ||
| pub fn try_sqrt(a: Mod231) -> Option<Mod231> { | ||
| let x = num_traits::pow::pow(a, MAGIC229); |
There was a problem hiding this comment.
I was wondering, could we use checked_pow instead perhaps?
There was a problem hiding this comment.
no, we don't want to check for overflow, as we are using modular arithmetic
Created #10 as an independent variant of this PR, in case we want to apply it before #8. |
#10) * Make sure the noisy matrices are noninvertible * Comment MAGIC229
No description provided.