-
Notifications
You must be signed in to change notification settings - Fork 155
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
chore(all): enforce polynomial size to be a power of 2 #1627
Conversation
bc3c778
to
6a4f74a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we may have other cyclotomics coming, I think there are more urgent backlog issues
Documenting the function to indicate it’s the floor log2 like the rust std lib is simpler here, I don’t think an assert would make sense, until we have other polynomial rings I don’t think this change is worthwhile |
6a4f74a
to
c4785f7
Compare
/// If the polynomial size is not a power of 2, returns the ceil of its log2 | ||
pub fn log2(&self) -> PolynomialSizeLog { | ||
PolynomialSizeLog((self.0 as f64).log2().ceil() as usize) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔 let's update this function to return "just" the log2 and have a ceil_ilog2 that returns the ceiling log2
also ceil_ilog2 should be written similar to the UnsignedInteger trait:
fn ceil_ilog2(self) -> u32 {
// ilog2 returns the rounded down log2
self.ilog2() + u32::from(!self.is_power_of_two())
}
tfhe/src/core_crypto/commons/numeric/unsigned.rs:94 and following
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's not have ceil_ilog2
at all then
c4785f7
to
99410ea
Compare
99410ea
to
1990876
Compare
No description provided.