Skip to content

Commit d675c68

Browse files
committed
Simplify a bit and test more types
1 parent 6742418 commit d675c68

File tree

1 file changed

+6
-17
lines changed

1 file changed

+6
-17
lines changed

test/libraries/cusparse/conversions.jl

Lines changed: 6 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -56,10 +56,12 @@ end
5656
end
5757

5858
@testset "CuSparseMatrix(::Adjoint/::Transpose)" begin
59-
A = sprand(5, 5, 0.2)
60-
for T in (CuSparseMatrixCSC, CuSparseMatrixCSR, CuSparseMatrixCOO), f in (transpose, adjoint)
61-
dA = T(f(A))
62-
@test Array(dA) == f(A)
59+
for typ in (Float32, ComplexF32, Float64, ComplexF64)
60+
A = sprand(typ, 5, 5, 0.2)
61+
for T in (CuSparseMatrixCSC{typ}, CuSparseMatrixCSR{typ}, CuSparseMatrixCOO{typ}), f in (transpose, adjoint)
62+
dA = T(f(A))
63+
@test Array(dA) == f(A)
64+
end
6365
end
6466
end
6567

@@ -123,19 +125,6 @@ for (n, bd, p) in [(100, 5, 0.02), (5, 1, 0.8), (4, 2, 0.5)]
123125
end
124126
end
125127

126-
for (n, p) in [(100, 0.02), (5, 0.8), (4, 0.5)]
127-
v"12.0" <= CUSPARSE.version() < v"12.1" && n == 4 && continue
128-
@testset "conversions between CuSparseMatrices (n, p) = ($n, $p)" begin
129-
A = sprand(n, n, p)
130-
for CuSparseMatrixType1 in (CuSparseMatrixCSC, CuSparseMatrixCSR), CuSparseMatrixType2 in (CuSparseMatrixCSC, CuSparseMatrixCSR), op in (transpose, adjoint)
131-
dA1 = CuSparseMatrixType1(A)
132-
@testset "conversion $op($CuSparseMatrixType1) --> $CuSparseMatrixType2" begin
133-
@test collect(CuSparseMatrixType2(op(dA1))) op(A)
134-
end
135-
end
136-
end
137-
end
138-
139128
@testset "sort CuSparseMatrix" begin
140129
# [5 7 0]
141130
# A = [8 0 6]

0 commit comments

Comments
 (0)