From 96ecf29e8be977f51f351308ef2c7c492bb829aa Mon Sep 17 00:00:00 2001 From: Ethan Werner Date: Tue, 9 Jun 2026 01:17:41 +0400 Subject: refactor --- example/direct.c | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) (limited to 'example/direct.c') diff --git a/example/direct.c b/example/direct.c index 102c0c3..29da5d3 100644 --- a/example/direct.c +++ b/example/direct.c @@ -1,7 +1,12 @@ -typedef double value_t; + +// direct.c - Example usage of direct.h computation graph + +#include + +typedef double direct_value_t; + #define DT_IMPLEMENTATION #include "../include/direct.h" -#include int main() { node_t x0 = {.x = 0.0, .function = dt_add}; @@ -20,7 +25,7 @@ int main() { dt_connect(&x3, &x4); dt_connect(&x4, &x5); dt_connect(&x4, &x6); - dt_connect(&x5, &x2); + dt_connect(&x5, &x6); dt_update_trace(&x0); printf("data: %lf\n", x0.x); @@ -29,5 +34,13 @@ int main() { dt_update_trace(&x0); printf("data: %lf\n", x0.x); + dt_clear_edges(&x0); + dt_clear_edges(&x1); + dt_clear_edges(&x2); + dt_clear_edges(&x3); + dt_clear_edges(&x4); + dt_clear_edges(&x5); + dt_clear_edges(&x6); + return 0; } \ No newline at end of file -- cgit v1.3.1