cmatrix.Matrix.convolve_signal

Matrix.convolve_signal()

Convolve self object (as a 1D signal) with given convolution mask (also as 1D signal)

Parameters

Type

Description

convolution_mask

Matrix

1D Matrix representing the convolution mask

mode

Int

Define the algorithme profile between
  • 0 => full convolution algorithm

  • 1 => convolution algorithm preservng time

Returns
Matrix

The 1D matrix containing the convolved signal.

Examples

>>> m=Matrix(1,8)
>>> import random as r
>>> for i in range(0,8):
...     m[0,i]=r.randint(0,50)
...
>>> mask=Matrix(1,3)
>>> for i in range(0,3):
...     mask[0,i]=r.randint(0,10)
...
>>> print(m)
| +25.000 | +8.000 | +41.000 | +20.000 | +28.000 | +23.000 | +17.000 | +45.000 |
printed
>>> print(mask)
| +1.000 | +5.000 | +9.000 |
printed
>>> print(m.convolve_signal(mask))
| +25.000 | +133.000 | +306.000 | +297.000 | +497.000 | +343.000 | +384.000 | +337.000 | +378.000 | +405.000 | +0.000 | +0.000 | +0.000 | +0.000 |
printed