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
I would look at Laravel's built-in collection methods to iterate over your collection (for loop way). https://laravel.com/docs/5.4/collections#method-each I don't think there are any matrix like operations to create a 1D filter.