@@ -34,7 +34,7 @@ class PowExpression : public Expression<PowExpression<EBase,EExp>> {
3434
3535 template <typename ... Args>
3636 KOKKOS_INLINE_FUNCTION
37- Real eval (Args... args) const {
37+ auto eval (Args... args) const {
3838 if constexpr (scalar_base) {
3939 return Kokkos::pow (m_base,m_exp.eval (args...));
4040 } else if constexpr (scalar_exp) {
@@ -43,6 +43,19 @@ class PowExpression : public Expression<PowExpression<EBase,EExp>> {
4343 return Kokkos::pow (m_base.eval (args...),m_exp.eval (args...));
4444 }
4545 }
46+
47+ static auto ret_type () {
48+ if constexpr (scalar_base) {
49+ using type = decltype (Kokkos::pow (std::declval<EBase>(),EExp::ret_type ()));
50+ return type (0 );
51+ } else if constexpr (scalar_exp) {
52+ using type = decltype (Kokkos::pow (EBase::ret_type (),std::declval<EExp>()));
53+ return type (0 );
54+ } else {
55+ using type = decltype (Kokkos::pow (EBase::ret_type (),EExp::ret_type ()));
56+ return type (0 );
57+ }
58+ }
4659protected:
4760
4861 EBase m_base;
@@ -64,19 +77,20 @@ pow (const Expression<EBase>& b, const Expression<EExp>& e)
6477 public: \
6578 name##Expression (const EArg& arg) \
6679 : m_arg(arg) \
67- { \
68- /* Nothing to do here */ \
69- } \
80+ {} \
7081 \
7182 int num_indices () const { return m_arg.num_indices (); } \
7283 \
7384 template <typename ... Args> \
7485 KOKKOS_INLINE_FUNCTION \
75- Real eval (Args... args) const { \
86+ auto eval (Args... args) const { \
7687 return Kokkos::impl (m_arg.eval (args...)); \
7788 } \
89+ static auto ret_type () { \
90+ using type = decltype (Kokkos::impl (EArg::ret_type ())); \
91+ return type (0 ); \
92+ } \
7893 protected: \
79- \
8094 EArg m_arg; \
8195 }; \
8296 \
0 commit comments