Skip to content

Commit 2f84ad4

Browse files
committed
Fix various broken links and out-of-date text
1 parent e59e9a6 commit 2f84ad4

17 files changed

+78
-80
lines changed

src/cmdstan-guide/err_handling_apdx.qmd

Lines changed: 0 additions & 27 deletions
This file was deleted.

src/cmdstan-guide/installation.qmd

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,9 @@ With conda, you can install CmdStan from the
2222
[conda-forge channel](https://conda-forge.org/).
2323
This will install a pre-built version of CmdStan along with the required
2424
dependencies (i.e. a C++ compiler, a version of Make, and required
25-
libraries) detailed below under [Source installation].
26-
The conda installation is designed so one can use the R or Python
27-
bindings to CmdStan seamlessly. Additionally, it provides the command
28-
`cmdstan_model` to activate the CmdStan makefile from anywhere.
25+
libraries). The conda installation is designed so one can use the R or
26+
Python bindings to CmdStan seamlessly. Additionally, it provides the
27+
command `cmdstan_model` to activate the CmdStan makefile from anywhere.
2928

3029
_Note_: This requires that conda has been installed already on your machine.
3130
You can either install [miniconda](https://docs.conda.io/en/latest/miniconda.html), a free, minimal installer for conda
@@ -224,7 +223,7 @@ On Linux and macOS:
224223
> make examples/bernoulli/bernoulli
225224
226225
# fit to provided data (results of 10 trials, 2 out of 10 successes)
227-
> ./examples/bernoulli/bernoulli sample\
226+
> ./examples/bernoulli/bernoulli sample\
228227
data file=examples/bernoulli/bernoulli.data.json
229228
230229
# default output written to file `output.csv`,
@@ -587,7 +586,7 @@ CmdStan v2.33.1 help
587586
4. Build the diagnose utility bin/diagnose
588587
5. Build all libraries and object files compile and link an executable Stan program
589588
590-
Note: to build using multiple cores, use the -j option to make, e.g.,
589+
Note: to build using multiple cores, use the -j option to make, e.g.,
591590
for 4 cores:
592591
> make build -j4
593592

src/cmdstan-guide/parallelization.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ Example:
5050
```
5151

5252
When the model is compiled with `STAN_THREADS` we can sample with multiple chains with a single
53-
executable (see section [running multiple chains]{#multi-chain-sampling} for cases when this is
53+
executable (see section [running multiple chains](mcmc_config.qmd#multi-chain-sampling) for cases when this is
5454
available). When running multiple chains `num_threads` is the maximum number of threads that can
5555
be used by all the chains combined. The exact number of threads that will be used for each chain
5656
at a given point in time is determined by the TBB scheduler. The following example start 2 chains

src/functions-reference/deprecated_functions.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ replace it.
1212
Starting in Stan 2.29, deprecated functions with drop in replacements (such as
1313
the renaming of `get_lp` or `multiply_log`) will be removed 3 versions later
1414
e.g., functions deprecated in Stan 2.20 will be removed in Stan 2.23 and placed
15-
in [Removed Functions]. The Stan compiler can
15+
in [Removed Functions](removed_functions.qmd). The Stan compiler can
1616
[automatically update](https://mc-stan.org/docs/stan-users-guide/using-stanc.html#stanc-pretty-printing)
1717
these on the behalf of the user for the entire deprecation window and at least
1818
one version following the removal.

src/functions-reference/integer-valued_basic_functions.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ in the Stan Reference Manual.
218218
Return the value `x` truncated to an integer. This will throw an error
219219
if the value of `x` is too big to represent as a 32-bit signed integer.
220220

221-
This is similar to `trunc` (see [Rounding functions]) but the return type is of
221+
This is similar to `trunc` (see [Rounding functions](real-valued_basic_functions.qmd#rounding-functions)) but the return type is of
222222
type `int`. For example, `to_int(3.9)` is `3`, and `to_int(-3.9)` is `-3`.
223223
{{< since 2.31 >}}
224224

src/reference-manual/blocks.qmd

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ applied once per chain.*
171171
`model` | yes | evaluate / leapfrog step
172172
`generated quantities` | yes | eval / sample
173173
&nbsp; | &nbsp; | write / sample
174-
`\slshape (initialization)` | n/a | read, transform / chain
174+
*`(initialization)`* | n/a | read, transform / chain
175175

176176
**Variable Declaration Table.**
177177
<a id="where-to-declare-table"></a>
@@ -271,7 +271,7 @@ generated quantities {
271271
}
272272
```
273273

274-
In this example, `y[N]` is a modeled data vector. Although it is
274+
In this example, `y` is an array of modeled data. Although it is
275275
specified in the `data` block, and thus must have a known value
276276
before the program may be run, it is modeled as if it were generated
277277
randomly as described by the model.

src/reference-manual/deprecations.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ to replace it.
99

1010
Starting with Stan 2.29, minor (syntax-level) deprecations can be removed 3
1111
versions after release; e.g., syntax deprecated in Stan 2.20 will be removed in
12-
Stan 2.23 and placed in [Removed Features]. The Stan compiler can
12+
Stan 2.23 and placed in [Removed Features](removals.qmd). The Stan compiler can
1313
[automatically update](https://mc-stan.org/docs/stan-users-guide/using-stanc.html#stanc-pretty-printing)
1414
many of these on the behalf of the user for at least one version after they are
1515
removed.

src/reference-manual/diagnostics.qmd

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -51,9 +51,8 @@ the reference manual chapter on transforms.
5151

5252
The log density includes the Jacobian adjustment implied by the
5353
constraints declared on variables. The Jacobian adjustment for
54-
constrained parameter transforms will be turned off if optimization is
55-
used in practice, but there is as of yet no way to turn it off in
56-
diagnostic mode.
54+
constrained parameter transforms may be turned off for optimization,
55+
but there is as of yet no way to turn it off in diagnostic mode.
5756

5857

5958
## Configuration options

src/reference-manual/execution.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ displayed.
5757

5858
## Initialization
5959

60-
Initialization is the same for sampling, optimization, and diagnosis
60+
Initialization is the same for all of Stan's algorithms.
6161

6262

6363
### User-supplied initial values {-}

src/reference-manual/expressions.qmd

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,7 @@ The following built in functions are also reserved and
158158
cannot be used as variable names:
159159

160160
```
161-
print, reject, profile, get_lp, increment_log_prob,
162-
target
161+
print, reject, profile, target
163162
```
164163

165164
The following block identifiers are reserved and cannot be used as variable names:
@@ -1117,7 +1116,11 @@ For example, this means `array[,] int` may be used where `array [,]
11171116
real` or `array [,] complex` is required; as another example, `array[]
11181117
real` may be used anywhere `array[] complex` is required.
11191118

1119+
Tuples have the natural extension of the above rules, applied to all
1120+
sub-types at once
11201121

1122+
8. A `tuple(U1, ..., UN)` may be promoted to a `tuple(T1, ..., TN)` if
1123+
every `Un` can be promoted to `Tn` for `n` in `1:N`
11211124

11221125
#### Literals {-}
11231126

src/reference-manual/includes.qmd

Lines changed: 15 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ contents of the included file.
8383

8484
## Recursive includes
8585

86-
Recursive includes will be ignored. For example, suppose
86+
Recursive includes will lead to a compiler error. For example, suppose
8787
`a.stan` contains
8888

8989
```stan
@@ -96,9 +96,20 @@ and `b.stan` contains
9696
#include a.stan
9797
```
9898

99-
The result of processing this file will be empty, because
100-
`a.stan` will include `b.stan`, from which the include of
101-
`a.stan` is ignored and a warning printed.
99+
This will result in an error explaining the circular dependency:
100+
101+
```
102+
Syntax error in './b.stan', line 1, column 0, included from
103+
'./a.stan', line 1, column 0, included from
104+
'./b.stan', line 1, column 0, included from
105+
'a.stan', line 1, column 0, include error:
106+
-------------------------------------------------
107+
1: #include a.stan
108+
^
109+
-------------------------------------------------
110+
111+
File a.stan recursively included itself.
112+
```
102113

103114
## Include paths
104115

src/reference-manual/licenses.qmd

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,14 @@ SUNDIALS is distributed under the
6161
The copyright of SUNDIALS is owned by Lawrence Livermore National
6262
Security Lab.
6363

64+
## Threaded Building Blocks (TBB) License
65+
66+
Stan uses the Threaded Building Blocks (TBB) library for parallel computations.
67+
TBB is distributed under the
68+
69+
* [Apache License, version 2](https://opensource.org/license/apache-2-0)
70+
71+
The copyright of TBB is owned by Intel Corporation.
6472

6573
## Google test license
6674

src/reference-manual/statements.qmd

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -124,11 +124,12 @@ an expression of type `vector` may be assigned to an lvalue of type
124124
### Lvalue summary {-}
125125

126126
The expressions that are legal left-hand sides of assignment
127-
statements are known as "lvalues." In Stan, there are only two
127+
statements are known as "lvalues." In Stan, there are three
128128
kinds of legal lvalues,
129129

130130
* a variable, or
131-
* a variable with one or more indices.
131+
* a variable with one or more indices, or
132+
* a comma separated list of lvalues surrounded by `(` and `)`
132133

133134
To be used as an lvalue, an indexed variable must have at least as
134135
many dimensions as the number of indices provided. An array of real
@@ -1140,12 +1141,8 @@ message that it is already defined.
11401141
### No constraints on local variables {-}
11411142

11421143
Local variables may not have constraints on their declaration. The
1143-
only types that may be used are
1144-
1145-
```
1146-
int, real, vector[K], row_vector[K], matrix[M, N].
1147-
```
1148-
1144+
only types that may be used are listed in the [types table](types.qmd#id:constrained-types.figure)
1145+
under "local".
11491146

11501147
### Blocks within blocks {-}
11511148

@@ -1430,6 +1427,10 @@ value of the log probability accumulator before and after each
14301427
sampling statement, it's possible to isolate where the log probability
14311428
becomes ill-defined (i.e., becomes not-a-number).
14321429

1430+
Note that print statements may not always be displayed immediately,
1431+
but rather at the end of an operation (e.g., leapfrog step). As such,
1432+
some issues such as infinite loops are difficult to debug effectively
1433+
with this technique.
14331434

14341435
## Reject statements {#reject-statements.section}
14351436

src/reference-manual/syntax.qmd

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,6 @@ A second condition is that there not be more indexes provided than
492492
dimensions of the underlying expression (in general) or variable (on
493493
the left side of assignments) being indexed. A vector or row vector
494494
adds 1 to the array dimension and a matrix adds 2. That is, the type
495-
`matrix[ , , ]`, a three-dimensional array of matrices, has five
495+
`array[ , , ] matrix`, a three-dimensional array of matrices, has five
496496
index positions: three for the array, one for the row of the matrix
497497
and one for the column.

src/reference-manual/types.qmd

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ size $6 \times 7$ containing values that are $3 \times 3$ matrices,
8383
and declares `z` to be a $12 \times 8 \times 15$ array of complex numbers.
8484

8585
Prior to 2.26 Stan models used a different syntax which has since been removed.
86-
See the [Removed Features] chapter for more details.
86+
See the [Removed Features](removals.qmd) chapter for more details.
8787

8888
### Tuple types {-}
8989

@@ -167,13 +167,14 @@ Stan uses 32-bit (4-byte) integers for all of its integer
167167
representations. The maximum value that can be represented
168168
as an integer is $2^{31}-1$; the minimum value is $-(2^{31})$.
169169

170-
When integers overflow, their values wrap. Thus it is up to the Stan
170+
When integers overflow, their value is determined by the underlying architecture.
171+
On most, their values wrap, but this cannot be guaranteed. Thus it is up to the Stan
171172
programmer to make sure the integer values in their programs stay in
172173
range. In particular, every intermediate expression must have an
173174
integer value that is in range.
174175

175176
Integer arithmetic works in the expected way for addition,
176-
subtraction, and multiplication, but rounds the result of division
177+
subtraction, and multiplication, but truncates the result of division
177178
(see [the Stan Functions Reference integer-valued arithmetic operators
178179
section](https://mc-stan.org/docs/functions-reference/integer-valued_basic_functions.html#int-arithmetic)
179180
for more information).
@@ -398,8 +399,7 @@ real<lower=-1, upper=1> rho;
398399
Lower bounds that are negative infinity or upper bounds that are
399400
positive infinity are ignored. Stan provides constants
400401
`positive_infinity()` and `negative_infinity()` which may
401-
be used for this purpose, or they may be read as data in the dump
402-
format.
402+
be used for this purpose, or they may be supplied as data.
403403

404404

405405
### Affinely transformed real {-}

src/reference-manual/user-functions.qmd

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,10 @@ and the recursive cases are that
418418
* a conditional statement qualifies if it has a default else
419419
clause and all of its body statements qualify.
420420

421+
An exception is made for "obviously infinite" loops like `while (1)`, which contain
422+
a `return` statement and no `break` statements. The only way to exit such a loop
423+
is to return, so they are considered as returning statements.
424+
421425
These rules disqualify
422426

423427
```stan

src/stan-users-guide/using-stanc.qmd

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,7 @@ Warning:
623623

624624
When a parameter is transformed in a non-linear fashion, an adjustment must be
625625
applied to account for distortion caused by the transform. This is discussed in
626-
depth in the [Changes of variables] section.
626+
depth in the [Changes of variables](reparameterization.qmd) section.
627627

628628
This portion of pedantic mode tries to detect instances where such an adjustment
629629
would be necessary and remind the user.
@@ -696,7 +696,7 @@ file.
696696

697697
Invoking `stanc --auto-format <model_file>` will print a version of your model
698698
which has been re-formatted. The goal is to have this automatic formatting stay
699-
as close as possible to the [Stan Program Style Guide]. This means spacing,
699+
as close as possible to the [Stan Program Style Guide](style-guide.qmd). This means spacing,
700700
indentation, and line length are all regularized. _Some_ deprecated features,
701701
like the use of `#` for line comments, are replaced, but the goal is mainly to
702702
preserve the program while formatting it.
@@ -810,17 +810,17 @@ The levels include these optimizations:
810810

811811
- **O0** includes no optimizations.
812812
- **O1** includes:
813-
- [Dead code elimination]
814-
- [Copy propagation]
815-
- [Constant propagation]
813+
- [Dead code elimination](#dead-code-elimination)
814+
- [Copy propagation](#copy-propagation)
815+
- [Constant propagation](#constant-propagation)
816816
- **Oexperimental** includes optimizations specified by **O1** and also:
817-
- [Automatic-differentiation level optimization]
818-
- [One step loop unrolling]
819-
- [Expression propagation]
820-
- [Partial evaluation]
821-
- [Lazy code motion]
822-
- [Function inlining]
823-
- [Static loop unrolling]
817+
- [Automatic-differentiation level optimization](#automatic-differentiation-level-optimization)
818+
- [One step loop unrolling](#one-step-loop-unrolling)
819+
- [Expression propagation](#expression-propagation)
820+
- [Partial evaluation](#partial-evaluation)
821+
- [Lazy code motion](#lazy-code-motion)
822+
- [Function inlining](#function-inlining)
823+
- [Static loop unrolling](#static-loop-unrolling)
824824

825825
In addition, **Oexperimental** will apply more repetitions of the optimizations,
826826
which may increase compile times.
@@ -924,9 +924,9 @@ prepare_data {
924924

925925
#### Copy propagation {-}
926926

927-
Copy propagation is similar to [expression propagation], but only
928-
propagates variables rather than arbitrary expressions. This can reduce the
929-
complexity of the code for other optimizations such as expression propagation.
927+
Copy propagation is similar to [expression propagation](#expression-propagation),
928+
but only propagates variables rather than arbitrary expressions. This can reduce
929+
the complexity of the code for other optimizations such as expression propagation.
930930

931931
Example Stan program:
932932

@@ -1048,7 +1048,7 @@ log_prob {
10481048

10491049
#### One step loop unrolling {-}
10501050

1051-
One step loop unrolling is similar to [static loop unrolling].
1051+
One step loop unrolling is similar to [static loop unrolling](#static-loop-unrolling).
10521052
However, this optimization only 'unrolls' the first loop iteration, and can
10531053
therefore work even when the total number of iterations is not predictable. This
10541054
can speed up a program by providing more opportunities for further optimizations
@@ -1103,7 +1103,7 @@ Constant propagation replaces the uses of a variable which
11031103
is known to have a constant value `E` with that constant `E`. This often results
11041104
in recalculating the expression, but provides more opportunities for further
11051105
optimizations such as partial evaluation. Expression propagation is always
1106-
followed by [lazy code motion] to avoid unnecessarily recomputing
1106+
followed by [lazy code motion](#lazy-code-motion) to avoid unnecessarily recomputing
11071107
expressions.
11081108

11091109
Example Stan program:

0 commit comments

Comments
 (0)