Skip to content

Commit

Permalink
Merge pull request #35 from gridap/complex_tests
Browse files Browse the repository at this point in the history
Test complex-valued systems
  • Loading branch information
fverdugo authored Feb 21, 2022
2 parents 4d8166b + a81f165 commit af70c13
Showing 1 changed file with 46 additions and 0 deletions.
46 changes: 46 additions & 0 deletions test/LinearSolver.jl
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,21 @@ if Int == Int64
test_linear_solver(ps, A, b, x)
end

I = Vector{Int32}(); J = Vector{Int32}(); V = Vector{Complex{Float64}}()
for (ik, jk, vk) in zip(I_,J_,V_)
push_coo!(SparseMatrixCSC,I,J,V,ik,jk,vk)
end
finalize_coo!(SparseMatrixCSC,I,J,V,rows, cols)
A = sparse(I,J,V,rows,cols)
b = ones(Complex{Float64},size(A)[2])
x = similar(b)
ps = PardisoSolver(msglvl=GridapPardiso.MSGLVL_VERBOSE)
ss = symbolic_setup(ps, A)
ns = numerical_setup(ss, A)
solve!(x, ns, b)
@test maximum(abs.(A*x-b)) < tol
test_linear_solver(ps, A, b, x)

#####################################################
# SparseMatrixCSR
#####################################################
Expand Down Expand Up @@ -130,6 +145,21 @@ for Bi in (0,1)
@test maximum(abs.(A*x-b)) < tol
test_linear_solver(ps, A, b, x)
end

I = Vector{Int32}(); J = Vector{Int32}(); V = Vector{Complex{Float64}}()
for (ik, jk, vk) in zip(I_,J_,V_)
push_coo!(SparseMatrixCSR,I,J,V,ik,jk,vk)
end
finalize_coo!(SparseMatrixCSR,I,J,V,rows,cols)
A = sparsecsr(Val{Bi}(),I,J,V,rows,cols)
b = ones(Complex{Float64},size(A)[2])
x = similar(b)
ps = PardisoSolver(msglvl=GridapPardiso.MSGLVL_VERBOSE)
ss = symbolic_setup(ps, A)
ns = numerical_setup(ss, A)
solve!(x, ns, b)
@test maximum(abs.(A*x-b)) < tol
test_linear_solver(ps, A, b, x)
end

#####################################################
Expand Down Expand Up @@ -197,6 +227,22 @@ for Bi in (0,1)
@test maximum(abs.(A*x-b)) < tol
test_linear_solver(ps, A, b, x)
end

I = Vector{Int32}(); J = Vector{Int32}(); V = Vector{Complex{Float64}}()
for (ik, jk, vk) in zip(I_,J_,V_)
push_coo!(SymSparseMatrixCSR,I,J,V,ik,jk,vk)
end
finalize_coo!(SymSparseMatrixCSR,I,J,V,rows,cols)
A = symsparsecsr(Val{Bi}(),I,J,V,rows,cols)
b = ones(Complex{Float64},size(A)[2])
x = similar(b)
ps = PardisoSolver(msglvl=GridapPardiso.MSGLVL_VERBOSE)
ss = symbolic_setup(ps, A)
ns = numerical_setup(ss, A)
solve!(x, ns, b)
@test maximum(abs.(A*x-b)) < tol
test_linear_solver(ps, A, b, x)

end

end

2 comments on commit af70c13

@fverdugo
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register()

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/55097

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.6.0 -m "<description of version>" af70c13a95fc602be06c29c1865e0dc234bb2b52
git push origin v0.6.0

Please sign in to comment.