Is there a faster complex exponent?
7 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
Daniel Dolan
le 15 Déc 2023
Réponse apportée : Daniel Dolan
le 18 Déc 2023
Is there any way to more quickly evaluate complex exponentials, i.e:
where Q is a real array? Quick numerical tests show that complex input noticeably slows down MATLAB's exp function.
Several thoughts:
- Some libraries, such as Julia Base, provide a cis/cisoid function that directly evaluates the Euler expansion.
- The GNU C library has sincos function that simultaneously evaluate sine and cosine more quickly than separate calls.
- The Fixed Point Designer has a cordicexp function that seems to be identical to cis, but I don't have this toolbox. No idea how this performs compared to the standard exp function.
11 commentaires
Paul
le 15 Déc 2023
Modifié(e) : Paul
le 16 Déc 2023
FWIW, Simulink offers a sincos and cos + jsin functions (Trigonometric Function), with options for how those functions are computed (Algorithm - Approximation Method). Don't know if the "under the hood" Simulink implementation would offer any performance benefits if brought into Matlab proper.
Bruno Luong
le 15 Déc 2023
But again I'm not convice MATLAB is NOT already do specific acceleration for exp(1i*Q). It is faster than cos alone on my PC and Walter PC as well
Réponse acceptée
Plus de réponses (1)
Sulaymon Eshkabilov
le 15 Déc 2023
Let's compare two ways e.g.:
Q = linspace(-10, 10, 1e6);
tic;
CQ1 = exp(1i*Q);
T1 =toc
tic;
CQ2 = cos(Q)+1i*sin(Q);
T2 =toc
fprintf('Calc time of exp(1i*Q): %f; cos(Q)+i*sin(Q): %f; \n', [T1, T2])
Voir également
Catégories
En savoir plus sur Symbolic Math Toolbox dans Help Center et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!