module: sqrt_raised_cosine_filter
parameters: double rolloff_factor, double symbol_period, int num_filt_taps
inputs: double in
outputs: double out
classes: Filter filt("1","1"), List list1()
static_variables:
init:
if (rolloff_factor < 0.0 || rolloff_factor > 1.0)
   {
    printf("error in 'sqrt_raised_cosine_filter'\n");
    printf("  parameter 'rolloff_factor' must be between 0 and 1!\n");
    printf("  in this case, rolloff_factor = %5.3e\n",rolloff_factor);
    exit(1);
   }
if (symbol_period <= 1.0e-15)
   {
    printf("error in 'sqrt_raised_cosine_filter'\n");
    printf("  parameter 'symbol_period' must be > 0.0!\n");
    printf("  in this case, symbol_period = %5.3e\n",symbol_period);
   }
if (num_filt_taps < 1)
   {
    printf("error in 'sqrt_raised_cosine_filter'\n");
    printf("  parameter 'num_filt_taps' must be > 0!\n");
    printf("  in this case, num_filt_taps = %d\n",num_filt_taps);
   }
if ((num_filt_taps % 2) != 1)
   {
    printf("error in 'sqrt_raised_cosine_filter'\n");
    printf("  parameter 'num_filt_taps' must be odd!\n");
    printf("  in this case, num_filt_taps = %d\n",num_filt_taps);
   }
int half_filter_length,i;
double time_step, num1, num2, den, tval, area;
time_step = Ts/symbol_period;
half_filter_length = (num_filt_taps - 1)/2;
for (i = -half_filter_length;i <= half_filter_length; i++)
   {
   tval = ((double) i)*time_step;
   num1 = cos((1.0+rolloff_factor)*pi*tval);
   if (i == 0)
      num2 = (1.0-rolloff_factor)*pi/(4.0*rolloff_factor);
   else
      num2 = sin((1.0-rolloff_factor)*pi*tval)/(4*rolloff_factor*tval);
   den = 1.0 - (4.0*rolloff_factor*tval)*(4.0*rolloff_factor*tval);
   if (fabs(den) < 1.0e-15)
      {
       printf("error in 'sqrt_raised_cosine_filter':\n");
       printf(" -> denominator of filter tap calculation is zero! ??\n");
       exit(1);
      }
   list1.inp((num1+num2)/den);
   }
area = 0.0;
list1.reset();
while (list1.notdone)
    area += list1.read();
if (fabs(area) < 1.0e-15)
   { 
    printf("error in 'sqrt_raised_cosine_filter':\n");
    printf("  -> area of computed impulse response is zero! ??\n");
    exit(1);
   }
list1.mul(1.0/area);
filt.set(list1,"1");
code:
filt.inp(in);
out=filt.out;
