diff options
author | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-10-18 12:49:39 -0600 |
---|---|---|
committer | Elizabeth Hunt <elizabeth.hunt@simponic.xyz> | 2023-10-18 12:49:39 -0600 |
commit | 9e7166a52e94d8e15bf2dbfe00026f21f76630a9 (patch) | |
tree | bb4d7114d5f91fa128375347ab4249a4c35408f2 /src/vector.c | |
parent | 1b4d91e623a083690ac6554d1aeaa38b75469908 (diff) | |
download | cmath-9e7166a52e94d8e15bf2dbfe00026f21f76630a9.tar.gz cmath-9e7166a52e94d8e15bf2dbfe00026f21f76630a9.zip |
oct 16, 18 notes. add unit tests with utest, and bisection root finding methods
Diffstat (limited to 'src/vector.c')
-rw-r--r-- | src/vector.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/vector.c b/src/vector.c index 4a6250c..3e4f62d 100644 --- a/src/vector.c +++ b/src/vector.c @@ -115,3 +115,14 @@ double sum_v(Array_double *v) { sum += v->data[i]; return sum; } + +int vector_equal(Array_double *a, Array_double *b) { + if (a->size != b->size) + return false; + + for (size_t i = 0; i < a->size; ++i) { + if (a->data[i] != b->data[i]) + return false; + } + return true; +} |