00001 /* hmmstats.c - Stuff for doing statistical analysis in general and 00002 * hidden Markov models in particular. 00003 * 00004 * This file is copyright 2002 Jim Kent, but license is hereby 00005 * granted for all use - public, private or commercial. */ 00006 00007 #include "common.h" 00008 #include "hmmstats.h" 00009 00010 static char const rcsid[] = "$Id: hmmstats.c,v 1.4 2003/05/06 07:33:42 kate Exp $"; 00011 00012 int scaledLog(double val) 00013 /* Return scaled log of val. */ 00014 { 00015 return round(logScaleFactor * log(val)); 00016 } 00017 00018 double oneOverSqrtTwoPi = 0.39894228; 00019 00020 double simpleGaussean(double x) 00021 /* Gaussean distribution with standard deviation 1 and mean 0. */ 00022 { 00023 return oneOverSqrtTwoPi * exp(-0.5*x*x ); 00024 } 00025 00026 double gaussean(double x, double mean, double sd) 00027 /* Gaussean distribution with mean and standard deviation at point x */ 00028 { 00029 x -= mean; 00030 x /= sd; 00031 return oneOverSqrtTwoPi * exp(-0.5*x*x) / sd; 00032 } 00033 00034
1.5.2