2
2
/***************************************************************************
3
3
* blitz/meta/vecassign.h TinyVector assignment metaprogram
5
* $Id: vecassign.h,v 1.6 2005/05/07 04:17:57 julianc Exp $
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
7
* Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
9
* This file is a part of Blitz.
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
12
14
* of the License, or (at your option) any later version.
14
* This program is distributed in the hope that it will be useful,
16
* Blitz is distributed in the hope that it will be useful,
15
17
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16
18
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17
* GNU General Public License for more details.
19
* GNU Lesser General Public License for more details.
19
* Suggestions: blitz-dev@oonumerics.org
20
* Bugs: blitz-bugs@oonumerics.org
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/>.
24
* Suggestions: blitz-devel@lists.sourceforge.net
25
* Bugs: blitz-support@lists.sourceforge.net
22
27
* For more information, please see the Blitz++ Home Page:
23
* http://oonumerics.org/blitz/
28
* https://sourceforge.net/projects/blitz/
25
30
***************************************************************************/
27
32
#ifndef BZ_META_VECASSIGN_H
28
33
#define BZ_META_VECASSIGN_H
35
#include <blitz/blitz.h>
30
37
BZ_NAMESPACE(blitz)
32
39
template<int N, int I>
35
42
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)
44
template<typename T_data, typename T_expr, typename T_updater>
45
static inline void fastAssign(T_data* data, T_expr expr, T_updater u)
40
u.update(vec[I], expr._bz_fastAccess(I));
47
u.update(data[I], expr.fastRead(I));
41
48
_bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
42
::fastAssign(vec,expr,u);
49
::fastAssign(data,expr,u);
45
52
template<typename T_vector, typename T_expr, typename T_updater>