2009-09-25 19:08:39 +08:00
|
|
|
// This file is part of Eigen, a lightweight C++ template library
|
|
|
|
// for linear algebra.
|
|
|
|
//
|
2010-06-25 05:21:58 +08:00
|
|
|
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
|
2012-09-05 18:59:32 +08:00
|
|
|
// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.net>
|
2009-09-25 19:08:39 +08:00
|
|
|
//
|
2012-07-14 02:42:47 +08:00
|
|
|
// This Source Code Form is subject to the terms of the Mozilla
|
|
|
|
// Public License v. 2.0. If a copy of the MPL was not distributed
|
|
|
|
// with this file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
2009-09-25 19:08:39 +08:00
|
|
|
|
|
|
|
#define SCALAR double
|
|
|
|
#define SCALAR_SUFFIX d
|
2010-11-04 05:03:12 +08:00
|
|
|
#define SCALAR_SUFFIX_UP "D"
|
2009-09-25 19:08:39 +08:00
|
|
|
#define ISCOMPLEX 0
|
|
|
|
|
|
|
|
#include "level1_impl.h"
|
2010-11-23 01:49:12 +08:00
|
|
|
#include "level1_real_impl.h"
|
2009-09-25 19:08:39 +08:00
|
|
|
#include "level2_impl.h"
|
2010-11-23 01:49:12 +08:00
|
|
|
#include "level2_real_impl.h"
|
2009-09-25 19:08:39 +08:00
|
|
|
#include "level3_impl.h"
|
2012-09-05 18:59:32 +08:00
|
|
|
|
2012-09-08 02:06:45 +08:00
|
|
|
double BLASFUNC(dsdot)(int* n, float* x, int* incx, float* y, int* incy)
|
2012-09-05 18:59:32 +08:00
|
|
|
{
|
2012-09-08 02:06:45 +08:00
|
|
|
if(*n<=0) return 0;
|
2012-09-07 15:21:57 +08:00
|
|
|
|
2012-09-08 02:06:45 +08:00
|
|
|
if(*incx==1 && *incy==1) return (vector(x,*n).cast<double>().cwiseProduct(vector(y,*n).cast<double>())).sum();
|
|
|
|
else if(*incx>0 && *incy>0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
|
|
|
|
else if(*incx<0 && *incy>0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,*incy).cast<double>())).sum();
|
|
|
|
else if(*incx>0 && *incy<0) return (vector(x,*n,*incx).cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
|
|
|
else if(*incx<0 && *incy<0) return (vector(x,*n,-*incx).reverse().cast<double>().cwiseProduct(vector(y,*n,-*incy).reverse().cast<double>())).sum();
|
|
|
|
else return 0;
|
2012-09-05 18:59:32 +08:00
|
|
|
}
|
|
|
|
|