openvm_stark_backend/interaction/utils.rs
1use p3_field::FieldAlgebra;
2
3use super::Interaction;
4
5/// Returns [beta^0, beta^1, ..., beta^{max_num_fields}]
6/// where max_num_fields is the maximum length of `fields` in any interaction.
7pub fn generate_betas<AF: FieldAlgebra, E>(
8 beta: AF,
9 all_interactions: &[Interaction<E>],
10) -> Vec<AF> {
11 let max_fields_len = all_interactions
12 .iter()
13 .map(|interaction| interaction.message.len())
14 .max()
15 .unwrap_or(0);
16
17 beta.powers().take(max_fields_len + 1).collect()
18}