source: XMLIO_V2/external/include/blitz/meta/matassign.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: 2.4 KB
Line 
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/meta/matassign.h   TinyMatrix assignment metaprogram
4 *
5 * $Id: matassign.h,v 1.6 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
28#ifndef BZ_META_MATASSIGN_H
29#define BZ_META_MATASSIGN_H
30
31BZ_NAMESPACE(blitz)
32
33template<int N_rows, int N_columns, int I, int J>
34class _bz_meta_matAssign2 {
35public:
36    static const int go = (J < N_columns - 1) ? 1 : 0;
37
38    template<typename T_matrix, typename T_expr, typename T_updater>
39    static inline void f(T_matrix& mat, T_expr expr, T_updater u)
40    {
41        u.update(mat(I,J), expr(I,J));
42        _bz_meta_matAssign2<N_rows * go, N_columns * go, I * go, (J+1) * go>
43            ::f(mat, expr, u);
44    }
45};
46
47template<>
48class _bz_meta_matAssign2<0,0,0,0> {
49public:
50    template<typename T_matrix, typename T_expr, typename T_updater>
51    static inline void f(T_matrix&, T_expr, T_updater)
52    { }
53};
54
55template<int N_rows, int N_columns, int I> 
56class _bz_meta_matAssign {
57public:
58    static const int go = (I < N_rows-1) ? 1 : 0;
59
60    template<typename T_matrix, typename T_expr, typename T_updater>
61    static inline void f(T_matrix& mat, T_expr expr, T_updater u)
62    {
63        _bz_meta_matAssign2<N_rows, N_columns, I, 0>::f(mat, expr, u);
64        _bz_meta_matAssign<N_rows * go, N_columns * go, (I+1) * go>
65            ::f(mat, expr, u);
66    }
67};
68
69template<>
70class _bz_meta_matAssign<0,0,0> {
71public:
72    template<typename T_matrix, typename T_expr, typename T_updater>
73    static inline void f(T_matrix&, T_expr, T_updater)
74    { }
75};
76
77
78BZ_NAMESPACE_END
79
80#endif // BZ_META_ASSIGN_H
Note: See TracBrowser for help on using the repository browser.