From 4316e28bb1c89bcc99b0fed93b351a043052fb96 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Mon, 17 Mar 2025 17:04:44 -0400 Subject: [PATCH] Sparse conversion tests --- test/libraries/cusparse/conversions.jl | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/test/libraries/cusparse/conversions.jl b/test/libraries/cusparse/conversions.jl index d530ffce19..674755df79 100644 --- a/test/libraries/cusparse/conversions.jl +++ b/test/libraries/cusparse/conversions.jl @@ -65,6 +65,17 @@ end end end +@testset "CuSparseMatrix(::Adjoint/::Transpose)" begin + for typ in (Float32, ComplexF32, Float64, ComplexF64), (outer_T, T) in ((CuSparseMatrixCSC, CuSparseMatrixCSR{typ}), (CuSparseMatrixCSR, CuSparseMatrixCSC{typ})) + A = sprand(typ, 5, 5, 0.2) + d_A = outer_T(A) + for f in (transpose, adjoint) + dA = T(f(d_A)) + @test Array(dA) == f(A) + end + end +end + @testset "CuSparseMatrix(::Diagonal)" begin X = Diagonal(rand(10)) dX = cu(X)