1#ifndef _GLUCAT_MATRIX_MULTI_H
2#define _GLUCAT_MATRIX_MULTI_H
41#include <boost/numeric/ublas/fwd.hpp>
50 namespace ublas = boost::numeric::ublas;
54 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
57 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
61 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
63 operator* (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
66 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
68 operator^ (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
71 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
73 operator& (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
76 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
78 operator% (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
81 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
86 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
88 operator/ (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
91 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
93 operator| (
const matrix_multi<Scalar_T,LO,HI,Tune_P>& lhs,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& rhs) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
96 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
101 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
106 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
112 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
114 sqrt(
const matrix_multi<Scalar_T,LO,HI,Tune_P>& val,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& i,
bool prechecked) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
117 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
124 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
126 log(
const matrix_multi<Scalar_T,LO,HI,Tune_P>& val,
const matrix_multi<Scalar_T,LO,HI,Tune_P>& i,
bool prechecked) ->
const matrix_multi<Scalar_T,LO,HI,Tune_P>;
129 template<
typename Scalar_T, const index_t LO, const index_t HI,
typename Tune_P >
136 template<
typename Scalar_T =
double, const index_t LO = DEFAULT_LO, const index_t HI = DEFAULT_HI,
typename Tune_P = tuning<> >
138 public clifford_algebra< Scalar_T, index_set<LO,HI>, matrix_multi<Scalar_T,LO,HI,Tune_P> >
146 using term_t = std::pair<const index_set_t, Scalar_T>;
150 template<
typename Other_Scalar_T, const index_t Other_LO, const index_t Other_HI,
typename Other_Tune_P >
152 template<
typename Other_Scalar_T, const index_t Other_LO, const index_t Other_HI,
typename Other_Tune_P >
158 using matrix_t = ublas::matrix<Scalar_T, orientation_t>;
169 template<
typename Other_Scalar_T >
172 template<
typename Other_Scalar_T >
174 const index_set_t frm,
const bool prechecked =
false);
177 const index_set_t frm,
const bool prechecked =
false);
182 const index_set_t frm,
const bool prechecked =
false);
189 const index_set_t frm,
const bool prechecked =
false);
194 const index_set_t frm,
const bool prechecked =
false);
200 const index_set_t frm,
const bool prechecked =
false)
201 { *
this =
matrix_multi(std::string(str), frm, prechecked); };
203 template<
typename Other_Scalar_T >
206 template<
typename Other_Scalar_T >
208 const index_set_t frm,
const bool prechecked =
false);
212 template<
typename Other_Scalar_T >
217 template< typename Matrix_T >
254 template< typename Other_Scalar_T, const
index_t Other_LO, const
index_t Other_HI, typename Other_Tune_P >
257 matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>& lhs_reframed,
matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>& rhs_reframed) -> const
index_set<Other_LO,Other_HI>;
258 template< typename Other_Scalar_T, const
index_t Other_LO, const
index_t Other_HI, typename Other_Tune_P >
261 const
matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>& i,
263 -> const
matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>;
264 template< typename Other_Scalar_T, const
index_t Other_LO, const
index_t Other_HI, typename Other_Tune_P >
267 const
matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>& i,
269 -> const
matrix_multi<Other_Scalar_T,Other_LO,Other_HI,Other_Tune_P>;
286 template< typename Scalar_T, const
index_t LO, const
index_t HI, typename Tune_P >
295 template <
typename Scalar_T, const glucat::index_t LO, const glucat::index_t HI,
typename Tune_P >
297 public numeric_limits<Scalar_T>
clifford_algebra<> declares the operations of a Clifford algebra
Specific exception class.
friend class framed_multi
friend class matrix_multi
Index set class based on std::bitset<> in Gnu standard C++ library.
matrix_multi(const matrix_multi< Other_Scalar_T, LO, HI, Tune_P > &val)
Construct a multivector from a multivector with a different scalar type.
typename matrix_t::size_type matrix_index_t
matrix_multi(const std::string &str, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a string: eg: "3+2{1,2}-6.1e-2{2,...
ublas::row_major orientation_t
friend class framed_multi
matrix_multi(const vector_t &vec, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a given vector.
~matrix_multi() override=default
Destructor.
friend auto matrix_sqrt(const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &val, const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &i, const index_t level) -> const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P >
static auto classname() -> const std::string
Class name used in messages.
index_set< LO, HI > index_set_t
friend auto reframe(const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &lhs, const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &rhs, matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &lhs_reframed, matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &rhs_reframed) -> const index_set< Other_LO, Other_HI >
auto basis_element(const index_set< LO, HI > &ist) const -> const basis_matrix_t
matrix_multi(const char *str)
Construct a multivector from a char*: eg: "3+2{1,2}-6.1e-2{2,3}".
matrix_multi(const Scalar_T &scr, const index_set_t frm=index_set_t())
Construct a multivector from a scalar (within a frame, if given)
std::pair< const index_set_t, Scalar_T > term_t
matrix_multi(const index_set_t ist, const Scalar_T &crd, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from an index set and a scalar coordinate.
matrix_multi(const int scr, const index_set_t frm=index_set_t())
Construct a multivector from an int (within a frame, if given)
matrix_multi(const matrix_multi< Other_Scalar_T, LO, HI, Tune_P > &val, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a given multivector.
multivector_t matrix_multi_t
auto fast_framed_multi() const -> const framed_multi< Other_Scalar_T, LO, HI, Tune_P >
Use inverse generalized FFT to construct a framed_multi_t.
auto fast_matrix_multi(const index_set_t frm) const -> const matrix_multi_t
Use generalized FFT to construct a matrix_multi_t.
ublas::compressed_matrix< int, orientation_t > basis_matrix_t
matrix_multi(const index_set_t ist, const Scalar_T &crd=Scalar_T(1))
Construct a multivector from an index set and a scalar coordinate.
friend class matrix_multi
ublas::matrix< Scalar_T, orientation_t > matrix_t
matrix_multi(const multivector_t &val, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a given multivector.
matrix_multi(const framed_multi< Other_Scalar_T, LO, HI, Tune_P > &val)
Construct a multivector from a framed_multi_t.
matrix_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,...
matrix_multi multivector_t
friend auto star(const matrix_multi_t &lhs, const matrix_multi_t &rhs) -> Scalar_T
matrix_multi(const framed_multi< Other_Scalar_T, LO, HI, Tune_P > &val, const index_set_t frm, const bool prechecked=false)
Construct a multivector, within a given frame, from a framed_multi_t.
error< multivector_t > error_t
matrix_multi(const std::string &str)
Construct a multivector from a string: eg: "3+2{1,2}-6.1e-2{2,3}".
matrix_multi()
Default constructor.
std::vector< Scalar_T > vector_t
friend auto matrix_log(const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &val, const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P > &i, const index_t level) -> const matrix_multi< Other_Scalar_T, Other_LO, Other_HI, Other_Tune_P >
static auto random(const index_set_t frm, Scalar_T fill=Scalar_T(1)) -> const matrix_multi_t
framed_multi< Scalar_T, LO, HI, Tune_P > framed_multi_t
#define _GLUCAT_CLIFFORD_ALGEBRA_OPERATIONS
auto operator<<(std::ostream &os, const framed_multi< Scalar_T, LO, HI, Tune_P > &val) -> std::ostream &
Write multivector to output.
auto operator|(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const RHS< Scalar_T, LO, HI, Tune_P > &rhs) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Transformation via twisted adjoint action.
auto operator*(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const Scalar_T &scr) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Product of multivector and scalar.
auto operator&(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const RHS< Scalar_T, LO, HI, Tune_P > &rhs) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Inner product.
auto exp(const framed_multi< Scalar_T, LO, HI, Tune_P > &val) -> const framed_multi< Scalar_T, LO, HI, Tune_P >
Exponential of multivector.
auto operator%(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const RHS< Scalar_T, LO, HI, Tune_P > &rhs) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Left contraction.
auto reframe(const matrix_multi< Scalar_T, LO, HI, Tune_P > &lhs, const matrix_multi< Scalar_T, LO, HI, Tune_P > &rhs, matrix_multi< Scalar_T, LO, HI, Tune_P > &lhs_reframed, matrix_multi< Scalar_T, LO, HI, Tune_P > &rhs_reframed) -> const index_set< LO, HI >
Find a common frame for operands of a binary operator.
auto operator>>(std::istream &s, framed_multi< Scalar_T, LO, HI, Tune_P > &val) -> std::istream &
Read multivector from input.
int index_t
Size of index_t should be enough to represent LO, HI.
auto operator/(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const Scalar_T &scr) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Quotient of multivector and scalar.
auto log(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Natural logarithm of multivector with specified complexifier.
auto matrix_sqrt(const matrix_multi< Scalar_T, LO, HI, Tune_P > &val, const matrix_multi< Scalar_T, LO, HI, Tune_P > &i, const index_t level) -> const matrix_multi< Scalar_T, LO, HI, Tune_P >
Square root of multivector with specified complexifier.
auto star(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const RHS< Scalar_T, LO, HI, Tune_P > &rhs) -> Scalar_T
Hestenes scalar product.
auto operator^(const Multivector< Scalar_T, LO, HI, Tune_P > &lhs, const RHS< Scalar_T, LO, HI, Tune_P > &rhs) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Outer product.
auto matrix_log(const matrix_multi< Scalar_T, LO, HI, Tune_P > &val, const matrix_multi< Scalar_T, LO, HI, Tune_P > &i, const index_t level) -> const matrix_multi< Scalar_T, LO, HI, Tune_P >
Natural logarithm of multivector with specified complexifier.
auto sqrt(const Multivector< Scalar_T, LO, HI, Tune_P > &val, const Multivector< Scalar_T, LO, HI, Tune_P > &i, const bool prechecked=false) -> const Multivector< Scalar_T, LO, HI, Tune_P >
Square root of multivector with specified complexifier.