Given line evaluation f, line coeff (alpha_t3, neg_bias_t3) and point P3, Compute line evaluation 'g' at P3 and multiply it with f. Return Script and Hints for the computation and return the line evaluation g. Compute g = le_{t3} (P3); h = f * g; Return (g, Script(Compute), Hints(Compute))
(
f: ark_bn254::Fq6,
alpha_t3: ark_bn254::Fq2,
neg_bias_t3: ark_bn254::Fq2,
p3: ark_bn254::G1Affine,
)
| 149 | /// Compute g = le_{t3} (P3); h = f * g; |
| 150 | /// Return (g, Script(Compute), Hints(Compute)) |
| 151 | pub(crate) fn utils_multiply_by_line_eval( |
| 152 | f: ark_bn254::Fq6, |
| 153 | alpha_t3: ark_bn254::Fq2, |
| 154 | neg_bias_t3: ark_bn254::Fq2, |
| 155 | p3: ark_bn254::G1Affine, |
| 156 | ) -> (ark_bn254::Fq6, Script, Vec<Hint>) { |
| 157 | assert_eq!(f.c2, ark_bn254::Fq2::ZERO); |
| 158 | |
| 159 | let mut l0_t3 = alpha_t3; |
| 160 | l0_t3.mul_assign_by_fp(&p3.x); |
| 161 | let mut l1_t3 = neg_bias_t3; |
| 162 | l1_t3.mul_assign_by_fp(&p3.y); |
| 163 | |
| 164 | let (hinted_ell_t3, hints_ell_t3) = |
| 165 | hinted_ell_by_constant_affine(p3.x, p3.y, alpha_t3, neg_bias_t3); |
| 166 | |
| 167 | let g = ark_bn254::Fq6::new(l0_t3, l1_t3, ark_bn254::Fq2::ZERO); |
| 168 | let (_, fg_scr, fg_hints) = utils_fq6_ss_mul(g, f); |
| 169 | |
| 170 | let scr = script! { |
| 171 | // [f, p3] |
| 172 | {Fq2::copy(0)} |
| 173 | // [f, p3, p3] |
| 174 | {Fq2::push(alpha_t3)} |
| 175 | {Fq2::push(neg_bias_t3)} |
| 176 | // [f, p3, p3, a, b] |
| 177 | {Fq2::roll(4)} |
| 178 | // [f, p3, a, b, p3] |
| 179 | {hinted_ell_t3} |
| 180 | // [f, p3, le0, le1] |
| 181 | // [f, p3, g] |
| 182 | {Fq2::roll(8)} {Fq2::roll(8)} |
| 183 | // [p3, g, f] |
| 184 | {fg_scr} |
| 185 | // [p3, g, f, fg] |
| 186 | }; |
| 187 | |
| 188 | let mut hints = vec![]; |
| 189 | hints.extend_from_slice(&hints_ell_t3); |
| 190 | hints.extend_from_slice(&fg_hints); |
| 191 | |
| 192 | (g, scr, hints) |
| 193 | } |
| 194 | |
| 195 | /// Compute product of two Fq12 elements in normalized form (1 + c J) <- (1 + a J) x (1 + b J). |
| 196 | /// Input a, b and output c. |
no test coverage detected