/** \file Static Matrix and Vector operations \author Darko Veberic \version $Id$ \date 12 Jun 2008 */ #ifndef _utl_SMatrixSVector_h_ #define _utl_SMatrixSVector_h_ #include #include #include namespace boost { namespace lambda { /// specialization for SMatrix<> * SVector<> template class plain_return_type_2< arithmetic_action, utl::SMatrix, utl::SVector > { private: // delegate to the type of T * U typedef typename return_type_2< arithmetic_action, T, U >::type res_type; public: typedef utl::SVector type; }; } } namespace utl { template inline typename boost::lambda::return_type_2< boost::lambda::arithmetic_action, utl::SMatrix, utl::SVector >::type operator*(const SMatrix& a, const SVector& x) { typedef typename boost::lambda::return_type_2< boost::lambda::arithmetic_action, utl::SMatrix, utl::SVector >::type VectorResultType; VectorResultType y; for (unsigned int i = 0; i < n; ++i) { y[i] = a[i][0] * x[0]; for (unsigned int j = 1; j < m; ++j) y[i] += a[i][j] * x[j]; } return y; } template Stream& operator<<(Stream& s, const SMatrix& a) { const SVector > v(a); return s << v; } } #endif