fold_cols

Function fold_cols 

Source
pub fn fold_cols<F, DataMat, DataVec>(
    mat: &FieldBuffer<F, DataMat>,
    vec: &FieldBuffer<F, DataVec>,
) -> FieldBuffer<F>
where F: Field, DataMat: Deref<Target = [F]>, DataVec: Deref<Target = [F]>,
Expand description

Computes a linear combination of the columns of a matrix.

A column-combination of a matrix is a matrix-vector multiplication.

This implementation is a naive, single-threaded implementation operating on buffers of scalar elements.

§Mathematical Definition

This operation accepts

  • $n \in \mathbb{N}$ (out.len()),
  • $m \in \mathbb{N}$ (vec.len()),
  • $M \in K^{n \times m}$ (mat),
  • $v \in K^m$ (vec),

and computes the vector $Mv$.

§Args

  • mat - a buffer of n * m F elements, interpreted as a row-major matrix.
  • vec - a buffer of m F elements containing the column scalars.

§Returns

The matrix-vector product, as a buffer of F elements.

§Preconditions

  • mat.log_len() must be at least vec.log_len()