Multiply a matrix for input channels

Good morning! I’m programming a plugin and I’m facing a problem I’m not able to solve…

The thing is that I have 16 input and output channels and a matrix (16x16) with values that change depending on the numbers the user selects, and I want to multiply the matrix for the 16 channels as a “dot multiplication”. My problem is that I don’t know how to manage the input channels in order to perform this calculation.

If somebody could help me out I’d the truly grateful.

Regards!

It’s best to first make a copy of the input channels, so you don’t overwrite your input data when processing the first row. Then you can clear the output buffer, so it’s all zeros, and you simply can add the input channels with the weights the user selects.

Basically a nested loop over all output and input channels, pseudo code:

for all output:
    for all input:
        out += in * matrix(out, in)

You can also take a look a the methods processReplacing and processNonReplacing in my MatrixMultiplicator: https://git.iem.at/audioplugins/IEMPluginSuite/-/blob/master/resources/MatrixMultiplication.h