np.power

np.power(x, y)[source]

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([ 4, 22, 19, 29, 25, 14,  0,  9,  8, 25], order=31)

In [3]: np.power(x, 3)
Out[3]: GF([ 2, 15,  8, 23,  1, 16,  0, 16, 16,  1], order=31)

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

In [5]: x * x * x
Out[5]: GF([ 2, 15,  8, 23,  1, 16,  0, 16, 16,  1], order=31)
In [6]: x = GF.Random(10, low=1); x
Out[6]: GF([16, 30, 23, 19, 30, 22, 15, 20, 16, 17], order=31)

In [7]: y = np.random.randint(-10, 10, 10); y
Out[7]: array([ -5,   8,   2,   9,  -4, -10,  -7,  -3, -10,  -1])

In [8]: np.power(x, y)
Out[8]: GF([ 1,  1,  2, 16,  1, 25, 27, 16,  1, 11], order=31)

In [9]: x ** y
Out[9]: GF([ 1,  1,  2, 16,  1, 25, 27, 16,  1, 11], order=31)