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