Function to find circular convolution
function convolution ( x , h , n , m ) { let row_vec = new Array ( MAX_SIZE ) ; row_vec . fill ( 0 ) ; let col_vec = new Array ( MAX_SIZE ) ; col_vec . fill ( 0 ) ; let out = new Array ( MAX_SIZE ) ; out . fill ( 0 ) ; let circular_shift_mat = new Array ( MAX_SIZE ) ; circular_shift_mat . fill ( 0 ) ; for ( let i = 0 ; i < MAX_SIZE ; i ++ ) { circular_shift_mat [ i ] = new Array ( MAX_SIZE ) ; for ( let j = 0 ; j < MAX_SIZE ; j ++ ) { circular_shift_mat [ i ] [ j ] = 0 ; } }