what would be a good way to implement a 1D convolution filter over laravel's collections? meaning, take one iterated element, N neighbor elements and do a weighted average, weights defined in a a convolution matrix
it's not hard to imagine how to do it iteratively via a for
loop, making use of an index
but is there a cleaner way, using collection's funcitonal approach via map/filter/something like that? i seem to have trouble accessing other element than the current iterated one