Skip to content

Commit 5081221

Browse files
committed
add: new lines in test
1 parent 3dff7c4 commit 5081221

1 file changed

Lines changed: 39 additions & 19 deletions

File tree

test/linalg/test_linalg_specialmatrices.fypp

Lines changed: 39 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -44,28 +44,38 @@ contains
4444

4545
! Initialize matrix.
4646
allocate(dl(n-1), dv(n), du(n-1))
47-
call random_number(dl) ; call random_number(dv) ; call random_number(du)
48-
A = tridiagonal(dl, dv, du) ; Amat = dense(A)
47+
call random_number(dl)
48+
call random_number(dv)
49+
call random_number(du)
50+
A = tridiagonal(dl, dv, du)
51+
Amat = dense(A)
4952

5053
! Random vectors.
51-
allocate(x(n), source = 0.0_wp) ; call random_number(x)
52-
allocate(y1(n), source = 0.0_wp) ; allocate(y2(n), source=0.0_wp)
54+
allocate(x(n), source = 0.0_wp)
55+
call random_number(x)
56+
allocate(y1(n), source = 0.0_wp)
57+
allocate(y2(n), source=0.0_wp)
5358

5459
! Test y = A @ x
55-
y1 = matmul(Amat, x) ; call spmv(A, x, y2)
60+
y1 = matmul(Amat, x)
61+
call spmv(A, x, y2)
5662
call check(error, all_close(y1, y2), .true.)
5763
if (allocated(error)) return
5864

5965
! Test y = A.T @ x
60-
y1 = 0.0_wp ; y2 = 0.0_wp
61-
y1 = matmul(transpose(Amat), x) ; call spmv(A, x, y2, op="T")
66+
y1 = 0.0_wp
67+
y2 = 0.0_wp
68+
y1 = matmul(transpose(Amat), x)
69+
call spmv(A, x, y2, op="T")
6270
call check(error, all_close(y1, y2), .true.)
6371
if (allocated(error)) return
6472

6573
#:if t1.startswith('complex')
6674
! Test y = A.H @ x
67-
y1 = 0.0_wp ; y2 = 0.0_wp
68-
y1 = matmul(hermitian(Amat), x) ; call spmv(A, x, y2, op="H")
75+
y1 = 0.0_wp
76+
y2 = 0.0_wp
77+
y1 = matmul(hermitian(Amat), x)
78+
call spmv(A, x, y2, op="H")
6979
call check(error, all_close(y1, y2), .true.)
7080
if (allocated(error)) return
7181
#:endif
@@ -139,28 +149,37 @@ contains
139149

140150
! Initialize matrix.
141151
allocate(du(n-1), dv(n))
142-
call random_number(du) ; call random_number(dv)
143-
A = sym_tridiagonal(du, dv) ; Amat = dense(A)
152+
call random_number(du)
153+
call random_number(dv)
154+
A = sym_tridiagonal(du, dv)
155+
Amat = dense(A)
144156

145157
! Random vectors.
146-
allocate(x(n), source = 0.0_wp) ; call random_number(x)
147-
allocate(y1(n), source = 0.0_wp) ; allocate(y2(n), source=0.0_wp)
158+
allocate(x(n), source = 0.0_wp)
159+
call random_number(x)
160+
allocate(y1(n), source = 0.0_wp)
161+
allocate(y2(n), source=0.0_wp)
148162

149163
! Test y = A @ x
150-
y1 = matmul(Amat, x) ; call spmv(A, x, y2)
164+
y1 = matmul(Amat, x)
165+
call spmv(A, x, y2)
151166
call check(error, all_close(y1, y2), .true.)
152167
if (allocated(error)) return
153168

154169
! Test y = A.T @ x
155-
y1 = 0.0_wp ; y2 = 0.0_wp
156-
y1 = matmul(transpose(Amat), x) ; call spmv(A, x, y2, op="T")
170+
y1 = 0.0_wp
171+
y2 = 0.0_wp
172+
y1 = matmul(transpose(Amat), x)
173+
call spmv(A, x, y2, op="T")
157174
call check(error, all_close(y1, y2), .true.)
158175
if (allocated(error)) return
159176

160177
#:if t1.startswith('complex')
161178
! Test y = A.H @ x
162-
y1 = 0.0_wp ; y2 = 0.0_wp
163-
y1 = matmul(hermitian(Amat), x) ; call spmv(A, x, y2, op="H")
179+
y1 = 0.0_wp
180+
y2 = 0.0_wp
181+
y1 = matmul(hermitian(Amat), x)
182+
call spmv(A, x, y2, op="H")
164183
call check(error, all_close(y1, y2), .true.)
165184
if (allocated(error)) return
166185
#:endif
@@ -229,7 +248,8 @@ contains
229248
integer :: i
230249

231250
!> Test constructor from arrays.
232-
dl = [(1.0_wp, i = 1, n-2)] ; du = dl
251+
dl = [(1.0_wp, i = 1, n-2)]
252+
du = dl
233253
dv = [(2.0_wp, i = 1, n)]
234254
A = tridiagonal(dl, dv, du, state)
235255
call check(error, state%ok(), .false.)

0 commit comments

Comments
 (0)