You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

32 lines
1.5 KiB

  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@inria.fr>
  5. // Copyright (C) 2012 Chen-Pang He <jdh8@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. #define SCALAR double
  11. #define SCALAR_SUFFIX d
  12. #define SCALAR_SUFFIX_UP "D"
  13. #define ISCOMPLEX 0
  14. #include "level1_impl.h"
  15. #include "level1_real_impl.h"
  16. #include "level2_impl.h"
  17. #include "level2_real_impl.h"
  18. #include "level3_impl.h"
  19. double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
  20. {
  21. if(*n<=0) return 0;
  22. if(*incx==1 && *incy==1) return (make_vector(x,*n).cast<double>().cwiseProduct(make_vector(y,*n).cast<double>())).sum();
  23. else if(*incx>0 && *incy>0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
  24. else if(*incx<0 && *incy>0) return (make_vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(make_vector(y,*n,*incy).cast<double>())).sum();
  25. else if(*incx>0 && *incy<0) return (make_vector(x,*n,*incx).cast<double>().cwiseProduct(make_vector(y,*n,-*incy).reverse().cast<double>())).sum();
  26. 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();
  27. else return 0;
  28. }