blob: 8fd0709ba8f158003836576141a7f4ea0ccc69e3 [file] [log] [blame]
Narayan Kamathc981c482012-11-02 10:59:05 +00001// 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>
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -07005// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.net>
Narayan Kamathc981c482012-11-02 10:59:05 +00006//
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"
Carlos Hernandez7faaa9f2014-08-05 17:53:32 -070021
22double 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 (vector(x,*n).cast<double>().cwiseProduct(vector(y,*n).cast<double>())).sum();
27 else if(*incx>0 && *incy>0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
28 else if(*incx<0 && *incy>0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
29 else if(*incx>0 && *incy<0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
30 else if(*incx<0 && *incy<0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
31 else return 0;
32}
33