MCPcopy Create free account
hub / github.com/BitVM/BitVM / query_table

Function query_table

bitvm/src/bn254/msm.rs:185–198  ·  view source on GitHub ↗

Given a precomputed table of some table index Lookup a_i-th row and return result The result is a G1Affine element corresponding to [a_i] (2^(w.i) P)

(
    table: (Vec<ark_bn254::G1Affine>, Script),
    row_index: (usize, Script),
)

Source from the content-addressed store, hash-verified

183// Lookup a_i-th row and return result
184// The result is a G1Affine element corresponding to [a_i] (2^(w.i) P)
185fn query_table(
186 table: (Vec<ark_bn254::G1Affine>, Script),
187 row_index: (usize, Script),
188) -> (ark_bn254::G1Affine, Script) {
189 let row = table.0[row_index.0];
190 let scr = script! {
191 // [scalar]
192 {row_index.1}
193 // [scalar slice] => a_i
194 {table.1}
195 // [a_i] (2 ^ (w.i) P)
196 };
197 (row, scr)
198}
199
200/// Compute: Sum of [a_i] (2^ (wi) P) for i = 0..N, N is the number of terms in addition chain
201/// BATCH_SIZE_PER_CHUNK such terms are batached inside a chunk

Callers 2

test_query_tableFunction · 0.85

Calls

no outgoing calls

Tested by 1

test_query_tableFunction · 0.68