source: XMLIO_V2/external/include/blitz/meta/product.h @ 80

Last change on this file since 80 was 80, checked in by ymipsl, 14 years ago

ajout lib externe

  • Property svn:eol-style set to native
File size: 1.8 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/meta/product.h  TinyVector product metaprogram
4 *
5 * $Id: product.h,v 1.5 2005/05/07 04:17:57 julianc Exp $
6 *
7 * Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
8 *
9 * This program is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU General Public License
11 * as published by the Free Software Foundation; either version 2
12 * of the License, or (at your option) any later version.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17 * GNU General Public License for more details.
18 *
19 * Suggestions:          blitz-dev@oonumerics.org
20 * Bugs:                 blitz-bugs@oonumerics.org
21 *
22 * For more information, please see the Blitz++ Home Page:
23 *    http://oonumerics.org/blitz/
24 *
25 ***************************************************************************/
26
27#ifndef BZ_META_PRODUCT_H
28#define BZ_META_PRODUCT_H
29
30#ifndef BZ_PROMOTE_H
31 #include <blitz/promote.h>
32#endif
33
34#ifndef BZ_METAPROG_H
35 #include <blitz/meta/metaprog.h>
36#endif
37
38BZ_NAMESPACE(blitz)
39
40template<int N, int I>
41class _bz_meta_vectorProduct {
42public:
43    static const int loopFlag = (I < N-1) ? 1 : 0;
44
45    template<typename T_expr1>
46    static inline BZ_SUMTYPE(_bz_typename T_expr1::T_numtype)
47    f(const T_expr1& a)
48    {
49        return a[I] * _bz_meta_vectorProduct<loopFlag * N, 
50            loopFlag * (I+1)>::f(a);
51    }
52};
53
54template<>
55class _bz_meta_vectorProduct<0,0> {
56public:
57    template<typename T_expr1>
58    static inline _bz_meta_nullOperand f(const T_expr1&)
59    { return _bz_meta_nullOperand(); }
60};
61
62BZ_NAMESPACE_END
63
64#endif // BZ_META_PRODUCT_H
Note: See TracBrowser for help on using the repository browser.