/* Generated by Pyrex 0.9.8.5 on Mon Jun 15 13:04:26 2009 */

#define PY_SSIZE_T_CLEAN
#include "Python.h"
#include "structmember.h"
#ifndef PY_LONG_LONG
  #define PY_LONG_LONG LONG_LONG
#endif
#if PY_VERSION_HEX < 0x02050000
  typedef int Py_ssize_t;
  #define PY_SSIZE_T_MAX INT_MAX
  #define PY_SSIZE_T_MIN INT_MIN
  #define PyInt_FromSsize_t(z) PyInt_FromLong(z)
  #define PyInt_AsSsize_t(o)	PyInt_AsLong(o)
#endif
#if !defined(WIN32) && !defined(MS_WINDOWS)
  #ifndef __stdcall
    #define __stdcall
  #endif
  #ifndef __cdecl
    #define __cdecl
  #endif
#endif
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
#include <math.h>
#include "array_interface.h"
#include "math.h"


typedef struct {PyObject **p; int i; char *s; long n;} __Pyx_StringTabEntry; /*proto*/

static PyObject *__pyx_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
static char **__pyx_f;

static void __Pyx_WriteUnraisable(char *name); /*proto*/

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

static PyObject *__Pyx_UnpackItem(PyObject *); /*proto*/
static int __Pyx_EndUnpack(PyObject *); /*proto*/

static PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i); /*proto*/

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/

static void __Pyx_AddTraceback(char *funcname); /*proto*/

/* Declarations from cogent.align._pairwise_pogs */


/* Declarations from implementation of cogent.align._pairwise_pogs */

typedef PyObject *__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType;

static double __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP;
static double __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE;
static int __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_XCOUNT;
static long __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
static long __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE;
static double *__pyx_f_6cogent_5align_14_pairwise_pogs_uncheckedArrayDouble(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,char,int,int,int **); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,char,int,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,char,int,int *,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,char,int,int *,int *,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,char,int,int *,int *,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType,int *,int *,int *,int *); /*proto*/

static char __pyx_k1[] = "__array_struct__";
static char __pyx_k2[] = "Array required, got None";
static char __pyx_k3[] = "Unexpected array interface version %s";
static char __pyx_k4[] = "'%s' type array required, got '%s'";
static char __pyx_k5[] = "chr";
static char __pyx_k6[] = "'%s%s' type array required, got '%s%s'";
static char __pyx_k7[] = "%s dimensional array required, got %s";
static char __pyx_k8[] = "Noncontiguous array";
static char __pyx_k9[] = "Dimension %s is %s, expected %s";
static char __pyx_k10[] = "%s * SCALE_STEP ** %s %s";
static char __pyx_k11[] = "asCombinedArray";
static char __pyx_k12[] = "fmpt";
static char __pyx_k13[] = "transition is a negative probability";
static char __pyx_k14[] = "product is a negative probability";
static char __pyx_k15[] = "underflows";
static char __pyx_k16[] = "is unexpectedly large";
static char __pyx_k17[] = "('1', '3')";
static char __pyx_k18[] = "__version__";
static char __pyx_k19[] = "version_info";
static char __pyx_k20[] = "";

static PyObject *__pyx_n___array_struct__;
static PyObject *__pyx_n___version__;
static PyObject *__pyx_n_asCombinedArray;
static PyObject *__pyx_n_chr;
static PyObject *__pyx_n_fmpt;
static PyObject *__pyx_n_underflows;
static PyObject *__pyx_n_version_info;

static PyObject *__pyx_k2p;
static PyObject *__pyx_k3p;
static PyObject *__pyx_k4p;
static PyObject *__pyx_k6p;
static PyObject *__pyx_k7p;
static PyObject *__pyx_k8p;
static PyObject *__pyx_k9p;
static PyObject *__pyx_k10p;
static PyObject *__pyx_k13p;
static PyObject *__pyx_k14p;
static PyObject *__pyx_k16p;
static PyObject *__pyx_k17p;
static PyObject *__pyx_k20p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n___array_struct__, 1, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_n___version__, 1, __pyx_k18, sizeof(__pyx_k18)},
  {&__pyx_n_asCombinedArray, 1, __pyx_k11, sizeof(__pyx_k11)},
  {&__pyx_n_chr, 1, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_n_fmpt, 1, __pyx_k12, sizeof(__pyx_k12)},
  {&__pyx_n_underflows, 1, __pyx_k15, sizeof(__pyx_k15)},
  {&__pyx_n_version_info, 1, __pyx_k19, sizeof(__pyx_k19)},
  {&__pyx_k2p, 0, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_k3p, 0, __pyx_k3, sizeof(__pyx_k3)},
  {&__pyx_k4p, 0, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_k6p, 0, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_k7p, 0, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_k8p, 0, __pyx_k8, sizeof(__pyx_k8)},
  {&__pyx_k9p, 0, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_k10p, 0, __pyx_k10, sizeof(__pyx_k10)},
  {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_k14p, 0, __pyx_k14, sizeof(__pyx_k14)},
  {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
  {&__pyx_k17p, 0, __pyx_k17, sizeof(__pyx_k17)},
  {&__pyx_k20p, 0, __pyx_k20, sizeof(__pyx_k20)},
  {0, 0, 0, 0}
};

static PyObject *__pyx_d1;
static int __pyx_d2;
static int __pyx_d3;
static int __pyx_d4;


/* Implementation of cogent.align._pairwise_pogs */

