📄 wal_test.c
字号:
/*
Demonstration of Walsh function generation, fast and slow Walsh transforms
(c)Max
*/
#include <stdio.h>
#include "fwt.h"
#include "wt.h"
#include "walsh.h"
#define WALSH_NUMBER 5 // generate this function
#define POINTS 64 // number of points
void PrintData(int *x,int n)
{
int i;
for(i=0;i<n;i++)
{
if(!(i&0x07)) printf("\n");
printf(" %d,",x[i]);
}
}
void main(void)
{
int i;
double dQ;
int x[POINTS],y[POINTS];
dQ=1.0/((double)POINTS);
// Generate Walsh function
for(i=0;i<POINTS;i++) x[i]=2*walsh(WALSH_NUMBER,dQ*i) - 1;
printf("\n\n -- Input array --- ");
PrintData(x,POINTS);
// Slow Walsh Transform
WT(x,y,POINTS);
printf("\n\n -- Slow Walsh Transform --- ");
PrintData(y,POINTS);
// Fast Walsh Transform
FWT(x,POINTS);
printf("\n\n -- Fast Walsh Transform --- ");
PrintData(x,POINTS);
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -