27 auto roughness_matrix = [sigma, &coeff_i, &coeff_i1, beta_i, beta_i1](
double sign) {
30 auto b_p_vec = beta_i1 * coeff_i1.
m_b + sign * beta_i * coeff_i.
m_b;
32 auto square = [](
auto& v) {
return v.
x() * v.x() + v.y() * v.y() + v.z() * v.z(); };
33 complex_t beta_p = std::sqrt(checkForUnderflow(square(b_p_vec)));
36 const complex_t alpha_pp = -(alpha_p * alpha_p + beta_p * beta_p) * sigma * sigma / 8.;
37 const complex_t beta_pp = -alpha_p * beta_p * sigma * sigma / 4.;
39 Eigen::Matrix2cd QL, QR;
41 const complex_t factor1 = std::sqrt(2. * (1. + b_p_vec.z()));
42 const complex_t factor2 = std::sqrt(2. * (1. - b_p_vec.z()));
43 QL << (b_p_vec.z() + 1.) / factor1, (b_p_vec.z() - 1.) / factor2,
44 (b_p_vec.x() +
I * b_p_vec.y()) / factor1, (b_p_vec.x() +
I * b_p_vec.y()) / factor2;
45 QR << (b_p_vec.z() + 1.) / factor1, (b_p_vec.x() -
I * b_p_vec.y()) / factor1,
46 (b_p_vec.z() - 1.) / factor2, (b_p_vec.x() -
I * b_p_vec.y()) / factor2;
48 const Eigen::Matrix2cd exp1 =
49 Eigen::DiagonalMatrix<complex_t, 2>({std::exp(alpha_pp), std::exp(alpha_pp)});
51 if (std::abs(beta_p) > std::numeric_limits<double>::epsilon() * 10.) {
52 Eigen::Matrix2cd exp2 = Eigen::Matrix2cd(
53 Eigen::DiagonalMatrix<complex_t, 2>({std::exp(beta_pp), std::exp(-beta_pp)}));
54 return Eigen::Matrix2cd{exp1 * QL * exp2 * QR};
60 const Eigen::Matrix2cd roughness_sum = roughness_matrix(1.);
61 const Eigen::Matrix2cd roughness_diff = roughness_matrix(-1.);
63 return {roughness_sum, roughness_diff};
66 std::pair<Eigen::Matrix2cd, Eigen::Matrix2cd>
71 Eigen::Matrix2cd roughness_sum{Eigen::Matrix2cd::Identity()};
72 Eigen::Matrix2cd roughness_diff{Eigen::Matrix2cd::Identity()};
75 roughness_sum = std::get<0>(ret);
76 roughness_diff = std::get<1>(ret);
80 const auto mp = 0.5 * (Eigen::Matrix2cd::Identity() + P) * roughness_diff;
81 const auto mm = 0.5 * (Eigen::Matrix2cd::Identity() - P) * roughness_sum;
89 return std::abs(val.imag()) < 1e-80 && val.real() < 0 ?
complex_t(val.real(), 1e-40) : val;
std::complex< double > complex_t
Defines class SpecularMagneticNCStrategy.
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 computeInverseP() const
Eigen::Vector2cd m_lambda
wave propagation direction (-1 for direct one, 1 for time reverse)
kvector_t m_b
unit magnetic field vector
Eigen::Matrix2cd computeP() const
std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > computeRoughnessMatrices(const MatrixRTCoefficients &coeff_i, const MatrixRTCoefficients &coeff_i1, double sigma) const
virtual std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > computeBackwardsSubmatrices(const MatrixRTCoefficients &coeff_i, const MatrixRTCoefficients &coeff_i1, double sigma) const