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([ 2, 20, 10, 10,  6, 19, 10, 26, 27, 10], order=31)

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

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

In [5]: x * x * x
Out[5]: GF([ 8,  2,  8,  8, 30,  8,  8, 30, 29,  8], order=31)
In [6]: x = GF.Random(10, low=1); x
Out[6]: GF([ 2, 29, 25,  4,  5,  8, 27, 11, 18, 13], order=31)

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

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

In [9]: x ** y
Out[9]: GF([ 2,  1,  1,  4, 25, 16,  1, 29,  8,  6], order=31)