22 std::pair<Eigen::Matrix2cd, Eigen::Matrix2cd>
30 auto roughness_matrix = [sigma, &coeff_i, &coeff_i1, beta_i, beta_i1](
double sign) {
33 auto b_p_vec = beta_i1 * coeff_i1.
m_b + sign * beta_i * coeff_i.
m_b;
35 auto square = [](
auto& v) {
return v.
x() * v.x() + v.y() * v.y() + v.z() * v.z(); };
39 const complex_t alpha_pp = -(alpha_p * alpha_p + beta_p * beta_p) * sigma * sigma / 8.;
40 const complex_t beta_pp = -alpha_p * beta_p * sigma * sigma / 4.;
42 Eigen::Matrix2cd QL, QR;
44 const complex_t factor1 = std::sqrt(2. * (1. + b_p_vec.z()));
45 const complex_t factor2 = std::sqrt(2. * (1. - b_p_vec.z()));
46 QL << (b_p_vec.z() + 1.) / factor1, (b_p_vec.z() - 1.) / factor2,
47 (b_p_vec.x() +
I * b_p_vec.y()) / factor1, (b_p_vec.x() +
I * b_p_vec.y()) / factor2;
48 QR << (b_p_vec.z() + 1.) / factor1, (b_p_vec.x() -
I * b_p_vec.y()) / factor1,
49 (b_p_vec.z() - 1.) / factor2, (b_p_vec.x() -
I * b_p_vec.y()) / factor2;
51 const Eigen::Matrix2cd exp1 =
52 Eigen::DiagonalMatrix<complex_t, 2>({std::exp(alpha_pp), std::exp(alpha_pp)});
54 if (std::abs(beta_p) > std::numeric_limits<double>::epsilon() * 10.) {
55 Eigen::Matrix2cd exp2 = Eigen::Matrix2cd(
56 Eigen::DiagonalMatrix<complex_t, 2>({std::exp(beta_pp), std::exp(-beta_pp)}));
57 return Eigen::Matrix2cd{exp1 * QL * exp2 * QR};
63 const Eigen::Matrix2cd roughness_sum = roughness_matrix(1.);
64 const Eigen::Matrix2cd roughness_diff = roughness_matrix(-1.);
66 return {roughness_sum, roughness_diff};
69 std::pair<Eigen::Matrix2cd, Eigen::Matrix2cd>
74 Eigen::Matrix2cd roughness_sum{Eigen::Matrix2cd::Identity()};
75 Eigen::Matrix2cd roughness_diff{Eigen::Matrix2cd::Identity()};
78 roughness_sum = std::get<0>(ret);
79 roughness_diff = std::get<1>(ret);
83 const auto mp = 0.5 * (Eigen::Matrix2cd::Identity() + P) * roughness_diff;
84 const auto mm = 0.5 * (Eigen::Matrix2cd::Identity() - P) * roughness_sum;
93 return std::abs(val.imag()) < 1e-80 && val.real() < 0 ?
complex_t(val.real(), 1e-40) : val;
std::complex< double > complex_t
Defines class SpecularMagneticNewNCStrategy.
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 m_lambda
wave propagation direction (-1 for direct one, 1 for time reverse)
Eigen::Matrix2cd computeInverseP() const
Eigen::Matrix2cd computeP() const
kvector_t m_b
unit magnetic field vector
std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > computeRoughnessMatrices(const MatrixRTCoefficients_v3 &coeff_i, const MatrixRTCoefficients_v3 &coeff_i1, double sigma) const
virtual std::pair< Eigen::Matrix2cd, Eigen::Matrix2cd > computeBackwardsSubmatrices(const MatrixRTCoefficients_v3 &coeff_i, const MatrixRTCoefficients_v3 &coeff_i1, double sigma) const
complex_t checkForUnderflow(complex_t val)