File tree Expand file tree Collapse file tree 9 files changed +64
-8
lines changed Expand file tree Collapse file tree 9 files changed +64
-8
lines changed Original file line number Diff line number Diff line change @@ -8,10 +8,14 @@ LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d"
8
8
StaticArrays = " 90137ffa-7385-5640-81b9-e52037218182"
9
9
10
10
[compat ]
11
- julia = " 1"
11
+ LightGraphs = " 1.3"
12
+ StaticArrays = " 1.0"
13
+ julia = " 1.5, 1.6"
12
14
13
15
[extras ]
16
+ LinearAlgebra = " 37e2e46d-f89d-539d-b4ee-838fcccc9c8e"
14
17
Test = " 8dfed614-e22c-5e08-85e1-65c5234f0b40"
18
+ SafeTestsets = " 1bc83da4-3b8d-516f-aca4-4fe02f6d838f"
15
19
16
20
[targets ]
17
- test = [" Test" ]
21
+ test = [" LinearAlgebra " , " Test" , " SafeTestsets " ]
Original file line number Diff line number Diff line change @@ -8,8 +8,6 @@ export System,
8
8
full_matrix,
9
9
full_vector,
10
10
11
- ldu_factorization!,
12
- ldu_backsubstitution!,
13
11
ldu_solve!
14
12
15
13
@@ -19,6 +17,9 @@ include("entry.jl")
19
17
include (" system.jl" )
20
18
include (" graph_functions.jl" )
21
19
20
+ # include("lu.jl")
21
+ # include("llt.jl")
22
+ # include("ldlt.jl")
22
23
include (" ldu.jl" )
23
24
24
25
end
Original file line number Diff line number Diff line change 11
11
12
12
function randomize! (entry:: Entry )
13
13
value = entry. value
14
- entry. value = rand (eltype (value), size (value))
14
+ entry. value = randn (eltype (value), size (value))
15
15
end
Original file line number Diff line number Diff line change
1
+ # LDLᵀ factorization for block-symmetric systems
Original file line number Diff line number Diff line change
1
+ # LDU factorization for unsymmetric systems
2
+
1
3
function ldu_factorization_l! (offdiagonal, diagonal)
2
4
offdiagonal. value = offdiagonal. value/ diagonal. value
3
5
return
Original file line number Diff line number Diff line change
1
+ # LLᵀ (Choleski) factorization for symmetric systems
Original file line number Diff line number Diff line change
1
+ # LU factorization for unsymmetric systems
Original file line number Diff line number Diff line change
1
+ using GraphBasedSystems
2
+ using LinearAlgebra
3
+ GBS = GraphBasedSystems
4
+
5
+ Z = zeros (Int64,10 ,10 )
6
+ A = [
7
+ 0 1 0 1 1 0 1 0 1 0
8
+ 1 0 1 0 0 0 0 0 0 0
9
+ 0 1 0 0 0 0 0 0 0 0
10
+ 1 0 0 0 1 0 0 0 0 0
11
+ 1 0 0 1 0 1 0 0 0 0
12
+ 0 0 0 0 1 0 0 0 0 0
13
+ 1 0 0 0 0 0 0 1 0 0
14
+ 0 0 0 0 0 0 1 0 1 1
15
+ 1 0 0 0 0 0 0 1 0 0
16
+ 0 0 0 0 0 0 0 1 0 0
17
+ ]
18
+
19
+ A = [
20
+ A Z Z Z
21
+ Z A Z Z
22
+ Z Z A Z
23
+ Z Z Z A
24
+ ]
25
+
26
+ A[3 ,11 ] = A[11 ,3 ] = 1
27
+ A[6 ,21 ] = A[21 ,6 ] = 1
28
+ A[10 ,31 ] = A[31 ,10 ] = 1
29
+
30
+
31
+ system = System {Float64} (A, [rand (1 : 3 ) for i= 1 : size (A)[1 ]])
32
+
33
+ for i= 1 : 10
34
+ for entry in collect (values (system. matrix_entries))
35
+ GBS. randomize! (entry)
36
+ end
37
+ for entry in collect (values (system. vector_entries))
38
+ GBS. randomize! (entry)
39
+ end
40
+
41
+ B = full_matrix (system)
42
+ b = full_vector (system)
43
+ ldu_solve! (system)
44
+ @test maximum (abs .(full_vector (system)- B\ b)) < 1e-5
45
+ end
46
+
Original file line number Diff line number Diff line change 1
- using GraphBasedSystems
2
1
using Test
2
+ using SafeTestsets
3
3
4
- @testset " GraphBasedSystems.jl " begin
5
- # Write your tests here.
4
+ @safetestset " LDU Tests " begin
5
+ include ( " ldu_test.jl " )
6
6
end
You can’t perform that action at this time.
0 commit comments