@@ -319,7 +319,7 @@ inline std::complex<var> pow(const std::complex<var>& x, const var& y) {
319319 * @return first argument to the power of the second argument
320320 */
321321template <typename T, typename = require_arithmetic_t <T>>
322- inline std::complex <var> pow (const std::complex <var>& x, T y) {
322+ inline std::complex <var> pow (const std::complex <var>& x, const T& y) {
323323 return internal::complex_pow (x, y);
324324}
325325
@@ -382,7 +382,7 @@ inline std::complex<var> pow(const var& x, std::complex<T> y) {
382382 * @return first argument to the power of the second argument
383383 */
384384template <typename T, typename = require_arithmetic_t <T>>
385- inline std::complex <var> pow (T x, const std::complex <var>& y) {
385+ inline std::complex <var> pow (const T& x, const std::complex <var>& y) {
386386 return internal::complex_pow (x, y);
387387}
388388
@@ -401,6 +401,26 @@ inline std::complex<var> pow(const std::complex<var>& x, int y) {
401401 return internal::complex_pow (x, y);
402402}
403403
404+ /* *
405+ * Returns the elementwise raising of the first argument to the power of the
406+ * second argument.
407+ *
408+ * @tparam T1 type of first argument
409+ * @tparam T2 type of second argument
410+ * @param a first argument
411+ * @param b second argument
412+ * @return the elementwise raising of the first argument to the power of the
413+ * second argument.
414+ */
415+ template <typename T1, typename T2, require_any_container_t <T1, T2>* = nullptr ,
416+ require_all_not_matrix_st<is_var, T1, T2>* = nullptr ,
417+ require_any_not_st_arithmetic<T1, T2>* = nullptr >
418+ inline auto pow (const T1& a, const T2& b) {
419+ return apply_scalar_binary (a, b, [](const auto & c, const auto & d) {
420+ return stan::math::pow (c, d);
421+ });
422+ }
423+
404424} // namespace math
405425} // namespace stan
406426#endif
0 commit comments