


import doctest
from collections import deque

import numpy as np







class 			_lowercase :


       """simple docstring"""




       def __init__(   self							:			Union[str, Any]       ):


             '''simple docstring'''



             lowerCamelCase__		:				Union[str, Any]    =  [2, 1, 2, -1]
             lowerCamelCase__		:				Tuple    =  [1, 2, 3, 4]





       def 						lowerCAmelCase     (   self							:			Optional[int]       ):


             '''simple docstring'''



             lowerCamelCase__		:				Union[str, Any]    =  len(self.first_signal       )
             lowerCamelCase__		:				Any    =  len(self.second_signal       )

             lowerCamelCase__		:				List[Any]    =  max(__lowerCamelCase					,      __lowerCamelCase       )

             # create a zero matrix of max_length x max_length
             lowerCamelCase__		:				str    =  [[0] * max_length for i in range(__lowerCamelCase       )]

             # fills the smaller signal with zeros to make both signals of same length
             if length_first_signal < length_second_signal:
                   self.first_signal += [0] * (max_length - length_first_signal)
             elif length_first_signal > length_second_signal:
                   self.second_signal += [0] * (max_length - length_second_signal)
             for i in range(__lowerCamelCase       ):
                   lowerCamelCase__		:				int    =  deque(self.second_signal       )
                   rotated_signal.rotate(__lowerCamelCase       )
                   for j, item in enumerate(__lowerCamelCase       ):
                         matrix[i][j] += item

        # multiply the matrix with the first signal
             lowerCamelCase__		:				Union[str, Any]    =  np.matmul(np.transpose(__lowerCamelCase       )					,      np.transpose(self.first_signal       )       )

             # rounding-off to two decimal places
             return [round(__lowerCamelCase					,      2       ) for i in final_signal]


if __name__ == "__main__":
    doctest.testmod()






class 			_lowercase :


       """simple docstring"""




       def __init__(   self							:			Any					,      __lowerCamelCase							:			int       ):


             '''simple docstring'''



             lowerCamelCase__		:				List[str]    =  n
             lowerCamelCase__		:				Union[str, Any]    =  [None] * self.n
             lowerCamelCase__		:				List[str]    =  0  # index of the first element
             lowerCamelCase__		:				Any    =  0
             lowerCamelCase__		:				Any    =  0





       def __len__(   self							:			Tuple       ):


             '''simple docstring'''



             return self.size





       def 						lowerCAmelCase     (   self							:			Optional[int]       ):


             '''simple docstring'''



             return self.size == 0





       def 						lowerCAmelCase     (   self							:			Union[str, Any]       ):


             '''simple docstring'''



             return False if self.is_empty() else self.array[self.front]





       def 						lowerCAmelCase     (   self							:			str					,      __lowerCamelCase							:			List[str]       ):


             '''simple docstring'''



             if self.size >= self.n:
                   raise Exception("QUEUE IS FULL"       )

             lowerCamelCase__		:				Optional[Any]    =  data
             lowerCamelCase__		:				Tuple    =  (self.rear + 1) % self.n
             self.size += 1
             return self





       def 						lowerCAmelCase     (   self							:			Tuple       ):


             '''simple docstring'''



             if self.size == 0:
                   raise Exception("UNDERFLOW"       )

             lowerCamelCase__		:				Any    =  self.array[self.front]
             lowerCamelCase__		:				List[Any]    =  None
             lowerCamelCase__		:				str    =  (self.front + 1) % self.n
             self.size -= 1
             return temp


