Skip to content

Commit 438c186

Browse files
committed
[clad] Power can take arguments of different types.
1 parent ee8598f commit 438c186

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

math/mathcore/inc/Math/CladDerivator.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -151,8 +151,8 @@ ValueAndPushforward<T, T> Log2_pushforward(T x, T d_x)
151151
return {::TMath::Log2(x), (1.0 / (x * ::TMath::Log(2.0))) * d_x};
152152
}
153153

154-
template <typename T>
155-
ValueAndPushforward<T, T> Power_pushforward(T x, T y, T d_x, T d_y)
154+
template <typename T, typename U>
155+
ValueAndPushforward<T, T> Power_pushforward(T x, U y, T d_x, U d_y)
156156
{
157157
T pushforward = y * ::TMath::Power(x, y - 1) * d_x;
158158
if (d_y) {
@@ -161,8 +161,8 @@ ValueAndPushforward<T, T> Power_pushforward(T x, T y, T d_x, T d_y)
161161
return {::TMath::Power(x, y), pushforward};
162162
}
163163

164-
template <typename T, typename U>
165-
void Power_pullback(T x, T y, U p, clad::array_ref<T> d_x, clad::array_ref<T> d_y)
164+
template <typename T, typename U, typename V>
165+
void Power_pullback(T x, U y, V p, clad::array_ref<T> d_x, clad::array_ref<U> d_y)
166166
{
167167
auto t = pow_pushforward(x, y, 1, 0);
168168
*d_x += t.pushforward * p;

0 commit comments

Comments
 (0)