static double *__pyx_f_6cogent_5align_14_pairwise_pogs_uncheckedArrayDouble(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_A) {
  struct PyArrayInterface *__pyx_v_a;
  PyObject *__pyx_v_cobj;
  double *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_A);
  __pyx_v_cobj = Py_None; Py_INCREF(Py_None);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":34 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_A, __pyx_n___array_struct__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
  Py_DECREF(__pyx_v_cobj);
  __pyx_v_cobj = __pyx_1;
  __pyx_1 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":35 */
  __pyx_v_a = ((struct PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_cobj));

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":36 */
  __pyx_r = ((double *)__pyx_v_a->data);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_WriteUnraisable("cogent.align._pairwise_pogs.uncheckedArrayDouble");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_cobj);
  Py_DECREF(__pyx_v_A);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_A,char __pyx_v_typecode,int __pyx_v_itemsize,int __pyx_v_nd,int **__pyx_v_dims) {
  struct PyArrayInterface *__pyx_v_a;
  PyObject *__pyx_v_cobj;
  char __pyx_v_typecode2;
  int __pyx_v_dimension;
  int __pyx_v_val;
  int *__pyx_v_var;
  void *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  Py_INCREF(__pyx_v_A);
  __pyx_v_cobj = Py_None; Py_INCREF(Py_None);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":43 */
  __pyx_1 = __pyx_v_A == Py_None;
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
    Py_INCREF(__pyx_k2p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k2p);
    __pyx_3 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":45 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_A, __pyx_n___array_struct__); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  Py_DECREF(__pyx_v_cobj);
  __pyx_v_cobj = __pyx_2;
  __pyx_2 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":46 */
  __pyx_v_a = ((struct PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_cobj));

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":47 */
  __pyx_1 = (__pyx_v_a->version != 2);
  if (__pyx_1) {
    __pyx_3 = PyInt_FromLong(__pyx_v_a->version); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(((PyObject *)(&PyString_Type)), __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_2 = PyNumber_Remainder(__pyx_k3p, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":51 */
  __pyx_v_typecode2 = __pyx_v_a->typekind;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":52 */
  __pyx_1 = (__pyx_v_typecode2 != __pyx_v_typecode);
  if (__pyx_1) {
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_chr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(__pyx_v_typecode); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_chr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    __pyx_4 = PyInt_FromLong(__pyx_v_typecode2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
    PyTuple_SET_ITEM(__pyx_3, 1, __pyx_4);
    __pyx_2 = 0;
    __pyx_4 = 0;
    __pyx_5 = PyNumber_Remainder(__pyx_k4p, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_4 = PyObject_CallObject(PyExc_TypeError, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":55 */
  __pyx_1 = (__pyx_v_a->itemsize != __pyx_v_itemsize);
  if (__pyx_1) {
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_chr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_5 = PyInt_FromLong(__pyx_v_typecode); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_5 = PyInt_FromLong(__pyx_v_itemsize); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_chr); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(__pyx_v_typecode2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_CallObject(__pyx_3, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_3 = PyInt_FromLong(__pyx_v_a->itemsize); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(4); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4);
    PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
    PyTuple_SET_ITEM(__pyx_6, 2, __pyx_2);
    PyTuple_SET_ITEM(__pyx_6, 3, __pyx_3);
    __pyx_4 = 0;
    __pyx_5 = 0;
    __pyx_2 = 0;
    __pyx_3 = 0;
    __pyx_4 = PyNumber_Remainder(__pyx_k6p, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_2 = PyObject_CallObject(PyExc_TypeError, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":58 */
  __pyx_1 = (__pyx_v_a->nd != __pyx_v_nd);
  if (__pyx_1) {
    __pyx_3 = PyInt_FromLong(__pyx_v_nd); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
    __pyx_6 = PyInt_FromLong(__pyx_v_a->nd); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_6);
    __pyx_3 = 0;
    __pyx_6 = 0;
    __pyx_5 = PyNumber_Remainder(__pyx_k7p, __pyx_4); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_3 = PyObject_CallObject(PyExc_ValueError, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":61 */
  __pyx_1 = (!(__pyx_v_a->flags & CONTIGUOUS));
  if (__pyx_1) {
    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
    Py_INCREF(__pyx_k8p);
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_k8p);
    __pyx_4 = PyObject_CallObject(PyExc_ValueError, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":66 */
  for (__pyx_v_dimension = 0; __pyx_v_dimension < __pyx_v_nd; ++__pyx_v_dimension) {

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":67 */
    __pyx_v_val = (__pyx_v_a->shape[__pyx_v_dimension]);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":68 */
    __pyx_v_var = (__pyx_v_dims[__pyx_v_dimension]);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":69 */
    __pyx_1 = ((__pyx_v_var[0]) == 0);
    if (__pyx_1) {
      (__pyx_v_var[0]) = __pyx_v_val;
      goto __pyx_L10;
    }
    __pyx_1 = ((__pyx_v_var[0]) != __pyx_v_val);
    if (__pyx_1) {
      __pyx_5 = PyInt_FromLong(__pyx_v_dimension); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_2 = PyInt_FromLong(__pyx_v_val); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_3 = PyInt_FromLong((__pyx_v_var[0])); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_6 = PyTuple_New(3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_6, 0, __pyx_5);
      PyTuple_SET_ITEM(__pyx_6, 1, __pyx_2);
      PyTuple_SET_ITEM(__pyx_6, 2, __pyx_3);
      __pyx_5 = 0;
      __pyx_2 = 0;
      __pyx_3 = 0;
      __pyx_4 = PyNumber_Remainder(__pyx_k9p, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
      __pyx_4 = 0;
      __pyx_2 = PyObject_CallObject(PyExc_ValueError, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      goto __pyx_L10;
    }
    /*else*/ {
    }
    __pyx_L10:;
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":79 */
  __pyx_r = __pyx_v_a->data;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_cobj);
  Py_DECREF(__pyx_v_A);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,char __pyx_v_typecode,int __pyx_v_size,int *__pyx_v_x) {
  int *__pyx_v_dims[1];
  void *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":85 */
  (__pyx_v_dims[0]) = __pyx_v_x;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":86 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_v_a,__pyx_v_typecode,__pyx_v_size,1,__pyx_v_dims); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,char __pyx_v_typecode,int __pyx_v_size,int *__pyx_v_x,int *__pyx_v_y) {
  int *__pyx_v_dims[2];
  void *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":91 */
  (__pyx_v_dims[0]) = __pyx_v_x;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":92 */
  (__pyx_v_dims[1]) = __pyx_v_y;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":93 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_v_a,__pyx_v_typecode,__pyx_v_size,2,__pyx_v_dims); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,char __pyx_v_typecode,int __pyx_v_size,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  int *__pyx_v_dims[3];
  void *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":98 */
  (__pyx_v_dims[0]) = __pyx_v_x;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":99 */
  (__pyx_v_dims[1]) = __pyx_v_y;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":100 */
  (__pyx_v_dims[2]) = __pyx_v_z;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":101 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_v_a,__pyx_v_typecode,__pyx_v_size,3,__pyx_v_dims); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 101; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArray4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,char __pyx_v_typecode,int __pyx_v_size,int *__pyx_v_w,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  int *__pyx_v_dims[4];
  void *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":106 */
  (__pyx_v_dims[0]) = __pyx_v_w;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":107 */
  (__pyx_v_dims[1]) = __pyx_v_x;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":108 */
  (__pyx_v_dims[2]) = __pyx_v_y;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":109 */
  (__pyx_v_dims[3]) = __pyx_v_z;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":110 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray(__pyx_v_a,__pyx_v_typecode,__pyx_v_size,4,__pyx_v_dims); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArray4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x) {
  double *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_a,'f',(sizeof(double)),__pyx_v_x); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
  __pyx_r = ((double *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayDouble1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x,int *__pyx_v_y) {
  double *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_a,'f',(sizeof(double)),__pyx_v_x,__pyx_v_y); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
  __pyx_r = ((double *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayDouble2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  double *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_a,'f',(sizeof(double)),__pyx_v_x,__pyx_v_y,__pyx_v_z); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; goto __pyx_L1;}
  __pyx_r = ((double *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayDouble3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_w,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  double *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray4D(__pyx_v_a,'f',(sizeof(double)),__pyx_v_w,__pyx_v_x,__pyx_v_y,__pyx_v_z); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; goto __pyx_L1;}
  __pyx_r = ((double *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayDouble4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x) {
  long *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray1D(__pyx_v_a,'i',(sizeof(long)),__pyx_v_x); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; goto __pyx_L1;}
  __pyx_r = ((long *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayLong1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong2D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x,int *__pyx_v_y) {
  long *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray2D(__pyx_v_a,'i',(sizeof(long)),__pyx_v_x,__pyx_v_y); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; goto __pyx_L1;}
  __pyx_r = ((long *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayLong2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong3D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  long *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray3D(__pyx_v_a,'i',(sizeof(long)),__pyx_v_x,__pyx_v_y,__pyx_v_z); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  __pyx_r = ((long *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayLong3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong4D(__pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_a,int *__pyx_v_w,int *__pyx_v_x,int *__pyx_v_y,int *__pyx_v_z) {
  long *__pyx_r;
  void *__pyx_1;
  Py_INCREF(__pyx_v_a);
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArray4D(__pyx_v_a,'i',(sizeof(long)),__pyx_v_w,__pyx_v_x,__pyx_v_y,__pyx_v_z); if (__pyx_1 == NULL) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; goto __pyx_L1;}
  __pyx_r = ((long *)__pyx_1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.checkArrayLong4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static PyObject *__pyx_f_6cogent_5align_14_pairwise_pogs_fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6cogent_5align_14_pairwise_pogs_fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mantissa = 0;
  PyObject *__pyx_v_exponent = 0;
  PyObject *__pyx_v_msg = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"mantissa","exponent","msg",0};
  __pyx_v_msg = __pyx_d1;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_mantissa, &__pyx_v_exponent, &__pyx_v_msg)) return 0;
  Py_INCREF(__pyx_v_mantissa);
  Py_INCREF(__pyx_v_exponent);
  Py_INCREF(__pyx_v_msg);
  __pyx_1 = PyTuple_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}
  Py_INCREF(__pyx_v_mantissa);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_mantissa);
  Py_INCREF(__pyx_v_exponent);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_exponent);
  Py_INCREF(__pyx_v_msg);
  PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_msg);
  __pyx_2 = PyNumber_Remainder(__pyx_k10p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 26; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  __pyx_2 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.fmpt");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_mantissa);
  Py_DECREF(__pyx_v_exponent);
  Py_DECREF(__pyx_v_msg);
  return __pyx_r;
}

static PyObject *__pyx_f_6cogent_5align_14_pairwise_pogs_calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cogent_5align_14_pairwise_pogs_calc_rows[] = "The ultimate in 2D Pyrex dynamic programming - Forward or Viterbi \n    algorithm, with doubles or with slower but practically unoverflowable \n    (double, long) GMP-like numbers.  Viterbi is also available in the ever \n    popular addition-of-logs version.  All this with any possible pair HMM \n    transition matrix.\n    \n    One time to use something faster than this is when the inputs are sequences\n    rather than alignments.  This code expects alignments (which can be single\n    sequences) represented as POGs (ie: DAGs).\n    \n    Limitations\n       - HMM states must be in a sensible order: M and X, then Y, then END.\n    ";
static PyObject *__pyx_f_6cogent_5align_14_pairwise_pogs_calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_plan = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_seq1_index = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_seq2_index = 0;
  int __pyx_v_i_low;
  int __pyx_v_i_high;
  int __pyx_v_j_low;
  int __pyx_v_j_high;
  PyObject *__pyx_v_preds = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_state_directions = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_T = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_xgap_scores = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_ygap_scores = 0;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_match_scores = 0;
  PyObject *__pyx_v_rows = 0;
  PyObject *__pyx_v_track = 0;
  int __pyx_v_viterbi;
  int __pyx_v_use_logs;
  int __pyx_v_local;
  int __pyx_v_use_scaling;
  int __pyx_v_dx;
  int __pyx_v_dy;
  int __pyx_v_prev_i;
  int __pyx_v_prev_j;
  int __pyx_v_state;
  int __pyx_v_prev_state;
  int __pyx_v_N;
  int __pyx_v_row_length;
  int __pyx_v_a_count;
  int __pyx_v_a;
  int __pyx_v_b;
  int __pyx_v_a_low;
  int __pyx_v_a_high;
  int __pyx_v_b_low;
  int __pyx_v_b_high;
  int __pyx_v_dest_states;
  int __pyx_v_dest_state;
  int __pyx_v_d4;
  int __pyx_v_j;
  int __pyx_v_i;
  int __pyx_v_last_i;
  int __pyx_v_last_j;
  int __pyx_v_last_state;
  int __pyx_v_overall_max_exponent;
  double __pyx_v_overall_max_mantissa;
  double __pyx_v_d_score;
  double __pyx_v_mantissa;
  double __pyx_v_partial_sum;
  double __pyx_v_sub_partial_sum;
  double __pyx_v_max_mantissa;
  long __pyx_v_exponent;
  long __pyx_v_index;
  long __pyx_v_max_exponent;
  long *__pyx_v_source_row_ex_data;
  double *__pyx_v_T_data;
  double *__pyx_v_source_row_data;
  double *__pyx_v_match_score_data;
  long *__pyx_v_dest_states_data;
  long *__pyx_v_plan_data;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_i_sources;
  __pyx_t_6cogent_5align_14_pairwise_pogs_ArrayType __pyx_v_j_sources;
  double *__pyx_v_current_row_data;
  double *__pyx_v_source_row_data_cache[256];
  long *__pyx_v_current_row_ex_data;
  long *__pyx_v_source_row_ex_data_cache[256];
  long __pyx_v_pointer_a;
  long __pyx_v_pointer_b;
  long __pyx_v_pointer_state;
  long *__pyx_v_track_data;
  long *__pyx_v_x_index;
  long *__pyx_v_y_index;
  int __pyx_v_x;
  int __pyx_v_y;
  int __pyx_v_max_x;
  int __pyx_v_max_y;
  long *__pyx_v_i_sources_data;
  long *__pyx_v_i_sources_offsets_data;
  long *__pyx_v_j_sources_data;
  long *__pyx_v_j_sources_offsets_data;
  long __pyx_v_i_sources_start;
  long __pyx_v_i_sources_end;
  long __pyx_v_j_sources_start;
  long __pyx_v_j_sources_end;
  int __pyx_v_i_link_count;
  int __pyx_v_j_link_count;
  int __pyx_v_row_count;
  int __pyx_v_row_length1;
  int __pyx_v_plan_index;
  int __pyx_v_row_count1;
  PyObject *__pyx_v_mantissas;
  PyObject *__pyx_v_exponents;
  int __pyx_v_bin_count;
  int __pyx_v_bin;
  double *__pyx_v_xgap_score_data;
  double *__pyx_v_ygap_score_data;
  PyObject *__pyx_v_pog1;
  PyObject *__pyx_v_pog2;
  PyObject *__pyx_v_j_sources_offsets;
  PyObject *__pyx_v_i_sources_offsets;
  double __pyx_v_impossible;
  PyObject *__pyx_v_score;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  int __pyx_3;
  double *__pyx_4;
  long *__pyx_5;
  long *__pyx_6;
  double *__pyx_7;
  long __pyx_8;
  long *__pyx_9;
  PyObject *__pyx_10 = 0;
  PyObject *__pyx_11 = 0;
  static char *__pyx_argnames[] = {"plan","seq1_index","seq2_index","i_low","i_high","j_low","j_high","preds","state_directions","T","xgap_scores","ygap_scores","match_scores","rows","track","viterbi","use_logs","local","use_scaling",0};
  __pyx_v_use_logs = __pyx_d2;
  __pyx_v_local = __pyx_d3;
  __pyx_v_use_scaling = __pyx_d4;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOiiiiOOOOOOOOi|iii", __pyx_argnames, &__pyx_v_plan, &__pyx_v_seq1_index, &__pyx_v_seq2_index, &__pyx_v_i_low, &__pyx_v_i_high, &__pyx_v_j_low, &__pyx_v_j_high, &__pyx_v_preds, &__pyx_v_state_directions, &__pyx_v_T, &__pyx_v_xgap_scores, &__pyx_v_ygap_scores, &__pyx_v_match_scores, &__pyx_v_rows, &__pyx_v_track, &__pyx_v_viterbi, &__pyx_v_use_logs, &__pyx_v_local, &__pyx_v_use_scaling)) return 0;
  Py_INCREF(__pyx_v_plan);
  Py_INCREF(__pyx_v_seq1_index);
  Py_INCREF(__pyx_v_seq2_index);
  Py_INCREF(__pyx_v_preds);
  Py_INCREF(__pyx_v_state_directions);
  Py_INCREF(__pyx_v_T);
  Py_INCREF(__pyx_v_xgap_scores);
  Py_INCREF(__pyx_v_ygap_scores);
  Py_INCREF(__pyx_v_match_scores);
  Py_INCREF(__pyx_v_rows);
  Py_INCREF(__pyx_v_track);
  __pyx_v_i_sources = Py_None; Py_INCREF(Py_None);
  __pyx_v_j_sources = Py_None; Py_INCREF(Py_None);
  __pyx_v_mantissas = Py_None; Py_INCREF(Py_None);
  __pyx_v_exponents = Py_None; Py_INCREF(Py_None);
  __pyx_v_pog1 = Py_None; Py_INCREF(Py_None);
  __pyx_v_pog2 = Py_None; Py_INCREF(Py_None);
  __pyx_v_j_sources_offsets = Py_None; Py_INCREF(Py_None);
  __pyx_v_i_sources_offsets = Py_None; Py_INCREF(Py_None);
  __pyx_v_score = Py_None; Py_INCREF(Py_None);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":73 */
  __pyx_1 = PyObject_GetIter(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  Py_DECREF(__pyx_v_mantissas);
  __pyx_v_mantissas = __pyx_2;
  __pyx_2 = 0;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  Py_DECREF(__pyx_v_exponents);
  __pyx_v_exponents = __pyx_2;
  __pyx_2 = 0;
  if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":75 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_3 = __pyx_v_use_logs;
  if (__pyx_3) {
    __pyx_3 = (!__pyx_v_viterbi);
  }
  if (!(!__pyx_3)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":76 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_3 = __pyx_v_use_logs;
  if (__pyx_3) {
    __pyx_3 = __pyx_v_use_scaling;
  }
  if (!(!__pyx_3)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":77 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_3 = __pyx_v_local;
  if (__pyx_3) {
    __pyx_3 = (!__pyx_v_viterbi);
  }
  if (!(!__pyx_3)) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":79 */
  __pyx_v_N = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":80 */
  __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_v_T,(&__pyx_v_N),(&__pyx_v_N)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; goto __pyx_L1;}
  __pyx_v_T_data = __pyx_4;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":81 */
  __pyx_v_row_length = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":82 */
  __pyx_v_row_count = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":83 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_plan,(&__pyx_v_row_count)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 83; goto __pyx_L1;}
  __pyx_v_plan_data = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":85 */
  __pyx_v_dest_states = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":86 */
  __pyx_v_d4 = 4;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":88 */
  __pyx_6 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong2D(__pyx_v_state_directions,(&__pyx_v_dest_states),(&__pyx_v_d4)); if (__pyx_6 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 88; goto __pyx_L1;}
  __pyx_v_dest_states_data = __pyx_6;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":93 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_seq1_index,(&__pyx_v_row_count)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; goto __pyx_L1;}
  __pyx_v_x_index = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":94 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_seq2_index,(&__pyx_v_row_length)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 94; goto __pyx_L1;}
  __pyx_v_y_index = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":96 */
  __pyx_v_max_x = 0;
  __pyx_v_max_y = 0;
  __pyx_v_bin_count = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":97 */
  __pyx_7 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble3D(__pyx_v_match_scores,(&__pyx_v_bin_count),(&__pyx_v_max_x),(&__pyx_v_max_y)); if (__pyx_7 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 97; goto __pyx_L1;}
  __pyx_v_match_score_data = __pyx_7;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":99 */
  __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_v_xgap_scores,(&__pyx_v_bin_count),(&__pyx_v_max_x)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; goto __pyx_L1;}
  __pyx_v_xgap_score_data = __pyx_4;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":100 */
  __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_v_ygap_scores,(&__pyx_v_bin_count),(&__pyx_v_max_y)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; goto __pyx_L1;}
  __pyx_v_ygap_score_data = __pyx_4;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":102 */
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_row_count; ++__pyx_v_i) {
    #ifndef PYREX_WITHOUT_ASSERTIONS
    __pyx_8 = (__pyx_v_x_index[__pyx_v_i]);
    __pyx_3 = 0 <= __pyx_8;
    if (__pyx_3) {
      __pyx_3 = __pyx_8 < __pyx_v_max_x;
    }
    if (!__pyx_3) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; goto __pyx_L1;}
    }
    #endif
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":104 */
  for (__pyx_v_j = 0; __pyx_v_j < __pyx_v_row_length; ++__pyx_v_j) {
    #ifndef PYREX_WITHOUT_ASSERTIONS
    __pyx_8 = (__pyx_v_y_index[__pyx_v_j]);
    __pyx_3 = 0 <= __pyx_8;
    if (__pyx_3) {
      __pyx_3 = __pyx_8 < __pyx_v_max_y;
    }
    if (!__pyx_3) {
      PyErr_SetNone(PyExc_AssertionError);
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 105; goto __pyx_L1;}
    }
    #endif
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":107 */
  #ifndef PYREX_WITHOUT_ASSERTIONS
  __pyx_3 = (__pyx_v_j_low >= 0);
  if (__pyx_3) {
    __pyx_3 = (__pyx_v_j_high > __pyx_v_j_low);
    if (__pyx_3) {
      __pyx_3 = (__pyx_v_j_high <= __pyx_v_row_length);
    }
  }
  if (!__pyx_3) {
    PyErr_SetNone(PyExc_AssertionError);
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":109 */
  __pyx_2 = PyObject_GetIter(__pyx_v_preds); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; goto __pyx_L1;}
  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; goto __pyx_L1;}
  Py_DECREF(__pyx_v_pog1);
  __pyx_v_pog1 = __pyx_1;
  __pyx_1 = 0;
  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; goto __pyx_L1;}
  Py_DECREF(__pyx_v_pog2);
  __pyx_v_pog2 = __pyx_1;
  __pyx_1 = 0;
  if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 109; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":110 */
  __pyx_1 = PyObject_GetAttr(__pyx_v_pog2, __pyx_n_asCombinedArray); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_2 = PyObject_CallObject(__pyx_1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetIter(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  Py_DECREF(__pyx_v_j_sources);
  __pyx_v_j_sources = __pyx_2;
  __pyx_2 = 0;
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  Py_DECREF(__pyx_v_j_sources_offsets);
  __pyx_v_j_sources_offsets = __pyx_2;
  __pyx_2 = 0;
  if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":111 */
  __pyx_v_j_link_count = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":112 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_j_sources,(&__pyx_v_j_link_count)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 112; goto __pyx_L1;}
  __pyx_v_j_sources_data = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":113 */
  __pyx_v_row_length1 = (__pyx_v_row_length + 1);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":114 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_j_sources_offsets,(&__pyx_v_row_length1)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; goto __pyx_L1;}
  __pyx_v_j_sources_offsets_data = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":116 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_pog1, __pyx_n_asCombinedArray); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  __pyx_1 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_v_i_sources);
  __pyx_v_i_sources = __pyx_1;
  __pyx_1 = 0;
  __pyx_1 = __Pyx_UnpackItem(__pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_v_i_sources_offsets);
  __pyx_v_i_sources_offsets = __pyx_1;
  __pyx_1 = 0;
  if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 116; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":117 */
  __pyx_v_i_link_count = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":118 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_i_sources,(&__pyx_v_i_link_count)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; goto __pyx_L1;}
  __pyx_v_i_sources_data = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":119 */
  __pyx_v_row_count1 = (__pyx_v_row_count + 1);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":120 */
  __pyx_5 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong1D(__pyx_v_i_sources_offsets,(&__pyx_v_row_count1)); if (__pyx_5 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; goto __pyx_L1;}
  __pyx_v_i_sources_offsets_data = __pyx_5;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":123 */
  __pyx_3 = __pyx_v_use_logs;
  if (__pyx_3) {
    __pyx_v_impossible = (-Py_HUGE_VAL);
    goto __pyx_L6;
  }
  /*else*/ {
    __pyx_v_impossible = 0.0;
  }
  __pyx_L6:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":128 */
  __pyx_3 = __pyx_v_viterbi;
  if (__pyx_3) {
    __pyx_3 = __pyx_v_track != Py_None;
  }
  if (__pyx_3) {
    __pyx_9 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong3D(__pyx_v_track,(&__pyx_v_row_count),(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_9 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; goto __pyx_L1;}
    __pyx_v_track_data = __pyx_9;
    goto __pyx_L7;
  }
  /*else*/ {
    __pyx_v_track_data = NULL;
  }
  __pyx_L7:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":134 */
  __pyx_v_overall_max_exponent = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":135 */
  __pyx_v_overall_max_mantissa = 0.0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":136 */
  __pyx_8 = (-1);
  __pyx_v_last_i = __pyx_8;
  __pyx_v_last_j = __pyx_8;
  __pyx_v_last_state = __pyx_8;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":138 */
  for (__pyx_v_i = __pyx_v_i_low; __pyx_v_i < __pyx_v_i_high; ++__pyx_v_i) {

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":139 */
    __pyx_v_x = (__pyx_v_x_index[__pyx_v_i]);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":141 */
    __pyx_3 = PyErr_CheckSignals();
    if (__pyx_3) {
      __pyx_1 = PyErr_Occurred(); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; goto __pyx_L1;}
      __Pyx_Raise(__pyx_1, 0, 0);
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 142; goto __pyx_L1;}
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":144 */
    __pyx_v_plan_index = (__pyx_v_plan_data[__pyx_v_i]);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":145 */
    __pyx_2 = __Pyx_GetItemInt(__pyx_v_mantissas, __pyx_v_plan_index); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; goto __pyx_L1;}
    __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_2,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_v_current_row_data = __pyx_4;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":146 */
    __pyx_3 = __pyx_v_use_scaling;
    if (__pyx_3) {
      __pyx_1 = __Pyx_GetItemInt(__pyx_v_exponents, __pyx_v_plan_index); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; goto __pyx_L1;}
      __pyx_6 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong2D(__pyx_1,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_6 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 147; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_v_current_row_ex_data = __pyx_6;
      goto __pyx_L11;
    }
    /*else*/ {
      __pyx_v_current_row_ex_data = NULL;
    }
    __pyx_L11:;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":151 */
    __pyx_2 = __Pyx_GetItemInt(__pyx_v_i_sources_offsets, __pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; goto __pyx_L1;}
    __pyx_8 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 151; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_v_i_sources_start = __pyx_8;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":152 */
    __pyx_1 = __Pyx_GetItemInt(__pyx_v_i_sources_offsets, (__pyx_v_i + 1)); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; goto __pyx_L1;}
    __pyx_8 = PyInt_AsLong(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 152; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_v_i_sources_end = __pyx_8;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":154 */
    (__pyx_v_source_row_data_cache[0]) = __pyx_v_current_row_data;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":155 */
    (__pyx_v_source_row_ex_data_cache[0]) = __pyx_v_current_row_ex_data;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":157 */
    __pyx_v_a_count = (__pyx_v_i_sources_end - __pyx_v_i_sources_start);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":158 */
    for (__pyx_v_a = 0; __pyx_v_a < __pyx_v_a_count; ++__pyx_v_a) {

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":159 */
      __pyx_v_prev_i = (__pyx_v_i_sources_data[(__pyx_v_a + __pyx_v_i_sources_start)]);

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":160 */
      __pyx_v_plan_index = (__pyx_v_plan_data[__pyx_v_prev_i]);

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":161 */
      __pyx_2 = __Pyx_GetItemInt(__pyx_v_mantissas, __pyx_v_plan_index); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; goto __pyx_L1;}
      __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayDouble2D(__pyx_2,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      (__pyx_v_source_row_data_cache[(__pyx_v_a + 1)]) = __pyx_4;

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":163 */
      __pyx_3 = __pyx_v_use_scaling;
      if (__pyx_3) {
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_exponents, __pyx_v_plan_index); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L1;}
        __pyx_6 = __pyx_f_6cogent_5align_14_pairwise_pogs_checkArrayLong2D(__pyx_1,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_6 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        (__pyx_v_source_row_ex_data_cache[(__pyx_v_a + 1)]) = __pyx_6;
        goto __pyx_L14;
      }
      /*else*/ {
        (__pyx_v_source_row_ex_data_cache[(__pyx_v_a + 1)]) = NULL;
      }
      __pyx_L14:;
    }

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":169 */
    __pyx_3 = (__pyx_v_i == 0);
    if (__pyx_3) {

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":170 */
      __pyx_3 = __pyx_v_use_logs;
      if (__pyx_3) {
        (__pyx_v_current_row_data[0]) = 0.0;
        goto __pyx_L16;
      }
      /*else*/ {
        (__pyx_v_current_row_data[0]) = 1.0;
      }
      __pyx_L16:;

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":174 */
      __pyx_3 = __pyx_v_use_scaling;
      if (__pyx_3) {
        (__pyx_v_current_row_ex_data[0]) = 0;
        goto __pyx_L17;
      }
      __pyx_L17:;
      goto __pyx_L15;
    }
    /*else*/ {

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":177 */
      (__pyx_v_current_row_data[((0 * __pyx_v_N) + 0)]) = __pyx_v_impossible;

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":178 */
      __pyx_3 = __pyx_v_use_scaling;
      if (__pyx_3) {
        (__pyx_v_current_row_ex_data[((0 * __pyx_v_N) + 0)]) = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;
        goto __pyx_L18;
      }
      __pyx_L18:;
    }
    __pyx_L15:;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":181 */
    __pyx_v_j_sources_end = (__pyx_v_j_sources_offsets_data[__pyx_v_j_low]);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":182 */
    for (__pyx_v_j = __pyx_v_j_low; __pyx_v_j < __pyx_v_j_high; ++__pyx_v_j) {

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":183 */
      __pyx_v_j_sources_start = __pyx_v_j_sources_end;

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":184 */
      __pyx_v_j_sources_end = (__pyx_v_j_sources_offsets_data[(__pyx_v_j + 1)]);

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":186 */
      for (__pyx_v_dest_state = 0; __pyx_v_dest_state < __pyx_v_dest_states; ++__pyx_v_dest_state) {

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":187 */
        __pyx_v_state = (__pyx_v_dest_states_data[((__pyx_v_dest_state * 4) + 0)]);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":188 */
        __pyx_v_bin = (__pyx_v_dest_states_data[((__pyx_v_dest_state * 4) + 1)]);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":189 */
        __pyx_v_dx = (__pyx_v_dest_states_data[((__pyx_v_dest_state * 4) + 2)]);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":190 */
        __pyx_v_dy = (__pyx_v_dest_states_data[((__pyx_v_dest_state * 4) + 3)]);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":192 */
        __pyx_v_max_mantissa = __pyx_v_impossible;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":193 */
        __pyx_v_max_exponent = __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":194 */
        __pyx_v_partial_sum = 0.0;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":195 */
        __pyx_v_pointer_state = (__pyx_v_N + 1);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":197 */
        __pyx_3 = __pyx_v_dx;
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":198 */
          __pyx_v_a_low = 1;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":199 */
          __pyx_v_a_high = (__pyx_v_a_count + 1);
          goto __pyx_L23;
        }
        /*else*/ {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":201 */
          __pyx_v_a_low = 0;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":202 */
          __pyx_v_a_high = 1;
        }
        __pyx_L23:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":204 */
        __pyx_3 = __pyx_v_dy;
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":205 */
          __pyx_v_b_low = 1;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":206 */
          __pyx_v_b_high = ((__pyx_v_j_sources_end - __pyx_v_j_sources_start) + 1);
          goto __pyx_L24;
        }
        /*else*/ {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":208 */
          __pyx_v_b_low = 0;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":209 */
          __pyx_v_b_high = 1;
        }
        __pyx_L24:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":211 */
        __pyx_3 = __pyx_v_use_scaling;
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":212 */
          __pyx_v_sub_partial_sum = 0.0;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":214 */
          for (__pyx_v_a = __pyx_v_a_low; __pyx_v_a < __pyx_v_a_high; ++__pyx_v_a) {

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":215 */
            __pyx_v_source_row_data = (__pyx_v_source_row_data_cache[__pyx_v_a]);

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":216 */
            __pyx_v_source_row_ex_data = (__pyx_v_source_row_ex_data_cache[__pyx_v_a]);

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":217 */
            for (__pyx_v_b = __pyx_v_b_low; __pyx_v_b < __pyx_v_b_high; ++__pyx_v_b) {

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":218 */
              __pyx_3 = __pyx_v_dy;
              if (__pyx_3) {
                __pyx_v_prev_j = (__pyx_v_j_sources_data[((__pyx_v_b - 1) + __pyx_v_j_sources_start)]);
                goto __pyx_L30;
              }
              /*else*/ {
                __pyx_v_prev_j = __pyx_v_j;
              }
              __pyx_L30:;

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":222 */
              for (__pyx_v_prev_state = (__pyx_v_prev_j > 0); __pyx_v_prev_state < __pyx_v_N; ++__pyx_v_prev_state) {

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":223 */
                __pyx_v_index = ((__pyx_v_prev_j * __pyx_v_N) + __pyx_v_prev_state);

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":225 */
                __pyx_v_exponent = (__pyx_v_source_row_ex_data[__pyx_v_index]);

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":226 */
                __pyx_3 = (__pyx_v_exponent == __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE);
                if (__pyx_3) {
                  goto __pyx_L31;
                  goto __pyx_L33;
                }
                __pyx_L33:;

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":230 */
                __pyx_v_mantissa = ((__pyx_v_source_row_data[__pyx_v_index]) * (__pyx_v_T_data[((__pyx_v_prev_state * __pyx_v_N) + __pyx_v_state)]));

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":232 */
                __pyx_3 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
                if (__pyx_3) {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":233 */
                  __pyx_3 = (__pyx_v_mantissa == 0.0);
                  if (__pyx_3) {
                    goto __pyx_L31;
                    goto __pyx_L35;
                  }
                  __pyx_L35:;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":235 */
                  __pyx_3 = (__pyx_v_mantissa < 0.0);
                  if (__pyx_3) {

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":236 */
                    __pyx_3 = ((__pyx_v_T_data[((__pyx_v_prev_state * __pyx_v_N) + __pyx_v_state)]) < 0.0);
                    if (__pyx_3) {
                      __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_fmpt); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      __pyx_10 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      __pyx_11 = PyTuple_New(3); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      PyTuple_SET_ITEM(__pyx_11, 0, __pyx_1);
                      PyTuple_SET_ITEM(__pyx_11, 1, __pyx_10);
                      Py_INCREF(__pyx_k13p);
                      PyTuple_SET_ITEM(__pyx_11, 2, __pyx_k13p);
                      __pyx_1 = 0;
                      __pyx_10 = 0;
                      __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_11); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      Py_DECREF(__pyx_2); __pyx_2 = 0;
                      Py_DECREF(__pyx_11); __pyx_11 = 0;
                      __pyx_10 = PyTuple_New(1); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      PyTuple_SET_ITEM(__pyx_10, 0, __pyx_1);
                      __pyx_1 = 0;
                      __pyx_2 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_10); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      Py_DECREF(__pyx_10); __pyx_10 = 0;
                      __Pyx_Raise(__pyx_2, 0, 0);
                      Py_DECREF(__pyx_2); __pyx_2 = 0;
                      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
                      goto __pyx_L37;
                    }
                    __pyx_L37:;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":239 */
                    __pyx_11 = __Pyx_GetName(__pyx_m, __pyx_n_fmpt); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    __pyx_10 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
                    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_10);
                    Py_INCREF(__pyx_k14p);
                    PyTuple_SET_ITEM(__pyx_2, 2, __pyx_k14p);
                    __pyx_1 = 0;
                    __pyx_10 = 0;
                    __pyx_1 = PyObject_CallObject(__pyx_11, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    Py_DECREF(__pyx_11); __pyx_11 = 0;
                    Py_DECREF(__pyx_2); __pyx_2 = 0;
                    __pyx_10 = PyTuple_New(1); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    PyTuple_SET_ITEM(__pyx_10, 0, __pyx_1);
                    __pyx_1 = 0;
                    __pyx_11 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_10); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    Py_DECREF(__pyx_10); __pyx_10 = 0;
                    __Pyx_Raise(__pyx_11, 0, 0);
                    Py_DECREF(__pyx_11); __pyx_11 = 0;
                    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 239; goto __pyx_L1;}
                    goto __pyx_L36;
                  }
                  __pyx_L36:;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":241 */
                  while (1) {
                    __pyx_3 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
                    if (!__pyx_3) break;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":242 */
                    __pyx_v_mantissa *= __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":243 */
                    __pyx_v_exponent += (-1);

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":244 */
                    __pyx_3 = (__pyx_v_exponent <= __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE);
                    if (__pyx_3) {
                      __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_fmpt); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      __pyx_10 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      __pyx_11 = PyTuple_New(3); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      PyTuple_SET_ITEM(__pyx_11, 0, __pyx_1);
                      PyTuple_SET_ITEM(__pyx_11, 1, __pyx_10);
                      Py_INCREF(__pyx_n_underflows);
                      PyTuple_SET_ITEM(__pyx_11, 2, __pyx_n_underflows);
                      __pyx_1 = 0;
                      __pyx_10 = 0;
                      __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_11); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      Py_DECREF(__pyx_2); __pyx_2 = 0;
                      Py_DECREF(__pyx_11); __pyx_11 = 0;
                      __pyx_10 = PyTuple_New(1); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      PyTuple_SET_ITEM(__pyx_10, 0, __pyx_1);
                      __pyx_1 = 0;
                      __pyx_2 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_10); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      Py_DECREF(__pyx_10); __pyx_10 = 0;
                      __Pyx_Raise(__pyx_2, 0, 0);
                      Py_DECREF(__pyx_2); __pyx_2 = 0;
                      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 245; goto __pyx_L1;}
                      goto __pyx_L40;
                    }
                    __pyx_L40:;
                  }
                  goto __pyx_L34;
                }
                __pyx_3 = (__pyx_v_mantissa > 1.0);
                if (__pyx_3) {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":249 */
                  __pyx_v_mantissa *= __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":250 */
                  __pyx_v_exponent += 1;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":251 */
                  __pyx_3 = (__pyx_v_exponent > __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE);
                  if (__pyx_3) {
                    __pyx_11 = __Pyx_GetName(__pyx_m, __pyx_n_fmpt); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    __pyx_10 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
                    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_10);
                    Py_INCREF(__pyx_k16p);
                    PyTuple_SET_ITEM(__pyx_2, 2, __pyx_k16p);
                    __pyx_1 = 0;
                    __pyx_10 = 0;
                    __pyx_1 = PyObject_CallObject(__pyx_11, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    Py_DECREF(__pyx_11); __pyx_11 = 0;
                    Py_DECREF(__pyx_2); __pyx_2 = 0;
                    __pyx_10 = PyTuple_New(1); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    PyTuple_SET_ITEM(__pyx_10, 0, __pyx_1);
                    __pyx_1 = 0;
                    __pyx_11 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_10); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    Py_DECREF(__pyx_10); __pyx_10 = 0;
                    __Pyx_Raise(__pyx_11, 0, 0);
                    Py_DECREF(__pyx_11); __pyx_11 = 0;
                    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 252; goto __pyx_L1;}
                    goto __pyx_L41;
                  }
                  __pyx_L41:;
                  goto __pyx_L34;
                }
                __pyx_L34:;

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":255 */
                __pyx_3 = (__pyx_v_exponent > __pyx_v_max_exponent);
                if (__pyx_3) {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":256 */
                  __pyx_3 = (__pyx_v_exponent == (__pyx_v_max_exponent + 1));
                  if (__pyx_3) {
                    __pyx_v_sub_partial_sum = __pyx_v_partial_sum;
                    goto __pyx_L43;
                  }
                  /*else*/ {
                    __pyx_v_sub_partial_sum = 0.0;
                  }
                  __pyx_L43:;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":260 */
                  __pyx_v_partial_sum = 0.0;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":261 */
                  __pyx_v_max_mantissa = 0.0;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":262 */
                  __pyx_v_max_exponent = __pyx_v_exponent;
                  goto __pyx_L42;
                }
                __pyx_L42:;

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":264 */
                __pyx_3 = (__pyx_v_exponent == __pyx_v_max_exponent);
                if (__pyx_3) {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":265 */
                  __pyx_v_partial_sum += __pyx_v_mantissa;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":266 */
                  __pyx_3 = __pyx_v_viterbi;
                  if (__pyx_3) {
                    __pyx_3 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
                  }
                  if (__pyx_3) {

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":267 */
                    __pyx_v_max_mantissa = __pyx_v_mantissa;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":268 */
                    __pyx_v_pointer_state = __pyx_v_prev_state;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":269 */
                    __pyx_v_pointer_a = __pyx_v_a;

                    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":270 */
                    __pyx_v_pointer_b = __pyx_v_b;
                    goto __pyx_L45;
                  }
                  __pyx_L45:;
                  goto __pyx_L44;
                }
                __pyx_3 = (__pyx_v_exponent == (__pyx_v_max_exponent - 1));
                if (__pyx_3) {
                  __pyx_v_sub_partial_sum += __pyx_v_mantissa;
                  goto __pyx_L44;
                }
                __pyx_L44:;
                __pyx_L31:;
              }

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":275 */
              __pyx_v_partial_sum += (__pyx_v_sub_partial_sum * __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE);
            }
          }
          goto __pyx_L25;
        }
        /*else*/ {
          for (__pyx_v_a = __pyx_v_a_low; __pyx_v_a < __pyx_v_a_high; ++__pyx_v_a) {

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":280 */
            __pyx_v_source_row_data = (__pyx_v_source_row_data_cache[__pyx_v_a]);

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":281 */
            for (__pyx_v_b = __pyx_v_b_low; __pyx_v_b < __pyx_v_b_high; ++__pyx_v_b) {

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":282 */
              __pyx_v_prev_j = (__pyx_v_j_sources_data[(__pyx_v_b + __pyx_v_j_sources_start)]);

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":283 */
              for (__pyx_v_prev_state = 0; __pyx_v_prev_state < __pyx_v_N; ++__pyx_v_prev_state) {

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":284 */
                __pyx_v_index = ((__pyx_v_prev_j * __pyx_v_N) + __pyx_v_prev_state);

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":285 */
                __pyx_3 = __pyx_v_use_logs;
                if (__pyx_3) {
                  __pyx_v_mantissa = ((__pyx_v_source_row_data[__pyx_v_index]) + (__pyx_v_T_data[((__pyx_v_prev_state * __pyx_v_N) + __pyx_v_state)]));
                  goto __pyx_L52;
                }
                /*else*/ {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":290 */
                  __pyx_v_mantissa = ((__pyx_v_source_row_data[__pyx_v_index]) * (__pyx_v_T_data[((__pyx_v_prev_state * __pyx_v_N) + __pyx_v_state)]));

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":291 */
                  __pyx_v_partial_sum += __pyx_v_mantissa;
                }
                __pyx_L52:;

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":292 */
                __pyx_3 = __pyx_v_viterbi;
                if (__pyx_3) {
                  __pyx_3 = (__pyx_v_mantissa > __pyx_v_max_mantissa);
                }
                if (__pyx_3) {

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":293 */
                  __pyx_v_max_mantissa = __pyx_v_mantissa;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":294 */
                  __pyx_v_pointer_state = __pyx_v_prev_state;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":295 */
                  __pyx_v_pointer_a = __pyx_v_a;

                  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":296 */
                  __pyx_v_pointer_b = __pyx_v_b;
                  goto __pyx_L53;
                }
                __pyx_L53:;
              }
            }
          }
        }
        __pyx_L25:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":298 */
        __pyx_3 = __pyx_v_viterbi;
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":299 */
          __pyx_v_mantissa = __pyx_v_max_mantissa;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":300 */
          __pyx_3 = (__pyx_v_track_data != 0);
          if (__pyx_3) {
            (__pyx_v_track_data[((((__pyx_v_i * __pyx_v_row_length) + __pyx_v_j) * __pyx_v_N) + __pyx_v_state)]) = ((((__pyx_v_pointer_a * 256) + __pyx_v_pointer_b) * 256) + __pyx_v_pointer_state);
            goto __pyx_L55;
          }
          __pyx_L55:;
          goto __pyx_L54;
        }
        /*else*/ {
          __pyx_v_mantissa = __pyx_v_partial_sum;
        }
        __pyx_L54:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":306 */
        __pyx_3 = __pyx_v_dy;
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":307 */
          __pyx_v_y = (__pyx_v_y_index[__pyx_v_j]);

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":308 */
          __pyx_3 = __pyx_v_dx;
          if (__pyx_3) {
            __pyx_v_d_score = (__pyx_v_match_score_data[((((__pyx_v_bin * __pyx_v_max_x) + __pyx_v_x) * __pyx_v_max_y) + __pyx_v_y)]);
            goto __pyx_L57;
          }
          /*else*/ {
            __pyx_v_d_score = (__pyx_v_ygap_score_data[((__pyx_v_bin * __pyx_v_max_y) + __pyx_v_y)]);
          }
          __pyx_L57:;
          goto __pyx_L56;
        }
        __pyx_3 = __pyx_v_dx;
        if (__pyx_3) {
          __pyx_v_d_score = (__pyx_v_xgap_score_data[((__pyx_v_bin * __pyx_v_max_x) + __pyx_v_x)]);
          goto __pyx_L56;
        }
        __pyx_3 = __pyx_v_use_logs;
        if (__pyx_3) {
          __pyx_v_d_score = 0.0;
          goto __pyx_L56;
        }
        /*else*/ {
          __pyx_v_d_score = 1.0;
        }
        __pyx_L56:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":319 */
        __pyx_3 = __pyx_v_use_logs;
        if (__pyx_3) {
          __pyx_v_mantissa += __pyx_v_d_score;
          goto __pyx_L58;
        }
        /*else*/ {
          __pyx_v_mantissa *= __pyx_v_d_score;
        }
        __pyx_L58:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":324 */
        (__pyx_v_current_row_data[((__pyx_v_j * __pyx_v_N) + __pyx_v_state)]) = __pyx_v_mantissa;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":325 */
        __pyx_3 = __pyx_v_use_scaling;
        if (__pyx_3) {
          (__pyx_v_current_row_ex_data[((__pyx_v_j * __pyx_v_N) + __pyx_v_state)]) = __pyx_v_max_exponent;
          goto __pyx_L59;
        }
        __pyx_L59:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":328 */
        __pyx_3 = __pyx_v_local;
        if (__pyx_3) {
          __pyx_3 = __pyx_v_dx;
          if (__pyx_3) {
            __pyx_3 = __pyx_v_dy;
          }
        }
        if (__pyx_3) {
          __pyx_3 = __pyx_v_use_scaling;
          if (__pyx_3) {
            __pyx_3 = (__pyx_v_max_exponent > __pyx_v_overall_max_exponent);
          }
          if (!__pyx_3) {
            __pyx_3 = (!__pyx_v_use_scaling);
            if (!__pyx_3) {
              __pyx_3 = (__pyx_v_max_exponent == __pyx_v_overall_max_exponent);
            }
            if (__pyx_3) {
              __pyx_3 = (__pyx_v_mantissa >= __pyx_v_overall_max_mantissa);
            }
          }
          if (__pyx_3) {

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":332 */
            __pyx_v_overall_max_exponent = __pyx_v_max_exponent;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":333 */
            __pyx_v_overall_max_mantissa = __pyx_v_mantissa;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":334 */
            __pyx_v_last_i = __pyx_v_i;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":335 */
            __pyx_v_last_j = __pyx_v_j;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":336 */
            __pyx_v_last_state = __pyx_v_state;
            goto __pyx_L61;
          }
          __pyx_L61:;
          goto __pyx_L60;
        }
        __pyx_L60:;
      }
    }
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":337 */
  __pyx_3 = (!__pyx_v_local);
  if (__pyx_3) {

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":338 */
    __pyx_v_last_i = (__pyx_v_i_high - 1);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":339 */
    __pyx_v_last_j = (__pyx_v_j_high - 1);

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":340 */
    __pyx_v_last_state = __pyx_v_state;
    goto __pyx_L62;
  }
  /*else*/ {

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":342 */
    __pyx_v_mantissa = __pyx_v_overall_max_mantissa;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":343 */
    __pyx_v_max_exponent = __pyx_v_overall_max_exponent;
  }
  __pyx_L62:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":345 */
  __pyx_3 = __pyx_v_use_scaling;
  if (__pyx_3) {
    __pyx_2 = PyFloat_FromDouble((log(__pyx_v_mantissa) + (log(__pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP) * __pyx_v_max_exponent))); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 346; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L63;
  }
  __pyx_3 = __pyx_v_use_logs;
  if (__pyx_3) {
    __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 348; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_1;
    __pyx_1 = 0;
    goto __pyx_L63;
  }
  /*else*/ {
    __pyx_10 = PyFloat_FromDouble(log(__pyx_v_mantissa)); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 350; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_10;
    __pyx_10 = 0;
  }
  __pyx_L63:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":351 */
  __pyx_11 = PyInt_FromLong(__pyx_v_last_i); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_v_last_j); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_11);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
  __pyx_11 = 0;
  __pyx_2 = 0;
  __pyx_10 = PyInt_FromLong(__pyx_v_last_state); if (!__pyx_10) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; goto __pyx_L1;}
  __pyx_11 = PyTuple_New(3); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 351; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_11, 0, __pyx_1);
  PyTuple_SET_ITEM(__pyx_11, 1, __pyx_10);
  Py_INCREF(__pyx_v_score);
  PyTuple_SET_ITEM(__pyx_11, 2, __pyx_v_score);
  __pyx_1 = 0;
  __pyx_10 = 0;
  __pyx_r = __pyx_11;
  __pyx_11 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_10);
  Py_XDECREF(__pyx_11);
  __Pyx_AddTraceback("cogent.align._pairwise_pogs.calc_rows");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_i_sources);
  Py_DECREF(__pyx_v_j_sources);
  Py_DECREF(__pyx_v_mantissas);
  Py_DECREF(__pyx_v_exponents);
  Py_DECREF(__pyx_v_pog1);
  Py_DECREF(__pyx_v_pog2);
  Py_DECREF(__pyx_v_j_sources_offsets);
  Py_DECREF(__pyx_v_i_sources_offsets);
  Py_DECREF(__pyx_v_score);
  Py_DECREF(__pyx_v_plan);
  Py_DECREF(__pyx_v_seq1_index);
  Py_DECREF(__pyx_v_seq2_index);
  Py_DECREF(__pyx_v_preds);
  Py_DECREF(__pyx_v_state_directions);
  Py_DECREF(__pyx_v_T);
  Py_DECREF(__pyx_v_xgap_scores);
  Py_DECREF(__pyx_v_ygap_scores);
  Py_DECREF(__pyx_v_match_scores);
  Py_DECREF(__pyx_v_rows);
  Py_DECREF(__pyx_v_track);
  return __pyx_r;
}

