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([ 9, 11, 28, 11, 18,  2, 18, 29,  5, 19, 17,  7, 28,  2, 16, 25, 16,
    27, 22], 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([ 9, 11, 28, 11, 18,  2, 18, 29,  5, 19, 17,  7, 28,  2, 16, 25, 16,
       27, 22])
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([143, 255, 207, 111, 101, 232, 107,  90, 175,  92, 127, 101, 201,  26,
    213, 106, 170, 103,  74], order=2^8)