blitz Version 1.0.2
Loading...
Searching...
No Matches
tv2assign.h
Go to the documentation of this file.
1// -*- C++ -*-
2/***************************************************************************
3 * blitz/meta/vecassign.h TinyVector assignment metaprogram
4 *
5 * $Id$
6 *
7 * Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
8 *
9 * This file is a part of Blitz.
10 *
11 * Blitz is free software: you can redistribute it and/or modify
12 * it under the terms of the GNU Lesser General Public License
13 * as published by the Free Software Foundation, either version 3
14 * of the License, or (at your option) any later version.
15 *
16 * Blitz is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU Lesser General Public License for more details.
20 *
21 * You should have received a copy of the GNU Lesser General Public
22 * License along with Blitz. If not, see <http://www.gnu.org/licenses/>.
23 *
24 * Suggestions: blitz-devel@lists.sourceforge.net
25 * Bugs: blitz-support@lists.sourceforge.net
26 *
27 * For more information, please see the Blitz++ Home Page:
28 * https://sourceforge.net/projects/blitz/
29 *
30 ***************************************************************************/
31
32#ifndef BZ_META_TV2ASSIGN_H
33#define BZ_META_TV2ASSIGN_H
34
35namespace blitz {
36
37template<int N, int I>
39public:
40 static const int loopFlag = (I < N-1) ? 1 : 0;
41
42 template<typename T_vector, typename T_expr, typename T_updater>
43 static inline void fastAssign(T_vector& vec, T_expr expr, T_updater u)
44 {
45 u.update(vec[I], expr.fastRead(I));
47 ::fastAssign(vec,expr,u);
48 }
49
50 template<typename T_vector, typename T_expr, typename T_updater>
51 static inline void assign(T_vector& vec, T_expr expr, T_updater u)
52 {
53 u.update(vec[I], expr[I]);
55 ::assign(vec,expr,u);
56 }
57
58 template<typename T_vector, typename T_numtype, typename T_updater>
59 static inline void assignWithArgs(T_vector& vec, T_updater u,
60 T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0,
61 T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0,
62 T_numtype x8=0, T_numtype x9=0)
63 {
64 u.update(vec[I], x0);
66 ::assignWithArgs(vec, u, x1, x2, x3, x4, x5, x6, x7, x8, x9);
67 }
68
69};
70
71template<>
73public:
74 template<typename T_vector, typename T_expr, typename T_updater>
75 static inline void fastAssign(T_vector&, T_expr, T_updater)
76 { }
77
78 template<typename T_vector, typename T_expr, typename T_updater>
79 static inline void assign(T_vector&, T_expr, T_updater)
80 { }
81
82 template<typename T_vector, typename T_numtype, typename T_updater>
83 static inline void assignWithArgs(T_vector&, T_updater,
84 T_numtype, T_numtype =0, T_numtype =0, T_numtype =0,
85 T_numtype =0, T_numtype =0, T_numtype =0, T_numtype =0,
86 T_numtype =0, T_numtype =0)
87 {
88 }
89};
90
91}
92
93#endif // BZ_META_ASSIGN_H
static void assign(T_vector &, T_expr, T_updater)
Definition tv2assign.h:79
static void fastAssign(T_vector &, T_expr, T_updater)
Definition tv2assign.h:75
static void assignWithArgs(T_vector &, T_updater, T_numtype, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0, T_numtype=0)
Definition tv2assign.h:83
Definition tv2assign.h:38
static void fastAssign(T_vector &vec, T_expr expr, T_updater u)
Definition tv2assign.h:43
static void assign(T_vector &vec, T_expr expr, T_updater u)
Definition tv2assign.h:51
static const int loopFlag
Definition tv2assign.h:40
static void assignWithArgs(T_vector &vec, T_updater u, T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0, T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0, T_numtype x8=0, T_numtype x9=0)
Definition tv2assign.h:59
Definition array-impl.h:66