/ghmm-0.7.0/ghmm/sfoba.h

http://github.com/jcnossen/hmmgenefinder · C Header · 104 lines · 15 code · 10 blank · 79 comment · 0 complexity · 5ae2fcc97c351f5f5c687f1f585de69b MD5 · raw file

  1. /*******************************************************************************
  2. *
  3. * This file is part of the General Hidden Markov Model Library,
  4. * GHMM version __VERSION__, see http://ghmm.org
  5. *
  6. * Filename: ghmm/ghmm/sfoba.h
  7. * Authors: Bernhard Knab, Benjamin Georgi
  8. *
  9. * Copyright (C) 1998-2004 Alexander Schliep
  10. * Copyright (C) 1998-2001 ZAIK/ZPR, Universitaet zu Koeln
  11. * Copyright (C) 2002-2004 Max-Planck-Institut fuer Molekulare Genetik,
  12. * Berlin
  13. *
  14. * Contact: schliep@ghmm.org
  15. *
  16. * This library is free software; you can redistribute it and/or
  17. * modify it under the terms of the GNU Library General Public
  18. * License as published by the Free Software Foundation; either
  19. * version 2 of the License, or (at your option) any later version.
  20. *
  21. * This library is distributed in the hope that it will be useful,
  22. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  23. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  24. * Library General Public License for more details.
  25. *
  26. * You should have received a copy of the GNU Library General Public
  27. * License along with this library; if not, write to the Free
  28. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  29. *
  30. *
  31. * This file is version $Revision: 1191 $
  32. * from $Date: 2005-06-21 11:56:12 +0200 (Tue, 21 Jun 2005) $
  33. * last change by $Author: cic99 $.
  34. *
  35. *******************************************************************************/
  36. #ifndef SFOBA_H
  37. #define SFOBA_H
  38. #include <ghmm/smodel.h>
  39. #ifdef __cplusplus
  40. extern "C" {
  41. #endif
  42. /**@name SHMM Forward-Backward-Algorithm */
  43. /*@{ (Doc++-Group: sfoba) */
  44. /** Forward-Backward-Algorithm for multiple double
  45. sequences with scaling.
  46. For reference see:
  47. Rabiner, L.R.: "`A Tutorial on Hidden {Markov} Models and Selected
  48. Applications in Speech Recognition"', Proceedings of the IEEE,
  49. 77, no 2, 1989, pp 257--285
  50. */
  51. /** Forward-Algorithm.
  52. Calculates alpha[t][i], scaling factors scale[t] and log( P(O|lambda) ) for
  53. a given double sequence and a given model.
  54. @param smo model
  55. @param O sequence
  56. @param T length of sequence
  57. @param alpha alpha[t][i]
  58. @param scale scale factors
  59. @param log_p log likelihood log( P(O|lambda) )
  60. @return 0 for success, -1 for error
  61. */
  62. int sfoba_forward (smodel * smo, double *O, int T, double ***b,
  63. double **alpha, double *scale, double *log_p);
  64. /**
  65. Backward-Algorithm.
  66. Calculates beta[t][i] given a double sequence and a model. Scale factors
  67. given as parameter (come from sfoba\_forward).
  68. @param smo model
  69. @param O sequence
  70. @param T length of sequence
  71. @param b matrix with precalculated output probabilities. May be NULL
  72. @param beta beta[t][i]
  73. @param scale scale factors
  74. @return 0 for success, -1 for error
  75. */
  76. int sfoba_backward (smodel * smo, double *O, int T, double ***b,
  77. double **beta, const double *scale);
  78. /**
  79. Calculation of log( P(O|lambda) ).
  80. Done by calling sfoba\_forward. Use this function if only the
  81. log likelihood and not alpha[t][i] is needed, alpha matrix is allocated with
  82. stat_matrix_d_alloc
  83. @param smo model
  84. @param O sequence
  85. @param T length of sequence
  86. @param log_p log likelihood log( P(O|lambda) )
  87. @return 0 for success, -1 for error
  88. */
  89. int sfoba_logp (smodel * smo, double *O, int T, double *log_p);
  90. #ifdef __cplusplus
  91. }
  92. #endif
  93. /*@} (Doc++-Group: sfoba) */
  94. #endif