Skip to content

Commit

Permalink
unit test in-place transpose
Browse files Browse the repository at this point in the history
  • Loading branch information
jalvesz committed Oct 19, 2024
1 parent b68b4c8 commit 62c702b
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions test/linalg/test_sparse_spmv.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,12 @@ contains
call spmv( COO, vec_x, vec_y2 )
call check(error, all(vec_y1 == vec_y2) )
if (allocated(error)) return

! Test in-place transpose
vec_y1 = 1._wp
call spmv( COO, vec_y1, vec_x, op=sparse_op_transpose )
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
if (allocated(error)) return
end block
#:endfor
end subroutine
Expand Down Expand Up @@ -114,6 +120,12 @@ contains

call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
if (allocated(error)) return

! Test in-place transpose
vec_y = 1._wp
call spmv( CSR, vec_y, vec_x, op=sparse_op_transpose )
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
if (allocated(error)) return
end block
#:endfor
end subroutine
Expand All @@ -139,6 +151,12 @@ contains

call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
if (allocated(error)) return

! Test in-place transpose
vec_y = 1._wp
call spmv( CSC, vec_y, vec_x, op=sparse_op_transpose )
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
if (allocated(error)) return
end block
#:endfor
end subroutine
Expand Down Expand Up @@ -170,6 +188,12 @@ contains

call check(error, all(vec_y == real([6,11,15,15],kind=wp)) )
if (allocated(error)) return

! Test in-place transpose
vec_y = 1._wp
call spmv( ELL, vec_y, vec_x, op=sparse_op_transpose )
call check(error, all(vec_x == real([17,15,4,14,-3],kind=wp)) )
if (allocated(error)) return
end block
#:endfor

Expand Down

0 comments on commit 62c702b

Please sign in to comment.