[3deeb5]: src / dgt_multi.c  Maximize  Restore  History

Download this file

142 lines (106 with data), 3.3 kB

  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
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
#include "config.h"
#include "ltfat.h"
#include "ltfat_types.h"
LTFAT_EXTERN void
LTFAT_NAME(nonsepwin2multi)(const LTFAT_COMPLEX *g,
const int L, const int Lg, const int a, const int M,
const int lt1, const int lt2,
LTFAT_COMPLEX *mwin)
{
const int b=L/M;
const LTFAT_REAL scal = 2*PI/L;
LTFAT_COMPLEX *gwork = (LTFAT_COMPLEX *)ltfat_malloc(L*sizeof(LTFAT_COMPLEX));
LTFAT_NAME(fir2long_c)((const LTFAT_COMPLEX*)g,Lg,L,(LTFAT_COMPLEX*)gwork);
for (int w=0;w<lt2;w++)
{
const int wavenum=((w*lt1)%lt2)*b/lt2;
for (int l=0;l<L;l++)
{
mwin[l+w*L]=cexp(I*scal*l*wavenum)*gwork[positiverem(l-w*a,L)];
}
}
ltfat_free(gwork);
}
LTFAT_EXTERN LTFAT_NAME(dgt_multi_plan)
LTFAT_NAME(dgt_multi_init)(const LTFAT_COMPLEX *f, const LTFAT_COMPLEX *g,
const int L, const int Lg, const int W, const int a, const int M,
const int lt1, const int lt2,
LTFAT_COMPLEX *cout,unsigned flags)
{
LTFAT_NAME(dgt_multi_plan) plan;
plan.a=a;
plan.M=M;
plan.L=L;
plan.Lg=Lg;
plan.W=W;
plan.lt1=lt1;
plan.lt2=lt2;
plan.f = (LTFAT_COMPLEX *)f;
plan.cout = cout;
const int N = L/a;
const int Ns = N/lt2;
plan.mwin = (LTFAT_COMPLEX *)ltfat_malloc(L*lt2*sizeof(LTFAT_COMPLEX));
plan.c_scratch = (LTFAT_COMPLEX *)ltfat_malloc(M*Ns*W*sizeof(LTFAT_COMPLEX));
LTFAT_NAME(nonsepwin2multi)(g,L,Lg,a,M,lt1,lt2,plan.mwin);
plan.rect_plan_array = (LTFAT_NAME(dgt_long_plan)*) ltfat_malloc(lt2*sizeof(LTFAT_NAME(dgt_long_plan)));
for (int win=0;win<lt2;win++)
{
plan.rect_plan_array[win]=LTFAT_NAME(dgt_long_init)((const LTFAT_COMPLEX*)plan.f,(const LTFAT_COMPLEX*)(plan.mwin+L*win),L,W,a*lt2,M,
(LTFAT_COMPLEX*)plan.c_scratch,flags);
}
plan.mod = (LTFAT_COMPLEX*) ltfat_malloc(N*sizeof(LTFAT_COMPLEX));
for (int win=0;win<plan.lt2;win++)
{
for (int n=0;n<Ns;n++)
{
plan.mod[win+n*lt2] = cexp(-2*PI*I*(a*n*((win*lt1)%lt2))/M);
}
}
return plan;
}
LTFAT_EXTERN void
LTFAT_NAME(dgt_multi_execute)(const LTFAT_NAME(dgt_multi_plan) plan)
{
const int N = plan.L/plan.a;
const int Ns = N/plan.lt2;
const int M=plan.M;
const int W=plan.W;
const int lt2=plan.lt2;
for (int win=0;win<plan.lt2;win++)
{
LTFAT_NAME(dgt_long_execute)(plan.rect_plan_array[win]);
for (int w=0;w<W;w++)
{
for (int n=0;n<Ns;n++)
{
for (int m=0;m<M;m++)
{
plan.cout[m+win*M+n*lt2*M+w*M*N] = plan.mod[win+n*lt2]*plan.c_scratch[m+n*M+w*M*Ns];
}
}
}
}
}
LTFAT_EXTERN void
LTFAT_NAME(dgt_multi_done)(LTFAT_NAME(dgt_multi_plan) plan)
{
ltfat_free(plan.mod);
for (int ii=0;ii<plan.lt2;ii++)
{
LTFAT_NAME(dgt_long_done)(plan.rect_plan_array[ii]);
}
ltfat_free(plan.rect_plan_array);
ltfat_free(plan.c_scratch);
ltfat_free(plan.mwin);
}
LTFAT_EXTERN void
LTFAT_NAME(dgt_multi)(const LTFAT_COMPLEX *f, const LTFAT_COMPLEX *g,
const int L, const int Lg, const int W, const int a, const int M,
const int lt1, const int lt2,
LTFAT_COMPLEX *cout)
{
LTFAT_NAME(dgt_multi_plan) plan = LTFAT_NAME(dgt_multi_init)(
f,g,L,Lg,W,a,M,lt1,lt2,cout,FFTW_ESTIMATE);
LTFAT_NAME(dgt_multi_execute)(plan);
LTFAT_NAME(dgt_multi_done)(plan);
}

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:

JavaScript is required for this form.





No, thanks