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,  2, 20, 13, 26, 14, 17, 29, 16,  6], order=31)

In [3]: np.power(x, 3)
Out[3]: GF([29,  8,  2, 27, 30, 16, 15, 23,  4, 30], order=31)

In [4]: x ** 3
Out[4]: GF([29,  8,  2, 27, 30, 16, 15, 23,  4, 30], order=31)

In [5]: x * x * x
Out[5]: GF([29,  8,  2, 27, 30, 16, 15, 23,  4, 30], order=31)
In [6]: x = GF.Random(10, low=1); x
Out[6]: GF([ 9, 22, 13, 23,  5, 11, 30, 21, 17, 17], order=31)

In [7]: y = np.random.randint(-10, 10, 10); y
Out[7]: array([-1,  3, -6, -8,  7,  0,  8, -1,  8,  8])

In [8]: np.power(x, y)
Out[8]: GF([ 7, 15,  2,  2,  5,  1,  1,  3, 18, 18], order=31)

In [9]: x ** y
Out[9]: GF([ 7, 15,  2,  2,  5,  1,  1,  3, 18, 18], order=31)