aboutsummaryrefslogtreecommitdiff
path: root/test_pffft.c
diff options
context:
space:
mode:
authorhayati ayguen <h_ayguen@web.de>2020-03-29 08:48:01 +0200
committerhayati ayguen <h_ayguen@web.de>2020-03-29 09:04:27 +0200
commit61ec6dace5e359f707f13b48eb1dd364d0e4bf4c (patch)
treed626cd20c7c2cd799378b1ebe94b2711ceabea78 /test_pffft.c
parent6e6120951fab9a7bbbf9f604bd028ddc01de5729 (diff)
downloadpffft-61ec6dace5e359f707f13b48eb1dd364d0e4bf4c.tar.gz
bugfixes and new helper functions for retrospection and allocation
* bugfix test_pffft.cpp: missing free * bugfix test_pffft.cpp: normalization of inverse() was on wrong index or variable * retrospection - wrapper class with typedef to initial template type - static helpers: isComplexTransform(), isFloatScalar() and isDoubleScalar() * allocation helpers: - member helpers: getSpectrumSize(), getInternalLayoutSize() and allocateOrigin(), allocateSpectrum() and allocateInternalLayout() * test_pffft float/double/cpp: float/double: use/test unordered pffft_transform() for inverse cpp: use/test inverseInternalLayout() when not useOrdered Signed-off-by: hayati ayguen <h_ayguen@web.de>
Diffstat (limited to 'test_pffft.c')
-rw-r--r--test_pffft.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/test_pffft.c b/test_pffft.c
index 64e0ba7..9b52932 100644
--- a/test_pffft.c
+++ b/test_pffft.c
@@ -62,6 +62,7 @@ int test(int N, int cplx, int useOrdered) {
int Nfloat = (cplx ? N*2 : N);
float *X = pffft_aligned_malloc((unsigned)Nfloat * sizeof(float));
float *Y = pffft_aligned_malloc((unsigned)Nfloat * sizeof(float));
+ float *R = pffft_aligned_malloc((unsigned)Nfloat * sizeof(float));
float *Z = pffft_aligned_malloc((unsigned)Nfloat * sizeof(float));
float *W = pffft_aligned_malloc((unsigned)Nfloat * sizeof(float));
int k, j, m, iter, kmaxOther, retError = 0;
@@ -116,8 +117,8 @@ int test(int N, int cplx, int useOrdered) {
pffft_transform_ordered(s, X, Y, W, PFFFT_FORWARD );
else
{
- pffft_transform(s, X, Z, W, PFFFT_FORWARD ); /* temporarily use Z for reordering */
- pffft_zreorder(s, Z, Y, PFFFT_FORWARD );
+ pffft_transform(s, X, R, W, PFFFT_FORWARD ); /* use R for reordering */
+ pffft_zreorder(s, R, Y, PFFFT_FORWARD ); /* reorder into Y[] for power calculations */
}
pwrOther = -1.0;
@@ -176,7 +177,10 @@ int test(int N, int cplx, int useOrdered) {
/* now convert spectrum back */
- pffft_transform_ordered(s, Y, Z, W, PFFFT_BACKWARD);
+ if (useOrdered)
+ pffft_transform_ordered(s, Y, Z, W, PFFFT_BACKWARD);
+ else
+ pffft_transform(s, R, Z, W, PFFFT_BACKWARD);
errSum = 0.0;
for ( j = 0; j < (cplx ? (2*N) : N); ++j )
@@ -202,6 +206,7 @@ int test(int N, int cplx, int useOrdered) {
pffft_aligned_free(X);
pffft_aligned_free(Y);
pffft_aligned_free(Z);
+ pffft_aligned_free(R);
pffft_aligned_free(W);
return retError;