Skip to content

constraints: mv folder - #432

Merged
tcoratger merged 4 commits into
mainfrom
constraints
Mar 17, 2026
Merged

tcoratger merged 4 commits into
mainfrom
constraints

Conversation

@tcoratger

Copy link
Copy Markdown
Owner

No description provided.

Comment on lines +256 to +259
// Transpose the points into a k × n matrix (rows = variables,
// columns = constraint points). Uses Plonky3's transpose which
// writes directly into a flat buffer.
let points_matrix = MultilinearPoint::transpose(&self.points, false);

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@kilic Here I think that we were doing just this manually.

Comment on lines +386 to +396
// Row i contains [z_1^{2^i}, z_2^{2^i}, ..., z_n^{2^i}].
// Stored as a flat Vec<F> of size k * n in row-major order.
let mut pow_matrix = F::zero_vec(k * n);
for (j, &var) in self.vars.iter().enumerate() {
let mut v = var;
for i in 0..k {
// pow_matrix[i * n + j] = z_j^{2^i}
pow_matrix[i * n + j] = v;
v = v.square();
}
}

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@kilic Here I think that we were doing a super heavy vec of vec allocation that can be simplified here.

Comment on lines -367 to -373
// Extract the i-th column of the power matrix: [pow(z_1)[i], ..., pow(z_n)[i]]
//
// These are the values z_1^{2^i}, z_2^{2^i}, ..., z_n^{2^i}.
let bin_powers_col = bin_powers
.iter()
.map(|powers| powers[i])
.collect::<Vec<_>>();

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@kilic That can be deleted now

Comment on lines +442 to +443
*weight_out +=
dot_product::<EF, _, _>(challenges.iter().copied(), row.iter().copied());

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

@kilic Here a dot product were hidden that can be done much more efficiently with the dedicated dot_product efficient method.

@tcoratger
tcoratger merged commit ca729e4 into main Mar 17, 2026
6 checks passed
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.

1 participant