Skip to content

Commit 20d22c5

Browse files
committed
Merge branch 'master' of https://github.com/stan-dev/docs
2 parents 23ec2e4 + 2357114 commit 20d22c5

File tree

7 files changed

+72
-35
lines changed

7 files changed

+72
-35
lines changed

Jenkinsfile

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ pipeline {
99
parameters {
1010
string(defaultValue: '', name: 'major_version', description: "Major version of the docs to be built")
1111
string(defaultValue: '', name: 'minor_version', description: "Minor version of the docs to be built")
12+
string(defaultValue: '', name: 'last_docs_version_dir', description: "Last docs version found in /docs. Example: 2_21")
1213
}
1314
environment {
1415
GITHUB_TOKEN = credentials('6e7c1e8f-ca2c-4b11-a70e-d934d3f6b681')
@@ -48,6 +49,11 @@ pipeline {
4849
sh "python add_redirects.py $major_version $minor_version stan-users-guide"
4950
}
5051
}
52+
stage("Link docs to latest") {
53+
steps{
54+
sh "add_links.sh $last_docs_version_dir"
55+
}
56+
}
5157
stage("Push PR for docs") {
5258
steps {
5359
withCredentials([usernamePassword(credentialsId: 'a630aebc-6861-4e69-b497-fd7f496ec46b',

add_links.sh

100644100755
Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,20 @@
11
#!/usr/bin/env bash
22

3-
mkdir docs/2_20_tmp
4-
(cd docs/2_20; tar cf - .) | (cd docs/2_20_tmp; tar xvf - )
5-
python link_to_latest.py docs/2_20_tmp/stan-users-guide "Stan User's Guide"
6-
python link_to_latest.py docs/2_20_tmp/reference-manual "Stan Reference Manual"
7-
python link_to_latest.py docs/2_20_tmp/functions-reference "Stan Functions Reference"
8-
mv docs/2_20 docs/2_20_bak
9-
mv docs/2_20_tmp/ docs/2_20
3+
### USAGE
4+
# add_links.sh last_docs_version_dir
5+
# add_links.sh 2_21
6+
7+
directory="$1"
8+
9+
mkdir docs/"$directory"_tmp
10+
11+
(cd docs/"$directory"; tar cf - .) | (cd docs/"$directory"_tmp; tar xvf - )
12+
13+
python link_to_latest.py docs/"$directory"_tmp/stan-users-guide "Stan User's Guide"
14+
python link_to_latest.py docs/"$directory"_tmp/reference-manual "Stan Reference Manual"
15+
python link_to_latest.py docs/"$directory"_tmp/functions-reference "Stan Functions Reference"
16+
17+
mv docs/"$directory" docs/"$directory"_bak
18+
mv docs/"$directory"_tmp/ docs/"$directory"
19+
20+
rm -r "$directory"_tmp

src/functions-reference/array_operations.Rmd

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33
```{r results='asis', echo=FALSE}
44
if (knitr::is_html_output()) {
55
cat(' * <a href="array-reductions.html">Reductions</a>\n')
6-
cat(' * <a href="array-size-and-dimension-function.html">Array Size and Dimension Function</a>\n')
7-
cat(' * <a href="array-broadcasting.html">Array Broadcasting</a>\n')
8-
cat(' * <a href="array-concatenation.html">Array Concatenation</a>\n')
6+
cat(' * <a href="array-size-and-dimension-function.html">Array size and dimension function</a>\n')
7+
cat(' * <a href="array-broadcasting.html">Array broadcasting</a>\n')
8+
cat(' * <a href="array-concatenation.html">Array concatenation</a>\n')
99
cat(' * <a href="sorting-functions.html">Sorting functions</a>\n')
10+
cat(' * <a href="reversing-functions.html">Reversing functions</a>\n')
1011
}
1112
```
1213

@@ -178,7 +179,7 @@ The squared Euclidean distance between x and y
178179
`real` **`squared_distance`**`(row_vector x, row_vector[] y)`<br>\newline
179180
The Euclidean distance between x and y
180181

181-
## Array Size and Dimension Function
182+
## Array size and dimension function
182183

183184
The size of an array or matrix can be obtained using the `dims()`
184185
function. The `dims()` function is defined to take an argument
@@ -236,7 +237,7 @@ can be any type, but the size is just the size of the top level array,
236237
not the total number of elements contained. For example, if `x` is of
237238
type `real[4,3]` then `size(x)` is 4.
238239

239-
## Array Broadcasting {#array-broadcasting}
240+
## Array broadcasting {#array-broadcasting}
240241

241242
The following operations create arrays by repeating elements to fill
242243
an array of a specified size. These operations work for all input
@@ -312,7 +313,7 @@ After the assignment to `b`, the value for `b[j,k,m,n]` is equal to
312313
`a[m,n]` where it is defined, for `j` in `1:3`, `k` in `1:4`, `m` in
313314
`1:5`, and `n` in `1:6`.
314315

315-
## Array Concatenation {#array-concatenation}
316+
## Array concatenation {#array-concatenation}
316317

317318
<!-- T; append_array; (T x, T y); -->
318319
\index{{\tt \bfseries append\_array }!{\tt (T x, T y): T}|hyperpage}
@@ -409,3 +410,16 @@ Number of components of v less than v[s]
409410
`int` **`rank`**`(int[] v, int s)`<br>\newline
410411
Number of components of v less than v[s]
411412

413+
## Reversing functions {#reversing-functions}
414+
415+
Stan provides functions to create a new array by reversing the order of
416+
elements in an existing array. For example, if `v` is declared as a real
417+
array of size 3, with values
418+
\[ \text{v} = (1,\, -10.3,\, 20.987), \] then
419+
\[ \mathrm{reverse(v)} = (20.987,\, -10.3,\, 1). \]
420+
421+
<!-- T[]; reverse; (T[] v); -->
422+
\index{{\tt \bfseries reverse }!{\tt (T[] v): T[]}|hyperpage}
423+
424+
`T[]` **`reverse`**`(T[] v)`<br>\newline
425+
Return a new array containing the elements of the argument in reverse order.

src/functions-reference/higher-order_functions.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -329,16 +329,16 @@ integrator separates parameter values, `theta`, from data values, `x_r`.
329329

330330
### Call to the 1D Integrator
331331

332-
<!-- vector; integrate_1d; (function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i); -->
333-
\index{{\tt \bfseries integrate\_1d }!{\tt (function integrand, real a, real b, real[] theta, real[] x\_r, int[] x\_i): vector}|hyperpage}
332+
<!-- real; integrate_1d; (function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i); -->
333+
\index{{\tt \bfseries integrate\_1d }!{\tt (function integrand, real a, real b, real[] theta, real[] x\_r, int[] x\_i): real}|hyperpage}
334334

335-
`vector` **`integrate_1d`** `(function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i)`<br>\newline
335+
`real` **`integrate_1d`** `(function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i)`<br>\newline
336336
Integrates the integrand from a to b.
337337

338-
<!-- vector; integrate_1d; (function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i), real relative_tolerance); -->
339-
\index{{\tt \bfseries integrate\_1d }!{\tt (function integrand, real a, real b, real[] theta, real[] x\_r, int[] x\_i, real relative\_tolerance): vector}|hyperpage}
338+
<!-- real; integrate_1d; (function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i), real relative_tolerance); -->
339+
\index{{\tt \bfseries integrate\_1d }!{\tt (function integrand, real a, real b, real[] theta, real[] x\_r, int[] x\_i, real relative\_tolerance): real}|hyperpage}
340340

341-
`vector` **`integrate_1d`** `(function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i, real relative_tolerance)`<br>\newline
341+
`real` **`integrate_1d`** `(function integrand, real a, real b, real[] theta, real[] x_r, int[] x_i, real relative_tolerance)`<br>\newline
342342
Integrates the integrand from a to b with the given relative tolerance.
343343

344344

src/functions-reference/matrix_operations.Rmd

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ cat(' * <a href="softmax.html">Special Matrix Functions</a>\n')
1616
cat(' * <a href="covariance.html">Covariance Functions</a>\n')
1717
cat(' * <a href="linear-algebra-functions-and-solvers.html">Linear Algebra Functions and Solvers</a>\n')
1818
cat(' * <a href="sort-functions.html">Sort Functions</a>\n')
19+
cat(' * <a href="reverse-functions.html">Reverse Functions</a>\n')
1920
}
2021
```
2122

@@ -1544,8 +1545,8 @@ The singular values of A in descending order
15441545

15451546
## Sort Functions
15461547

1547-
see section [sorting functions](#sorting-functions) for examples of how the functions
1548-
work.
1548+
See the [sorting functions section](#sorting-functions) for examples of how
1549+
the functions work.
15491550

15501551
<!-- vector; sort_asc; (vector v); -->
15511552
\index{{\tt \bfseries sort\_asc }!{\tt (vector v): vector}|hyperpage}
@@ -1611,3 +1612,16 @@ Number of components of v less than v[s]
16111612
`int` **`rank`**`(row_vector v, int s)`<br>\newline
16121613
Number of components of v less than v[s]
16131614

1615+
## Reverse Functions {#reverse-functions}
1616+
1617+
<!-- vector; reverse; (vector v); -->
1618+
\index{{\tt \bfseries reverse }!{\tt (vector v): vector}|hyperpage}
1619+
1620+
`vector` **`reverse`**`(vector v)`<br>\newline
1621+
Return a new vector containing the elements of the argument in reverse order.
1622+
1623+
<!-- row_vector; reverse; (row_vector v); -->
1624+
\index{{\tt \bfseries reverse }!{\tt (row_vector v): row_vector}|hyperpage}
1625+
1626+
`row_vector` **`reverse`**`(row_vector v)`<br>\newline
1627+
Return a new row vector containing the elements of the argument in reverse order.

src/reference-manual/analysis.Rmd

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,8 @@ $\theta$ and real- and discrete-valued data $y$.^[Using vectors simplifies high
8585

8686
An MCMC *sample* consists of a set of a sequence of $M$ Markov chains,
8787
each consisting of an ordered sequence of $N$ *draws* from the
88-
posterior.^[The structure is assumed to be rectangular; in the
89-
future, this needs to be generalized to ragged samples.] The sample
90-
thus consists of $M \times N$ draws from the posterior.
88+
posterior.^[The structure is assumed to be rectangular; in the future, this needs to be generalized to ragged samples.]
89+
The sample thus consists of $M \times N$ draws from the posterior.
9190

9291

9392
### Potential Scale Reduction
@@ -189,10 +188,7 @@ quantities. The short answer is "no," but this is elaborated
189188
further in this section.
190189

191190
For example, consider the value `lp__`, which is the log posterior
192-
density (up to a constant).^[The `lp__` value also represents the
193-
potential energy in the Hamiltonian system and is rate bounded by the
194-
randomly supplied kinetic energy each iteration, which follows a
195-
Chi-square distribution in the number of parameters.]
191+
density (up to a constant).^[The `lp__` value also represents the potential energy in the Hamiltonian system and is rate bounded by the randomly supplied kinetic energy each iteration, which follows a Chi-square distribution in the number of parameters.]
196192

197193
It is thus a mistake to declare convergence in any practical sense if
198194
`lp__` has not converged, because different chains are really in

src/reference-manual/statements.Rmd

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -800,11 +800,7 @@ Such reassignment is not permitted in BUGS. In BUGS, for loops are
800800
declarative, defining plates in directed graphical model notation,
801801
which can be thought of as repeated substructures in the graphical
802802
model. Therefore, it is illegal in BUGS or JAGS to have a for loop
803-
that repeatedly reassigns a value to a variable.^[A programming idiom
804-
in BUGS code simulates a local variable by replacing `theta` in the
805-
above example with `theta[n]`, effectively creating `N` different
806-
variables, `theta[1]`, ..., `theta[N]`. Of course, this is not a hack
807-
if the value of `theta[n]` is required for all `n`.]
803+
that repeatedly reassigns a value to a variable.^[A programming idiom in BUGS code simulates a local variable by replacing `theta` in the above example with `theta[n]`, effectively creating `N` different variables, `theta[1]`, ..., `theta[N]`. Of course, this is not a hack if the value of `theta[n]` is required for all `n`.]
808804

809805
In Stan, assignments are executed in the order they are encountered.
810806
As a consequence, the following Stan program has a very different
@@ -987,8 +983,8 @@ for (n in 1:N) {
987983
}
988984
```
989985

990-
The open curly bracket (`\{`) is the first character of the block
991-
and the close curly bracket (`\`}) is the last character.
986+
The open curly bracket (`{`) is the first character of the block
987+
and the close curly bracket (`}`) is the last character.
992988

993989
Because whitespace is ignored in Stan, the following program will
994990
not compile.

0 commit comments

Comments
 (0)