aboutsummaryrefslogtreecommitdiffhomepage
path: root/blas/single.cpp
diff options
context:
space:
mode:
authorGravatar Chen-Pang He <jdh8@ms63.hinet.net>2012-09-08 02:06:45 +0800
committerGravatar Chen-Pang He <jdh8@ms63.hinet.net>2012-09-08 02:06:45 +0800
commit1b61aadcbe0f3d8c6898d28b7605347a7643190d (patch)
tree8644a7530385714f93193c7a824e181271939b9d /blas/single.cpp
parentb0b9b4d6b223cfbfee564427514cd6d693e1c503 (diff)
Implement SDSDOT with DSDOT and avoid allocating buffers in DSDOT.
Diffstat (limited to 'blas/single.cpp')
-rw-r--r--blas/single.cpp14
1 files changed, 1 insertions, 13 deletions
diff --git a/blas/single.cpp b/blas/single.cpp
index 9516398ba..836e3eee2 100644
--- a/blas/single.cpp
+++ b/blas/single.cpp
@@ -2,7 +2,6 @@
// for linear algebra.
//
// Copyright (C) 2009 Gael Guennebaud <gael.guennebaud@inria.fr>
-// Copyright (C) 2012 Chen-Pang He <jdh8@ms63.hinet.net>
//
// 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
@@ -20,15 +19,4 @@
#include "level3_impl.h"
float BLASFUNC(sdsdot)(int* n, float* alpha, float* x, int* incx, float* y, int* incy)
-{
- float res = *alpha;
-
- if(*n>0) {
- if(*incx==1 && *incy==1) res += (vector(x,*n).cwiseProduct(vector(y,*n))).sum();
- else if(*incx>0 && *incy>0) res += (vector(x,*n,*incx).cwiseProduct(vector(y,*n,*incy))).sum();
- else if(*incx<0 && *incy>0) res += (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,*incy))).sum();
- else if(*incx>0 && *incy<0) res += (vector(x,*n,*incx).cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
- else if(*incx<0 && *incy<0) res += (vector(x,*n,-*incx).reverse().cwiseProduct(vector(y,*n,-*incy).reverse())).sum();
- }
- return res;
-}
+{ return *alpha + BLASFUNC(dsdot)(n, x, incx, y, incy); }