@@ -157,16 +157,20 @@ function test_addition(;m=10,n=10,d=0.1) where {Tv,Ti}
157157 csc2== 2 * csc
158158end
159159
160-
161160function test_operations (n)
162161 A= ExtendableSparseMatrix (n,n)
163162 sprand_sdd! (A)
164163 b= rand (n)
164+ if Base. USE_GPL_LIBS begin
165+ # requires SuiteSparse which is not available on non-GPL builds
165166 x= A\ b
166167 Ax= A* x
167168 b≈ Ax
168169end
169-
170+ else
171+ true
172+ end
173+ end
170174
171175@testset " Operations" begin
172176 for irun= 1 : 10
175179 d= 0.3 * rand ()
176180 @test test_addition (m= m,n= n,d= d)
177181 end
178-
182+
179183 @test test_operations (10 )
180184 @test test_operations (100 )
181185 @test test_operations (1000 )
@@ -261,6 +265,8 @@ function test_precon2(precon,k,l,m;maxiter=10000)
261265end
262266
263267
268+ if Base. USE_GPL_LIBS begin
269+ # requires SuiteSparse which is not available on non-GPL builds
264270@testset " preconditioners" begin
265271 @test all (isapprox .(test_precon (ILU0Preconditioner,20 ,20 ,20 ), (true , 1.3535160424212675e-5 ), rtol= 1.0e-5 ))
266272 @test all (isapprox .(test_precon (JacobiPreconditioner,20 ,20 ,20 ), (true , 2.0406032775945658e-5 ), rtol= 1.0e-5 ))
@@ -269,15 +275,15 @@ end
269275 @test all (isapprox .(test_precon (AMGPreconditioner,20 ,20 ,20 ), (true , 6.863753664354144e-7 ), rtol= 1.0e-2 ))
270276end
271277
272-
273278@testset " preconditioners 2" begin
274279 @test all (isapprox .(test_precon2 (ILU0Preconditioner (),20 ,20 ,20 ), (true , 1.3535160424212675e-5 ), rtol= 1.0e-5 ))
275280 @test all (isapprox .(test_precon2 (JacobiPreconditioner (),20 ,20 ,20 ), (true , 2.0406032775945658e-5 ), rtol= 1.0e-5 ))
276281 @test all (isapprox .(test_precon2 (ParallelJacobiPreconditioner (),20 ,20 ,20 ), (true , 2.0406032775945658e-5 ), rtol= 1.0e-5 ))
277282 @test all (isapprox .(test_precon2 (ILUTPreconditioner (),20 ,20 ,20 ), (true , 1.2719511868322086e-5 ), rtol= 1.0e-5 ))
278283 @test all (isapprox .(test_precon2 (AMGPreconditioner (),20 ,20 ,20 ), (true , 6.863753664354144e-7 ), rtol= 1.0e-2 ))
279284end
280-
285+ end
286+ end
281287
282288
283289# #############################################
@@ -288,7 +294,12 @@ function test_symmetric(n,uplo)
288294 flush! (A)
289295 SA= Symmetric (A,uplo)
290296 Scsc= Symmetric (A. cscmatrix,uplo)
297+ if Base. USE_GPL_LIBS
298+ # requires SuiteSparse which is not available on non-GPL builds
291299 SA\ b≈ Scsc\ b
300+ else
301+ true
302+ end
292303end
293304
294305
@@ -313,7 +324,12 @@ function test_hermitian(n,uplo)
313324 b= rand (n)
314325 HA= Hermitian (A,uplo)
315326 Hcsc= Hermitian (A. cscmatrix,uplo)
327+ if Base. USE_GPL_LIBS
328+ # requires SuiteSparse which is not available on non-GPL builds
316329 HA\ b≈ Hcsc\ b
330+ else
331+ true
332+ end
317333end
318334
319335@testset " hermitian" begin
@@ -361,7 +377,8 @@ function test_lu2(k,l,m;lufac=ExtendableSparse.LUFactorization())
361377 all (x1ext.< x2ext)
362378end
363379
364-
380+ if Base. USE_GPL_LIBS
381+ # requires SuiteSparse which is not available on non-GPL builds
365382@testset " ExtendableSparse.LUFactorization" begin
366383 @test test_lu1 (10 ,10 ,10 )
367384 @test test_lu1 (25 ,40 ,1 )
371388 @test test_lu2 (25 ,40 ,1 )
372389 @test test_lu2 (1000 ,1 ,1 )
373390end
391+ end
374392
393+ if Base. USE_GPL_LIBS
394+ # requires SuiteSparse which is not available on non-GPL builds
375395@testset " Cholesky" begin
376396 @test test_lu1 (10 ,10 ,10 ,lufac= CholeskyFactorization ())
377397 @test test_lu1 (25 ,40 ,1 ,lufac= CholeskyFactorization ())
381401 @test test_lu2 (25 ,40 ,1 ,lufac= CholeskyFactorization ())
382402 @test test_lu2 (1000 ,1 ,1 ,lufac= CholeskyFactorization ())
383403end
404+ end
384405
406+
407+ if Base. USE_GPL_LIBS
408+ # requires SuiteSparse which is not available on non-GPL builds
385409@testset " mkl-pardiso" begin
386410if ! Sys. isapple ()
387411 @test test_lu1 (10 ,10 ,10 ,lufac= MKLPardisoLU ())
396420 # @test test_lu2(25,40,1,lufac=MKLPardisoLU(mtype=2))
397421 # @test test_lu2(1000,1,1,lufac=MKLPardisoLU(mtype=2))
398422end
423+ end
399424
400-
425+ if Base. USE_GPL_LIBS
426+ # requires SuiteSparse which is not available on non-GPL builds
401427if Pardiso. PARDISO_LOADED[]
402428 @testset " pardiso" begin
403429 @test test_lu1 (10 ,10 ,10 ,lufac= PardisoLU ())
@@ -414,7 +440,7 @@ if Pardiso.PARDISO_LOADED[]
414440
415441 end
416442end
417-
443+ end
418444
419445
420446# #############################################
@@ -462,6 +488,9 @@ function test_linearsolve(n)
462488
463489end
464490
491+ if Base. USE_GPL_LIBS
492+ # requires SuiteSparse which is not available on non-GPL builds
465493@testset " LinearSolve" begin
466494 test_linearsolve (20 )
467495end
496+ end
0 commit comments