| 1 | #ifndef BZ_TINYVEC_CC | 
|---|
| 2 | #define BZ_TINYVEC_CC | 
|---|
| 3 |  | 
|---|
| 4 | #ifndef BZ_TINYVEC_H | 
|---|
| 5 | #include <blitz/tinyvec.h> | 
|---|
| 6 | #endif | 
|---|
| 7 |  | 
|---|
| 8 | #ifndef BZ_VECTOR_H | 
|---|
| 9 | #include <blitz/vector.h> | 
|---|
| 10 | #endif | 
|---|
| 11 |  | 
|---|
| 12 | #ifndef BZ_VECPICK_H | 
|---|
| 13 | #include <blitz/vecpick.h> | 
|---|
| 14 | #endif | 
|---|
| 15 |  | 
|---|
| 16 | #ifndef BZ_RANGE_H | 
|---|
| 17 | #include <blitz/range.h> | 
|---|
| 18 | #endif | 
|---|
| 19 |  | 
|---|
| 20 | #include <blitz/meta/vecassign.h> | 
|---|
| 21 |  | 
|---|
| 22 | BZ_NAMESPACE(blitz) | 
|---|
| 23 |  | 
|---|
| 24 | template<class T_numtype, int N_length> | 
|---|
| 25 | inline TinyVector<T_numtype, N_length>::TinyVector(T_numtype initValue) | 
|---|
| 26 | { | 
|---|
| 27 | for (int i=0; i < N_length; ++i) | 
|---|
| 28 | data_[i] = initValue; | 
|---|
| 29 | } | 
|---|
| 30 |  | 
|---|
| 31 | template<class T_numtype, int N_length> | 
|---|
| 32 | inline TinyVector<T_numtype, N_length>::TinyVector(const | 
|---|
| 33 | TinyVector<T_numtype, N_length>& x) | 
|---|
| 34 | { | 
|---|
| 35 | for (int i=0; i < N_length; ++i) | 
|---|
| 36 | data_[i] = x.data_[i]; | 
|---|
| 37 | } | 
|---|
| 38 |  | 
|---|
| 39 | template<class T_numtype, int N_length> template<class P_expr, class P_updater> | 
|---|
| 40 | inline | 
|---|
| 41 | void TinyVector<T_numtype, N_length>::_bz_assign(P_expr expr, P_updater up) | 
|---|
| 42 | { | 
|---|
| 43 | BZPRECHECK(expr.length(N_length) == N_length, | 
|---|
| 44 | "An expression with length " << expr.length(N_length) | 
|---|
| 45 | << " was assigned to a TinyVector<" | 
|---|
| 46 | << BZ_DEBUG_TEMPLATE_AS_STRING_LITERAL(T_numtype) | 
|---|
| 47 | << "," << N_length << ">"); | 
|---|
| 48 |  | 
|---|
| 49 | if (expr._bz_hasFastAccess()) | 
|---|
| 50 | { | 
|---|
| 51 | _bz_meta_vecAssign<N_length, 0>::fastAssign(*this, expr, up); | 
|---|
| 52 | } | 
|---|
| 53 | else { | 
|---|
| 54 | _bz_meta_vecAssign<N_length, 0>::assign(*this, expr, up); | 
|---|
| 55 | } | 
|---|
| 56 | } | 
|---|
| 57 |  | 
|---|
| 58 | /***************************************************************************** | 
|---|
| 59 | * Assignment operators with vector expression operand | 
|---|
| 60 | */ | 
|---|
| 61 |  | 
|---|
| 62 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 63 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 64 | TinyVector<P_numtype, N_length>::operator=(_bz_VecExpr<P_expr> expr) | 
|---|
| 65 | { | 
|---|
| 66 | _bz_assign(expr, _bz_update<P_numtype, _bz_typename P_expr::T_numtype>()); | 
|---|
| 67 | return *this; | 
|---|
| 68 | } | 
|---|
| 69 |  | 
|---|
| 70 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 71 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 72 | TinyVector<P_numtype, N_length>::operator+=(_bz_VecExpr<P_expr> expr) | 
|---|
| 73 | { | 
|---|
| 74 | _bz_assign(expr, _bz_plus_update<P_numtype, | 
|---|
| 75 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 76 | return *this; | 
|---|
| 77 | } | 
|---|
| 78 |  | 
|---|
| 79 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 80 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 81 | TinyVector<P_numtype, N_length>::operator-=(_bz_VecExpr<P_expr> expr) | 
|---|
| 82 | { | 
|---|
| 83 | _bz_assign(expr, _bz_minus_update<P_numtype, | 
|---|
| 84 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 85 | return *this; | 
|---|
| 86 | } | 
|---|
| 87 |  | 
|---|
| 88 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 89 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 90 | TinyVector<P_numtype, N_length>::operator*=(_bz_VecExpr<P_expr> expr) | 
|---|
| 91 | { | 
|---|
| 92 | _bz_assign(expr, _bz_multiply_update<P_numtype, | 
|---|
| 93 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 94 | return *this; | 
|---|
| 95 | } | 
|---|
| 96 |  | 
|---|
| 97 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 98 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 99 | TinyVector<P_numtype, N_length>::operator/=(_bz_VecExpr<P_expr> expr) | 
|---|
| 100 | { | 
|---|
| 101 | _bz_assign(expr, _bz_divide_update<P_numtype, | 
|---|
| 102 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 103 | return *this; | 
|---|
| 104 | } | 
|---|
| 105 |  | 
|---|
| 106 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 107 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 108 | TinyVector<P_numtype, N_length>::operator%=(_bz_VecExpr<P_expr> expr) | 
|---|
| 109 | { | 
|---|
| 110 | _bz_assign(expr, _bz_mod_update<P_numtype, | 
|---|
| 111 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 112 | return *this; | 
|---|
| 113 | } | 
|---|
| 114 |  | 
|---|
| 115 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 116 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 117 | TinyVector<P_numtype, N_length>::operator^=(_bz_VecExpr<P_expr> expr) | 
|---|
| 118 | { | 
|---|
| 119 | _bz_assign(expr, _bz_xor_update<P_numtype, | 
|---|
| 120 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 121 | return *this; | 
|---|
| 122 | } | 
|---|
| 123 |  | 
|---|
| 124 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 125 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 126 | TinyVector<P_numtype, N_length>::operator&=(_bz_VecExpr<P_expr> expr) | 
|---|
| 127 | { | 
|---|
| 128 | _bz_assign(expr, _bz_bitand_update<P_numtype, | 
|---|
| 129 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 130 | return *this; | 
|---|
| 131 | } | 
|---|
| 132 |  | 
|---|
| 133 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 134 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 135 | TinyVector<P_numtype, N_length>::operator|=(_bz_VecExpr<P_expr> expr) | 
|---|
| 136 | { | 
|---|
| 137 | _bz_assign(expr, _bz_bitor_update<P_numtype, | 
|---|
| 138 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 139 | return *this; | 
|---|
| 140 | } | 
|---|
| 141 |  | 
|---|
| 142 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 143 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 144 | TinyVector<P_numtype, N_length>::operator<<=(_bz_VecExpr<P_expr> expr) | 
|---|
| 145 | { | 
|---|
| 146 | _bz_assign(expr, _bz_shiftl_update<P_numtype, | 
|---|
| 147 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 148 | return *this; | 
|---|
| 149 | } | 
|---|
| 150 |  | 
|---|
| 151 | template<class P_numtype, int N_length> template<class P_expr> | 
|---|
| 152 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 153 | TinyVector<P_numtype, N_length>::operator>>=(_bz_VecExpr<P_expr> expr) | 
|---|
| 154 | { | 
|---|
| 155 | _bz_assign(expr, _bz_shiftr_update<P_numtype, | 
|---|
| 156 | _bz_typename P_expr::T_numtype>()); | 
|---|
| 157 | return *this; | 
|---|
| 158 | } | 
|---|
| 159 |  | 
|---|
| 160 | /***************************************************************************** | 
|---|
| 161 | * Assignment operators with scalar operand | 
|---|
| 162 | */ | 
|---|
| 163 |  | 
|---|
| 164 | template<class P_numtype, int N_length> | 
|---|
| 165 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 166 | TinyVector<P_numtype, N_length>::initialize(P_numtype x) | 
|---|
| 167 | { | 
|---|
| 168 | #ifndef BZ_KCC_COPY_PROPAGATION_KLUDGE | 
|---|
| 169 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 170 | (*this) = _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 171 | #else | 
|---|
| 172 | // Avoid using the copy propagation kludge for this simple | 
|---|
| 173 | // operation. | 
|---|
| 174 | for (int i=0; i < N_length; ++i) | 
|---|
| 175 | data_[i] = x; | 
|---|
| 176 | #endif | 
|---|
| 177 | return *this; | 
|---|
| 178 | } | 
|---|
| 179 |  | 
|---|
| 180 | template<class P_numtype, int N_length> | 
|---|
| 181 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 182 | TinyVector<P_numtype, N_length>::operator+=(P_numtype x) | 
|---|
| 183 | { | 
|---|
| 184 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 185 | (*this) += _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 186 | return *this; | 
|---|
| 187 | } | 
|---|
| 188 |  | 
|---|
| 189 | template<class P_numtype, int N_length> | 
|---|
| 190 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 191 | TinyVector<P_numtype, N_length>::operator-=(P_numtype x) | 
|---|
| 192 | { | 
|---|
| 193 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 194 | (*this) -= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 195 | return *this; | 
|---|
| 196 | } | 
|---|
| 197 |  | 
|---|
| 198 | template<class P_numtype, int N_length> | 
|---|
| 199 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 200 | TinyVector<P_numtype, N_length>::operator*=(P_numtype x) | 
|---|
| 201 | { | 
|---|
| 202 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 203 | (*this) *= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 204 | return *this; | 
|---|
| 205 | } | 
|---|
| 206 |  | 
|---|
| 207 | template<class P_numtype, int N_length> | 
|---|
| 208 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 209 | TinyVector<P_numtype, N_length>::operator/=(P_numtype x) | 
|---|
| 210 | { | 
|---|
| 211 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 212 | (*this) /= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 213 | return *this; | 
|---|
| 214 | } | 
|---|
| 215 |  | 
|---|
| 216 | template<class P_numtype, int N_length> | 
|---|
| 217 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 218 | TinyVector<P_numtype, N_length>::operator%=(P_numtype x) | 
|---|
| 219 | { | 
|---|
| 220 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 221 | (*this) %= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 222 | return *this; | 
|---|
| 223 | } | 
|---|
| 224 |  | 
|---|
| 225 | template<class P_numtype, int N_length> | 
|---|
| 226 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 227 | TinyVector<P_numtype, N_length>::operator^=(P_numtype x) | 
|---|
| 228 | { | 
|---|
| 229 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 230 | (*this) ^= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 231 | return *this; | 
|---|
| 232 | } | 
|---|
| 233 |  | 
|---|
| 234 | template<class P_numtype, int N_length> | 
|---|
| 235 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 236 | TinyVector<P_numtype, N_length>::operator&=(P_numtype x) | 
|---|
| 237 | { | 
|---|
| 238 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 239 | (*this) &= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 240 | return *this; | 
|---|
| 241 | } | 
|---|
| 242 |  | 
|---|
| 243 | template<class P_numtype, int N_length> | 
|---|
| 244 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 245 | TinyVector<P_numtype, N_length>::operator|=(P_numtype x) | 
|---|
| 246 | { | 
|---|
| 247 | typedef _bz_VecExprConstant<P_numtype> T_expr; | 
|---|
| 248 | (*this) |= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 249 | return *this; | 
|---|
| 250 | } | 
|---|
| 251 |  | 
|---|
| 252 | template<class P_numtype, int N_length> | 
|---|
| 253 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 254 | TinyVector<P_numtype, N_length>::operator<<=(int x) | 
|---|
| 255 | { | 
|---|
| 256 | typedef _bz_VecExprConstant<int> T_expr; | 
|---|
| 257 | (*this) <<= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 258 | return *this; | 
|---|
| 259 | } | 
|---|
| 260 |  | 
|---|
| 261 | template<class P_numtype, int N_length> | 
|---|
| 262 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 263 | TinyVector<P_numtype, N_length>::operator>>=(int x) | 
|---|
| 264 | { | 
|---|
| 265 | typedef _bz_VecExprConstant<int> T_expr; | 
|---|
| 266 | (*this) >>= _bz_VecExpr<T_expr>(T_expr(x)); | 
|---|
| 267 | return *this; | 
|---|
| 268 | } | 
|---|
| 269 |  | 
|---|
| 270 | /***************************************************************************** | 
|---|
| 271 | * Assignment operators with TinyVector operand | 
|---|
| 272 | */ | 
|---|
| 273 |  | 
|---|
| 274 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 275 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 276 | TinyVector<P_numtype, N_length>::operator=(const | 
|---|
| 277 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 278 | { | 
|---|
| 279 | (*this) = _bz_VecExpr<_bz_typename | 
|---|
| 280 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 281 | return *this; | 
|---|
| 282 | } | 
|---|
| 283 |  | 
|---|
| 284 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 285 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 286 | TinyVector<P_numtype, N_length>::operator+=(const | 
|---|
| 287 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 288 | { | 
|---|
| 289 | (*this) += _bz_VecExpr<_bz_typename | 
|---|
| 290 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 291 | return *this; | 
|---|
| 292 | } | 
|---|
| 293 |  | 
|---|
| 294 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 295 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 296 | TinyVector<P_numtype, N_length>::operator-=(const | 
|---|
| 297 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 298 | { | 
|---|
| 299 | (*this) -= _bz_VecExpr<_bz_typename | 
|---|
| 300 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 301 | return *this; | 
|---|
| 302 | } | 
|---|
| 303 |  | 
|---|
| 304 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 305 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 306 | TinyVector<P_numtype, N_length>::operator*=(const | 
|---|
| 307 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 308 | { | 
|---|
| 309 | (*this) *= _bz_VecExpr<_bz_typename | 
|---|
| 310 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 311 | return *this; | 
|---|
| 312 | } | 
|---|
| 313 |  | 
|---|
| 314 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 315 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 316 | TinyVector<P_numtype, N_length>::operator/=(const | 
|---|
| 317 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 318 | { | 
|---|
| 319 | (*this) /= _bz_VecExpr<_bz_typename | 
|---|
| 320 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 321 | return *this; | 
|---|
| 322 | } | 
|---|
| 323 |  | 
|---|
| 324 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 325 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 326 | TinyVector<P_numtype, N_length>::operator%=(const | 
|---|
| 327 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 328 | { | 
|---|
| 329 | (*this) %= _bz_VecExpr<_bz_typename | 
|---|
| 330 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 331 | return *this; | 
|---|
| 332 | } | 
|---|
| 333 |  | 
|---|
| 334 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 335 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 336 | TinyVector<P_numtype, N_length>::operator^=(const | 
|---|
| 337 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 338 | { | 
|---|
| 339 | (*this) ^= _bz_VecExpr<_bz_typename | 
|---|
| 340 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 341 | return *this; | 
|---|
| 342 | } | 
|---|
| 343 |  | 
|---|
| 344 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 345 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 346 | TinyVector<P_numtype, N_length>::operator&=(const | 
|---|
| 347 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 348 | { | 
|---|
| 349 | (*this) &= _bz_VecExpr<_bz_typename | 
|---|
| 350 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 351 | return *this; | 
|---|
| 352 | } | 
|---|
| 353 |  | 
|---|
| 354 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 355 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 356 | TinyVector<P_numtype, N_length>::operator|=(const | 
|---|
| 357 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 358 | { | 
|---|
| 359 | (*this) |= _bz_VecExpr<_bz_typename | 
|---|
| 360 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 361 | return *this; | 
|---|
| 362 | } | 
|---|
| 363 |  | 
|---|
| 364 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 365 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 366 | TinyVector<P_numtype, N_length>::operator<<=(const | 
|---|
| 367 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 368 | { | 
|---|
| 369 | (*this) <<= _bz_VecExpr<_bz_typename | 
|---|
| 370 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 371 | return *this; | 
|---|
| 372 | } | 
|---|
| 373 |  | 
|---|
| 374 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 375 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 376 | TinyVector<P_numtype, N_length>::operator>>=(const | 
|---|
| 377 | TinyVector<P_numtype2, N_length>& x) | 
|---|
| 378 | { | 
|---|
| 379 | (*this) >>= _bz_VecExpr<_bz_typename | 
|---|
| 380 | TinyVector<P_numtype2, N_length>::T_constIterator>(x.begin()); | 
|---|
| 381 | return *this; | 
|---|
| 382 | } | 
|---|
| 383 |  | 
|---|
| 384 | /***************************************************************************** | 
|---|
| 385 | * Assignment operators with Vector operand | 
|---|
| 386 | */ | 
|---|
| 387 |  | 
|---|
| 388 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 389 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 390 | TinyVector<P_numtype, N_length>::operator=(const Vector<P_numtype2>& x) | 
|---|
| 391 | { | 
|---|
| 392 | (*this) = x._bz_asVecExpr(); | 
|---|
| 393 | return *this; | 
|---|
| 394 | } | 
|---|
| 395 |  | 
|---|
| 396 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 397 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 398 | TinyVector<P_numtype, N_length>::operator+=(const Vector<P_numtype2>& x) | 
|---|
| 399 | { | 
|---|
| 400 | (*this) += x._bz_asVecExpr(); | 
|---|
| 401 | return *this; | 
|---|
| 402 | } | 
|---|
| 403 |  | 
|---|
| 404 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 405 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 406 | TinyVector<P_numtype, N_length>::operator-=(const Vector<P_numtype2>& x) | 
|---|
| 407 | { | 
|---|
| 408 | (*this) -= x._bz_asVecExpr(); | 
|---|
| 409 | return *this; | 
|---|
| 410 | } | 
|---|
| 411 |  | 
|---|
| 412 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 413 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 414 | TinyVector<P_numtype, N_length>::operator*=(const Vector<P_numtype2>& x) | 
|---|
| 415 | { | 
|---|
| 416 | (*this) *= x._bz_asVecExpr(); | 
|---|
| 417 | return *this; | 
|---|
| 418 | } | 
|---|
| 419 |  | 
|---|
| 420 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 421 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 422 | TinyVector<P_numtype, N_length>::operator/=(const Vector<P_numtype2>& x) | 
|---|
| 423 | { | 
|---|
| 424 | (*this) /= x._bz_asVecExpr(); | 
|---|
| 425 | return *this; | 
|---|
| 426 | } | 
|---|
| 427 |  | 
|---|
| 428 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 429 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 430 | TinyVector<P_numtype, N_length>::operator%=(const Vector<P_numtype2>& x) | 
|---|
| 431 | { | 
|---|
| 432 | (*this) %= x._bz_asVecExpr(); | 
|---|
| 433 | return *this; | 
|---|
| 434 | } | 
|---|
| 435 |  | 
|---|
| 436 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 437 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 438 | TinyVector<P_numtype, N_length>::operator^=(const Vector<P_numtype2>& x) | 
|---|
| 439 | { | 
|---|
| 440 | (*this) ^= x._bz_asVecExpr(); | 
|---|
| 441 | return *this; | 
|---|
| 442 | } | 
|---|
| 443 |  | 
|---|
| 444 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 445 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 446 | TinyVector<P_numtype, N_length>::operator&=(const Vector<P_numtype2>& x) | 
|---|
| 447 | { | 
|---|
| 448 | (*this) &= x._bz_asVecExpr(); | 
|---|
| 449 | return *this; | 
|---|
| 450 | } | 
|---|
| 451 |  | 
|---|
| 452 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 453 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 454 | TinyVector<P_numtype, N_length>::operator|=(const Vector<P_numtype2>& x) | 
|---|
| 455 | { | 
|---|
| 456 | (*this) |= x._bz_asVecExpr(); | 
|---|
| 457 | return *this; | 
|---|
| 458 | } | 
|---|
| 459 |  | 
|---|
| 460 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 461 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 462 | TinyVector<P_numtype, N_length>::operator<<=(const Vector<P_numtype2>& x) | 
|---|
| 463 | { | 
|---|
| 464 | (*this) <<= x._bz_asVecExpr(); | 
|---|
| 465 | return *this; | 
|---|
| 466 | } | 
|---|
| 467 |  | 
|---|
| 468 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 469 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 470 | TinyVector<P_numtype, N_length>::operator>>=(const Vector<P_numtype2>& x) | 
|---|
| 471 | { | 
|---|
| 472 | (*this) >>= x._bz_asVecExpr(); | 
|---|
| 473 | return *this; | 
|---|
| 474 | } | 
|---|
| 475 |  | 
|---|
| 476 | /***************************************************************************** | 
|---|
| 477 | * Assignment operators with Range operand | 
|---|
| 478 | */ | 
|---|
| 479 |  | 
|---|
| 480 | template<class P_numtype, int N_length> | 
|---|
| 481 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 482 | TinyVector<P_numtype, N_length>::operator=(Range r) | 
|---|
| 483 | { | 
|---|
| 484 | (*this) = r._bz_asVecExpr(); | 
|---|
| 485 | return *this; | 
|---|
| 486 | } | 
|---|
| 487 |  | 
|---|
| 488 | template<class P_numtype, int N_length> | 
|---|
| 489 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 490 | TinyVector<P_numtype, N_length>::operator+=(Range r) | 
|---|
| 491 | { | 
|---|
| 492 | (*this) += r._bz_asVecExpr(); | 
|---|
| 493 | return *this; | 
|---|
| 494 | } | 
|---|
| 495 |  | 
|---|
| 496 | template<class P_numtype, int N_length> | 
|---|
| 497 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 498 | TinyVector<P_numtype, N_length>::operator-=(Range r) | 
|---|
| 499 | { | 
|---|
| 500 | (*this) -= r._bz_asVecExpr(); | 
|---|
| 501 | return *this; | 
|---|
| 502 | } | 
|---|
| 503 |  | 
|---|
| 504 | template<class P_numtype, int N_length> | 
|---|
| 505 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 506 | TinyVector<P_numtype, N_length>::operator*=(Range r) | 
|---|
| 507 | { | 
|---|
| 508 | (*this) *= r._bz_asVecExpr(); | 
|---|
| 509 | return *this; | 
|---|
| 510 | } | 
|---|
| 511 |  | 
|---|
| 512 | template<class P_numtype, int N_length> | 
|---|
| 513 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 514 | TinyVector<P_numtype, N_length>::operator/=(Range r) | 
|---|
| 515 | { | 
|---|
| 516 | (*this) /= r._bz_asVecExpr(); | 
|---|
| 517 | return *this; | 
|---|
| 518 | } | 
|---|
| 519 |  | 
|---|
| 520 | template<class P_numtype, int N_length> | 
|---|
| 521 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 522 | TinyVector<P_numtype, N_length>::operator%=(Range r) | 
|---|
| 523 | { | 
|---|
| 524 | (*this) %= r._bz_asVecExpr(); | 
|---|
| 525 | return *this; | 
|---|
| 526 | } | 
|---|
| 527 |  | 
|---|
| 528 | template<class P_numtype, int N_length> | 
|---|
| 529 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 530 | TinyVector<P_numtype, N_length>::operator^=(Range r) | 
|---|
| 531 | { | 
|---|
| 532 | (*this) ^= r._bz_asVecExpr(); | 
|---|
| 533 | return *this; | 
|---|
| 534 | } | 
|---|
| 535 |  | 
|---|
| 536 | template<class P_numtype, int N_length> | 
|---|
| 537 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 538 | TinyVector<P_numtype, N_length>::operator&=(Range r) | 
|---|
| 539 | { | 
|---|
| 540 | (*this) &= r._bz_asVecExpr(); | 
|---|
| 541 | return *this; | 
|---|
| 542 | } | 
|---|
| 543 |  | 
|---|
| 544 | template<class P_numtype, int N_length> | 
|---|
| 545 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 546 | TinyVector<P_numtype, N_length>::operator|=(Range r) | 
|---|
| 547 | { | 
|---|
| 548 | (*this) |= r._bz_asVecExpr(); | 
|---|
| 549 | return *this; | 
|---|
| 550 | } | 
|---|
| 551 |  | 
|---|
| 552 | template<class P_numtype, int N_length> | 
|---|
| 553 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 554 | TinyVector<P_numtype, N_length>::operator<<=(Range r) | 
|---|
| 555 | { | 
|---|
| 556 | (*this) <<= r._bz_asVecExpr(); | 
|---|
| 557 | return *this; | 
|---|
| 558 | } | 
|---|
| 559 |  | 
|---|
| 560 | template<class P_numtype, int N_length> | 
|---|
| 561 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 562 | TinyVector<P_numtype, N_length>::operator>>=(Range r) | 
|---|
| 563 | { | 
|---|
| 564 | (*this) >>= r._bz_asVecExpr(); | 
|---|
| 565 | return *this; | 
|---|
| 566 | } | 
|---|
| 567 |  | 
|---|
| 568 | /***************************************************************************** | 
|---|
| 569 | * Assignment operators with VectorPick operand | 
|---|
| 570 | */ | 
|---|
| 571 |  | 
|---|
| 572 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 573 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 574 | TinyVector<P_numtype, N_length>::operator=(const VectorPick<P_numtype2>& x) | 
|---|
| 575 | { | 
|---|
| 576 | (*this) = x._bz_asVecExpr(); | 
|---|
| 577 | return *this; | 
|---|
| 578 | } | 
|---|
| 579 |  | 
|---|
| 580 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 581 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 582 | TinyVector<P_numtype, N_length>::operator+=(const VectorPick<P_numtype2>& x) | 
|---|
| 583 | { | 
|---|
| 584 | (*this) += x._bz_asVecExpr(); | 
|---|
| 585 | return *this; | 
|---|
| 586 | } | 
|---|
| 587 |  | 
|---|
| 588 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 589 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 590 | TinyVector<P_numtype, N_length>::operator-=(const VectorPick<P_numtype2>& x) | 
|---|
| 591 | { | 
|---|
| 592 | (*this) -= x._bz_asVecExpr(); | 
|---|
| 593 | return *this; | 
|---|
| 594 | } | 
|---|
| 595 |  | 
|---|
| 596 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 597 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 598 | TinyVector<P_numtype, N_length>::operator*=(const VectorPick<P_numtype2>& x) | 
|---|
| 599 | { | 
|---|
| 600 | (*this) *= x._bz_asVecExpr(); | 
|---|
| 601 | return *this; | 
|---|
| 602 | } | 
|---|
| 603 |  | 
|---|
| 604 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 605 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 606 | TinyVector<P_numtype, N_length>::operator/=(const VectorPick<P_numtype2>& x) | 
|---|
| 607 | { | 
|---|
| 608 | (*this) /= x._bz_asVecExpr(); | 
|---|
| 609 | return *this; | 
|---|
| 610 | } | 
|---|
| 611 |  | 
|---|
| 612 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 613 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 614 | TinyVector<P_numtype, N_length>::operator%=(const VectorPick<P_numtype2>& x) | 
|---|
| 615 | { | 
|---|
| 616 | (*this) %= x._bz_asVecExpr(); | 
|---|
| 617 | return *this; | 
|---|
| 618 | } | 
|---|
| 619 |  | 
|---|
| 620 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 621 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 622 | TinyVector<P_numtype, N_length>::operator^=(const VectorPick<P_numtype2>& x) | 
|---|
| 623 | { | 
|---|
| 624 | (*this) ^= x._bz_asVecExpr(); | 
|---|
| 625 | return *this; | 
|---|
| 626 | } | 
|---|
| 627 |  | 
|---|
| 628 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 629 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 630 | TinyVector<P_numtype, N_length>::operator&=(const VectorPick<P_numtype2>& x) | 
|---|
| 631 | { | 
|---|
| 632 | (*this) &= x._bz_asVecExpr(); | 
|---|
| 633 | return *this; | 
|---|
| 634 | } | 
|---|
| 635 |  | 
|---|
| 636 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 637 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 638 | TinyVector<P_numtype, N_length>::operator|=(const VectorPick<P_numtype2>& x) | 
|---|
| 639 | { | 
|---|
| 640 | (*this) |= x._bz_asVecExpr(); | 
|---|
| 641 | return *this; | 
|---|
| 642 | } | 
|---|
| 643 |  | 
|---|
| 644 | template<class P_numtype, int N_length> template<class P_numtype2> | 
|---|
| 645 | inline TinyVector<P_numtype, N_length>& | 
|---|
| 646 | TinyVector<P_numtype, N_length>::operator>>=(const VectorPick<P_numtype2>& x) | 
|---|
| 647 | { | 
|---|
| 648 | (*this) <<= x._bz_asVecExpr(); | 
|---|
| 649 | return *this; | 
|---|
| 650 | } | 
|---|
| 651 |  | 
|---|
| 652 | BZ_NAMESPACE_END | 
|---|
| 653 |  | 
|---|
| 654 | #endif // BZ_TINYVEC_CC | 
|---|