SMatrixSVectorOp.h
Go to the documentation of this file.
1 
9 #ifndef _utl_SMatrixSVector_h_
10 #define _utl_SMatrixSVector_h_
11 
12 #include <boost/lambda/lambda.hpp>
13 
14 #include <utl/SVector.h>
15 #include <utl/SMatrix.h>
16 
17 
18 namespace boost {
19 
20  namespace lambda {
21 
23  template<unsigned int n, unsigned int m, typename T, typename U>
24  class plain_return_type_2<
25  arithmetic_action<multiply_action>,
26  utl::SMatrix<n, m, T>,
27  utl::SVector<m, U>
28  > {
29  private:
30  // delegate to the type of T * U
31  typedef typename
32  return_type_2<
33  arithmetic_action<multiply_action>,
34  T,
35  U
37 
38  public:
40  };
41 
42  }
43 
44 }
45 
46 
47 namespace utl {
48 
49  template<unsigned int n, unsigned int m, typename T, typename U>
50  inline
51  typename boost::lambda::return_type_2<
52  boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
55  >::type
57  {
58  typedef typename boost::lambda::return_type_2<
59  boost::lambda::arithmetic_action<boost::lambda::multiply_action>,
62  >::type VectorResultType;
63 
64  VectorResultType y;
65 
66  for (unsigned int i = 0; i < n; ++i) {
67  y[i] = a[i][0] * x[0];
68  for (unsigned int j = 1; j < m; ++j)
69  y[i] += a[i][j] * x[j];
70  }
71 
72  return y;
73  }
74 
75 
76  template<class Stream, unsigned int n, unsigned int m, typename T>
77  Stream&
78  operator<<(Stream& s, const SMatrix<n, m, T>& a)
79  {
80  const SVector<n, SVector<m, T> > v(a);
81 
82  return s << v;
83  }
84 
85 }
86 
87 
88 #endif
#define U
constexpr double s
Definition: AugerUnits.h:163
Static (small and dense) vector class.
Definition: SVector.h:33
Vector operator*(const double d, const Vector &v)
Definition: OperationsVV.h:38
constexpr double m
Definition: AugerUnits.h:121
Static (small and dense) matrix class.
Definition: SMatrix.h:23

, generated on Tue Sep 26 2023.