Azzera filtri
Azzera filtri

How many multiplications in one convolution

5 visualizzazioni (ultimi 30 giorni)
C = [1;2;3]; % i.e. a column vector, hence named "C"
R = [1 2 3]; % i.e. a row vector, "R"
F = [1 4 6 4 1; 4 16 24 16 4; 6 24 36 24 6; 4 16 24 16 4; 1 4 6 4 1];
Let "*" denote the convolution operator.
J = C * R * F
How many multiplications are required for the above convolution to get J?
  2 Commenti
Jonas
Jonas il 4 Mag 2022
are you interested in the 2d convolution of those variables? and if not, how is your convolution defined between a row and a column vector, respectively between a row vector and a matrix?
Rik
Rik il 4 Mag 2022
How exactly is this a Matlab question?

Accedi per commentare.

Risposta accettata

Walter Roberson
Walter Roberson il 4 Mag 2022
Modificato: Walter Roberson il 4 Mag 2022
For a 1D convolution, one step in a convolution involves as many multiplications as min() of the lengths of the two parameters (and then a sum.) The shorter vector is then moved one step to the right and another set of multiplication is done, and then the window is moved again, and so on.
The exact number of steps will depend upon which boundary conditions you are using, "full", "valid" or "same". Also, the exact number of multiplications will depend upon how you implement the boundary conditions: if you are currently positioned so that (say) 3 entries from the shorter vector are "off the edge" then those entries can be thought of as being multiplied by 0... but do you count those multiplications or do you say that the implementation of the convolution is strong enough that it does not perform those multiplications with 0 (even though that is the fasted way to implement) ?
A 2D convolution is similar, but once one row is finished then the convolution moves down and processes the next row; and you have to worry about the boundary conditions for vertical movement as well.

Più risposte (0)

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by