Function rustml::ops_inplace::d_gemv [] [src]

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

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.0, 2.0, 3.0; 
    4.0, 2.0, 5.0
];
let x = [2.0, 6.0, 3.0];
let mut y = [7.0, 2.0];

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