Skip to content

Commit

Permalink
[fedora] 隐藏编译消息
Browse files Browse the repository at this point in the history
  • Loading branch information
XiangyunHuang committed Dec 11, 2023
1 parent de29864 commit 8b0f9ea
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion probabilistic-reasoning-framework.qmd
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,7 @@ fit_gaussian$summary(.num_args = list(sigfig = 4, notation = "dec"))
Stan 语言和 C/C++ 语言比较类似,变量需要先声明再使用,函数需要用 `return` 返回值,总而言之,类型声明比较严格。变量的声明没有太多的内涵,就是 C++ 和 Stan 定义的语法,比如整型用 `int` 声明。建模过程中,时常需要将 R 语言环境中的数据传递给 Stan 代码编译出来的模型,而 Stan 是基于 C++ 语言,在变量类型方面有继承有发展。下表给出 Stan 与 R 语言中的变量类型对应关系。值得注意, R 语言的类型检查是不严格的,使用变量也不需要提前声明和初始化。Stan 语言中向量、矩阵的类型都是实数,下标也从 1 开始,元组类型和 R 语言中的列表类似,所有向量默认都是列向量。

| 类型 | Stan 语言 | R 语言 |
|-----------------|----------------------|---------------------------------|
|------------------|----------------------|--------------------------------|
| 整型 | `int x = 1;` | `x = 1L` |
| 实数 | `real x = 3.14;` | `x = 3.14` |
| 向量 | `vector[3] x = [1, 2, 3]';` | `x = c(1L, 2L, 3L)` |
Expand Down Expand Up @@ -336,6 +336,8 @@ model {
接着,将以上 Stan 代码编译

```{r}
#| message: false
mod_cholesky_decompose <- cmdstan_model(stan_file = stan_file, compile = TRUE)
```

Expand Down

0 comments on commit 8b0f9ea

Please sign in to comment.