Skip to content

Commit

Permalink
Merge pull request #1104 from raphaeldussin/tridiag_det_fix
Browse files Browse the repository at this point in the history
fix out of bounds when nrows == 1
  • Loading branch information
Hallberg-NOAA authored May 7, 2020
2 parents 2b6d7c6 + 450e954 commit 70cfd64
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/diagnostics/MOM_wave_speed.F90
Original file line number Diff line number Diff line change
Expand Up @@ -1246,7 +1246,7 @@ subroutine tridiag_det(a, b, c, nrows, lam, det_out, ddet_out, row_scale)
rscl = 1.0 ; if (present(row_scale)) rscl = row_scale

det(1) = 1.0 ; ddet(1) = 0.0
det(2) = b(2)-lam ; ddet(2) = -1.0
if (nrows > 1) then ; det(2) = b(2)-lam ; ddet(2) = -1.0 ; endif
do n=3,nrows
det(n) = rscl*(b(n)-lam)*det(n-1) - rscl*(a(n)*c(n-1))*det(n-2)
ddet(n) = rscl*(b(n)-lam)*ddet(n-1) - rscl*(a(n)*c(n-1))*ddet(n-2) - det(n-1)
Expand Down

0 comments on commit 70cfd64

Please sign in to comment.