/*************************************************************************** * blitz/tinyvec.cc Declaration of TinyVector methods * * $Id$ * * Copyright (C) 1997-2011 Todd Veldhuizen * * This file is a part of Blitz. * * Blitz is free software: you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License * as published by the Free Software Foundation, either version 3 * of the License, or (at your option) any later version. * * Blitz is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Lesser General Public License for more details. * * You should have received a copy of the GNU Lesser General Public * License along with Blitz. If not, see . * * Suggestions: blitz-devel@lists.sourceforge.net * Bugs: blitz-support@lists.sourceforge.net * * For more information, please see the Blitz++ Home Page: * https://sourceforge.net/projects/blitz/ * ***************************************************************************/ #ifndef BZ_TINYVEC2_CC #define BZ_TINYVEC2_CC #include #include #include #include BZ_NAMESPACE(blitz) /* * Constructors */ template _bz_forceinline TinyVector::TinyVector(const T_numtype initValue) { for (int i=0; i < N_length; ++i) data_[i] = initValue; } template _bz_forceinline TinyVector::TinyVector(const TinyVector& x) { for (int i=0; i < N_length; ++i) data_[i] = x.data_[i]; } template template _bz_forceinline TinyVector::TinyVector(const TinyVector& x) { for (int i=0; i < N_length; ++i) data_[i] = static_cast(x[i]); } /* * Assignment-type operators */ template _bz_forceinline TinyVector& TinyVector::initialize(T_numtype x) { (*this) = _bz_ArrayExpr<_bz_ArrayExprConstant >(x); return *this; } template template _bz_forceinline TinyVector& TinyVector::operator=(const ETBase& expr) { _tv_evaluate(_bz_typename asExpr::T_expr(expr.unwrap()), _bz_update< T_numtype, _bz_typename asExpr::T_expr::T_result>()); return *this; } #define BZ_TV2_UPDATE(op,name) \ template \ template \ _bz_forceinline \ TinyVector& \ TinyVector::operator op(const T& expr) \ { \ _tv_evaluate(_bz_typename asExpr::T_expr(expr), \ name::T_expr::T_result>()); \ return *this; \ } BZ_TV2_UPDATE(+=, _bz_plus_update) BZ_TV2_UPDATE(-=, _bz_minus_update) BZ_TV2_UPDATE(*=, _bz_multiply_update) BZ_TV2_UPDATE(/=, _bz_divide_update) BZ_TV2_UPDATE(%=, _bz_mod_update) BZ_TV2_UPDATE(^=, _bz_xor_update) BZ_TV2_UPDATE(&=, _bz_bitand_update) BZ_TV2_UPDATE(|=, _bz_bitor_update) BZ_TV2_UPDATE(<<=, _bz_shiftl_update) BZ_TV2_UPDATE(>>=, _bz_shiftr_update) /* * Other member functions */ template template _bz_forceinline _bz_ArrayExpr >::T_expr, N0> > TinyVector::operator()(IndexPlaceholder) const { return _bz_ArrayExpr::T_expr, N0> > (noConst()); } BZ_NAMESPACE_END #include // Iterators //#include unused now? #include #endif // BZ_TINYVEC_CC