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([ 3, 18,  1,  8, 14, 13, 29, 25, 17, 29, 23,  2,  2, 12, 20,  5,  6,
     3, 10], 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([ 3, 18,  1,  8, 14, 13, 29, 25, 17, 29, 23,  2,  2, 12, 20,  5,  6,
        3, 10])
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([197, 176, 120, 213, 244,  48,  52,  59, 134, 244,  62,  70, 214,  71,
    222, 101, 126, 171, 219], order=2^8)