MCPcopy Create free account
hub / github.com/docknetwork/crypto / add_3

Method add_3

utils/src/randomized_mult_checker.rs:61–76  ·  view source on GitHub ↗

Add a check of the form `p1 * s1 + p2 * s2 + p3 * s3 = t`. Converts it to `p1 * s1 * r + p2 * s2 * r + p3 * s3 * r - t * r = 0` where `r` is the current randomness.

(
        &mut self,
        p1: G,
        s1: &G::ScalarField,
        p2: G,
        s2: &G::ScalarField,
        p3: G,
        s3: &G::ScalarField,
        t: G,
    )

Source from the content-addressed store, hash-verified

59
60 /// Add a check of the form `p1 * s1 + p2 * s2 + p3 * s3 = t`. Converts it to `p1 * s1 * r + p2 * s2 * r + p3 * s3 * r - t * r = 0` where `r` is the current randomness.
61 pub fn add_3(
62 &mut self,
63 p1: G,
64 s1: &G::ScalarField,
65 p2: G,
66 s2: &G::ScalarField,
67 p3: G,
68 s3: &G::ScalarField,
69 t: G,
70 ) {
71 self.add(p1, self.current_random * s1);
72 self.add(p2, self.current_random * s2);
73 self.add(p3, self.current_random * s3);
74 self.add(t, -self.current_random);
75 self.current_random *= self.random;
76 }
77
78 /// Add a check of the form `<a, b> = t`. Expects `a` and `b` to be of the same length
79 pub fn add_many<'a>(

Calls 1

addMethod · 0.45

Tested by 2

basicFunction · 0.64
timing_comparisonFunction · 0.64