Skip to main content

blas_dgemv

Function blas_dgemv 

Source
pub fn blas_dgemv(
    transpose: bool,
    alpha: f64,
    a: &Matrix,
    x: &[f64],
    beta: f64,
    y: &[f64],
) -> Result<Vec<f64>>
Expand description

Matrix-vector product alpha * op(A) * x + beta * y, where op(A) is A or its transpose (igraph_blas_dgemv); the result is returned as a new vector. When beta is zero, y only provides the length.

Time complexity: O(nk) for an n × k matrix.

Binds igraph_blas_dgemv.

§Errors

If the lengths of x and y do not match op(A).

§Examples

use igraph::{linalg::blas_dgemv, prelude::*};
let a = Matrix::from_rows(&[[1.0, 2.0], [3.0, 4.0]]).unwrap();
assert_eq!(blas_dgemv(false, 1.0, &a, &[1.0, 1.0], 0.0, &[0.0, 0.0]).unwrap(), vec![3.0, 7.0]);
assert_eq!(blas_dgemv(true, 2.0, &a, &[1.0, 1.0], 1.0, &[1.0, 1.0]).unwrap(), vec![9.0, 13.0]);