Skip to content

Commit 9644892

Browse files
Merge pull request #895 from stan-dev/algebra-solvers-cleanup
Fix argument order, missing index entries for variadic solvers
2 parents 7fe8f3a + 098efc1 commit 9644892

File tree

3 files changed

+32
-4
lines changed

3 files changed

+32
-4
lines changed

src/functions-reference/functions_index.qmd

Lines changed: 20 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/functions-reference/higher-order_functions.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,18 +59,26 @@ and ultimately the computational cost of evaluating the gradients.
5959

6060
### Call to the algebraic solver
6161

62+
<!-- vector; solve_newton; (function algebra_system, vector y_guess, ...); -->
63+
\index{{\tt \bfseries solve\_newton }!{\tt (function algebra\_system, vector y\_guess, ...): vector}|hyperpage}
6264
`vector` **`solve_newton`**`(function algebra_system, vector y_guess, ...)`<br>\newline
6365
Solves the algebraic system, given an initial guess, using Newton's method.
6466
{{< since 2.31 >}}
6567

68+
<!-- vector; solve_newton_tol; (function algebra_system, vector y_guess, data real scaling_step, data real f_tol, int max_steps, ...); -->
69+
\index{{\tt \bfseries solve\_newton\_tol }!{\tt (function algebra\_system, vector y\_guess, data real scaling\_step, data real f\_tol, int max\_steps, ...): vector}|hyperpage}
6670
`vector` **`solve_newton_tol`**`(function algebra_system, vector y_guess, data real scaling_step, data real f_tol, int max_steps, ...)`<br>\newline
6771
Solves the algebraic system, given an initial guess, using Newton's method with additional control parameters for the solver.
6872
{{< since 2.31 >}}
6973

74+
<!-- vector; solve_powell; (function algebra_system, vector y_guess, ...); -->
75+
\index{{\tt \bfseries solve\_powell }!{\tt (function algebra\_system, vector y\_guess, ...): vector}|hyperpage}
7076
`vector` **`solve_powell`**`(function algebra_system, vector y_guess, ...)`<br>\newline
7177
Solves the algebraic system, given an initial guess, using Powell's hybrid method.
7278
{{< since 2.31 >}}
7379

80+
<!-- vector; solve_powell_tol; (function algebra_system, vector y_guess, data real rel_tol, data real f_tol, int max_steps, ...); -->
81+
\index{{\tt \bfseries solve\powell\_tol }!{\tt (function algebra\_system, vector y\_guess, data real rel\_tol, data real f\_tol, int max\_steps, ...): vector}|hyperpage}
7482
`vector` **`solve_powell_tol`**`(function algebra_system, vector y_guess, data real rel_tol, data real f_tol, int max_steps, ...)`<br>\newline
7583
Solves the algebraic system, given an initial guess, using Powell's hybrid method with additional control parameters for the solver.
7684
{{< since 2.31 >}}

src/stan-users-guide/algebraic-equations.qmd

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,17 @@ do so, the current Metropolis proposal gets rejected.
142142
## Control parameters for the algebraic solver {#algebra-control.section}
143143

144144
The call to the algebraic solver shown previously uses the default control settings. The `_tol` variant of the solver function
145-
allows three additional parameters, all of which must be supplied.
145+
allows three additional parameters, all of which must be supplied before the variadic arguments.
146146

147147
```stan
148-
y = solve_newton_tol(system, y_guess, theta, x_r, x_i,
149-
scaling_step, f_tol, max_steps);
148+
y = solve_newton_tol(system, y_guess, scaling_step, f_tol, max_steps,
149+
theta, x_r, x_i);
150150
```
151151

152152
For the Newton solver the three control arguments are scaling step, function tolerance, and maximum number of steps. For the Powell's hybrid method the three control arguments are relative tolerance, function tolerance, and maximum number of steps. If a Newton step is smaller than the scaling step tolerance, the code breaks, assuming the solver is no longer making significant progress. If set to 0, this constraint is ignored. For Powell's hybrid method the relative tolerance is the estimated relative error of the solver and serves to test if a satisfactory solution has been found. After convergence of the either solver, the proposed solution
153153
is plugged into the algebraic system and its norm is compared to the function tolerance. If the norm is below the function tolerance, the solution is deemed acceptable. If the solver solver reaches the maximum number of steps, it stops and returns an error message. If one of the criteria is not met, the
154154
Metropolis proposal gets rejected with a warning message explaining which criterion
155-
was not satisfied.
155+
was not satisfied.
156156

157157

158158
The default values for the control arguments are respectively

0 commit comments

Comments
 (0)