コード例 #1
0
ファイル: ginfo.c プロジェクト: kaspermunch/sap-vendors
/* For Island model, we have no split time, but two periods that are separated
 * by the imaginary split. We have also imaginary population tree where ancestor
 * population resides in the imaginary last period and descendents in the first
 * period.
 * ---------------------------------------------------------------------------
 * numsplittimes: This tells us number of popoulation splits. If we consider a
 * binary population tree, then it would be one less than the number of
 * populations: npops - 1. If we consider Island model of [[npops]] populations,
 * it would be 0. Function [[read_datafile_top_lines]] sets the value.
 * lastperiodnumber: This would be the same as [[numsplittimes]] if we consider
 * a binary population tree. We have the imaginary split time for Island model.
 * It would 1 for Island model. Function [[read_datafile_top_lines]] sets the 
 * value.
 * numtreepops: The number of nodes of a population tree. For Island model, it
 * would be [[npops]] plus one. For a binary population tree, it would be twice
 * the [[npops]] minus one. Function [[read_datafile_top_lines]] sets the value
 * after reading the number of populations from an input file.
 * numpopsizeparams: The number of nodes of a population tree. For Island model,
 * it would be [[npops]]. For a binary population tree, it would be twice the
 * [[npops]] minus one, which is equal to [[numtreepops]].
 */
void
init_genealogy_weights (struct genealogy_weights *gweight)
{
  int i;
  gweight->cc = malloc ((numsplittimes + 1) * sizeof (int *));
  gweight->hcc = malloc ((numsplittimes + 1) * sizeof (double *));
  gweight->fc = malloc ((numsplittimes + 1) * sizeof (double *));
  for (i = 0; i < numsplittimes + 1; i++)
  {
    gweight->cc[i] = malloc ((npops - i) * sizeof (int));
    gweight->hcc[i] = malloc ((npops - i) * sizeof (double));
    gweight->fc[i] = malloc ((npops - i) * sizeof (double));
  }
  
  if (modeloptions[NOMIGRATION] == 0)
  {
    gweight->mc = malloc (lastperiodnumber * sizeof (int **));
    gweight->fm = malloc (lastperiodnumber * sizeof (double **));
    for (i = 0; i < npops - 1; i++)
    {
      gweight->mc[i] = alloc2Dint (npops - i, npops - i);
      gweight->fm[i] = alloc2Ddouble (npops - i, npops - i);
    }
  }
  setzero_genealogy_weights (gweight);
}
コード例 #2
0
ファイル: update_t_RY.cpp プロジェクト: goshng/cocoa
void
init_t_RY (void)
{
  int li, j;
  init_genealogy_weights (&holdallgweight_t_RY);
  for (li = 0; li < nloci; li++)
    init_genealogy_weights (&holdgweight_t_RY[li]);
  init_probcalc (&holdallpcalc_t_RY);
  for (largestsamp = 0, j = 0; j < nloci; j++)
    if (largestsamp < L[j].numlines)
      largestsamp = L[j].numlines;
  skipflag = alloc2Dint (nloci, 2 * largestsamp - 1);
}                               // init_changet_RY