Need help to implement my function

I need a kernel for filtering my 2D data array. My Kernel has the following input parameter:

    [*]1. parameter is a 2D data array[*]2. parameter is a 2D filter array[*]3. parameter is a 1D filter_identifier array

My filter array consists of different filter. With a selected filter each row of the 2D data array is filtered. The appropriate filter is selected via the filter array identifier.

Here is an example.

My 2D data array consists of 512 lines. Each line consists of 1024 values​​. My filter array consists of 10 different filters. Each filter consists of 1024 filter coefficients. The 1D filter iendtifier array consists of 512 elements, because the row data array consists of 512. If the first identifier value in the filter array is a 5, then should the fifth filter for the first row are used. The filter function multiplies the first value of the first row with the first value of the filter. All filter values ​​are multiplied point by point with each line.

Can somebody help me with the kernel code please