![]() |
Blitz Support : |
From: Dalal, Navneet (navneet.dalal_at_[hidden])
Date: 2003-06-19 11:17:37
Hi Todd,
Thanks Todd, I have already implemented Convolution functions (both for 1D
and 2D arrays, cyclic and acyclic behavior at boundaries, exact and extended
boundary conditions). Once, I have tested it properly and documented it, I
would send it to you. One thing that I could not understand, why would it be
poor way to implement 2D seperable convolution as 1D convolution of two
arrays?
Actually, since last 2-3 years, I was working in Java and the main reason
for my recent switch to C++ was templates.
So, I was looking for some ease of implementation also. In java, it was
really painful to write same code for each basic data type(int, double,
etc). Well you are right that probably I should use FFTs for efficiency.
One more thing: Binary operations (+ - / *) are missing in TinyVector class
in Blitz-0.6. Whereas, documentation/manual says these operations are
defined.
thanks
navneet
-----Original Message-----
From: Todd Veldhuizen [mailto:tveldhui_at_[hidden]]
Sent: Thursday, June 19, 2003 11:49 AM
To: Dalal, Navneet
Subject: Re: [Blitz-support] Convolution along 2 dimensions
Hi Navneet,
There is a method convolve(Array<T,1> x, Array<T,1> y) that computes the
1-D convolution of two arrays. This would be a fairly poor way of
implementing a 2D separable convolution though :(. Although it
would be fairly easy to provide another version of convolve that
allows you to provide a destination array for the result.. then
you could avoid temporaries by allocating a 2D array for the result,
and doing a loop over the rows/columns with a convolve for each.
Do you want cyclic or acyclic boundaries? If acyclic, do you want the
result truncated to the size of the original 2D array? How big is the 1D
gaussian compared to the 2D array size? One possibility is to use an FFT
package.. if your 1D signal is of size n, and your 2D array is of size m,
then if n >> log(m) you're probably better of with FFTs is my guess
(depending on whether you're looking at ease of implementation vs.
efficiency).
Cheers,
Todd
-- Todd Veldhuizen / tveldhui_at_[hidden] / Indiana University Computer Science On Wed, 18 Jun 2003, Dalal, Navneet wrote: > Hi everybody, > > I am new to Blitz++ and am stuck with one problem. > > I want to convolve a 2D signal with a 1D signal, let us say first along > x-axis and then along y-axis. > The reason is my 1D signal is separable (it is Gaussian). So this operation > will be much faster. > > Now I have two questions: > > 1. How can I do these operations in blitz using stencils, expression > templates, etc? > > 2. Ideally one would like to use 1D convolution signal to convolve first > along x-axis and then convolve new signal along y-axis. Can I avoid > temporaries? > > thanks > navneet > _______________________________________________ > Blitz-support mailing list > Blitz-support_at_[hidden] > http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support > _______________________________________________ Blitz-support mailing list Blitz-support_at_[hidden] http://www.oonumerics.org/mailman/listinfo.cgi/blitz-support