⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 test_fft.c

📁 This a framework to test new ideas in transmission technology. Actual development is a LDPC-coder in
💻 C
字号:
/***************************************************************************              test_fft.c  -  Module for testing the fft-routines                            -------------------    begin                :  2004    authors              :  Linus Gasser    emails               :  linus.gasser@epfl.ch ***************************************************************************//***************************************************************************                                 Changes                                 ------- date - name - description 04/01/28 - ineiti - begin  **************************************************************************//*************************************************************************** *                                                                         * *   This program is free software; you can redistribute it and/or modify  * *   it under the terms of the GNU General Public License as published by  * *   the Free Software Foundation; either version 2 of the License, or     * *   (at your option) any later version.                                   * *                                                                         * ***************************************************************************/char desc[] ="Description:\n""Tests the internal (non-optimized) fft-functions. The signal\n""is composed of two peaks (the fft of a sin), and is then\n""fft'ed, which should give a sine, and then ifft'ed, which\n""should give again the original signal.\n\n";#include <complex.h>#include <math.h>#include "spc.h"#include "std.h"#define DBG_LVL 4void print_complex( char *str, complex double *v, int len ){  int i;    PR( str );  for ( i=0; i<len; i++ ){    double re = ((int)( creal( v[i] ) * 10 )) / 10.;    double im = ((int)( cimag( v[i] ) * 10 )) / 10.;    PR_CL( "\n%-4g + %gi", re, im );  }  PR_CL( "\n" );}#define FFT_LEN 8void *start_it( void *arg ) {  complex double x[FFT_LEN] = { 0, 1, 0, 0,  0, 0, 1, 0 };  print_complex( "This signal ", x, FFT_LEN );  swr_fft_complex( x, logb( FFT_LEN ), SWR_FFT );  print_complex( "Has this FFT ", x, FFT_LEN );  swr_fft_complex( x, logb( FFT_LEN ), SWR_IFFT );  print_complex( "And should be identical with ", x, FFT_LEN );    return 0;}swr_spc_id_t spm_id;struct thread start;/** * This function is called upon "insmod" and is used to register the * different parts of the module to the SPM. */int um_module_init(void) {  PR_CL( desc );  if ( swr_thread_init( &start, start_it, NULL ) < 0 )    goto first_no_stack;  return 0;first_no_stack:  PR_DBG( 0, "Couldn't allocate stack\n" );  return -1;}void um_module_exit( void ) {  swr_thread_free( &start, NULL );}module_init( um_module_init );module_exit( um_module_exit );

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -