20 const auto eps = std::numeric_limits<double>::epsilon() * 10.;
26 , m_lambda(
std::move(eigenvalues))
28 , m_magnetic_SLD(magnetic_SLD)
49 const Eigen::Matrix2cd exp2 = Eigen::DiagonalMatrix<complex_t, 2>(selection);
51 if (std::abs(
m_b.
mag() - 1.) < eps) {
53 const double factor1 = 2. * (1. +
m_b.
z());
55 return Q * exp2 * Q.adjoint() / factor1;
57 }
else if (
m_b.
mag() < eps)
60 throw std::runtime_error(
"Broken magnetic field vector");
123 Eigen::Matrix2cd result;
125 result << alpha + sign * beta *
m_b.
z(), sign * beta * (
m_b.
x() -
I *
m_b.
y()),
126 sign * beta * (
m_b.
x() +
I *
m_b.
y()), alpha - sign * beta *
m_b.
z();
144 if (std::abs(alpha * alpha - beta * beta) == 0.)
145 return Eigen::Matrix2cd::Zero();
148 result *= 2. / (alpha * alpha - beta * beta);
158 if (std::abs(
m_b.
mag() - 1.) < eps) {
159 const Eigen::Matrix2cd exp2 = Eigen::DiagonalMatrix<complex_t, 2>(
163 const double factor1 = 2. * (1. +
m_b.
z());
166 return Q * exp2 * Q.adjoint() / factor1;
168 }
else if (
m_b.
mag() < eps)
169 return Eigen::Matrix2cd::Identity() * GetImExponential(
m_kz_sign * alpha);
171 throw std::runtime_error(
"Broken magnetic field vector");
177 if (exponent.imag() > -std::log(std::numeric_limits<double>::min()))
179 return std::exp(
I * exponent);
Defines the macro ASSERT.
#define ASSERT(condition)
std::complex< double > complex_t
Defines class MatrixRTCoefficients.
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::Matrix2cd TransformationMatrix(Eigen::Vector2d selection) const
Eigen::Vector2cd R2plus() const override
Eigen::Vector2cd T2min() const override
Eigen::Matrix2cd computeDeltaMatrix(double thickness)
Eigen::Vector2cd T1min() const override
Eigen::Matrix2cd computeInverseP() const
Eigen::Vector2cd m_lambda
wave propagation direction (-1 for direct one, 1 for time reverse)
MatrixRTCoefficients & operator=(const MatrixRTCoefficients &)
Eigen::Matrix2cd T1Matrix() const
Eigen::Vector2cd T2plus() const override
MatrixRTCoefficients(double kz_sign, Eigen::Vector2cd eigenvalues, kvector_t b, double magnetic_SLD)
Eigen::Vector2cd R1min() const override
Eigen::Vector2cd R2min() const override
kvector_t m_b
unit magnetic field vector
Eigen::Matrix2cd pMatrixHelper(double sign) const
MatrixRTCoefficients * clone() const override
~MatrixRTCoefficients() override
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.
Eigen::Vector2cd R1plus() const override
Eigen::Matrix2cd T2Matrix() const
Eigen::Matrix2cd computeP() const