source: Sophya/trunk/Poubelle/DPC:FitsIOServer/Blitz/blitz/meta/matassign.h@ 658

Last change on this file since 658 was 658, checked in by ansari, 26 years ago

no message

File size: 2.7 KB
RevLine 
[658]1/***************************************************************************
2 * blitz/meta/matassign.h TinyMatrix assignment metaprogram
3 *
4 * $Id: matassign.h,v 1.1.1.1 1999-11-26 16:37:08 ansari Exp $
5 *
6 * Copyright (C) 1997,1998 Todd Veldhuizen <tveldhui@seurat.uwaterloo.ca>
7 *
8 * This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
17 *
18 * Suggestions: blitz-suggest@cybervision.com
19 * Bugs: blitz-bugs@cybervision.com
20 *
21 * For more information, please see the Blitz++ Home Page:
22 * http://seurat.uwaterloo.ca/blitz/
23 *
24 ***************************************************************************
25 * $Log: not supported by cvs2svn $
26 * Revision 1.1.1.1 1999/04/09 17:59:03 ansari
27 * Creation module DPC/Blitz (blitz 0.4) Reza 09/04/99
28 *
29 * Revision 1.2 1998/03/14 00:08:44 tveldhui
30 * 0.2-alpha-05
31 *
32 * Revision 1.1 1997/07/16 14:51:20 tveldhui
33 * Update: Alpha release 0.2 (Arrays)
34 *
35 */
36
37
38#ifndef BZ_META_MATASSIGN_H
39#define BZ_META_MATASSIGN_H
40
41BZ_NAMESPACE(blitz)
42
43template<int N_rows, int N_columns, int I, int J>
44class _bz_meta_matAssign2 {
45public:
46 enum { go = (J < N_columns - 1) ? 1 : 0 };
47
48 template<class T_matrix, class T_expr, class T_updater>
49 static inline void f(T_matrix& mat, T_expr expr, T_updater u)
50 {
51 u.update(mat(I,J), expr(I,J));
52 _bz_meta_matAssign2<N_rows * go, N_columns * go, I * go, (J+1) * go>
53 ::f(mat, expr, u);
54 }
55};
56
57template<>
58class _bz_meta_matAssign2<0,0,0,0> {
59public:
60 template<class T_matrix, class T_expr, class T_updater>
61 static inline void f(T_matrix& mat, T_expr expr, T_updater u)
62 { }
63};
64
65template<int N_rows, int N_columns, int I>
66class _bz_meta_matAssign {
67public:
68 enum { go = (I < N_rows-1) ? 1 : 0 };
69
70 template<class T_matrix, class T_expr, class T_updater>
71 static inline void f(T_matrix& mat, T_expr expr, T_updater u)
72 {
73 _bz_meta_matAssign2<N_rows, N_columns, I, 0>::f(mat, expr, u);
74 _bz_meta_matAssign<N_rows * go, N_columns * go, (I+1) * go>
75 ::f(mat, expr, u);
76 }
77};
78
79template<>
80class _bz_meta_matAssign<0,0,0> {
81public:
82 template<class T_matrix, class T_expr, class T_updater>
83 static inline void f(T_matrix& mat, T_expr expr, T_updater u)
84 { }
85};
86
87
88BZ_NAMESPACE_END
89
90#endif // BZ_META_ASSIGN_H
Note: See TracBrowser for help on using the repository browser.