Skip to content

Commit da6011d

Browse files
authored
Merge pull request #11 from ZIB-IOL/test
Fixed inverse hessian boosting, added tests and adjusted README
2 parents 91d69ef + 56d8ac0 commit da6011d

5 files changed

+42
-8
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
name = "ApproximateVanishingIdeals"
22
uuid = "5c3d299b-aa2f-43dc-84cc-e9c547fd880b"
33
authors = ["ZIB-IOL"]
4-
version = "0.1.0"
4+
version = "0.1.1"
55

66
[deps]
77
FrankWolfe = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30"

README.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,12 @@ f(x) = \frac{1}{m}\|Ax + b\|_2^2.
2121
## Installation
2222
The most recent release is available via:
2323
```julia
24-
Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl.git")
24+
using Pkg
25+
Pkg.add("ApproximateVanishingIdeals")
26+
```
27+
Or get the latest main branch with:
28+
```julia
29+
Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl", rev="main")
2530
```
2631

2732
## Getting started

docs/src/index.md

+6-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,12 @@ f(x) = \frac{1}{m}\|Ax + b\|_2^2.
2020
## Installation
2121
The most recent release is available via:
2222
```julia
23-
Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl.git")
23+
using Pkg
24+
Pkg.add("ApproximateVanishingIdeals")
25+
```
26+
Or get the latest main branch with:
27+
```julia
28+
Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl", rev="main")
2429
```
2530

2631
## Getting started

src/auxiliary_functions_avi.jl

+4-4
Original file line numberDiff line numberDiff line change
@@ -17,17 +17,17 @@ function streaming_matrix_updates(A, A_squared, A_a, a, a_squared; A_squared_inv
1717
b = A_a
1818

1919
B_squared = hcat(A_squared, b)
20-
B_squared = vcat(B_squared, vcat(b, a_squared)')
20+
B_squared = vcat(B_squared, transpose(vcat(b, a_squared)))
2121

2222
if A_squared_inv !== nothing
2323
# write B_squared_inv as S = | S_1, s_2|
2424
# | s_2.T s_3|
2525

2626
A_squared_inv_b = A_squared_inv * b
27-
b_A_squared_inv_b = (b' * A_squared_inv_b)
27+
b_A_squared_inv_b = (transpose(b) * A_squared_inv_b)
2828

29-
s_2 = A_squared_inv + (A_squared_inv_b * A_squared_inv_b') ./ (a_squared .- b_A_squared_inv_b)
30-
s_2 = (s_2 * b) ./ a_squared
29+
s_2 = (A_squared_inv + (A_squared_inv_b * transpose(A_squared_inv_b)) ./ (a_squared .- b_A_squared_inv_b))
30+
s_2 = - (s_2 * b) ./ a_squared
3131

3232
s_3 = (1 .- (b' * s_2)) ./ a_squared
3333

test/test_auxiliary_functions_avi.jl

+25-1
Original file line numberDiff line numberDiff line change
@@ -45,5 +45,29 @@ end
4545
@test vec2 l1_projection(vec2)
4646
@test norm(l1_projection(vec2), 1) 1
4747
@test norm(vec2) norm(l1_projection(vec2))
48+
end;
4849

49-
end
50+
51+
@testset "Test suite for streaming_matrix_updates" begin
52+
dim = 30000
53+
A = rand(dim, 500)
54+
55+
A_sq = transpose(A) * A
56+
A_sq_inv = inv(A_sq)
57+
58+
a = rand(dim, 1)
59+
a_sq = (transpose(a) * a)[1]
60+
61+
A_a = transpose(A) * a
62+
63+
B, B_2, B_2_1 = streaming_matrix_updates(A, A_sq, A_a, a, a_sq; A_squared_inv=A_sq_inv)
64+
65+
C = hcat(A, a)
66+
67+
C_2 = transpose(C) * C
68+
69+
C_2_1 = inv(C_2)
70+
71+
@test norm(C_2 - B_2) < 1.0e-8
72+
@test norm(C_2_1 - B_2_1) < 1.0e-8
73+
end;

0 commit comments

Comments
 (0)