Function rustml::ops_inplace::s_gemv [] [src]

pub fn s_gemv(trans: bool, alpha: f32, a: &Matrix<f32>, x: &[f32], beta: f32, y: &mut [f32])

Computes alpha * A * x + beta * y or alpha * A^T * x + beta * y and stores the result in y. (optimized via BLAS)

If trans is true the transpose of A is used.

Panics if the dimensions of the matrix and the vector do not match.

use rustml::ops_inplace::*;
use rustml::matrix::*;

let a = mat![
    1.0f32, 2.0, 3.0; 
    4.0, 2.0, 5.0
];
let x = [2.0f32, 6.0, 3.0];
let mut y = [7.0f32, 2.0];

s_gemv(false, 2.0, &a, &x, 3.0, &mut y);
assert_eq!(y, [67.0f32, 76.0]);