MSM for `commitments` and `coeffs`
(
coeffs_and_comms: impl IntoIterator<Item = (E::ScalarField, &'a marlin_pc::Commitment<E>)>,
)
| 49 | { |
| 50 | /// MSM for `commitments` and `coeffs` |
| 51 | fn combine_commitments<'a>( |
| 52 | coeffs_and_comms: impl IntoIterator<Item = (E::ScalarField, &'a marlin_pc::Commitment<E>)>, |
| 53 | ) -> (E::G1, Option<E::G1>) { |
| 54 | let mut combined_comm = E::G1::zero(); |
| 55 | let mut combined_shifted_comm = None; |
| 56 | for (coeff, comm) in coeffs_and_comms { |
| 57 | if coeff.is_one() { |
| 58 | combined_comm.add_assign(&comm.comm.0); |
| 59 | } else { |
| 60 | combined_comm += &comm.comm.0.mul(coeff); |
| 61 | } |
| 62 | |
| 63 | if let Some(shifted_comm) = &comm.shifted_comm { |
| 64 | let cur = shifted_comm.0.mul(coeff); |
| 65 | combined_shifted_comm = Some(combined_shifted_comm.map_or(cur, |c| c + cur)); |
| 66 | } |
| 67 | } |
| 68 | (combined_comm, combined_shifted_comm) |
| 69 | } |
| 70 | |
| 71 | /// Normalize a list of commitments |
| 72 | fn normalize_commitments<'a>( |
nothing calls this directly
no test coverage detected