pub struct R1CS {
pub num_public_inputs: usize,
pub interner: Interner,
pub a: SparseMatrix,
pub b: SparseMatrix,
pub c: SparseMatrix,
}Expand description
Represents a R1CS constraint system.
Fields§
§num_public_inputs: usize§interner: Interner§a: SparseMatrix§b: SparseMatrix§c: SparseMatrixImplementations§
Source§impl R1CS
impl R1CS
pub fn new() -> Self
pub const fn a(&self) -> HydratedSparseMatrix<'_>
pub const fn b(&self) -> HydratedSparseMatrix<'_>
pub const fn c(&self) -> HydratedSparseMatrix<'_>
Sourcepub const fn num_constraints(&self) -> usize
pub const fn num_constraints(&self) -> usize
The number of constraints in the R1CS instance.
Sourcepub const fn num_witnesses(&self) -> usize
pub const fn num_witnesses(&self) -> usize
The number of witnesses in the R1CS instance (including the constant one witness).
pub fn grow_matrices(&mut self, num_rows: usize, num_cols: usize)
Sourcepub fn add_witnesses(&mut self, count: usize)
pub fn add_witnesses(&mut self, count: usize)
Add a new witnesses to the R1CS instance.
Sourcepub fn add_constraint(
&mut self,
a: &[(FieldElement, usize)],
b: &[(FieldElement, usize)],
c: &[(FieldElement, usize)],
)
pub fn add_constraint( &mut self, a: &[(FieldElement, usize)], b: &[(FieldElement, usize)], c: &[(FieldElement, usize)], )
Add an R1CS constraint. Duplicate witness indices within each linear combination are merged (coefficients summed) and zeros are dropped.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for R1CS
impl<'de> Deserialize<'de> for R1CS
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for R1CS
impl StructuralPartialEq for R1CS
Auto Trait Implementations§
impl Freeze for R1CS
impl RefUnwindSafe for R1CS
impl Send for R1CS
impl Sync for R1CS
impl Unpin for R1CS
impl UnsafeUnpin for R1CS
impl UnwindSafe for R1CS
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more