Skip to content

Commit

Permalink
Test more options for symmetric factorizations (#19)
Browse files Browse the repository at this point in the history
  • Loading branch information
amontoison authored Mar 14, 2024
1 parent dc2f311 commit 4130002
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions test/test_cudss.jl
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ function cudss_execution()

symmetric_hermitian_pivots = T <: Real ? ('C', 'R', 'N') : ('N',)
@testset "Symmetric -- Hermitian" begin
@testset "view = $view" for view in ('F',)
@testset "view = $view" for view in ('F', 'L', 'U')
@testset "Pivoting = $pivot" for pivot in symmetric_hermitian_pivots
A_cpu = sprand(T, n, n, 0.01) + I
A_cpu = A_cpu + A_cpu'
Expand Down Expand Up @@ -170,7 +170,7 @@ function cudss_execution()
end

@testset "SPD -- HPD" begin
@testset "view = $view" for view in ('F',)
@testset "view = $view" for view in ('F', 'L', 'U')
@testset "Pivoting = $pivot" for pivot in ('C', 'R', 'N')
A_cpu = sprand(T, n, n, 0.01)
A_cpu = A_cpu * A_cpu' + I
Expand Down Expand Up @@ -246,7 +246,7 @@ function cudss_generic()
end

@testset "Symmetric -- Hermitian" begin
@testset "view = $view" for view in ('F',)
@testset "view = $view" for view in ('F', 'L', 'U')
A_cpu = sprand(T, n, n, 0.01) + I
A_cpu = A_cpu + A_cpu'
B_cpu = rand(T, n, p)
Expand All @@ -262,7 +262,7 @@ function cudss_generic()

solver = ldlt(A_gpu; view)
ldiv!(X_gpu, solver, B_gpu)
R_gpu = B_gpu - A_gpu * X_gpu
R_gpu = B_gpu - CuSparseMatrixCSR(A_cpu) * X_gpu
@test norm(R_gpu) eps(R)

c = rand(R)
Expand All @@ -279,7 +279,7 @@ function cudss_generic()
@testset "\\" begin
solver = ldlt(A_gpu; view)
X_gpu = solver \ B_gpu
R_gpu = B_gpu - A_gpu * X_gpu
R_gpu = B_gpu - CuSparseMatrixCSR(A_cpu) * X_gpu
@test norm(R_gpu) eps(R)

c = rand(R)
Expand All @@ -295,7 +295,7 @@ function cudss_generic()
end

@testset "SPD -- HPD" begin
@testset "view = $view" for view in ('F',)
@testset "view = $view" for view in ('F', 'L', 'U')
A_cpu = sprand(T, n, n, 0.01)
A_cpu = A_cpu * A_cpu' + I
B_cpu = rand(T, n, p)
Expand All @@ -311,7 +311,7 @@ function cudss_generic()

solver = cholesky(A_gpu; view)
ldiv!(X_gpu, solver, B_gpu)
R_gpu = B_gpu - A_gpu * X_gpu
R_gpu = B_gpu - CuSparseMatrixCSR(A_cpu) * X_gpu
@test norm(R_gpu) eps(R)

c = rand(R)
Expand All @@ -328,7 +328,7 @@ function cudss_generic()
@testset "\\" begin
solver = cholesky(A_gpu; view)
X_gpu = solver \ B_gpu
R_gpu = B_gpu - A_gpu * X_gpu
R_gpu = B_gpu - CuSparseMatrixCSR(A_cpu) * X_gpu
@test norm(R_gpu) eps(R)

c = rand(R)
Expand Down

0 comments on commit 4130002

Please sign in to comment.