Skip to content

Commit

Permalink
Fix use of multiply rather than matrix multiply operator
Browse files Browse the repository at this point in the history
  • Loading branch information
matt-graham committed Aug 2, 2024
1 parent 04b30f6 commit 8e59672
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 9 deletions.
4 changes: 2 additions & 2 deletions R/barker.R
Original file line number Diff line number Diff line change
Expand Up @@ -53,12 +53,12 @@ log_density_ratio_barker <- function(
sum(
log1p_exp(
state$momentum() * Matrix::drop(
Matrix::t(scale_and_shape) *
Matrix::t(scale_and_shape) %*%
state$gradient_log_density(target_distribution)
)
) - log1p_exp(
proposed_state$momentum() * Matrix::drop(
Matrix::t(scale_and_shape) *
Matrix::t(scale_and_shape) %*%
proposed_state$gradient_log_density(target_distribution)
)
)
Expand Down
7 changes: 0 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,6 @@ results <- sample_chain(
n_main_iteration = n_main_iteration,
adapters = adapters
)
#> Warning in Matrix::t(scale_and_shape) * state$gradient_log_density(target_distribution): Recycling array of length 1 in array-vector arithmetic is deprecated.
#> Use c() or as.vector() instead.
#> Warning in Matrix::t(scale_and_shape) * proposed_state$gradient_log_density(target_distribution): Recycling array of length 1 in array-vector arithmetic is deprecated.
#> Use c() or as.vector() instead.
```

``` r
mean_accept_prob <- mean(results$statistics$accept_prob)
adapted_shape <- proposal$parameters()$shape
cat(
Expand Down

0 comments on commit 8e59672

Please sign in to comment.