Skip to content

Commit

Permalink
Merge pull request #881 from jvdp1/fix_svd_1
Browse files Browse the repository at this point in the history
svd - check the size of storage space
  • Loading branch information
jvdp1 authored Oct 25, 2024
2 parents 38e8e0e + e244e13 commit 8050d1f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/stdlib_linalg_svd.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,11 @@ submodule(stdlib_linalg) stdlib_linalg_svd
if (info==0) then
!> Prepare working storage
lwork = nint(real(work_dummy(1),kind=${rk}$), kind=ilp)
! Check if the returned working storage space is smaller than the largest value
! allowed by lwork
lwork = merge(nint(real(work_dummy(1),kind=${rk}$), kind=ilp) &
, huge(lwork) &
, real(work_dummy(1),kind=${rk}$) < real(huge(lwork),kind=${rk}$) )
allocate(work(lwork))
!> Compute SVD
Expand Down

0 comments on commit 8050d1f

Please sign in to comment.