np.power
- np.power(x, y)
Exponentiates a Galois field array element-wise.
References
Examples
In [1]: GF = galois.GF(31) In [2]: x = GF.Random(10); x Out[2]: GF([24, 16, 20, 25, 25, 13, 9, 18, 2, 26], order=31) In [3]: np.power(x, 3) Out[3]: GF([29, 4, 2, 1, 1, 27, 16, 4, 8, 30], order=31) In [4]: x ** 3 Out[4]: GF([29, 4, 2, 1, 1, 27, 16, 4, 8, 30], order=31) In [5]: x * x * x Out[5]: GF([29, 4, 2, 1, 1, 27, 16, 4, 8, 30], order=31)
In [6]: x = GF.Random(10, low=1); x Out[6]: GF([24, 26, 11, 3, 7, 24, 15, 13, 18, 2], order=31) In [7]: y = np.random.randint(-10, 10, 10); y Out[7]: array([ -7, 4, -1, -5, 7, 3, 0, -10, -4, -1]) In [8]: np.power(x, y) Out[8]: GF([21, 5, 17, 6, 28, 29, 1, 25, 28, 16], order=31) In [9]: x ** y Out[9]: GF([21, 5, 17, 6, 28, 29, 1, 25, 28, 16], order=31)