Skip to content

Commit 364b9ca

Browse files
committed
export error amount
1 parent 9ac97d1 commit 364b9ca

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

test/linalg/test_linalg_qr.fypp

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44
module test_linalg_qr
55
use testdrive, only: error_type, check, new_unittest, unittest_type
66
use stdlib_linalg_constants
7-
use stdlib_linalg, only: qr,qr_space,linalg_state_type
7+
use stdlib_linalg_state, only: LINALG_VALUE_ERROR,linalg_state_type
8+
use stdlib_linalg, only: qr,qr_space
89

910
implicit none (type,external)
1011

@@ -53,15 +54,21 @@ module test_linalg_qr
5354
aorig = a
5455

5556
! 1) QR factorization with full matrices
57+
q = 1.0_${rk}$
5658
call qr(a,q,r,err=state)
5759

5860
! Check return code
5961
call check(error,state%ok(),state%print())
6062
if (allocated(error)) return
6163

6264
! Check solution
63-
! call check(error, all(abs(a-matmul(q,r))<tol), 'converged solution (full)')
64-
! if (allocated(error)) return
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+
6572

6673
! 2) QR factorization with reduced matrices
6774
call qr(a,qred,rred,err=state)
@@ -96,7 +103,7 @@ module test_linalg_qr
96103
if (allocated(error)) return
97104

98105
! Check solution
99-
call check(error, all(abs(a-matmul(qred,rred))<tol), 'converged solution (external storage)')
106+
call check(error, all(abs(a-matmul(q,r))<tol), 'converged solution (external storage)')
100107
if (allocated(error)) return
101108

102109
! Check that an invalid problem size returns an error

0 commit comments

Comments
 (0)