colour.algebra.spow¶
-
colour.algebra.
spow
(a, p)[source]¶ Raises given array \(a\) to the power \(p\) as follows: \(sign(a) * |a|^p\).
This avoids NaNs generation when array \(a\) is negative and the power \(p\) is fractional.
Parameters: - a (numeric or array_like) – Array \(a\).
- p (numeric or array_like) – Power \(p\).
Returns: Array \(a\) safely raised to the power \(p\).
Return type: numeric or ndarray
Examples
>>> np.power(-2, 0.15) nan >>> spow(-2, 0.15) # doctest: +ELLIPSIS -1.1095694... >>> spow(0, 0) 0.0