Prev: real time plot
Next: image adaptor kit
From: LFG Tech on 19 Jul 2010 04:47 Hello Friends, I am writing a code where in there are a lot if-else and for loops. Due to this my code is getting bogged down and increasing my execution time. Another function that is a pain is the improfile function. Is it possible to speed it up? Regards, Vinod.
From: Jan Simon on 19 Jul 2010 05:17 Dear Vinod, > I am writing a code where in there are a lot if-else and for loops. Due to this my code is getting bogged down and increasing my execution time. Another function that is a pain is the improfile function. Is it possible to speed it up? If the loops are slow, did you try to vectorize these parts? Did you consider the usualy method to avoid a slow down: pre-allocation, pre-allocation, pre-allocation, operate on columns instead of rows, use indices in integer format, use C-Mex for bottlenecks, ...? IMPROFILE calls INTERP2, which is not a really fast implementation. There are some interpolation routines in the FEX. My one (CMex, "ScaleTime") performs a 1D-interpolation only, but e.g. it was ridiculous(ly?) 233 times faster than INTERP1 for interpolating 100 points from a [1 x 1e5] vector. Perhaps you post some of the bottlenecks you find using the profiler? Kind regards, Jan
From: LFG Tech on 19 Jul 2010 05:38 "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i2156i$13u$1(a)fred.mathworks.com>... > Dear Vinod, > > > I am writing a code where in there are a lot if-else and for loops. Due to this my code is getting bogged down and increasing my execution time. Another function that is a pain is the improfile function. Is it possible to speed it up? > > If the loops are slow, did you try to vectorize these parts? > Did you consider the usualy method to avoid a slow down: pre-allocation, pre-allocation, pre-allocation, operate on columns instead of rows, use indices in integer format, use C-Mex for bottlenecks, ...? > > IMPROFILE calls INTERP2, which is not a really fast implementation. There are some interpolation routines in the FEX. My one (CMex, "ScaleTime") performs a 1D-interpolation only, but e.g. it was ridiculous(ly?) 233 times faster than INTERP1 for interpolating 100 points from a [1 x 1e5] vector. > > Perhaps you post some of the bottlenecks you find using the profiler? > > Kind regards, Jan Hello Sir, Thank u for ur response. U mentioned that there are "some interpolation routines in the FEX". What do u mean by that ? Cld u shed some light on it pls? Regards, Vinod.
From: us on 19 Jul 2010 06:22 "LFG Tech " <vinodkaruvat(a)gmail.com> wrote in message <i216dt$h9l$1(a)fred.mathworks.com>... > "Jan Simon" <matlab.THIS_YEAR(a)nMINUSsimon.de> wrote in message <i2156i$13u$1(a)fred.mathworks.com>... > > Dear Vinod, > > > > > I am writing a code where in there are a lot if-else and for loops. Due to this my code is getting bogged down and increasing my execution time. Another function that is a pain is the improfile function. Is it possible to speed it up? > > > > If the loops are slow, did you try to vectorize these parts? > > Did you consider the usualy method to avoid a slow down: pre-allocation, pre-allocation, pre-allocation, operate on columns instead of rows, use indices in integer format, use C-Mex for bottlenecks, ...? > > > > IMPROFILE calls INTERP2, which is not a really fast implementation. There are some interpolation routines in the FEX. My one (CMex, "ScaleTime") performs a 1D-interpolation only, but e.g. it was ridiculous(ly?) 233 times faster than INTERP1 for interpolating 100 points from a [1 x 1e5] vector. > > > > Perhaps you post some of the bottlenecks you find using the profiler? > > > > Kind regards, Jan > > > Hello Sir, > > Thank u for ur response. > U mentioned that there are "some interpolation routines in the FEX". What do u mean by that ? Cld u shed some light on it pls? > > Regards, > Vinod. well... the FEX, ie, file exchange service/server, is living here... http://www.mathworks.com/matlabcentral/fileexchange/ js's FEX contribution is available here... http://www.mathworks.com/matlabcentral/fileexchange/25463-scaletime us
From: Jan Simon on 19 Jul 2010 06:50 Dear Vinod, > U mentioned that there are "some interpolation routines in the FEX". What do u mean by that ? Cld u shed some light on it pls? My ScaleTime will not help to solve your problem, because it is 1D only.You could search for "interp2" in: http://www.mathworks.com/matlabcentral/fileexchange/ or simply ask Google e.g. for "Matlab fast interpolation". Kind regards, Jan
|
Pages: 1 Prev: real time plot Next: image adaptor kit |