Skip to content

Commit

Permalink
Fix double use of eigen expression in rev pow
Browse files Browse the repository at this point in the history
  • Loading branch information
SteveBronder committed Jul 22, 2021
1 parent 023bf9e commit 74cab27
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion stan/math/prim/fun/pow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ inline complex_return_t<U, V> complex_pow(const U& x, const V& y) {
template <typename T1, typename T2, require_any_container_t<T1, T2>* = nullptr,
require_all_not_matrix_st<is_var, T1, T2>* = nullptr>
inline auto pow(const T1& a, const T2& b) {
return apply_scalar_binary(a, b, [&](const auto& c, const auto& d) {
return apply_scalar_binary(a, b, [](const auto& c, const auto& d) {
using std::pow;
return pow(c, d);
});
Expand Down
2 changes: 1 addition & 1 deletion stan/math/rev/fun/pow.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -329,7 +329,7 @@ template <typename T, typename Mat, require_arithmetic_t<T>* = nullptr,
inline auto pow(T base, const Mat& exponent) {
using ret_type = plain_type_t<Mat>;
arena_t<ret_type> arena_exponent = exponent;
arena_t<ret_type> ret = exponent.val().unaryExpr(
arena_t<ret_type> ret = arena_exponent.val().unaryExpr(
[base](auto&& x) { return std::pow(base, x); });
reverse_pass_callback([base, arena_exponent, ret]() mutable {
if (base == 0.0) {
Expand Down

0 comments on commit 74cab27

Please sign in to comment.