Prev: Running matlab from xterm from a cronjob? (Matlab-xterm-cronjob);
Next: angle between two vectors
From: David Romero-Antequera on 6 Aug 2010 14:40 Hello, there. I have a code where the slowest part is to compute hundreds of time something like exp(1i*t*D), where t is an scalar and D is, in general, complex and best case scenario, real and bounded. Given that within my code, t will change randomly but monotonically (actually, this is a function integrated with the ODE solvers), is there a way to improve speed computing exp(1i*t1*D) based on exp(1i*t*D)? It is important to get clear that abs(t-t1) is an small number (is the integration step, as a matter of fact) and it is NOT a fixed quantity. BTW: I've tried an adaptive Taylor series approximation, selecting the number of terms needed to attain some accuracy goal. This is not, by any means, faster, unless some serious accuracy is loss. Thank you!
From: Matt Fig on 6 Aug 2010 15:14 Just throwing it out there: Could you initially compute the function for a suitable range of t values, appropriately gridded, then use interpolation?
From: Walter Roberson on 6 Aug 2010 15:21 David Romero-Antequera wrote: > Hello, there. > > I have a code where the slowest part is to compute hundreds of time > something like exp(1i*t*D), where t is an scalar and D is, in general, > complex and best case scenario, real and bounded. Given that within my > code, t will change randomly but monotonically (actually, this is a > function integrated with the ODE solvers), is there a way to improve > speed computing exp(1i*t1*D) based on exp(1i*t*D)? It is important to > get clear that abs(t-t1) is an small number (is the integration step, as > a matter of fact) and it is NOT a fixed quantity. > > BTW: I've tried an adaptive Taylor series approximation, selecting the > number of terms needed to attain some accuracy goal. This is not, by any > means, faster, unless some serious accuracy is loss. What is (t-t1)*D ? If the absolute value of that quantity is significantly less than 1, then a series expansion of the ratio exp(1i*(t+t0)*D) / exp(1i*t*D) effectively vanishes after a very reasonable number of terms; as the quantity approaches 1 then more terms are needed, and when the quantity exceeds 1 then the terms of the series balloon. Do you have control of the maximum step increment after D is known? If so then you could deliberately arrange for the series terms for the ratio to become negligible with a relatively small polynomial.
From: David Romero-Antequera on 6 Aug 2010 15:30 "Matt Fig" <spamanon(a)yahoo.com> wrote in message <i3hmts$t19$1(a)fred.mathworks.com>... > Just throwing it out there: Could you initially compute the function for a suitable range of t values, appropriately gridded, then use interpolation? I have tried this. It is slower than computing the exponential itself.
|
Pages: 1 Prev: Running matlab from xterm from a cronjob? (Matlab-xterm-cronjob); Next: angle between two vectors |