830 - Haplotyper::SampleOneHaplotype()

From Genome Analysis Wiki
Revision as of 14:15, 2 October 2013 by Goncalo (talk | contribs)
Jump to navigationJump to search
float Haplotyper::SampleOneHaplotype(float * vector, double first, double & second, float & choice)
   {
   for (second = 0; second < states; second++)
      {
      choice += vector[CalculateIndex(first, second)] * 0.5;
      if (choice >= 0.0) return;
      }

   second = first;
   }

int Haplotyper::CalculateIndex(int first, int second)
   {
   if (first >= second)
       return (first * (first + 1) / 2 + second);
   else
       return (second * (second + 1) / 2 + first);
   }