pub fn parallel_batch_matvec(
py: Python<'_>,
matrices: Vec<Vec<f64>>,
vectors: Vec<Vec<f64>>,
n_rows: usize,
n_cols: usize,
) -> PyResult<Vec<Vec<f64>>>Expand description
Perform a batch of matrix-vector multiplications in parallel.
Each pair (matrices[i], vectors[i]) represents a multiplication
A * v where A is stored in row-major order with shape
(n_rows, n_cols) and v is a vector of length n_cols.
The GIL is released during Rayon computation.
§Arguments
matrices– list of flat row-major matrices, each withn_rows * n_colselements.vectors– list of vectors, each withn_colselements.n_rows– number of rows in each matrix.n_cols– number of columns in each matrix (= length of each vector).
§Errors
Returns ValueError if:
matricesandvectorshave different lengths.- Any matrix does not have exactly
n_rows * n_colselements. - Any vector does not have exactly
n_colselements.