def _scalar_power(self, f, p, out):
        """Compute ``p``-th power of ``f`` for ``p`` scalar."""
        # Avoid infinite recursions by making a copy of the function
        f_copy = f.copy()

        def pow_posint(x, n):
            """Power function for positive integer ``n``, out-of-place."""
            if isinstance(x, np.ndarray):
                y = x.copy()
                return ipow_posint(y, n)
            else:
                return x ** n

        def ipow_posint(x, n):
            """Power function for positive integer ``n``, in-place."""
            if n == 1:
                return x
            elif n % 2 == 0:
                x *= x
                return ipow_posint(x, n // 2)
            else:
                tmp = x.copy()
                x *= x
                ipow_posint(x, n // 2)
                x *= tmp
                return x

        def power_oop(x, **kwargs):
            """Power out-of-place evaluation function."""
            if p == 0:
                return self.one()
            elif p == int(p) and p >= 1:
                return np.asarray(pow_posint(f_copy(x, **kwargs), int(p)),
                                  dtype=self.scalar_out_dtype)
            else:
                result = np.power(f_copy(x, **kwargs), p)
                return result.astype(self.scalar_out_dtype)

        out._call_out_of_place = power_oop
        decorator = preload_first_arg(out, 'in-place')
        out._call_in_place = decorator(_default_in_place)
        out._call_has_out = out._call_out_optional = False
        return out
Compute ``p``-th power of ``f`` for ``p`` scalar.