forked from FFTW/fftw3
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathallocate.c
41 lines (34 loc) · 935 Bytes
/
allocate.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/* not worth copyrighting */
/* $Id: allocate.c,v 1.3 2003-01-15 02:10:25 athena Exp $ */
#include "config.h"
#include "bench.h"
/*
* Allocate I/O arrays for a problem.
*
* This is the default routine that can be overridden by the user in
* complicated cases.
*/
void problem_alloc(struct problem *p)
{
if (p->kind == PROBLEM_COMPLEX) {
size_t s = p->size * p->vsize;
p->phys_size = s;
p->in = bench_malloc(s * sizeof(bench_complex));
if (p->in_place)
p->out = p->in;
else
p->out = bench_malloc(s * sizeof(bench_complex));
} else {
size_t s = p->vsize;
int i;
for (i = 0; i < p->rank; ++i)
/* slightly overallocate to account for unpacked formats */
s *= p->n[i] + 2;
p->phys_size = s;
p->in = bench_malloc(s * sizeof(bench_real));
if (p->in_place)
p->out = p->in;
else
p->out = bench_malloc(s * sizeof(bench_real));
}
}