~kaktusjoe/spacetime/spacetime2.0.0-ubuntu18.05

« back to all changes in this revision

Viewing changes to src/AntisymmetricFourTensor.cpp

  • Committer: Joseph F. Boudreau
  • Date: 2018-01-05 17:09:07 UTC
  • Revision ID: boudreau@pitt.edu-20180105170907-jcxsjfkvnvpjdnrw
Tags: upstream-2.0.0
ImportĀ upstreamĀ versionĀ 2.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#include "Spacetime/AntisymmetricFourTensor.h"
 
2
#include "Spacetime/LorentzTransformation.h"
 
3
 
 
4
#include "Eigen/Dense"
 
5
 
 
6
// Lorentz Transformation:
 
7
AntisymmetricFourTensor operator *(const LorentzTransformation & L, const AntisymmetricFourTensor & v) {
 
8
  typedef std::complex<double> Complex;
 
9
  Complex I(0,1);
 
10
  const double sqrt2=sqrt(2.0), sqrt8=sqrt(8);
 
11
  
 
12
  Eigen::Vector3cd
 
13
    S1((-v(1,0)-I*v(3,2) + I*v(2,0)-v(1,3))/sqrt2,
 
14
       v(3,0)+I*v(2,1),
 
15
       (v(1,0)+I*v(3,2) + I*v(2,0)-v(1,3))/sqrt2);
 
16
 
 
17
  Eigen::Vector3cd
 
18
    S2((-v(1,0)+I*v(3,2) + I*v(2,0)+v(1,3))/sqrt2,
 
19
       v(3,0)-I*v(2,1),
 
20
       (v(1,0)-I*v(3,2) + I*v(2,0)+v(1,3))/sqrt2);
 
21
    
 
22
  Eigen::Vector3cd S1Prime=L.rep1(3)*S1, S2Prime=L.rep2(3)*S2;
 
23
  
 
24
  AntisymmetricFourTensor T;
 
25
  T(1,0) = real(S1Prime(2)-S1Prime(0) + S2Prime(2)-S2Prime(0))/sqrt8;
 
26
  T(2,0) = real (-I*(S1Prime(2)+S1Prime(0)+S2Prime(2)+S2Prime(0)))/sqrt8;
 
27
  T(3,0) = real(S1Prime(1)+S2Prime(1))/2.0;
 
28
  
 
29
  T(3,2) = imag(S1Prime(2)-S1Prime(0) - S2Prime(2) +S2Prime(0))/sqrt8;
 
30
  T(1,3) = imag (-I*(S1Prime(2)+S1Prime(0)-S2Prime(2)-S2Prime(0)))/sqrt8;
 
31
  T(2,1) = imag(S1Prime(1)-S2Prime(1))/2.0;
 
32
  return T;
 
33
}