From 0cb45ce84ed5854c43d9f4a7b3b9725fd22a6845 Mon Sep 17 00:00:00 2001 From: Dominik Kuzinowicz Date: Wed, 28 Feb 2024 12:16:42 +0100 Subject: [PATCH 1/3] Fixed inverse hessian boosting and added tests --- src/auxiliary_functions_avi.jl | 8 ++++---- test/test_auxiliary_functions_avi.jl | 25 ++++++++++++++++++++++++- 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/src/auxiliary_functions_avi.jl b/src/auxiliary_functions_avi.jl index 625879b..a3c8908 100644 --- a/src/auxiliary_functions_avi.jl +++ b/src/auxiliary_functions_avi.jl @@ -17,17 +17,17 @@ function streaming_matrix_updates(A, A_squared, A_a, a, a_squared; A_squared_inv b = A_a B_squared = hcat(A_squared, b) - B_squared = vcat(B_squared, vcat(b, a_squared)') + B_squared = vcat(B_squared, transpose(vcat(b, a_squared))) if A_squared_inv !== nothing # write B_squared_inv as S = | S_1, s_2| # | s_2.T s_3| A_squared_inv_b = A_squared_inv * b - b_A_squared_inv_b = (b' * A_squared_inv_b) + b_A_squared_inv_b = (transpose(b) * A_squared_inv_b) - s_2 = A_squared_inv + (A_squared_inv_b * A_squared_inv_b') ./ (a_squared .- b_A_squared_inv_b) - s_2 = (s_2 * b) ./ a_squared + s_2 = (A_squared_inv + (A_squared_inv_b * transpose(A_squared_inv_b)) ./ (a_squared .- b_A_squared_inv_b)) + s_2 = - (s_2 * b) ./ a_squared s_3 = (1 .- (b' * s_2)) ./ a_squared diff --git a/test/test_auxiliary_functions_avi.jl b/test/test_auxiliary_functions_avi.jl index e3630a1..433cf99 100644 --- a/test/test_auxiliary_functions_avi.jl +++ b/test/test_auxiliary_functions_avi.jl @@ -45,5 +45,28 @@ end @test vec2 ≈ l1_projection(vec2) @test norm(l1_projection(vec2), 1) ≈ 1 @test norm(vec2) ≈ norm(l1_projection(vec2)) +end; - end \ No newline at end of file +@testset "Test suite for streaming_matrix_updates" begin + dim = 30000 + A = rand(dim, 500) + + A_sq = transpose(A) * A + A_sq_inv = inv(A_sq) + + a = rand(dim, 1) + a_sq = (transpose(a) * a)[1] + + A_a = transpose(A) * a + + B, B_2, B_2_1 = streaming_matrix_updates(A, A_sq, A_a, a, a_sq; A_squared_inv=A_sq_inv) + + C = hcat(A, a) + + C_2 = transpose(C) * C + + C_2_1 = inv(C_2) + + @test norm(C_2 - B_2) < 1.0e-8 + @test norm(C_2_1 - B_2_1) < 1.0e-8 +end; \ No newline at end of file From 5f832fd364a96fde340c1ee73822e978c28463f9 Mon Sep 17 00:00:00 2001 From: Dominik Kuzinowicz Date: Wed, 28 Feb 2024 12:25:10 +0100 Subject: [PATCH 2/3] incremented version after error fixes --- Project.toml | 2 +- test/test_auxiliary_functions_avi.jl | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/Project.toml b/Project.toml index 7b789e9..07049fb 100644 --- a/Project.toml +++ b/Project.toml @@ -1,7 +1,7 @@ name = "ApproximateVanishingIdeals" uuid = "5c3d299b-aa2f-43dc-84cc-e9c547fd880b" authors = ["ZIB-IOL"] -version = "0.1.0" +version = "0.1.1" [deps] FrankWolfe = "f55ce6ea-fdc5-4628-88c5-0087fe54bd30" diff --git a/test/test_auxiliary_functions_avi.jl b/test/test_auxiliary_functions_avi.jl index 433cf99..783742c 100644 --- a/test/test_auxiliary_functions_avi.jl +++ b/test/test_auxiliary_functions_avi.jl @@ -47,6 +47,7 @@ end @test norm(vec2) ≈ norm(l1_projection(vec2)) end; + @testset "Test suite for streaming_matrix_updates" begin dim = 30000 A = rand(dim, 500) From 56d8ac0edfc245038ea93e3c9717561870a39d23 Mon Sep 17 00:00:00 2001 From: Dominik Kuzinowicz Date: Sat, 2 Mar 2024 11:31:31 +0100 Subject: [PATCH 3/3] Updated README to reflect package registration --- README.md | 7 ++++++- docs/src/index.md | 7 ++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 8385a33..e93cdd7 100644 --- a/README.md +++ b/README.md @@ -21,7 +21,12 @@ f(x) = \frac{1}{m}\|Ax + b\|_2^2. ## Installation The most recent release is available via: ```julia -Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl.git") +using Pkg +Pkg.add("ApproximateVanishingIdeals") +``` +Or get the latest main branch with: +```julia +Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl", rev="main") ``` ## Getting started diff --git a/docs/src/index.md b/docs/src/index.md index bb7fdd7..91ce026 100644 --- a/docs/src/index.md +++ b/docs/src/index.md @@ -20,7 +20,12 @@ f(x) = \frac{1}{m}\|Ax + b\|_2^2. ## Installation The most recent release is available via: ```julia -Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl.git") +using Pkg +Pkg.add("ApproximateVanishingIdeals") +``` +Or get the latest main branch with: +```julia +Pkg.add(url="https://github.com/ZIB-IOL/ApproximateVanishingIdeals.jl", rev="main") ``` ## Getting started