-
Notifications
You must be signed in to change notification settings - Fork 157
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): use destructuring in conformance #1449
Conversation
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.
Thanks, some comments
@@ -25,11 +25,18 @@ impl<T: UnsignedInteger> ParameterSetConformant for SeededLweCiphertext<T> { | |||
type ParameterSet = LweCiphertextParameters<T>; | |||
|
|||
fn is_conformant(&self, lwe_ct_parameters: &LweCiphertextParameters<T>) -> bool { | |||
let Self { | |||
data: _, |
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 need to ignore, change the from_ref below to use that scalar
@@ -761,9 +761,14 @@ where | |||
type ParameterSet = LweCiphertextParameters<C::Element>; | |||
|
|||
fn is_conformant(&self, lwe_ct_parameters: &LweCiphertextParameters<C::Element>) -> bool { | |||
let Self { | |||
data: _, |
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.
do not ignore data and replace self in the check encrypted_content_respects_mod by data
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.
Done
== glwe_ct_parameters.glwe_dim.to_glwe_size().0 | ||
* glwe_ct_parameters.polynomial_size.0 |
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.
if need be there should be a primitive that compute the glwe ciphertext size given a size/dim and a polynomial size
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.
Added
&& modulus_switched_glwe_ciphertext_list.iter().all(|glwe| { | ||
glwe.glwe_dimension() == params.ct_params.glwe_dim | ||
&& glwe.polynomial_size() == params.ct_params.polynomial_size | ||
&& glwe.uncompressed_ciphertext_modulus() == params.ct_params.ct_modulus |
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.
can we forward the conformance check to glwe.is_conformant maybe ?
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.
Done
carry_modulus, | ||
pbs_order, | ||
lwe_per_glwe, | ||
count: _, |
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.
count ignored ?
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.
Now checked
2bfa6ee
to
88239f0
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.
small remark about the size primitive
|
||
pub const fn to_glwe_ct_size(self, poly_size: PolynomialSize) -> usize { | ||
self.0 * poly_size.0 | ||
} |
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.
glwe_ciphertext_size already exists as a free standing function in tfhe/src/core_crypto/entities/glwe_ciphertext.rs
== glwe_ct_parameters | ||
.glwe_dim | ||
.to_glwe_size() | ||
.to_glwe_ct_size(glwe_ct_parameters.polynomial_size) |
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.
glwe_ciphertext_size
88239f0
to
5cdc80f
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.
Thanks ! This looks good and will be more robust to structure changes !
looks like some auto imports do not work |
5cdc80f
to
e6bec08
Compare
No description provided.