Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
17
Task/Deconvolution-1D/R/deconvolution-1d-1.r
Normal file
17
Task/Deconvolution-1D/R/deconvolution-1d-1.r
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
conv <- function(a, b) {
|
||||
p <- length(a)
|
||||
q <- length(b)
|
||||
n <- p + q - 1
|
||||
r <- nextn(n, f=2)
|
||||
y <- fft(fft(c(a, rep(0, r-p))) * fft(c(b, rep(0, r-q))), inverse=TRUE)/r
|
||||
y[1:n]
|
||||
}
|
||||
|
||||
deconv <- function(a, b) {
|
||||
p <- length(a)
|
||||
q <- length(b)
|
||||
n <- p - q + 1
|
||||
r <- nextn(max(p, q), f=2)
|
||||
y <- fft(fft(c(a, rep(0, r-p))) / fft(c(b, rep(0, r-q))), inverse=TRUE)/r
|
||||
return(y[1:n])
|
||||
}
|
||||
7
Task/Deconvolution-1D/R/deconvolution-1d-2.r
Normal file
7
Task/Deconvolution-1D/R/deconvolution-1d-2.r
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
h <- c(-8,-9,-3,-1,-6,7)
|
||||
f <- c(-3,-6,-1,8,-6,3,-1,-9,-9,3,-2,5,2,-2,-7,-1)
|
||||
g <- c(24,75,71,-34,3,22,-45,23,245,25,52,25,-67,-96,96,31,55,36,29,-43,-7)
|
||||
|
||||
max(abs(conv(f,h) - g))
|
||||
max(abs(deconv(g,f) - h))
|
||||
max(abs(deconv(g,h) - f))
|
||||
1
Task/Deconvolution-1D/R/deconvolution-1d-3.r
Normal file
1
Task/Deconvolution-1D/R/deconvolution-1d-3.r
Normal file
|
|
@ -0,0 +1 @@
|
|||
conv(a, b) == convolve(a, rev(b), type="open")
|
||||
Loading…
Add table
Add a link
Reference in a new issue