FEDRA emulsion software from the OPERA Collaboration
UnaryOperators.hh
Go to the documentation of this file.
1 #ifndef __UNARYOPERATORS_HH
2 #define __UNARYOPERATORS_HH
3 //======================================================
4 //
5 // ATTENTION: This file was automatically generated,
6 // do not edit!
7 //
8 // author: Thorsten Glebe
9 // HERA-B Collaboration
10 // Max-Planck-Institut fuer Kernphysik
11 // Saupfercheckweg 1
12 // 69117 Heidelberg
13 // Germany
14 // E-mail: T.Glebe@mpi-hd.mpg.de
15 //
16 //======================================================
17 
18 template <class T, unsigned int D> class SVector;
19 template <class T, unsigned int D1, unsigned int D2> class SMatrix;
20 
21 
22 //==============================================================================
23 // Minus
24 //==============================================================================
25 template <class T>
26 class Minus {
27 public:
28  static inline T apply(const T& rhs) {
29  return -(rhs);
30  }
31 };
32 
33 //==============================================================================
34 // operator- (Expr, unary)
35 //==============================================================================
36 template <class A, class T, unsigned int D>
37 inline Expr<UnaryOp<Minus<T>, Expr<A,T,D>, T>, T, D>
38  operator-(const Expr<A,T,D>& rhs) {
39  typedef UnaryOp<Minus<T>, Expr<A,T,D>, T> MinusUnaryOp;
40 
41  return Expr<MinusUnaryOp,T,D>(MinusUnaryOp(Minus<T>(),rhs));
42 }
43 
44 
45 //==============================================================================
46 // operator- (SVector, unary)
47 //==============================================================================
48 template <class T, unsigned int D>
49 inline Expr<UnaryOp<Minus<T>, SVector<T,D>, T>, T, D>
50  operator-(const SVector<T,D>& rhs) {
51  typedef UnaryOp<Minus<T>, SVector<T,D>, T> MinusUnaryOp;
52 
53  return Expr<MinusUnaryOp,T,D>(MinusUnaryOp(Minus<T>(),rhs));
54 }
55 
56 //==============================================================================
57 // operator- (MatrixExpr, unary)
58 //==============================================================================
59 template <class A, class T, unsigned int D, unsigned int D2>
60 inline Expr<UnaryOp<Minus<T>, Expr<A,T,D,D2>, T>, T, D, D2>
61  operator-(const Expr<A,T,D,D2>& rhs) {
62  typedef UnaryOp<Minus<T>, Expr<A,T,D,D2>, T> MinusUnaryOp;
63 
64  return Expr<MinusUnaryOp,T,D,D2>(MinusUnaryOp(Minus<T>(),rhs));
65 }
66 
67 
68 //==============================================================================
69 // operator- (SMatrix, unary)
70 //==============================================================================
71 template <class T, unsigned int D, unsigned int D2>
72 inline Expr<UnaryOp<Minus<T>, SMatrix<T,D,D2>, T>, T, D, D2>
73  operator-(const SMatrix<T,D,D2>& rhs) {
74  typedef UnaryOp<Minus<T>, SMatrix<T,D,D2>, T> MinusUnaryOp;
75 
76  return Expr<MinusUnaryOp,T,D,D2>(MinusUnaryOp(Minus<T>(),rhs));
77 }
78 
79 
80 //==============================================================================
81 // Fabs
82 //==============================================================================
83 template <class T>
84 class Fabs {
85 public:
86  static inline T apply(const T& rhs) {
87  return fabs(rhs);
88  }
89 };
90 
91 //==============================================================================
92 // fabs (Expr, unary)
93 //==============================================================================
94 template <class A, class T, unsigned int D>
95 inline Expr<UnaryOp<Fabs<T>, Expr<A,T,D>, T>, T, D>
96  fabs(const Expr<A,T,D>& rhs) {
97  typedef UnaryOp<Fabs<T>, Expr<A,T,D>, T> FabsUnaryOp;
98 
99  return Expr<FabsUnaryOp,T,D>(FabsUnaryOp(Fabs<T>(),rhs));
100 }
101 
102 
103 //==============================================================================
104 // fabs (SVector, unary)
105 //==============================================================================
106 template <class T, unsigned int D>
107 inline Expr<UnaryOp<Fabs<T>, SVector<T,D>, T>, T, D>
108  fabs(const SVector<T,D>& rhs) {
109  typedef UnaryOp<Fabs<T>, SVector<T,D>, T> FabsUnaryOp;
110 
111  return Expr<FabsUnaryOp,T,D>(FabsUnaryOp(Fabs<T>(),rhs));
112 }
113 
114 //==============================================================================
115 // fabs (MatrixExpr, unary)
116 //==============================================================================
117 template <class A, class T, unsigned int D, unsigned int D2>
118 inline Expr<UnaryOp<Fabs<T>, Expr<A,T,D,D2>, T>, T, D, D2>
119  fabs(const Expr<A,T,D,D2>& rhs) {
120  typedef UnaryOp<Fabs<T>, Expr<A,T,D,D2>, T> FabsUnaryOp;
121 
122  return Expr<FabsUnaryOp,T,D,D2>(FabsUnaryOp(Fabs<T>(),rhs));
123 }
124 
125 
126 //==============================================================================
127 // fabs (SMatrix, unary)
128 //==============================================================================
129 template <class T, unsigned int D, unsigned int D2>
130 inline Expr<UnaryOp<Fabs<T>, SMatrix<T,D,D2>, T>, T, D, D2>
131  fabs(const SMatrix<T,D,D2>& rhs) {
132  typedef UnaryOp<Fabs<T>, SMatrix<T,D,D2>, T> FabsUnaryOp;
133 
134  return Expr<FabsUnaryOp,T,D,D2>(FabsUnaryOp(Fabs<T>(),rhs));
135 }
136 
137 
138 //==============================================================================
139 // Sqr
140 //==============================================================================
141 template <class T>
142 class Sqr {
143 public:
144  static inline T apply(const T& rhs) {
145  return square(rhs);
146  }
147 };
148 
149 //==============================================================================
150 // sqr (Expr, unary)
151 //==============================================================================
152 template <class A, class T, unsigned int D>
153 inline Expr<UnaryOp<Sqr<T>, Expr<A,T,D>, T>, T, D>
154  sqr(const Expr<A,T,D>& rhs) {
155  typedef UnaryOp<Sqr<T>, Expr<A,T,D>, T> SqrUnaryOp;
156 
157  return Expr<SqrUnaryOp,T,D>(SqrUnaryOp(Sqr<T>(),rhs));
158 }
159 
160 
161 //==============================================================================
162 // sqr (SVector, unary)
163 //==============================================================================
164 template <class T, unsigned int D>
165 inline Expr<UnaryOp<Sqr<T>, SVector<T,D>, T>, T, D>
166  sqr(const SVector<T,D>& rhs) {
167  typedef UnaryOp<Sqr<T>, SVector<T,D>, T> SqrUnaryOp;
168 
169  return Expr<SqrUnaryOp,T,D>(SqrUnaryOp(Sqr<T>(),rhs));
170 }
171 
172 //==============================================================================
173 // sqr (MatrixExpr, unary)
174 //==============================================================================
175 template <class A, class T, unsigned int D, unsigned int D2>
176 inline Expr<UnaryOp<Sqr<T>, Expr<A,T,D,D2>, T>, T, D, D2>
177  sqr(const Expr<A,T,D,D2>& rhs) {
178  typedef UnaryOp<Sqr<T>, Expr<A,T,D,D2>, T> SqrUnaryOp;
179 
180  return Expr<SqrUnaryOp,T,D,D2>(SqrUnaryOp(Sqr<T>(),rhs));
181 }
182 
183 
184 //==============================================================================
185 // sqr (SMatrix, unary)
186 //==============================================================================
187 template <class T, unsigned int D, unsigned int D2>
188 inline Expr<UnaryOp<Sqr<T>, SMatrix<T,D,D2>, T>, T, D, D2>
189  sqr(const SMatrix<T,D,D2>& rhs) {
190  typedef UnaryOp<Sqr<T>, SMatrix<T,D,D2>, T> SqrUnaryOp;
191 
192  return Expr<SqrUnaryOp,T,D,D2>(SqrUnaryOp(Sqr<T>(),rhs));
193 }
194 
195 #endif
const T square(const T &x)
Definition: Functions.hh:46
Expr< UnaryOp< Fabs< T >, Expr< A, T, D >, T >, T, D > fabs(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:96
Expr< UnaryOp< Minus< T >, Expr< A, T, D >, T >, T, D > operator-(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:38
Expr< UnaryOp< Sqr< T >, Expr< A, T, D >, T >, T, D > sqr(const Expr< A, T, D > &rhs)
Definition: UnaryOperators.hh:154
Definition: Expression.hh:43
Definition: UnaryOperators.hh:84
static T apply(const T &rhs)
Definition: UnaryOperators.hh:86
Definition: UnaryOperators.hh:26
static T apply(const T &rhs)
Definition: UnaryOperators.hh:28
Definition: SMatrix.hh:53
Definition: SVector.hh:51
Definition: UnaryOperators.hh:142
static T apply(const T &rhs)
Definition: UnaryOperators.hh:144
Definition: Expression.hh:143