Skip to content

Commit 3db022d

Browse files
committed
add test: init NaNs, check correct return
1 parent 8ed1fe4 commit 3db022d

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

test/linalg/test_linalg_qr.fypp

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -53,22 +53,20 @@ module test_linalg_qr
5353
#:endif
5454
aorig = a
5555

56-
! 1) QR factorization with full matrices
57-
q = 1.0_${rk}$
56+
! 1) QR factorization with full matrices. Input NaNs to be sure Q and R are OK on return
57+
q = 0.0_${rk}$
58+
q = 1.0_${rk}$/q
59+
r = 0.0_${rk}$
60+
r = 1.0_${rk}$/r
5861
call qr(a,q,r,err=state)
5962

6063
! Check return code
6164
call check(error,state%ok(),state%print())
6265
if (allocated(error)) return
6366

6467
! Check solution
65-
if (.not.all(abs(a-matmul(q,r))<tol)) then
66-
state = linalg_state_type('qr',LINALG_VALUE_ERROR,'converged solution (full) max error: ',&
67-
maxval(abs(a-matmul(q,r))))
68-
call check(error, state%ok(), state%print())
69-
if (allocated(error)) return
70-
endif
71-
68+
call check(error, all(abs(a-matmul(q,r))<tol), 'converged solution (fulle)')
69+
if (allocated(error)) return
7270

7371
! 2) QR factorization with reduced matrices
7472
call qr(a,qred,rred,err=state)

0 commit comments

Comments
 (0)