Add connect_array convenience method in CircuitBuilder (#1620)

* Add connect_array method

* Pacify clippy

* Wording
This commit is contained in:
Robin Salen 2024-08-27 16:56:19 -04:00 committed by GitHub
parent bb8f388091
commit 9fdf1b8ef4
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
5 changed files with 19 additions and 0 deletions

View File

@ -30,3 +30,6 @@ homepage = "https://github.com/0xPolygonZero/plonky2"
repository = "https://github.com/0xPolygonZero/plonky2"
keywords = ["cryptography", "SNARK", "PLONK", "FRI", "plonky2"]
categories = ["cryptography"]
[workspace.lints.clippy]
too_long_first_doc_paragraph = "allow"

View File

@ -26,3 +26,6 @@ plonky2_util = { version = "0.2.0", path = "../util", default-features = false }
# Display math equations properly in documentation
[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", ".cargo/katex-header.html"]
[lints]
workspace = true

View File

@ -87,3 +87,6 @@ harness = false
# Display math equations properly in documentation
[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", ".cargo/katex-header.html"]
[lints]
workspace = true

View File

@ -524,6 +524,13 @@ impl<F: RichField + Extendable<D>, const D: usize> CircuitBuilder<F, D> {
.push(CopyConstraint::new((x, y), self.context_log.open_stack()));
}
/// Enforces that the underlying values of two [`Target`] arrays are equal.
pub fn connect_array<const N: usize>(&mut self, x: [Target; N], y: [Target; N]) {
for i in 0..N {
self.connect(x[i], y[i]);
}
}
/// Enforces that two [`ExtensionTarget<D>`] underlying values are equal.
pub fn connect_extension(&mut self, src: ExtensionTarget<D>, dst: ExtensionTarget<D>) {
for i in 0..D {

View File

@ -36,3 +36,6 @@ env_logger = { version = "0.9.0", default-features = false }
# Display math equations properly in documentation
[package.metadata.docs.rs]
rustdoc-args = ["--html-in-header", ".cargo/katex-header.html"]
[lints]
workspace = true