oxfordcontrol/TRS.jl

Problem with initialization

pkofod opened this issue · 2 comments

I think you may have something incorrectly initialized, since the output varies slightly between runs.

julia> trs([1.0 0.0; 0.0 1.0], [-18.0, -14.0], 10.0)[1]
2×1 Array{Float64,2}:
 7.893522173763263
 6.139406135149204

julia> trs([1.0 0.0; 0.0 1.0], [-18.0, -14.0], 10.0)[1]
2×1 Array{Float64,2}:
 7.893522173763264
 6.139406135149204

julia> trs([1.0 0.0; 0.0 1.0], [-18.0, -14.0], 10.0)[1]
2×1 Array{Float64,2}:
 7.893522173763264
 6.139406135149204

julia> trs([1.0 0.0; 0.0 1.0], [-18.0, -14.0], 10.0)[1]
2×1 Array{Float64,2}:
 7.8935221737632615
 6.139406135149205 

This is because of the underlying eigensolver used, Arpack. The results are not deterministic as a initial random vector is used inside Arpack's Fortran code. If you want to have deterministic results try passing an initial point with the keyword argument v0 (dimension: 2n) which is passed to ARPACK.

I will update the documentation to emphasise this and to make the use of warm-starting more clear.

Ah okay, thanks for clarifying!