static struct PyMethodDef __pyx_methods[] = {
  {"fmpt", (PyCFunction)__pyx_f_6cogent_5align_14_pairwise_pogs_fmpt, METH_VARARGS|METH_KEYWORDS, 0},
  {"calc_rows", (PyCFunction)__pyx_f_6cogent_5align_14_pairwise_pogs_calc_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cogent_5align_14_pairwise_pogs_calc_rows},
  {0, 0, 0, 0}
};

static void __pyx_init_filenames(void); /*proto*/

PyMODINIT_FUNC init_pairwise_pogs(void); /*proto*/
PyMODINIT_FUNC init_pairwise_pogs(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  int __pyx_5;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_pairwise_pogs", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 1; goto __pyx_L1;};

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/../../include/numerical_pyrex.pyx":13 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k17p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":11 */
  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
  __pyx_1 = 0;
  __pyx_2 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_version_info, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 11; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":12 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k17p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 12; goto __pyx_L1;}

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":15 */
  __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP = pow(2.0, 50);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":16 */
  __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_FLOAT_VALUE = (1.0 / __pyx_v_6cogent_5align_14_pairwise_pogs_SCALE_STEP);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":19 */
  __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_XCOUNT = 256;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":22 */
  __pyx_v_6cogent_5align_14_pairwise_pogs_MIN_SCALE = (-10000);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":23 */
  __pyx_v_6cogent_5align_14_pairwise_pogs_MAX_SCALE = 10000;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":25 */
  Py_INCREF(__pyx_k20p);
  __pyx_d1 = __pyx_k20p;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_pogs.pyx":28 */
  __pyx_d2 = 0;
  __pyx_4 = PyInt_AsLong(Py_False); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 32; goto __pyx_L1;}
  __pyx_d3 = __pyx_4;
  __pyx_5 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; goto __pyx_L1;}
  __pyx_d4 = __pyx_5;
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("cogent.align._pairwise_pogs");
}

