Skip to content

Commit

Permalink
240405.122313.HKT add a postcondition to p_norm in linalg.f90
Browse files Browse the repository at this point in the history
  • Loading branch information
zaikunzhang committed Apr 5, 2024
1 parent ff30dc6 commit 4bf79ec
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2179,3 +2179,4 @@ JDORP
hpa
CERI
HIMMELP
nuse
3 changes: 2 additions & 1 deletion fortran/common/linalg.f90
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ module linalg_mod
!
! Started: July 2020
!
! Last Modified: Saturday, March 16, 2024 AM04:06:59
! Last Modified: Friday, April 05, 2024 PM12:19:24
!--------------------------------------------------------------------------------------------------!

implicit none
Expand Down Expand Up @@ -1930,6 +1930,7 @@ function p_norm(x, p) result(y)
if (DEBUGGING) then
call assert(y >= 0 .or. is_nan(sum(abs(x))), 'Y >= 0 unless X contains NaN', srname)
call assert(y > 0 .or. is_nan(sum(abs(x))) .or. all(abs(x) <= 0), 'Y > 0 unless X contains NaN or is zero', srname)
call assert(is_nan(y) .eqv. any(is_nan(x)), 'Y is NaN if and only if X contains NaN', srname)
end if

end function p_norm
Expand Down

0 comments on commit 4bf79ec

Please sign in to comment.