@@ -42,6 +42,7 @@ subroutine test_rsp_eye_determinant(error)
42
42
integer (ilp), parameter :: n = 128_ilp
43
43
44
44
real (sp) :: a(n,n),deta
45
+ real (sp), allocatable :: aalloc(:,:)
45
46
46
47
a = eye(n)
47
48
@@ -50,8 +51,18 @@ subroutine test_rsp_eye_determinant(error)
50
51
51
52
call check(error,state% ok(),state% print ())
52
53
if (allocated (error)) return
53
-
54
54
call check(error, abs (deta-1.0_sp )<epsilon (0.0_sp ), ' det(eye(n))==1' )
55
+ if (allocated (error)) return
56
+
57
+ ! > Test with allocatable matrix
58
+ aalloc = eye(n)
59
+ deta = det(aalloc,overwrite_a= .false. ,err= state)
60
+ call check(error,state% ok(),state% print ()// ' (allocatable a)' )
61
+ if (allocated (error)) return
62
+ call check(error,allocated (aalloc),' a is still allocated' )
63
+ if (allocated (error)) return
64
+ call check(error, abs (deta-1.0_sp )<epsilon (0.0_sp ), ' det(eye(n))==1 (allocatable a))' )
65
+ if (allocated (error)) return
55
66
56
67
end subroutine test_rsp_eye_determinant
57
68
@@ -91,6 +102,7 @@ subroutine test_rdp_eye_determinant(error)
91
102
integer (ilp), parameter :: n = 128_ilp
92
103
93
104
real (dp) :: a(n,n),deta
105
+ real (dp), allocatable :: aalloc(:,:)
94
106
95
107
a = eye(n)
96
108
@@ -99,8 +111,18 @@ subroutine test_rdp_eye_determinant(error)
99
111
100
112
call check(error,state% ok(),state% print ())
101
113
if (allocated (error)) return
102
-
103
114
call check(error, abs (deta-1.0_dp )<epsilon (0.0_dp ), ' det(eye(n))==1' )
115
+ if (allocated (error)) return
116
+
117
+ ! > Test with allocatable matrix
118
+ aalloc = eye(n)
119
+ deta = det(aalloc,overwrite_a= .false. ,err= state)
120
+ call check(error,state% ok(),state% print ()// ' (allocatable a)' )
121
+ if (allocated (error)) return
122
+ call check(error,allocated (aalloc),' a is still allocated' )
123
+ if (allocated (error)) return
124
+ call check(error, abs (deta-1.0_dp )<epsilon (0.0_dp ), ' det(eye(n))==1 (allocatable a))' )
125
+ if (allocated (error)) return
104
126
105
127
end subroutine test_rdp_eye_determinant
106
128
@@ -140,6 +162,7 @@ subroutine test_csp_eye_determinant(error)
140
162
integer (ilp), parameter :: n = 128_ilp
141
163
142
164
complex (sp) :: a(n,n),deta
165
+ complex (sp), allocatable :: aalloc(:,:)
143
166
144
167
a = eye(n)
145
168
@@ -148,8 +171,18 @@ subroutine test_csp_eye_determinant(error)
148
171
149
172
call check(error,state% ok(),state% print ())
150
173
if (allocated (error)) return
151
-
152
174
call check(error, abs (deta-1.0_sp )<epsilon (0.0_sp ), ' det(eye(n))==1' )
175
+ if (allocated (error)) return
176
+
177
+ ! > Test with allocatable matrix
178
+ aalloc = eye(n)
179
+ deta = det(aalloc,overwrite_a= .false. ,err= state)
180
+ call check(error,state% ok(),state% print ()// ' (allocatable a)' )
181
+ if (allocated (error)) return
182
+ call check(error,allocated (aalloc),' a is still allocated' )
183
+ if (allocated (error)) return
184
+ call check(error, abs (deta-1.0_sp )<epsilon (0.0_sp ), ' det(eye(n))==1 (allocatable a))' )
185
+ if (allocated (error)) return
153
186
154
187
end subroutine test_csp_eye_determinant
155
188
@@ -189,6 +222,7 @@ subroutine test_cdp_eye_determinant(error)
189
222
integer (ilp), parameter :: n = 128_ilp
190
223
191
224
complex (dp) :: a(n,n),deta
225
+ complex (dp), allocatable :: aalloc(:,:)
192
226
193
227
a = eye(n)
194
228
@@ -197,8 +231,18 @@ subroutine test_cdp_eye_determinant(error)
197
231
198
232
call check(error,state% ok(),state% print ())
199
233
if (allocated (error)) return
200
-
201
234
call check(error, abs (deta-1.0_dp )<epsilon (0.0_dp ), ' det(eye(n))==1' )
235
+ if (allocated (error)) return
236
+
237
+ ! > Test with allocatable matrix
238
+ aalloc = eye(n)
239
+ deta = det(aalloc,overwrite_a= .false. ,err= state)
240
+ call check(error,state% ok(),state% print ()// ' (allocatable a)' )
241
+ if (allocated (error)) return
242
+ call check(error,allocated (aalloc),' a is still allocated' )
243
+ if (allocated (error)) return
244
+ call check(error, abs (deta-1.0_dp )<epsilon (0.0_dp ), ' det(eye(n))==1 (allocatable a))' )
245
+ if (allocated (error)) return
202
246
203
247
end subroutine test_cdp_eye_determinant
204
248
0 commit comments