static char *__pyx_filenames[] = {
  "numerical_pyrex.pyx",
  "_pairwise_pogs.pyx",
};

/* Runtime support code */

static void __pyx_init_filenames(void) {
  __pyx_f = __pyx_filenames;
}

static void __Pyx_WriteUnraisable(char *name) {
    PyObject *old_exc, *old_val, *old_tb;
    PyObject *ctx;
    PyErr_Fetch(&old_exc, &old_val, &old_tb);
    ctx = PyString_FromString(name);
    PyErr_Restore(old_exc, old_val, old_tb);
    if (!ctx)
        ctx = Py_None;
    PyErr_WriteUnraisable(ctx);
}

static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) {
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    /* First, check the traceback argument, replacing None with NULL. */
    if (tb == Py_None) {
        Py_DECREF(tb);
        tb = 0;
    }
    else if (tb != NULL && !PyTraceBack_Check(tb)) {
        PyErr_SetString(PyExc_TypeError,
            "raise: arg 3 must be a traceback or None");
        goto raise_error;
    }
    /* Next, replace a missing value with None */
    if (value == NULL) {
        value = Py_None;
        Py_INCREF(value);
    }
    #if PY_VERSION_HEX < 0x02050000
    if (!PyClass_Check(type))
    #else
    if (!PyType_Check(type))
    #endif
    {
        /* Raising an instance.  The value should be a dummy. */
        if (value != Py_None) {
            PyErr_SetString(PyExc_TypeError,
                "instance exception may not have a separate value");
            goto raise_error;
        }
        /* Normalize to raise <class>, <instance> */
        Py_DECREF(value);
        value = type;
        #if PY_VERSION_HEX < 0x02050000
            if (PyInstance_Check(type)) {
                type = (PyObject*) ((PyInstanceObject*)type)->in_class;
                Py_INCREF(type);
            }
            else {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception must be an old-style class or instance");
                goto raise_error;
            }
        #else
            type = (PyObject*) type->ob_type;
            Py_INCREF(type);
            if (!PyType_IsSubtype((PyTypeObject *)type, (PyTypeObject *)PyExc_BaseException)) {
                PyErr_SetString(PyExc_TypeError,
                    "raise: exception class must be a subclass of BaseException");
                goto raise_error;
            }
        #endif
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name) {
    PyObject *result;
    result = PyObject_GetAttr(dict, name);
    if (!result)
        PyErr_SetObject(PyExc_NameError, name);
    return result;
}

static void __Pyx_UnpackError(void) {
    PyErr_SetString(PyExc_ValueError, "unpack sequence of wrong size");
}

static PyObject *__Pyx_UnpackItem(PyObject *iter) {
    PyObject *item;
    if (!(item = PyIter_Next(iter))) {
        if (!PyErr_Occurred())
            __Pyx_UnpackError();
    }
    return item;
}

static int __Pyx_EndUnpack(PyObject *iter) {
    PyObject *item;
    if ((item = PyIter_Next(iter))) {
        Py_DECREF(item);
        __Pyx_UnpackError();
        return -1;
    }
    else if (!PyErr_Occurred())
        return 0;
    else
        return -1;
}

static PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i) {
    PyTypeObject *t = o->ob_type;
    PyObject *r;
    if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
        r = PySequence_GetItem(o, i);
    else {
        PyObject *j = PyInt_FromLong(i);
        if (!j)
            return 0;
        r = PyObject_GetItem(o, j);
        Py_DECREF(j);
    }
    return r;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        if (t->i)
            PyString_InternInPlace(t->p);
        ++t;
    }
    return 0;
}

