np.multiply

np.multiply(x, y)

Multiplies two Galois field arrays element-wise.

References

Examples

Multiplying two Galois field arrays results in field multiplication.

In [1]: GF = galois.GF(31)

In [2]: x = GF.Random(10); x
Out[2]: GF([ 0, 21, 16, 16, 15, 28, 13,  8, 29, 27], order=31)

In [3]: y = GF.Random(10); y
Out[3]: GF([ 2, 26, 25,  3, 17, 14, 29,  5,  8,  9], order=31)

In [4]: np.multiply(x, y)
Out[4]: GF([ 0, 19, 28, 17,  7, 20,  5,  9, 15, 26], order=31)

In [5]: x * y
Out[5]: GF([ 0, 19, 28, 17,  7, 20,  5,  9, 15, 26], order=31)

Multiplying a Galois field array with an integer results in scalar multiplication.

In [6]: GF = galois.GF(31)

In [7]: x = GF.Random(10); x
Out[7]: GF([ 2, 29,  0,  6,  4, 25,  1, 13,  2, 11], order=31)

In [8]: np.multiply(x, 3)
Out[8]: GF([ 6, 25,  0, 18, 12, 13,  3,  8,  6,  2], order=31)

In [9]: x * 3
Out[9]: GF([ 6, 25,  0, 18, 12, 13,  3,  8,  6,  2], order=31)
In [10]: print(GF.properties)
GF(31):
  characteristic: 31
  degree: 1
  order: 31
  irreducible_poly: x + 28
  is_primitive_poly: True
  primitive_element: 3

# Adding `characteristic` copies of any element always results in zero
In [11]: x * GF.characteristic
Out[11]: GF([0, 0, 0, 0, 0, 0, 0, 0, 0, 0], order=31)