Hi all,
I'm trying to implement a multidimensional convolution defined like this in
2d:
"We initialize to zero a matrix c and add to it, starting at the (i,j)th
position, submatrices b[i, j] * a[:, :] padded with zeros."
I have this function:
stagedfunction convn{T,N}(A::Array{T,N}, B::Array{T,N})
quote
retsize = [size(A)...] + [size(B)...]
retsize = tuple(retsize...)
ret = zeros(T, retsize)
@nloops $N i A begin
@nloops $N j B begin
(@nref $N ret k->(i_d + j_d)) = (@nref A i) * (@nref B j)
end
end
return ret
end
end
but I'm getting a cryptic ERROR: wrong number of arguments message to this
input
A = randn(5, 5)
convn(A, A)
Any help is appreciated. Thanks,
Derek