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 #ifndef alg_types_h__ 00012 #define alg_types_h__ 00013 00014 #include "libalgebra/libalgebra.h" 00015 #include "addons/gmpwrapper.h" 00016 //#include "mtl/mtl.h" 00017 00018 //#pragma warning(push) 00019 //#pragma warning (disable : 800) 00020 //#include "../addons/gmpwrapper.h" 00021 //#pragma warning(pop) 00022 00023 00024 enum coefficient_t 00025 { 00026 Rational, 00027 DPReal, 00028 SPReal 00029 }; 00030 00031 namespace { 00032 00033 template <coefficient_t F> struct Field; 00034 00035 template<> 00036 struct Field < Rational > 00037 { 00038 typedef mpq_class S; 00039 typedef mpq_class Q; 00040 }; 00041 00042 template<> 00043 struct Field < DPReal > 00044 { 00045 typedef double S; 00046 typedef double Q; 00047 }; 00048 00049 template<> 00050 struct Field < SPReal > 00051 { 00052 typedef float S; 00053 typedef float Q; 00054 }; 00055 00056 } // anon namespace 00057 00058 template <unsigned D, unsigned W, coefficient_t F = Rational> 00059 struct alg_types : Field < F > 00060 { 00061 typedef typename Field < F >::S S; 00062 typedef typename Field < F >::Q Q; 00063 typedef S SCA; 00064 typedef Q RAT; 00065 typedef alg::DEG DEG; 00066 typedef alg::LET LET; 00067 static const unsigned DEPTH = D; 00068 static const unsigned myDIM = W; 00069 static const unsigned ALPHABET_SIZE = W; 00070 typedef alg::poly<S,Q> MULTIPOLY1; 00071 typedef alg::free_tensor<S,Q,ALPHABET_SIZE,DEPTH> TENSOR; 00072 typedef alg::lie<S,Q,ALPHABET_SIZE,DEPTH> LIE; 00073 typedef alg::maps<S,Q,ALPHABET_SIZE,DEPTH> MAPS; 00074 typedef alg::cbh<S,Q,ALPHABET_SIZE,DEPTH> CBH; 00075 typedef alg::multi_polynomial<S,Q,ALPHABET_SIZE,DEPTH> MULTIPOLY; 00076 //typedef mtl::dense1D<RAT> mtlVector; 00077 //typedef typename mtl::matrix<RAT, mtl::rectangle<>, mtl::dense<>, mtl::row_major>::type mtlMatrix; 00078 //typedef typename mtl::matrix<RAT, mtl::diagonal<>, mtl::packed<>, mtl::row_major>::type mtlDiagMat; 00079 }; 00080 00081 00082 00084 // 00085 // 00086 //#ifndef alg_types_h__ 00087 //#define alg_types_h__ 00088 // 00089 //#include "libalgebra.h" 00090 // 00091 //#pragma warning(push) 00092 //#pragma warning (disable : 800) 00093 //#include "../addons/gmpwrapper.h" 00094 //#pragma warning(pop) 00095 // 00096 // 00097 //enum coefficient_t 00098 //{ 00099 // Rational, 00100 // DPReal, 00101 // SPReal 00102 //}; 00103 // 00104 //namespace 00105 //{ 00106 // 00107 //template <coefficient_t F> 00108 //struct Field; 00109 // 00110 //template<> 00111 //struct Field<Rational> 00112 //{ 00113 // typedef mpq_class S; 00114 // typedef mpq_class Q; 00115 //}; 00116 // 00117 //template<> 00118 //struct Field<DPReal> 00119 //{ 00120 // typedef double S; 00121 // typedef double Q; 00122 //}; 00123 // 00124 //template<> 00125 //struct Field<SPReal> 00126 //{ 00127 // typedef float S; 00128 // typedef float Q; 00129 //}; 00130 // 00131 //} // anon namespace 00132 // 00133 //template <unsigned D, unsigned W, coefficient_t F = Rational> 00134 //struct alg_types : Field<F> 00135 //{ 00136 // typedef typename Field<F>::S S; 00137 // typedef typename Field<F>::Q Q; 00138 // typedef S SCA; 00139 // typedef Q RAT; 00140 // static const unsigned DEPTH = D; 00141 // static const unsigned myDIM = W; 00142 // static const unsigned ALPHABET_SIZE = W; 00143 // typedef alg::poly<S, Q> MULTIPOLY1; 00144 // typedef alg::free_tensor<S, Q, ALPHABET_SIZE, DEPTH> TENSOR; 00145 // typedef alg::lie<S, Q, ALPHABET_SIZE, DEPTH> LIE; 00146 // typedef alg::maps<S, Q, ALPHABET_SIZE, DEPTH> MAPS; 00147 // typedef alg::cbh<S, Q, ALPHABET_SIZE, DEPTH> CBH; 00148 // typedef alg::multi_polynomial<S, Q, ALPHABET_SIZE, DEPTH> MULTIPOLY; 00149 //}; 00150 00151 #endif // alg_types_h__