~ubuntu-branches/ubuntu/karmic/python-scipy/karmic

« back to all changes in this revision

Viewing changes to scipy/weave/blitz/blitz/meta/vecassign.h

  • Committer: Bazaar Package Importer
  • Author(s): Ondrej Certik
  • Date: 2008-06-16 22:58:01 UTC
  • mfrom: (2.1.24 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080616225801-irdhrpcwiocfbcmt
Tags: 0.6.0-12
* The description updated to match the current SciPy (Closes: #489149).
* Standards-Version bumped to 3.8.0 (no action needed)
* Build-Depends: netcdf-dev changed to libnetcdf-dev

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// -*- C++ -*-
 
2
/***************************************************************************
 
3
 * blitz/meta/vecassign.h   TinyVector assignment metaprogram
 
4
 *
 
5
 * $Id: vecassign.h 1413 2005-11-01 22:04:15Z cookedm $
 
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
#ifndef BZ_META_VECASSIGN_H
 
28
#define BZ_META_VECASSIGN_H
 
29
 
 
30
BZ_NAMESPACE(blitz)
 
31
 
 
32
template<int N, int I> 
 
33
class _bz_meta_vecAssign {
 
34
public:
 
35
    static const int loopFlag = (I < N-1) ? 1 : 0;
 
36
 
 
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)
 
39
    {
 
40
        u.update(vec[I], expr._bz_fastAccess(I));
 
41
        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
 
42
           ::fastAssign(vec,expr,u);
 
43
    }
 
44
 
 
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)
 
47
    {
 
48
        u.update(vec[I], expr[I]);
 
49
        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
 
50
           ::assign(vec,expr,u);
 
51
    }
 
52
 
 
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)
 
58
    {
 
59
        u.update(vec[I], x0);
 
60
        _bz_meta_vecAssign<N * loopFlag, (I+1) * loopFlag>
 
61
            ::assignWithArgs(vec, u, x1, x2, x3, x4, x5, x6, x7, x8, x9);
 
62
    }
 
63
        
 
64
};
 
65
 
 
66
template<>
 
67
class _bz_meta_vecAssign<0,0> {
 
68
public:
 
69
    template<typename T_vector, typename T_expr, typename T_updater>
 
70
    static inline void fastAssign(T_vector&, T_expr, T_updater)
 
71
    { }
 
72
 
 
73
    template<typename T_vector, typename T_expr, typename T_updater>
 
74
    static inline void assign(T_vector&, T_expr, T_updater)
 
75
    { }
 
76
 
 
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)
 
82
    {
 
83
    }
 
84
};
 
85
 
 
86
BZ_NAMESPACE_END
 
87
 
 
88
#endif // BZ_META_ASSIGN_H