@@ -23,36 +23,36 @@ julia> build(p, PG());
23
23
24
24
"""
25
25
function 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" )
56
56
end
57
57
58
58
# ###############################################################################
@@ -83,10 +83,10 @@ julia> solve!(x_solver);
83
83
84
84
"""
85
85
function 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
90
90
end
91
91
92
92
@@ -109,15 +109,15 @@ Variable(Float64, (4,))
109
109
julia> A, b = randn(10,4), randn(10);
110
110
111
111
julia> 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 |
116
116
117
117
```
118
118
119
119
"""
120
120
function 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)
123
123
end
0 commit comments