pylops.utils.signalprocessing.convmtx

pylops.utils.signalprocessing.convmtx(h, n, offset=0, sparse=False)[source]

Convolution matrix

Makes a dense convolution matrix \(\mathbf{C}\) such that the dot product np.dot(C, x) is the convolution of the filter \(h\) centered on offset and the input signal \(x\).

Equivalent of MATLAB’s convmtx function for: - mode='full' when used with offset=0. - mode='same' when used with offset=len(h)//2 (after truncating the rows as C[:n])

Parameters:
hnumpy.ndarray

Convolution filter (1D array)

nint

Number of columns of convolution matrix

offsetint, optional

Index of the center of the filter

sparsebool, optional

Added in version 2.8.0.

Return dense (False) or sparse (True) matrix

Returns:
Cnumpy.ndarray or scipy.sparse.spmatrix

Convolution matrix of size \(\text{len}(h)+n-1 \times n\)