00001 /* ************************************************************* 00002 00003 Copyright 2010 Terry Lyons, Stephen Buckley, Djalil Chafai, 00004 Greg Gyurkó and Arend Janssen. 00005 00006 Distributed under the terms of the GNU General Public License, 00007 Version 3. (See accompanying file License.txt) 00008 00009 ************************************************************* */ 00010 00011 00012 00013 #pragma once 00014 00015 #ifndef __GROUPELEMENT__ 00016 #define __GROUPELEMENT__ 00017 00018 00019 #include "AbstractSolutionPoint.h" 00020 00021 00023 00027 template <typename my_alg_type> 00028 class ActionPoint : public my_alg_type::mtlVector 00029 { 00030 typedef typename my_alg_type::LET LET; 00031 typedef typename my_alg_type::mtlVector mtlVector; 00032 00033 static const unsigned myDIM = my_alg_type::myDIM; 00034 00035 public: 00037 ActionPoint(mtlVector & M) : mtlVector(M){}; 00038 00039 template <typename T> 00040 ActionPoint(T M) : mtlVector((mtlVector)M){}; 00041 00042 ActionPoint() : mtlVector(myDIM){}; 00043 00044 ~ActionPoint() {}; 00045 00047 explicit ActionPoint (AbstractSolutionPoint<my_alg_type> & p) : mtlVector(myDIM) 00048 { 00049 for(unsigned int i=0; i < myDIM; i++) 00050 { 00051 if (p.find(LET(i+1)) != p.end()) 00052 { 00053 (*this)[i] = p[LET(i+1)]; 00054 } 00055 else 00056 { 00057 (*this)[i] = 0; 00058 } 00059 } 00060 }; 00061 00063 AbstractSolutionPoint<my_alg_type> ActionPoint2AbstractSolutionPoint(void) 00064 { 00065 AbstractSolutionPoint<my_alg_type> result; 00066 00067 for(unsigned int i=0; i < myDIM; i++) 00068 { 00069 if ( (*this)[i] != 0 ) 00070 { 00071 result[LET(i+1)] = (*this)[i]; 00072 } 00073 } 00074 00075 return result; 00076 }; 00077 00079 static ActionPoint<my_alg_type> AbstractSolutionPoint2ActionPoint(AbstractSolutionPoint<my_alg_type> & p) 00080 { 00081 ActionPoint<my_alg_type> a; 00082 00083 for(unsigned int i=0; i < myDIM; i++) 00084 { 00085 if (p.find(LET(i+1)) != p.end()) 00086 { 00087 a[i] = p[LET(i+1)]; 00088 } 00089 else 00090 { 00091 a[i] = 0; 00092 } 00093 } 00094 00095 return a; 00096 }; 00097 00098 };// END CLASS DEFINITION ActionPoint 00099 00100 00102 00104 template <typename my_alg_type> 00105 class GroupElement : public my_alg_type::mtlMatrix 00106 { 00107 typedef typename my_alg_type::RAT RAT; 00108 typedef typename my_alg_type::mtlMatrix mtlMatrix; 00109 00110 static const unsigned myDIM = my_alg_type::myDIM; 00111 00112 public: 00114 GroupElement(mtlMatrix & M) : mtlMatrix(M) {}; 00115 00117 GroupElement() : mtlMatrix(myDIM,myDIM) 00118 { 00119 mtl::set_diagonal((mtlMatrix &)*this,RAT(1)); 00120 }; 00121 00123 ~GroupElement() {}; 00124 00126 GroupElement<my_alg_type> operator* (const GroupElement<my_alg_type> & g) const 00127 { 00128 GroupElement<my_alg_type> temp; 00129 mtl::set_diagonal((mtlMatrix) temp,RAT(0)); 00130 mtl::mult((mtlMatrix &) g,(mtlMatrix &) *this ,(mtlMatrix &) temp); 00131 return temp; 00132 }; 00133 00135 ActionPoint<my_alg_type> operator()(const ActionPoint<my_alg_type> & Arg) 00136 { 00137 ActionPoint<my_alg_type> temp; 00138 mtl::set_value(temp,RAT(0)); 00139 mtlMatrix trans; 00140 mtl::mult((mtlMatrix &) *this,Arg,temp); 00141 return ActionPoint<my_alg_type>(temp); 00142 }; 00143 00144 };// END CLASS DEFINITION GroupElement 00145 00146 00147 #endif // __GROUPELEMENT__