Home | History | Annotate | Download | only in blas
      1 // This file is part of Eigen, a lightweight C++ template library
      2 // for linear algebra.
      3 //
      4 // Copyright (C) 2009 Gael Guennebaud <gael.guennebaud (at) inria.fr>
      5 // Copyright (C) 2012 Chen-Pang He <jdh8 (at) ms63.hinet.net>
      6 //
      7 // This Source Code Form is subject to the terms of the Mozilla
      8 // Public License v. 2.0. If a copy of the MPL was not distributed
      9 // with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
     10 
     11 #define SCALAR        double
     12 #define SCALAR_SUFFIX d
     13 #define SCALAR_SUFFIX_UP "D"
     14 #define ISCOMPLEX     0
     15 
     16 #include "level1_impl.h"
     17 #include "level1_real_impl.h"
     18 #include "level2_impl.h"
     19 #include "level2_real_impl.h"
     20 #include "level3_impl.h"
     21 
     22 double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
     23 {
     24   if(*n<=0) return 0;
     25 
     26   if(*incx==1 && *incy==1)    return (make_vector(x,*n).cast<double>().cwiseProduct(make_vector(y,*n).cast<double>())).sum();
     27   else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
     28   else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
     29   else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
     30   else if(*incx<0 && *incy<0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
     31   else return 0;
     32 }
     33