|
4 | 4 | module test_linalg_qr
|
5 | 5 | use testdrive, only: error_type, check, new_unittest, unittest_type
|
6 | 6 | 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 |
8 | 9 |
|
9 | 10 | implicit none (type,external)
|
10 | 11 |
|
@@ -53,15 +54,21 @@ module test_linalg_qr
|
53 | 54 | aorig = a
|
54 | 55 |
|
55 | 56 | ! 1) QR factorization with full matrices
|
| 57 | + q = 1.0_${rk}$ |
56 | 58 | call qr(a,q,r,err=state)
|
57 | 59 |
|
58 | 60 | ! Check return code
|
59 | 61 | call check(error,state%ok(),state%print())
|
60 | 62 | if (allocated(error)) return
|
61 | 63 |
|
62 | 64 | ! 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 | + |
65 | 72 |
|
66 | 73 | ! 2) QR factorization with reduced matrices
|
67 | 74 | call qr(a,qred,rred,err=state)
|
@@ -96,7 +103,7 @@ module test_linalg_qr
|
96 | 103 | if (allocated(error)) return
|
97 | 104 |
|
98 | 105 | ! 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)') |
100 | 107 | if (allocated(error)) return
|
101 | 108 |
|
102 | 109 | ! Check that an invalid problem size returns an error
|
|
0 commit comments