This function creates a UniversalParams. It does not check if the paramters are consistent/correct.
(
sec_param: usize,
a: (usize, usize),
b: (usize, usize),
r: (usize, usize),
base_len: usize,
n: usize,
m: usize,
a_dims: Vec<(usize, us
| 144 | |
| 145 | /// This function creates a UniversalParams. It does not check if the paramters are consistent/correct. |
| 146 | pub fn new( |
| 147 | sec_param: usize, |
| 148 | a: (usize, usize), |
| 149 | b: (usize, usize), |
| 150 | r: (usize, usize), |
| 151 | base_len: usize, |
| 152 | n: usize, |
| 153 | m: usize, |
| 154 | a_dims: Vec<(usize, usize, usize)>, |
| 155 | b_dims: Vec<(usize, usize, usize)>, |
| 156 | a_mats: Vec<SprsMat<F>>, |
| 157 | b_mats: Vec<SprsMat<F>>, |
| 158 | check_well_formedness: bool, |
| 159 | leaf_hash_param: LeafParam<C>, |
| 160 | two_to_one_hash_param: TwoToOneParam<C>, |
| 161 | col_hash_params: H::Parameters, |
| 162 | ) -> Self { |
| 163 | let m_ext = if a_dims.is_empty() { |
| 164 | ceil_mul(m, r) |
| 165 | } else { |
| 166 | Self::codeword_len(&a_dims, &b_dims) |
| 167 | }; |
| 168 | let start = a_dims |
| 169 | .iter() |
| 170 | .scan(0, |acc, &(row, _, _)| { |
| 171 | *acc += row; |
| 172 | Some(*acc) |
| 173 | }) |
| 174 | .collect::<Vec<_>>(); |
| 175 | let end = b_dims |
| 176 | .iter() |
| 177 | .scan(m_ext, |acc, &(_, col, _)| { |
| 178 | *acc -= col; |
| 179 | Some(*acc) |
| 180 | }) |
| 181 | .collect::<Vec<_>>(); |
| 182 | |
| 183 | Self { |
| 184 | sec_param, |
| 185 | alpha: a, |
| 186 | beta: b, |
| 187 | rho_inv: r, |
| 188 | base_len, |
| 189 | n, |
| 190 | m, |
| 191 | m_ext, |
| 192 | a_dims, |
| 193 | b_dims, |
| 194 | start, |
| 195 | end, |
| 196 | a_mats, |
| 197 | b_mats, |
| 198 | check_well_formedness, |
| 199 | leaf_hash_param, |
| 200 | two_to_one_hash_param, |
| 201 | col_hash_params, |
| 202 | } |
| 203 | } |