Skip to content

Commit

Permalink
Fix Hessian/Hessians test
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailMihov committed Mar 19, 2024
1 parent f12263a commit e77453a
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions test/Hessian/Hessians.C
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
// RUN: ./Hessians.out | FileCheck -check-prefix=CHECK-EXEC %s

//CHECK-NOT: {{.*error|warning|note:.*}}
// XFAIL: target={{i586.*}}

#include "clad/Differentiator/Differentiator.h"

Expand Down Expand Up @@ -90,8 +89,8 @@ void f_cubed_add1_darg1_grad(double a, double b, clad::array_ref<double> _d_a, c

void f_cubed_add1_hessian(double a, double b, clad::array_ref<double> hessianMatrix);
//CHECK: void f_cubed_add1_hessian(double a, double b, clad::array_ref<double> hessianMatrix) __attribute__((always_inline)) {
//CHECK-NEXT: f_cubed_add1_darg0_grad(a, b, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
//CHECK-NEXT: f_cubed_add1_darg1_grad(a, b, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
//CHECK-NEXT: f_cubed_add1_darg0_grad(a, b, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
//CHECK-NEXT: f_cubed_add1_darg1_grad(a, b, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
//CHECK-NEXT: }

double f_suvat1(double u, double t) {
Expand All @@ -103,8 +102,8 @@ void f_suvat1_darg1_grad(double u, double t, clad::array_ref<double> _d_u, clad:

void f_suvat1_hessian(double u, double t, clad::array_ref<double> hessianMatrix);
//CHECK:void f_suvat1_hessian(double u, double t, clad::array_ref<double> hessianMatrix) {
//CHECK-NEXT: f_suvat1_darg0_grad(u, t, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
//CHECK-NEXT: f_suvat1_darg1_grad(u, t, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
//CHECK-NEXT: f_suvat1_darg0_grad(u, t, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
//CHECK-NEXT: f_suvat1_darg1_grad(u, t, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
//CHECK-NEXT:}

double f_cond3(double x, double c) {
Expand All @@ -121,8 +120,8 @@ void f_cond3_darg1_grad(double x, double c, clad::array_ref<double> _d_x, clad::

void f_cond3_hessian(double x, double c, clad::array_ref<double> hessianMatrix);
//CHECK:void f_cond3_hessian(double x, double c, clad::array_ref<double> hessianMatrix) {
//CHECK-NEXT: f_cond3_darg0_grad(x, c, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
//CHECK-NEXT: f_cond3_darg1_grad(x, c, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
//CHECK-NEXT: f_cond3_darg0_grad(x, c, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
//CHECK-NEXT: f_cond3_darg1_grad(x, c, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
//CHECK-NEXT:}

double f_power10(double x) {
Expand All @@ -133,7 +132,7 @@ void f_power10_darg0_grad(double x, clad::array_ref<double> _d_x);

void f_power10_hessian(double x, clad::array_ref<double> hessianMatrix);
//CHECK: void f_power10_hessian(double x, clad::array_ref<double> hessianMatrix) {
//CHECK-NEXT: f_power10_darg0_grad(x, hessianMatrix.slice(0UL, 1UL));
//CHECK-NEXT: f_power10_darg0_grad(x, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}));
//CHECK-NEXT: }

struct Experiment {
Expand All @@ -155,9 +154,9 @@ struct Experiment {
void someMethod_hessian(double x, clad::array_ref<double> hessianMatrix);
// CHECK: void someMethod_hessian(double i, double j, clad::array_ref<double> hessianMatrix) {
// CHECK-NEXT: Experiment _d_this;
// CHECK-NEXT: this->someMethod_darg0_grad(i, j, &_d_this, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
// CHECK-NEXT: this->someMethod_darg0_grad(i, j, &_d_this, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
// CHECK-NEXT: Experiment _d_this0;
// CHECK-NEXT: this->someMethod_darg1_grad(i, j, &_d_this0, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
// CHECK-NEXT: this->someMethod_darg1_grad(i, j, &_d_this0, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
// CHECK-NEXT: }
};

Expand All @@ -182,9 +181,9 @@ struct Widget {
clad::array_ref<double> hessianMatrix);
// CHECK: void memFn_1_hessian(double i, double j, clad::array_ref<double> hessianMatrix) {
// CHECK-NEXT: Widget _d_this;
// CHECK-NEXT: this->memFn_1_darg0_grad(i, j, &_d_this, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
// CHECK-NEXT: this->memFn_1_darg0_grad(i, j, &_d_this, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
// CHECK-NEXT: Widget _d_this0;
// CHECK-NEXT: this->memFn_1_darg1_grad(i, j, &_d_this0, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
// CHECK-NEXT: this->memFn_1_darg1_grad(i, j, &_d_this0, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
// CHECK-NEXT: }

double memFn_2(double i, double j) {
Expand All @@ -207,9 +206,9 @@ struct Widget {
clad::array_ref<double> hessianMatrix);
// CHECK: void memFn_2_hessian(double i, double j, clad::array_ref<double> hessianMatrix) {
// CHECK-NEXT: Widget _d_this;
// CHECK-NEXT: this->memFn_2_darg0_grad(i, j, &_d_this, hessianMatrix.slice(0UL, 1UL), hessianMatrix.slice(1UL, 1UL));
// CHECK-NEXT: this->memFn_2_darg0_grad(i, j, &_d_this, hessianMatrix.slice({{0U|0UL}}, {{1U|1UL}}), hessianMatrix.slice({{1U|1UL}}, {{1U|1UL}}));
// CHECK-NEXT: Widget _d_this0;
// CHECK-NEXT: this->memFn_2_darg1_grad(i, j, &_d_this0, hessianMatrix.slice(2UL, 1UL), hessianMatrix.slice(3UL, 1UL));
// CHECK-NEXT: this->memFn_2_darg1_grad(i, j, &_d_this0, hessianMatrix.slice({{2U|2UL}}, {{1U|1UL}}), hessianMatrix.slice({{3U|3UL}}, {{1U|1UL}}));
// CHECK-NEXT: }
};

Expand Down

0 comments on commit e77453a

Please sign in to comment.