Skip to content

Conversation

@lostella
Copy link
Member

@lostella lostella commented Nov 25, 2017

This PR is to fix L-BFGS: now it is implemented for both Array and Tuple objects at once.
Furthermore, the newly introduced block.jl defines more rigorously what BlockArray objects are (that is, Array or Tuple objects) and all the associated operations and convenient broadcasts. This will eventually serve as a replacement for deep.jl.

@codecov-io
Copy link

codecov-io commented Nov 25, 2017

Codecov Report

Merging #3 into master will decrease coverage by 1.3%.
The diff coverage is 77.38%.

Impacted file tree graph

@@            Coverage Diff            @@
##           master      #3      +/-   ##
=========================================
- Coverage    92.2%   90.9%   -1.31%     
=========================================
  Files          37      36       -1     
  Lines        1386    1352      -34     
=========================================
- Hits         1278    1229      -49     
- Misses        108     123      +15
Impacted Files Coverage Δ
src/linearoperators/LBFGS.jl 100% <100%> (ø) ⬆️
src/utilities/block.jl 60.46% <60.46%> (ø)
src/syntax.jl 93.47% <80%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 72a8d6e...baff0de. Read the comment docs.


# Constructors
#default
function LBFGS(T::Type, dim::NTuple{N,Int}, M::Int) where {N}
Copy link
Member

Choose a reason for hiding this comment

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

I would prefer to keep this constructor for consistency, this is the standard constructor for all operators:
Operator(T::Type, dim::Tuple, args...)


mutable struct LBFGS{R, T <: BlockArray, M} <: LinearOperator
currmem::Integer
curridx::Integer
Copy link
Member

Choose a reason for hiding this comment

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

having Abstract Types in constructors creates Type Instability.

H::R
end

function LBFGS(x::T, M::Integer) where {R, T <: BlockArray{R}}
Copy link
Member

@nantonel nantonel Nov 26, 2017

Choose a reason for hiding this comment

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

this created problems as R for example when typing LBFGS( (zeros(3),zeros(Complex{Float64})), 3).
While typeof( (zeros(3),zeros(Complex{Float64})) ) <: BlockArray{Float64} == true apparently it couldn't be determined that R was Float64.

L.ys_M[L.curridx] = ys
blockcopy!(L.s_M[L.curridx], L.s)
blockcopy!(L.y_M[L.curridx], L.y)
yty = real(vecdot(L.y, L.y))
Copy link
Member

Choose a reason for hiding this comment

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

test passed also with vecdot but I guess it is more safe to use our blockvecdot no?

@nantonel
Copy link
Member

definitively agree with that. changed that!

@lostella
Copy link
Member Author

Ok! Let me propose some additional changes though, let's wait before merging.

@nantonel
Copy link
Member

sure! actually why not waiting until the new solvers are done?

@nantonel nantonel merged commit af0bf85 into master Nov 27, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants