FEDRA emulsion software from the OPERA Collaboration
BinaryOperators.hh
Go to the documentation of this file.
1 #ifndef __BINARYOPERATORS_HH
2 #define __BINARYOPERATORS_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 // AddOp
24 //==============================================================================
25 template <class T>
26 class AddOp {
27 public:
28  static inline T apply(const T& lhs, const T& rhs) {
29  return lhs + rhs;
30  }
31 };
32 
33 
34 //==============================================================================
35 // operator+ (SVector, binary)
36 //==============================================================================
37 template < class T, unsigned int D>
39  operator+(const SVector<T,D>& lhs, const SVector<T,D>& rhs) {
40  typedef BinaryOp<AddOp<T>, SVector<T,D>, SVector<T,D>, T> AddOpBinOp;
41 
42  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,rhs));
43 }
44 
45 
46 //==============================================================================
47 // operator+ (SVector, binary)
48 //==============================================================================
49 template <class A, class T, unsigned int D>
51  operator+(const Expr<A,T,D>& lhs, const SVector<T,D>& rhs) {
52  typedef BinaryOp<AddOp<T>, Expr<A,T,D>, SVector<T,D>, T> AddOpBinOp;
53 
54  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,rhs));
55 }
56 
57 
58 //==============================================================================
59 // operator+ (SVector, binary)
60 //==============================================================================
61 template < class A, class T, unsigned int D>
63  operator+(const SVector<T,D>& lhs, const Expr<A,T,D>& rhs) {
64  typedef BinaryOp<AddOp<T>, SVector<T,D>, Expr<A,T,D>, T> AddOpBinOp;
65 
66  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,rhs));
67 }
68 
69 
70 //==============================================================================
71 // operator+ (SVector, binary)
72 //==============================================================================
73 template <class A, class B, class T, unsigned int D>
75  operator+(const Expr<A,T,D>& lhs, const Expr<B,T,D>& rhs) {
76  typedef BinaryOp<AddOp<T>, Expr<A,T,D>, Expr<B,T,D>, T> AddOpBinOp;
77 
78  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,rhs));
79 }
80 
81 
82 //==============================================================================
83 // operator+ (SVector, binary, Constant)
84 //==============================================================================
85 template <class A, class T, unsigned int D>
87  operator+(const SVector<T,D>& lhs, const A& rhs) {
88  typedef BinaryOp<AddOp<T>, SVector<T,D>, Constant<A>, T> AddOpBinOp;
89 
90  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,Constant<A>(rhs)));
91 }
92 
93 //==============================================================================
94 // operator+ (SVector, binary, Constant)
95 //==============================================================================
96 template <class A, class T, unsigned int D>
98  operator+(const A& lhs, const SVector<T,D>& rhs) {
99  typedef BinaryOp<AddOp<T>, Constant<A>, SVector<T,D>, T> AddOpBinOp;
100 
101  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),Constant<A>(lhs),rhs));
102 }
103 
104 
105 //==============================================================================
106 // operator+ (SVector, binary, Constant)
107 //==============================================================================
108 template <class A, class B, class T, unsigned int D>
110  operator+(const Expr<B,T,D>& lhs, const A& rhs) {
111  typedef BinaryOp<AddOp<T>, Expr<B,T,D>, Constant<A>, T> AddOpBinOp;
112 
113  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),lhs,Constant<A>(rhs)));
114 }
115 
116 //==============================================================================
117 // operator+ (SVector, binary, Constant)
118 //==============================================================================
119 template <class A, class B, class T, unsigned int D>
121  operator+(const A& lhs, const Expr<B,T,D>& rhs) {
122  typedef BinaryOp<AddOp<T>, Constant<A>, Expr<B,T,D>, T> AddOpBinOp;
123 
124  return Expr<AddOpBinOp,T,D>(AddOpBinOp(AddOp<T>(),Constant<A>(lhs),rhs));
125 }
126 
127 
128 //==============================================================================
129 // operator+ (SMatrix, binary)
130 //==============================================================================
131 template < class T, unsigned int D, unsigned int D2>
133  operator+(const SMatrix<T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
134  typedef BinaryOp<AddOp<T>, SMatrix<T,D,D2>, SMatrix<T,D,D2>, T> AddOpBinOp;
135 
136  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,rhs));
137 }
138 
139 
140 //==============================================================================
141 // operator+ (SMatrix, binary)
142 //==============================================================================
143 template <class A, class T, unsigned int D, unsigned int D2>
145  operator+(const Expr<A,T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
146  typedef BinaryOp<AddOp<T>, Expr<A,T,D,D2>, SMatrix<T,D,D2>, T> AddOpBinOp;
147 
148  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,rhs));
149 }
150 
151 
152 //==============================================================================
153 // operator+ (SMatrix, binary)
154 //==============================================================================
155 template < class A, class T, unsigned int D, unsigned int D2>
157  operator+(const SMatrix<T,D,D2>& lhs, const Expr<A,T,D,D2>& rhs) {
158  typedef BinaryOp<AddOp<T>, SMatrix<T,D,D2>, Expr<A,T,D,D2>, T> AddOpBinOp;
159 
160  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,rhs));
161 }
162 
163 
164 //==============================================================================
165 // operator+ (SMatrix, binary)
166 //==============================================================================
167 template <class A, class B, class T, unsigned int D, unsigned int D2>
169  operator+(const Expr<A,T,D,D2>& lhs, const Expr<B,T,D,D2>& rhs) {
170  typedef BinaryOp<AddOp<T>, Expr<A,T,D,D2>, Expr<B,T,D,D2>, T> AddOpBinOp;
171 
172  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,rhs));
173 }
174 
175 
176 //==============================================================================
177 // operator+ (SMatrix, binary, Constant)
178 //==============================================================================
179 template <class A, class T, unsigned int D, unsigned int D2>
180 inline Expr<BinaryOp<AddOp<T>, SMatrix<T,D,D2>, Constant<A>, T>, T, D, D2>
181  operator+(const SMatrix<T,D,D2>& lhs, const A& rhs) {
182  typedef BinaryOp<AddOp<T>, SMatrix<T,D,D2>, Constant<A>, T> AddOpBinOp;
183 
184  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,Constant<A>(rhs)));
185 }
186 
187 //==============================================================================
188 // operator+ (SMatrix, binary, Constant)
189 //==============================================================================
190 template <class A, class T, unsigned int D, unsigned int D2>
191 inline Expr<BinaryOp<AddOp<T>, Constant<A>, SMatrix<T,D,D2>, T>, T, D, D2>
192  operator+(const A& lhs, const SMatrix<T,D,D2>& rhs) {
193  typedef BinaryOp<AddOp<T>, Constant<A>, SMatrix<T,D,D2>, T> AddOpBinOp;
194 
195  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),Constant<A>(lhs),rhs));
196 }
197 
198 
199 //==============================================================================
200 // operator+ (SMatrix, binary, Constant)
201 //==============================================================================
202 template <class A, class B, class T, unsigned int D, unsigned int D2>
203 inline Expr<BinaryOp<AddOp<T>, Expr<B,T,D,D2>, Constant<A>, T>, T, D, D2>
204  operator+(const Expr<B,T,D,D2>& lhs, const A& rhs) {
205  typedef BinaryOp<AddOp<T>, Expr<B,T,D,D2>, Constant<A>, T> AddOpBinOp;
206 
207  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),lhs,Constant<A>(rhs)));
208 }
209 
210 //==============================================================================
211 // operator+ (SMatrix, binary, Constant)
212 //==============================================================================
213 template <class A, class B, class T, unsigned int D, unsigned int D2>
214 inline Expr<BinaryOp<AddOp<T>, Constant<A>, Expr<B,T,D,D2>, T>, T, D, D2>
215  operator+(const A& lhs, const Expr<B,T,D,D2>& rhs) {
216  typedef BinaryOp<AddOp<T>, Constant<A>, Expr<B,T,D,D2>, T> AddOpBinOp;
217 
218  return Expr<AddOpBinOp,T,D,D2>(AddOpBinOp(AddOp<T>(),Constant<A>(lhs),rhs));
219 }
220 
221 
222 //==============================================================================
223 // MinOp
224 //==============================================================================
225 template <class T>
226 class MinOp {
227 public:
228  static inline T apply(const T& lhs, const T& rhs) {
229  return lhs - rhs;
230  }
231 };
232 
233 
234 //==============================================================================
235 // operator- (SVector, binary)
236 //==============================================================================
237 template < class T, unsigned int D>
239  operator-(const SVector<T,D>& lhs, const SVector<T,D>& rhs) {
240  typedef BinaryOp<MinOp<T>, SVector<T,D>, SVector<T,D>, T> MinOpBinOp;
241 
242  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,rhs));
243 }
244 
245 
246 //==============================================================================
247 // operator- (SVector, binary)
248 //==============================================================================
249 template <class A, class T, unsigned int D>
251  operator-(const Expr<A,T,D>& lhs, const SVector<T,D>& rhs) {
252  typedef BinaryOp<MinOp<T>, Expr<A,T,D>, SVector<T,D>, T> MinOpBinOp;
253 
254  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,rhs));
255 }
256 
257 
258 //==============================================================================
259 // operator- (SVector, binary)
260 //==============================================================================
261 template < class A, class T, unsigned int D>
263  operator-(const SVector<T,D>& lhs, const Expr<A,T,D>& rhs) {
264  typedef BinaryOp<MinOp<T>, SVector<T,D>, Expr<A,T,D>, T> MinOpBinOp;
265 
266  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,rhs));
267 }
268 
269 
270 //==============================================================================
271 // operator- (SVector, binary)
272 //==============================================================================
273 template <class A, class B, class T, unsigned int D>
275  operator-(const Expr<A,T,D>& lhs, const Expr<B,T,D>& rhs) {
276  typedef BinaryOp<MinOp<T>, Expr<A,T,D>, Expr<B,T,D>, T> MinOpBinOp;
277 
278  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,rhs));
279 }
280 
281 
282 //==============================================================================
283 // operator- (SVector, binary, Constant)
284 //==============================================================================
285 template <class A, class T, unsigned int D>
287  operator-(const SVector<T,D>& lhs, const A& rhs) {
288  typedef BinaryOp<MinOp<T>, SVector<T,D>, Constant<A>, T> MinOpBinOp;
289 
290  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,Constant<A>(rhs)));
291 }
292 
293 //==============================================================================
294 // operator- (SVector, binary, Constant)
295 //==============================================================================
296 template <class A, class T, unsigned int D>
298  operator-(const A& lhs, const SVector<T,D>& rhs) {
299  typedef BinaryOp<MinOp<T>, Constant<A>, SVector<T,D>, T> MinOpBinOp;
300 
301  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),Constant<A>(lhs),rhs));
302 }
303 
304 
305 //==============================================================================
306 // operator- (SVector, binary, Constant)
307 //==============================================================================
308 template <class A, class B, class T, unsigned int D>
310  operator-(const Expr<B,T,D>& lhs, const A& rhs) {
311  typedef BinaryOp<MinOp<T>, Expr<B,T,D>, Constant<A>, T> MinOpBinOp;
312 
313  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),lhs,Constant<A>(rhs)));
314 }
315 
316 //==============================================================================
317 // operator- (SVector, binary, Constant)
318 //==============================================================================
319 template <class A, class B, class T, unsigned int D>
321  operator-(const A& lhs, const Expr<B,T,D>& rhs) {
322  typedef BinaryOp<MinOp<T>, Constant<A>, Expr<B,T,D>, T> MinOpBinOp;
323 
324  return Expr<MinOpBinOp,T,D>(MinOpBinOp(MinOp<T>(),Constant<A>(lhs),rhs));
325 }
326 
327 
328 //==============================================================================
329 // operator- (SMatrix, binary)
330 //==============================================================================
331 template < class T, unsigned int D, unsigned int D2>
333  operator-(const SMatrix<T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
334  typedef BinaryOp<MinOp<T>, SMatrix<T,D,D2>, SMatrix<T,D,D2>, T> MinOpBinOp;
335 
336  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,rhs));
337 }
338 
339 
340 //==============================================================================
341 // operator- (SMatrix, binary)
342 //==============================================================================
343 template <class A, class T, unsigned int D, unsigned int D2>
345  operator-(const Expr<A,T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
346  typedef BinaryOp<MinOp<T>, Expr<A,T,D,D2>, SMatrix<T,D,D2>, T> MinOpBinOp;
347 
348  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,rhs));
349 }
350 
351 
352 //==============================================================================
353 // operator- (SMatrix, binary)
354 //==============================================================================
355 template < class A, class T, unsigned int D, unsigned int D2>
357  operator-(const SMatrix<T,D,D2>& lhs, const Expr<A,T,D,D2>& rhs) {
358  typedef BinaryOp<MinOp<T>, SMatrix<T,D,D2>, Expr<A,T,D,D2>, T> MinOpBinOp;
359 
360  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,rhs));
361 }
362 
363 
364 //==============================================================================
365 // operator- (SMatrix, binary)
366 //==============================================================================
367 template <class A, class B, class T, unsigned int D, unsigned int D2>
369  operator-(const Expr<A,T,D,D2>& lhs, const Expr<B,T,D,D2>& rhs) {
370  typedef BinaryOp<MinOp<T>, Expr<A,T,D,D2>, Expr<B,T,D,D2>, T> MinOpBinOp;
371 
372  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,rhs));
373 }
374 
375 
376 //==============================================================================
377 // operator- (SMatrix, binary, Constant)
378 //==============================================================================
379 template <class A, class T, unsigned int D, unsigned int D2>
380 inline Expr<BinaryOp<MinOp<T>, SMatrix<T,D,D2>, Constant<A>, T>, T, D, D2>
381  operator-(const SMatrix<T,D,D2>& lhs, const A& rhs) {
382  typedef BinaryOp<MinOp<T>, SMatrix<T,D,D2>, Constant<A>, T> MinOpBinOp;
383 
384  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,Constant<A>(rhs)));
385 }
386 
387 //==============================================================================
388 // operator- (SMatrix, binary, Constant)
389 //==============================================================================
390 template <class A, class T, unsigned int D, unsigned int D2>
391 inline Expr<BinaryOp<MinOp<T>, Constant<A>, SMatrix<T,D,D2>, T>, T, D, D2>
392  operator-(const A& lhs, const SMatrix<T,D,D2>& rhs) {
393  typedef BinaryOp<MinOp<T>, Constant<A>, SMatrix<T,D,D2>, T> MinOpBinOp;
394 
395  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),Constant<A>(lhs),rhs));
396 }
397 
398 
399 //==============================================================================
400 // operator- (SMatrix, binary, Constant)
401 //==============================================================================
402 template <class A, class B, class T, unsigned int D, unsigned int D2>
403 inline Expr<BinaryOp<MinOp<T>, Expr<B,T,D,D2>, Constant<A>, T>, T, D, D2>
404  operator-(const Expr<B,T,D,D2>& lhs, const A& rhs) {
405  typedef BinaryOp<MinOp<T>, Expr<B,T,D,D2>, Constant<A>, T> MinOpBinOp;
406 
407  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),lhs,Constant<A>(rhs)));
408 }
409 
410 //==============================================================================
411 // operator- (SMatrix, binary, Constant)
412 //==============================================================================
413 template <class A, class B, class T, unsigned int D, unsigned int D2>
414 inline Expr<BinaryOp<MinOp<T>, Constant<A>, Expr<B,T,D,D2>, T>, T, D, D2>
415  operator-(const A& lhs, const Expr<B,T,D,D2>& rhs) {
416  typedef BinaryOp<MinOp<T>, Constant<A>, Expr<B,T,D,D2>, T> MinOpBinOp;
417 
418  return Expr<MinOpBinOp,T,D,D2>(MinOpBinOp(MinOp<T>(),Constant<A>(lhs),rhs));
419 }
420 
421 
422 //==============================================================================
423 // MulOp
424 //==============================================================================
425 template <class T>
426 class MulOp {
427 public:
428  static inline T apply(const T& lhs, const T& rhs) {
429  return lhs * rhs;
430  }
431 };
432 
433 
434 //==============================================================================
435 // operator* (SVector, binary)
436 //==============================================================================
437 template < class T, unsigned int D>
439  operator*(const SVector<T,D>& lhs, const SVector<T,D>& rhs) {
440  typedef BinaryOp<MulOp<T>, SVector<T,D>, SVector<T,D>, T> MulOpBinOp;
441 
442  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,rhs));
443 }
444 
445 
446 //==============================================================================
447 // operator* (SVector, binary)
448 //==============================================================================
449 template <class A, class T, unsigned int D>
451  operator*(const Expr<A,T,D>& lhs, const SVector<T,D>& rhs) {
452  typedef BinaryOp<MulOp<T>, Expr<A,T,D>, SVector<T,D>, T> MulOpBinOp;
453 
454  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,rhs));
455 }
456 
457 
458 //==============================================================================
459 // operator* (SVector, binary)
460 //==============================================================================
461 template < class A, class T, unsigned int D>
463  operator*(const SVector<T,D>& lhs, const Expr<A,T,D>& rhs) {
464  typedef BinaryOp<MulOp<T>, SVector<T,D>, Expr<A,T,D>, T> MulOpBinOp;
465 
466  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,rhs));
467 }
468 
469 
470 //==============================================================================
471 // operator* (SVector, binary)
472 //==============================================================================
473 template <class A, class B, class T, unsigned int D>
475  operator*(const Expr<A,T,D>& lhs, const Expr<B,T,D>& rhs) {
476  typedef BinaryOp<MulOp<T>, Expr<A,T,D>, Expr<B,T,D>, T> MulOpBinOp;
477 
478  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,rhs));
479 }
480 
481 
482 //==============================================================================
483 // operator* (SVector, binary, Constant)
484 //==============================================================================
485 template <class A, class T, unsigned int D>
487  operator*(const SVector<T,D>& lhs, const A& rhs) {
488  typedef BinaryOp<MulOp<T>, SVector<T,D>, Constant<A>, T> MulOpBinOp;
489 
490  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,Constant<A>(rhs)));
491 }
492 
493 //==============================================================================
494 // operator* (SVector, binary, Constant)
495 //==============================================================================
496 template <class A, class T, unsigned int D>
498  operator*(const A& lhs, const SVector<T,D>& rhs) {
499  typedef BinaryOp<MulOp<T>, Constant<A>, SVector<T,D>, T> MulOpBinOp;
500 
501  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),Constant<A>(lhs),rhs));
502 }
503 
504 
505 //==============================================================================
506 // operator* (SVector, binary, Constant)
507 //==============================================================================
508 template <class A, class B, class T, unsigned int D>
510  operator*(const Expr<B,T,D>& lhs, const A& rhs) {
511  typedef BinaryOp<MulOp<T>, Expr<B,T,D>, Constant<A>, T> MulOpBinOp;
512 
513  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),lhs,Constant<A>(rhs)));
514 }
515 
516 //==============================================================================
517 // operator* (SVector, binary, Constant)
518 //==============================================================================
519 template <class A, class B, class T, unsigned int D>
521  operator*(const A& lhs, const Expr<B,T,D>& rhs) {
522  typedef BinaryOp<MulOp<T>, Constant<A>, Expr<B,T,D>, T> MulOpBinOp;
523 
524  return Expr<MulOpBinOp,T,D>(MulOpBinOp(MulOp<T>(),Constant<A>(lhs),rhs));
525 }
526 
527 
528 //==============================================================================
529 // times (SMatrix, binary)
530 //==============================================================================
531 template < class T, unsigned int D, unsigned int D2>
533  times(const SMatrix<T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
534  typedef BinaryOp<MulOp<T>, SMatrix<T,D,D2>, SMatrix<T,D,D2>, T> MulOpBinOp;
535 
536  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,rhs));
537 }
538 
539 
540 //==============================================================================
541 // times (SMatrix, binary)
542 //==============================================================================
543 template <class A, class T, unsigned int D, unsigned int D2>
545  times(const Expr<A,T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
546  typedef BinaryOp<MulOp<T>, Expr<A,T,D,D2>, SMatrix<T,D,D2>, T> MulOpBinOp;
547 
548  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,rhs));
549 }
550 
551 
552 //==============================================================================
553 // times (SMatrix, binary)
554 //==============================================================================
555 template < class A, class T, unsigned int D, unsigned int D2>
557  times(const SMatrix<T,D,D2>& lhs, const Expr<A,T,D,D2>& rhs) {
558  typedef BinaryOp<MulOp<T>, SMatrix<T,D,D2>, Expr<A,T,D,D2>, T> MulOpBinOp;
559 
560  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,rhs));
561 }
562 
563 
564 //==============================================================================
565 // times (SMatrix, binary)
566 //==============================================================================
567 template <class A, class B, class T, unsigned int D, unsigned int D2>
569  times(const Expr<A,T,D,D2>& lhs, const Expr<B,T,D,D2>& rhs) {
570  typedef BinaryOp<MulOp<T>, Expr<A,T,D,D2>, Expr<B,T,D,D2>, T> MulOpBinOp;
571 
572  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,rhs));
573 }
574 
575 
576 //==============================================================================
577 // operator* (SMatrix, binary, Constant)
578 //==============================================================================
579 template <class A, class T, unsigned int D, unsigned int D2>
580 inline Expr<BinaryOp<MulOp<T>, SMatrix<T,D,D2>, Constant<A>, T>, T, D, D2>
581  operator*(const SMatrix<T,D,D2>& lhs, const A& rhs) {
582  typedef BinaryOp<MulOp<T>, SMatrix<T,D,D2>, Constant<A>, T> MulOpBinOp;
583 
584  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,Constant<A>(rhs)));
585 }
586 
587 //==============================================================================
588 // operator* (SMatrix, binary, Constant)
589 //==============================================================================
590 template <class A, class T, unsigned int D, unsigned int D2>
591 inline Expr<BinaryOp<MulOp<T>, Constant<A>, SMatrix<T,D,D2>, T>, T, D, D2>
592  operator*(const A& lhs, const SMatrix<T,D,D2>& rhs) {
593  typedef BinaryOp<MulOp<T>, Constant<A>, SMatrix<T,D,D2>, T> MulOpBinOp;
594 
595  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),Constant<A>(lhs),rhs));
596 }
597 
598 
599 //==============================================================================
600 // operator* (SMatrix, binary, Constant)
601 //==============================================================================
602 template <class A, class B, class T, unsigned int D, unsigned int D2>
603 inline Expr<BinaryOp<MulOp<T>, Expr<B,T,D,D2>, Constant<A>, T>, T, D, D2>
604  operator*(const Expr<B,T,D,D2>& lhs, const A& rhs) {
605  typedef BinaryOp<MulOp<T>, Expr<B,T,D,D2>, Constant<A>, T> MulOpBinOp;
606 
607  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),lhs,Constant<A>(rhs)));
608 }
609 
610 //==============================================================================
611 // operator* (SMatrix, binary, Constant)
612 //==============================================================================
613 template <class A, class B, class T, unsigned int D, unsigned int D2>
614 inline Expr<BinaryOp<MulOp<T>, Constant<A>, Expr<B,T,D,D2>, T>, T, D, D2>
615  operator*(const A& lhs, const Expr<B,T,D,D2>& rhs) {
616  typedef BinaryOp<MulOp<T>, Constant<A>, Expr<B,T,D,D2>, T> MulOpBinOp;
617 
618  return Expr<MulOpBinOp,T,D,D2>(MulOpBinOp(MulOp<T>(),Constant<A>(lhs),rhs));
619 }
620 
621 
622 //==============================================================================
623 // DivOp
624 //==============================================================================
625 template <class T>
626 class DivOp {
627 public:
628  static inline T apply(const T& lhs, const T& rhs) {
629  return lhs / rhs;
630  }
631 };
632 
633 
634 //==============================================================================
635 // operator/ (SVector, binary)
636 //==============================================================================
637 template < class T, unsigned int D>
639  operator/(const SVector<T,D>& lhs, const SVector<T,D>& rhs) {
640  typedef BinaryOp<DivOp<T>, SVector<T,D>, SVector<T,D>, T> DivOpBinOp;
641 
642  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,rhs));
643 }
644 
645 
646 //==============================================================================
647 // operator/ (SVector, binary)
648 //==============================================================================
649 template <class A, class T, unsigned int D>
651  operator/(const Expr<A,T,D>& lhs, const SVector<T,D>& rhs) {
652  typedef BinaryOp<DivOp<T>, Expr<A,T,D>, SVector<T,D>, T> DivOpBinOp;
653 
654  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,rhs));
655 }
656 
657 
658 //==============================================================================
659 // operator/ (SVector, binary)
660 //==============================================================================
661 template < class A, class T, unsigned int D>
663  operator/(const SVector<T,D>& lhs, const Expr<A,T,D>& rhs) {
664  typedef BinaryOp<DivOp<T>, SVector<T,D>, Expr<A,T,D>, T> DivOpBinOp;
665 
666  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,rhs));
667 }
668 
669 
670 //==============================================================================
671 // operator/ (SVector, binary)
672 //==============================================================================
673 template <class A, class B, class T, unsigned int D>
675  operator/(const Expr<A,T,D>& lhs, const Expr<B,T,D>& rhs) {
676  typedef BinaryOp<DivOp<T>, Expr<A,T,D>, Expr<B,T,D>, T> DivOpBinOp;
677 
678  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,rhs));
679 }
680 
681 
682 //==============================================================================
683 // operator/ (SVector, binary, Constant)
684 //==============================================================================
685 template <class A, class T, unsigned int D>
687  operator/(const SVector<T,D>& lhs, const A& rhs) {
688  typedef BinaryOp<DivOp<T>, SVector<T,D>, Constant<A>, T> DivOpBinOp;
689 
690  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,Constant<A>(rhs)));
691 }
692 
693 //==============================================================================
694 // operator/ (SVector, binary, Constant)
695 //==============================================================================
696 template <class A, class T, unsigned int D>
698  operator/(const A& lhs, const SVector<T,D>& rhs) {
699  typedef BinaryOp<DivOp<T>, Constant<A>, SVector<T,D>, T> DivOpBinOp;
700 
701  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),Constant<A>(lhs),rhs));
702 }
703 
704 
705 //==============================================================================
706 // operator/ (SVector, binary, Constant)
707 //==============================================================================
708 template <class A, class B, class T, unsigned int D>
710  operator/(const Expr<B,T,D>& lhs, const A& rhs) {
711  typedef BinaryOp<DivOp<T>, Expr<B,T,D>, Constant<A>, T> DivOpBinOp;
712 
713  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),lhs,Constant<A>(rhs)));
714 }
715 
716 //==============================================================================
717 // operator/ (SVector, binary, Constant)
718 //==============================================================================
719 template <class A, class B, class T, unsigned int D>
721  operator/(const A& lhs, const Expr<B,T,D>& rhs) {
722  typedef BinaryOp<DivOp<T>, Constant<A>, Expr<B,T,D>, T> DivOpBinOp;
723 
724  return Expr<DivOpBinOp,T,D>(DivOpBinOp(DivOp<T>(),Constant<A>(lhs),rhs));
725 }
726 
727 
728 //==============================================================================
729 // operator/ (SMatrix, binary)
730 //==============================================================================
731 template < class T, unsigned int D, unsigned int D2>
733  operator/(const SMatrix<T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
734  typedef BinaryOp<DivOp<T>, SMatrix<T,D,D2>, SMatrix<T,D,D2>, T> DivOpBinOp;
735 
736  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,rhs));
737 }
738 
739 
740 //==============================================================================
741 // operator/ (SMatrix, binary)
742 //==============================================================================
743 template <class A, class T, unsigned int D, unsigned int D2>
745  operator/(const Expr<A,T,D,D2>& lhs, const SMatrix<T,D,D2>& rhs) {
746  typedef BinaryOp<DivOp<T>, Expr<A,T,D,D2>, SMatrix<T,D,D2>, T> DivOpBinOp;
747 
748  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,rhs));
749 }
750 
751 
752 //==============================================================================
753 // operator/ (SMatrix, binary)
754 //==============================================================================
755 template < class A, class T, unsigned int D, unsigned int D2>
757  operator/(const SMatrix<T,D,D2>& lhs, const Expr<A,T,D,D2>& rhs) {
758  typedef BinaryOp<DivOp<T>, SMatrix<T,D,D2>, Expr<A,T,D,D2>, T> DivOpBinOp;
759 
760  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,rhs));
761 }
762 
763 
764 //==============================================================================
765 // operator/ (SMatrix, binary)
766 //==============================================================================
767 template <class A, class B, class T, unsigned int D, unsigned int D2>
769  operator/(const Expr<A,T,D,D2>& lhs, const Expr<B,T,D,D2>& rhs) {
770  typedef BinaryOp<DivOp<T>, Expr<A,T,D,D2>, Expr<B,T,D,D2>, T> DivOpBinOp;
771 
772  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,rhs));
773 }
774 
775 
776 //==============================================================================
777 // operator/ (SMatrix, binary, Constant)
778 //==============================================================================
779 template <class A, class T, unsigned int D, unsigned int D2>
780 inline Expr<BinaryOp<DivOp<T>, SMatrix<T,D,D2>, Constant<A>, T>, T, D, D2>
781  operator/(const SMatrix<T,D,D2>& lhs, const A& rhs) {
782  typedef BinaryOp<DivOp<T>, SMatrix<T,D,D2>, Constant<A>, T> DivOpBinOp;
783 
784  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,Constant<A>(rhs)));
785 }
786 
787 //==============================================================================
788 // operator/ (SMatrix, binary, Constant)
789 //==============================================================================
790 template <class A, class T, unsigned int D, unsigned int D2>
791 inline Expr<BinaryOp<DivOp<T>, Constant<A>, SMatrix<T,D,D2>, T>, T, D, D2>
792  operator/(const A& lhs, const SMatrix<T,D,D2>& rhs) {
793  typedef BinaryOp<DivOp<T>, Constant<A>, SMatrix<T,D,D2>, T> DivOpBinOp;
794 
795  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),Constant<A>(lhs),rhs));
796 }
797 
798 
799 //==============================================================================
800 // operator/ (SMatrix, binary, Constant)
801 //==============================================================================
802 template <class A, class B, class T, unsigned int D, unsigned int D2>
803 inline Expr<BinaryOp<DivOp<T>, Expr<B,T,D,D2>, Constant<A>, T>, T, D, D2>
804  operator/(const Expr<B,T,D,D2>& lhs, const A& rhs) {
805  typedef BinaryOp<DivOp<T>, Expr<B,T,D,D2>, Constant<A>, T> DivOpBinOp;
806 
807  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),lhs,Constant<A>(rhs)));
808 }
809 
810 //==============================================================================
811 // operator/ (SMatrix, binary, Constant)
812 //==============================================================================
813 template <class A, class B, class T, unsigned int D, unsigned int D2>
814 inline Expr<BinaryOp<DivOp<T>, Constant<A>, Expr<B,T,D,D2>, T>, T, D, D2>
815  operator/(const A& lhs, const Expr<B,T,D,D2>& rhs) {
816  typedef BinaryOp<DivOp<T>, Constant<A>, Expr<B,T,D,D2>, T> DivOpBinOp;
817 
818  return Expr<DivOpBinOp,T,D,D2>(DivOpBinOp(DivOp<T>(),Constant<A>(lhs),rhs));
819 }
820 
821 #endif
Expr< BinaryOp< DivOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > operator/(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Definition: BinaryOperators.hh:639
Expr< BinaryOp< MulOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > operator*(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Definition: BinaryOperators.hh:439
Expr< BinaryOp< MinOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > operator-(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Definition: BinaryOperators.hh:239
Expr< BinaryOp< AddOp< T >, SVector< T, D >, SVector< T, D >, T >, T, D > operator+(const SVector< T, D > &lhs, const SVector< T, D > &rhs)
Definition: BinaryOperators.hh:39
Expr< BinaryOp< MulOp< T >, SMatrix< T, D, D2 >, SMatrix< T, D, D2 >, T >, T, D, D2 > times(const SMatrix< T, D, D2 > &lhs, const SMatrix< T, D, D2 > &rhs)
Definition: BinaryOperators.hh:533
Definition: BinaryOperators.hh:26
static T apply(const T &lhs, const T &rhs)
Definition: BinaryOperators.hh:28
Definition: Expression.hh:113
Definition: Expression.hh:172
Definition: BinaryOperators.hh:626
static T apply(const T &lhs, const T &rhs)
Definition: BinaryOperators.hh:628
Definition: Expression.hh:43
Definition: BinaryOperators.hh:226
static T apply(const T &lhs, const T &rhs)
Definition: BinaryOperators.hh:228
Definition: BinaryOperators.hh:426
static T apply(const T &lhs, const T &rhs)
Definition: BinaryOperators.hh:428
Definition: SMatrix.hh:53
Definition: SVector.hh:51