2
/***************************************************************************
3
* blitz/meta/vecassign.h TinyVector assignment metaprogram
5
* $Id: vecassign.h 1413 2005-11-01 22:04:15Z cookedm $
7
* Copyright (C) 1997-2001 Todd Veldhuizen <tveldhui@oonumerics.org>
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.
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.
19
* Suggestions: blitz-dev@oonumerics.org
20
* Bugs: blitz-bugs@oonumerics.org
22
* For more information, please see the Blitz++ Home Page:
23
* http://oonumerics.org/blitz/
25
***************************************************************************/
27
#ifndef BZ_META_VECASSIGN_H
28
#define BZ_META_VECASSIGN_H
32
template<int N, int I>
33
class _bz_meta_vecAssign {
35
static const int loopFlag = (I < N-1) ? 1 : 0;
37
template<typename T_vector, typename T_expr, typename T_updater>
38
static inline void fastAssign(T_vector& vec, T_expr expr, T_updater u)
40
u.update(vec[I], expr._bz_fastAccess(I));
41
_bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
42
::fastAssign(vec,expr,u);
45
template<typename T_vector, typename T_expr, typename T_updater>
46
static inline void assign(T_vector& vec, T_expr expr, T_updater u)
48
u.update(vec[I], expr[I]);
49
_bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
53
template<typename T_vector, typename T_numtype, typename T_updater>
54
static inline void assignWithArgs(T_vector& vec, T_updater u,
55
T_numtype x0, T_numtype x1=0, T_numtype x2=0, T_numtype x3=0,
56
T_numtype x4=0, T_numtype x5=0, T_numtype x6=0, T_numtype x7=0,
57
T_numtype x8=0, T_numtype x9=0)
60
_bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
61
::assignWithArgs(vec, u, x1, x2, x3, x4, x5, x6, x7, x8, x9);
67
class _bz_meta_vecAssign<0,0> {
69
template<typename T_vector, typename T_expr, typename T_updater>
70
static inline void fastAssign(T_vector&, T_expr, T_updater)
73
template<typename T_vector, typename T_expr, typename T_updater>
74
static inline void assign(T_vector&, T_expr, T_updater)
77
template<typename T_vector, typename T_numtype, typename T_updater>
78
static inline void assignWithArgs(T_vector&, T_updater,
79
T_numtype, T_numtype =0, T_numtype =0, T_numtype =0,
80
T_numtype =0, T_numtype =0, T_numtype =0, T_numtype =0,
81
T_numtype =0, T_numtype =0)
88
#endif // BZ_META_ASSIGN_H