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