np.convolve

np.convolve(a, b)

Convolves the input arrays.

See: https://numpy.org/doc/stable/reference/generated/numpy.convolve.html

Examples

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

In [2]: a = GF.Random(10)

In [3]: b = GF.Random(10)

In [4]: np.convolve(a, b)
Out[4]: 
GF([ 2, 27, 22, 10, 19, 14, 23, 10,  3, 29, 16, 23, 27, 10,  4,  9, 28,
    20, 25], order=31)

# Equivalent implementation with native numpy
In [5]: np.convolve(a.view(np.ndarray).astype(int), b.view(np.ndarray).astype(int)) % 31
Out[5]: 
array([ 2, 27, 22, 10, 19, 14, 23, 10,  3, 29, 16, 23, 27, 10,  4,  9, 28,
       20, 25])
In [6]: GF = galois.GF(2**8)

In [7]: a = GF.Random(10)

In [8]: b = GF.Random(10)

In [9]: np.convolve(a, b)
Out[9]: 
GF([103, 191,  61, 121,  30, 184, 255, 250,  82,  79, 118,  96,  49, 168,
    142,  61, 182,  90, 173], order=2^8)