|
@@ -19,6 +19,7 @@ namespace Lemma {
|
19
|
19
|
|
20
|
20
|
rams = lambda*lambda;
|
21
|
21
|
u = (rams-kk.array()).sqrt(); // CRITICAL
|
|
22
|
+
|
22
|
23
|
uk = u(0);
|
23
|
24
|
um = u(0);
|
24
|
25
|
|
|
@@ -27,16 +28,14 @@ namespace Lemma {
|
27
|
28
|
|
28
|
29
|
Zyd.tail<1>() = Zyi.tail<1>();
|
29
|
30
|
|
30
|
|
- // Vectorise, performance is not really any better
|
|
31
|
+ // Vectorise, performance benchmarks approx. the same as loop w gcc 9 -TI
|
31
|
32
|
cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
|
32
|
33
|
th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
|
33
|
34
|
|
34
|
|
- /*
|
35
|
|
- for (int ilay=1; ilay<nlay-1; ++ilay) {
|
36
|
|
- cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
|
37
|
|
- th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
|
38
|
|
- }
|
39
|
|
- */
|
|
35
|
+// for (int ilay=1; ilay<nlay-1; ++ilay) {
|
|
36
|
+// cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
|
|
37
|
+// th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
|
|
38
|
+// }
|
40
|
39
|
|
41
|
40
|
// recursive, can't vectorize
|
42
|
41
|
for (int N=nlay-2; N >= 1; --N) {
|
|
@@ -54,6 +53,7 @@ namespace Lemma {
|
54
|
53
|
|
55
|
54
|
rams = lambda*lambda;
|
56
|
55
|
u = (rams-kk.array()).sqrt(); // CRITICAL
|
|
56
|
+
|
57
|
57
|
uk = u(0);
|
58
|
58
|
um = u(0);
|
59
|
59
|
|
|
@@ -62,16 +62,14 @@ namespace Lemma {
|
62
|
62
|
|
63
|
63
|
Zyd.tail<1>() = Zyi.tail<1>();
|
64
|
64
|
|
65
|
|
- // Vectorise
|
|
65
|
+ // Vectorise, performance benchmarks approx. the same as loop w/ gcc 9 -TI
|
66
|
66
|
cf.segment(1,nlay-2) = (-2.*u.segment(1, nlay-2).array() * LayerThickness.segment(1, nlay-2).array()).exp();
|
67
|
67
|
th.segment(1,nlay-2) = (1.-cf.segment(1, nlay-2).array()) / (1.+cf.segment(1, nlay-2).array());
|
68
|
68
|
|
69
|
|
- /*
|
70
|
|
- for (int ilay=1; ilay<nlay-1; ++ilay) {
|
71
|
|
- cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
|
72
|
|
- th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
|
73
|
|
- }
|
74
|
|
- */
|
|
69
|
+// for (int ilay=1; ilay<nlay-1; ++ilay) {
|
|
70
|
+// cf(ilay) = std::exp(-(Real)(2.)*u(ilay)*LayerThickness(ilay));
|
|
71
|
+// th(ilay) = ((Real)(1.)-cf(ilay)) / ((Real)(1.)+cf(ilay));
|
|
72
|
+// }
|
75
|
73
|
|
76
|
74
|
// recursive, can't vectorize
|
77
|
75
|
for (int N=nlay-2; N >=1; --N) {
|