Skip to content

Commit

Permalink
Fix Jacobian/functors test
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailMihov committed Mar 19, 2024
1 parent 91e022a commit 2f5e237
Showing 1 changed file with 49 additions and 50 deletions.
99 changes: 49 additions & 50 deletions test/Jacobian/Functors.C
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// RUN: %cladclang -Xclang -plugin-arg-clad -Xclang -enable-tbr %s -I%S/../../include -oFunctors.out
// RUN: ./Functors.out | FileCheck -check-prefix=CHECK-EXEC %s
// CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand All @@ -22,14 +21,14 @@ struct Experiment {
// CHECK-NEXT: output[0] = this->x * i * i * j;
// CHECK-NEXT: output[1] = this->y * i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += this->x * i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += this->x * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
};
Expand All @@ -49,14 +48,14 @@ struct ExperimentConst {
// CHECK-NEXT: output[0] = this->x * i * i * j;
// CHECK-NEXT: output[1] = this->y * i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += this->x * i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += this->x * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
};
Expand All @@ -80,14 +79,14 @@ struct ExperimentVolatile {
// CHECK-NEXT: _t1 = this->y * i;
// CHECK-NEXT: output[1] = this->y * i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += _t1 * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += _t1 * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += _t1 * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += _t1 * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += _t0 * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += _t0 * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += _t0 * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += _t0 * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
};
Expand All @@ -111,14 +110,14 @@ struct ExperimentConstVolatile {
// CHECK-NEXT: _t1 = this->y * i;
// CHECK-NEXT: output[1] = this->y * i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += _t1 * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += _t1 * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += _t1 * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += _t1 * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += _t0 * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += _t0 * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += _t0 * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += _t0 * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
};
Expand All @@ -140,14 +139,14 @@ namespace outer {
// CHECK-NEXT: output[0] = this->x * i * i * j;
// CHECK-NEXT: output[1] = this->y * i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += this->y * i * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += this->y * 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += this->y * i * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += this->x * i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += this->x * i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += this->x * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
};
Expand All @@ -161,14 +160,14 @@ namespace outer {
// CHECK-NEXT: output[0] = i * i * j;
// CHECK-NEXT: output[1] = i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += i * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += i * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }
}
Expand Down Expand Up @@ -210,14 +209,14 @@ int main() {
// CHECK-NEXT: output[0] = i * i * j;
// CHECK-NEXT: output[1] = i * j * j;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += 1 * j * j;
// CHECK-NEXT: jacobianMatrix[3UL] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[3UL] += i * j * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += 1 * j * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += i * j * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += 1 * j * i;
// CHECK-NEXT: jacobianMatrix[0UL] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[1UL] += i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += 1 * j * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += i * 1 * j;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }

Expand All @@ -230,14 +229,14 @@ int main() {
// CHECK-NEXT: output[0] = x * i * i * jj;
// CHECK-NEXT: output[1] = y * i * jj * jj;
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[2UL] += y * 1 * jj * jj;
// CHECK-NEXT: jacobianMatrix[3UL] += y * i * 1 * jj;
// CHECK-NEXT: jacobianMatrix[3UL] += y * i * jj * 1;
// CHECK-NEXT: jacobianMatrix[{{2U|2UL}}] += y * 1 * jj * jj;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += y * i * 1 * jj;
// CHECK-NEXT: jacobianMatrix[{{3U|3UL}}] += y * i * jj * 1;
// CHECK-NEXT: }
// CHECK-NEXT: {
// CHECK-NEXT: jacobianMatrix[0UL] += x * 1 * jj * i;
// CHECK-NEXT: jacobianMatrix[0UL] += x * i * 1 * jj;
// CHECK-NEXT: jacobianMatrix[1UL] += x * i * i * 1;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += x * 1 * jj * i;
// CHECK-NEXT: jacobianMatrix[{{0U|0UL}}] += x * i * 1 * jj;
// CHECK-NEXT: jacobianMatrix[{{1U|1UL}}] += x * i * i * 1;
// CHECK-NEXT: }
// CHECK-NEXT: }

Expand Down Expand Up @@ -282,4 +281,4 @@ int main() {
TEST(E_NNS); // CHECK-EXEC: {756.00, 294.00, 405.00, 630.00}, {756.00, 294.00, 405.00, 630.00}
TEST(E_NNS_Again); // CHECK-EXEC: {756.00, 294.00, 405.00, 630.00}, {756.00, 294.00, 405.00, 630.00}
TEST(lambdaWithCapture); // CHECK-EXEC: {756.00, 294.00, 405.00, 630.00}, {756.00, 294.00, 405.00, 630.00}
}
}

0 comments on commit 2f5e237

Please sign in to comment.