00001
00005 #include <bpm/bpm_messages.h>
00006 #include <bpm/bpm_alloc.h>
00007
00008 double **alloc_complex_wave_double( int ns ) {
00009
00010 int i;
00011 static double **w;
00012
00013 w = (double**) calloc( ns, sizeof(double*) );
00014 if ( ! w ) {
00015 bpm_error( "Unable to allocate memory in alloc_complex_wave_double(...)",
00016 __FILE__, __LINE__ );
00017 return NULL;
00018 }
00019
00020 for ( i = 0; i<ns; i++ ) {
00021 w[i] = (double*) calloc( 2, sizeof(double) );
00022 if ( ! w[i] ) {
00023 bpm_error( "Unable to allocate memory in alloc_complex_wave_double(...)",
00024 __FILE__, __LINE__ );
00025 return NULL;
00026 }
00027 }
00028
00029 return w;
00030 }
00031
00032
00033
00034 void free_complex_wave_double( double **w, int ns ) {
00035
00036 int i;
00037
00038 if ( ! w ) return;
00039
00040 for ( i=0; i< ns; i++ ) {
00041 if ( w[i] ) free( w[i] );
00042 }
00043
00044 free( w );
00045 return;
00046 }