1 | #ifndef BZ_ARRAYOPS_CC
|
---|
2 | #define BZ_ARRAYOPS_CC
|
---|
3 |
|
---|
4 | #ifndef BZ_ARRAY_H
|
---|
5 | #error <blitz/array/ops.cc> must be included via <blitz/array.h>
|
---|
6 | #endif
|
---|
7 |
|
---|
8 | #ifndef BZ_UPDATE_H
|
---|
9 | #include <blitz/update.h>
|
---|
10 | #endif
|
---|
11 |
|
---|
12 | BZ_NAMESPACE(blitz)
|
---|
13 |
|
---|
14 | /*
|
---|
15 | * Constant operands
|
---|
16 | */
|
---|
17 |
|
---|
18 | template<class T_numtype, int N_rank>
|
---|
19 | inline Array<T_numtype, N_rank>& Array<T_numtype,N_rank>::initialize(
|
---|
20 | T_numtype x)
|
---|
21 | {
|
---|
22 | (*this) = _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
23 | return *this;
|
---|
24 | }
|
---|
25 |
|
---|
26 | template<class T_numtype, int N_rank>
|
---|
27 | inline Array<T_numtype, N_rank>&
|
---|
28 | Array<T_numtype,N_rank>::operator+=(T_numtype x)
|
---|
29 | {
|
---|
30 | (*this) += _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
31 | return *this;
|
---|
32 | }
|
---|
33 |
|
---|
34 | template<class T_numtype, int N_rank>
|
---|
35 | inline Array<T_numtype, N_rank>&
|
---|
36 | Array<T_numtype,N_rank>::operator-=(T_numtype x)
|
---|
37 | {
|
---|
38 | (*this) -= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
39 | return *this;
|
---|
40 | }
|
---|
41 |
|
---|
42 | template<class T_numtype, int N_rank>
|
---|
43 | inline Array<T_numtype, N_rank>&
|
---|
44 | Array<T_numtype,N_rank>::operator*=(T_numtype x)
|
---|
45 | {
|
---|
46 | (*this) *= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
47 | return *this;
|
---|
48 | }
|
---|
49 |
|
---|
50 | template<class T_numtype, int N_rank>
|
---|
51 | inline Array<T_numtype, N_rank>&
|
---|
52 | Array<T_numtype,N_rank>::operator/=(T_numtype x)
|
---|
53 | {
|
---|
54 | (*this) /= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
55 | return *this;
|
---|
56 | }
|
---|
57 |
|
---|
58 | template<class T_numtype, int N_rank>
|
---|
59 | inline Array<T_numtype, N_rank>&
|
---|
60 | Array<T_numtype,N_rank>::operator%=(T_numtype x)
|
---|
61 | {
|
---|
62 | (*this) %= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
63 | return *this;
|
---|
64 | }
|
---|
65 |
|
---|
66 | template<class T_numtype, int N_rank>
|
---|
67 | inline Array<T_numtype, N_rank>&
|
---|
68 | Array<T_numtype,N_rank>::operator^=(T_numtype x)
|
---|
69 | {
|
---|
70 | (*this) ^= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
71 | return *this;
|
---|
72 | }
|
---|
73 |
|
---|
74 | template<class T_numtype, int N_rank>
|
---|
75 | inline Array<T_numtype, N_rank>&
|
---|
76 | Array<T_numtype,N_rank>::operator&=(T_numtype x)
|
---|
77 | {
|
---|
78 | (*this) &= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
79 | return *this;
|
---|
80 | }
|
---|
81 |
|
---|
82 | template<class T_numtype, int N_rank>
|
---|
83 | inline Array<T_numtype, N_rank>&
|
---|
84 | Array<T_numtype,N_rank>::operator|=(T_numtype x)
|
---|
85 | {
|
---|
86 | (*this) |= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
87 | return *this;
|
---|
88 | }
|
---|
89 |
|
---|
90 | template<class T_numtype, int N_rank>
|
---|
91 | inline Array<T_numtype, N_rank>&
|
---|
92 | Array<T_numtype,N_rank>::operator>>=(T_numtype x)
|
---|
93 | {
|
---|
94 | (*this) <<= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
95 | return *this;
|
---|
96 | }
|
---|
97 |
|
---|
98 | template<class T_numtype, int N_rank>
|
---|
99 | inline Array<T_numtype, N_rank>&
|
---|
100 | Array<T_numtype,N_rank>::operator<<=(T_numtype x)
|
---|
101 | {
|
---|
102 | (*this) <<= _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
|
---|
103 | return *this;
|
---|
104 | }
|
---|
105 |
|
---|
106 | /*
|
---|
107 | * Array operands
|
---|
108 | */
|
---|
109 |
|
---|
110 | template<class T_numtype, int N_rank>
|
---|
111 | inline Array<T_numtype, N_rank>&
|
---|
112 | Array<T_numtype, N_rank>::operator=(const Array<T_numtype,N_rank>& x)
|
---|
113 | {
|
---|
114 | (*this) = _bz_ArrayExpr<ArrayIterator<T_numtype, N_rank> >(x.begin());
|
---|
115 | return *this;
|
---|
116 | }
|
---|
117 |
|
---|
118 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
119 | inline Array<T_numtype, N_rank>&
|
---|
120 | Array<T_numtype, N_rank>::operator=(const Array<T_numtype2,N_rank>& x)
|
---|
121 | {
|
---|
122 | (*this) = _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
123 | return *this;
|
---|
124 | }
|
---|
125 |
|
---|
126 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
127 | inline Array<T_numtype, N_rank>&
|
---|
128 | Array<T_numtype, N_rank>::operator+=(const Array<T_numtype2,N_rank>& x)
|
---|
129 | {
|
---|
130 | (*this) += _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
131 | return *this;
|
---|
132 | }
|
---|
133 |
|
---|
134 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
135 | inline Array<T_numtype, N_rank>&
|
---|
136 | Array<T_numtype, N_rank>::operator-=(const Array<T_numtype2,N_rank>& x)
|
---|
137 | {
|
---|
138 | (*this) -= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
139 | return *this;
|
---|
140 | }
|
---|
141 |
|
---|
142 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
143 | inline Array<T_numtype, N_rank>&
|
---|
144 | Array<T_numtype, N_rank>::operator*=(const Array<T_numtype2,N_rank>& x)
|
---|
145 | {
|
---|
146 | (*this) *= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
147 | return *this;
|
---|
148 | }
|
---|
149 |
|
---|
150 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
151 | inline Array<T_numtype, N_rank>&
|
---|
152 | Array<T_numtype, N_rank>::operator/=(const Array<T_numtype2,N_rank>& x)
|
---|
153 | {
|
---|
154 | (*this) /= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
155 | return *this;
|
---|
156 | }
|
---|
157 |
|
---|
158 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
159 | inline Array<T_numtype, N_rank>&
|
---|
160 | Array<T_numtype, N_rank>::operator%=(const Array<T_numtype2,N_rank>& x)
|
---|
161 | {
|
---|
162 | (*this) %= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
163 | return *this;
|
---|
164 | }
|
---|
165 |
|
---|
166 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
167 | inline Array<T_numtype, N_rank>&
|
---|
168 | Array<T_numtype, N_rank>::operator^=(const Array<T_numtype2,N_rank>& x)
|
---|
169 | {
|
---|
170 | (*this) ^= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
171 | return *this;
|
---|
172 | }
|
---|
173 |
|
---|
174 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
175 | inline Array<T_numtype, N_rank>&
|
---|
176 | Array<T_numtype, N_rank>::operator&=(const Array<T_numtype2,N_rank>& x)
|
---|
177 | {
|
---|
178 | (*this) &= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
179 | return *this;
|
---|
180 | }
|
---|
181 |
|
---|
182 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
183 | inline Array<T_numtype, N_rank>&
|
---|
184 | Array<T_numtype, N_rank>::operator|=(const Array<T_numtype2,N_rank>& x)
|
---|
185 | {
|
---|
186 | (*this) |= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
187 | return *this;
|
---|
188 | }
|
---|
189 |
|
---|
190 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
191 | inline Array<T_numtype, N_rank>&
|
---|
192 | Array<T_numtype, N_rank>::operator>>=(const Array<T_numtype2,N_rank>& x)
|
---|
193 | {
|
---|
194 | (*this) >>= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
195 | return *this;
|
---|
196 | }
|
---|
197 |
|
---|
198 | template<class T_numtype, int N_rank> template<class T_numtype2>
|
---|
199 | inline Array<T_numtype, N_rank>&
|
---|
200 | Array<T_numtype, N_rank>::operator<<=(const Array<T_numtype2,N_rank>& x)
|
---|
201 | {
|
---|
202 | (*this) <<= _bz_ArrayExpr<ArrayIterator<T_numtype2, N_rank> >(x.begin());
|
---|
203 | return *this;
|
---|
204 | }
|
---|
205 |
|
---|
206 | /*
|
---|
207 | * Array expression operands
|
---|
208 | */
|
---|
209 |
|
---|
210 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
211 | inline Array<T_numtype, N_rank>&
|
---|
212 | Array<T_numtype, N_rank>::operator=(_bz_ArrayExpr<T_expr> expr)
|
---|
213 | {
|
---|
214 | evaluate(expr, _bz_update<T_numtype, _bz_typename T_expr::T_numtype>());
|
---|
215 | return *this;
|
---|
216 | }
|
---|
217 |
|
---|
218 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
219 | inline Array<T_numtype, N_rank>&
|
---|
220 | Array<T_numtype, N_rank>::operator+=(_bz_ArrayExpr<T_expr> expr)
|
---|
221 | {
|
---|
222 | evaluate(expr, _bz_plus_update<T_numtype, _bz_typename T_expr::T_numtype>());
|
---|
223 | return *this;
|
---|
224 | }
|
---|
225 |
|
---|
226 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
227 | inline Array<T_numtype, N_rank>&
|
---|
228 | Array<T_numtype, N_rank>::operator-=(_bz_ArrayExpr<T_expr> expr)
|
---|
229 | {
|
---|
230 | evaluate(expr, _bz_minus_update<T_numtype,
|
---|
231 | _bz_typename T_expr::T_numtype>());
|
---|
232 | return *this;
|
---|
233 | }
|
---|
234 |
|
---|
235 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
236 | inline Array<T_numtype, N_rank>&
|
---|
237 | Array<T_numtype, N_rank>::operator*=(_bz_ArrayExpr<T_expr> expr)
|
---|
238 | {
|
---|
239 | evaluate(expr, _bz_multiply_update<T_numtype,
|
---|
240 | _bz_typename T_expr::T_numtype>());
|
---|
241 | return *this;
|
---|
242 | }
|
---|
243 |
|
---|
244 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
245 | inline Array<T_numtype, N_rank>&
|
---|
246 | Array<T_numtype, N_rank>::operator/=(_bz_ArrayExpr<T_expr> expr)
|
---|
247 | {
|
---|
248 | evaluate(expr, _bz_divide_update<T_numtype,
|
---|
249 | _bz_typename T_expr::T_numtype>());
|
---|
250 | return *this;
|
---|
251 | }
|
---|
252 |
|
---|
253 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
254 | inline Array<T_numtype, N_rank>&
|
---|
255 | Array<T_numtype, N_rank>::operator%=(_bz_ArrayExpr<T_expr> expr)
|
---|
256 | {
|
---|
257 | evaluate(expr, _bz_mod_update<T_numtype,
|
---|
258 | _bz_typename T_expr::T_numtype>());
|
---|
259 | return *this;
|
---|
260 | }
|
---|
261 |
|
---|
262 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
263 | inline Array<T_numtype, N_rank>&
|
---|
264 | Array<T_numtype, N_rank>::operator^=(_bz_ArrayExpr<T_expr> expr)
|
---|
265 | {
|
---|
266 | evaluate(expr, _bz_xor_update<T_numtype,
|
---|
267 | _bz_typename T_expr::T_numtype>());
|
---|
268 | return *this;
|
---|
269 | }
|
---|
270 |
|
---|
271 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
272 | inline Array<T_numtype, N_rank>&
|
---|
273 | Array<T_numtype, N_rank>::operator&=(_bz_ArrayExpr<T_expr> expr)
|
---|
274 | {
|
---|
275 | evaluate(expr, _bz_bitand_update<T_numtype,
|
---|
276 | _bz_typename T_expr::T_numtype>());
|
---|
277 | return *this;
|
---|
278 | }
|
---|
279 |
|
---|
280 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
281 | inline Array<T_numtype, N_rank>&
|
---|
282 | Array<T_numtype, N_rank>::operator|=(_bz_ArrayExpr<T_expr> expr)
|
---|
283 | {
|
---|
284 | evaluate(expr, _bz_bitor_update<T_numtype,
|
---|
285 | _bz_typename T_expr::T_numtype>());
|
---|
286 | return *this;
|
---|
287 | }
|
---|
288 |
|
---|
289 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
290 | inline Array<T_numtype, N_rank>&
|
---|
291 | Array<T_numtype, N_rank>::operator>>=(_bz_ArrayExpr<T_expr> expr)
|
---|
292 | {
|
---|
293 | evaluate(expr, _bz_shiftr_update<T_numtype,
|
---|
294 | _bz_typename T_expr::T_numtype>());
|
---|
295 | return *this;
|
---|
296 | }
|
---|
297 |
|
---|
298 | template<class T_numtype, int N_rank> template<class T_expr>
|
---|
299 | inline Array<T_numtype, N_rank>&
|
---|
300 | Array<T_numtype, N_rank>::operator<<=(_bz_ArrayExpr<T_expr> expr)
|
---|
301 | {
|
---|
302 | evaluate(expr, _bz_shiftl_update<T_numtype,
|
---|
303 | _bz_typename T_expr::T_numtype>());
|
---|
304 | return *this;
|
---|
305 | }
|
---|
306 |
|
---|
307 | BZ_NAMESPACE_END
|
---|
308 |
|
---|
309 | #endif // BZ_ARRAYOPS_CC
|
---|