lapack_traits/blas/
axpy.rs

1use crate::Scalar;
2use num_complex::Complex32 as c32;
3use num_complex::Complex64 as c64;
4
5pub trait Taxpy: Scalar {
6    unsafe fn axpy(n: i32, alpha: Self, x: &[Self], incx: i32, y: &mut [Self], incy: i32);
7}
8
9macro_rules! impl_taxpy(
10    ($N: ty, $taxpy: path) => (
11        impl Taxpy for $N{
12            unsafe fn axpy(n: i32, alpha: Self, x: &[Self], incx: i32, y: &mut [Self], incy: i32) {
13                $taxpy(n, alpha, x, incx, y, incy)
14            }
15        }
16    )
17);
18
19impl_taxpy!(f32, cblas::saxpy);
20impl_taxpy!(f64, cblas::daxpy);
21impl_taxpy!(c32, cblas::caxpy);
22impl_taxpy!(c64, cblas::zaxpy);