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

Deconv not implemented for arrays #572

Open
orswan opened this issue Oct 21, 2024 · 2 comments
Open

Deconv not implemented for arrays #572

orswan opened this issue Oct 21, 2024 · 2 comments

Comments

@orswan
Copy link

orswan commented Oct 21, 2024

conv happily accepts 2d arrays:

> M = conv(ones(2,2),ones(2,2))
3×3 Matrix{Float64}:
 1.0  2.0  1.0
 2.0  4.0  2.0
 1.0  2.0  1.0

However, the analogous operation for deconv throws an error:

> deconv(M,ones(2,2))

MethodError: no method matching deconv(::Matrix{Float64}, ::Matrix{Float64})
...

Would it be possible to implement deconv for arrays?

@martinholters
Copy link
Member

Can you specify what it should do, exactly? The vector-deconv does polynomial division:

DSP.jl/src/dspbase.jl

Lines 157 to 160 in 4ff6208

deconv(b,a) -> c
Construct vector `c` such that `b = conv(a,c) + r`.
Equivalent to polynomial division.

That is quite brief, but means that c has length N=length(b)-length(a)+1 and the first N entries of r (if one computes it) are zero (up to rounding errors). I'm not sure how this generalizes to matrices. If a is separable, one could separate the deconvolution into a row-wise and a column-wise step, but for general a, I don't know.

That said, a deconvolution in the MMSE sense (i.e. find c such that sum(abs2, b - conv(a,c)) is minimized) might be useful and would also have a more obvious generalization to matrices, but it's not deconv.

@mbaz
Copy link
Contributor

mbaz commented Dec 18, 2024

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants