private double prod(List<double> list1, List<double> list2 )
{
if (list1.Count != list2.Count) throw new System.Exception("The two list have to have the same size");
double val = 0;
for (int i = 0; i < list1.Count; i++)
{
val += list1[i] * list2[i];
}
return val;
}