Browse Source

Add missing doc comments.

main
porcuquine 3 years ago
committed by Srinath Setty
parent
commit
338fbff9ac
1 changed files with 10 additions and 20 deletions
  1. +10
    -20
      src/bellperson/shape_cs.rs

+ 10
- 20
src/bellperson/shape_cs.rs

@ -45,7 +45,7 @@ impl Ord for OrderedVariable {
} }
#[allow(clippy::upper_case_acronyms)] #[allow(clippy::upper_case_acronyms)]
/// TODO: document
/// `ShapeCS` is a `ConstraintSystem` for creating `R1CSShape`s for a circuit.
pub struct ShapeCS<G: Group> pub struct ShapeCS<G: Group>
where where
G::Scalar: PrimeField + Field, G::Scalar: PrimeField + Field,
@ -53,7 +53,7 @@ where
named_objects: HashMap<String, NamedObject>, named_objects: HashMap<String, NamedObject>,
current_namespace: Vec<String>, current_namespace: Vec<String>,
#[allow(clippy::type_complexity)] #[allow(clippy::type_complexity)]
/// TODO: document
/// All constraints added to the `ShapeCS`.
pub constraints: Vec<( pub constraints: Vec<(
LinearCombination<G::Scalar>, LinearCombination<G::Scalar>,
LinearCombination<G::Scalar>, LinearCombination<G::Scalar>,
@ -94,38 +94,27 @@ impl ShapeCS
where where
G::Scalar: PrimeField, G::Scalar: PrimeField,
{ {
/// TODO: document
/// Create a new, default `ShapeCS`,
pub fn new() -> Self { pub fn new() -> Self {
ShapeCS::default() ShapeCS::default()
} }
// pub fn constraints(
// &self,
// ) -> Vec<(
// LinearCombination<G::Scalar>,
// LinearCombination<G::Scalar>,
// LinearCombination<G::Scalar>,
// String,
// )> {
// self.constraints.clone()
// }
/// TODO: document
/// Returns the number of constraints defined for this `ShapeCS`.
pub fn num_constraints(&self) -> usize { pub fn num_constraints(&self) -> usize {
self.constraints.len() self.constraints.len()
} }
/// TODO: document
/// Returns the number of inputs defined for this `ShapeCS`.
pub fn num_inputs(&self) -> usize { pub fn num_inputs(&self) -> usize {
self.inputs.len() self.inputs.len()
} }
/// TODO: document
/// Returns the number of aux inputs defined for this `ShapeCS`.
pub fn num_aux(&self) -> usize { pub fn num_aux(&self) -> usize {
self.aux.len() self.aux.len()
} }
/// TODO: document
/// Print all public inputs, aux inputs, and constraint names.
pub fn pretty_print_list(&self) -> Vec<String> { pub fn pretty_print_list(&self) -> Vec<String> {
let mut result = Vec::new(); let mut result = Vec::new();
@ -143,7 +132,7 @@ where
result result
} }
/// TODO: document
/// Print all iputs and a detailed representation of each constraint.
pub fn pretty_print(&self) -> String { pub fn pretty_print(&self) -> String {
let mut s = String::new(); let mut s = String::new();
@ -211,7 +200,8 @@ where
s s
} }
/// TODO: document
/// Associate `NamedObject` with `path`.
/// `path` must not already have an associated object.
fn set_named_obj(&mut self, path: String, to: NamedObject) { fn set_named_obj(&mut self, path: String, to: NamedObject) {
assert!( assert!(
!self.named_objects.contains_key(&path), !self.named_objects.contains_key(&path),

Loading…
Cancel
Save