From c1f5c871a8fe64cf8675ae046f46afa23e167410 Mon Sep 17 00:00:00 2001 From: Ivo Kubjas Date: Wed, 22 Nov 2023 11:55:43 +0100 Subject: [PATCH] docs: add init docs --- std/algebra/emulated/sw_bw6761/g2.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/std/algebra/emulated/sw_bw6761/g2.go b/std/algebra/emulated/sw_bw6761/g2.go index 432c18803d..ede32dc663 100644 --- a/std/algebra/emulated/sw_bw6761/g2.go +++ b/std/algebra/emulated/sw_bw6761/g2.go @@ -6,8 +6,10 @@ import ( "github.com/consensys/gnark/std/math/emulated" ) +// g2AffP is the raw G2 element without precomputations. type g2AffP = sw_emulated.AffinePoint[BaseField] +// G2Affine represents G2 element with optional embedded line precomputations. type G2Affine struct { P g2AffP Lines *lineEvaluations @@ -20,12 +22,16 @@ func newG2AffP(v bw6761.G2Affine) g2AffP { } } +// NewG2Affine returns the witness of v without precomputations. In case of +// pairing the precomputation will be done in-circuit. func NewG2Affine(v bw6761.G2Affine) G2Affine { return G2Affine{ P: newG2AffP(v), } } +// NewG2AffineFixed returns witness of v with precomputations for efficient +// pairing computation. func NewG2AffineFixed(v bw6761.G2Affine) G2Affine { lines := precomputeLines(v) return G2Affine{ @@ -34,6 +40,9 @@ func NewG2AffineFixed(v bw6761.G2Affine) G2Affine { } } +// NewG2AffineFixedPlaceholder returns a placeholder for the circuit compilation +// when witness will be given with line precomputations using +// [NewG2AffineFixed]. func NewG2AffineFixedPlaceholder() G2Affine { var lines lineEvaluations for i := 0; i < len(bw6761.LoopCounter)-1; i++ {