43 return dS.Kjj()[
i] + da.Kjj()[
i] * B[
i] + a.Kjj()[
i] * dB_dT[
i];
45 return dS.Kjj()[
i] + da.Kjj()[
i] * B[
i];
56 return Eigen::Vector2d(
57 dS.Kjj()[
i] + da.Kjj()[
i] * B[
i] + a.Kjj()[
i] * dB_dT[
i],
58 dS.K12()[
i] + da.K12()[
i] * B[
i] + a.K12()[
i] * dB_dT[
i]);
60 return Eigen::Vector2d(dS.Kjj()[
i] + da.Kjj()[
i] * B[
i],
61 dS.K12()[
i] + da.K12()[
i] * B[
i]);
72 return Eigen::Vector3d(
73 dS.Kjj()[
i] + da.Kjj()[
i] * B[
i] + a.Kjj()[
i] * dB_dT[
i],
74 dS.K12()[
i] + da.K12()[
i] * B[
i] + a.K12()[
i] * dB_dT[
i],
75 dS.K13()[
i] + da.K13()[
i] * B[
i] + a.K13()[
i] * dB_dT[
i]);
77 return Eigen::Vector3d(dS.Kjj()[
i] + da.Kjj()[
i] * B[
i],
78 dS.K12()[
i] + da.K12()[
i] * B[
i],
79 dS.K13()[
i] + da.K13()[
i] * B[
i]);
90 return Eigen::Vector4d(
91 dS.Kjj()[
i] + da.Kjj()[
i] * B[
i] + a.Kjj()[
i] * dB_dT[
i],
92 dS.K12()[
i] + da.K12()[
i] * B[
i] + a.K12()[
i] * dB_dT[
i],
93 dS.K13()[
i] + da.K13()[
i] * B[
i] + a.K13()[
i] * dB_dT[
i],
94 dS.K14()[
i] + da.K14()[
i] * B[
i] + a.K14()[
i] * dB_dT[
i]);
96 return Eigen::Vector4d(dS.Kjj()[
i] + da.Kjj()[
i] * B[
i],
97 dS.K12()[
i] + da.K12()[
i] * B[
i],
98 dS.K13()[
i] + da.K13()[
i] * B[
i],
99 dS.K14()[
i] + da.K14()[
i] * B[
i]);
103 return Eigen::Matrix<double, 1, 1>(a);
107 return (Eigen::Matrix2d() << a, b, b, a).finished();
114 return (Eigen::Matrix3d() << a, b, c, b, a, u, c, -u, a).finished();
124 return (Eigen::Matrix4d() << a,
144 return Eigen::Matrix<double, 1, 1>(m(0, 0));
148 return (Eigen::Matrix2d() << m(0, 0), m(0, 1), m(1, 0), m(1, 1)).finished();
152 return (Eigen::Matrix3d() << m(0, 0),
165 return (Eigen::Matrix4d() << m(0, 0),
184 inline Eigen::Matrix<double, 1, 1>
inv1(
const Numeric& a) noexcept {
185 return Eigen::Matrix<double, 1, 1>(1 / a);
189 return (Eigen::Matrix2d() << a, -b, -b, a).finished() / (a * a - b * b);
196 return (Eigen::Matrix3d() << a * a + u * u,
206 (a * a * a - a * b * b - a * c * c + a * u * u);
216 return (Eigen::Matrix4d() << a * a * a + a * u * u + a * v * v + a *
w *
w,
217 -a * a * b - a * c * u - a * d * v - b * w * w + c * v * w -
219 -a * a * c + a * b * u - a * d * w + b * v * w - c * v * v +
221 -a * a * d + a * b * v + a * c * w - b * u * w + c * u * v -
223 -a * a * b + a * c * u + a * d * v - b * w * w + c * v * w -
225 a * a * a - a * c * c - a * d * d + a * w * w,
226 -a * a * u + a * b * c - a * v * w + b * d * w - c * d * v +
228 -a * a * v + a * b * d + a * u * w - b * c * w + c * c * v -
230 -a * a * c - a * b * u + a * d * w + b * v * w - c * v * v +
232 a * a * u + a * b * c - a * v * w - b * d * w + c * d * v - d * d * u,
233 a * a * a - a * b * b - a * d * d + a * v * v,
234 -a * a * w + a * c * d - a * u * v + b * b * w - b * c * v +
236 -a * a * d - a * b * v - a * c * w - b * u * w + c * u * v -
238 a * a * v + a * b * d + a * u * w + b * c * w - c * c * v + c * d * u,
239 a * a * w + a * c * d - a * u * v - b * b * w + b * c * v - b * d * u,
240 a * a * a - a * b * b - a * c * c + a * u * u)
242 (a * a * a * a - a * a * b * b - a * a * c * c - a * a * d * d +
243 a * a * u * u + a * a * v * v + a * a * w * w - b * b * w * w +
244 2 * b * c * v * w - 2 * b * d * u * w - c * c * v * v +
245 2 * c * d * u * v - d * d * u * u);
253 const Index ia = 0) noexcept {
256 std::exp(-0.5 * r * (K1.
Kjj(iz, ia)[
i] + K2.
Kjj(iz, ia)[
i]));
264 const Index ia = 0) noexcept {
267 b = -0.5 * r * (K1.
K12(iz, ia)[
i] + K2.
K12(iz, ia)[
i]);
268 const Numeric exp_a = std::exp(a);
269 const Numeric cb = std::cosh(b), sb = std::sinh(b);
270 T.
Mat2(
i).noalias() =
271 (Eigen::Matrix2d() << cb, sb, sb, cb).finished() * exp_a;
280 const Index ia = 0) noexcept {
283 b = -0.5 * r * (K1.
K12(iz, ia)[
i] + K2.
K12(iz, ia)[
i]),
284 c = -0.5 * r * (K1.
K13(iz, ia)[
i] + K2.
K13(iz, ia)[
i]),
285 u = -0.5 * r * (K1.
K23(iz, ia)[
i] + K2.
K23(iz, ia)[
i]);
286 const Numeric exp_a = std::exp(a);
288 if (b == 0. and c == 0. and u == 0.)
291 const Numeric a2 = a * a,
b2 = b * b, c2 = c * c, u2 = u * u;
292 const Numeric Const = b2 + c2 - u2;
294 const bool real = Const > 0;
295 const bool imag = Const < 0;
296 const bool either = real or imag;
301 (real ? 1 : -1) * x * x;
307 real ? std::sinh(x) : std::sin(-x);
309 real ? std::cosh(x) : std::cos(+x);
318 either ? a2 * (cx - 1.0) - a * x * sx +
x2 : 1.0 + 0.5 * a2 - a;
319 const Numeric C1 = either ? 2.0 * a * (1.0 - cx) + x * sx : 1.0 - a;
320 const Numeric C2 = either ? cx - 1.0 : 0.5;
322 T.
Mat3(
i).noalias() =
324 (Eigen::Matrix3d() << C0 + C1 * a + C2 * (a2 + b2 + c2),
325 C1 * b + C2 * (2 * a * b - c * u),
326 C1 * c + C2 * (2 * a * c + b * u),
327 C1 * b + C2 * (2 * a * b + c * u),
328 C0 + C1 * a + C2 * (a2 + b2 - u2),
329 C1 * u + C2 * (2 * a * u + b * c),
330 C1 * c + C2 * (2 * a * c - b * u),
331 -C1 * u - C2 * (2 * a * u - b * c),
332 C0 + C1 * a + C2 * (a2 + c2 - u2))
343 const Index ia = 0) noexcept {
344 static constexpr
Numeric sqrt_05 = Constant::inv_sqrt_2;
347 b = -0.5 * r * (K1.
K12(iz, ia)[
i] + K2.
K12(iz, ia)[
i]),
348 c = -0.5 * r * (K1.
K13(iz, ia)[
i] + K2.
K13(iz, ia)[
i]),
349 d = -0.5 * r * (K1.
K14(iz, ia)[
i] + K2.
K14(iz, ia)[
i]),
350 u = -0.5 * r * (K1.
K23(iz, ia)[
i] + K2.
K23(iz, ia)[
i]),
351 v = -0.5 * r * (K1.
K24(iz, ia)[
i] + K2.
K24(iz, ia)[
i]),
352 w = -0.5 * r * (K1.
K34(iz, ia)[
i] + K2.
K34(iz, ia)[
i]);
353 const Numeric exp_a = std::exp(a);
355 if (b == 0. and c == 0. and d == 0. and u == 0. and v == 0. and
w == 0.)
358 const Numeric b2 = b * b, c2 = c * c, d2 = d * d, u2 = u * u,
v2 = v * v,
362 w2 * w2 + 2 * (b2 * (b2 * 0.5 + c2 + d2 - u2 - v2 + w2) +
363 c2 * (c2 * 0.5 + d2 - u2 + v2 - w2) +
364 d2 * (d2 * 0.5 + u2 - v2 - w2) +
365 u2 * (u2 * 0.5 + v2 + w2) + v2 * (v2 * 0.5 + w2) +
366 4 * (b * d * u * w - b * c * v * w - c * d * u * v));
368 const Numeric Const2 = b2 + c2 + d2 - u2 - v2 - w2;
372 const Complex
x2 = x * x;
373 const Complex y2 = y * y;
374 const Complex cy = std::cos(y);
375 const Complex sy = std::sin(y);
376 const Complex cx = std::cosh(x);
377 const Complex sx = std::sinh(x);
381 const bool both_zero = y_zero and x_zero;
382 const bool either_zero = y_zero or x_zero;
392 const Complex ix = x_zero ? 0.0 : 1.0 / x;
393 const Complex iy = y_zero ? 0.0 : 1.0 / y;
394 const Complex inv_x2y2 =
401 either_zero ? 1.0 : ((cy * x2 + cx * y2) * inv_x2y2).real();
403 either_zero ? 1.0 : ((sy * x2 * iy + sx * y2 * ix) * inv_x2y2).real();
404 const Numeric C2 = both_zero ? 0.5 : ((cx - cy) * inv_x2y2).real();
406 both_zero ? 1.0 / 6.0
407 : ((x_zero ? 1.0 - sy * iy
408 : y_zero ? sx * ix - 1.0 : sx * ix - sy * iy) *
411 T.
Mat4(
i).noalias() =
412 exp_a * (Eigen::Matrix4d() << C0 + C2 * (b2 + c2 + d2),
413 C1 * b + C2 * (-c * u - d * v) +
414 C3 * (b * (b2 + c2 + d2) - u * (b * u - d * w) -
415 v * (b * v + c *
w)),
416 C1 * c + C2 * (b * u - d *
w) +
417 C3 * (c * (b2 + c2 + d2) - u * (c * u + d * v) -
418 w * (b * v + c * w)),
419 C1 * d + C2 * (b * v + c * w) +
420 C3 * (d * (b2 + c2 + d2) - v * (c * u + d * v) +
421 w * (b * u - d *
w)),
423 C1 * b + C2 * (c * u + d * v) +
424 C3 * (-b * (-b2 + u2 + v2) + c * (b * c - v *
w) +
425 d * (b * d + u * w)),
426 C0 + C2 * (b2 - u2 - v2),
427 C2 * (b * c - v *
w) + C1 * u +
428 C3 * (c * (c * u + d * v) - u * (-b2 + u2 + v2) -
429 w * (b * d + u * w)),
430 C2 * (b * d + u * w) + C1 * v +
431 C3 * (d * (c * u + d * v) - v * (-b2 + u2 + v2) +
432 w * (b * c - v *
w)),
434 C1 * c + C2 * (-b * u + d *
w) +
435 C3 * (b * (b * c - v * w) - c * (-c2 + u2 + w2) +
436 d * (c * d - u * v)),
437 C2 * (b * c - v * w) - C1 * u +
438 C3 * (-b * (b * u - d *
w) + u * (-c2 + u2 + w2) -
439 v * (c * d - u * v)),
440 C0 + C2 * (c2 - u2 - w2),
441 C2 * (c * d - u * v) + C1 * w +
442 C3 * (-d * (b * u - d *
w) + v * (b * c - v * w) -
443 w * (-c2 + u2 + w2)),
445 C1 * d + C2 * (-b * v - c *
w) +
446 C3 * (b * (b * d + u * w) + c * (c * d - u * v) -
447 d * (-d2 + v2 + w2)),
448 C2 * (b * d + u * w) - C1 * v +
449 C3 * (-b * (b * v + c *
w) - u * (c * d - u * v) +
450 v * (-d2 + v2 + w2)),
451 C2 * (c * d - u * v) - C1 * w +
452 C3 * (-c * (b * v + c * w) + u * (b * d + u *
w) +
453 w * (-d2 + v2 + w2)),
454 C0 + C2 * (d2 - v2 - w2))
472 const Index ia) noexcept {
473 for (
Index i = 0;
i < K1.NumberOfFrequencies();
i++) {
475 std::exp(-0.5 *
r * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i]));
476 for (
Index j = 0; j < dT1.nelem(); j++) {
477 if (dK1[j].NumberOfFrequencies())
478 dT1[j].Mat1(
i)(0, 0) =
481 (
r * dK1[j].Kjj(iz, ia)[
i] +
482 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
484 if (dK2[j].NumberOfFrequencies())
485 dT2[j].Mat1(
i)(0, 0) =
488 (
r * dK2[j].Kjj(iz, ia)[
i] +
489 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
507 const Index ia) noexcept {
508 for (
Index i = 0;
i < K1.NumberOfFrequencies();
i++) {
509 const Numeric a = -0.5 *
r * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i]),
510 b = -0.5 *
r * (K1.K12(iz, ia)[
i] + K2.K12(iz, ia)[
i]);
511 const Numeric exp_a = std::exp(a);
512 const Numeric cb = std::cosh(b), sb = std::sinh(b);
513 T.Mat2(
i).noalias() =
514 (Eigen::Matrix2d() << cb, sb, sb, cb).finished() * exp_a;
515 for (
Index j = 0; j < dT1.nelem(); j++) {
516 if (dK1[j].NumberOfFrequencies()) {
517 const Numeric da = -0.5 * (
r * dK1[j].Kjj(iz, ia)[
i] +
518 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] +
521 db = -0.5 * (
r * dK1[j].K12(iz, ia)[
i] +
522 ((j == it) ? dr_dT1 * (K1.K12(iz, ia)[
i] +
525 dT1[j].Mat2(
i).noalias() =
527 (Eigen::Matrix2d() << sb, cb, cb, sb).finished() * exp_a * db;
529 if (dK2[j].NumberOfFrequencies()) {
530 const Numeric da = -0.5 * (
r * dK2[j].Kjj(iz, ia)[
i] +
531 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] +
534 db = -0.5 * (
r * dK2[j].K12(iz, ia)[
i] +
535 ((j == it) ? dr_dT2 * (K1.K12(iz, ia)[
i] +
538 dT2[j].Mat2(
i).noalias() =
540 (Eigen::Matrix2d() << sb, cb, cb, sb).finished() * exp_a * db;
558 const Index ia) noexcept {
559 for (
Index i = 0;
i < K1.NumberOfFrequencies();
i++) {
560 const Numeric a = -0.5 *
r * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i]),
561 b = -0.5 *
r * (K1.K12(iz, ia)[
i] + K2.K12(iz, ia)[
i]),
562 c = -0.5 *
r * (K1.K13(iz, ia)[
i] + K2.K13(iz, ia)[
i]),
563 u = -0.5 *
r * (K1.K23(iz, ia)[
i] + K2.K23(iz, ia)[
i]);
564 const Numeric exp_a = std::exp(a);
566 if (b == 0. and c == 0. and u == 0.) {
568 for (
Index j = 0; j < dT1.nelem(); j++) {
569 if (dK1[j].NumberOfFrequencies())
570 dT1[j].Mat3(
i).noalias() =
573 (
r * dK1[j].Kjj(iz, ia)[
i] +
574 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
576 if (dK2[j].NumberOfFrequencies())
577 dT2[j].Mat3(
i).noalias() =
580 (
r * dK2[j].Kjj(iz, ia)[
i] +
581 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
585 const Numeric a2 = a * a,
b2 = b * b, c2 = c * c, u2 = u * u;
586 const Numeric Const = b2 + c2 - u2;
588 const bool real = Const > 0;
589 const bool imag = Const < 0;
590 const bool either = real or imag;
595 (real ? 1 : -1) * x * x;
599 const Numeric inv_x2 = inv_x * inv_x;
602 real ? std::sinh(x) : std::sin(-x);
604 real ? std::cosh(x) : std::cos(+x);
613 either ? a2 * (cx - 1.0) - a * x * sx +
x2 : 1.0 + 0.5 * a2 - a;
614 const Numeric C1 = either ? 2.0 * a * (1.0 - cx) + x * sx : 1.0 - a;
615 const Numeric C2 = either ? cx - 1.0 : 0.5;
617 T.Mat3(
i).noalias() =
619 (Eigen::Matrix3d() << C0 + C1 * a + C2 * (a2 + b2 + c2),
620 C1 * b + C2 * (2 * a * b - c * u),
621 C1 * c + C2 * (2 * a * c + b * u),
622 C1 * b + C2 * (2 * a * b + c * u),
623 C0 + C1 * a + C2 * (a2 + b2 - u2),
624 C1 * u + C2 * (2 * a * u + b * c),
625 C1 * c + C2 * (2 * a * c - b * u),
626 -C1 * u - C2 * (2 * a * u - b * c),
627 C0 + C1 * a + C2 * (a2 + c2 - u2))
630 for (
Index j = 0; j < dT1.nelem(); j++) {
631 if (dK1[j].NumberOfFrequencies()) {
632 const Numeric da = -0.5 * (
r * dK1[j].Kjj(iz, ia)[
i] +
633 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] +
636 db = -0.5 * (
r * dK1[j].K12(iz, ia)[
i] +
637 ((j == it) ? dr_dT1 * (K1.K12(iz, ia)[
i] +
640 dc = -0.5 * (
r * dK1[j].K13(iz, ia)[
i] +
641 ((j == it) ? dr_dT1 * (K1.K13(iz, ia)[
i] +
644 du = -0.5 * (
r * dK1[j].K23(iz, ia)[
i] +
645 ((j == it) ? dr_dT1 * (K1.K23(iz, ia)[
i] +
648 const Numeric da2 = 2 * a * da, db2 = 2 * b * db, dc2 = 2 * c * dc,
650 const Numeric dx = either ? ((db2 + dc2 - du2) * inv_x * 0.5) : 0,
652 const Numeric dsx = (real ? 1 : -1) * cx * dx;
655 const Numeric dC0 = either ? da2 * (cx - 1.0) + da2 * (dcx - 1.0) -
656 da * x * sx - a * dx * sx -
660 either ? 2.0 * (da * (1.0 - cx) - a * dcx) + dx * sx + x * dsx
662 const Numeric dC2 = either ? dcx : 0;
664 dT1[j].Mat3(
i).noalias() =
665 T.Mat3(
i) * (da + dx2 * inv_x2) +
667 (Eigen::Matrix3d() << dC0 + dC1 * a + C1 * da +
668 dC2 * (a2 + b2 + c2) +
669 C2 * (da2 + db2 + dc2),
670 dC1 * b + C1 * db + dC2 * (2 * a * b - c * u) +
671 C2 * (2 * da * b - dc * u + 2 * a * db - c * du),
672 dC1 * c + C1 * dc + dC2 * (2 * a * c + b * u) +
673 C2 * (2 * da * c + db * u + 2 * a * dc + b * du),
674 dC1 * b + C1 * db + dC2 * (2 * a * b + c * u) +
675 C2 * (2 * da * b + dc * u + 2 * a * db + c * du),
676 dC0 + dC1 * a + C1 * da + dC2 * (a2 + b2 - u2) +
677 C2 * (da2 + db2 - du2),
678 dC1 * u + C1 * du + dC2 * (2 * a * u + b * c) +
679 C2 * (2 * da * u + db * c + 2 * a * du + b * dc),
680 dC1 * c + C1 * dc + dC2 * (2 * a * c - b * u) +
681 C2 * (2 * da * c - db * u + 2 * a * dc - b * du),
682 -dC1 * u - C1 * du - dC2 * (2 * a * u - b * c) -
683 C2 * (2 * da * u - db * c + 2 * a * du - b * dc),
684 dC0 + dC1 * a + C1 * da + dC2 * (a2 + c2 - u2) +
685 C2 * (da2 + dc2 - du2))
688 if (dK2[j].NumberOfFrequencies()) {
689 const Numeric da = -0.5 * (
r * dK2[j].Kjj(iz, ia)[
i] +
690 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] +
693 db = -0.5 * (
r * dK2[j].K12(iz, ia)[
i] +
694 ((j == it) ? dr_dT2 * (K1.K12(iz, ia)[
i] +
697 dc = -0.5 * (
r * dK2[j].K13(iz, ia)[
i] +
698 ((j == it) ? dr_dT2 * (K1.K13(iz, ia)[
i] +
701 du = -0.5 * (
r * dK2[j].K23(iz, ia)[
i] +
702 ((j == it) ? dr_dT2 * (K1.K23(iz, ia)[
i] +
705 const Numeric da2 = 2 * a * da, db2 = 2 * b * db, dc2 = 2 * c * dc,
707 const Numeric dx = either ? ((db2 + dc2 - du2) * inv_x * 0.5) : 0,
709 const Numeric dsx = (real ? 1 : -1) * cx * dx;
712 const Numeric dC0 = either ? da2 * (cx - 1.0) + da2 * (dcx - 1.0) -
713 da * x * sx - a * dx * sx -
717 either ? 2.0 * (da * (1.0 - cx) - a * dcx) + dx * sx + x * dsx
719 const Numeric dC2 = either ? dcx : 0;
721 dT2[j].Mat3(
i).noalias() =
722 T.Mat3(
i) * (da + dx2 * inv_x2) +
724 (Eigen::Matrix3d() << dC0 + dC1 * a + C1 * da +
725 dC2 * (a2 + b2 + c2) +
726 C2 * (da2 + db2 + dc2),
727 dC1 * b + C1 * db + dC2 * (2 * a * b - c * u) +
728 C2 * (2 * da * b - dc * u + 2 * a * db - c * du),
729 dC1 * c + C1 * dc + dC2 * (2 * a * c + b * u) +
730 C2 * (2 * da * c + db * u + 2 * a * dc + b * du),
731 dC1 * b + C1 * db + dC2 * (2 * a * b + c * u) +
732 C2 * (2 * da * b + dc * u + 2 * a * db + c * du),
733 dC0 + dC1 * a + C1 * da + dC2 * (a2 + b2 - u2) +
734 C2 * (da2 + db2 - du2),
735 dC1 * u + C1 * du + dC2 * (2 * a * u + b * c) +
736 C2 * (2 * da * u + db * c + 2 * a * du + b * dc),
737 dC1 * c + C1 * dc + dC2 * (2 * a * c - b * u) +
738 C2 * (2 * da * c - db * u + 2 * a * dc - b * du),
739 -dC1 * u - C1 * du - dC2 * (2 * a * u - b * c) -
740 C2 * (2 * da * u - db * c + 2 * a * du - b * dc),
741 dC0 + dC1 * a + C1 * da + dC2 * (a2 + c2 - u2) +
742 C2 * (da2 + dc2 - du2))
762 const Index ia) noexcept {
763 static constexpr
Numeric sqrt_05 = Constant::inv_sqrt_2;
764 for (
Index i = 0;
i < K1.NumberOfFrequencies();
i++) {
765 const Numeric a = -0.5 *
r * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i]),
766 b = -0.5 *
r * (K1.K12(iz, ia)[
i] + K2.K12(iz, ia)[
i]),
767 c = -0.5 *
r * (K1.K13(iz, ia)[
i] + K2.K13(iz, ia)[
i]),
768 d = -0.5 *
r * (K1.K14(iz, ia)[
i] + K2.K14(iz, ia)[
i]),
769 u = -0.5 *
r * (K1.K23(iz, ia)[
i] + K2.K23(iz, ia)[
i]),
770 v = -0.5 *
r * (K1.K24(iz, ia)[
i] + K2.K24(iz, ia)[
i]),
771 w = -0.5 *
r * (K1.K34(iz, ia)[
i] + K2.K34(iz, ia)[
i]);
772 const Numeric exp_a = std::exp(a);
774 if (b == 0. and c == 0. and d == 0. and u == 0. and v == 0. and
w == 0.) {
776 for (
Index j = 0; j < dK1.nelem(); j++) {
777 if (dK1[j].NumberOfFrequencies())
778 dT1[j].Mat4(
i).noalias() =
781 (
r * dK1[j].Kjj(iz, ia)[
i] +
782 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
784 if (dK2[j].NumberOfFrequencies())
785 dT2[j].Mat4(
i).noalias() =
788 (
r * dK2[j].Kjj(iz, ia)[
i] +
789 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] + K2.Kjj(iz, ia)[
i])
793 const Numeric b2 = b * b, c2 = c * c, d2 = d * d, u2 = u * u,
v2 = v * v,
796 w2 * w2 + 2 * (b2 * (b2 * 0.5 + c2 + d2 - u2 - v2 + w2) +
797 c2 * (c2 * 0.5 + d2 - u2 + v2 - w2) +
798 d2 * (d2 * 0.5 + u2 - v2 - w2) +
799 u2 * (u2 * 0.5 + v2 + w2) + v2 * (v2 * 0.5 + w2) +
800 4 * (b * d * u * w - b * c * v * w - c * d * u * v));
802 const Numeric Const2 = b2 + c2 + d2 - u2 - v2 - w2;
805 const Complex x = tmp_x_sqrt * sqrt_05;
807 const Complex
x2 = x * x;
808 const Complex y2 = y * y;
809 const Complex cy = std::cos(y);
810 const Complex sy = std::sin(y);
811 const Complex cx = std::cosh(x);
812 const Complex sx = std::sinh(x);
816 const bool both_zero = y_zero and x_zero;
817 const bool either_zero = y_zero or x_zero;
827 const Complex ix = x_zero ? 0.0 : 1.0 / x;
828 const Complex iy = y_zero ? 0.0 : 1.0 / y;
829 const Complex inv_x2y2 =
834 const Complex C0c = either_zero ? 1.0 : (cy * x2 + cx * y2) * inv_x2y2;
836 either_zero ? 1.0 : (sy * x2 * iy + sx * y2 * ix) * inv_x2y2;
837 const Complex C2c = both_zero ? 0.5 : (cx - cy) * inv_x2y2;
839 both_zero ? 1.0 / 6.0
840 : (x_zero ? 1.0 - sy * iy
841 : y_zero ? sx * ix - 1.0 : sx * ix - sy * iy) *
844 const Numeric& C0 =
reinterpret_cast<const Numeric(&)[2]
>(C0c)[0];
845 const Numeric& C1 =
reinterpret_cast<const Numeric(&)[2]
>(C1c)[0];
846 const Numeric& C2 =
reinterpret_cast<const Numeric(&)[2]
>(C2c)[0];
847 const Numeric& C3 =
reinterpret_cast<const Numeric(&)[2]
>(C3c)[0];
848 T.Mat4(
i).noalias() =
849 exp_a * (Eigen::Matrix4d() << C0 + C2 * (b2 + c2 + d2),
850 C1 * b + C2 * (-c * u - d * v) +
851 C3 * (b * (b2 + c2 + d2) - u * (b * u - d * w) -
852 v * (b * v + c *
w)),
853 C1 * c + C2 * (b * u - d *
w) +
854 C3 * (c * (b2 + c2 + d2) - u * (c * u + d * v) -
855 w * (b * v + c * w)),
856 C1 * d + C2 * (b * v + c * w) +
857 C3 * (d * (b2 + c2 + d2) - v * (c * u + d * v) +
858 w * (b * u - d *
w)),
860 C1 * b + C2 * (c * u + d * v) +
861 C3 * (-b * (-b2 + u2 + v2) + c * (b * c - v *
w) +
862 d * (b * d + u * w)),
863 C0 + C2 * (b2 - u2 - v2),
864 C2 * (b * c - v *
w) + C1 * u +
865 C3 * (c * (c * u + d * v) - u * (-b2 + u2 + v2) -
866 w * (b * d + u * w)),
867 C2 * (b * d + u * w) + C1 * v +
868 C3 * (d * (c * u + d * v) - v * (-b2 + u2 + v2) +
869 w * (b * c - v *
w)),
871 C1 * c + C2 * (-b * u + d *
w) +
872 C3 * (b * (b * c - v * w) - c * (-c2 + u2 + w2) +
873 d * (c * d - u * v)),
874 C2 * (b * c - v * w) - C1 * u +
875 C3 * (-b * (b * u - d *
w) + u * (-c2 + u2 + w2) -
876 v * (c * d - u * v)),
877 C0 + C2 * (c2 - u2 - w2),
878 C2 * (c * d - u * v) + C1 * w +
879 C3 * (-d * (b * u - d *
w) + v * (b * c - v * w) -
880 w * (-c2 + u2 + w2)),
882 C1 * d + C2 * (-b * v - c *
w) +
883 C3 * (b * (b * d + u * w) + c * (c * d - u * v) -
884 d * (-d2 + v2 + w2)),
885 C2 * (b * d + u * w) - C1 * v +
886 C3 * (-b * (b * v + c *
w) - u * (c * d - u * v) +
887 v * (-d2 + v2 + w2)),
888 C2 * (c * d - u * v) - C1 * w +
889 C3 * (-c * (b * v + c * w) + u * (b * d + u *
w) +
890 w * (-d2 + v2 + w2)),
891 C0 + C2 * (d2 - v2 - w2))
894 for (
Index j = 0; j < dK1.nelem(); j++) {
895 if (dK1[j].NumberOfFrequencies()) {
896 const Numeric da = -0.5 * (
r * dK1[j].Kjj(iz, ia)[
i] +
897 ((j == it) ? dr_dT1 * (K1.Kjj(iz, ia)[
i] +
900 db = -0.5 * (
r * dK1[j].K12(iz, ia)[
i] +
901 ((j == it) ? dr_dT1 * (K1.K12(iz, ia)[
i] +
904 dc = -0.5 * (
r * dK1[j].K13(iz, ia)[
i] +
905 ((j == it) ? dr_dT1 * (K1.K13(iz, ia)[
i] +
908 dd = -0.5 * (
r * dK1[j].K14(iz, ia)[
i] +
909 ((j == it) ? dr_dT1 * (K1.K14(iz, ia)[
i] +
912 du = -0.5 * (
r * dK1[j].K23(iz, ia)[
i] +
913 ((j == it) ? dr_dT1 * (K1.K23(iz, ia)[
i] +
916 dv = -0.5 * (
r * dK1[j].K24(iz, ia)[
i] +
917 ((j == it) ? dr_dT1 * (K1.K24(iz, ia)[
i] +
920 dw = -0.5 * (
r * dK1[j].K34(iz, ia)[
i] +
921 ((j == it) ? dr_dT1 * (K1.K34(iz, ia)[
i] +
924 const Numeric db2 = 2 * db * b, dc2 = 2 * dc * c, dd2 = 2 * dd * d,
925 du2 = 2 * du * u, dv2 = 2 * dv * v, dw2 = 2 *
dw *
w;
928 2 * (db2 * (b2 * 0.5 + c2 + d2 - u2 - v2 + w2) +
929 b2 * (db2 * 0.5 + dc2 + dd2 - du2 - dv2 + dw2) +
930 dc2 * (c2 * 0.5 + d2 - u2 + v2 - w2) +
931 c2 * (dc2 * 0.5 + dd2 - du2 + dv2 - dw2) +
932 dd2 * (d2 * 0.5 + u2 - v2 - w2) +
933 d2 * (dd2 * 0.5 + du2 - dv2 - dw2) +
934 du2 * (u2 * 0.5 + v2 + w2) + u2 * (du2 * 0.5 + dv2 + dw2) +
935 dv2 * (v2 * 0.5 + w2) + v2 * (dv2 * 0.5 + dw2) +
936 4 * (db * d * u * w - db * c * v * w - dc * d * u * v +
937 b * dd * u * w - b * dc * v * w - c * dd * u * v +
938 b * d * du * w - b * c * dv * w - c * d * du * v +
939 b * d * u *
dw - b * c * v *
dw - c * d * u * dv));
940 const Complex dConst1 = 0.5 * dtmp / Const1;
941 const Numeric dConst2 = db2 + dc2 + dd2 - du2 - dv2 - dw2;
943 x_zero ? 0 : (0.5 * (dConst2 + dConst1) / tmp_x_sqrt) * sqrt_05;
944 const Complex dy = y_zero ? 0
945 : (0.5 * (dConst2 - dConst1) / tmp_y_sqrt) *
947 const Complex dx2 = 2 * x *
dx;
948 const Complex dy2 = 2 * y * dy;
949 const Complex dcy = -sy * dy;
950 const Complex dsy = cy * dy;
951 const Complex dcx = sx *
dx;
952 const Complex dsx = cx *
dx;
953 const Complex dix = -dx * ix * ix;
954 const Complex diy = -dy * iy * iy;
955 const Complex dx2dy2 = dx2 + dy2;
959 : (dcy * x2 + cy * dx2 + dcx * y2 + cx * dy2 - C0c * dx2dy2) *
963 : (dsy * x2 * iy + sy * dx2 * iy + sy * x2 * diy +
964 dsx * y2 * ix + sx * dy2 * ix + sx * y2 * dix -
968 both_zero ? 0.0 : (dcx - dcy - C2c * dx2dy2) * inv_x2y2;
971 : ((x_zero ? -dsy * iy - sy * diy
972 : y_zero ? dsx * ix + sx * dix
973 : dsx * ix + sx * dix - dsy * iy -
978 const Numeric& dC0 =
reinterpret_cast<const Numeric(&)[2]
>(dC0c)[0];
979 const Numeric& dC1 =
reinterpret_cast<const Numeric(&)[2]
>(dC1c)[0];
980 const Numeric& dC2 =
reinterpret_cast<const Numeric(&)[2]
>(dC2c)[0];
981 const Numeric& dC3 =
reinterpret_cast<const Numeric(&)[2]
>(dC3c)[0];
982 dT1[j].Mat4(
i).noalias() =
986 << dC0 + dC2 * (b2 + c2 + d2) + C2 * (db2 + dc2 + dd2),
987 db * C1 + b * dC1 + dC2 * (-c * u - d * v) +
988 C2 * (-dc * u - dd * v - c * du - d * dv) +
989 dC3 * (b * (b2 + c2 + d2) - u * (b * u - d * w) -
990 v * (b * v + c *
w)) +
991 C3 * (db * (b2 + c2 + d2) - du * (b * u - d * w) -
992 dv * (b * v + c *
w) + b * (db2 + dc2 + dd2) -
993 u * (db * u - dd *
w) - v * (db * v + dc * w) -
994 u * (b * du - d *
dw) - v * (b * dv + c *
dw)),
995 dC1 * c + C1 * dc + dC2 * (b * u - d * w) +
996 C2 * (db * u - dd * w + b * du - d *
dw) +
997 dC3 * (c * (b2 + c2 + d2) - u * (c * u + d * v) -
998 w * (b * v + c * w)) +
999 C3 * (dc * (b2 + c2 + d2) - du * (c * u + d * v) -
1000 dw * (b * v + c * w) + c * (db2 + dc2 + dd2) -
1001 u * (dc * u + dd * v) - w * (db * v + dc *
w) -
1002 u * (c * du + d * dv) - w * (b * dv + c *
dw)),
1003 dC1 * d + C1 * dd + dC2 * (b * v + c *
w) +
1004 C2 * (db * v + dc * w + b * dv + c * dw) +
1005 dC3 * (d * (b2 + c2 + d2) - v * (c * u + d * v) +
1006 w * (b * u - d *
w)) +
1007 C3 * (dd * (b2 + c2 + d2) - dv * (c * u + d * v) +
1008 dw * (b * u - d *
w) + d * (db2 + dc2 + dd2) -
1009 v * (dc * u + dd * v) + w * (db * u - dd * w) -
1010 v * (c * du + d * dv) + w * (b * du - d * dw)),
1012 db * C1 + b * dC1 + dC2 * (c * u + d * v) +
1013 C2 * (dc * u + dd * v + c * du + d * dv) +
1014 dC3 * (-b * (-b2 + u2 + v2) + c * (b * c - v *
w) +
1015 d * (b * d + u * w)) +
1016 C3 * (-db * (-b2 + u2 + v2) + dc * (b * c - v *
w) +
1017 dd * (b * d + u * w) - b * (-db2 + du2 + dv2) +
1018 c * (db * c - dv * w) + d * (db * d + du *
w) +
1019 c * (b * dc - v * dw) + d * (b * dd + u *
dw)),
1020 dC0 + dC2 * (b2 - u2 - v2) + C2 * (db2 - du2 - dv2),
1021 dC2 * (b * c - v *
w) +
1022 C2 * (db * c + b * dc - dv * w - v * dw) + dC1 * u +
1024 dC3 * (c * (c * u + d * v) - u * (-b2 + u2 + v2) -
1025 w * (b * d + u *
w)) +
1026 C3 * (dc * (c * u + d * v) - du * (-b2 + u2 + v2) -
1027 dw * (b * d + u *
w) + c * (dc * u + dd * v) -
1028 u * (-db2 + du2 + dv2) - w * (db * d + du * w) +
1029 c * (c * du + d * dv) - w * (b * dd + u * dw)),
1030 dC2 * (b * d + u * w) +
1031 C2 * (db * d + b * dd + du * w + u *
dw) + dC1 * v +
1033 dC3 * (d * (c * u + d * v) - v * (-b2 + u2 + v2) +
1034 w * (b * c - v * w)) +
1035 C3 * (dd * (c * u + d * v) - dv * (-b2 + u2 + v2) +
1036 dw * (b * c - v * w) + d * (dc * u + dd * v) -
1037 v * (-db2 + du2 + dv2) + w * (db * c - dv *
w) +
1038 d * (c * du + d * dv) + w * (b * dc - v *
dw)),
1040 dC1 * c + C1 * dc + dC2 * (-b * u + d *
w) +
1041 C2 * (-db * u + dd * w - b * du + d * dw) +
1042 dC3 * (b * (b * c - v *
w) - c * (-c2 + u2 + w2) +
1043 d * (c * d - u * v)) +
1044 C3 * (db * (b * c - v *
w) - dc * (-c2 + u2 + w2) +
1045 dd * (c * d - u * v) + b * (db * c - dv * w) -
1046 c * (-dc2 + du2 + dw2) + d * (dc * d - du * v) +
1047 b * (b * dc - v *
dw) + d * (c * dd - u * dv)),
1048 dC2 * (b * c - v * w) +
1049 C2 * (db * c + b * dc - dv * w - v *
dw) - dC1 * u -
1051 dC3 * (-b * (b * u - d * w) + u * (-c2 + u2 + w2) -
1052 v * (c * d - u * v)) +
1053 C3 * (-db * (b * u - d * w) + du * (-c2 + u2 + w2) -
1054 dv * (c * d - u * v) - b * (db * u - dd *
w) +
1055 u * (-dc2 + du2 + dw2) - v * (dc * d - du * v) -
1056 b * (b * du - d * dw) - v * (c * dd - u * dv)),
1057 dC0 + dC2 * (c2 - u2 - w2) + C2 * (dc2 - du2 - dw2),
1058 dC2 * (c * d - u * v) +
1059 C2 * (dc * d + c * dd - du * v - u * dv) + dC1 * w +
1061 dC3 * (-d * (b * u - d *
w) + v * (b * c - v * w) -
1062 w * (-c2 + u2 + w2)) +
1063 C3 * (-dd * (b * u - d *
w) + dv * (b * c - v * w) -
1064 dw * (-c2 + u2 + w2) - d * (db * u - dd * w) +
1065 v * (db * c - dv *
w) - w * (-dc2 + du2 + dw2) -
1066 d * (b * du - d *
dw) + v * (b * dc - v * dw)),
1068 dC1 * d + C1 * dd + dC2 * (-b * v - c * w) +
1069 C2 * (-db * v - dc * w - b * dv - c *
dw) +
1070 dC3 * (b * (b * d + u * w) + c * (c * d - u * v) -
1071 d * (-d2 + v2 + w2)) +
1072 C3 * (db * (b * d + u * w) + dc * (c * d - u * v) -
1073 dd * (-d2 + v2 + w2) + b * (db * d + du *
w) +
1074 c * (dc * d - du * v) - d * (-dd2 + dv2 + dw2) +
1075 b * (b * dd + u * dw) + c * (c * dd - u * dv)),
1076 dC2 * (b * d + u *
w) +
1077 C2 * (db * d + b * dd + du * w + u * dw) - dC1 * v -
1079 dC3 * (-b * (b * v + c *
w) - u * (c * d - u * v) +
1080 v * (-d2 + v2 + w2)) +
1081 C3 * (-db * (b * v + c *
w) - du * (c * d - u * v) +
1082 dv * (-d2 + v2 + w2) - b * (db * v + dc * w) -
1083 u * (dc * d - du * v) + v * (-dd2 + dv2 + dw2) -
1084 b * (b * dv + c *
dw) - u * (c * dd - u * dv)),
1085 dC2 * (c * d - u * v) +
1086 C2 * (dc * d + c * dd - du * v - u * dv) - dC1 * w -
1088 dC3 * (-c * (b * v + c * w) + u * (b * d + u *
w) +
1089 w * (-d2 + v2 + w2)) +
1090 C3 * (-dc * (b * v + c * w) + du * (b * d + u *
w) +
1091 dw * (-d2 + v2 + w2) - c * (db * v + dc *
w) +
1092 u * (db * d + du * w) + w * (-dd2 + dv2 + dw2) -
1093 c * (b * dv + c * dw) + u * (b * dd + u *
dw)),
1094 dC0 + dC2 * (d2 - v2 - w2) + C2 * (dd2 - dv2 - dw2))
1097 if (dK2[j].NumberOfFrequencies()) {
1098 const Numeric da = -0.5 * (
r * dK2[j].Kjj(iz, ia)[
i] +
1099 ((j == it) ? dr_dT2 * (K1.Kjj(iz, ia)[
i] +
1102 db = -0.5 * (
r * dK2[j].K12(iz, ia)[
i] +
1103 ((j == it) ? dr_dT2 * (K1.K12(iz, ia)[
i] +
1106 dc = -0.5 * (
r * dK2[j].K13(iz, ia)[
i] +
1107 ((j == it) ? dr_dT2 * (K1.K13(iz, ia)[
i] +
1110 dd = -0.5 * (
r * dK2[j].K14(iz, ia)[
i] +
1111 ((j == it) ? dr_dT2 * (K1.K14(iz, ia)[
i] +
1114 du = -0.5 * (
r * dK2[j].K23(iz, ia)[
i] +
1115 ((j == it) ? dr_dT2 * (K1.K23(iz, ia)[
i] +
1118 dv = -0.5 * (
r * dK2[j].K24(iz, ia)[
i] +
1119 ((j == it) ? dr_dT2 * (K1.K24(iz, ia)[
i] +
1122 dw = -0.5 * (
r * dK2[j].K34(iz, ia)[
i] +
1123 ((j == it) ? dr_dT2 * (K1.K34(iz, ia)[
i] +
1126 const Numeric db2 = 2 * db * b, dc2 = 2 * dc * c, dd2 = 2 * dd * d,
1127 du2 = 2 * du * u, dv2 = 2 * dv * v, dw2 = 2 *
dw *
w;
1130 2 * (db2 * (b2 * 0.5 + c2 + d2 - u2 - v2 + w2) +
1131 b2 * (db2 * 0.5 + dc2 + dd2 - du2 - dv2 + dw2) +
1132 dc2 * (c2 * 0.5 + d2 - u2 + v2 - w2) +
1133 c2 * (dc2 * 0.5 + dd2 - du2 + dv2 - dw2) +
1134 dd2 * (d2 * 0.5 + u2 - v2 - w2) +
1135 d2 * (dd2 * 0.5 + du2 - dv2 - dw2) +
1136 du2 * (u2 * 0.5 + v2 + w2) + u2 * (du2 * 0.5 + dv2 + dw2) +
1137 dv2 * (v2 * 0.5 + w2) + v2 * (dv2 * 0.5 + dw2) +
1138 4 * (db * d * u * w - db * c * v * w - dc * d * u * v +
1139 b * dd * u * w - b * dc * v * w - c * dd * u * v +
1140 b * d * du * w - b * c * dv * w - c * d * du * v +
1141 b * d * u *
dw - b * c * v *
dw - c * d * u * dv));
1142 const Complex dConst1 = 0.5 * dtmp / Const1;
1143 const Numeric dConst2 = db2 + dc2 + dd2 - du2 - dv2 - dw2;
1145 x_zero ? 0 : (0.5 * (dConst2 + dConst1) / tmp_x_sqrt) * sqrt_05;
1146 const Complex dy = y_zero ? 0
1147 : (0.5 * (dConst2 - dConst1) / tmp_y_sqrt) *
1149 const Complex dx2 = 2 * x *
dx;
1150 const Complex dy2 = 2 * y * dy;
1151 const Complex dcy = -sy * dy;
1152 const Complex dsy = cy * dy;
1153 const Complex dcx = sx *
dx;
1154 const Complex dsx = cx *
dx;
1155 const Complex dix = -dx * ix * ix;
1156 const Complex diy = -dy * iy * iy;
1157 const Complex dx2dy2 = dx2 + dy2;
1158 const Complex dC0c =
1161 : (dcy * x2 + cy * dx2 + dcx * y2 + cx * dy2 - C0c * dx2dy2) *
1163 const Complex dC1c =
1165 : (dsy * x2 * iy + sy * dx2 * iy + sy * x2 * diy +
1166 dsx * y2 * ix + sx * dy2 * ix + sx * y2 * dix -
1169 const Complex dC2c =
1170 both_zero ? 0.0 : (dcx - dcy - C2c * dx2dy2) * inv_x2y2;
1171 const Complex dC3c =
1173 : ((x_zero ? -dsy * iy - sy * diy
1174 : y_zero ? dsx * ix + sx * dix
1175 : dsx * ix + sx * dix - dsy * iy -
1180 const Numeric& dC0 =
reinterpret_cast<const Numeric(&)[2]
>(dC0c)[0];
1181 const Numeric& dC1 =
reinterpret_cast<const Numeric(&)[2]
>(dC1c)[0];
1182 const Numeric& dC2 =
reinterpret_cast<const Numeric(&)[2]
>(dC2c)[0];
1183 const Numeric& dC3 =
reinterpret_cast<const Numeric(&)[2]
>(dC3c)[0];
1184 dT2[j].Mat4(
i).noalias() =
1188 << dC0 + dC2 * (b2 + c2 + d2) + C2 * (db2 + dc2 + dd2),
1189 db * C1 + b * dC1 + dC2 * (-c * u - d * v) +
1190 C2 * (-dc * u - dd * v - c * du - d * dv) +
1191 dC3 * (b * (b2 + c2 + d2) - u * (b * u - d * w) -
1192 v * (b * v + c *
w)) +
1193 C3 * (db * (b2 + c2 + d2) - du * (b * u - d * w) -
1194 dv * (b * v + c *
w) + b * (db2 + dc2 + dd2) -
1195 u * (db * u - dd *
w) - v * (db * v + dc * w) -
1196 u * (b * du - d *
dw) - v * (b * dv + c *
dw)),
1197 dC1 * c + C1 * dc + dC2 * (b * u - d * w) +
1198 C2 * (db * u - dd * w + b * du - d *
dw) +
1199 dC3 * (c * (b2 + c2 + d2) - u * (c * u + d * v) -
1200 w * (b * v + c * w)) +
1201 C3 * (dc * (b2 + c2 + d2) - du * (c * u + d * v) -
1202 dw * (b * v + c * w) + c * (db2 + dc2 + dd2) -
1203 u * (dc * u + dd * v) - w * (db * v + dc *
w) -
1204 u * (c * du + d * dv) - w * (b * dv + c *
dw)),
1205 dC1 * d + C1 * dd + dC2 * (b * v + c *
w) +
1206 C2 * (db * v + dc * w + b * dv + c * dw) +
1207 dC3 * (d * (b2 + c2 + d2) - v * (c * u + d * v) +
1208 w * (b * u - d *
w)) +
1209 C3 * (dd * (b2 + c2 + d2) - dv * (c * u + d * v) +
1210 dw * (b * u - d *
w) + d * (db2 + dc2 + dd2) -
1211 v * (dc * u + dd * v) + w * (db * u - dd * w) -
1212 v * (c * du + d * dv) + w * (b * du - d * dw)),
1214 db * C1 + b * dC1 + dC2 * (c * u + d * v) +
1215 C2 * (dc * u + dd * v + c * du + d * dv) +
1216 dC3 * (-b * (-b2 + u2 + v2) + c * (b * c - v *
w) +
1217 d * (b * d + u * w)) +
1218 C3 * (-db * (-b2 + u2 + v2) + dc * (b * c - v *
w) +
1219 dd * (b * d + u * w) - b * (-db2 + du2 + dv2) +
1220 c * (db * c - dv * w) + d * (db * d + du *
w) +
1221 c * (b * dc - v * dw) + d * (b * dd + u *
dw)),
1222 dC0 + dC2 * (b2 - u2 - v2) + C2 * (db2 - du2 - dv2),
1223 dC2 * (b * c - v *
w) +
1224 C2 * (db * c + b * dc - dv * w - v * dw) + dC1 * u +
1226 dC3 * (c * (c * u + d * v) - u * (-b2 + u2 + v2) -
1227 w * (b * d + u *
w)) +
1228 C3 * (dc * (c * u + d * v) - du * (-b2 + u2 + v2) -
1229 dw * (b * d + u *
w) + c * (dc * u + dd * v) -
1230 u * (-db2 + du2 + dv2) - w * (db * d + du * w) +
1231 c * (c * du + d * dv) - w * (b * dd + u * dw)),
1232 dC2 * (b * d + u * w) +
1233 C2 * (db * d + b * dd + du * w + u *
dw) + dC1 * v +
1235 dC3 * (d * (c * u + d * v) - v * (-b2 + u2 + v2) +
1236 w * (b * c - v * w)) +
1237 C3 * (dd * (c * u + d * v) - dv * (-b2 + u2 + v2) +
1238 dw * (b * c - v * w) + d * (dc * u + dd * v) -
1239 v * (-db2 + du2 + dv2) + w * (db * c - dv *
w) +
1240 d * (c * du + d * dv) + w * (b * dc - v *
dw)),
1242 dC1 * c + C1 * dc + dC2 * (-b * u + d *
w) +
1243 C2 * (-db * u + dd * w - b * du + d * dw) +
1244 dC3 * (b * (b * c - v *
w) - c * (-c2 + u2 + w2) +
1245 d * (c * d - u * v)) +
1246 C3 * (db * (b * c - v *
w) - dc * (-c2 + u2 + w2) +
1247 dd * (c * d - u * v) + b * (db * c - dv * w) -
1248 c * (-dc2 + du2 + dw2) + d * (dc * d - du * v) +
1249 b * (b * dc - v *
dw) + d * (c * dd - u * dv)),
1250 dC2 * (b * c - v * w) +
1251 C2 * (db * c + b * dc - dv * w - v *
dw) - dC1 * u -
1253 dC3 * (-b * (b * u - d * w) + u * (-c2 + u2 + w2) -
1254 v * (c * d - u * v)) +
1255 C3 * (-db * (b * u - d * w) + du * (-c2 + u2 + w2) -
1256 dv * (c * d - u * v) - b * (db * u - dd *
w) +
1257 u * (-dc2 + du2 + dw2) - v * (dc * d - du * v) -
1258 b * (b * du - d * dw) - v * (c * dd - u * dv)),
1259 dC0 + dC2 * (c2 - u2 - w2) + C2 * (dc2 - du2 - dw2),
1260 dC2 * (c * d - u * v) +
1261 C2 * (dc * d + c * dd - du * v - u * dv) + dC1 * w +
1263 dC3 * (-d * (b * u - d *
w) + v * (b * c - v * w) -
1264 w * (-c2 + u2 + w2)) +
1265 C3 * (-dd * (b * u - d *
w) + dv * (b * c - v * w) -
1266 dw * (-c2 + u2 + w2) - d * (db * u - dd * w) +
1267 v * (db * c - dv *
w) - w * (-dc2 + du2 + dw2) -
1268 d * (b * du - d *
dw) + v * (b * dc - v * dw)),
1270 dC1 * d + C1 * dd + dC2 * (-b * v - c * w) +
1271 C2 * (-db * v - dc * w - b * dv - c *
dw) +
1272 dC3 * (b * (b * d + u * w) + c * (c * d - u * v) -
1273 d * (-d2 + v2 + w2)) +
1274 C3 * (db * (b * d + u * w) + dc * (c * d - u * v) -
1275 dd * (-d2 + v2 + w2) + b * (db * d + du *
w) +
1276 c * (dc * d - du * v) - d * (-dd2 + dv2 + dw2) +
1277 b * (b * dd + u * dw) + c * (c * dd - u * dv)),
1278 dC2 * (b * d + u *
w) +
1279 C2 * (db * d + b * dd + du * w + u * dw) - dC1 * v -
1281 dC3 * (-b * (b * v + c *
w) - u * (c * d - u * v) +
1282 v * (-d2 + v2 + w2)) +
1283 C3 * (-db * (b * v + c *
w) - du * (c * d - u * v) +
1284 dv * (-d2 + v2 + w2) - b * (db * v + dc * w) -
1285 u * (dc * d - du * v) + v * (-dd2 + dv2 + dw2) -
1286 b * (b * dv + c *
dw) - u * (c * dd - u * dv)),
1287 dC2 * (c * d - u * v) +
1288 C2 * (dc * d + c * dd - du * v - u * dv) - dC1 * w -
1290 dC3 * (-c * (b * v + c * w) + u * (b * d + u *
w) +
1291 w * (-d2 + v2 + w2)) +
1292 C3 * (-dc * (b * v + c * w) + du * (b * d + u *
w) +
1293 dw * (-d2 + v2 + w2) - c * (db * v + dc *
w) +
1294 u * (db * d + du * w) + w * (-dd2 + dv2 + dw2) -
1295 c * (b * dv + c * dw) + u * (b * dd + u *
dw)),
1296 dC0 + dC2 * (d2 - v2 - w2) + C2 * (dd2 - dv2 - dw2))
1308 switch (K1.StokesDimensions()) {
1334 const Index it = -1,
1336 const Index ia = 0) noexcept {
1339 dtransmat4(T, dT1, dT2, K1, K2, dK1, dK2, r, dr_dT1, dr_dT2, it, iz, ia);
1342 dtransmat3(T, dT1, dT2, K1, K2, dK1, dK2, r, dr_dT1, dr_dT2, it, iz, ia);
1345 dtransmat2(T, dT1, dT2, K1, K2, dK1, dK2, r, dr_dT1, dr_dT2, it, iz, ia);
1348 dtransmat1(T, dT1, dT2, K1, K2, dK1, dK2, r, dr_dT1, dr_dT2, it, iz, ia);
1363 const Index temp_deriv_pos) {
1364 if (not dT1.
nelem())
1368 T, dT1, dT2, K1, K2, dK1, dK2, r, dr_dtemp1, dr_dtemp2, temp_deriv_pos);
1382 const bool& jacobian_do) {
1387 for (
Index j = 0; j < jacobian_quantities.
nelem(); j++)
1388 if (jacobian_quantities[j].Analytical()) dJ[j].SetZero(
i);
1403 for (
Index j = 0; j < jacobian_quantities.
nelem(); j++)
1404 if (jacobian_quantities[j].Analytical())
1405 dJ[j].Vec4(
i).noalias() =
1428 for (
Index j = 0; j < jacobian_quantities.
nelem(); j++)
1429 if (jacobian_quantities[j].Analytical())
1430 dJ[j].Vec3(
i).noalias() =
1449 for (
Index j = 0; j < jacobian_quantities.
nelem(); j++)
1450 if (jacobian_quantities[j].Analytical())
1451 dJ[j].Vec2(
i).noalias() =
1463 const auto invK = 1 / K.
Kjj()[
i];
1464 J.
Vec1(
i)[0] *= invK;
1466 for (
Index j = 0; j < jacobian_quantities.
nelem(); j++)
1467 if (jacobian_quantities[j].Analytical())
1477 dK[j].Kjj()[
i] * J.
Vec1(
i)[0]);
1499 for (
size_t i = 0;
i < dI1.size();
i++) {
1500 dI1[
i].addDerivEmission(PiT, dT1[
i], T, I, dJ1[i]);
1501 dI2[i].addDerivEmission(PiT, dT2[i], T, I, dJ2[i]);
1508 for (
size_t i = 0;
i < dI1.size();
i++) {
1509 dI1[
i].addDerivTransmission(PiT, dT1[
i], I);
1510 dI2[i].addDerivTransmission(PiT, dT2[i], I);
1532 const Index nf = n ? T[0].Frequencies() : 1;
1533 const Index ns = n ? T[0].StokesDim() : 1;
1537 for (
Index i = 1;
i < n;
i++) PiT[
i].mul(PiT[
i - 1], T[
i]);
1540 for (
Index i = 1;
i < n;
i++) PiT[
i].mul(T[
i], PiT[i - 1]);
1561 const Index nv = np ? I[0].Frequencies() : 0;
1562 const Index ns = np ? I[0].StokesDim() : 1;
1566 for (
Index ip = 0; ip < np; ip++)
1567 I[ip].setBackscatterTransmission(I_incoming, PiTr[ip], PiTf[ip], Z[ip]);
1569 for (
Index ip = 0; ip < np; ip++) {
1570 for (
Index iq = 0; iq < nq; iq++) {
1571 dI[ip][ip][iq].setBackscatterTransmissionDerivative(
1572 I_incoming, PiTr[ip], PiTf[ip], dZ[ip][iq]);
1581 BackscatterSolverCommutativeTransmissionStokesDimOne:
1582 for (
Index ip = 0; ip < np; ip++) {
1583 for (
Index j = ip; j < np; j++) {
1584 for (
Index iq = 0; iq < nq; iq++) {
1585 for (
Index iv = 0; iv < nv; iv++) {
1586 dI[ip][j][iq].Vec1(iv).noalias() +=
1587 T[ip].Mat1(iv).inverse() *
1588 (dT1[ip][iq].Mat1(iv) + dT2[ip][iq].Mat1(iv)) *
1591 if (j < np - 1 and j > ip)
1592 dI[ip][j][iq].Vec1(iv).noalias() +=
1593 T[ip+1].Mat1(iv).inverse() *
1594 (dT1[ip][iq].Mat1(iv) + dT2[ip][iq].Mat1(iv)) *
1602 for (
Index ip = 0; ip < np; ip++) {
1603 for (
Index j = ip; j < np; j++) {
1604 for (
Index iq = 0; iq < nq; iq++) {
1605 for (
Index iv = 0; iv < nv; iv++) {
1606 dI[ip][j][iq].Vec2(iv).noalias() +=
1607 T[ip].Mat2(iv).inverse() *
1608 (dT1[ip][iq].Mat2(iv) + dT2[ip][iq].Mat2(iv)) *
1611 if (j < np - 1 and j > ip)
1612 dI[ip][j][iq].Vec2(iv).noalias() +=
1613 T[ip+1].Mat2(iv).inverse() *
1614 (dT1[ip][iq].Mat2(iv) + dT2[ip][iq].Mat2(iv)) *
1622 for (
Index ip = 0; ip < np; ip++) {
1623 for (
Index j = ip; j < np; j++) {
1624 for (
Index iq = 0; iq < nq; iq++) {
1625 for (
Index iv = 0; iv < nv; iv++) {
1626 dI[ip][j][iq].Vec3(iv).noalias() +=
1627 T[ip].Mat3(iv).inverse() *
1628 (dT1[ip][iq].Mat3(iv) + dT2[ip][iq].Mat3(iv)) *
1631 if (j < np - 1 and j > ip)
1632 dI[ip][j][iq].Vec3(iv).noalias() +=
1633 T[ip+1].Mat3(iv).inverse() *
1634 (dT1[ip][iq].Mat3(iv) + dT2[ip][iq].Mat3(iv)) *
1642 for (
Index ip = 0; ip < np; ip++) {
1643 for (
Index j = ip; j < np; j++) {
1644 for (
Index iq = 0; iq < nq; iq++) {
1645 for (
Index iv = 0; iv < nv; iv++) {
1646 dI[ip][j][iq].Vec4(iv).noalias() +=
1647 T[ip].Mat4(iv).inverse() *
1648 (dT1[ip][iq].Mat4(iv) + dT2[ip][iq].Mat4(iv)) *
1651 if (j < np - 1 and j > ip)
1652 dI[ip][j][iq].Vec4(iv).noalias() +=
1653 T[ip+1].Mat4(iv).inverse() *
1654 (dT1[ip][iq].Mat4(iv) + dT2[ip][iq].Mat4(iv)) *
1664 std::runtime_error(
"Do not activate this code. It is not ready yet");
1668 goto BackscatterSolverCommutativeTransmissionStokesDimOne;
1671 for (
Index ip = 0; ip < np; ip++) {
1672 for (
Index j = ip; j < np; j++) {
1673 for (
Index iq = 0; iq < nq; iq++) {
1674 for (
Index iv = 0; iv < nv; iv++) {
1676 dI[ip][j][iq].Vec2(iv).noalias() +=
1677 PiTr[ip-2].Mat2(iv) *
1678 (dT1[ip-1][iq].Mat2(iv) + dT2[ip][iq].Mat2(iv)) *
1679 PiTr[ip-1].Mat2(iv).inverse() * I[j].Vec2(iv);
1682 dI[ip][j][iq].Vec2(iv).noalias() +=
1683 PiTr[ip].Mat2(iv) * Z[ip].Mat2(iv) * PiTf[ip-2].Mat2(iv) *
1684 (dT1[ip][iq].Mat2(iv) + dT2[ip+1][iq].Mat2(iv)) *
1685 PiTf[ip-1].Mat2(iv).inverse() * PiTf[ip].Mat2(iv) *
1689 dI[ip][j][iq].Vec2(iv).noalias() +=
1690 (dT1[ip-1][iq].Mat2(iv) + dT2[ip][iq].Mat2(iv)) *
1691 PiTr[ip-1].Mat2(iv).inverse() * I[j].Vec2(iv);
1694 dI[ip][j][iq].Vec2(iv).noalias() +=
1695 PiTr[ip].Mat2(iv) * Z[ip].Mat2(iv) *
1696 (dT1[ip][iq].Mat2(iv) + dT2[ip+1][iq].Mat2(iv)) *
1697 PiTf[ip-1].Mat2(iv).inverse() * PiTf[ip].Mat2(iv) *
1722 for (
Index ip = 0; ip < np; ip++) {
1727 for (
Index iv = 0; iv < nv; iv++)
1728 for (
Index id = 0;
id < nd;
id++)
1729 aotm[ip].Mat4(iv).noalias() +=
1733 for (
Index iv = 0; iv < nv; iv++)
1734 for (
Index id = 0;
id < nd;
id++)
1735 aotm[ip].Mat3(iv).noalias() +=
1739 for (
Index iv = 0; iv < nv; iv++)
1740 for (
Index id = 0;
id < nd;
id++)
1741 aotm[ip].Mat2(iv).noalias() +=
1745 for (
Index iv = 0; iv < nv; iv++)
1746 for (
Index id = 0;
id < nd;
id++)
1747 aotm[ip].Mat1(iv).noalias() +=
1765 for (
Index ip = 0; ip < np; ip++) {
1766 for (
Index iq = 0; iq < nq; iq++) {
1767 aoaotm[ip][iq].setZero();
1769 if(not aom[iq].empty()) {
1772 for (
Index iv = 0; iv < nv; iv++)
1773 for (
Index id = 0;
id < nd;
id++)
1774 aoaotm[ip][iq].Mat4(iv).noalias() +=
1778 for (
Index iv = 0; iv < nv; iv++)
1779 for (
Index id = 0;
id < nd;
id++)
1780 aoaotm[ip][iq].Mat3(iv).noalias() +=
1784 for (
Index iv = 0; iv < nv; iv++)
1785 for (
Index id = 0;
id < nd;
id++)
1786 aoaotm[ip][iq].Mat2(iv).noalias() +=
1790 for (
Index iv = 0; iv < nv; iv++)
1791 for (
Index id = 0;
id < nd;
id++)
1792 aoaotm[ip][iq].Mat1(iv).noalias() +=
1805 for (
const auto& T : tm.
T4) os << T <<
'\n';
1806 for (
const auto& T : tm.
T3) os << T <<
'\n';
1807 for (
const auto& T : tm.
T2) os << T <<
'\n';
1808 for (
const auto& T : tm.
T1) os << T <<
'\n';
1814 for (
const auto& T : atm) os << T <<
'\n';
1820 for (
const auto& T : aatm) os << T <<
'\n';
1826 for (
const auto& R : rv.
R4) os << R.transpose() <<
'\n';
1827 for (
const auto& R : rv.
R3) os << R.transpose() <<
'\n';
1828 for (
const auto& R : rv.
R2) os << R.transpose() <<
'\n';
1829 for (
const auto& R : rv.
R1) os << R.transpose() <<
'\n';
1834 for (
const auto& R : arv) os << R <<
'\n';
1840 for (
const auto& R : aarv) os << R <<
'\n';
1845 for (
auto& T : tm.
T4)
1846 is >> T(0, 0) >> T(0, 1) >> T(0, 2) >> T(0, 3) >>
1847 T(1, 0) >> T(1, 1) >> T(1, 2) >> T(1, 3) >>
1848 T(2, 0) >> T(2, 1) >> T(2, 2) >> T(2, 3) >>
1849 T(3, 0) >> T(3, 1) >> T(3, 2) >> T(3, 3);
1850 for (
auto& T : tm.
T3)
1851 is >> T(0, 0) >> T(0, 1) >> T(0, 2) >>
1852 T(1, 0) >> T(1, 1) >> T(1, 2) >>
1853 T(2, 0) >> T(2, 1) >> T(2, 2);
1854 for (
auto& T : tm.
T2) is >> T(0, 0) >> T(0, 1) >>
1856 for (
auto& T : tm.
T1) is >> T(0, 0);
1861 for (
auto& R : rv.
R4) is >> R[0] >> R[1] >> R[2] >> R[3];
1862 for (
auto& R : rv.
R3) is >> R[0] >> R[1] >> R[2];
1863 for (
auto& R : rv.
R2) is >> R[0] >> R[1] >> R[2];
1864 for (
auto& R : rv.
R1) is >> R[0];
Index npages() const
Returns the number of pages.
INDEX Index
The type to use for all integer numbers and indices.
Class to keep track of Transmission Matrices for Stokes Dim 1-4.
Eigen::Matrix3d matrix3(const Numeric &a, const Numeric &b, const Numeric &c, const Numeric &u) noexcept
RadiativeTransferSolver
Intended to hold various forward solvers.
A class implementing complex numbers for ARTS.
Index nelem() const
Number of elements.
TransmissionMatrix(Index nf=0, Index stokes=1)
Construct a new Transmission Matrix object.
bool IsRotational(const Index iv=0, const Index iz=0, const Index ia=0) const
False if diagonal element is non-zero in internal Matrix representation.
void dtransmat3(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dT1, const Numeric &dr_dT2, const Index it, const Index iz, const Index ia) noexcept
constexpr Numeric lower_is_considered_zero_for_sinc_likes
Constants of physical expressions as constexpr.
void stepwise_transmission(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dtemp1, const Numeric &dr_dtemp2, const Index temp_deriv_pos)
Set the stepwise transmission matrix.
void dtransmat2(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dT1, const Numeric &dr_dT2, const Index it, const Index iz, const Index ia) noexcept
VectorView K24(const Index iz=0, const Index ia=0)
Vector view to K(1, 3) elements.
CumulativeTransmission
Intended to hold various ways to accumulate the transmission matrix.
cmplx FADDEEVA() w(cmplx z, double relerr)
const Eigen::Vector2d & Vec2(size_t i) const
Return Vector at position.
void setSource(const StokesVector &a, const ConstVectorView &B, const StokesVector &S, Index i)
Set this to source vector at position.
Index nbooks() const
Returns the number of books.
std::ostream & operator<<(std::ostream &os, const TransmissionMatrix &tm)
Output operator.
Stokes vector is as Propagation matrix but only has 4 possible values.
void transmat(TransmissionMatrix &T, const PropagationMatrix &K1, const PropagationMatrix &K2, const Numeric &r) noexcept
void rem_avg(const RadiationVector &O1, const RadiationVector &O2)
Remove the average of two other RadiationVector from *this.
Eigen::Matrix2d matrix2(const Numeric &a, const Numeric &b) noexcept
VectorView K23(const Index iz=0, const Index ia=0)
Vector view to K(1, 2) elements.
void add_avg(const RadiationVector &O1, const RadiationVector &O2)
Add the average of two other RadiationVector to *this.
VectorView K13(const Index iz=0, const Index ia=0)
Vector view to K(0, 2) elements.
std::vector< Eigen::Matrix3d, Eigen::aligned_allocator< Eigen::Matrix3d > > T3
std::istream & operator>>(std::istream &is, TransmissionMatrix &tm)
Input operator.
VectorView K12(const Index iz=0, const Index ia=0)
Vector view to K(0, 1) elements.
Eigen::Vector4d vector4(const StokesVector &a, const ConstVectorView &B, const StokesVector &da, const ConstVectorView &dB_dT, const StokesVector &dS, bool dT, Index i) noexcept
Index nshelves() const
Returns the number of shelves.
Eigen::Matrix< double, 1, 1 > matrix1(const Numeric &a) noexcept
VectorView K34(const Index iz=0, const Index ia=0)
Vector view to K(2, 3) elements.
Eigen::Vector2d vector2(const StokesVector &a, const ConstVectorView &B, const StokesVector &da, const ConstVectorView &dB_dT, const StokesVector &dS, bool dT, Index i) noexcept
ArrayOfTransmissionMatrix cumulative_transmission(const ArrayOfTransmissionMatrix &T, const CumulativeTransmission type)
Accumulate the transmission matrix over all layers.
std::complex< Numeric > Complex
Array< TransmissionMatrix > ArrayOfTransmissionMatrix
Eigen::Matrix3d inv3(const Numeric &a, const Numeric &b, const Numeric &c, const Numeric &u) noexcept
void dtransmat(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dT1=0, const Numeric &dr_dT2=0, const Index it=-1, const Index iz=0, const Index ia=0) noexcept
void stepwise_source(RadiationVector &J, ArrayOfRadiationVector &dJ, const PropagationMatrix &K, const StokesVector &a, const StokesVector &S, const ArrayOfPropagationMatrix &dK, const ArrayOfStokesVector &da, const ArrayOfStokesVector &dS, const ConstVectorView B, const ConstVectorView dB_dT, const ArrayOfRetrievalQuantity &jacobian_quantities, const bool &jacobian_do)
Set the stepwise source.
Stuff related to the transmission matrix.
void SetZero(size_t i)
Set Radiation Vector to Zero at position.
ArrayOfArrayOfTransmissionMatrix cumulative_backscatter_derivative(ConstTensor5View t, const ArrayOfMatrix &aom)
Accumulated backscatter derivative (???)
void transmat1(TransmissionMatrix &T, const PropagationMatrix &K1, const PropagationMatrix &K2, const Numeric &r, const Index iz=0, const Index ia=0) noexcept
Index StokesDim() const
Get Stokes dimension.
A constant view of a Tensor5.
Numeric vector1(const StokesVector &a, const ConstVectorView &B, const StokesVector &da, const ConstVectorView &dB_dT, const StokesVector &dS, bool dT, Index i) noexcept
NUMERIC Numeric
The type to use for all floating point numbers.
Index StokesDimensions() const
The stokes dimension of the propagation matrix.
constexpr Complex dw(Complex z, Complex w) noexcept
The Faddeeva function partial derivative.
BackscatterSolver
Intended to hold various backscatter solvers.
void set_backscatter_radiation_vector(ArrayOfRadiationVector &I, ArrayOfArrayOfArrayOfRadiationVector &dI, const RadiationVector &I_incoming, const ArrayOfTransmissionMatrix &T, const ArrayOfTransmissionMatrix &PiTf, const ArrayOfTransmissionMatrix &PiTr, const ArrayOfTransmissionMatrix &Z, const ArrayOfArrayOfTransmissionMatrix &dT1, const ArrayOfArrayOfTransmissionMatrix &dT2, const ArrayOfArrayOfTransmissionMatrix &dZ, const BackscatterSolver solver)
Set the backscatter radiation vector.
std::vector< Eigen::Matrix2d, Eigen::aligned_allocator< Eigen::Matrix2d > > T2
Eigen::Vector3d vector3(const StokesVector &a, const ConstVectorView &B, const StokesVector &da, const ConstVectorView &dB_dT, const StokesVector &dS, bool dT, Index i) noexcept
Radiation Vector for Stokes dimension 1-4.
std::vector< Eigen::Vector4d, Eigen::aligned_allocator< Eigen::Vector4d > > R4
const Eigen::Matrix4d & Mat4(size_t i) const
Get Matrix at position.
void dtransmat4(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dT1, const Numeric &dr_dT2, const Index it, const Index iz, const Index ia) noexcept
VectorView K14(const Index iz=0, const Index ia=0)
Vector view to K(0, 3) elements.
Index NumberOfFrequencies() const
The number of frequencies of the propagation matrix.
This can be used to make arrays out of anything.
const Eigen::Matrix3d & Mat3(size_t i) const
Get Matrix at position.
VectorView Kjj(const Index iz=0, const Index ia=0)
Vector view to diagonal elements.
std::vector< Eigen::Vector3d, Eigen::aligned_allocator< Eigen::Vector3d > > R3
void update_radiation_vector(RadiationVector &I, ArrayOfRadiationVector &dI1, ArrayOfRadiationVector &dI2, const RadiationVector &J1, const RadiationVector &J2, const ArrayOfRadiationVector &dJ1, const ArrayOfRadiationVector &dJ2, const TransmissionMatrix &T, const TransmissionMatrix &PiT, const ArrayOfTransmissionMatrix &dT1, const ArrayOfTransmissionMatrix &dT2, const RadiativeTransferSolver solver)
Update the Radiation Vector.
Eigen::Matrix4d matrix4(const Numeric &a, const Numeric &b, const Numeric &c, const Numeric &d, const Numeric &u, const Numeric &v, const Numeric &w) noexcept
void transmat3(TransmissionMatrix &T, const PropagationMatrix &K1, const PropagationMatrix &K2, const Numeric &r, const Index iz=0, const Index ia=0) noexcept
const Eigen::Matrix2d & Mat2(size_t i) const
Get Matrix at position.
A constant view of a Vector.
void transmat2(TransmissionMatrix &T, const PropagationMatrix &K1, const PropagationMatrix &K2, const Numeric &r, const Index iz=0, const Index ia=0) noexcept
std::vector< Eigen::Matrix4d, Eigen::aligned_allocator< Eigen::Matrix4d > > T4
A constant view of a Matrix.
std::vector< Eigen::Matrix< double, 1, 1 >, Eigen::aligned_allocator< Eigen::Matrix< double, 1, 1 > > > T1
const Eigen::Vector4d & Vec4(size_t i) const
Return Vector at position.
Index ncols() const
Returns the number of columns.
const Eigen::Vector3d & Vec3(size_t i) const
Return Vector at position.
Eigen::Matrix< double, 1, 1 > inv1(const Numeric &a) noexcept
std::vector< Eigen::Matrix< double, 1, 1 >, Eigen::aligned_allocator< Eigen::Matrix< double, 1, 1 > > > R1
Eigen::Matrix4d inv4(const Numeric &a, const Numeric &b, const Numeric &c, const Numeric &d, const Numeric &u, const Numeric &v, const Numeric &w) noexcept
void add_weighted(const TransmissionMatrix &T, const RadiationVector &close, const RadiationVector &far)
Add the weighted source of two RadiationVector to *this.
invlib::MatrixIdentity< Matrix > Identity
void dtransmat1(TransmissionMatrix &T, ArrayOfTransmissionMatrix &dT1, ArrayOfTransmissionMatrix &dT2, const PropagationMatrix &K1, const PropagationMatrix &K2, const ArrayOfPropagationMatrix &dK1, const ArrayOfPropagationMatrix &dK2, const Numeric &r, const Numeric &dr_dT1, const Numeric &dr_dT2, const Index it, const Index iz, const Index ia) noexcept
Eigen::Matrix2d inv2(const Numeric &a, const Numeric &b) noexcept
void transmat4(TransmissionMatrix &T, const PropagationMatrix &K1, const PropagationMatrix &K2, const Numeric &r, const Index iz=0, const Index ia=0) noexcept
void leftMul(const TransmissionMatrix &T)
Multiply radiation vector from the left.
ArrayOfTransmissionMatrix cumulative_backscatter(ConstTensor5View t, ConstMatrixView m)
Accumulated backscatter (???)
const Eigen::Matrix< double, 1, 1 > & Vec1(size_t i) const
Return Vector at position.
const Eigen::Matrix< double, 1, 1 > & Mat1(size_t i) const
Get Matrix at position.
Numeric sqrt(const Rational r)
Square root.
std::vector< Eigen::Vector2d, Eigen::aligned_allocator< Eigen::Vector2d > > R2