Path: news.mathworks.com!newsfeed-00.mathworks.com!nlpi057.nbdc.sbc.com!prodigy.net!news.glorb.com!postnews.google.com!s24g2000vbp.googlegroups.com!not-for-mail
From: ImageAnalyst <imageanalyst@mailinator.com>
Newsgroups: comp.soft-sys.matlab
Subject: Re: conv2 in R2008b very slow
Date: Fri, 26 Dec 2008 06:19:08 -0800 (PST)
Organization: http://groups.google.com
Lines: 86
Message-ID: <64571b05-b09d-4d55-a8b5-a4921d84398e@s24g2000vbp.googlegroups.com>
References: <gie3tb$qen$1@fred.mathworks.com> <3762e938-71a0-46a1-9cd4-3a56fd62fe0f@17g2000vbf.googlegroups.com> 
	<gj2o8i$pul$1@fred.mathworks.com>
NNTP-Posting-Host: 75.186.70.56
Mime-Version: 1.0
Content-Type: text/plain; charset=ISO-8859-1
Content-Transfer-Encoding: quoted-printable
X-Trace: posting.google.com 1230301149 19710 127.0.0.1 (26 Dec 2008 14:19:09 GMT)
X-Complaints-To: groups-abuse@google.com
NNTP-Posting-Date: Fri, 26 Dec 2008 14:19:09 +0000 (UTC)
Complaints-To: groups-abuse@google.com
Injection-Info: s24g2000vbp.googlegroups.com; posting-host=75.186.70.56; 
	posting-account=0rLUzAkAAABojYSRC64DkTbtiSCX77HH
User-Agent: G2/1.0
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET 
	CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.04506.648; .NET CLR 
	3.5.21022),gzip(gfe),gzip(gfe)
Xref: news.mathworks.com comp.soft-sys.matlab:508824


On Dec 26, 9:04=A0am, "Matt" <mjacobson.removet...@xorantech.com> wrote:
> > Andreas:
> > Interesting question. =A0here are my times:
> > % in R2008b: 21.170 seconds.
> > % in R2008a: =A0 0.018 seconds.
>
> Did you check quantitative agreement between the results of each?
> I just can't believe it's possible to do a convolution that size in 0.018=
 sec.
>
> But if so, what kind of machine are you using?

---------------------------------------------------------------------------=
------------
Matt:
I didn't.  I simply copied and pasted and didn't do much analysis or
interpretation of results, other than simply noting the elapsed time
in the command window.  I ran it on a Dell M90 notebook computer with
a Intel Centrino Duo CPU and 4 GB of RAM.  Checking agreement would be
the next step. I could write the array out to a mat file and then read
it back in and subtract.  I haven't done this.  If you want, you can
simply copy and paste this code into test.m (the customgauss from the
fileexchange is included):

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
function test

	clc;
	GaussWidth =3D [23, 180];
	F =3D customgauss([GaussWidth(2), GaussWidth(2)], GaussWidth(1),
GaussWidth(1), 0, 0, 1, [0 0]);
	% customgauss -> see below

	% Array of zeros
	G1 =3D zeros(600, 1000);

	% Set one single point
	G1(300, 400) =3D 1.5;

	% in R2008b: 21.17 seconds.
	% in R2008a: .018 seconds.
	tic; G2 =3D conv2(G1, F, 'same'); toc
	return; % from test()


% CUSTOMGAUSS    Generate a custom 2D gaussian
%
%    gauss =3D customgauss(gsize, sigmax, sigmay, theta, offset, factor,
center)
%
%          gsize     Size of the output 'gauss', should be a 1x2
vector
%          sigmax    Std. dev. in the X direction
%          sigmay    Std. dev. in the Y direction
%          theta     Rotation in degrees
%          offset    Minimum value in output
%          factor    Related to maximum value of output, should be
%                    different from zero
%          center    The center position of the gaussian, should be a
%                    1x2 vector
function ret =3D customgauss(gsize, sigmax, sigmay, theta, offset,
factor, center)
ret     =3D zeros(gsize);
rbegin  =3D -round(gsize(1) / 2);
cbegin  =3D -round(gsize(2) / 2);
for r=3D1:gsize(1)
    for c=3D1:gsize(2)
        ret(r,c) =3D rotgauss(rbegin+r,cbegin+c, theta, sigmax, sigmay,
offset, factor, center);
    end
end


function val =3D rotgauss(x, y, theta, sigmax, sigmay, offset, factor,
center)
xc      =3D center(1);
yc      =3D center(2);
theta   =3D (theta/180)*pi;
xm      =3D (x-xc)*cos(theta) - (y-yc)*sin(theta);
ym      =3D (x-xc)*sin(theta) + (y-yc)*cos(theta);
u       =3D (xm/sigmax)^2 + (ym/sigmay)^2;
val     =3D offset + factor*exp(-u/2);

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
Regards,
ImageAnalyst