Skip to content

Commit 5c2c391

Browse files
authored
Merge pull request #1169 from srinjoy933/fix-skew-symmetric-fresh
add zero-diagonal constraint checks for is_skew_symmetric
2 parents dae9d4b + bd8022e commit 5c2c391

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

test/linalg/test_linalg_matrix_property_checks.fypp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -205,23 +205,27 @@ contains
205205
type(error_type), allocatable, intent(out) :: error
206206

207207
#! variable sizes independent of type/kind
208-
${t1}$ :: A_true(2,2), A_false_1(2,2), A_false_2(3,2)
208+
${t1}$ :: A_true(2,2), A_false_1(2,2), A_false_2(3,2), A_false_diag(2,2)
209209
#! populate variables dependent on type/kind
210210
#:if s1[0] == 'r'
211211
A_true = reshape([0.,2.,-2.,0.],[2,2])
212212
A_false_1 = reshape([0.,2.,-3.,0.],[2,2])
213213
A_false_2 = reshape([0.,2.,3.,-2.,0.,6.],[3,2]) !nonsquare matrix
214+
A_false_diag = reshape([1.,2.,-2.,0.],[2,2]) ! non-zero diagonal
214215
#:elif s1[0] == 'c'
215216
A_true = reshape([cmplx(0.,0.),cmplx(2.,1.), &
216217
-cmplx(2.,1.),cmplx(0.,0.)],[2,2])
217218
A_false_1 = reshape([cmplx(0.,0.),cmplx(2.,1.), &
218219
-cmplx(3.,1.),cmplx(0.,0.)],[2,2])
219220
A_false_2 = reshape([cmplx(0.,0.),cmplx(2.,1.),cmplx(3.,0.), &
220221
-cmplx(2.,1.),cmplx(0.,0.),cmplx(6.,0.)],[3,2]) !nonsquare matrix
222+
A_false_diag = reshape([cmplx(0.,1.),cmplx(2.,1.), &
223+
-cmplx(2.,1.),cmplx(0.,0.)],[2,2]) ! purely imaginary diagonal
221224
#:elif s1[0] == 'i'
222225
A_true = reshape([0,2,-2,0],[2,2])
223226
A_false_1 = reshape([0,2,-3,0],[2,2])
224227
A_false_2 = reshape([0,2,3,-2,0,6],[3,2]) !nonsquare matrix
228+
A_false_diag = reshape([1,2,-2,0],[2,2]) ! non-zero diagonal
225229
#:endif
226230

227231
#! error check calls are type/kind independent
@@ -234,6 +238,9 @@ contains
234238
call check(error, (.not. is_skew_symmetric(A_false_2)), &
235239
"(.not. is_skew_symmetric(A_false_2)) failed.")
236240
if (allocated(error)) return
241+
call check(error, (.not. is_skew_symmetric(A_false_diag)), &
242+
"(.not. is_skew_symmetric(A_false_diag)) failed.")
243+
if (allocated(error)) return
237244
end subroutine test_is_skew_symmetric_${s1}$
238245
#:endfor
239246

@@ -544,4 +551,4 @@ program tester
544551
write(error_unit, '(i0, 1x, a)') stat, "test(s) failed!"
545552
error stop
546553
end if
547-
end program
554+
end program

0 commit comments

Comments
 (0)