lapack_traits/blas/
nrm2.rs

1use crate::Scalar;
2use num_complex::Complex32 as c32;
3use num_complex::Complex64 as c64;
4
5pub trait Tnrm2: Scalar{
6    unsafe fn nrm2(n: i32, x: &[Self], incx: i32) -> Self::Real;
7}
8
9macro_rules! impl_tnrm2(
10    ($N: ty, $tnrm2: path) => (
11        impl Tnrm2 for $N{
12            unsafe fn nrm2(n: i32, x: &[Self], incx: i32) -> Self::Real{
13                $tnrm2(n, x, incx)
14            }
15        }
16    )
17);
18
19impl_tnrm2!(f32, cblas::snrm2);
20impl_tnrm2!(f64, cblas::dnrm2);
21impl_tnrm2!(c32, cblas::scnrm2);
22impl_tnrm2!(c64, cblas::dznrm2);