File tree Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Expand file tree Collapse file tree 2 files changed +6
-0
lines changed Original file line number Diff line number Diff line change @@ -254,6 +254,9 @@ SampleArgs <- R6::R6Class(
254
254
fileext = " .json"
255
255
)
256
256
for (i in seq_along(inv_metric_paths )) {
257
+ if (length(inv_metric [[i ]] == 1 ) && metric == " diag_e" ) {
258
+ inv_metric [[i ]] <- array (inv_metric [[i ]], dim = c(1 ))
259
+ }
257
260
write_stan_json(list (inv_metric = inv_metric [[i ]]), inv_metric_paths [i ])
258
261
}
259
262
Original file line number Diff line number Diff line change @@ -1743,6 +1743,9 @@ inv_metric <- function(matrix = TRUE) {
1743
1743
if (matrix && ! is.matrix(out [[1 ]])) {
1744
1744
# convert each vector to a diagonal matrix
1745
1745
out <- lapply(out , diag )
1746
+ } else if (length(out [[1 ]]) == 1 ) {
1747
+ # convert each scalar to a 1x1 matrix
1748
+ out <- lapply(out , array , dim = c(1 ))
1746
1749
}
1747
1750
out
1748
1751
}
You can’t perform that action at this time.
0 commit comments