コード例 #1
0
ファイル: randvar.c プロジェクト: tempbottle/ghmm
/*============================================================================*/
double ighmm_rand_get_1overa (double x, double mean, double u)
{
  /* Calulates 1/a(x, mean, u), with a = the integral from x til \infty over
     the Gauss density function */
# define CUR_PROC "ighmm_rand_get_1overa"

  double erfc_value;

  if (u <= 0.0) {
    GHMM_LOG(LCONVERTED, "u <= 0.0 not allowed\n");
    goto STOP;
  }

#if defined(__STDC_VERSION__) && (__STDC_VERSION__ >= 199901L)
  erfc_value = erfc ((x - mean) / sqrt (u * 2));
#else
  erfc_value = ighmm_erfc ((x - mean) / sqrt (u * 2));
#endif

  if (erfc_value <= DBL_MIN) {
    ighmm_mes (MES_WIN, "a ~= 0.0 critical! (mue = %.2f, u =%.2f)\n", mean, u);
    return (erfc_value);
  }
  else
    return (2.0 / erfc_value);

STOP:
  return (-1.0);
# undef CUR_PROC
}                               /* ighmm_rand_get_1overa */
コード例 #2
0
ファイル: smix_hmm.c プロジェクト: amremam2004/ghmm
/*============================================================================*/
int main(int argc, char* argv[]) {
#define CUR_PROC "smix_hmm_main"

#ifdef GHMM_OBSOLETE
  int exitcode = -1;

  if (argc != 4 && argc != 5) {
    printf("Insufficient arguments. Usage: \n");
    printf("mix_hmm [Seq.File] [InitModel File] [Out File] <seed>\n");
    goto STOP;
  }
  ghmm_rng_init();
  if (argc == 5)
      GHMM_RNG_SET(RNG,atoi(argv[4]));
    else {      
      ghmm_rng_timeseed(RNG); 
    }
  
  exitcode = smix_hmm_run(argc, argv);
  /*------------------------------------------------------------------------*/
 STOP:
  ighmm_mes(MES_WIN, "\n(%2.2T): Program finished with exitcode %d.\n", exitcode );
  ighmm_mes_exit();
  return(exitcode);

#else  /* GHMM_OBSOLETE */
  fprintf (stderr, "cluster is obsolete. If you need it rebuild the GHMM with \"GHMM_OBSOLETE\"\n");
  return 0;
#endif /* GHMM_OBSOLETE */

# undef CUR_PROC
} /* main */