#include "compile.h"
#include "frameobject.h"
#include "traceback.h"

static void __Pyx_AddTraceback(char *funcname) {
    PyObject *py_srcfile = 0;
    PyObject *py_funcname = 0;
    PyObject *py_globals = 0;
    PyObject *empty_tuple = 0;
    PyObject *empty_string = 0;
    PyCodeObject *py_code = 0;
    PyFrameObject *py_frame = 0;
    
    py_srcfile = PyString_FromString(__pyx_filename);
    if (!py_srcfile) goto bad;
    py_funcname = PyString_FromString(funcname);
    if (!py_funcname) goto bad;
    py_globals = PyModule_GetDict(__pyx_m);
    if (!py_globals) goto bad;
    empty_tuple = PyTuple_New(0);
    if (!empty_tuple) goto bad;
    empty_string = PyString_FromString("");
    if (!empty_string) goto bad;
    py_code = PyCode_New(
        0,            /*int argcount,*/
        0,            /*int nlocals,*/
        0,            /*int stacksize,*/
        0,            /*int flags,*/
        empty_string, /*PyObject *code,*/
        empty_tuple,  /*PyObject *consts,*/
        empty_tuple,  /*PyObject *names,*/
        empty_tuple,  /*PyObject *varnames,*/
        empty_tuple,  /*PyObject *freevars,*/
        empty_tuple,  /*PyObject *cellvars,*/
        py_srcfile,   /*PyObject *filename,*/
        py_funcname,  /*PyObject *name,*/
        __pyx_lineno,   /*int firstlineno,*/
        empty_string  /*PyObject *lnotab*/
    );
    if (!py_code) goto bad;
    py_frame = PyFrame_New(
        PyThreadState_Get(), /*PyThreadState *tstate,*/
        py_code,             /*PyCodeObject *code,*/
        py_globals,          /*PyObject *globals,*/
        0                    /*PyObject *locals*/
    );
    if (!py_frame) goto bad;
    py_frame->f_lineno = __pyx_lineno;
    PyTraceBack_Here(py_frame);
bad:
    Py_XDECREF(py_srcfile);
    Py_XDECREF(py_funcname);
    Py_XDECREF(empty_tuple);
    Py_XDECREF(empty_string);
    Py_XDECREF(py_code);
    Py_XDECREF(py_frame);
}
