module: mimo_filter_2by2
description: 
parameters:  
inputs:  Vector in_vec
outputs:  Vector out_vec
set_output_vector_lengths: out_vec=2
classes:  
static_variables:  Filter *mimo_filt, int rows, int cols
init:
int i,j;
  
//        col0        col1
//  row0  in0->out0   in0->out1
//  row1  in1->out0   in1->out1

rows = 2;
cols = 2;
if (in_vec.get_length() != 2)
  {
   printf("error in 'vec_2elem_to_scalar':  in_vec must have length 2\n");
   printf("  -> in this case, in_vec has length %d\n",in_vec.get_length());
   exit(1);
  }
mimo_filt = new Filter [rows*cols];

// in this example, simple set all filter entries to a simple RC lowpass

for (i = 0; i < rows; i++)
   {
    for (j = 0; j < cols; j++)
       {
        if (i == 0 && j == 0)
           mimo_filt[i*rows + j].set("K","1 + 1/wp*s","K,wp,Ts",1.0,2*pi*100e3,Ts);
        else if (i == 0 && j == 1)
           mimo_filt[i*rows + j].set("K","1 + 1/wp*s","K,wp,Ts",1.0,2*pi*50e3,Ts);
        else if (i == 1 && j == 0)
           mimo_filt[i*rows + j].set("K","1 + 1/wp*s","K,wp,Ts",1.0,2*pi*200e3,Ts);
        else if (i == 1 && j == 1)
           mimo_filt[i*rows + j].set("K","1 + 1/wp*s","K,wp,Ts",1.0,2*pi*10e3,Ts);
       }
   }

end:
delete [] mimo_filt;
  
code:  
int i,j;
double temp_val;

for (i = 0; i < rows; i++)
    for (j = 0; j < cols; j++)
        mimo_filt[i*rows + j].inp(in_vec.get_elem(i));

for (j = 0; j < cols; j++)
   out_vec.set_elem(j,0.0);

for (i = 0; i < rows; i++)
   {
    for (j = 0; j < cols; j++)
       {
        temp_val = out_vec.get_elem(j);
        out_vec.set_elem(j,mimo_filt[i*rows + j].out + temp_val);
       }
   }




