MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / compute_dimensions

Method compute_dimensions

poly-commit/src/linear_codes/ligero.rs:118–128  ·  view source on GitHub ↗

Compute the a suitable (for instance, FFT-friendly over F) matrix with at least poly_len entries. The return pair (n, m) corresponds to the dimensions n x m. FIXME: Maybe, there should be some checks for making sure the extended row can have an FFT.

(&self, poly_len: usize)

Source from the content-addressed store, hash-verified

116 /// The return pair (n, m) corresponds to the dimensions n x m.
117 /// FIXME: Maybe, there should be some checks for making sure the extended row can have an FFT.
118 fn compute_dimensions(&self, poly_len: usize) -> (usize, usize) {
119 assert_eq!(
120 (poly_len as f64) as usize,
121 poly_len,
122 "n cannot be converted to f64: aborting"
123 );
124 let t = calculate_t::<F>(self.sec_param(), self.distance(), poly_len).unwrap();
125 let n = 1 << log2((ceil_div(2 * poly_len, t) as f64).sqrt().ceil() as usize);
126 let m = ceil_div(poly_len, n);
127 (n, m)
128 }
129
130 fn leaf_hash_param(&self) -> &<<C as Config>::LeafHash as CRHScheme>::Parameters {
131 &self.leaf_hash_param

Callers 1

compute_matricesMethod · 0.45

Calls 3

ceil_divFunction · 0.85
sec_paramMethod · 0.45
distanceMethod · 0.45

Tested by

no test coverage detected