Skip to content

Commit

Permalink
Merge pull request #11 from ZIB-IOL/test
Browse files Browse the repository at this point in the history
Fixed inverse hessian boosting, added tests and adjusted README
  • Loading branch information
dkuzi authored Mar 2, 2024
2 parents 91d69ef + 56d8ac0 commit da6011d
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
7 changes: 6 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion docs/src/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
8 changes: 4 additions & 4 deletions src/auxiliary_functions_avi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 25 additions & 1 deletion test/test_auxiliary_functions_avi.jl
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,29 @@ end
@test vec2 l1_projection(vec2)
@test norm(l1_projection(vec2), 1) 1
@test norm(vec2) norm(l1_projection(vec2))
end;

end

@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;

2 comments on commit da6011d

@dkuzi
Copy link
Collaborator Author

@dkuzi dkuzi commented on da6011d Mar 2, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JuliaRegistrator register

Release notes:

Inverse Hessian Boosting now functions as intended

@JuliaRegistrator
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Registration pull request created: JuliaRegistries/General/102109

Tagging

After the above pull request is merged, it is recommended that a tag is created on this repository for the registered package version.

This will be done automatically if the Julia TagBot GitHub Action is installed, or can be done manually through the github interface, or via:

git tag -a v0.1.1 -m "<description of version>" da6011d2b59d71ab646eaf9499e22d6a2bee65c4
git push origin v0.1.1

Please sign in to comment.