BornAgain  1.19.79
Open-source research software to simulate and fit neutron and x-ray reflectometry and grazing-incidence small-angle scattering
SpinMatrix Class Reference

Description

Definition at line 23 of file SpinMatrix.h.

Public Member Functions

 SpinMatrix ()
 Contructs the null matrix. More...
 
 SpinMatrix (complex_t a_, complex_t b_, complex_t c_, complex_t d_)
 Constructs matrix with rows (a_,b_) and (c_,d_). More...
 
SpinMatrix adjoint () const
 
bool allFinite () const
 
Spinor col0 () const
 
Spinor col1 () const
 
complex_t determinant () const
 
SpinMatrix operator* (complex_t) const
 
SpinMatrix operator* (const SpinMatrix &) const
 
Spinor operator* (const Spinor &) const
 
SpinMatrix operator* (double) const
 
SpinMatrix operator*= (complex_t)
 
SpinMatrix operator*= (const SpinMatrix &)
 
SpinMatrix operator*= (double)
 
SpinMatrix operator+ (const SpinMatrix &) const
 
SpinMatrix operator+= (const SpinMatrix &)
 
SpinMatrix operator- () const
 
SpinMatrix operator- (const SpinMatrix &) const
 
SpinMatrix operator/ (complex_t) const
 
SpinMatrix operator/ (double) const
 
SpinMatrix operator/= (complex_t)
 
SpinMatrix operator/= (double)
 
complex_t trace () const
 

Static Public Member Functions

static SpinMatrix Diag (complex_t a_, complex_t d_)
 
static SpinMatrix FromBlochVector (const R3 &v)
 Constructs matrix (I+v*s)/2, where s is the Pauli vector. More...
 
static SpinMatrix One ()
 

Public Attributes

complex_t a
 
complex_t b
 
complex_t c
 
complex_t d
 

Constructor & Destructor Documentation

◆ SpinMatrix() [1/2]

SpinMatrix::SpinMatrix ( complex_t  a_,
complex_t  b_,
complex_t  c_,
complex_t  d_ 
)

Constructs matrix with rows (a_,b_) and (c_,d_).

Definition at line 18 of file SpinMatrix.cpp.

19  : a(a_)
20  , b(b_)
21  , c(c_)
22  , d(d_)
23 {
24 }
complex_t a
Definition: SpinMatrix.h:68
complex_t b
Definition: SpinMatrix.h:68
complex_t c
Definition: SpinMatrix.h:68
complex_t d
Definition: SpinMatrix.h:68

◆ SpinMatrix() [2/2]

SpinMatrix::SpinMatrix ( )

Contructs the null matrix.

Definition at line 26 of file SpinMatrix.cpp.

27  : SpinMatrix(0, 0, 0, 0)
28 {
29 }
SpinMatrix()
Contructs the null matrix.
Definition: SpinMatrix.cpp:26

Member Function Documentation

◆ adjoint()

SpinMatrix SpinMatrix::adjoint ( ) const

Definition at line 180 of file SpinMatrix.cpp.

181 {
182  return {conj(a), conj(c), conj(b), conj(d)};
183 }

References a, b, c, and d.

Referenced by MatrixFlux::computeDeltaMatrix(), DecouplingApproximationStrategy::polarizedCalculation(), and MatrixFlux::TransformationMatrix().

◆ allFinite()

bool SpinMatrix::allFinite ( ) const

Definition at line 175 of file SpinMatrix.cpp.

176 {
177  return isfinite(a) && isfinite(b) && isfinite(c) && isfinite(d);
178 }

References a, b, c, and d.

◆ col0()

Spinor SpinMatrix::col0 ( ) const

Definition at line 155 of file SpinMatrix.cpp.

156 {
157  return {a, c};
158 }

References a, and c.

Referenced by MatrixFlux::R1plus(), MatrixFlux::R2plus(), MatrixFlux::T1plus(), and MatrixFlux::T2plus().

◆ col1()

Spinor SpinMatrix::col1 ( ) const

Definition at line 160 of file SpinMatrix.cpp.

161 {
162  return {b, d};
163 }

References b, and d.

Referenced by MatrixFlux::R1min(), MatrixFlux::R2min(), MatrixFlux::T1min(), and MatrixFlux::T2min().

◆ determinant()

complex_t SpinMatrix::determinant ( ) const

Definition at line 170 of file SpinMatrix.cpp.

171 {
172  return a * d - b * c;
173 }

References a, b, c, and d.

Referenced by Compute::SpecularMagnetic::topLayerR().

◆ Diag()

SpinMatrix SpinMatrix::Diag ( complex_t  a_,
complex_t  d_ 
)
static

Definition at line 31 of file SpinMatrix.cpp.

32 {
33  return {a_, 0, 0, d_};
34 }

Referenced by One().

◆ FromBlochVector()

SpinMatrix SpinMatrix::FromBlochVector ( const R3 &  v)
static

Constructs matrix (I+v*s)/2, where s is the Pauli vector.

Definition at line 41 of file SpinMatrix.cpp.

42 {
43  return {(1.0 + v.z()) / 2.0, complex_t(v.x(), -v.y()) / 2.0, complex_t(v.x(), v.y()) / 2.0,
44  (1.0 - v.z()) / 2.0};
45 }

Referenced by PolFilter::matrix(), ISpecularScan::polMatrices(), and Beam::polMatrix().

◆ One()

SpinMatrix SpinMatrix::One ( )
static

Definition at line 36 of file SpinMatrix.cpp.

