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([21, 28, 21, 4, 20, 17, 6, 11, 1, 22], order=31) In [3]: np.power(x, 3) Out[3]: GF([23, 4, 23, 2, 2, 15, 30, 29, 1, 15], order=31) In [4]: x ** 3 Out[4]: GF([23, 4, 23, 2, 2, 15, 30, 29, 1, 15], order=31) In [5]: x * x * x Out[5]: GF([23, 4, 23, 2, 2, 15, 30, 29, 1, 15], order=31)
In [6]: x = GF.Random(10, low=1); x Out[6]: GF([23, 29, 13, 9, 18, 21, 4, 22, 5, 18], order=31) In [7]: y = np.random.randint(-10, 10, 10); y Out[7]: array([-2, 9, 5, 2, -9, 5, -8, 8, -5, 4]) In [8]: np.power(x, y) Out[8]: GF([16, 15, 6, 19, 16, 6, 16, 28, 5, 10], order=31) In [9]: x ** y Out[9]: GF([16, 15, 6, 19, 16, 6, 16, 28, 5, 10], order=31)