You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@commons.apache.org by er...@apache.org on 2021/05/26 10:52:56 UTC
[commons-math] branch modularized_master updated: Use "final";
reuse already computed value.
This is an automated email from the ASF dual-hosted git repository.
erans pushed a commit to branch modularized_master
in repository https://gitbox.apache.org/repos/asf/commons-math.git
The following commit(s) were added to refs/heads/modularized_master by this push:
new ed43735 Use "final"; reuse already computed value.
ed43735 is described below
commit ed43735e221467cec99a452474a9df2c56204515
Author: Gilles Sadowski <gi...@gmail.com>
AuthorDate: Wed May 26 12:46:06 2021 +0200
Use "final"; reuse already computed value.
---
.../commons/math4/transform/FastFourierTransform.java | 14 ++++++++------
1 file changed, 8 insertions(+), 6 deletions(-)
diff --git a/commons-math-transform/src/main/java/org/apache/commons/math4/transform/FastFourierTransform.java b/commons-math-transform/src/main/java/org/apache/commons/math4/transform/FastFourierTransform.java
index 6f4d5a9..7877da5 100644
--- a/commons-math-transform/src/main/java/org/apache/commons/math4/transform/FastFourierTransform.java
+++ b/commons-math-transform/src/main/java/org/apache/commons/math4/transform/FastFourierTransform.java
@@ -227,8 +227,8 @@ public class FastFourierTransform implements ComplexTransform {
int lastN0 = 4;
int lastLogN0 = 2;
while (lastN0 < n) {
- int n0 = lastN0 << 1;
- int logN0 = lastLogN0 + 1;
+ final int n0 = lastN0 << 1;
+ final int logN0 = lastLogN0 + 1;
double wSubN0R = W_SUB_N_R[logN0];
double wSubN0I = W_SUB_N_I[logN0];
if (inverse) {
@@ -253,12 +253,14 @@ public class FastFourierTransform implements ComplexTransform {
final double hrR = dataR[destOddStartIndexPlusR];
final double hrI = dataI[destOddStartIndexPlusR];
+ final double a = wSubN0ToRR * hrR - wSubN0ToRI * hrI;
+ final double b = wSubN0ToRR * hrI + wSubN0ToRI * hrR;
// dest[destEvenStartIndex + r] = Gr + WsubN0ToR * Hr
- dataR[destEvenStartIndexPlusR] = grR + wSubN0ToRR * hrR - wSubN0ToRI * hrI;
- dataI[destEvenStartIndexPlusR] = grI + wSubN0ToRR * hrI + wSubN0ToRI * hrR;
+ dataR[destEvenStartIndexPlusR] = grR + a;
+ dataI[destEvenStartIndexPlusR] = grI + b;
// dest[destOddStartIndex + r] = Gr - WsubN0ToR * Hr
- dataR[destOddStartIndexPlusR] = grR - (wSubN0ToRR * hrR - wSubN0ToRI * hrI);
- dataI[destOddStartIndexPlusR] = grI - (wSubN0ToRR * hrI + wSubN0ToRI * hrR);
+ dataR[destOddStartIndexPlusR] = grR - a;
+ dataI[destOddStartIndexPlusR] = grI - b;
// WsubN0ToR *= WsubN0R
final double nextWsubN0ToRR = wSubN0ToRR * wSubN0R - wSubN0ToRI * wSubN0I;