|
177 | 177 | @test all(isapprox.(test_precon(ParallelJacobiPreconditioner,20,20,20), (true, 2.0406032775945658e-5), rtol=1.0e-5)) |
178 | 178 | end |
179 | 179 |
|
| 180 | + |
| 181 | + |
| 182 | +function test_symmetric(n,uplo) |
| 183 | + A=ExtendableSparseMatrix(n,n) |
| 184 | + sprand_sdd!(A) |
| 185 | + b=rand(n) |
| 186 | + flush!(A) |
| 187 | + SA=Symmetric(A,uplo) |
| 188 | + Scsc=Symmetric(A.cscmatrix,uplo) |
| 189 | + SA\b≈ Scsc\b |
| 190 | +end |
| 191 | + |
| 192 | + |
| 193 | + |
| 194 | +@testset "symmetric" begin |
| 195 | + @test test_symmetric(3,:U) |
| 196 | + @test test_symmetric(3,:L) |
| 197 | + @test test_symmetric(30,:U) |
| 198 | + @test test_symmetric(30,:L) |
| 199 | + @test test_symmetric(300,:U) |
| 200 | + @test test_symmetric(300,:L) |
| 201 | +end |
| 202 | + |
| 203 | + |
| 204 | + |
| 205 | +function test_hermitian(n,uplo) |
| 206 | + A=ExtendableSparseMatrix{ComplexF64,Int64}(n,n) |
| 207 | + sprand_sdd!(A) |
| 208 | + flush!(A) |
| 209 | + A.cscmatrix.nzval.=(1.0+0.01im)*A.cscmatrix.nzval |
| 210 | + b=rand(n) |
| 211 | + HA=Hermitian(A,uplo) |
| 212 | + Hcsc=Hermitian(A.cscmatrix,uplo) |
| 213 | + HA\b≈ Hcsc\b |
| 214 | +end |
| 215 | + |
| 216 | +@testset "hermitian" begin |
| 217 | + @test test_hermitian(3,:U) |
| 218 | + @test test_hermitian(3,:L) |
| 219 | + @test test_hermitian(30,:U) |
| 220 | + @test test_hermitian(30,:L) |
| 221 | + @test test_hermitian(300,:U) |
| 222 | + @test test_hermitian(300,:L) |
| 223 | +end |
0 commit comments