@@ -53,7 +53,7 @@ With this in mind, we can almost directly transcribe the discrete equation into
53
53
54
54
{% method %}
55
55
{% sample lang="jl" %}
56
- [ import:29-48 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
56
+ [ import:27-46 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
57
57
{% endmethod %}
58
58
59
59
The easiest way to reason about this code is to read it as you might read a textbook.
@@ -184,30 +184,30 @@ Here it is again for clarity:
184
184
185
185
{% method %}
186
186
{% sample lang="jl" %}
187
- [ import:29-48 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
187
+ [ import:27-46 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
188
188
{% endmethod %}
189
189
190
190
Here, the main difference between the bounded and unbounded versions is that the output array size is smaller in the bounded case.
191
191
For an unbounded convolution, the function would be called with a the output array size specified to be the size of both signals put together:
192
192
193
193
{% method %}
194
194
{% sample lang="jl" %}
195
- [ import:60-61 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
195
+ [ import:58-59 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
196
196
{% endmethod %}
197
197
198
198
On the other hand, the bounded call would set the output array size to simply be the length of the signal
199
199
200
200
{% method %}
201
201
{% sample lang="jl" %}
202
- [ import:63-64 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
202
+ [ import:61-62 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
203
203
{% endmethod %}
204
204
205
205
Finally, as we mentioned before, it is possible to center bounded convolutions by changing the location where we calculate the each point along the filter.
206
206
This can be done by modifying the following line:
207
207
208
208
{% method %}
209
209
{% sample lang="jl" %}
210
- [ import:37-37 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
210
+ [ import:35-35 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
211
211
{% endmethod %}
212
212
213
213
Here, ` j ` counts from ` i-length(filter) ` to ` i ` .
@@ -239,7 +239,7 @@ In code, this typically amounts to using some form of modulus operation, as show
239
239
240
240
{% method %}
241
241
{% sample lang="jl" %}
242
- [ import:4-27 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
242
+ [ import:4-25 , lang:"julia"] ( ../code/julia/1d_convolution.jl )
243
243
{% endmethod %}
244
244
245
245
This is essentially the same as before, except for the modulus operations, which allow us to work on a periodic domain.
0 commit comments