MCPcopy Create free account
hub / github.com/arkworks-rs/poly-commit / compute_matrices

Method compute_matrices

poly-commit/src/linear_codes/mod.rs:118–138  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Implementers 3

mod.rspoly-commit/src/linear_codes/univariat
mod.rspoly-commit/src/linear_codes/multiline
mod.rspoly-commit/src/linear_codes/multiline

Calls 3

lenMethod · 0.80
rowsMethod · 0.80
compute_dimensionsMethod · 0.45

Tested by

no test coverage detected