summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAnthony Blake <anthonix@me.com>2012-11-14 15:43:38 +1300
committerAnthony Blake <anthonix@me.com>2012-11-14 15:43:38 +1300
commitee64c6bf96e4c919c1bb466b46ff0c56d2c01d78 (patch)
tree6d78ac42f89627db6b1414178d68e01d7a899034
parentf45f74e28f6437b1762b2f755af47055c6f6f1bf (diff)
downloadffts-ee64c6bf96e4c919c1bb466b46ff0c56d2c01d78.zip
ffts-ee64c6bf96e4c919c1bb466b46ff0c56d2c01d78.tar.gz
Multi-dimensional saves some planning
-rw-r--r--src/ffts_nd.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/src/ffts_nd.c b/src/ffts_nd.c
index 046a939..c1d4429 100644
--- a/src/ffts_nd.c
+++ b/src/ffts_nd.c
@@ -43,7 +43,14 @@ void ffts_free_nd(ffts_plan_t *p) {
int i;
for(i=0;i<p->rank;i++) {
- ffts_free(p->plans[i]);
+
+ ffts_plan_t *x = p->plans[i];
+ int k;
+ for(k=0;k<i;k++) {
+ if(x == p->plans[k]) x = NULL;
+ }
+
+ ffts_free(x);
}
free(p->plans);
@@ -180,7 +187,15 @@ ffts_plan_t *ffts_init_nd(int rank, size_t *Ns, int sign) {
for(i=0;i<rank;i++) {
p->Ms[i] = vol / p->Ns[i];
- p->plans[i] = ffts_init_1d(p->Ms[i], sign);
+
+ p->plans[i] = NULL;
+ int k;
+ for(k=0;k<i;k++) {
+ if(p->Ms[k] == p->Ms[i])
+ p->plans[i] = p->plans[k];
+ }
+
+ if(!p->plans[i]) p->plans[i] = ffts_init_1d(p->Ms[i], sign);
}
p->transpose_buf = valloc(sizeof(float) * 2 * 8 * 8);
OpenPOWER on IntegriCloud