1 /*
  2  *   Copyright (c) 2009, Michael Lehn
  3  *
  4  *   All rights reserved.
  5  *
  6  *   Redistribution and use in source and binary forms, with or without
  7  *   modification, are permitted provided that the following conditions
  8  *   are met:
  9  *
 10  *   1) Redistributions of source code must retain the above copyright
 11  *      notice, this list of conditions and the following disclaimer.
 12  *   2) Redistributions in binary form must reproduce the above copyright
 13  *      notice, this list of conditions and the following disclaimer in
 14  *      the documentation and/or other materials provided with the
 15  *      distribution.
 16  *   3) Neither the name of the FLENS development group nor the names of
 17  *      its contributors may be used to endorse or promote products derived
 18  *      from this software without specific prior written permission.
 19  *
 20  *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 21  *   "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 22  *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 23  *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 24  *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 25  *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 26  *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 27  *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 28  *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 29  *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 30  *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 31  */
 32 
 33 #ifndef CXXBLAS_LEVEL1_DOT_H
 34 #define CXXBLAS_LEVEL1_DOT_H 1
 35 
 36 #include <cxxblas/typedefs.h>
 37 
 38 #define HAVE_CXXBLAS_DOT 1
 39 #define HAVE_CXXBLAS_DOTU 1
 40 
 41 namespace cxxblas {
 42 
 43 template <typename IndexType, typename X, typename Y, typename Result>
 44     void
 45     dotu(IndexType n, const X *x, IndexType incX, const Y *y, IndexType incY,
 46          Result &result);
 47 
 48 template <typename IndexType, typename X, typename Y, typename Result>
 49     void
 50     dot(IndexType n, const X *x, IndexType incX, const Y *y, IndexType incY,
 51         Result &result);
 52 
 53 #ifdef HAVE_CBLAS
 54 
 55 // sdsdot
 56 template <typename IndexType>
 57     typename If<IndexType>::isBlasCompatibleInteger
 58     sdot(IndexType n, float alpha,
 59          const float *x, IndexType incX,
 60          const float *y, IndexType incY,
 61          float &result);
 62 
 63 // dsdot
 64 template <typename IndexType>
 65     typename If<IndexType>::isBlasCompatibleInteger
 66     dot(IndexType n,
 67         const float *x, IndexType incX,
 68         const float *y, IndexType incY,
 69         double &result);
 70 
 71 // sdot
 72 template <typename IndexType>
 73     typename If<IndexType>::isBlasCompatibleInteger
 74     dot(IndexType n,
 75         const float *x, IndexType incX,
 76         const float  *y, IndexType incY,
 77         float &result);
 78 
 79 // ddot
 80 template <typename IndexType>
 81     typename If<IndexType>::isBlasCompatibleInteger
 82     dot(IndexType n,
 83         const double *x, IndexType incX,
 84         const double *y, IndexType incY,
 85         double &result);
 86 
 87 // cdotu_sub
 88 template <typename IndexType>
 89     typename If<IndexType>::isBlasCompatibleInteger
 90     dotu(IndexType n,
 91          const ComplexFloat  *x, IndexType incX,
 92          const ComplexFloat  *y, IndexType incY,
 93          ComplexFloat &result);
 94 
 95 // cdotc_sub
 96 template <typename IndexType>
 97     typename If<IndexType>::isBlasCompatibleInteger
 98     dot(IndexType n,
 99         const ComplexFloat  *x, IndexType incX,
100         const ComplexFloat  *y, IndexType incY,
101         ComplexFloat &result);
102 
103 // zdotu_sub
104 template <typename IndexType>
105     typename If<IndexType>::isBlasCompatibleInteger
106     dotu(IndexType n,
107          const ComplexDouble *x, IndexType incX,
108          const ComplexDouble *y, IndexType incY,
109          ComplexDouble &result);
110 
111 // zdotc_sub
112 template <typename IndexType>
113     typename If<IndexType>::isBlasCompatibleInteger
114     dot(IndexType n,
115         const ComplexDouble *x, IndexType incX,
116         const ComplexDouble *y, IndexType incY,
117         ComplexDouble &result);
118 
119 #endif // HAVE_CBLAS
120 
121 // namespace cxxblas
122 
123 #endif // CXXBLAS_LEVEL1_DOT_H