pub fn fold_cols<F, DataMat, DataVec>(
mat: &FieldBuffer<F, DataMat>,
vec: &FieldBuffer<F, DataVec>,
) -> Result<FieldBuffer<F>, Error>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 ofn * mFelements, interpreted as a row-major matrix.vec- a buffer ofmFelements containing the column scalars.
§Returns
The matrix-vector product, as a buffer of F elements.
§Throws
- Returns an error if
mat.len()does not equalvec.len() * out.len(). - Returns an error if
matis not a subfield ofF.