20 complex_t GetImExponential(complex_t exponent);
 
   21 const auto eps = std::numeric_limits<double>::epsilon() * 10.;
 
   24 MatrixRTCoefficients_v3::MatrixRTCoefficients_v3(
double kz_sign, Eigen::Vector2cd eigenvalues,
 
   26     : m_kz_sign(kz_sign), m_lambda(std::move(eigenvalues)), m_b(std::move(b)),
 
   27       m_magnetic_SLD(magnetic_SLD)
 
   29     ASSERT(std::abs(m_b.mag() - 1) < eps || (m_b.mag() < eps && magnetic_SLD < eps));
 
   37 MatrixRTCoefficients_v3::~MatrixRTCoefficients_v3() = 
default;
 
   44 Eigen::Matrix2cd MatrixRTCoefficients_v3::TransformationMatrix(Eigen::Vector2d selection)
 const 
   46     const Eigen::Matrix2cd exp2 = Eigen::DiagonalMatrix<complex_t, 2>(selection);
 
   48     if (std::abs(m_b.
mag() - 1.) < eps) {
 
   50         const double factor1 = 2. * (1. + m_b.
z());
 
   51         Q << (1. + m_b.
z()), (I * m_b.
y() - m_b.
x()), (m_b.
x() + I * m_b.
y()), (m_b.
z() + 1.);
 
   52         return Q * exp2 * Q.adjoint() / factor1;
 
   54     } 
else if (m_b.
mag() < eps)
 
   57     throw std::runtime_error(
"Broken magnetic field vector");
 
   60 Eigen::Matrix2cd MatrixRTCoefficients_v3::T1Matrix()
 const 
   62     return TransformationMatrix({0., 1.});
 
   65 Eigen::Matrix2cd MatrixRTCoefficients_v3::T2Matrix()
 const 
   67     return TransformationMatrix({1., 0.});
 
   72     return T1Matrix() * m_T.col(0);
 
   75 Eigen::Vector2cd MatrixRTCoefficients_v3::R1plus()
 const 
   77     return T1Matrix() * m_R.col(0);
 
   80 Eigen::Vector2cd MatrixRTCoefficients_v3::T2plus()
 const 
   82     return T2Matrix() * m_T.col(0);
 
   85 Eigen::Vector2cd MatrixRTCoefficients_v3::R2plus()
 const 
   87     return T2Matrix() * m_R.col(0);
 
   90 Eigen::Vector2cd MatrixRTCoefficients_v3::T1min()
 const 
   92     return T1Matrix() * m_T.col(1);
 
   95 Eigen::Vector2cd MatrixRTCoefficients_v3::R1min()
 const 
   97     return T1Matrix() * m_R.col(1);
 
  100 Eigen::Vector2cd MatrixRTCoefficients_v3::T2min()
 const 
  102     return T2Matrix() * m_T.col(1);
 
  105 Eigen::Vector2cd MatrixRTCoefficients_v3::R2min()
 const 
  107     return T2Matrix() * m_R.col(1);
 
  112     return m_kz_sign * m_lambda;
 
  115 Eigen::Matrix2cd MatrixRTCoefficients_v3::pMatrixHelper(
double sign)
 const 
  117     const complex_t alpha = m_lambda(1) + m_lambda(0);
 
  118     const complex_t beta = m_lambda(1) - m_lambda(0);
 
  120     Eigen::Matrix2cd result;
 
  124     result << alpha + sign * beta * b.
z(), sign * beta * (b.
x() - I * b.
y()),
 
  125         sign * beta * (b.
x() + I * b.
y()), alpha - sign * beta * b.
z();
 
  130 Eigen::Matrix2cd MatrixRTCoefficients_v3::computeP()
 const 
  132     Eigen::Matrix2cd result = pMatrixHelper(1.);
 
  138 Eigen::Matrix2cd MatrixRTCoefficients_v3::computeInverseP()
 const 
  140     const complex_t alpha = m_lambda(1) + m_lambda(0);
 
  141     const complex_t beta = m_lambda(1) - m_lambda(0);
 
  143     if (std::abs(alpha * alpha - beta * beta) == 0.)
 
  144         return Eigen::Matrix2cd::Zero();
 
  146     Eigen::Matrix2cd result = pMatrixHelper(-1.);
 
  147     result *= 2. / (alpha * alpha - beta * beta);
 
  152 Eigen::Matrix2cd MatrixRTCoefficients_v3::computeDeltaMatrix(
double thickness)
 
  154     Eigen::Matrix2cd result;
 
  155     const complex_t alpha = 0.5 * thickness * (m_lambda(1) + m_lambda(0));
 
  157     const Eigen::Matrix2cd exp2 = Eigen::DiagonalMatrix<complex_t, 2>(
 
  158         {GetImExponential(thickness * m_lambda(1)), GetImExponential(thickness * m_lambda(0))});
 
  161     if (std::abs(m_b.
mag() - 1.) < eps) {
 
  163         const double factor1 = 2. * (1. + m_b.
z());
 
  164         Q << (1. + m_b.
z()), (I * m_b.
y() - m_b.
x()), (m_b.
x() + I * m_b.
y()), (m_b.
z() + 1.);
 
  166         return Q * exp2 * Q.adjoint() / factor1;
 
  168     } 
else if (m_b.
mag() < eps)
 
  169         return Eigen::Matrix2cd::Identity() * GetImExponential(alpha);
 
  171     throw std::runtime_error(
"Broken magnetic field vector");
 
  176 complex_t GetImExponential(complex_t exponent)
 
  178     if (exponent.imag() > -std::log(std::numeric_limits<double>::min()))
 
  180     return std::exp(I * exponent);
 
Defines the macro ASSERT.
 
Defines class MatrixRTCoefficients_v3.
 
double mag() const
Returns magnitude of the vector.
 
T z() const
Returns z-component in cartesian coordinate system.
 
T y() const
Returns y-component in cartesian coordinate system.
 
T x() const
Returns x-component in cartesian coordinate system.
 
Specular reflection and transmission coefficients in a layer in case of magnetic interactions between...
 
Eigen::Vector2cd T1plus() const override
The following functions return the transmitted and reflected amplitudes for different incoming beam p...
 
Eigen::Vector2cd getKz() const override
Returns z-part of the two wavevector eigenmodes.