Skip to content

Commit 62c702b

Browse files
committed
unit test in-place transpose
1 parent b68b4c8 commit 62c702b

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

test/linalg/test_sparse_spmv.fypp

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,12 @@ contains
6161
call spmv( COO, vec_x, vec_y2 )
6262
call check(error, all(vec_y1 == vec_y2) )
6363
if (allocated(error)) return
64+
65+
! Test in-place transpose
66+
vec_y1 = 1._wp
67+
call spmv( COO, vec_y1, vec_x, op=sparse_op_transpose )
68+
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
69+
if (allocated(error)) return
6470
end block
6571
#:endfor
6672
end subroutine
@@ -114,6 +120,12 @@ contains
114120

115121
call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
116122
if (allocated(error)) return
123+
124+
! Test in-place transpose
125+
vec_y = 1._wp
126+
call spmv( CSR, vec_y, vec_x, op=sparse_op_transpose )
127+
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
128+
if (allocated(error)) return
117129
end block
118130
#:endfor
119131
end subroutine
@@ -139,6 +151,12 @@ contains
139151

140152
call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
141153
if (allocated(error)) return
154+
155+
! Test in-place transpose
156+
vec_y = 1._wp
157+
call spmv( CSC, vec_y, vec_x, op=sparse_op_transpose )
158+
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
159+
if (allocated(error)) return
142160
end block
143161
#:endfor
144162
end subroutine
@@ -170,6 +188,12 @@ contains
170188

171189
call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
172190
if (allocated(error)) return
191+
192+
! Test in-place transpose
193+
vec_y = 1._wp
194+
call spmv( ELL, vec_y, vec_x, op=sparse_op_transpose )
195+
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
196+
if (allocated(error)) return
173197
end block
174198
#:endfor
175199

0 commit comments

Comments
 (0)