@@ -53,9 +53,9 @@ 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:27-46, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
56
+ [ import:27-46, lang:"julia"] ( code/julia/1d_convolution.jl )
57
57
{% sample lang="cs" %}
58
- [ import:63-84, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
58
+ [ import:63-84, lang:"csharp"] ( code/csharp/1DConvolution.cs )
59
59
{% endmethod %}
60
60
61
61
The easiest way to reason about this code is to read it as you might read a textbook.
@@ -186,38 +186,38 @@ Here it is again for clarity:
186
186
187
187
{% method %}
188
188
{% sample lang="jl" %}
189
- [ import:27-46, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
189
+ [ import:27-46, lang:"julia"] ( code/julia/1d_convolution.jl )
190
190
{% sample lang="cs" %}
191
- [ import:63-84, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
191
+ [ import:63-84, lang:"csharp"] ( code/csharp/1DConvolution.cs )
192
192
{% endmethod %}
193
193
194
194
Here, the main difference between the bounded and unbounded versions is that the output array size is smaller in the bounded case.
195
195
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:
196
196
197
197
{% method %}
198
198
{% sample lang="jl" %}
199
- [ import:58-59, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
199
+ [ import:58-59, lang:"julia"] ( code/julia/1d_convolution.jl )
200
200
{% sample lang="cs" %}
201
- [ import:96-97, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
201
+ [ import:96-97, lang:"csharp"] ( code/csharp/1DConvolution.cs )
202
202
{% endmethod %}
203
203
204
204
On the other hand, the bounded call would set the output array size to simply be the length of the signal
205
205
206
206
{% method %}
207
207
{% sample lang="jl" %}
208
- [ import:61-62, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
208
+ [ import:61-62, lang:"julia"] ( code/julia/1d_convolution.jl )
209
209
{% sample lang="cs" %}
210
- [ import:98-99, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
210
+ [ import:98-99, lang:"csharp"] ( code/csharp/1DConvolution.cs )
211
211
{% endmethod %}
212
212
213
213
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.
214
214
This can be done by modifying the following line:
215
215
216
216
{% method %}
217
217
{% sample lang="jl" %}
218
- [ import:35-35, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
218
+ [ import:35-35, lang:"julia"] ( code/julia/1d_convolution.jl )
219
219
{% sample lang="cs" %}
220
- [ import:71-71, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
220
+ [ import:71-71, lang:"csharp"] ( code/csharp/1DConvolution.cs )
221
221
{% endmethod %}
222
222
223
223
Here, ` j ` counts from ` i-length(filter) ` to ` i ` .
@@ -249,9 +249,9 @@ In code, this typically amounts to using some form of modulus operation, as show
249
249
250
250
{% method %}
251
251
{% sample lang="jl" %}
252
- [ import:4-25, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
252
+ [ import:4-25, lang:"julia"] ( code/julia/1d_convolution.jl )
253
253
{% sample lang="cs" %}
254
- [ import:38-61, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
254
+ [ import:38-61, lang:"csharp"] ( code/csharp/1DConvolution.cs )
255
255
{% endmethod %}
256
256
257
257
This is essentially the same as before, except for the modulus operations, which allow us to work on a periodic domain.
@@ -266,9 +266,9 @@ For the code associated with this chapter, we have used the convolution to gener
266
266
267
267
{% method %}
268
268
{% sample lang="jl" %}
269
- [ import, lang:"julia"] ( ../ code/julia/1d_convolution.jl)
269
+ [ import, lang:"julia"] ( code/julia/1d_convolution.jl )
270
270
{% sample lang="cs" %}
271
- [ import, lang:"csharp"] ( ../ code/csharp/1DConvolution.cs)
271
+ [ import, lang:"csharp"] ( code/csharp/1DConvolution.cs )
272
272
{% endmethod %}
273
273
274
274
At a test case, we have chosen to use two sawtooth functions, which should produce the following images:
0 commit comments