/usr/include/blitz/tinymat2.cc is in libblitz0-dev 1:0.10-3.3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | /***************************************************************************
* blitz/tinyvec.cc Declaration of TinyVector methods
*
* $Id$
*
* Copyright (C) 1997-2011 Todd Veldhuizen <tveldhui@acm.org>
*
* 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 <http://www.gnu.org/licenses/>.
*
* 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_TINYMAT2_CC
#define BZ_TINYMAT2_CC
#include <blitz/tmevaluate.h>
#include <blitz/tinymat2io.cc>
#include <blitz/array/domain.h>
BZ_NAMESPACE(blitz)
template<typename P_numtype, int N_rows, int N_columns>
inline TinyMatrix<P_numtype, N_rows, N_columns>::TinyMatrix(T_numtype initValue)
{
for (sizeType i=0; i < numElements(); ++i)
data_[i] = initValue;
}
template<typename P_numtype, int N_rows, int N_columns>
inline TinyMatrix<P_numtype, N_rows, N_columns>::TinyMatrix(const T_matrix& x)
{
for (sizeType i=0; i < numElements(); ++i)
data_[i] = x.data_[i];
}
template<typename P_numtype, int N_rows, int N_columns>
template<typename P_numtype2>
inline
TinyMatrix<P_numtype, N_rows, N_columns>::TinyMatrix(const TinyMatrix<P_numtype2, N_rows, N_columns>& x)
{
for (sizeType i=0; i < numElements(); ++i)
data_[i] = static_cast<P_numtype>(x.data_[i]);
}
/*
* Assignment-type operators
*/
template<typename P_numtype, int N_rows, int N_columns>
TinyMatrix<P_numtype, N_rows, N_columns>&
TinyMatrix<P_numtype, N_rows, N_columns>::initialize(T_numtype x)
{
(*this) = _bz_ArrayExpr<_bz_ArrayExprConstant<T_numtype> >(x);
return *this;
}
template<typename P_numtype, int N_rows, int N_columns>
template<typename T_expr>
inline
TinyMatrix<P_numtype, N_rows, N_columns>&
TinyMatrix<P_numtype, N_rows, N_columns>::operator=(const ETBase<T_expr>& expr)
{
_tm_evaluate(_bz_typename asExpr<T_expr>::T_expr(expr.unwrap()),
_bz_update<T_numtype, _bz_typename asExpr<T_expr>::T_expr::T_result>());
return *this;
}
#define BZ_TM2_UPDATE(op,name) \
template<typename P_numtype, int N_rows, int N_columns> \
template<typename T> \
inline TinyMatrix<P_numtype, N_rows, N_columns>& \
TinyMatrix<P_numtype, N_rows, N_columns>::operator op(const T& expr) \
{ \
_tm_evaluate(_bz_typename asExpr<T>::T_expr(expr), \
name<T_numtype, _bz_typename asExpr<T>::T_expr::T_result>()); \
return *this; \
}
BZ_TM2_UPDATE(+=, _bz_plus_update)
BZ_TM2_UPDATE(-=, _bz_minus_update)
BZ_TM2_UPDATE(*=, _bz_multiply_update)
BZ_TM2_UPDATE(/=, _bz_divide_update)
BZ_TM2_UPDATE(%=, _bz_mod_update)
BZ_TM2_UPDATE(^=, _bz_xor_update)
BZ_TM2_UPDATE(&=, _bz_bitand_update)
BZ_TM2_UPDATE(|=, _bz_bitor_update)
BZ_TM2_UPDATE(<<=, _bz_shiftl_update)
BZ_TM2_UPDATE(>>=, _bz_shiftr_update)
/*
* Other member functions
*/
template<typename P_numtype, int N_rows, int N_columns>
inline RectDomain<2>
TinyMatrix<P_numtype, N_rows, N_columns>::domain()
{
return RectDomain<2>(lbound(), ubound());
}
template<typename P_numtype, int N_rows, int N_columns>
template<int N0, int N1>
inline _bz_ArrayExpr<ArrayIndexMapping<typename asExpr<TinyMatrix<P_numtype, N_rows, N_columns> >::T_expr, N0, N1> >
TinyMatrix<P_numtype, N_rows, N_columns>::operator()(IndexPlaceholder<N0>, IndexPlaceholder<N1>) const
{
return _bz_ArrayExpr<ArrayIndexMapping<typename asExpr<T_matrix>::T_expr,
N0, N1> >(noConst());
}
BZ_NAMESPACE_END
#endif // BZ_TINYVEC_CC
|