37 {
38  return Diag(1, 1);
39 }
static SpinMatrix Diag(complex_t a_, complex_t d_)
Definition: SpinMatrix.cpp:31

References Diag().

Referenced by Compute::MagneticNevotCroceTransition::backwardsSubmatrices(), Compute::TransitionMagneticTanh::backwardsSubmatrices(), MatrixFlux::computeDeltaMatrix(), IFormFactor::formfactor_pol(), MaterialUtils::MagnetizationCorrection(), PolFilter::matrix(), and Compute::SpecularMagnetic::topLayerR().

Here is the call graph for this function:

◆ operator*() [1/4]

SpinMatrix SpinMatrix::operator* ( complex_t  f) const

Definition at line 89 of file SpinMatrix.cpp.

90 {
91  return {a * f, b * f, c * f, d * f};
92 }

References a, b, c, and d.

◆ operator*() [2/4]

SpinMatrix SpinMatrix::operator* ( const SpinMatrix o) const

Definition at line 72 of file SpinMatrix.cpp.

73 {
74  return {a * o.a + b * o.c, a * o.b + b * o.d, c * o.a + d * o.c, c * o.b + d * o.d};
75 }

References a, b, c, and d.

◆ operator*() [3/4]

Spinor SpinMatrix::operator* ( const Spinor s) const

Definition at line 84 of file SpinMatrix.cpp.

85 {
86  return {a * s.u + b * s.v, c * s.u + d * s.v};
87 }
complex_t v
Definition: Spinor.h:31
complex_t u
Definition: Spinor.h:31

References a, b, c, d, Spinor::u, and Spinor::v.

◆ operator*() [4/4]

SpinMatrix SpinMatrix::operator* ( double  f) const

Definition at line 94 of file SpinMatrix.cpp.

95 {
96  return {a * f, b * f, c * f, d * f};
97 }

References a, b, c, and d.

◆ operator*=() [1/3]

SpinMatrix SpinMatrix::operator*= ( complex_t  f)

Definition at line 109 of file SpinMatrix.cpp.

110 {
111  a *= f;
112  b *= f;
113  c *= f;
114  d *= f;
115  return *this;
116 }

References a, b, c, and d.

◆ operator*=() [2/3]

SpinMatrix SpinMatrix::operator*= ( const SpinMatrix o)

Definition at line 77 of file SpinMatrix.cpp.

78 {
79  const SpinMatrix tmp(*this * o);
80  *this = tmp;
81  return *this;
82 }

◆ operator*=() [3/3]

SpinMatrix SpinMatrix::operator*= ( double  f)

Definition at line 118 of file SpinMatrix.cpp.

119 {
120  a *= f;
121  b *= f;
122  c *= f;
123  d *= f;
124  return *this;
125 }

References a, b, c, and d.

◆ operator+()

SpinMatrix SpinMatrix::operator+ ( const SpinMatrix o) const

Definition at line 52 of file SpinMatrix.cpp.

53 {
54  return {a + o.a, b + o.b, c + o.c, d + o.d};
55 }

References a, b, c, and d.

◆ operator+=()

SpinMatrix SpinMatrix::operator+= ( const SpinMatrix o)

Definition at line 62 of file SpinMatrix.cpp.

63 {
64  a += o.a;
65  b += o.b;
66  c += o.c;
67  d += o.d;
68 
69  return *this;
70 }

References a, b, c, and d.

◆ operator-() [1/2]

SpinMatrix SpinMatrix::operator- ( ) const

Definition at line 47 of file SpinMatrix.cpp.

48 {
49  return {-a, -b, -c, -d};
50 }

References a, b, c, and d.

◆ operator-() [2/2]

SpinMatrix SpinMatrix::operator- ( const SpinMatrix o) const

Definition at line 57 of file SpinMatrix.cpp.

58 {
59  return {a - o.a, b - o.b, c - o.c, d - o.d};
60 }

References a, b, c, and d.

◆ operator/() [1/2]

SpinMatrix SpinMatrix::operator/ ( complex_t  f) const

Definition at line 99 of file SpinMatrix.cpp.

100 {
101  return {a / f, b / f, c / f, d / f};
102 }

References a, b, c, and d.

◆ operator/() [2/2]

SpinMatrix SpinMatrix::operator/ ( double  f) const

Definition at line 104 of file SpinMatrix.cpp.

105 {
106  return {a / f, b / f, c / f, d / f};
107 }

References a, b, c, and d.

◆ operator/=() [1/2]

SpinMatrix SpinMatrix::operator/= ( complex_t  f)

Definition at line 127 of file SpinMatrix.cpp.

128 {
129  a /= f;
130  b /= f;
131  c /= f;
132  d /= f;
133  return *this;
134 }

References a, b, c, and d.

◆ operator/=() [2/2]

SpinMatrix SpinMatrix::operator/= ( double  f)

Definition at line 136 of file SpinMatrix.cpp.

137 {
138  a /= f;
139  b /= f;
140  c /= f;
141  d /= f;
142  return *this;
143 }

References a, b, c, and d.

◆ trace()

complex_t SpinMatrix::trace ( ) const

Definition at line 165 of file SpinMatrix.cpp.

166 {
167  return a + d;
168 }

References a, and d.

Referenced by DecouplingApproximationStrategy::polarizedCalculation(), and SSCAStrategy::polarizedCalculation().

Member Data Documentation

◆ a

◆ b

◆ c

◆ d


The documentation for this class was generated from the following files: