/* Generated by Pyrex 0.9.8.5 on Mon Jun 15 13:04:24 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_seqs */


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

typedef PyObject *__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType;

static double __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP;
static double __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE;
static int __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_XCOUNT;
static long __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;
static long __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_SCALE;
static double *__pyx_f_6cogent_5align_14_pairwise_seqs_uncheckedArrayDouble(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,char,int,int,int **); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray1D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,char,int,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,char,int,int *,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,char,int,int *,int *,int *); /*proto*/
static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray4D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,char,int,int *,int *,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble1D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble2D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble3D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *,int *,int *); /*proto*/
static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble4D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *,int *,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong1D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong2D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong3D(__pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType,int *,int *,int *); /*proto*/
static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong4D(__pyx_t_6cogent_5align_14_pairwise_seqs_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[] = "fmpt";
static char __pyx_k12[] = "transition is a negative probability";
static char __pyx_k13[] = "product is a negative probability";
static char __pyx_k14[] = "underflows";
static char __pyx_k15[] = "is unexpectedly large";
static char __pyx_k16[] = "('1', '3')";
static char __pyx_k17[] = "__version__";
static char __pyx_k18[] = "version_info";
static char __pyx_k19[] = "";

static PyObject *__pyx_n___array_struct__;
static PyObject *__pyx_n___version__;
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_k12p;
static PyObject *__pyx_k13p;
static PyObject *__pyx_k15p;
static PyObject *__pyx_k16p;
static PyObject *__pyx_k19p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n___array_struct__, 1, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_n___version__, 1, __pyx_k17, sizeof(__pyx_k17)},
  {&__pyx_n_chr, 1, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_n_fmpt, 1, __pyx_k11, sizeof(__pyx_k11)},
  {&__pyx_n_underflows, 1, __pyx_k14, sizeof(__pyx_k14)},
  {&__pyx_n_version_info, 1, __pyx_k18, sizeof(__pyx_k18)},
  {&__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_k12p, 0, __pyx_k12, sizeof(__pyx_k12)},
  {&__pyx_k13p, 0, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_k15p, 0, __pyx_k15, sizeof(__pyx_k15)},
  {&__pyx_k16p, 0, __pyx_k16, sizeof(__pyx_k16)},
  {&__pyx_k19p, 0, __pyx_k19, sizeof(__pyx_k19)},
  {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_seqs */

static double *__pyx_f_6cogent_5align_14_pairwise_seqs_uncheckedArrayDouble(__pyx_t_6cogent_5align_14_pairwise_seqs_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/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/include/numerical_pyrex.pyx":35 */
  __pyx_v_a = ((struct PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_cobj));

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/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_seqs.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_seqs_checkArray(__pyx_t_6cogent_5align_14_pairwise_seqs_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/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/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/include/numerical_pyrex.pyx":46 */
  __pyx_v_a = ((struct PyArrayInterface *)PyCObject_AsVoidPtr(__pyx_v_cobj));

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/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/include/numerical_pyrex.pyx":51 */
  __pyx_v_typecode2 = __pyx_v_a->typekind;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/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/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/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/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/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/include/numerical_pyrex.pyx":67 */
    __pyx_v_val = (__pyx_v_a->shape[__pyx_v_dimension]);

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

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/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/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_seqs.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_seqs_checkArray1D(__pyx_t_6cogent_5align_14_pairwise_seqs_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/include/numerical_pyrex.pyx":85 */
  (__pyx_v_dims[0]) = __pyx_v_x;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/include/numerical_pyrex.pyx":86 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_seqs_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_seqs.checkArray1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray2D(__pyx_t_6cogent_5align_14_pairwise_seqs_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/include/numerical_pyrex.pyx":91 */
  (__pyx_v_dims[0]) = __pyx_v_x;

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/include/numerical_pyrex.pyx":93 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_seqs_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_seqs.checkArray2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray3D(__pyx_t_6cogent_5align_14_pairwise_seqs_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/include/numerical_pyrex.pyx":98 */
  (__pyx_v_dims[0]) = __pyx_v_x;

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

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/include/numerical_pyrex.pyx":101 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_seqs_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_seqs.checkArray3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static void *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArray4D(__pyx_t_6cogent_5align_14_pairwise_seqs_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/include/numerical_pyrex.pyx":106 */
  (__pyx_v_dims[0]) = __pyx_v_w;

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

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

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/include/numerical_pyrex.pyx":110 */
  __pyx_1 = __pyx_f_6cogent_5align_14_pairwise_seqs_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_seqs.checkArray4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble1D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayDouble1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble2D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayDouble2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble3D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayDouble3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static double *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble4D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayDouble4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong1D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayLong1D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong2D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayLong2D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong3D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayLong3D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static long *__pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong4D(__pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_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_seqs.checkArrayLong4D");
  __pyx_r = NULL;
  __pyx_L0:;
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}

static PyObject *__pyx_f_6cogent_5align_14_pairwise_seqs_fmpt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_6cogent_5align_14_pairwise_seqs_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 = 28; 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 = 28; 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_seqs.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_seqs_calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_6cogent_5align_14_pairwise_seqs_calc_rows[] = "The faster, sequence only (no POG) version.  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    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_seqs_calc_rows(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  __pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType __pyx_v_plan = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType __pyx_v_seq1_index = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_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_seqs_ArrayType __pyx_v_state_directions = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType __pyx_v_T = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType __pyx_v_xgap_scores = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_ArrayType __pyx_v_ygap_scores = 0;
  __pyx_t_6cogent_5align_14_pairwise_seqs_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_j;
  int __pyx_v_state;
  int __pyx_v_prev_state;
  int __pyx_v_N;
  int __pyx_v_row_length;
  int __pyx_v_a;
  int __pyx_v_b;
  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_source_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;
  double *__pyx_v_current_row_data;
  double *__pyx_v_prev_row_data;
  long *__pyx_v_current_row_ex_data;
  long *__pyx_v_prev_row_ex_data;
  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;
  int __pyx_v_row_count;
  int __pyx_v_plan_index2;
  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;
  double __pyx_v_impossible;
  PyObject *__pyx_v_plan_index1;
  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;
  double __pyx_10;
  PyObject *__pyx_11 = 0;
  PyObject *__pyx_12 = 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_mantissas = Py_None; Py_INCREF(Py_None);
  __pyx_v_exponents = Py_None; Py_INCREF(Py_None);
  __pyx_v_plan_index1 = Py_None; Py_INCREF(Py_None);
  __pyx_v_score = Py_None; Py_INCREF(Py_None);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":66 */
  __pyx_1 = PyObject_GetIter(__pyx_v_rows); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; goto __pyx_L1;}
  __pyx_2 = __Pyx_UnpackItem(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 66; 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 = 66; 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 = 66; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":68 */
  #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 = 68; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":69 */
  #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 = 69; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":70 */
  #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 = 70; goto __pyx_L1;}
  }
  #endif

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

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

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

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

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

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

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

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

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

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

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":90 */
  __pyx_7 = __pyx_f_6cogent_5align_14_pairwise_seqs_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 = 90; goto __pyx_L1;}
  __pyx_v_match_score_data = __pyx_7;

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

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":95 */
  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 = 96; goto __pyx_L1;}
    }
    #endif
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":97 */
  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 = 98; goto __pyx_L1;}
    }
    #endif
  }

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":100 */
  #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 = 100; goto __pyx_L1;}
  }
  #endif

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":103 */
  __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_seqs.pyx":108 */
  __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_seqs_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 = 109; 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_seqs.pyx":114 */
  __pyx_v_overall_max_exponent = __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":116 */
  __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_seqs.pyx":118 */
  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_seqs.pyx":119 */
    __pyx_v_x = (__pyx_v_x_index[__pyx_v_i]);

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

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":124 */
    __pyx_1 = PyInt_FromLong((__pyx_v_plan_data[__pyx_v_i])); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 124; goto __pyx_L1;}
    Py_DECREF(__pyx_v_plan_index1);
    __pyx_v_plan_index1 = __pyx_1;
    __pyx_1 = 0;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":125 */
    __pyx_3 = (__pyx_v_i > 0);
    if (__pyx_3) {
      __pyx_v_plan_index2 = (__pyx_v_plan_data[(__pyx_v_i - 1)]);
      goto __pyx_L11;
    }
    /*else*/ {
      __pyx_v_prev_row_data = NULL;
    }
    __pyx_L11:;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":129 */
    __pyx_2 = PyObject_GetItem(__pyx_v_mantissas, __pyx_v_plan_index1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; goto __pyx_L1;}
    __pyx_4 = __pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayDouble2D(__pyx_2,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_4 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 129; 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_seqs.pyx":130 */
    __pyx_3 = __pyx_v_use_scaling;
    if (__pyx_3) {
      __pyx_1 = PyObject_GetItem(__pyx_v_exponents, __pyx_v_plan_index1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; goto __pyx_L1;}
      __pyx_6 = __pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong2D(__pyx_1,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_6 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 131; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_v_current_row_ex_data = __pyx_6;
      goto __pyx_L12;
    }
    __pyx_L12:;

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

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

      /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":134 */
      __pyx_3 = __pyx_v_use_scaling;
      if (__pyx_3) {
        __pyx_1 = __Pyx_GetItemInt(__pyx_v_exponents, __pyx_v_plan_index2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; goto __pyx_L1;}
        __pyx_6 = __pyx_f_6cogent_5align_14_pairwise_seqs_checkArrayLong2D(__pyx_1,(&__pyx_v_row_length),(&__pyx_v_N)); if (__pyx_6 == NULL) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 135; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_v_prev_row_ex_data = __pyx_6;
        goto __pyx_L14;
      }
      __pyx_L14:;
      goto __pyx_L13;
    }
    __pyx_L13:;

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":140 */
    for (__pyx_v_j = __pyx_v_j_low; __pyx_v_j < __pyx_v_j_high; ++__pyx_v_j) {
      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_seqs.pyx":143 */
        __pyx_v_state = (__pyx_v_dest_states_data[((__pyx_v_dest_state * 4) + 0)]);

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

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

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

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

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":149 */
        __pyx_v_max_exponent = __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE;

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

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

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":153 */
        __pyx_v_a = __pyx_v_dx;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":154 */
        __pyx_v_b = __pyx_v_dy;

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

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":157 */
          __pyx_v_source_i = (__pyx_v_i - 1);

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":158 */
          __pyx_v_source_row_data = __pyx_v_prev_row_data;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":159 */
          __pyx_v_source_row_ex_data = __pyx_v_prev_row_ex_data;
          goto __pyx_L19;
        }
        /*else*/ {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":161 */
          __pyx_v_source_i = __pyx_v_i;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":162 */
          __pyx_v_source_row_data = __pyx_v_current_row_data;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":163 */
          __pyx_v_source_row_ex_data = __pyx_v_current_row_ex_data;
        }
        __pyx_L19:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":165 */
        __pyx_v_prev_j = (__pyx_v_j - __pyx_v_dy);

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":166 */
        __pyx_3 = (__pyx_v_prev_j < 0);
        if (__pyx_3) {
          goto __pyx_L17;
          goto __pyx_L20;
        }
        __pyx_L20:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":169 */
        __pyx_3 = (__pyx_v_source_i < 0);
        if (__pyx_3) {
          goto __pyx_L17;
          goto __pyx_L21;
        }
        __pyx_L21:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":172 */
        __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_prev_j == 0);
          if (__pyx_3) {
            __pyx_3 = (__pyx_v_source_i == 0);
          }
        }
        if (__pyx_3) {

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":173 */
          __pyx_10 = (__pyx_v_T_data[((0 * __pyx_v_N) + __pyx_v_state)]);
          __pyx_v_partial_sum = __pyx_10;
          __pyx_v_max_mantissa = __pyx_10;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":174 */
          __pyx_v_max_exponent = 0;

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":175 */
          __pyx_v_pointer_state = 0;

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

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":177 */
          __pyx_v_pointer_b = __pyx_v_b;
          goto __pyx_L22;
        }
        __pyx_L22:;

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

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

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

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

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

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":185 */
            __pyx_3 = (__pyx_v_exponent == __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE);
            if (__pyx_3) {
              goto __pyx_L24;
              goto __pyx_L26;
            }
            __pyx_L26:;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":189 */
            __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_seqs.pyx":191 */
            __pyx_3 = (__pyx_v_mantissa < __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE);
            if (__pyx_3) {

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":192 */
              __pyx_3 = (__pyx_v_mantissa == 0.0);
              if (__pyx_3) {
                goto __pyx_L24;
                goto __pyx_L28;
              }
              __pyx_L28:;

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

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":195 */
                __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 = 196; goto __pyx_L1;}
                  __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  __pyx_11 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  __pyx_12 = PyTuple_New(3); if (!__pyx_12) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  PyTuple_SET_ITEM(__pyx_12, 0, __pyx_1);
                  PyTuple_SET_ITEM(__pyx_12, 1, __pyx_11);
                  Py_INCREF(__pyx_k12p);
                  PyTuple_SET_ITEM(__pyx_12, 2, __pyx_k12p);
                  __pyx_1 = 0;
                  __pyx_11 = 0;
                  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_12); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  Py_DECREF(__pyx_2); __pyx_2 = 0;
                  Py_DECREF(__pyx_12); __pyx_12 = 0;
                  __pyx_11 = PyTuple_New(1); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  PyTuple_SET_ITEM(__pyx_11, 0, __pyx_1);
                  __pyx_1 = 0;
                  __pyx_2 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_11); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  Py_DECREF(__pyx_11); __pyx_11 = 0;
                  __Pyx_Raise(__pyx_2, 0, 0);
                  Py_DECREF(__pyx_2); __pyx_2 = 0;
                  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 196; goto __pyx_L1;}
                  goto __pyx_L30;
                }
                __pyx_L30:;

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

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

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":201 */
                __pyx_v_mantissa *= __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP;

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

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

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":208 */
              __pyx_v_mantissa *= __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE;

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

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":210 */
              __pyx_3 = (__pyx_v_exponent > __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_SCALE);
              if (__pyx_3) {
                __pyx_12 = __Pyx_GetName(__pyx_m, __pyx_n_fmpt); if (!__pyx_12) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                __pyx_1 = PyFloat_FromDouble(__pyx_v_mantissa); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                __pyx_11 = PyInt_FromLong(__pyx_v_exponent); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
                PyTuple_SET_ITEM(__pyx_2, 1, __pyx_11);
                Py_INCREF(__pyx_k15p);
                PyTuple_SET_ITEM(__pyx_2, 2, __pyx_k15p);
                __pyx_1 = 0;
                __pyx_11 = 0;
                __pyx_1 = PyObject_CallObject(__pyx_12, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                Py_DECREF(__pyx_12); __pyx_12 = 0;
                Py_DECREF(__pyx_2); __pyx_2 = 0;
                __pyx_11 = PyTuple_New(1); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                PyTuple_SET_ITEM(__pyx_11, 0, __pyx_1);
                __pyx_1 = 0;
                __pyx_12 = PyObject_CallObject(PyExc_ArithmeticError, __pyx_11); if (!__pyx_12) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                Py_DECREF(__pyx_11); __pyx_11 = 0;
                __Pyx_Raise(__pyx_12, 0, 0);
                Py_DECREF(__pyx_12); __pyx_12 = 0;
                {__pyx_filename = __pyx_f[1]; __pyx_lineno = 211; goto __pyx_L1;}
                goto __pyx_L34;
              }
              __pyx_L34:;
              goto __pyx_L27;
            }
            __pyx_L27:;

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

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

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

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

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":221 */
              __pyx_v_max_exponent = __pyx_v_exponent;
              goto __pyx_L35;
            }
            __pyx_L35:;

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

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

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":225 */
              __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_seqs.pyx":226 */
                __pyx_v_max_mantissa = __pyx_v_mantissa;

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

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

                /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":229 */
                __pyx_v_pointer_b = __pyx_v_b;
                goto __pyx_L38;
              }
              __pyx_L38:;
              goto __pyx_L37;
            }
            __pyx_3 = (__pyx_v_exponent == (__pyx_v_max_exponent - 1));
            if (__pyx_3) {
              __pyx_v_sub_partial_sum += __pyx_v_mantissa;
              goto __pyx_L37;
            }
            __pyx_L37:;
            __pyx_L24:;
          }

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":234 */
          __pyx_v_partial_sum += (__pyx_v_sub_partial_sum * __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE);
          goto __pyx_L23;
        }
        /*else*/ {
          for (__pyx_v_prev_state = 1; __pyx_v_prev_state < __pyx_v_N; ++__pyx_v_prev_state) {

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

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":238 */
            __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_L41;
            }
            /*else*/ {

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":243 */
              __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_seqs.pyx":244 */
              __pyx_v_partial_sum += __pyx_v_mantissa;
            }
            __pyx_L41:;

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":245 */
            __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_seqs.pyx":246 */
              __pyx_v_max_mantissa = __pyx_v_mantissa;

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

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

              /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":249 */
              __pyx_v_pointer_b = __pyx_v_b;
              goto __pyx_L42;
            }
            __pyx_L42:;
          }
        }
        __pyx_L23:;

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

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

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":253 */
          __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_L44;
          }
          __pyx_L44:;
          goto __pyx_L43;
        }
        /*else*/ {
          __pyx_v_mantissa = __pyx_v_partial_sum;
        }
        __pyx_L43:;

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

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

          /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":261 */
          __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_L46;
          }
          /*else*/ {
            __pyx_v_d_score = (__pyx_v_ygap_score_data[((__pyx_v_bin * __pyx_v_max_y) + __pyx_v_y)]);
          }
          __pyx_L46:;
          goto __pyx_L45;
        }
        __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_L45;
        }
        __pyx_3 = __pyx_v_use_logs;
        if (__pyx_3) {
          __pyx_v_d_score = 0.0;
          goto __pyx_L45;
        }
        /*else*/ {
          __pyx_v_d_score = 1.0;
        }
        __pyx_L45:;

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

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":277 */
        (__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_seqs.pyx":278 */
        __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_L48;
        }
        __pyx_L48:;

        /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":281 */
        __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_seqs.pyx":285 */
            __pyx_v_overall_max_exponent = __pyx_v_max_exponent;

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

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

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

            /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":289 */
            __pyx_v_last_state = __pyx_v_state;
            goto __pyx_L50;
          }
          __pyx_L50:;
          goto __pyx_L49;
        }
        __pyx_L49:;
        __pyx_L17:;
      }
    }
  }

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

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

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

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":293 */
    __pyx_v_last_state = __pyx_v_state;
    goto __pyx_L51;
  }
  /*else*/ {

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

    /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":296 */
    __pyx_v_max_exponent = __pyx_v_overall_max_exponent;
  }
  __pyx_L51:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":298 */
  __pyx_3 = __pyx_v_use_scaling;
  if (__pyx_3) {
    __pyx_2 = PyFloat_FromDouble((log(__pyx_v_mantissa) + (log(__pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP) * __pyx_v_max_exponent))); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L52;
  }
  __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 = 301; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_1;
    __pyx_1 = 0;
    goto __pyx_L52;
  }
  /*else*/ {
    __pyx_11 = PyFloat_FromDouble(log(__pyx_v_mantissa)); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; goto __pyx_L1;}
    Py_DECREF(__pyx_v_score);
    __pyx_v_score = __pyx_11;
    __pyx_11 = 0;
  }
  __pyx_L52:;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":304 */
  __pyx_12 = PyInt_FromLong(__pyx_v_last_i); if (!__pyx_12) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_v_last_j); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_12);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
  __pyx_12 = 0;
  __pyx_2 = 0;
  __pyx_11 = PyInt_FromLong(__pyx_v_last_state); if (!__pyx_11) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
  __pyx_12 = PyTuple_New(3); if (!__pyx_12) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_12, 0, __pyx_1);
  PyTuple_SET_ITEM(__pyx_12, 1, __pyx_11);
  Py_INCREF(__pyx_v_score);
  PyTuple_SET_ITEM(__pyx_12, 2, __pyx_v_score);
  __pyx_1 = 0;
  __pyx_11 = 0;
  __pyx_r = __pyx_12;
  __pyx_12 = 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_11);
  Py_XDECREF(__pyx_12);
  __Pyx_AddTraceback("cogent.align._pairwise_seqs.calc_rows");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_mantissas);
  Py_DECREF(__pyx_v_exponents);
  Py_DECREF(__pyx_v_plan_index1);
  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_seqs_fmpt, METH_VARARGS|METH_KEYWORDS, 0},
  {"calc_rows", (PyCFunction)__pyx_f_6cogent_5align_14_pairwise_seqs_calc_rows, METH_VARARGS|METH_KEYWORDS, __pyx_doc_6cogent_5align_14_pairwise_seqs_calc_rows},
  {0, 0, 0, 0}
};

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

PyMODINIT_FUNC init_pairwise_seqs(void); /*proto*/
PyMODINIT_FUNC init_pairwise_seqs(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_seqs", __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/include/numerical_pyrex.pyx":13 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___version__, __pyx_k16p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 13; goto __pyx_L1;}

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":13 */
  __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 13; 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 = 13; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

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

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":17 */
  __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP = pow(2.0, 50);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":18 */
  __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_FLOAT_VALUE = (1.0 / __pyx_v_6cogent_5align_14_pairwise_seqs_SCALE_STEP);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":21 */
  __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_XCOUNT = 256;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":24 */
  __pyx_v_6cogent_5align_14_pairwise_seqs_MIN_SCALE = (-10000);

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":25 */
  __pyx_v_6cogent_5align_14_pairwise_seqs_MAX_SCALE = 10000;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":27 */
  Py_INCREF(__pyx_k19p);
  __pyx_d1 = __pyx_k19p;

  /* "/Users/mcdonald/ResearchWork/PyCogent-v1.1/cogent/align/_pairwise_seqs.pyx":30 */
  __pyx_d2 = 0;
  __pyx_4 = PyInt_AsLong(Py_False); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 34; goto __pyx_L1;}
  __pyx_d3 = __pyx_4;
  __pyx_5 = PyInt_AsLong(Py_True); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; 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_seqs");
}

static char *__pyx_filenames[] = {
  "numerical_pyrex.pyx",
  "_pairwise_seqs.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);
}
