Go to the documentation of this file. 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 >
76 template<
typename Scalar_T, const index_t LO, const index_t HI >
81 template<
typename Scalar_T, const index_t LO, const index_t HI >
86 template<
typename Scalar_T, const index_t LO, const index_t HI >
91 template<
typename Scalar_T, const index_t LO, const index_t HI >
96 template<
typename Scalar_T, const index_t LO, const index_t HI >
101 template<
typename Scalar_T, const index_t LO, const index_t HI >
106 template<
typename Scalar_T, const index_t LO, const index_t HI >
111 template<
typename Scalar_T, const index_t LO, const index_t HI >
116 template<
typename Scalar_T, const index_t LO, const index_t HI >
121 template<
typename Scalar_T, const index_t LO, const index_t HI >
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
multivector_t framed_multi_t
const Multivector< Scalar_T, LO, HI > operator%(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Left contraction.
class var_term var_term_t
std::pair< index_set< LO, HI >, Scalar_T > var_pair_t
map_t::size_type size_type
index_set< LO, HI > index_set_t
multivector_t & centre_qp1_pm1(index_t &p, index_t &q)
Subalgebra isomorphism: R_{p,q} to R_{q+1,p-1}.
framed_multi multivector_t
map_t::const_iterator const_iterator
const Multivector< Scalar_T, LO, HI > operator|(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Transformation via twisted adjoint action.
var_term_t & operator*=(const term_t &rhs)
Product of variable term and term.
matrix_multi_t::matrix_t matrix_t
static const std::string classname()
Class name used in messages.
~framed_multi()
Destructor.
static const std::string classname()
Class name used in messages.
int index_t
Size of index_t should be enough to represent LO, HI.
std::pair< const multivector_t, const multivector_t > framed_pair_t
hash_size_t(size_t hash_size)
std::vector< Scalar_T > vector_t
Index set class based on std::bitset<> in Gnu standard C++ library.
ublas::compressed_matrix< Scalar_T, orientation_t > matrix_t
std::istream & operator>>(std::istream &s, framed_multi< Scalar_T, LO, HI > &val)
Read multivector from input.
std::unordered_map< index_set_t, Scalar_T, index_set_hash< LO, HI > > map_t
std::ostream & operator<<(std::ostream &os, const framed_multi< Scalar_T, LO, HI > &val)
Write multivector to output.
Scalar_T star(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Hestenes scalar product.
var_term()
Default constructor.
multivector_t & centre_pp4_qm4(index_t &p, index_t &q)
Subalgebra isomorphism: R_{p,q} to R_{p+4,q-4}.
framed_multi(const char *str, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a char*: eg: "3+2{1,2}-6.1e-2{2,...
index_set< LO, HI > index_set_t
static Scalar_T crd_of_mult(const std::pair< const index_set< LO, HI >, Scalar_T > &lhs, const std::pair< const index_set< LO, HI >, Scalar_T > &rhs)
Coordinate of product of terms.
const Multivector< Scalar_T, LO, HI > operator/(const Multivector< Scalar_T, LO, HI > &lhs, const Scalar_T &scr)
Quotient of multivector and scalar.
#define _GLUCAT_CLIFFORD_ALGEBRA_OPERATIONS
std::pair< const index_set_t, Scalar_T > term_t
multivector_t unfold(const index_set_t frm) const
Subalgebra isomorphism: unfold each term within the given frame.
const Multivector< Scalar_T, LO, HI > sqrt(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Square root of multivector with specified complexifier.
size_t operator()(index_set_t val) const
multivector_t fold(const index_set_t frm) const
Subalgebra isomorphism: fold each term within the given frame.
framed_multi(const char *str)
Construct a multivector from a char*: eg: "3+2{1,2}-6.1e-2{2,3}".
A matrix_multi<Scalar_T,LO,HI> is a matrix approximation to a multivector.
Specific exception class.
A framed_multi<Scalar_T,LO,HI> is a framed approximation to a multivector.
friend class framed_multi
const Multivector< Scalar_T, LO, HI > log(const Multivector< Scalar_T, LO, HI > &val, const Multivector< Scalar_T, LO, HI > &i, const bool prechecked=false)
Natural logarithm of multivector with specified complexifier.
const Multivector< Scalar_T, LO, HI > operator*(const Multivector< Scalar_T, LO, HI > &lhs, const Scalar_T &scr)
Product of multivector and scalar.
const Multivector< Scalar_T, LO, HI > odd(const Multivector< Scalar_T, LO, HI > &val)
Odd part.
const Multivector< Scalar_T, LO, HI > operator&(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Inner product.
var_term(const index_set_t ist, const Scalar_T &crd=Scalar_T(1))
Construct a variable term from an index set and a scalar coordinate.
error< multivector_t > error_t
matrix_multi< Scalar_T, LO, HI > matrix_multi_t
size_t operator()() const
const matrix_t fast(const index_t level, const bool odd) const
Generalized FFT from framed_multi_t to matrix_t.
std::map< index_set_t, Scalar_T, std::less< const index_set_t > > sorted_map_t
const framed_multi_t fast_framed_multi() const
Use inverse generalized FFT to construct a framed_multi_t.
const matrix_multi< Other_Scalar_T, LO, HI > fast_matrix_multi(const index_set_t frm) const
Use generalized FFT to construct a matrix_multi_t.
size_t hash_fn() const
Hash function.
static const framed_multi_t random(const index_set_t frm, Scalar_T fill=Scalar_T(1))
Random multivector within a frame.
_GLUCAT_CLIFFORD_ALGEBRA_OPERATIONS unsigned long nbr_terms() const
Number of terms.
multivector_t & operator+=(const term_t &term)
Add a term, if non-zero.
const framed_multi< Scalar_T, LO, HI > exp(const framed_multi< Scalar_T, LO, HI > &val)
Exponential of multivector.
const Multivector< Scalar_T, LO, HI > operator^(const Multivector< Scalar_T, LO, HI > &lhs, const RHS< Scalar_T, LO, HI > &rhs)
Outer product.
multivector_t & centre_pm4_qp4(index_t &p, index_t &q)
Subalgebra isomorphism: R_{p,q} to R_{p-4,q+4}.
const framed_pair_t divide(const index_set_t ist) const
Divide multivector into part divisible by index_set and remainder.