Arrange the coefficients of the polynomial into a matrix, and apply encoding to each row. Returns the tuple (original_matrix, encoded_matrix).
(polynomial: &P, param: &Self::LinCodePCParams)
| 116 | /// and apply encoding to each row. |
| 117 | /// Returns the tuple (original_matrix, encoded_matrix). |
| 118 | fn compute_matrices(polynomial: &P, param: &Self::LinCodePCParams) -> (Matrix<F>, Matrix<F>) { |
| 119 | let mut coeffs = Self::poly_to_vec(polynomial); |
| 120 | |
| 121 | // 1. Computing the matrix dimensions. |
| 122 | let (n_rows, n_cols) = param.compute_dimensions(coeffs.len()); |
| 123 | |
| 124 | // padding the coefficient vector with zeroes |
| 125 | coeffs.resize(n_rows * n_cols, F::zero()); |
| 126 | |
| 127 | let mat = Matrix::new_from_flat(n_rows, n_cols, &coeffs); |
| 128 | |
| 129 | // 2. Apply encoding row-wise |
| 130 | let rows = mat.rows(); |
| 131 | let ext_mat = Matrix::new_from_rows( |
| 132 | cfg_iter!(rows) |
| 133 | .map(|r| Self::encode(r, param).unwrap()) |
| 134 | .collect(), |
| 135 | ); |
| 136 | |
| 137 | (mat, ext_mat) |
| 138 | } |
| 139 | |
| 140 | /// Tensor the query point z in the following sense: |
| 141 | /// For a polynomial p(X) represented by a matrix M |