1
/***************************************************************************
2
* blitz/tvecglobs.h TinyVector global functions
4
* $Id: tvecglobs.h 1414 2005-11-01 22:04:59Z cookedm $
6
* This program is free software; you can redistribute it and/or
7
* modify it under the terms of the GNU General Public License
8
* as published by the Free Software Foundation; either version 2
9
* of the License, or (at your option) any later version.
11
* This program is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU General Public License for more details.
16
* Suggestions: blitz-dev@oonumerics.org
17
* Bugs: blitz-bugs@oonumerics.org
19
* For more information, please see the Blitz++ Home Page:
20
* http://oonumerics.org/blitz/
22
***************************************************************************/
24
#ifndef BZ_TVECGLOBS_H
25
#define BZ_TVECGLOBS_H
27
#ifndef BZ_META_METAPROG_H
28
#include <blitz/meta/metaprog.h>
32
#include <blitz/numtrait.h>
35
#include <blitz/tvcross.h> // Cross products
36
#include <blitz/meta/dot.h>
37
#include <blitz/meta/product.h>
38
#include <blitz/meta/sum.h>
42
template<typename T_numtype1, typename T_numtype2, int N_length>
43
inline BZ_PROMOTE(T_numtype1, T_numtype2)
44
dot(const TinyVector<T_numtype1, N_length>& a,
45
const TinyVector<T_numtype2, N_length>& b)
47
return _bz_meta_vectorDot<N_length, 0>::f(a,b);
50
template<typename T_expr1, typename T_numtype2, int N_length>
51
inline BZ_PROMOTE(_bz_typename T_expr1::T_numtype, T_numtype2)
52
dot(_bz_VecExpr<T_expr1> a, const TinyVector<T_numtype2, N_length>& b)
54
return _bz_meta_vectorDot<N_length, 0>::f_value_ref(a,b);
57
template<typename T_numtype1, typename T_expr2, int N_length>
58
inline BZ_PROMOTE(T_numtype1, _bz_typename T_expr2::T_numtype)
59
dot(const TinyVector<T_numtype1, N_length>& a, _bz_VecExpr<T_expr2> b)
61
return _bz_meta_vectorDot<N_length, 0>::f_ref_value(a,b);
64
template<typename T_numtype1, int N_length>
65
inline BZ_SUMTYPE(T_numtype1)
66
product(const TinyVector<T_numtype1, N_length>& a)
68
return _bz_meta_vectorProduct<N_length, 0>::f(a);
71
template<typename T_numtype, int N_length>
73
sum(const TinyVector<T_numtype, N_length>& a)
75
return _bz_meta_vectorSum<N_length, 0>::f(a);
80
#endif // BZ_TVECGLOBS_H