Skip to content

Add 0-padded optimization in dense polynomial + sumcheck#5

Open
nicholas-mainardi wants to merge 9 commits intofeat/serialize_structsfrom
feat/change_fixing_order_sumcheck
Open

Add 0-padded optimization in dense polynomial + sumcheck#5
nicholas-mainardi wants to merge 9 commits intofeat/serialize_structsfrom
feat/change_fixing_order_sumcheck

Conversation

@nicholas-mainardi
Copy link
Contributor

No description provided.

}

pub fn pad_num_vars(&mut self, num_vars: usize) {
self.padded_num_vars = Some(num_vars);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Worth checking the number of variables isn't lower than the actual number of evaluation representations imo.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done in commit 2a05edd

self.z[i] = self.z[2 * i] + *r * (self.z[2 * i + 1] - self.z[2 * i]);
let len = self.unpadded_len();
if len == 1 {
self.z[0] *= F::ONE - r
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

here you're not decreasing the number of padded or unpadded vars, so that means we could continue fixing it until eternity ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is done at the end of the method https://github.com/Lagrange-Labs/dp-crypto/blob/feat/change_fixing_order_sumcheck/dp-crypto/src/poly/dense.rs#L388, as it needs to be done independently from which branch is taken in this if

}

if let Some(nv) = self.padded_num_vars.as_mut() {
*nv -= 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it wasn't a check before but should we panic or saturating_sub here ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added an assertion at the beginning of the method to check that num_vars > 0

@nicholas-mainardi nicholas-mainardi force-pushed the feat/change_fixing_order_sumcheck branch from 2a05edd to fccf93f Compare December 15, 2025 10:50
@nicholas-mainardi nicholas-mainardi force-pushed the feat/change_fixing_order_sumcheck branch from fccf93f to 8b7c250 Compare December 15, 2025 11:07
@nicholas-mainardi nicholas-mainardi marked this pull request as ready for review December 15, 2025 11:07
@nicholas-mainardi nicholas-mainardi force-pushed the feat/change_fixing_order_sumcheck branch from ce520e4 to bf429d9 Compare December 19, 2025 15:26
@nicholas-mainardi nicholas-mainardi force-pushed the feat/change_fixing_order_sumcheck branch from f646b21 to 76f7067 Compare January 9, 2026 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants