@@ -23,6 +23,7 @@ blockdim = 5
23
23
dense_d_x = CuVector (x)
24
24
CUDA. @allowscalar begin
25
25
@test sprint (show, d_x) == replace (sprint (show, x), " SparseVector{Float64, Int64}" => " CUDA.CUSPARSE.CuSparseVector{Float64, Int32}" , " sparsevec([" => " sparsevec(Int32[" )
26
+ @test sprint (show, MIME " text/plain" (), d_x) == replace (sprint (show, MIME " text/plain" (), x), " SparseVector{Float64, Int64}" => " CuSparseVector{Float64, Int32}" , " sparsevec([" => " sparsevec(Int32[" )
26
27
@test Array (d_x[:]) == x[:]
27
28
@test d_x[firstindex (d_x)] == x[firstindex (x)]
28
29
@test d_x[div (end , 2 )] == x[div (end , 2 )]
@@ -44,6 +45,10 @@ blockdim = 5
44
45
@test size (d_x) == (m, 1 )
45
46
x = sprand (m,n,0.2 )
46
47
d_x = CuSparseMatrixCSC (x)
48
+ d_tx = CuSparseMatrixCSC (transpose (x))
49
+ d_ax = CuSparseMatrixCSC (adjoint (x))
50
+ @test size (d_tx) == (n,m)
51
+ @test size (d_ax) == (n,m)
47
52
@test CuSparseMatrixCSC (d_x) === d_x
48
53
@test length (d_x) == m* n
49
54
@test size (d_x) == (m,n)
@@ -52,9 +57,12 @@ blockdim = 5
52
57
@test size (d_x,3 ) == 1
53
58
@test ndims (d_x) == 2
54
59
CUDA. @allowscalar begin
60
+ @test sprint (show, d_x) == sprint (show, SparseMatrixCSC (d_x))
55
61
@test sprint (show, MIME " text/plain" (), d_x) == replace (sprint (show, MIME " text/plain" (), x), " SparseMatrixCSC{Float64, Int64}" => " CuSparseMatrixCSC{Float64, Int32}" )
56
62
@test Array (d_x[:]) == x[:]
57
63
@test d_x[:, :] == x[:, :]
64
+ @test d_tx[:, :] == transpose (x)[:, :]
65
+ @test d_ax[:, :] == adjoint (x)[:, :]
58
66
@test d_x[(1 , 1 )] == x[1 , 1 ]
59
67
@test d_x[firstindex (d_x)] == x[firstindex (x)]
60
68
@test d_x[div (end , 2 )] == x[div (end , 2 )]
@@ -91,6 +99,8 @@ blockdim = 5
91
99
@test_throws ArgumentError copyto! (d_y,d_x)
92
100
x = sprand (m,n,0.2 )
93
101
d_x = CuSparseMatrixCOO (x)
102
+ d_tx = CuSparseMatrixCOO (transpose (x))
103
+ d_ax = CuSparseMatrixCOO (adjoint (x))
94
104
@test CuSparseMatrixCOO (d_x) === d_x
95
105
@test length (d_x) == m* n
96
106
@test size (d_x) == (m,n)
@@ -107,6 +117,8 @@ blockdim = 5
107
117
@test d_x[firstindex (d_x)] == x[firstindex (x)]
108
118
@test d_x[div (end , 2 )] == x[div (end , 2 )]
109
119
@test d_x[end ] == x[end ]
120
+ @test d_tx[:, 1 ] == transpose (x)[:, 1 ]
121
+ @test d_ax[1 , :] == adjoint (x)[1 , :]
110
122
@test d_x[firstindex (d_x), firstindex (d_x)] == x[firstindex (x), firstindex (x)]
111
123
@test d_x[div (end , 2 ), div (end , 2 )] == x[div (end , 2 ), div (end , 2 )]
112
124
@test d_x[end , end ] == x[end , end ]
0 commit comments