versor  3.0
C++11 library for Geometric algebra
vsr_multivector.h
Go to the documentation of this file.
1 
25 #ifndef MV_H_INCLUDED
26 #define MV_H_INCLUDED
27 
28 
29 #include "vsr_algebra.h" //<-- algebra implementation details (EGA, MGA, CGA)
30 
31 #include <math.h>
32 #include <iostream>
33 
34 
35 
40 namespace vsr{
41 
42 
54  template<typename algebra_type, typename basis_type>
55  struct Multivector{
56 
57  using algebra = algebra_type;
58  using basis = basis_type;
59 
60  static const int Num = basis::Num;
61 
62  using value_t = typename algebra::value_t;
63  using space = typename algebra::types;
64 
65  template<class B> using MultivectorB = Multivector<algebra,B>;
66 
68  using Dual = typename algebra::template make_gp< typename blade<algebra::dim,algebra::dim>::type, basis>;
70  using DualE = typename algebra::template make_gp< Basis<bits::pss(algebra::dim-2)>, basis>;
71 
73  typedef const value_t array_type[Num];
74 
75  array_type& begin() const { return val; }
76 
78  constexpr value_t operator[] (int idx) const{
79  return val[idx];
80  }
82  value_t& operator[] (int idx){
83  return val[idx];
84  }
85 
87  template<typename...Args>
88  constexpr explicit Multivector(Args...v) :
89  val{ static_cast<value_t>(v)...} {}
90 
92  template<typename B>
93  constexpr Multivector( const Multivector<algebra,B>& b) : Multivector(b.template cast<Multivector<algebra,basis>>()) {}
94 
96  template<class alg, typename B>
97  constexpr Multivector( const Multivector<alg, B>& b ) : Multivector( b.template cast<Multivector<algebra,basis>>() ) {}
98 
100  template<bits::type IDX> value_t get() const;
102  template<bits::type IDX> value_t& get();
104  template<bits::type IDX> Multivector& set(value_t v);
105 
107  Multivector& reset(value_t v = value_t()){
108  std::fill( &(val[0]), &(val[0]) + basis::Num, v);
109  return *this;
110  }
111 
113  Multivector conjugation() const;
115  Multivector conj() const { return conjugation(); }
117  Multivector involution() const;
119  Multivector inv() const { return involution(); }
120 
122  template<class B> B cast() const;
124  template<class B> B copy() const;
125 
127  bool operator == (const Multivector& mv) const{
128  for (int i = 0; i < Num; ++i) {
129  if (val[i] != mv[i]) return false;
130  }
131  return true;
132  }
133 
135  void print(){
136  basis::print();
137  VPrint::Call( *this );
138  }
139 
140 
141  /*-----------------------------------------------------------------------------
142  * Dispatched functions (called by AlgebraImpl see core/vsr_algebra.h)
143  *-----------------------------------------------------------------------------*/
145  template<class B>
146  auto operator * ( const MultivectorB<B>& b) const -> decltype( algebra::gp(*this,b)) {
147  return algebra::gp(*this, b);
148  }
149 
151  template<class B>
152  Multivector& operator *= ( const MultivectorB<B>& b) {
153  *this = *this * b;
154  return *this;
155  }
156 
158  template<class B>
159  auto operator ^ ( const MultivectorB<B>& b) const-> decltype( algebra::op(*this,b)) {
160  return algebra::op(*this, b);
161  }
162 
165  template<class B>
166  auto operator <= ( const MultivectorB<B>& b) const-> decltype( algebra::ip(*this,b)) {
167  return algebra::ip(*this, b);
168  }
169 
171  template<class B>
172  auto operator % (const MultivectorB<B>& b ) const -> decltype( algebra::gp(*this,b) ){
173  return ( (*this * b) - (b * (*this) ) ) * .5;
174  }
175 
177  template<typename B>
178  Multivector spin( const MultivectorB<B>& b ) const { return algebra::spin(*this,b); }
180  template<typename B>
181  Multivector reflect( const MultivectorB<B>& b ) const { return algebra::reflect(*this,b); }
182 
183  template<typename B> Multivector sp( const MultivectorB<B>& b) const { return spin(b); }
184  template<typename B> Multivector re( const MultivectorB<B>& b) const { return reflect(b); }
185 
187  Multivector operator ~() const {
188  return Reverse< basis >::Type::template Make(*this) ;
189  }
190 
192  Multivector operator !() const {
193  Multivector tmp = ~(*this);
194  value_t v = ((*this) * tmp)[0];
195  return (v==0) ? tmp : tmp / v;
196  }
197 
198  // Division \\(A/B\\)
199  template<class B>
200  auto operator / (const MultivectorB<B>& b) const RETURNS(
201  ( *this * !b )
202  )
203 
204  /*-----------------------------------------------------------------------------
205  * Transformations (note mostly here for conformal metric)
206  * for instance null() only works in conformal metric (returns identity in others)
207  * these are all defined in vsr_generic_op.h or in vsr_cga3D_op.h
208  *-----------------------------------------------------------------------------*/
209 
210 
211  Multivector<algebra, typename algebra::vector_basis > null() const;
212 
215  template<class B>
216  Multivector rot ( const MultivectorB<B>& b ) const;
217  template<class B>
218  Multivector rotate ( const MultivectorB<B>& b ) const;
220 
221  template<class B>
222  Multivector trs ( const MultivectorB<B>& b ) const;
223  template<class B>
224  Multivector translate ( const MultivectorB<B>& b ) const;
225 
226 
227  template<class ... Ts>
228  Multivector trs ( Ts ... v ) const;
229  template<class ... Ts>
230  Multivector translate ( Ts ... v ) const;
231 
232  template<class B>
233  Multivector trv ( const MultivectorB<B>& b ) const;
234  template<class B>
235  Multivector transverse ( const MultivectorB<B>& b ) const;
236 
237  template<class ... Ts>
238  Multivector trv ( Ts ... v ) const;
239  template<class ... Ts>
240  Multivector transverse ( Ts ... v ) const;
241 
242  template<class B>
243  Multivector mot ( const MultivectorB<B>& b) const;
244  template<class B>
245  Multivector motor ( const MultivectorB<B>& b) const;
246  template<class B>
247  Multivector twist ( const MultivectorB<B>& b) const;
248 
249  template<class B>
250  Multivector bst ( const MultivectorB<B>& b ) const;
251  template<class B>
252  Multivector boost ( const MultivectorB<B>& b ) const;
253 
254  template<class B>
255  Multivector dil ( const MultivectorB<B>& b, VSR_PRECISION t ) const;
256  template<class B>
257  Multivector dilate ( const MultivectorB<B>& b, VSR_PRECISION t ) const;
258 
259 
260  /*-----------------------------------------------------------------------------
261  * Duality
262  *-----------------------------------------------------------------------------*/
263  auto dual() const -> Dual {
264  return algebra::gp( *this , typename space::Pss(-1) );
265  }
266 
267  auto undual() const -> Dual {
268  return algebra::gp( *this ,typename space::Pss(1) );
269  }
270 
271  auto duale() const -> DualE{
272  return algebra::gp( *this ,typename space::Euc(-1) );
273  }
274 
275  auto unduale() const -> DualE{
276  return algebra::gp( *this ,typename space::Euc(1) );
277  }
278 
279 
280  /*-----------------------------------------------------------------------------
281  * Weights and Units
282  *-----------------------------------------------------------------------------*/
283  value_t wt() const{ return (*this <= *this)[0]; }
284  value_t rwt() const{ return (*this <= ~(*this))[0]; }
285  value_t norm() const { value_t a = rwt(); if(a<0) return 0; return sqrt( a ); }
286  value_t rnorm() const{ value_t a = rwt(); if(a<0) return -sqrt( -a ); return sqrt( a ); }
287 
288  Multivector unit() const { value_t t = sqrt( fabs( (*this <= *this)[0] ) ); if (t == 0) return Multivector(); return *this / t; }
289  Multivector runit() const { value_t t = rnorm(); if (t == 0) return Multivector(); return *this / t; }
290  Multivector tunit() const { value_t t = norm(); if (t == 0) return Multivector(); return *this / t; }
291 
292 
293  /*-----------------------------------------------------------------------------
294  * Sums
295  *-----------------------------------------------------------------------------*/
296  template<class B>
297  auto operator + (const MultivectorB<B>& b) -> decltype( algebra::sum(*this, b) ) {
298  return algebra::sum(*this,b);
299  }
300 
301 
302  Multivector operator + (const Multivector& a) const {
303  Multivector tmp;
304  for (int i = 0; i < Num; ++i) tmp[i] = (*this)[i] + a[i];
305  return tmp;
306  }
307 
308  Multivector operator - (const Multivector& a) const {
309  Multivector tmp;
310  for (int i = 0; i < Num; ++i) tmp[i] = (*this)[i] - a[i];
311  return tmp;
312  }
313 
314  Multivector operator -() const{
315  Multivector tmp = *this;
316  for (int i = 0; i < Num; ++i){ tmp[i] = -tmp[i]; }
317  return tmp;
318  }
319 
320  Multivector& operator -=(const Multivector& b){
321  for (int i = 0; i < Num; ++i) (*this)[i] -= b[i];
322  return *this;
323  }
324  Multivector& operator +=(const Multivector& b){
325  for (int i = 0; i < Num; ++i) (*this)[i] += b[i];
326  return *this;
327  }
328 
329  Multivector operator / (VSR_PRECISION f) const{
330  Multivector tmp = *this;
331  for (int i = 0; i < Num; ++i){ tmp[i] /= f; }
332  return tmp;
333  }
334 
335  Multivector& operator /= (VSR_PRECISION f){
336  for (int i = 0; i < Num; ++i){ (*this)[i] /= f; }
337  return *this;
338  }
339 
340  Multivector operator * (VSR_PRECISION f) const {
341  Multivector tmp = *this;
342  for (int i = 0; i < Num; ++i){ tmp[i] *= f; }
343  return tmp;
344  }
345  Multivector& operator *= (VSR_PRECISION f){
346  for (int i = 0; i < Num; ++i){ (*this)[i] *= f; }
347  return *this;
348  }
349 
350  auto operator + (VSR_PRECISION a) const -> decltype( algebra::sumv( a, *this) ) {
351  return algebra::sumv(a, *this);
352  }
353 
354  static Multivector x,y,z,xy,xz,yz;
355 
356  friend ostream& operator << (ostream& os, const Multivector& m){
357  for (int i=0; i < Num; ++i){
358  os << m[i] << "\t";//std::endl;
359  }
360  return os;
361  }
362  };
363 
364 
365 
366 /*-----------------------------------------------------------------------------
367  * CONVERSIONS (CASTING, COPYING)
368  *-----------------------------------------------------------------------------*/
369 template<typename Algebra, typename B> template<class A>
371  return Cast< typename A::basis, B >::Type::template doCast<A>( *this );
372 }
373 
374 template<typename Algebra, typename B> template<class A>
376  A tmp;
377  for (int i = 0; i < A::basis::Num; ++i) tmp[i] = (*this)[i];
378  return tmp;
379 }
380 
381 
382 /*-----------------------------------------------------------------------------
383  * GETTERS AND SETTERS
384  *-----------------------------------------------------------------------------*/
385 template<typename Algebra, typename B> template<bits::type IDX>
386 typename Algebra::value_t & Multivector<Algebra,B>::get(){
387  return val[ find(IDX, B()) ];
388 }
389 template<typename Algebra, typename B> template<bits::type IDX>
390 typename Algebra::value_t Multivector<Algebra,B>::get() const{
391  return val[ find(IDX, B()) ];
392 }
393 template<typename Algebra, typename B> template<bits::type IDX>
394 Multivector<Algebra,B>& Multivector<Algebra,B>::set( typename Algebra::value_t v){
395  get<IDX>() = v;
396  return *this;
397 }
398 
399 template<typename Algebra, typename B>
400 Multivector<Algebra,B> Multivector<Algebra,B>::x = Multivector<Algebra,B>().template set<1>(1);
401 
402 template<typename Algebra, typename B>
403 Multivector<Algebra,B> Multivector<Algebra,B>::y = Multivector<Algebra,B>().template set<2>(1);
404 
405 template<typename Algebra, typename B>
406 Multivector<Algebra,B> Multivector<Algebra,B>::z = Multivector<Algebra,B>().template set<4>(1);
407 
408 template<typename Algebra, typename B>
409 Multivector<Algebra,B> Multivector<Algebra,B>::xy = Multivector<Algebra,B>().template set<3>(1);
410 
411 template<typename Algebra, typename B>
412 Multivector<Algebra,B> Multivector<Algebra,B>::xz = Multivector<Algebra,B>().template set<5>(1);
413 
414 template<typename Algebra, typename B>
415 Multivector<Algebra,B> Multivector<Algebra,B>::yz = Multivector<Algebra,B>().template set<6>(1);
416 
417 
418 
419 
420 /*-----------------------------------------------------------------------------
421  * UNARY OPERATIONS
422  *-----------------------------------------------------------------------------*/
423 template<typename Algebra, typename B>
425  return Conjugate<B>::Type::template Make(*this);
426 }
427 template<typename Algebra, typename B>
429  return Involute<B>::Type::template Make(*this);
430 }
431 
432 
433 
434 template<typename algebra> using GASca = Multivector< algebra, typename algebra::types::sca >;
435 template<typename algebra> using GAVec = Multivector< algebra, typename algebra::types::vec >;
436 template<typename algebra> using GABiv = Multivector< algebra, typename algebra::types::biv >;
437 template<typename algebra> using GATri = Multivector< algebra, typename algebra::types::tri >;
438 template<typename algebra> using GAPnt = Multivector< algebra, typename algebra::types::pnt >;
439 template<typename algebra> using GADls = Multivector< algebra, typename algebra::types::dls >;
440 template<typename algebra> using GAPar = Multivector< algebra, typename algebra::types::par >;
441 template<typename algebra> using GACir = Multivector< algebra, typename algebra::types::cir >;
442 template<typename algebra> using GASph = Multivector< algebra, typename algebra::types::sph >;
443 template<typename algebra> using GAFlp = Multivector< algebra, typename algebra::types::flp >;
444 template<typename algebra> using GADll = Multivector< algebra, typename algebra::types::dll >;
445 template<typename algebra> using GALin = Multivector< algebra, typename algebra::types::lin >;
446 template<typename algebra> using GADlp = Multivector< algebra, typename algebra::types::dlp >;
447 template<typename algebra> using GAPln = Multivector< algebra, typename algebra::types::pln >;
448 template<typename algebra> using GAMnk = Multivector< algebra, typename algebra::types::mnk >;
449 template<typename algebra> using GAInf = Multivector< algebra, typename algebra::types::inf >;
450 template<typename algebra> using GAOri = Multivector< algebra, typename algebra::types::ori >;
451 template<typename algebra> using GAPss = Multivector< algebra, typename algebra::types::pss >;
452 template<typename algebra> using GATnv = Multivector< algebra, typename algebra::types::tnv >;
453 template<typename algebra> using GADrv = Multivector< algebra, typename algebra::types::drv >;
454 template<typename algebra> using GATnb = Multivector< algebra, typename algebra::types::tnb >;
455 template<typename algebra> using GADrb = Multivector< algebra, typename algebra::types::drb >;
456 template<typename algebra> using GATnt = Multivector< algebra, typename algebra::types::tnt >;
457 template<typename algebra> using GADrt = Multivector< algebra, typename algebra::types::drt >;
458 template<typename algebra> using GARot = Multivector< algebra, typename algebra::types::rot >;
459 template<typename algebra> using GATrs = Multivector< algebra, typename algebra::types::trs >;
460 template<typename algebra> using GADil = Multivector< algebra, typename algebra::types::dil >;
461 template<typename algebra> using GAMot = Multivector< algebra, typename algebra::types::mot >;
462 template<typename algebra> using GABst = Multivector< algebra, typename algebra::types::bst >;
463 template<typename algebra> using GATrv = Multivector< algebra, typename algebra::types::trv >;
464 template<typename algebra> using GACon = Multivector< algebra, typename algebra::types::con >;
465 template<typename algebra> using GATsd = Multivector< algebra, typename algebra::types::tsd >;
466 template<typename algebra> using GAEucPss = Multivector< algebra, typename algebra::types::eucpss >;
467 
468 template<typename algebra>
469 struct GAE{
470  template <bits::type ... NN> using e = typename algebra::types::template e<NN...>;// Multivector<algebra, typename algebra::types::e_basis::template e<NN...> >;
471 };
472 
473 template<bits::type N, typename T=VSR_PRECISION> using euclidean = algebra< metric<N>,T>;
474 template<bits::type N, typename T=VSR_PRECISION> using conformal = algebra< metric<N-1,1,true>,T>;
475 
476 /*-----------------------------------------------------------------------------
477  * EUCLIDEAN TEMPLATE ALIAS UTILITY
478  *-----------------------------------------------------------------------------*/
479 
480 template<bits::type N, typename T=VSR_PRECISION> using NESca = GASca< euclidean<N,T> >;
481 template<bits::type N, typename T=VSR_PRECISION> using NEVec = GAVec< euclidean<N,T> >;
482 template<bits::type N, typename T=VSR_PRECISION> using NEBiv = GABiv< euclidean<N,T> >;
483 template<bits::type N, typename T=VSR_PRECISION> using NETri = GATri< euclidean<N,T> >;
484 template<bits::type N, typename T=VSR_PRECISION> using NERot = GARot< euclidean<N,T> >;
485 
486 template<bits::type dim, typename T=VSR_PRECISION> using euclidean_vector = GAVec< euclidean<dim,T> >;
487 template<bits::type dim, typename T=VSR_PRECISION> using euclidean_bivector = GABiv< euclidean<dim,T> >;
488 template<bits::type dim, typename T=VSR_PRECISION> using euclidean_trivector = GATri< euclidean<dim,T> >;
489 template<bits::type dim, typename T=VSR_PRECISION> using euclidean_rotor = GARot< euclidean<dim,T> >;
490 
491 template<typename T=VSR_PRECISION>
492 struct NE{
493  template <bits::type ... NN> using e = typename GAE< euclidean<bits::dimOf( bits::blade((1<<(NN-1))...) ), T >>::template e<NN...>;
494 };
495 //
496 
498 // * CONFORMAL TEMPLATE ALIAS UTILITY
499 // *-----------------------------------------------------------------------------*/
500 
501 template<bits::type N, typename T=VSR_PRECISION> using NSca = GASca<conformal<N,T>>;
502 template<bits::type N, typename T=VSR_PRECISION> using NVec = GAVec<conformal<N,T>>;
503 template<bits::type N, typename T=VSR_PRECISION> using NBiv = GABiv<conformal<N,T>>;
504 template<bits::type N, typename T=VSR_PRECISION> using NPnt = GAPnt<conformal<N,T>>;
505 template<bits::type N, typename T=VSR_PRECISION> using NBst = GABst<conformal<N,T>>;
506 template<bits::type N, typename T=VSR_PRECISION> using NPar = GAPar<conformal<N,T>>;
507 template<bits::type N, typename T=VSR_PRECISION> using NCir = GACir<conformal<N,T>>;
508 template<bits::type N, typename T=VSR_PRECISION> using NRot = GARot<conformal<N,T>>;
509 template<bits::type N, typename T=VSR_PRECISION> using NTnv = GATnv<conformal<N,T>>;
510 template<bits::type N, typename T=VSR_PRECISION> using NTrv = GATrv<conformal<N,T>>;
511 template<bits::type N, typename T=VSR_PRECISION> using NTrs = GATrs<conformal<N,T>>;
512 template<bits::type N, typename T=VSR_PRECISION> using NDrv = GADrv<conformal<N,T>>;
513 template<bits::type N, typename T=VSR_PRECISION> using NDil = GADil<conformal<N,T>>;
514 template<bits::type N, typename T=VSR_PRECISION> using NTsd = GATsd<conformal<N,T>>;
515 template<bits::type N, typename T=VSR_PRECISION> using NOri = GAOri<conformal<N,T>>;
516 template<bits::type N, typename T=VSR_PRECISION> using NInf = GAInf<conformal<N,T>>;
517 template<bits::type N, typename T=VSR_PRECISION> using NDls = GADls<conformal<N,T>>;
518 template<bits::type N, typename T=VSR_PRECISION> using NDll = GADll<conformal<N,T>>;
519 template<bits::type N, typename T=VSR_PRECISION> using NLin = GALin<conformal<N,T>>;
520 template<bits::type N, typename T=VSR_PRECISION> using NMnk = GAMnk<conformal<N,T>>;
521 template<bits::type N, typename T=VSR_PRECISION> using NPss = GAPss<conformal<N,T>>;
522 template<bits::type N, typename T=VSR_PRECISION> using NSph = GASph<conformal<N,T>>;
523 template<bits::type N, typename T=VSR_PRECISION> using NTri = GATri<conformal<N,T>>;
524 template<bits::type N, typename T=VSR_PRECISION> using NFlp = GAFlp<conformal<N,T>>;
525 template<bits::type N, typename T=VSR_PRECISION> using NPln = GAPln<conformal<N,T>>;
526 template<bits::type N, typename T=VSR_PRECISION> using NDlp = GADlp<conformal<N,T>>;
527 template<bits::type N, typename T=VSR_PRECISION> using NDrb = GADrb<conformal<N,T>>;
528 template<bits::type N, typename T=VSR_PRECISION> using NTnb = GATnb<conformal<N,T>>;
529 template<bits::type N, typename T=VSR_PRECISION> using NTnt = GATnt<conformal<N,T>>;
530 template<bits::type N, typename T=VSR_PRECISION> using NDrt = GADrt<conformal<N,T>>;
531 template<bits::type N, typename T=VSR_PRECISION> using NMot = GAMot<conformal<N,T>>;
532 template<bits::type N, typename T=VSR_PRECISION> using NCon = GACon<conformal<N,T>>;
533 
534 
535 template<bits::type N, typename T=VSR_PRECISION> using conformal_scalar = GASca<conformal<N,T>>;
536 template<bits::type N, typename T=VSR_PRECISION> using conformal_vector = GAVec<conformal<N,T>>;
537 template<bits::type N, typename T=VSR_PRECISION> using conformal_Biv = GABiv<conformal<N,T>>;
538 template<bits::type N, typename T=VSR_PRECISION> using conformal_Pnt = GAPnt<conformal<N,T>>;
539 template<bits::type N, typename T=VSR_PRECISION> using conformal_Bst = GABst<conformal<N,T>>;
540 template<bits::type N, typename T=VSR_PRECISION> using conformal_Par = GAPar<conformal<N,T>>;
541 template<bits::type N, typename T=VSR_PRECISION> using conformal_Cir = GACir<conformal<N,T>>;
542 template<bits::type N, typename T=VSR_PRECISION> using conformal_Rot = GARot<conformal<N,T>>;
543 template<bits::type N, typename T=VSR_PRECISION> using conformal_Tnv = GATnv<conformal<N,T>>;
544 template<bits::type N, typename T=VSR_PRECISION> using conformal_Trv = GATrv<conformal<N,T>>;
545 template<bits::type N, typename T=VSR_PRECISION> using conformal_Trs = GATrs<conformal<N,T>>;
546 template<bits::type N, typename T=VSR_PRECISION> using conformal_Drv = GADrv<conformal<N,T>>;
547 template<bits::type N, typename T=VSR_PRECISION> using conformal_Dil = GADil<conformal<N,T>>;
548 template<bits::type N, typename T=VSR_PRECISION> using conformal_Tsd = GATsd<conformal<N,T>>;
549 template<bits::type N, typename T=VSR_PRECISION> using conformal_Ori = GAOri<conformal<N,T>>;
550 template<bits::type N, typename T=VSR_PRECISION> using conformal_Inf = GAInf<conformal<N,T>>;
551 template<bits::type N, typename T=VSR_PRECISION> using conformal_Dls = GADls<conformal<N,T>>;
552 template<bits::type N, typename T=VSR_PRECISION> using conformal_Dll = GADll<conformal<N,T>>;
553 template<bits::type N, typename T=VSR_PRECISION> using conformal_Lin = GALin<conformal<N,T>>;
554 template<bits::type N, typename T=VSR_PRECISION> using conformal_Mnk = GAMnk<conformal<N,T>>;
555 template<bits::type N, typename T=VSR_PRECISION> using conformal_Pss = GAPss<conformal<N,T>>;
556 template<bits::type N, typename T=VSR_PRECISION> using conformal_Sph = GASph<conformal<N,T>>;
557 template<bits::type N, typename T=VSR_PRECISION> using conformal_Tri = GATri<conformal<N,T>>;
558 template<bits::type N, typename T=VSR_PRECISION> using conformal_Flp = GAFlp<conformal<N,T>>;
559 template<bits::type N, typename T=VSR_PRECISION> using conformal_Pln = GAPln<conformal<N,T>>;
560 template<bits::type N, typename T=VSR_PRECISION> using conformal_Dlp = GADlp<conformal<N,T>>;
561 template<bits::type N, typename T=VSR_PRECISION> using conformal_Drb = GADrb<conformal<N,T>>;
562 template<bits::type N, typename T=VSR_PRECISION> using conformal_Tnb = GATnb<conformal<N,T>>;
563 template<bits::type N, typename T=VSR_PRECISION> using conformal_Tnt = GATnt<conformal<N,T>>;
564 template<bits::type N, typename T=VSR_PRECISION> using conformal_Drt = GADrt<conformal<N,T>>;
565 template<bits::type N, typename T=VSR_PRECISION> using conformal_Mot = GAMot<conformal<N,T>>;
566 template<bits::type N, typename T=VSR_PRECISION> using conformal_Con = GACon<conformal<N,T>>;
567 
568 
569 } //vsr::
570 
571 #endif
572 
573 
574 
575 
B cast() const
Casting to type B.
Multivector involution() const
Involution Unary Operation.
Definition: vsr_multivector.h:428
Multivector & operator*=(const MultivectorB< B > &b)
Geometric Product in place Transformation.
Definition: vsr_multivector.h:152
auto operator%(const MultivectorB< B > &b) const -> decltype(algebra::gp(*this, b))
Commutator Product \(a \times b\)
Definition: vsr_multivector.h:172
constexpr value_t operator[](int idx) const
Get value at idx
Definition: vsr_multivector.h:78
static const int dim
– Dimension of Algebra (2,3,4,5,etc)
Definition: vsr_algebra.h:102
Multivector spin(const MultivectorB< B > &b) const
Rotor (even) transformation \(RA\tilde{R}\)
Definition: vsr_multivector.h:178
static const int Num
number of bases
Definition: vsr_multivector.h:60
An algebra instance is templated on:
Definition: vsr_algebra.h:96
Generic Geometric Number Types (templated on an algebra and a basis )
Definition: vsr_algebra.h:69
static mv_t< typename ICat< typename NotType< Basis< 0 >, B >::Type, Basis< 0 > >::Type > sumv(VSR_PRECISION a, const mv_t< B > &b)
Sum some scalar value.
Definition: vsr_algebra.h:165
Multivector< algebra, B > MultivectorB
another Type within same algebra
Definition: vsr_multivector.h:65
Multivector< algebra, typename algebra::vector_basis > null() const
Conformal Mapping \(\boldsymbol(x)\to n_o + \boldsymbol{x} + \boldsymbol{x}^2n_\infty \) ...
Definition: vsr_generic_op.h:1118
basis_type basis
basis is an algebraic data type created with compile-time list processing
Definition: vsr_multivector.h:58
Multivector operator~() const
Reversion \(\tilde{A}\)
Definition: vsr_multivector.h:187
typename algebra::template make_gp< typename blade< algebra::dim, algebra::dim >::type, basis > Dual
the Dual Type (product of this and algebra::types::pseudoscalar)
Definition: vsr_multivector.h:68
named_types< impl > types
certain prenamed types in euclidean and conformal
Definition: vsr_algebra.h:230
void print()
Printing.
Definition: vsr_multivector.h:135
Definition: vsr_multivector.h:469
Multivector operator!() const
Inversion \(\tilde{A}/A\tilde{A}\)
Definition: vsr_multivector.h:192
typename algebra::types space
<>::::<>
Definition: vsr_multivector.h:63
auto operator*(const MultivectorB< B > &b) const -> decltype(algebra::gp(*this, b))
Geometric Product \(a*b\)
Definition: vsr_multivector.h:146
NPss< 5 > Pss
Pseudoscalar
Definition: vsr_cga3D_types.h:70
static constexpr A reflect(const A &a, const B &b)
Reflect a by b, return type a.
Definition: vsr_algebra.h:203
constexpr Multivector(Args...v)
Construct from list of args (cannot be longer than Num)
Definition: vsr_multivector.h:88
Multivector inv() const
Involution Unary Operation Shorthand.
Definition: vsr_multivector.h:119
N+1 algebra
algebra (a metric and field)
Definition: vsr_multivector.h:57
implementations of algebras (Euclidean, PQ-metric, and conformal)
constexpr Multivector(const Multivector< algebra, B > &b)
Construct from different Basis within same Algebra.
Definition: vsr_multivector.h:93
Multivector & set(value_t v)
Set value of blade type IDX
auto operator^(const MultivectorB< B > &b) const -> decltype(algebra::op(*this, b))
Outer Product \(a \wedge b\)
Definition: vsr_multivector.h:159
Multivector conjugation() const
Conjugation Unary Operation.
Definition: vsr_multivector.h:424
Definition: vsr_multivector.h:492
the versor library namespace
Definition: vsr_algebra.h:29
Multivector rot(const MultivectorB< B > &b) const
B copy() const
Copying to type B.
static constexpr A spin(const A &a, const B &b)
Spin a by b, return type a.
Definition: vsr_algebra.h:194
Multivector conj() const
Conjugation Unary Operation Shorthand.
Definition: vsr_multivector.h:115
typename algebra::value_t value_t
the field over which the algebra is defined (e.g. float or double)
Definition: vsr_multivector.h:62
bool operator==(const Multivector &mv) const
Comparison.
Definition: vsr_multivector.h:127
constexpr Multivector(const Multivector< alg, B > &b)
Construct from different algebra signature and different basis.
Definition: vsr_multivector.h:97
const value_t array_type[Num]
Data Array Type
Definition: vsr_multivector.h:73
typename algebra::template make_gp< Basis< bits::pss(algebra::dim-2)>, basis > DualE
the Euclidan subspace Dual Type (product of this and algebra::types::euclidean_pseudoscalar) ...
Definition: vsr_multivector.h:70
Multivector & reset(value_t v=value_t())
Reset.
Definition: vsr_multivector.h:107
array_type & begin() const
Pointer to first data.
Definition: vsr_multivector.h:75
Multivector rotate(const MultivectorB< B > &b) const
value_t val[Num]
Data Array
Definition: vsr_multivector.h:72
Multivector reflect(const MultivectorB< B > &b) const
Versor (Odd) Transformation \(R\hat{A}\tilde{R}\)
Definition: vsr_multivector.h:181
value_t get() const
Immutable get value of blade type IDX (.
static mv_t< B > sum(const mv_t< B > &a, const mv_t< B > &b)
Sum of Similar types.
Definition: vsr_algebra.h:133
value_type value_t
– Field over which Algebra is Defined (e.g. float, double, complex)
Definition: vsr_algebra.h:100