convolve#
- class brainunit.math.convolve(a, v, mode='full', *, precision=None, preferred_element_type=None, **kwargs)#
Return the discrete, linear convolution of two one-dimensional sequences.
The resulting unit is
a.unit * v.unit.- Parameters:
a (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – First one-dimensional input array.v (saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex) – Second one-dimensional input array.mode (
str) – ‘full’ (default): output shape(N+M-1,). ‘same’: output lengthmax(M, N). ‘valid’: output lengthmax(M, N) - min(M, N) + 1.precision (
Any) – Precision for the computation.preferred_element_type (
str|type[Any] |dtype|SupportsDType|None) – Accumulation and result dtype.
- Returns:
out – Discrete, linear convolution of a and v. The resulting unit is
a.unit * v.unit.- Return type:
saiunit.Quantity |
Array|ndarray|bool|number|bool|int|float|complex
Examples
>>> import saiunit as u >>> a = u.math.array([1.0, 2.0, 3.0]) * u.meter >>> v = u.math.array([0.5, 1.0]) * u.second >>> u.math.convolve(a, v) # unit is meter * second