@@ -23,36 +23,36 @@ julia> build(p, PG());
2323
2424"""
2525function build (terms:: Tuple , solver:: ForwardBackwardSolver )
26- x = extract_variables (terms)
27- # Separate smooth and nonsmooth
28- smooth, nonsmooth = split_smooth (terms)
29- # Separate quadratic and nonquadratic
30- quadratic, smooth = split_quadratic (smooth)
31- kwargs = Array {Any, 1} ()
32- if is_proximable (nonsmooth)
33- g = extract_proximable (x, nonsmooth)
34- append! (kwargs, [(:g , g)])
35- if ! isempty (quadratic)
36- fq = extract_functions (quadratic)
37- Aq = extract_operators (x, quadratic)
38- append! (kwargs, [(:fq , fq)])
39- append! (kwargs, [(:Aq , Aq)])
40- end
41- if ! isempty (smooth)
42- if is_linear (smooth)
43- fs = extract_functions (smooth)
44- As = extract_operators (x, smooth)
45- append! (kwargs, [(:As , As)])
46- else
47- fs = extract_functions_nodisp (smooth)
48- As = extract_affines (x, smooth)
49- fs = PrecomposeNonlinear (fs, As)
50- end
51- append! (kwargs, [(:fs , fs)])
52- end
53- return build_iterator (x, solver; kwargs... )
54- end
55- error (" Sorry, I cannot solve this problem" )
26+ x = extract_variables (terms)
27+ # Separate smooth and nonsmooth
28+ smooth, nonsmooth = split_smooth (terms)
29+ # Separate quadratic and nonquadratic
30+ quadratic, smooth = split_quadratic (smooth)
31+ kwargs = Array {Any, 1} ()
32+ if is_proximable (nonsmooth)
33+ g = extract_proximable (x, nonsmooth)
34+ append! (kwargs, [(:g , g)])
35+ if ! isempty (quadratic)
36+ fq = extract_functions (quadratic)
37+ Aq = extract_operators (x, quadratic)
38+ append! (kwargs, [(:fq , fq)])
39+ append! (kwargs, [(:Aq , Aq)])
40+ end
41+ if ! isempty (smooth)
42+ if is_linear (smooth)
43+ fs = extract_functions (smooth)
44+ As = extract_operators (x, smooth)
45+ append! (kwargs, [(:As , As)])
46+ else
47+ fs = extract_functions_nodisp (smooth)
48+ As = extract_affines (x, smooth)
49+ fs = PrecomposeNonlinear (fs, As)
50+ end
51+ append! (kwargs, [(:fs , fs)])
52+ end
53+ return build_iterator (x, solver; kwargs... )
54+ end
55+ error (" Sorry, I cannot solve this problem" )
5656end
5757
5858# ###############################################################################
@@ -83,10 +83,10 @@ julia> solve!(x_solver);
8383
8484"""
8585function solve! (x_and_iter:: Tuple{Tuple{Vararg{Variable}}, ProximalAlgorithms.ProximalAlgorithm} )
86- x, iterator = x_and_iter
87- it, x_star = ProximalAlgorithms. run! (iterator)
88- ~ x .= x_star
89- return it, iterator
86+ x, iterator = x_and_iter
87+ it, x_star = ProximalAlgorithms. run! (iterator)
88+ ~ x .= x_star
89+ return it, iterator
9090end
9191
9292
@@ -109,15 +109,15 @@ Variable(Float64, (4,))
109109julia> A, b = randn(10,4), randn(10);
110110
111111julia> solve(p,PG());
112- it | gamma | fpr |
113- ------|------------|------------|
114- 1 | 7.6375e-02 | 1.8690e+00 |
115- 12 | 7.6375e-02 | 9.7599e-05 |
112+ it | gamma | fpr |
113+ ------|------------|------------|
114+ 1 | 7.6375e-02 | 1.8690e+00 |
115+ 12 | 7.6375e-02 | 9.7599e-05 |
116116
117117```
118118
119119"""
120120function solve (terms:: Tuple , solver:: ForwardBackwardSolver )
121- built_slv = build (terms, solver)
122- return solve! (built_slv)
121+ built_slv = build (terms, solver)
122+ return solve! (built_slv)
123123end
0 commit comments