Python numpy.core.umath.power() Examples
The following are 2
code examples of numpy.core.umath.power().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
numpy.core.umath
, or try the search function
.
Example #1
Source File: ma.py From Computable with MIT License | 6 votes |
def power (a, b, third=None): "a**b" if third is not None: raise MAError("3-argument power not supported.") ma = getmask(a) mb = getmask(b) m = mask_or(ma, mb) fa = filled(a, 1) fb = filled(b, 1) if fb.dtype.char in typecodes["Integer"]: return masked_array(umath.power(fa, fb), m) md = make_mask(umath.less(fa, 0), flag=1) m = mask_or(m, md) if m is nomask: return masked_array(umath.power(fa, fb)) else: fa = numeric.where(m, 1, fa) return masked_array(umath.power(fa, fb), m)
Example #2
Source File: ma.py From Computable with MIT License | 5 votes |
def __pow__(self, other, third=None): "Return power(self, other, third)" return power(self, other, third)