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([17,  2,  5, 21, 12, 24, 17, 25, 16, 13], order=31)

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

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

In [5]: x * x * x
Out[5]: GF([15,  8,  1, 23, 23, 29, 15,  1,  4, 27], order=31)
In [6]: x = GF.Random(10, low=1); x
Out[6]: GF([15, 10, 10, 19, 15,  8, 29, 29,  2, 27], order=31)

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

In [8]: np.power(x, y)
Out[8]: GF([15,  1,  9,  9, 16,  4,  1, 30,  1, 23], order=31)

In [9]: x ** y
Out[9]: GF([15,  1,  9,  9, 16,  4,  1, 30,  1, 23], order=31)