Exemple #1
0
        public static void saxpy()
        {
            (var method, var msg) = intro();
            var n     = 5;
            var incx  = 1;
            var incy  = 1;
            var alpha = .5f;
            var x     = floats(1, 2, 3, 4, 5);
            var y     = floats(.5, .5, .5, .5, .5);

            input($"alpha={alpha}, x = {x.FormatVector()}, y = {y.FormatVector()}");

            var sw = stopwatch();

            CBLAS.cblas_saxpy(n, alpha, ref x[0], incx, ref y[0], incy);
            var time = snapshot(sw);

            output(y.FormatVector());
            conclude(time);
        }
Exemple #2
0
Fichier : All.cs Projet : 0xCM/z0
        public static void saxpy()
        {
            (var method, var msg) = intro();
            var          n     = 5;
            var          incx  = 1;
            var          incy  = 1;
            var          alpha = .5f;
            Span <float> x     = new float[] { 1, 2, 3, 4, 5 };
            Span <float> y     = new float[] { .5f, .5f, .5f, .5f, .5f };

            input($"alpha={alpha}, x = {x.FormatVector()}, y = {y.FormatVector()}");

            var sw = Time.stopwatch();

            CBLAS.cblas_saxpy(n, alpha, ref x[0], incx, ref y[0], incy);
            var ss = snap(sw);

            output(y.FormatVector());
            conclude(ss);
        }
Exemple #3
0
 public static void axpy(float a, BlockVector <float> X, BlockVector <float> Y, ref BlockVector <float> Z)
 {
     Y.CopyTo(ref Z);
     CBLAS.cblas_saxpy(length(X, Y), a, ref head(X), 1, ref head(Z), 1);
 }
Exemple #4
0
 public static void axpy <N>(float a, BlockVector <N, float> X, BlockVector <N, float> Y, ref BlockVector <N, float> Z)
     where N : ITypeNat, new()
 {
     Y.CopyTo(ref Z);
     CBLAS.cblas_saxpy(nati <N>(), a, ref head(X), 1, ref head(Z), 1);
 }
Exemple #5
0
Fichier : axpy.cs Projet : 0xCM/z0
 public static void axpy <N>(float a, Block256 <N, float> X, Block256 <N, float> Y, ref Block256 <N, float> Z)
     where N : unmanaged, ITypeNat
 {
     Y.CopyTo(ref Z);
     CBLAS.cblas_saxpy(nat32i <N>(), a, ref head(X), 1, ref head(Z), 1);
 }