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