Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

1D Convolution - always a 0 element #852

Closed
4 tasks
jiegillet opened this issue Aug 31, 2021 · 0 comments · Fixed by #854
Closed
4 tasks

1D Convolution - always a 0 element #852

jiegillet opened this issue Aug 31, 2021 · 0 comments · Fixed by #854
Labels
lang: julia Julia programming language Problem This is a problem in the archive or an implementation.

Comments

@jiegillet
Copy link
Member

This is possibly talked about in #202 but I'm pretty sure the chapter on convolution came after that issue...

Bug Report

Description

There is always a 0 element in the linear convolution.

Steps to Reproduce

The code says

# full convolution, output will be the size of x + y
full_linear_output = convolve_linear(x, y, length(x) + length(y))

for example,

julia> convolve_linear([1,2], [7, 8], 4)
4-element Array{Float64,1}:
  7.0
 22.0
 16.0
  0.0

The last element is always 0 because it corresponds to a situation when the signal and filter functions don't overlap at all.

  1 2  1 2  1 2    1 2
  |    | |    |
8 7    8 7    8 7     8 7
  7    22     16    0

Expected behavior

# full convolution, output will be the size of x + y - 1
full_linear_output = convolve_linear(x, y, length(x) + length(y) - 1)
julia> convolve_linear([1,2], [7, 8], 3)
4-element Array{Float64,1}:
  7.0
 22.0
 16.0

For Algorithm Archive Developers

  • The bug can be reproduced
  • The bug can be fixed (if not, please explain why not in a comment below)
  • There is a timeline to fix the bug
  • The bug has been fixed (Please link the PR)
@jiegillet jiegillet added Problem This is a problem in the archive or an implementation. lang: julia Julia programming language labels Aug 31, 2021
jiegillet added a commit to jiegillet/algorithm-archive that referenced this issue Aug 31, 2021
leios added a commit that referenced this issue Aug 31, 2021
* [#852] [#853] Fix for Julia 1D convolution

* fixing line numbers for jie's PR

Co-authored-by: James Schloss <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
lang: julia Julia programming language Problem This is a problem in the archive or an implementation.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant