Skip to content

Commit

Permalink
step size option
Browse files Browse the repository at this point in the history
  • Loading branch information
baggepinnen committed Mar 30, 2020
1 parent b595056 commit f39cd5b
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions src/TotalLeastSquares.jl
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ end


"""
sls(A, y; r = 1, iters = 100, verbose = false, tol = 1.0e-8)
sls(A, y; r = 1, iters = 100, verbose = false, tol = 1.0e-8, α0 = 0.1)
Simplex least-squares: minimizeₓ ||Ax-y||₂ s.t. sum(x) = r
Expand All @@ -214,17 +214,15 @@ Simplex least-squares: minimizeₓ ||Ax-y||₂ s.t. sum(x) = r
- `iters`: Maximum number of iterations of projected gradient
- `verbose`: Print stuff
- `tol`: Tolerance (change in x between iterations).
- `α0`: initial step size. This parameter influences speed of convergence and also to which point the algorithm converges.
"""
function sls(A, y; r=1, iters=100, verbose=false, tol=1e-8)
function sls(A, y; r=1, iters=100, verbose=false, tol=1e-8, α0 = 0.1)

α0 = 0.1
x = A\y
proj_simplex!(x; r=r)
xo = copy(x)
g = similar(x)
e = similar(y)
local ng, step
step = 0.0
verbose && @info "Iter 0 cost: $(norm(A*x-y))"
for iter = 1:iters
mul!(e,A,x)
Expand Down

0 comments on commit f39cd5b

Please sign in to comment.