On Wed, Mar 3, 2010 at 10:09 PM, Zsbán Ambrus <[email protected]> wrote:
> Deconvolution, let's see.
...
> The multi-dimensional case is similar and is exercise to the reader.
Let's use the one-dimensional case to get the two-dimensional one.
]a =: 8-?17$~3 6
0 1 6 _6 5 8
6 8 3 6 _3 2
2 4 _8 5 _5 0
]b =: 8-?17$~4 5
_3 1 8 6 0
_7 2 8 1 _3
_8 _7 3 6 8
8 4 _3 8 _2
]c=: +//."2 +//. a */"1"1 2 b
0 _3 _17 32 33 _31 12 94 48 0
_18 _25 7 147 89 _34 46 85 5 _24
_48 _62 32 64 53 _79 _62 _29 99 58
_62 _122 70 _53 72 263 _17 44 57 0
32 42 80 124 64 28 10 _32 _18 _4
16 40 _54 12 32 _107 71 _50 10 0
conv=: +//.@:(*/)
deconv=: 4 :('r=.$0'; 'while. x<:&#y'; 'do. r=.r,t=.y%&{.x';
'y=.}.y-/@:,:t*x'; 'end.'; 'r')
deconv2=: 4 :('r=.i.0 0'; 'while. x<:&#y'; 'do. r=.r,t=.x
deconv&:{.y'; 'y=.}.y-/@:,:t conv"1 x'; 'end.'; 'r')
b deconv2 c
0 1 6 _6 5 8
6 8 3 6 _3 2
2 4 _8 5 _5 0
Now I can truly say that higher dimensions are exercise for the reader.
Ambrus
----------------------------------------------------------------------
For information about J forums see http://www.jsoftware.com/forums.htm