1 #ifndef _GLUCAT_FRAMED_MULTI_H
2 #define _GLUCAT_FRAMED_MULTI_H
38 #if defined(_GLUCAT_USE_BOOST_POOL_ALLOC)
40 #include <boost/pool/poolfwd.hpp>
50 #if defined(_GLUCAT_USE_STD_UNORDERED_MAP)
51 # include <unordered_map>
54 #if defined(_GLUCAT_USE_STD_UNORDERED_MAP)
55 # define _GLUCAT_MAP_IS_HASH
57 # define _GLUCAT_MAP_IS_ORDERED
64 template<
typename Scalar_T, const index_t LO, const index_t HI >
67 template<
typename Scalar_T, const index_t LO, const index_t HI >
71 template<
typename Scalar_T, const index_t LO, const index_t HI >
72 const framed_multi<Scalar_T,LO,HI>
73 operator* (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
76 template<
typename Scalar_T, const index_t LO, const index_t HI >
77 const framed_multi<Scalar_T,LO,HI>
78 operator^ (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
81 template<
typename Scalar_T, const index_t LO, const index_t HI >
82 const framed_multi<Scalar_T,LO,HI>
83 operator& (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
86 template<
typename Scalar_T, const index_t LO, const index_t HI >
87 const framed_multi<Scalar_T,LO,HI>
88 operator% (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
91 template<
typename Scalar_T, const index_t LO, const index_t HI >
93 star(
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
96 template<
typename Scalar_T, const index_t LO, const index_t HI >
97 const framed_multi<Scalar_T,LO,HI>
98 operator/ (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
101 template<
typename Scalar_T, const index_t LO, const index_t HI >
102 const framed_multi<Scalar_T,LO,HI>
103 operator| (
const framed_multi<Scalar_T,LO,HI>& lhs,
const framed_multi<Scalar_T,LO,HI>& rhs);
106 template<
typename Scalar_T, const index_t LO, const index_t HI >
108 operator>> (std::istream& s, framed_multi<Scalar_T,LO,HI>& val);
111 template<
typename Scalar_T, const index_t LO, const index_t HI >
113 operator<< (std::ostream& os,
const framed_multi<Scalar_T,LO,HI>& val);
116 template<
typename Scalar_T, const index_t LO, const index_t HI >
118 operator<< (std::ostream& os,
const std::pair<
const index_set<LO,HI>, Scalar_T >& term);
121 template<
typename Scalar_T, const index_t LO, const index_t HI >
122 const framed_multi<Scalar_T,LO,HI>
123 exp(
const framed_multi<Scalar_T,LO,HI>& val);
125 template< const index_t LO, const index_t HI>
134 template<
typename Scalar_T =
double, const index_t LO = DEFAULT_LO, const index_t HI = DEFAULT_HI >
136 public clifford_algebra< Scalar_T, index_set<LO,HI>, framed_multi<Scalar_T,LO,HI> >,
137 #if defined(_GLUCAT_USE_STD_UNORDERED_MAP)
138 private std::unordered_map< index_set<LO,HI>, Scalar_T, index_set_hash<LO,HI> >
140 private std::map< index_set<LO,HI>, Scalar_T,
141 std::less< const index_set<LO,HI> >
142 #if defined(_GLUCAT_USE_BOOST_POOL_ALLOC)
143 , boost::fast_pool_allocator< std::pair<const index_set<LO,HI>, Scalar_T> >
153 typedef std::pair<const index_set_t, Scalar_T>
term_t;
157 template<
typename Other_Scalar_T, const index_t Other_LO, const index_t Other_HI >
159 template<
typename Other_Scalar_T, const index_t Other_LO, const index_t Other_HI >
167 std::less<const index_set_t>
168 #if defined(_GLUCAT_USE_BOOST_POOL_ALLOC)
169 , boost::fast_pool_allocator<term_t>
173 #if defined(_GLUCAT_USE_STD_UNORDERED_MAP)
174 typedef std::unordered_map< index_set_t, Scalar_T, index_set_hash<LO,HI> >
192 typedef std::pair< const multivector_t, const multivector_t >
211 template<
typename Other_Scalar_T >
214 template<
typename Other_Scalar_T >
216 const index_set_t frm,
const bool prechecked =
false);
219 const index_set_t frm,
const bool prechecked =
false);
224 const index_set_t frm,
const bool prechecked =
false);
231 const index_set_t frm,
const bool prechecked =
false);
236 const index_set_t frm,
const bool prechecked =
false);
242 const index_set_t frm,
const bool prechecked =
false)
243 { *
this =
framed_multi(std::string(str), frm, prechecked); };
245 template<
typename Other_Scalar_T >
248 template<
typename Other_Scalar_T >
283 operator<< <>(std::ostream& os,
const term_t& term);
309 public std::pair<index_set<LO,HI>, Scalar_T>
316 {
return "var_term"; };
330 this->second *= rhs.second * this->first.sign_of_mult(rhs.first);
331 this->first ^= rhs.first;
340 template<
typename Scalar_T, const index_t LO, const index_t HI >
348 template<
typename Scalar_T, const index_t LO, const index_t HI >
349 const std::pair<const index_set<LO,HI>, Scalar_T>
351 (
const std::pair<const index_set<LO,HI>, Scalar_T>& lhs,
352 const std::pair<const index_set<LO,HI>, Scalar_T>& rhs);
355 template<
typename Scalar_T, const index_t LO, const index_t HI >
360 template<
typename Scalar_T, const index_t LO, const index_t HI >
365 template<
typename Scalar_T, const index_t LO, const index_t HI >
373 template <
typename Scalar_T, const glucat::index_t LO, const glucat::index_t HI>
374 struct numeric_limits<
glucat::framed_multi<Scalar_T,LO,HI> > :
375 public numeric_limits<Scalar_T>
378 #endif // _GLUCAT_FRAMED_MULTI_H