module: vec3_filter_array
description: 
timing_sensitivity: 
parameters:  int num_sig
inputs:  Vector in_vec
outputs:  Vector out_vec
set_output_vector_lengths: out_vec=num_sig
classes:  Matrix param_matrix()
static_variables:  Filter *filt_array
init:
int i,num_filt_params, num_mat_rows, num_mat_cols;
double k, alpha, wo_2;

num_filt_params = 3;

if (num_sig < 1)
   {
    printf("error in 'vec3_filter_array':  num_sig must be >= 1\n");
    printf("   -> in this case, num_sig = %d\n", num_sig);
    exit(1);
   }  
if (in_vec.get_length() != num_sig)
   {
    printf("error in 'vec3_filter_array':  in_vec must have length = num_sig\n");
    printf("   -> in this case, in_vec has length %d\n", in_vec.get_length());
    printf("      num_sig = %d\n", num_sig);
    exit(1);
   }
param_matrix.load("vec3_filter_array_params.dat");
num_mat_rows = param_matrix.get_rows();
num_mat_cols = param_matrix.get_cols();
if (num_mat_rows != num_sig)
  {
   printf("error in 'vec3_filter_array':  file 'vec3_filter_array_params.dat'\n");
   printf("   must have number of rows = num_sig\n");
   printf("   -> in this case, number of rows = %d\n", num_mat_rows);
   printf("      num_sig = %d\n", num_sig);
   exit(1);
  }
if (num_mat_cols != num_filt_params)
  {
   printf("error in 'vec3_filter_array':  file 'vec3_filter_array_params.dat'\n");
   printf("   must have number of cols = %d\n", num_filt_params);
   printf("   -> in this case, number of cols = %d\n", num_mat_cols);
   exit(1);
  }

filt_array = new Filter[num_sig];

for (i = 0; i < num_mat_rows; i++)
  {
   k = param_matrix.get_elem(i,0);
   alpha = param_matrix.get_elem(i,1);
   wo_2 = param_matrix.get_elem(i,2);
   filt_array[i].set("K*wo_2","s^2 + 2*alpha*s + wo_2","K,alpha,wo_2,Ts",k,alpha,wo_2,Ts);
  }

end:  
delete [] filt_array;

code:  
int i;

for (i = 0; i < num_sig; i++)
   {
   filt_array[i].inp(in_vec.get_elem(i));
   out_vec.set_elem(i,filt_array[i].out);
   }
