pub fn pow_rrule<S: ScalarAd>(x: S, exponent: S, cotangent: S) -> (S, S)Expand description
Reverse rule for pow(x, exponent).
When x is zero and exponent is a non-positive real scalar, the exponent-cotangent path returns NaN to surface the singularity.
ยงExamples
use chainrules::pow_rrule;
let (dx, dexp) = pow_rrule(2.0_f64, 3.0_f64, 1.0);
assert_eq!(dx, 12.0);
assert!((dexp - 8.0_f64 * std::f64::consts::LN_2).abs() < 1e-12);