diff options
| author | Ethan Werner <mail@ethanwerner.com> | 2026-06-09 01:17:41 +0400 |
|---|---|---|
| committer | Ethan Werner <mail@ethanwerner.com> | 2026-06-09 01:17:41 +0400 |
| commit | 96ecf29e8be977f51f351308ef2c7c492bb829aa (patch) | |
| tree | c664aa61262e6f7627a732f0e4fbb84281b99952 /example/direct.c | |
| parent | f6a144987cc403de8ad6bddd055f756120f8d405 (diff) | |
refactor
Diffstat (limited to 'example/direct.c')
| -rw-r--r-- | example/direct.c | 19 |
1 files changed, 16 insertions, 3 deletions
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 <stdio.h> + +typedef double direct_value_t; + #define DT_IMPLEMENTATION #include "../include/direct.h" -#include <stdio.h> 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 |