Small corrections to LBFGSData constructor#414
Open
pkofod wants to merge 1 commit intoJuliaSmoothOptimizers:mainfrom
Open
Small corrections to LBFGSData constructor#414pkofod wants to merge 1 commit intoJuliaSmoothOptimizers:mainfrom
pkofod wants to merge 1 commit intoJuliaSmoothOptimizers:mainfrom
Conversation
`mem` is clamped to positive integers. I'm not sure if it's intentional that no errors are thrown here. In the existing code the memory would be set to 1, but all the variables needed to maintain the approximation were set to something not positive, for example
```
julia> LinearOperators.LBFGSData(Float64, 1;mem=-1, inverse=true)
ERROR: ArgumentError: invalid GenericMemory size: too large for system address width
Stacktrace:
[1] GenericMemory
@ ./boot.jl:516 [inlined]
[2] Array
@ ./boot.jl:578 [inlined]
[3] Array
@ ./boot.jl:591 [inlined]
[4] zeros
@ ./array.jl:589 [inlined]
[5] zeros(::Type{Float64}, dims::Int64)
@ Base ./array.jl:585
[6] LinearOperators.LBFGSData(T::Type, n::Int64; mem::Int64, scaling::Bool, damped::Bool, inverse::Bool, σ₂::Float64, σ₃::Float64)
@ LinearOperators ~/.julia/packages/LinearOperators/p7GRU/src/lbfgs.jl:36
[7] top-level scope
@ REPL[33]:1
```
Then, a small mostly theoretical thing. The vectors `a` and `b` are Vector{Vector{T)) but if inverse == true you get just a Vector{T}. It works at runtime because julia will convert it by accident because it just widens the type and tries to copy all memory, but there is 0 memory to copy. I just figured it was clearer to actually specify the type directly and not rely on the convert behavior.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #414 +/- ##
==========================================
- Coverage 95.00% 94.83% -0.17%
==========================================
Files 17 21 +4
Lines 1100 1180 +80
==========================================
+ Hits 1045 1119 +74
- Misses 55 61 +6 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
memis clamped to positive integers. I'm not sure if it's intentional that no errors are thrown here. In the existing code the memory would be set to 1, but all the variables needed to maintain the approximation were set to something not positive, for exampleThen, a small mostly theoretical thing. The vectors
aandbare Vector{Vector{T)) but if inverse == true you get just a Vector{T}. It works at runtime because julia will convert it by accident because it just widens the type and tries to copy all memory, but there is 0 memory to copy. I just figured it was clearer to actually specify the type directly and not rely on the convert behavior.