source: XMLIO_V2/external/include/blitz/tvecglobs.h @ 73

Last change on this file since 73 was 73, checked in by ymipsl, 14 years ago
  • Property svn:eol-style set to native
File size: 2.4 KB
Line 
1/***************************************************************************
2 * blitz/tvecglobs.h     TinyVector global functions
3 *
4 * $Id: tvecglobs.h,v 1.3 2003/12/11 03:44:22 julianc Exp $
5 *
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.
10 *
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.
15 *
16 * Suggestions:          blitz-dev@oonumerics.org
17 * Bugs:                 blitz-bugs@oonumerics.org
18 *
19 * For more information, please see the Blitz++ Home Page:
20 *    http://oonumerics.org/blitz/
21 *
22 ***************************************************************************/
23
24#ifndef BZ_TVECGLOBS_H
25#define BZ_TVECGLOBS_H
26
27#ifndef BZ_META_METAPROG_H
28 #include <blitz/meta/metaprog.h>
29#endif
30
31#ifndef BZ_NUMTRAIT_H
32 #include <blitz/numtrait.h>
33#endif
34
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>
39
40BZ_NAMESPACE(blitz)
41
42template<typename T_numtype1, typename T_numtype2, int N_length>
43inline BZ_PROMOTE(T_numtype1, T_numtype2)
44dot(const TinyVector<T_numtype1, N_length>& a, 
45    const TinyVector<T_numtype2, N_length>& b)
46{
47    return _bz_meta_vectorDot<N_length, 0>::f(a,b);
48}
49
50template<typename T_expr1, typename T_numtype2, int N_length>
51inline BZ_PROMOTE(_bz_typename T_expr1::T_numtype, T_numtype2)
52dot(_bz_VecExpr<T_expr1> a, const TinyVector<T_numtype2, N_length>& b)
53{
54    return _bz_meta_vectorDot<N_length, 0>::f_value_ref(a,b);
55}
56
57template<typename T_numtype1, typename T_expr2, int N_length>
58inline BZ_PROMOTE(T_numtype1, _bz_typename T_expr2::T_numtype)
59dot(const TinyVector<T_numtype1, N_length>& a, _bz_VecExpr<T_expr2> b)
60{
61    return _bz_meta_vectorDot<N_length, 0>::f_ref_value(a,b);
62}
63
64template<typename T_numtype1, int N_length>
65inline BZ_SUMTYPE(T_numtype1)
66product(const TinyVector<T_numtype1, N_length>& a)
67{
68    return _bz_meta_vectorProduct<N_length, 0>::f(a);
69}
70
71template<typename T_numtype, int N_length>
72inline T_numtype
73sum(const TinyVector<T_numtype, N_length>& a)
74{
75    return _bz_meta_vectorSum<N_length, 0>::f(a);
76}
77
78BZ_NAMESPACE_END
79
80#endif // BZ_TVECGLOBS_H
81
Note: See TracBrowser for help on using the repository browser.