Go to the documentation of this file.00001
00002
00003
00004 #ifndef operations_hh
00005 #define operations_hh
00006
00007 #include "basics/typedefs.hh"
00008 #include "basics/vectorsMatrices.hh"
00009
00010 namespace concepts {
00011
00012 template<class F>
00013 F& inverse(F& f) { f = 1.0 / f; return f; }
00014
00015 template<class F>
00016 F inverse(const F& f) { return 1.0 / f; }
00017
00018 template<class F, int dim>
00019 Mapping<F,dim>& inverse(Mapping<F,dim>& m) { m = m.inverse(); return m; }
00020
00021 template<class F, int dim>
00022 Mapping<F,dim> inverse(const Mapping<F,dim>& m) { return m.inverse(); }
00023
00024 template<class F, int dim>
00025 F determinant(const Mapping<F,dim>& m) { return m.determinant(); }
00026
00027 template<class F, int dim>
00028 Mapping<F,dim>& adjugate(Mapping<F,dim>& m) { m = m.adjugate(); return m; }
00029
00030 template<class F, int dim>
00031 Mapping<F,dim> adjugate(const Mapping<F,dim>& m) { return m.adjugate(); }
00032
00033 template<class F, class G>
00034 G& product(const F& m, G& v) {
00035 v = m * v; return v;
00036 }
00037
00038 template<class F, class G>
00039 G product(const F& m, const G& v) {
00040 return m * v;
00041 }
00042
00043 template<class F, int dim>
00044 Mapping<F,dim>& prodTranspose(Mapping<F,dim>& m)
00045 { m = m.prodTranspose(); return m; }
00046
00047 template<class F, int dim>
00048 Mapping<F,dim> prodTranspose(const Mapping<F,dim>& m)
00049 { return m.prodTranspose(); }
00050
00051 template<class F, int dim>
00052 Mapping<F,dim>& transpose(Mapping<F,dim>& m)
00053 { m = m.transpose(); return m; }
00054
00055 template<class F, int dim>
00056 Mapping<F,dim> transpose(const Mapping<F,dim>& m)
00057 { return m.transpose(); }
00058
00059
00060 template <class F, class G, class H>
00061 class multiplies : public std::binary_function<F, G, H>,
00062 public OutputOperator
00063 {
00064 public:
00065 H operator()(const F& x, const G& y) const { return x * y; }
00066 protected:
00067 virtual std::ostream& info(std::ostream& os) const {
00068 return os << "*";
00069 }
00070 };
00071
00072 }
00073
00074 namespace std {
00075
00081 inline const concepts::Real conj(const concepts::Real& v) { return v; }
00082
00088 inline const concepts::Real norm(const concepts::Real& v) {
00089 return v * v;
00090 }
00091
00092 }
00093
00094 #endif // operations_hh