summaryrefslogtreecommitdiff
path: root/matrix.c
diff options
context:
space:
mode:
authorJasper2025-09-01 08:57:20 +0200
committerJasper2025-09-01 08:57:20 +0200
commit33874d69d46df15faa13c039b1c329b12949b039 (patch)
treeb74676734e1f543bd3e618f92ad1b3b9d68e947e /matrix.c
parent7d763b5778cfbf81ee420558d13e8acbb66d860a (diff)
Tolerance check of absolute value in 'matrix_eq'
Diffstat (limited to 'matrix.c')
-rw-r--r--matrix.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/matrix.c b/matrix.c
index 46302f7..1e1a4dd 100644
--- a/matrix.c
+++ b/matrix.c
@@ -247,7 +247,7 @@ int matrix_eq(const Matrix *A, const Matrix *B, const double tol)
for (size_t i = 0; i < A->m; ++i)
{
for (size_t j = 0; j < A->n; ++j)
- if (matrix_at(A, i, j) - matrix_at(B, i, j) > tol) return FALSE;
+ if (ABS(matrix_at(A, i, j) - matrix_at(B, i, j)) > tol) return FALSE;
}
return TRUE;
}