Skip to content

Commit e0b4a6a

Browse files
committed
Update for tests and acitivity analysis.
1 parent cae65f1 commit e0b4a6a

File tree

6 files changed

+876
-700
lines changed

6 files changed

+876
-700
lines changed

regression-tests/pure2-autodiff.cpp2

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,10 @@ ad_test_reverse: @autodiff<"reverse"> @print type = {
196196
add_1: (x: double, y: double) -> (r: double) = {
197197
r = x + y;
198198
}
199+
200+
mul_1: (x: double, y: double) -> (r: double) = {
201+
r = x * y;
202+
}
199203
}
200204
}
201205

@@ -257,7 +261,12 @@ main: () = {
257261
y_b: double = 0.0;
258262
w_b: double = 1.0;
259263

260-
write_output_reverse("x + y", x, y, w_b, ad_name::ad_test_reverse::add_1_b(x, x_b, y, y_b, w_b));
264+
write_output_reverse("x + y", x, x_b, y, y_b, w_b, ad_name::ad_test_reverse::add_1_b(x, x_b, y, y_b, w_b));
265+
write_output_reverse("x * y", x, x_b, y, y_b, w_b, ad_name::ad_test_reverse::mul_1_b(x, x_b, y, y_b, w_b));
266+
267+
_ = x_b;
268+
_ = y_b;
269+
_ = w_b;
261270

262271
r_twice := ad_test_twice::mul_1_d_d2(x, x_d, x_d, 0.0);
263272
std::cout << "2nd order diff of x*x at (x)$ = (r_twice.r_d_d2)$" << std::endl;

regression-tests/test-results/gcc-13-c++2b/pure2-autodiff.cpp.execution

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,6 @@ diff(do while loop) at (x = 2.000000, x_d = 1.000000, y = 3.000000, y_d = 2.0000
2828
diff(for loop) at (x = 2.000000, x_d = 1.000000, y = 3.000000, y_d = 2.000000) = (r = 5.000000, r_d = 3.000000)
2929
diff(tye_outer.a + y) at (x = 2.000000, x_d = 1.000000, y = 3.000000, y_d = 2.000000) = (r = 5.000000, r_d = 3.000000)
3030
diff(type_outer.add(y)) at (x = 2.000000, x_d = 1.000000, y = 3.000000, y_d = 2.000000) = (r = 5.000000, r_d = 3.000000)
31+
diff(x + y) at (x = 2.000000, y = 3.000000, r_b = 1.000000) = (r = 5.000000, x_b = 1.000000, y_b = 1.000000)
32+
diff(x * y) at (x = 2.000000, y = 3.000000, r_b = 1.000000) = (r = 6.000000, x_b = 3.000000, y_b = 2.000000)
3133
2nd order diff of x*x at 2.000000 = 2.000000

0 commit comments

Comments
 (0)