#include "common.h" #include "vector.h" /*************************************************************** FUNCTION: split_odd_even This rearranges an array. The elements that were initially even numbered are packed in bottom half, and the initially odd elements are moved to the top half (the end). This serves to convert a complex array as used by Numerical Recipes routines into separate real and imaginary arrays, suitable for passing into Matlab as a complex array. ***************************************************************/ void split_odd_even(float *a, int n) { float *re, *im; int i, nh; nh = n/2; if (nh*2 != n) { printf("\nERROR in split_odd_even: n = %d is odd.\n", n); exit(-1); } re = (float *) calloc(nh, sizeof(float)); im = (float *) calloc(nh, sizeof(float)); if (re == NULL || im == NULL) { printf("\nERROR in split_odd_even: out of memory.\n"); exit(-1); } for (i=0; i