1 #ifdef HAVE_STDLIB_H
2 #include <stdlib.h>
3 #endif
4 #include <stdio.h>
5 #include <math.h>
6 #include <errno.h>
7 #include "yagi.h"
8 #include <errno.h>
9 
fill_v_vector(int driven,int parasitic,double ** driven_data,double * v)10 void fill_v_vector(int driven, int parasitic, double **driven_data, double *v)
11 {
12 	double real, imaginary;
13 	int i, elements=driven+parasitic;
14 
15 	for(i=1;i<=elements;i++)		/* fill driven elements */
16 	{
17 		if(i<=driven)
18 		{
19 			real      = driven_data[i][VOLTAGE_R];
20 			imaginary = driven_data[i][VOLTAGE_I];
21 			v[2*i-1]=real;
22 			v[2*i]=imaginary;
23 		}
24 		else  /* zero parasitic elements */
25 		{
26 			v[2*i-1]=0.0;
27 			v[2*i]=0.0;
28 		}
29 	}
30 
31 #ifdef DEBUG
32 	if(errno)
33 	{
34 		fprintf(stderr,"Errno =%d in fill_v_vector() of v.c\n", errno);
35 		exit(1);
36 	}
37 #endif
38 }
39