Class documentation of Concepts

Loading...
Searching...
No Matches
operations.hh
Go to the documentation of this file.
1
6#ifndef operations_hh
7#define operations_hh
8
9#include "basics/typedefs.hh"
11
12namespace concepts {
13
14 template<class F>
15 F& inverse(F& f) { f = 1.0 / f; return f; }
16
17 template<class F>
18 F inverse(const F& f) { return 1.0 / f; }
19
20 template<class F, uint dim>
21 Mapping<F,dim>& inverse(Mapping<F,dim>& m) { m = m.inverse(); return m; }
22
23 template<class F, uint dim>
24 Mapping<F,dim> inverse(const Mapping<F,dim>& m) { return m.inverse(); }
25
26 template<class F, uint dim>
27 F determinant(const Mapping<F,dim>& m) { return m.determinant(); }
28
29 template<class F, uint dim>
30 Mapping<F,dim>& adjugate(Mapping<F,dim>& m) { m = m.adjugate(); return m; }
31
32 template<class F, uint dim>
33 Mapping<F,dim> adjugate(const Mapping<F,dim>& m) { return m.adjugate(); }
34
35 template<class F, class G>
36 G& product(const F& m, G& v) {
37 v = m * v; return v;
38 }
39
40 template<class F, class G>
41 G product(const F& m, const G& v) {
42 return m * v;
43 }
44
45 template<class F, uint dim>
46 Mapping<F,dim>& prodTranspose(Mapping<F,dim>& m)
47 { m = m.prodTranspose(); return m; }
48
49 template<class F, uint dim>
50 Mapping<F,dim> prodTranspose(const Mapping<F,dim>& m)
51 { return m.prodTranspose(); }
52
53 template<class F, uint dim>
54 Mapping<F,dim>& transpose(Mapping<F,dim>& m)
55 { m = m.transpose(); return m; }
56
57 template<class F, uint dim>
58 Mapping<F,dim> transpose(const Mapping<F,dim>& m)
59 { return m.transpose(); }
60
61
62 template <class F, class G, class H>
63 class multiplies : public std::binary_function<F, G, H>,
64 public OutputOperator
65 {
66 public:
67 H operator()(const F& x, const G& y) const { return x * y; }
68 protected:
69 virtual std::ostream& info(std::ostream& os) const {
70 return os << "*";
71 }
72 };
73
74} // namespace concepts
75
76namespace std {
77
83 inline const concepts::Real conj(const concepts::Real& v) { return v; }
84
90 inline const concepts::Real norm(const concepts::Real& v) {
91 return v * v;
92 }
93
94 // Returns the absolute value of an unsigned integer
95 inline uint abs(const uint& v) {
96 return v;
97 }
98
99} // namespace std
100
101#endif // operations_hh
Mapping< F, DimX, DimY > transpose() const
Returns the transpose of the matrix.
Mapping< F, DimY, DimY > prodTranspose() const
Returns the product with the transpose of the matrix.
Mapping< F, DimY, DimX > adjugate() const
virtual std::ostream & info(std::ostream &os) const
Returns information in an output stream.
Definition operations.hh:69
double Real
Definition typedefs.hh:39
Set< F > makeSet(uint n, const F &first,...)
Definition set.hh:320
const concepts::Real norm(const concepts::Real &v)
Definition operations.hh:90