Skip to content

Commit

Permalink
Fix Fortran addition test (#737)
Browse files Browse the repository at this point in the history
Check absolute values instead of relative since we now have truly
sparse matrices
  • Loading branch information
jeanlucf22 authored Oct 10, 2023
1 parent 522edda commit 8078e59
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions tests/Fortran-tests/add_matrix_typed.F90
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ function test_add_matrix_typed(matrix_type, element_kind, element_precision,&
DUMMY_KIND(DUMMY_PREC), allocatable :: c_dense(:, :)
DUMMY_KIND(DUMMY_PREC), allocatable :: d_dense(:, :)

real(DUMMY_PREC) :: expected, rel_diff, tol
real(DUMMY_PREC) :: expected, diff, tol

integer :: i, j

Expand Down Expand Up @@ -69,9 +69,9 @@ function test_add_matrix_typed(matrix_type, element_kind, element_precision,&
do i = 1, n
do j = 1, n
expected = alpha * a_dense(i, j) + beta * c_dense(i, j)
rel_diff = abs((expected - b_dense(i, j)) / expected)
if(rel_diff > tol) then
print *, "rel. diff = ", rel_diff
diff = abs((expected - b_dense(i, j)))
if(diff > tol) then
print *, "diff = ", diff
call bml_error(__FILE__, __LINE__, &
& "add() matrices are not identical")
end if
Expand All @@ -81,9 +81,9 @@ function test_add_matrix_typed(matrix_type, element_kind, element_precision,&
else
expected = a_dense(i, j)
end if
rel_diff = abs((expected - d_dense(i, j)) / expected)
if(rel_diff > tol) then
print *, "rel. diff = ", rel_diff
diff = abs((expected - d_dense(i, j)))
if(diff > tol) then
print *, "rel. diff = ", diff
call bml_error(__FILE__, __LINE__, &
& "add_identity() matrices are not identical")
end if
Expand Down

0 comments on commit 8078e59

Please sign in to comment.