@@ -12,21 +12,43 @@ test_factorize("./data/", true)
12
12
test_update (" ./data/" )
13
13
test_maxvolume (" ./data/" )
14
14
15
- m = 1000
16
- obj = LUFactor (m)
17
- B = sprand (m, m, 5e-3 ) + I
18
- err = factorize (obj, B)
19
- rhs = randn (m)
20
- lhs = solve (obj, rhs, ' N' )
21
- res = norm (B * lhs - rhs, Inf )
22
- @test res ≤ √ eps (Float64)
23
- col = sparsevec ([1 ], [1.0 ], m)
24
- lhs = solve_for_update (obj, col, getsol= true )
25
- vmax, j = findmax (abs .(lhs))
26
- piv = lhs[j]
27
- solve_for_update (obj, j)
28
- piverr = update (obj, piv)
29
- lhs = solve (obj, rhs, ' N' )
30
- B[:,j] = col
31
- res = norm (B * lhs - rhs, Inf )
32
- @test res ≤ √ eps (Float64)
15
+ @testset " Basic test" begin
16
+ m = 1000
17
+ obj = LUFactor (m)
18
+ B = sprand (m, m, 5e-3 ) + I
19
+ err = factorize (obj, B)
20
+ rhs = randn (m)
21
+ lhs = solve (obj, rhs, ' N' )
22
+ res = norm (B * lhs - rhs, Inf )
23
+ @test res ≤ √ eps (Float64)
24
+ col = sparsevec ([1 ], [1.0 ], m)
25
+ lhs = solve_for_update (obj, col, getsol= true )
26
+ vmax, j = findmax (abs .(lhs))
27
+ piv = lhs[j]
28
+ solve_for_update (obj, j)
29
+ piverr = update (obj, piv)
30
+ lhs = solve (obj, rhs, ' N' )
31
+ B[:,j] = col
32
+ res = norm (B * lhs - rhs, Inf )
33
+ @test res ≤ √ eps (Float64)
34
+ end
35
+
36
+ @testset " Integrated rank-one update" begin
37
+ m = 500
38
+ for _ in 1 : 100
39
+ F = LUFactor (m)
40
+ B = sprand (m, m, 5e-3 ) + 3 I
41
+ err = factorize (F, B)
42
+ rhs = randn (m)
43
+ lhs = solve (F, rhs, ' N' )
44
+ res = norm (B * lhs - rhs, Inf )
45
+ @test res ≤ sqrt (eps ())
46
+ ridx1, ridx2 = rand (1 : m÷ 2 ), rand (m÷ 2 + 1 : m)
47
+ v1, v2 = rand (), rand ()
48
+ col = sparsevec ([ridx1], [v1], m)
49
+ _, piverr = BasicLU. update (F, ridx1, col)
50
+ lhs = solve (F, rhs, ' N' )
51
+ B[:,ridx1] .= col
52
+ @test norm (B * lhs - rhs, Inf ) <= sqrt (eps ())
53
+ end
54
+ end
0 commit comments