11using GraphBasedSystems
22using LinearAlgebra
33
4- A = [
5- 0 1 0 1 1 0 1 0 1 0
6- 1 0 1 0 0 0 0 0 0 0
7- 0 1 0 0 0 0 0 0 0 0
8- 1 0 0 0 1 0 0 0 0 0
9- 1 0 0 1 0 1 0 0 0 0
10- 0 0 0 0 1 0 0 0 0 0
11- 1 0 0 0 0 0 0 1 0 0
12- 0 0 0 0 0 0 1 0 1 1
13- 1 0 0 0 0 0 0 1 0 0
14- 0 0 0 0 0 0 0 1 0 0
15- ]
4+ include (" adjacency_matrix.jl" )
165
17- B = [
18- 0 1 0 0 0 1 0 0 0
19- 1 0 0 0 0 1 0 0 0
20- 0 0 0 0 0 1 1 0 1
21- 0 0 0 0 0 0 1 1 0
22- 0 0 0 0 0 0 0 1 1
23- 1 1 1 0 0 0 1 0 0
24- 0 0 1 1 0 1 0 1 1
25- 0 0 0 1 1 0 1 0 1
26- 0 0 1 0 1 0 1 1 0
27- ]
286
29- C = [
30- 0 1 1 0 0 0
31- 1 0 0 1 0 0
32- 1 0 0 1 1 0
33- 0 1 1 0 0 1
34- 0 0 1 0 0 1
35- 0 0 0 1 1 0
36- ]
37-
38- D = [
39- 0 1 1 0 1 0
40- 1 0 0 1 0 1
41- 1 0 0 1 0 0
42- 0 1 1 0 0 0
43- 1 0 0 0 0 1
44- 0 1 0 0 1 0 ]
45-
46- ZAA = zeros (Int64,10 ,10 )
47- ZAB = zeros (Int64,10 ,9 )
48- ZAC = zeros (Int64,10 ,6 )
49- ZAD = zeros (Int64,10 ,6 )
50- ZBB = zeros (Int64,9 ,9 )
51- ZBC = zeros (Int64,9 ,6 )
52- ZBD = zeros (Int64,9 ,6 )
53- ZCC = zeros (Int64,6 ,6 )
54- ZCD = zeros (Int64,6 ,6 )
55-
56- ZBA = ZAB'
57- ZCA = ZAC'
58- ZDA = ZAD'
59- ZCB = ZBC'
60- ZDB = ZBD'
61- ZDC = ZCD'
62-
63-
64- # Graph 1 is disconnected, 2-3-4-5 are connected, 6 is disconnected, 7 is disconnected
65-
66- A = [
67- A ZAA ZAB ZAC ZAA ZAA ZAD
68- ZAA A ZAB ZAC ZAA ZAA ZAD
69- ZBA ZBA B ZBC ZBA ZBA ZBD
70- ZCA ZCA ZCB C ZCA ZCA ZCD
71- ZAA ZAA ZAB ZAC A ZAA ZAD
72- ZAA ZAA ZAB ZAC ZAA A ZAD
73- ZDA ZDA ZDB ZDC ZDA ZDA D
74- ]
75-
76- A[13 ,21 ] = A[21 ,13 ] = 1
77- A[16 ,30 ] = A[30 ,16 ] = 1
78- A[20 ,36 ] = A[36 ,20 ] = 1
79-
80- function initialize!_posdef! (system)
7+ function initialize!_posdef! (system:: System{N} ) where N
818 initialize! (system,rand)
82- for i= 1 : size (A)[ 1 ]
9+ for i= 1 : N
8310 system. matrix_entries[i,i]. value += 1000 * I
8411 end
8512end
@@ -89,20 +16,17 @@ system = System{Float64}(A, ones(Int,size(A)[1])*3)
8916systemldlt = System {Float64} (A, ones (Int,size (A)[1 ])* 3 , symmetric= true )
9017systemllt = System {Float64} (A, ones (Int,size (A)[1 ])* 3 , symmetric= true )
9118
92- SUITE[" ldu" ] = @benchmarkable ldu_solve! ($ system) samples= 2 setup= (initialize! ($ system))
93- SUITE[" lu" ] = @benchmarkable lu_solve! ($ system) samples= 2 setup= (initialize! ($ system))
94- SUITE[" ldlt" ] = @benchmarkable ldlt_solve! ($ systemldlt) samples= 2 setup= (initialize! ($ systemldlt))
95- SUITE[" llt" ] = @benchmarkable llt_solve! ($ systemllt) samples= 2 setup= (initialize!_posdef! ($ systemllt))
96-
97- # A = [
98- # 0 1 1 1 1
99- # 1 0 1 1 1
100- # 1 1 0 1 1
101- # 1 1 1 0 1
102- # 1 1 1 1 0
103- # ]
104-
105-
106-
107-
108-
19+ SUITE[" sparse_ldu" ] = @benchmarkable ldu_solve! ($ system) setup= (initialize! ($ system))
20+ SUITE[" sparse_lu" ] = @benchmarkable lu_solve! ($ system) setup= (initialize! ($ system))
21+ SUITE[" dense_lu" ] = @benchmarkable lu (F)\ f setup= (initialize! ($ system);F= full_matrix ($ system);f= full_vector ($ system))
22+ SUITE[" sparse_ldlt" ] = @benchmarkable ldlt_solve! ($ systemldlt) setup= (initialize! ($ systemldlt))
23+ SUITE[" dense_ldlt" ] = @benchmarkable bunchkaufman (F)\ f setup= (initialize! ($ systemldlt);F= full_matrix ($ systemldlt);f= full_vector ($ systemldlt))
24+ SUITE[" sparse_llt" ] = @benchmarkable llt_solve! ($ systemllt) setup= (initialize!_posdef! ($ systemllt))
25+ SUITE[" dense_llt" ] = @benchmarkable cholesky (F)\ f setup= (initialize!_posdef! ($ systemllt);F= full_matrix ($ systemllt);f= full_vector ($ systemllt))
26+
27+ SUITE[" sparse_add" ] = @benchmarkable + ($ system,$ system) setup= (initialize! ($ system))
28+ SUITE[" dense_add" ] = @benchmarkable (+ (F,F);+ (f+ f)) setup= (initialize! ($ system);F= full_matrix ($ system);f= full_vector ($ system))
29+ SUITE[" sparse_mul" ] = @benchmarkable * ($ system,$ system) setup= (initialize! ($ system))
30+ SUITE[" dense_mul" ] = @benchmarkable * (F,F) setup= (initialize! ($ system);F= full_matrix ($ system))
31+ SUITE[" sparse_solve" ] = @benchmarkable \ ($ system,Bmat) setup= (initialize! ($ system);Bmat= deepcopy (system. matrix_entries);initialize! ($ system))
32+ SUITE[" dense_solve" ] = @benchmarkable \ (F1,F2) setup= (initialize! ($ system);F2= full_matrix ($ system);initialize! ($ system);F1= full_matrix ($ system))
0 commit comments