/* Generated by Pyrex 0.9.4.1 on Tue Nov 28 20:48:09 2006 */

#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
#ifdef __cplusplus
#define __PYX_EXTERN_C extern "C"
#else
#define __PYX_EXTERN_C extern
#endif
__PYX_EXTERN_C double pow(double, double);
#include "array_interface.h"
#include "common.h"
#include "wavelets.h"
#include "wt.h"
#include "math.h"


typedef struct {const char *s; const void **p;} __Pyx_CApiTabEntry; /*proto*/
typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t); /*proto*/
static int __Pyx_EndUnpack(PyObject *, Py_ssize_t); /*proto*/
static int __Pyx_PrintItem(PyObject *); /*proto*/
static int __Pyx_PrintNewline(void); /*proto*/
static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
static void __Pyx_ReRaise(void); /*proto*/
static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
static PyObject *__Pyx_GetExcValue(void); /*proto*/
static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name); /*proto*/
static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
static int __Pyx_GetStarArgs(PyObject **args, PyObject **kwds, char *kwd_list[], Py_ssize_t nargs, PyObject **args2, PyObject **kwds2); /*proto*/
static void __Pyx_WriteUnraisable(char *name); /*proto*/
static void __Pyx_AddTraceback(char *funcname); /*proto*/
static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size);  /*proto*/
static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/
static int __Pyx_GetVtable(PyObject *dict, void *vtabptr); /*proto*/
static PyObject *__Pyx_CreateClass(PyObject *bases, PyObject *dict, PyObject *name, char *modname); /*proto*/
static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
static int __Pyx_InitCApi(PyObject *module); /*proto*/
static int __Pyx_ImportModuleCApi(__Pyx_CApiTabEntry *t); /*proto*/
static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/

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

/* Declarations from c_python */


/* Declarations from c_array_interface */


/* Declarations from c_wt */


/* Declarations from c_math */


/* Declarations from _pywt */

__PYX_EXTERN_C DL_EXPORT(PyTypeObject) WaveletType;

struct WaveletObject {
  PyObject_HEAD
  Wavelet (*w);
  PyObject *name;
  PyObject *number;
};

static PyTypeObject *__pyx_ptype_5_pywt_Wavelet = 0;
static char (*__pyx_k31);
static PyObject *__pyx_k32;
static int __pyx_k33;
static PyObject *__pyx_k35;
static PyObject *__pyx_k36;
static int __pyx_k37;
static int __pyx_k38;
static PyObject *__pyx_k39;
static PyObject *(__pyx_f_5_pywt_double_array_to_list(double (*),Py_ssize_t )); /*proto*/
static int (__pyx_f_5_pywt_copy_object_to_double_array(PyObject *,double (*))); /*proto*/
static int (__pyx_f_5_pywt_array_interface_as_double_array_ptr(PyObject *,unsigned int ,double (*(*)),Py_ssize_t (*),char )); /*proto*/
static int (__pyx_f_5_pywt_object_as_buffer(PyObject *,double (*(*)),Py_ssize_t (*),char )); /*proto*/
static int (__pyx_f_5_pywt_c_mode_from_object(PyObject *)); /*proto*/
static PyObject *(__pyx_f_5_pywt_wname_to_code(char (*))); /*proto*/
static PyObject *(__pyx_f_5_pywt_c_wavelet_from_object(PyObject *)); /*proto*/

/* Implementation of _pywt */

static char (__pyx_k1[]) = "Lowpass decomposition filter";
static char (__pyx_k2[]) = "Highpass decomposition filter";
static char (__pyx_k3[]) = "Lowpass reconstruction filter";
static char (__pyx_k4[]) = "Highpass reconstruction filter";
static char (__pyx_k5[]) = "Reconstruction filters length";
static char (__pyx_k6[]) = "Decomposition filters length";
static char (__pyx_k7[]) = "Wavelet family name";
static char (__pyx_k8[]) = "Short wavelet family name";
static char (__pyx_k9[]) = "Is orthogonal";
static char (__pyx_k10[]) = "Is biorthogonal";
static char (__pyx_k11[]) = "Wavelet symmetry";
static char (__pyx_k12[]) = "Number of wavelet function vanishing moments";
static char (__pyx_k13[]) = "Number of scaling function vanishing moments";
static char (__pyx_k14[]) = "Is built-in";
static char (__pyx_k15[]) = "pywt.numerix";
static char (__pyx_k17[]) = "$Id: _pywt.c 57 2006-11-28 21:42:41Z filipw $";
static char (__pyx_k18[]) = "Pyrex wrapper for low-level C wavelet transform implementation.";
static char (__pyx_k23[]) = "\n    Different ways of dealing with border distortion problem while performing\n    Discrete Wavelet Transform analysis.\n    \n    To reduce this effect the signal or image can be extended by adding extra samples.\n    \n    zpd - zero-padpadding                0  0 | x1 x2 ... xn | 0  0\n    cpd - constant-padding              x1 x1 | x1 x2 ... xn | xn xn\n    sym - symmetric-padding             x2 x1 | x1 x2 ... xn | xn xn-1\n    ppd - periodic-padding            xn-1 xn | x1 x2 ... xn | x1 x2\n    sp1 - smooth-padding               (1st derivative interpolation)\n    \n    DWT performed for these extension modes is slightly redundant, but ensure\n    a perfect reconstruction for IDWT.\n\n    per - periodization - like periodic-padding but gives the smallest number\n          of decomposition coefficients. IDWT must be performed with the same mode.\n          \n    ";
static char (__pyx_k30[]) = "";

static PyObject *__pyx_n_contiguous_array_from_any;
static PyObject *__pyx_n___id__;
static PyObject *__pyx_n___doc__;
static PyObject *__pyx_n_c_python;
static PyObject *__pyx_n_c_array_interface;
static PyObject *__pyx_n_c_wt;
static PyObject *__pyx_n_c_math;
static PyObject *__pyx_n_memory_buffer_object;
static PyObject *__pyx_n___from_object;
static PyObject *__pyx_n_MODES;
static PyObject *__pyx_n_wavelet_from_object;
static PyObject *__pyx_n_dwt_max_level;
static PyObject *__pyx_n_dwt;
static PyObject *__pyx_n_dwt_coeff_len;
static PyObject *__pyx_n_idwt;
static PyObject *__pyx_n_upcoef;
static PyObject *__pyx_n_swt_max_level;
static PyObject *__pyx_n_swt;
static PyObject *__pyx_n___all__;
static PyObject *__pyx_n_numerix;
static PyObject *__pyx_n_object;
static PyObject *__pyx_n_zpd;
static PyObject *__pyx_n_cpd;
static PyObject *__pyx_n_sym;
static PyObject *__pyx_n_ppd;
static PyObject *__pyx_n_sp1;
static PyObject *__pyx_n_per;
static PyObject *__pyx_n__asym;
static PyObject *__pyx_n_modes;
static PyObject *__pyx_n_from_object;
static PyObject *__pyx_n_staticmethod;
static PyObject *__pyx_n_Wavelet;

static PyObject *__pyx_k15p;
static PyObject *__pyx_k17p;
static PyObject *__pyx_k18p;
static PyObject *__pyx_k23p;

static PyObject *__pyx_n_append;

static PyObject *__pyx_f_5_pywt_double_array_to_list(double (*__pyx_v_data),Py_ssize_t __pyx_v_n) {
  Py_ssize_t __pyx_v_i;
  PyObject *__pyx_v_app;
  PyObject *__pyx_v_ret;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  __pyx_v_app = Py_None; Py_INCREF(Py_None);
  __pyx_v_ret = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src\arraytools.pxi":4 */
  /*     ret = [] */
  __pyx_1 = PyList_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; goto __pyx_L1;}
  Py_DECREF(__pyx_v_ret);
  __pyx_v_ret = __pyx_1;
  __pyx_1 = 0;

  /* "D:\wt\trunk\src\arraytools.pxi":5 */
  /*     app = ret.append */
  __pyx_1 = PyObject_GetAttr(__pyx_v_ret, __pyx_n_append); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}
  Py_DECREF(__pyx_v_app);
  __pyx_v_app = __pyx_1;
  __pyx_1 = 0;

  /* "D:\wt\trunk\src\arraytools.pxi":6 */
  /*     for i from 0 <= i < n: */
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {

    /* "D:\wt\trunk\src\arraytools.pxi":7 */
    /*         app(data[i]) */
    __pyx_1 = PyFloat_FromDouble((__pyx_v_data[__pyx_v_i])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1);
    __pyx_1 = 0;
    __pyx_1 = PyObject_Call(__pyx_v_app, __pyx_2, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_L2:;
  }
  __pyx_L3:;

  /* "D:\wt\trunk\src\arraytools.pxi":8 */
  /*     return ret */
  Py_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  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("_pywt.double_array_to_list");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_app);
  Py_DECREF(__pyx_v_ret);
  return __pyx_r;
}

static PyObject *__pyx_n_len;
static PyObject *__pyx_n_Exception;

static int __pyx_f_5_pywt_copy_object_to_double_array(PyObject *__pyx_v_source,double (*__pyx_v_dest)) {
  Py_ssize_t __pyx_v_i;
  Py_ssize_t __pyx_v_n;
  PyObject *__pyx_v_e;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_ssize_t __pyx_4;
  double __pyx_5;
  int __pyx_6;
  Py_INCREF(__pyx_v_source);
  __pyx_v_e = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src\arraytools.pxi":13 */
  /*     try: */
  /*try:*/ {

    /* "D:\wt\trunk\src\arraytools.pxi":14 */
    /*         n = len(source) */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L2;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L2;}
    Py_INCREF(__pyx_v_source);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_source);
    __pyx_3 = PyObject_Call(__pyx_1, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L2;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = PyInt_AsSsize_t(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 14; goto __pyx_L2;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_v_n = __pyx_4;

    /* "D:\wt\trunk\src\arraytools.pxi":15 */
    /*         for i from 0 <= i < n: */
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_n; ++__pyx_v_i) {

      /* "D:\wt\trunk\src\arraytools.pxi":16 */
      /*             dest[i] = source[i] */
      __pyx_1 = PyInt_FromSsize_t(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L2;}
      __pyx_2 = PyObject_GetItem(__pyx_v_source, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L2;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_5 = PyFloat_AsDouble(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 16; goto __pyx_L2;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      (__pyx_v_dest[__pyx_v_i]) = __pyx_5;
      __pyx_L4:;
    }
    __pyx_L5:;
  }
  goto __pyx_L3;
  __pyx_L2:;
  Py_XDECREF(__pyx_3); __pyx_3 = 0;
  Py_XDECREF(__pyx_1); __pyx_1 = 0;
  Py_XDECREF(__pyx_2); __pyx_2 = 0;

  /* "D:\wt\trunk\src\arraytools.pxi":17 */
  /*     except Exception, e: */
  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_Exception); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
  __pyx_6 = PyErr_ExceptionMatches(__pyx_3);
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__pyx_6) {
    __Pyx_AddTraceback("_pywt.copy_object_to_double_array");
    __pyx_1 = __Pyx_GetExcValue(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; goto __pyx_L1;}
    Py_DECREF(__pyx_v_e);
    __pyx_v_e = __pyx_1;
    __pyx_1 = 0;

    /* "D:\wt\trunk\src\arraytools.pxi":18 */
    /*         raise */
    __Pyx_ReRaise();
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 18; goto __pyx_L1;}

    /* "D:\wt\trunk\src\arraytools.pxi":19 */
    /*         return -1 */
    __pyx_r = (-1);
    goto __pyx_L0;
    goto __pyx_L3;
  }
  goto __pyx_L1;
  __pyx_L3:;

  /* "D:\wt\trunk\src\arraytools.pxi":20 */
  /*     return 0 */
  __pyx_r = 0;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.copy_object_to_double_array");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_e);
  Py_DECREF(__pyx_v_source);
  return __pyx_r;
}

static PyObject *__pyx_n_hasattr;
static PyObject *__pyx_n___array_struct__;


static int __pyx_f_5_pywt_array_interface_as_double_array_ptr(PyObject *__pyx_v_source,unsigned int __pyx_v_min_dims,double (*(*__pyx_v_buffer_addr)),Py_ssize_t (*__pyx_v_buffer_len),char __pyx_v_rwmode) {
  double (*__pyx_v_data);
  Py_ssize_t __pyx_v_dim1_len;
  Py_ssize_t __pyx_v_dim2_len;
  PyGenericArrayInterface (*__pyx_v_array_struct);
  PyObject *__pyx_v_cobject;
  int __pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  Py_INCREF(__pyx_v_source);
  __pyx_v_cobject = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src\arraytools.pxi":45 */
  /*     if hasattr(source, '__array_struct__'): */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_hasattr); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  Py_INCREF(__pyx_v_source);
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_source);
  Py_INCREF(__pyx_n___array_struct__);
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_n___array_struct__);
  __pyx_3 = PyObject_Call(__pyx_1, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyObject_IsTrue(__pyx_3); if (__pyx_4 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 45; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src\arraytools.pxi":46 */
    /*         cobject = source.__array_struct__ */
    __pyx_1 = PyObject_GetAttr(__pyx_v_source, __pyx_n___array_struct__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; goto __pyx_L1;}
    Py_DECREF(__pyx_v_cobject);
    __pyx_v_cobject = __pyx_1;
    __pyx_1 = 0;

    /* "D:\wt\trunk\src\arraytools.pxi":47 */
    /*         if c_python.PyCObject_Check(cobject): */
    __pyx_4 = PyCObject_Check(__pyx_v_cobject);
    if (__pyx_4) {

      /* "D:\wt\trunk\src\arraytools.pxi":48 */
      /*             array_struct = <c_array_interface.PyGenericArrayInterface*> c_python.PyCObject_AsVoidPtr(cobject) */
      __pyx_v_array_struct = ((PyGenericArrayInterface (*))PyCObject_AsVoidPtr(__pyx_v_cobject));

      /* "D:\wt\trunk\src\arraytools.pxi":50 */
      /*             if min_dims == 1: */
      __pyx_4 = (__pyx_v_min_dims == 1);
      if (__pyx_4) {

        /* "D:\wt\trunk\src\arraytools.pxi":51 */
        /*                 if not (c_array_interface.PyArrayInterface_CHECK_1D(array_struct)): */
        __pyx_4 = (!PyArrayInterface_CHECK_1D(__pyx_v_array_struct));
        if (__pyx_4) {

          /* "D:\wt\trunk\src\arraytools.pxi":53 */
          /*                     return -3 */
          __pyx_r = (-3);
          goto __pyx_L0;
          goto __pyx_L5;
        }
        __pyx_L5:;

        /* "D:\wt\trunk\src\arraytools.pxi":54 */
        /*                 dim1_len = c_array_interface.PyArrayInterface_SHAPE(array_struct, 0) */
        __pyx_v_dim1_len = PyArrayInterface_SHAPE(__pyx_v_array_struct,0);

        /* "D:\wt\trunk\src\arraytools.pxi":55 */
        /*                 if dim1_len < 1: */
        __pyx_4 = (__pyx_v_dim1_len < 1);
        if (__pyx_4) {

          /* "D:\wt\trunk\src\arraytools.pxi":57 */
          /*                     return -5 */
          __pyx_r = (-5);
          goto __pyx_L0;
          goto __pyx_L6;
        }
        __pyx_L6:;

        /* "D:\wt\trunk\src\arraytools.pxi":58 */
        /*                 buffer_len[0] = dim1_len */
        (__pyx_v_buffer_len[0]) = __pyx_v_dim1_len;
        goto __pyx_L4;
      }
      __pyx_4 = (__pyx_v_min_dims == 2);
      if (__pyx_4) {

        /* "D:\wt\trunk\src\arraytools.pxi":60 */
        /*                 if not (c_array_interface.PyArrayInterface_CHECK_2D(array_struct)): */
        __pyx_4 = (!PyArrayInterface_CHECK_2D(__pyx_v_array_struct));
        if (__pyx_4) {

          /* "D:\wt\trunk\src\arraytools.pxi":62 */
          /*                     return -3 */
          __pyx_r = (-3);
          goto __pyx_L0;
          goto __pyx_L7;
        }
        __pyx_L7:;

        /* "D:\wt\trunk\src\arraytools.pxi":63 */
        /*                 dim1_len = c_array_interface.PyArrayInterface_SHAPE(array_struct, 0) */
        __pyx_v_dim1_len = PyArrayInterface_SHAPE(__pyx_v_array_struct,0);

        /* "D:\wt\trunk\src\arraytools.pxi":64 */
        /*                 dim2_len = c_array_interface.PyArrayInterface_SHAPE(array_struct, 1) */
        __pyx_v_dim2_len = PyArrayInterface_SHAPE(__pyx_v_array_struct,1);

        /* "D:\wt\trunk\src\arraytools.pxi":65 */
        /*                 if dim1_len < 1 or dim2_len < 1: */
        __pyx_4 = (__pyx_v_dim1_len < 1);
        if (!__pyx_4) {
          __pyx_4 = (__pyx_v_dim2_len < 1);
        }
        if (__pyx_4) {

          /* "D:\wt\trunk\src\arraytools.pxi":67 */
          /*                     return -5 */
          __pyx_r = (-5);
          goto __pyx_L0;
          goto __pyx_L8;
        }
        __pyx_L8:;

        /* "D:\wt\trunk\src\arraytools.pxi":68 */
        /*                 buffer_len[0] = dim1_len */
        (__pyx_v_buffer_len[0]) = __pyx_v_dim1_len;

        /* "D:\wt\trunk\src\arraytools.pxi":69 */
        /*                 buffer_len[1] = dim2_len */
        (__pyx_v_buffer_len[1]) = __pyx_v_dim2_len;
        goto __pyx_L4;
      }
      /*else*/ {

        /* "D:\wt\trunk\src\arraytools.pxi":72 */
        /*                 return -4 */
        __pyx_r = (-4);
        goto __pyx_L0;
      }
      __pyx_L4:;

      /* "D:\wt\trunk\src\arraytools.pxi":76 */
      /*             if rwmode == c'w': */
      __pyx_4 = (__pyx_v_rwmode == 'w');
      if (__pyx_4) {

        /* "D:\wt\trunk\src\arraytools.pxi":77 */
        /*                 data = c_array_interface.PyArrayInterface_DATA_AS_DOUBLE_C_ARRAY(array_struct) */
        __pyx_v_data = PyArrayInterface_DATA_AS_DOUBLE_C_ARRAY(__pyx_v_array_struct);
        goto __pyx_L9;
      }
      __pyx_4 = (__pyx_v_rwmode == 'r');
      if (__pyx_4) {

        /* "D:\wt\trunk\src\arraytools.pxi":79 */
        /*                 data = c_array_interface.PyArrayInterface_DATA_AS_DOUBLE_C_ARRAY_RO(array_struct) */
        __pyx_v_data = PyArrayInterface_DATA_AS_DOUBLE_C_ARRAY_RO(__pyx_v_array_struct);
        goto __pyx_L9;
      }
      /*else*/ {

        /* "D:\wt\trunk\src\arraytools.pxi":82 */
        /*                 return -6 */
        __pyx_r = (-6);
        goto __pyx_L0;
      }
      __pyx_L9:;

      /* "D:\wt\trunk\src\arraytools.pxi":84 */
      /*             if data != NULL: */
      __pyx_4 = (__pyx_v_data != 0);
      if (__pyx_4) {

        /* "D:\wt\trunk\src\arraytools.pxi":85 */
        /*                 buffer_addr[0] = data */
        (__pyx_v_buffer_addr[0]) = __pyx_v_data;

        /* "D:\wt\trunk\src\arraytools.pxi":86 */
        /*                 return 0 */
        __pyx_r = 0;
        goto __pyx_L0;
        goto __pyx_L10;
      }
      /*else*/ {

        /* "D:\wt\trunk\src\arraytools.pxi":94 */
        /*                 return -7 */
        __pyx_r = (-7);
        goto __pyx_L0;
      }
      __pyx_L10:;
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "D:\wt\trunk\src\arraytools.pxi":97 */
    /*         return -2 */
    __pyx_r = (-2);
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src\arraytools.pxi":99 */
  /*     return -1 */
  __pyx_r = (-1);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_WriteUnraisable("_pywt.array_interface_as_double_array_ptr");
  __pyx_L0:;
  Py_DECREF(__pyx_v_cobject);
  Py_DECREF(__pyx_v_source);
  return __pyx_r;
}

static int __pyx_f_5_pywt_object_as_buffer(PyObject *__pyx_v_source,double (*(*__pyx_v_buffer_addr)),Py_ssize_t (*__pyx_v_buffer_len),char __pyx_v_mode) {
  int __pyx_r;
  Py_INCREF(__pyx_v_source);

  /* "D:\wt\trunk\src\arraytools.pxi":102 */
  /*     return array_interface_as_double_array_ptr(source, 1, buffer_addr, buffer_len, mode) */
  __pyx_r = __pyx_f_5_pywt_array_interface_as_double_array_ptr(__pyx_v_source,1,__pyx_v_buffer_addr,__pyx_v_buffer_len,__pyx_v_mode);
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_WriteUnraisable("_pywt.object_as_buffer");
  __pyx_L0:;
  Py_DECREF(__pyx_v_source);
  return __pyx_r;
}

static PyObject *__pyx_n_ValueError;

static PyObject *__pyx_k50p;
static PyObject *__pyx_k51p;

static char (__pyx_k50[]) = "Invalid mode";
static char (__pyx_k51[]) = "Unknown mode name";

static int __pyx_f_5_pywt_c_mode_from_object(PyObject *__pyx_v_mode) {
  int __pyx_v_m;
  PyObject (*__pyx_v_co);
  PyObject *__pyx_v_o;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  char (*__pyx_5);
  Py_INCREF(__pyx_v_mode);
  __pyx_v_o = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":32 */
  /*     if c_python.PyInt_Check(mode): */
  __pyx_1 = PyInt_Check(__pyx_v_mode);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":33 */
    /*         m = mode */
    __pyx_1 = PyInt_AsLong(__pyx_v_mode); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 33; goto __pyx_L1;}
    __pyx_v_m = __pyx_1;

    /* "D:\wt\trunk\src/_pywt.pyx":34 */
    /*         if m <= c_wt.MODE_INVALID or m >= c_wt.MODE_MAX: */
    __pyx_1 = (__pyx_v_m <= MODE_INVALID);
    if (!__pyx_1) {
      __pyx_1 = (__pyx_v_m >= MODE_MAX);
    }
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":35 */
      /*             raise ValueError("Invalid mode") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; goto __pyx_L1;}
      Py_INCREF(__pyx_k50p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k50p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 35; goto __pyx_L1;}

      /* "D:\wt\trunk\src/_pywt.pyx":36 */
      /*             return -1 */
      __pyx_r = (-1);
      goto __pyx_L0;
      goto __pyx_L3;
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":38 */
    /*         co = c_python.PyObject_GetAttrString(MODES, mode) */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_MODES); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; goto __pyx_L1;}
    __pyx_5 = PyString_AsString(__pyx_v_mode); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 38; goto __pyx_L1;}
    __pyx_v_co = PyObject_GetAttrString(__pyx_2,__pyx_5);
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":39 */
    /*         if co != NULL: */
    __pyx_1 = (__pyx_v_co != 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":40 */
      /*             o = <object>co */
      __pyx_3 = (PyObject *)__pyx_v_co;
      Py_INCREF(__pyx_3);
      Py_DECREF(__pyx_v_o);
      __pyx_v_o = __pyx_3;
      __pyx_3 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":41 */
      /*             c_python.Py_DECREF(o) # decref above extra ref inc */
      Py_DECREF(__pyx_v_o);

      /* "D:\wt\trunk\src/_pywt.pyx":42 */
      /*             m = <object>co */
      __pyx_4 = (PyObject *)__pyx_v_co;
      Py_INCREF(__pyx_4);
      __pyx_1 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 42; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_v_m = __pyx_1;
      goto __pyx_L4;
    }
    /*else*/ {

      /* "D:\wt\trunk\src/_pywt.pyx":44 */
      /*             c_python.PyErr_Clear() */
      PyErr_Clear();

      /* "D:\wt\trunk\src/_pywt.pyx":45 */
      /*             raise ValueError("Unknown mode name") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; goto __pyx_L1;}
      Py_INCREF(__pyx_k51p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k51p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 45; goto __pyx_L1;}

      /* "D:\wt\trunk\src/_pywt.pyx":46 */
      /*             return -1 */
      __pyx_r = (-1);
      goto __pyx_L0;
    }
    __pyx_L4:;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":47 */
  /*     return m */
  __pyx_r = __pyx_v_m;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.c_mode_from_object");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_o);
  Py_DECREF(__pyx_v_mode);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt___from_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5_pywt___from_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"mode",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_mode)) return 0;
  Py_INCREF(__pyx_v_mode);

  /* "D:\wt\trunk\src/_pywt.pyx":50 */
  /*     return c_mode_from_object(mode) */
  __pyx_1 = __pyx_f_5_pywt_c_mode_from_object(__pyx_v_mode); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 50; goto __pyx_L1;}
  __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_2);
  __Pyx_AddTraceback("_pywt.__from_object");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_mode);
  return __pyx_r;
}

static PyObject *__pyx_n_lower;
static PyObject *__pyx_n_db;
static PyObject *__pyx_n_coif;
static PyObject *__pyx_n_int;
static PyObject *__pyx_n_bior;
static PyObject *__pyx_n_rbio;
static PyObject *__pyx_n_haar;
static PyObject *__pyx_n_dmey;

static PyObject *__pyx_k52p;
static PyObject *__pyx_k57p;
static PyObject *__pyx_k59p;
static PyObject *__pyx_k62p;

static char (__pyx_k52[]) = "Invalid wavelet name";
static char (__pyx_k57[]) = ".";
static char (__pyx_k59[]) = ".";
static char (__pyx_k62[]) = "Unknown wavelet name, '%s' not in wavelist()";

static PyObject *__pyx_f_5_pywt_wname_to_code(char (*__pyx_v_name)) {
  PyObject *__pyx_v_name_;
  PyObject *__pyx_v_n;
  PyObject *__pyx_v_code;
  PyObject *__pyx_v_number;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  Py_ssize_t __pyx_6;
  PyObject *__pyx_7 = 0;
  __pyx_v_name_ = Py_None; Py_INCREF(Py_None);
  __pyx_v_n = Py_None; Py_INCREF(Py_None);
  __pyx_v_code = Py_None; Py_INCREF(Py_None);
  __pyx_v_number = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":90 */
  /*     name_ = name.lower() */
  __pyx_1 = PyString_FromString(__pyx_v_name); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_lower); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; goto __pyx_L1;}
  __pyx_3 = PyObject_Call(__pyx_2, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 90; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_name_);
  __pyx_v_name_ = __pyx_3;
  __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":92 */
  /*     if len(name_) == 0: */
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; goto __pyx_L1;}
  Py_INCREF(__pyx_v_name_);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_name_);
  __pyx_3 = PyObject_Call(__pyx_2, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_2, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 92; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src/_pywt.pyx":93 */
    /*         raise ValueError("Invalid wavelet name") */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; goto __pyx_L1;}
    Py_INCREF(__pyx_k52p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k52p);
    __pyx_2 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 93; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":95 */
  /*     for n, code in (("db", c"d"), ("sym", c"s"), ("coif", c"c")): */
  __pyx_1 = PyInt_FromLong('d'); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  Py_INCREF(__pyx_n_db);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_n_db);
  PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);
  __pyx_1 = 0;
  __pyx_2 = PyInt_FromLong('s'); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  Py_INCREF(__pyx_n_sym);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_n_sym);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyInt_FromLong('c'); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  Py_INCREF(__pyx_n_coif);
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_n_coif);
  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyTuple_New(3); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1);
  PyTuple_SET_ITEM(__pyx_2, 2, __pyx_5);
  __pyx_3 = 0;
  __pyx_1 = 0;
  __pyx_5 = 0;
  __pyx_3 = PyObject_GetIter(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  for (;;) {
    __pyx_L3:;
    __pyx_1 = PyIter_Next(__pyx_3);
    if (!__pyx_1) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
      break;
    }
    __pyx_5 = __Pyx_UnpackItem(__pyx_1, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
    Py_DECREF(__pyx_v_n);
    __pyx_v_n = __pyx_5;
    __pyx_5 = 0;
    __pyx_2 = __Pyx_UnpackItem(__pyx_1, 1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
    Py_DECREF(__pyx_v_code);
    __pyx_v_code = __pyx_2;
    __pyx_2 = 0;
    if (__Pyx_EndUnpack(__pyx_1, 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 95; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":96 */
    /*         if name_[:len(n)] == n: */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    Py_INCREF(__pyx_v_n);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_n);
    __pyx_2 = PyObject_Call(__pyx_1, __pyx_5, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_6 = PyInt_AsSsize_t(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_1 = PySequence_GetSlice(__pyx_v_name_, 0, __pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_1, __pyx_v_n, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 96; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_4) {

      /* "D:\wt\trunk\src/_pywt.pyx":97 */
      /*             try: */
      /*try:*/ {

        /* "D:\wt\trunk\src/_pywt.pyx":98 */
        /*                 number = int(name_[len(n):]) */
        __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        Py_INCREF(__pyx_v_n);
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_n);
        __pyx_7 = PyObject_Call(__pyx_2, __pyx_1, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_6 = PyInt_AsSsize_t(__pyx_7); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        __pyx_2 = PySequence_GetSlice(__pyx_v_name_, __pyx_6, PY_SSIZE_T_MAX); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
        __pyx_2 = 0;
        __pyx_7 = PyObject_Call(__pyx_5, __pyx_1, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 98; goto __pyx_L6;}
        Py_DECREF(__pyx_5); __pyx_5 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_v_number);
        __pyx_v_number = __pyx_7;
        __pyx_7 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":99 */
        /*                 return (code, number) */
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 99; goto __pyx_L6;}
        Py_INCREF(__pyx_v_code);
        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_code);
        Py_INCREF(__pyx_v_number);
        PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_number);
        __pyx_r = __pyx_2;
        __pyx_2 = 0;
        goto __pyx_L0;
      }
      goto __pyx_L7;
      __pyx_L6:;
      Py_XDECREF(__pyx_5); __pyx_5 = 0;
      Py_XDECREF(__pyx_1); __pyx_1 = 0;
      Py_XDECREF(__pyx_7); __pyx_7 = 0;
      Py_XDECREF(__pyx_2); __pyx_2 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":100 */
      /*             except ValueError: */
      __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; goto __pyx_L1;}
      __pyx_4 = PyErr_ExceptionMatches(__pyx_5);
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      if (__pyx_4) {
        __Pyx_AddTraceback("_pywt.wname_to_code");
        __pyx_1 = __Pyx_GetExcValue(); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 100; goto __pyx_L1;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":101 */
        /*                 pass */
        goto __pyx_L7;
      }
      goto __pyx_L1;
      __pyx_L7:;
      goto __pyx_L5;
    }
    __pyx_L5:;
  }
  __pyx_L4:;
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":103 */
  /*     if name_[:4] == "bior": */
  __pyx_7 = PySequence_GetSlice(__pyx_v_name_, 0, 4); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_7, __pyx_n_bior, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 103; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_7); __pyx_7 = 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src/_pywt.pyx":104 */
    /*         if len(name_) == 7 and name_[-2] == '.': */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
    Py_INCREF(__pyx_v_name_);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_name_);
    __pyx_1 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_3 = PyInt_FromLong(7); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_1, __pyx_3, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_4) {
      __pyx_7 = PyInt_FromLong((-2)); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
      __pyx_2 = PyObject_GetItem(__pyx_v_name_, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
      Py_DECREF(__pyx_7); __pyx_7 = 0;
      if (PyObject_Cmp(__pyx_2, __pyx_k57p, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 104; goto __pyx_L1;}
      __pyx_4 = __pyx_4 == 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;
    }
    if (__pyx_4) {

      /* "D:\wt\trunk\src/_pywt.pyx":105 */
      /*             try: */
      /*try:*/ {

        /* "D:\wt\trunk\src/_pywt.pyx":106 */
        /*                 number = int(name_[-3])*10 + int(name_[-1]) */
        __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        __pyx_1 = PyInt_FromLong((-3)); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        __pyx_3 = PyObject_GetItem(__pyx_v_name_, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_7 = PyTuple_New(1); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        PyTuple_SET_ITEM(__pyx_7, 0, __pyx_3);
        __pyx_3 = 0;
        __pyx_2 = PyObject_Call(__pyx_5, __pyx_7, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_5); __pyx_5 = 0;
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        __pyx_1 = PyInt_FromLong(10); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        __pyx_3 = PyNumber_Multiply(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        __pyx_7 = PyInt_FromLong((-1)); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        __pyx_2 = PyObject_GetItem(__pyx_v_name_, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
        __pyx_2 = 0;
        __pyx_7 = PyObject_Call(__pyx_5, __pyx_1, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_5); __pyx_5 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __pyx_2 = PyNumber_Add(__pyx_3, __pyx_7); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 106; goto __pyx_L10;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        Py_DECREF(__pyx_v_number);
        __pyx_v_number = __pyx_2;
        __pyx_2 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":107 */
        /*                 return (c'b', number) */
        __pyx_5 = PyInt_FromLong('b'); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; goto __pyx_L10;}
        __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 107; goto __pyx_L10;}
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_5);
        Py_INCREF(__pyx_v_number);
        PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_number);
        __pyx_5 = 0;
        __pyx_r = __pyx_1;
        __pyx_1 = 0;
        goto __pyx_L0;
      }
      goto __pyx_L11;
      __pyx_L10:;
      Py_XDECREF(__pyx_3); __pyx_3 = 0;
      Py_XDECREF(__pyx_7); __pyx_7 = 0;
      Py_XDECREF(__pyx_2); __pyx_2 = 0;
      Py_XDECREF(__pyx_5); __pyx_5 = 0;
      Py_XDECREF(__pyx_1); __pyx_1 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":108 */
      /*             except ValueError: */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; goto __pyx_L1;}
      __pyx_4 = PyErr_ExceptionMatches(__pyx_3);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      if (__pyx_4) {
        __Pyx_AddTraceback("_pywt.wname_to_code");
        __pyx_7 = __Pyx_GetExcValue(); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 108; goto __pyx_L1;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":109 */
        /*                 pass */
        goto __pyx_L11;
      }
      goto __pyx_L1;
      __pyx_L11:;
      goto __pyx_L9;
    }
    __pyx_L9:;
    goto __pyx_L8;
  }
  __pyx_2 = PySequence_GetSlice(__pyx_v_name_, 0, 4); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_2, __pyx_n_rbio, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src/_pywt.pyx":111 */
    /*         if len(name_) == 7 and name_[-2] == '.': */
    __pyx_5 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
    Py_INCREF(__pyx_v_name_);
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_name_);
    __pyx_3 = PyObject_Call(__pyx_5, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_7 = PyInt_FromLong(7); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_3, __pyx_7, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_4 = __pyx_4 == 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    if (__pyx_4) {
      __pyx_2 = PyInt_FromLong((-2)); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
      __pyx_5 = PyObject_GetItem(__pyx_v_name_, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      if (PyObject_Cmp(__pyx_5, __pyx_k59p, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 111; goto __pyx_L1;}
      __pyx_4 = __pyx_4 == 0;
      Py_DECREF(__pyx_5); __pyx_5 = 0;
    }
    if (__pyx_4) {

      /* "D:\wt\trunk\src/_pywt.pyx":112 */
      /*             try: */
      /*try:*/ {

        /* "D:\wt\trunk\src/_pywt.pyx":113 */
        /*                 number = int(name_[-3])*10 + int(name_[-1]) */
        __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        __pyx_3 = PyInt_FromLong((-3)); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        __pyx_7 = PyObject_GetItem(__pyx_v_name_, __pyx_3); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        PyTuple_SET_ITEM(__pyx_2, 0, __pyx_7);
        __pyx_7 = 0;
        __pyx_5 = PyObject_Call(__pyx_1, __pyx_2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        __pyx_3 = PyInt_FromLong(10); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        __pyx_7 = PyNumber_Multiply(__pyx_5, __pyx_3); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_5); __pyx_5 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_int); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        __pyx_2 = PyInt_FromLong((-1)); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        __pyx_5 = PyObject_GetItem(__pyx_v_name_, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
        __pyx_5 = 0;
        __pyx_2 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __pyx_5 = PyNumber_Add(__pyx_7, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 113; goto __pyx_L13;}
        Py_DECREF(__pyx_7); __pyx_7 = 0;
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_v_number);
        __pyx_v_number = __pyx_5;
        __pyx_5 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":114 */
        /*                 return (c'r', number) */
        __pyx_1 = PyInt_FromLong('r'); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; goto __pyx_L13;}
        __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 114; goto __pyx_L13;}
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
        Py_INCREF(__pyx_v_number);
        PyTuple_SET_ITEM(__pyx_3, 1, __pyx_v_number);
        __pyx_1 = 0;
        __pyx_r = __pyx_3;
        __pyx_3 = 0;
        goto __pyx_L0;
      }
      goto __pyx_L14;
      __pyx_L13:;
      Py_XDECREF(__pyx_7); __pyx_7 = 0;
      Py_XDECREF(__pyx_2); __pyx_2 = 0;
      Py_XDECREF(__pyx_5); __pyx_5 = 0;
      Py_XDECREF(__pyx_1); __pyx_1 = 0;
      Py_XDECREF(__pyx_3); __pyx_3 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":115 */
      /*             except ValueError: */
      __pyx_7 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; goto __pyx_L1;}
      __pyx_4 = PyErr_ExceptionMatches(__pyx_7);
      Py_DECREF(__pyx_7); __pyx_7 = 0;
      if (__pyx_4) {
        __Pyx_AddTraceback("_pywt.wname_to_code");
        __pyx_2 = __Pyx_GetExcValue(); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 115; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;

        /* "D:\wt\trunk\src/_pywt.pyx":116 */
        /*                 pass */
        goto __pyx_L14;
      }
      goto __pyx_L1;
      __pyx_L14:;
      goto __pyx_L12;
    }
    __pyx_L12:;
    goto __pyx_L8;
  }
  if (PyObject_Cmp(__pyx_v_name_, __pyx_n_haar, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 117; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src/_pywt.pyx":118 */
    /*         return c'h', 0 */
    __pyx_5 = PyInt_FromLong('h'); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; goto __pyx_L1;}
    __pyx_1 = PyInt_FromLong(0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 118; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
    PyTuple_SET_ITEM(__pyx_3, 1, __pyx_1);
    __pyx_5 = 0;
    __pyx_1 = 0;
    __pyx_r = __pyx_3;
    __pyx_3 = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  if (PyObject_Cmp(__pyx_v_name_, __pyx_n_dmey, &__pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; goto __pyx_L1;}
  __pyx_4 = __pyx_4 == 0;
  if (__pyx_4) {

    /* "D:\wt\trunk\src/_pywt.pyx":121 */
    /*         return c'm', 0 */
    __pyx_7 = PyInt_FromLong('m'); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(2); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 121; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_7);
    PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
    __pyx_7 = 0;
    __pyx_2 = 0;
    __pyx_r = __pyx_5;
    __pyx_5 = 0;
    goto __pyx_L0;
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "D:\wt\trunk\src/_pywt.pyx":123 */
  /*     raise ValueError("Unknown wavelet name, '%s' not in wavelist()" % name) */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}
  __pyx_3 = PyString_FromString(__pyx_v_name); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}
  __pyx_7 = PyNumber_Remainder(__pyx_k62p, __pyx_3); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_7);
  __pyx_7 = 0;
  __pyx_5 = PyObject_Call(__pyx_1, __pyx_2, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __Pyx_Raise(__pyx_5, 0, 0);
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  {__pyx_filename = __pyx_f[1]; __pyx_lineno = 123; goto __pyx_L1;}

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_7);
  __Pyx_AddTraceback("_pywt.wname_to_code");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_name_);
  Py_DECREF(__pyx_v_n);
  Py_DECREF(__pyx_v_code);
  Py_DECREF(__pyx_v_number);
  return __pyx_r;
}

static PyObject *__pyx_n_TypeError;
static PyObject *__pyx_n_get_filters_coeffs;
static PyObject *__pyx_n_map;
static PyObject *__pyx_n_float;
static PyObject *__pyx_n_max;
static PyObject *__pyx_n_MemoryError;

static PyObject *__pyx_k63p;
static PyObject *__pyx_k64p;
static PyObject *__pyx_k65p;
static PyObject *__pyx_k66p;
static PyObject *__pyx_k67p;
static PyObject *__pyx_k68p;

static char (__pyx_k63[]) = "Wavelet name or filter bank must be specified";
static char (__pyx_k64[]) = "Wrong wavelet name";
static char (__pyx_k65[]) = "Expected filter bank with 4 filters, got filter bank with %d filters";
static char (__pyx_k66[]) = "Filter bank with float or int values required";
static char (__pyx_k67[]) = "Filter bank can not be zero-length";
static char (__pyx_k68[]) = "Could not allocate memory for given filter bank";

static int __pyx_f_5_pywt_7Wavelet___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_5_pywt_7Wavelet___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  char (*__pyx_v_name);
  PyObject *__pyx_v_filter_bank = 0;
  PyObject *__pyx_v_c;
  PyObject *__pyx_v_nr;
  PyObject *__pyx_v_filters;
  PyObject *__pyx_v_dec_lo;
  PyObject *__pyx_v_dec_hi;
  PyObject *__pyx_v_rec_lo;
  PyObject *__pyx_v_rec_hi;
  PyObject *__pyx_v_max_length;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  char __pyx_5;
  PyObject *__pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  PyObject *__pyx_9 = 0;
  index_t __pyx_10;
  static char *__pyx_argnames[] = {"name","filter_bank",0};
  __pyx_v_name = __pyx_k31;
  __pyx_v_filter_bank = __pyx_k32;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|sO", __pyx_argnames, &__pyx_v_name, &__pyx_v_filter_bank)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_filter_bank);
  __pyx_v_c = Py_None; Py_INCREF(Py_None);
  __pyx_v_nr = Py_None; Py_INCREF(Py_None);
  __pyx_v_filters = Py_None; Py_INCREF(Py_None);
  __pyx_v_dec_lo = Py_None; Py_INCREF(Py_None);
  __pyx_v_dec_hi = Py_None; Py_INCREF(Py_None);
  __pyx_v_rec_lo = Py_None; Py_INCREF(Py_None);
  __pyx_v_rec_hi = Py_None; Py_INCREF(Py_None);
  __pyx_v_max_length = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":143 */
  /*         if not name and filter_bank is None: */
  __pyx_1 = (!(__pyx_v_name != 0));
  if (__pyx_1) {
    __pyx_1 = __pyx_v_filter_bank == Py_None;
  }
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":144 */
    /*             raise TypeError("Wavelet name or filter bank must be specified") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; goto __pyx_L1;}
    Py_INCREF(__pyx_k63p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k63p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":147 */
  /*         if filter_bank is None: */
  __pyx_1 = __pyx_v_filter_bank == Py_None;
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":149 */
    /*             c, nr = wname_to_code(name) */
    __pyx_2 = __pyx_f_5_pywt_wname_to_code(__pyx_v_name); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; goto __pyx_L1;}
    __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; goto __pyx_L1;}
    Py_DECREF(__pyx_v_c);
    __pyx_v_c = __pyx_3;
    __pyx_3 = 0;
    __pyx_4 = __Pyx_UnpackItem(__pyx_2, 1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; goto __pyx_L1;}
    Py_DECREF(__pyx_v_nr);
    __pyx_v_nr = __pyx_4;
    __pyx_4 = 0;
    if (__Pyx_EndUnpack(__pyx_2, 2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":150 */
    /*             self.w = <c_wt.Wavelet*> c_wt.wavelet(c, nr) */
    __pyx_5 = PyInt_AsLong(__pyx_v_c); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; goto __pyx_L1;}
    __pyx_1 = PyInt_AsLong(__pyx_v_nr); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 150; goto __pyx_L1;}
    ((struct WaveletObject *)__pyx_v_self)->w = ((Wavelet (*))wavelet(__pyx_5,__pyx_1));

    /* "D:\wt\trunk\src/_pywt.pyx":152 */
    /*             if self.w == NULL: */
    __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w == 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":153 */
      /*                 raise ValueError("Wrong wavelet name") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; goto __pyx_L1;}
      Py_INCREF(__pyx_k64p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k64p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 153; goto __pyx_L1;}
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "D:\wt\trunk\src/_pywt.pyx":155 */
    /*             self.name = name.lower() */
    __pyx_3 = PyString_FromString(__pyx_v_name); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; goto __pyx_L1;}
    __pyx_4 = PyObject_GetAttr(__pyx_3, __pyx_n_lower); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; goto __pyx_L1;}
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 155; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(((struct WaveletObject *)__pyx_v_self)->name);
    ((struct WaveletObject *)__pyx_v_self)->name = __pyx_3;
    __pyx_3 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":156 */
    /*             self.number = nr */
    Py_INCREF(__pyx_v_nr);
    Py_DECREF(((struct WaveletObject *)__pyx_v_self)->number);
    ((struct WaveletObject *)__pyx_v_self)->number = __pyx_v_nr;
    goto __pyx_L3;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":159 */
    /*             filters = filter_bank.get_filters_coeffs() */
    __pyx_4 = PyObject_GetAttr(__pyx_v_filter_bank, __pyx_n_get_filters_coeffs); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; goto __pyx_L1;}
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 159; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_v_filters);
    __pyx_v_filters = __pyx_3;
    __pyx_3 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":160 */
    /*             if len(filters) != 4: */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; goto __pyx_L1;}
    Py_INCREF(__pyx_v_filters);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_filters);
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = PyInt_FromLong(4); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_3, __pyx_4, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 160; goto __pyx_L1;}
    __pyx_1 = __pyx_1 != 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":161 */
      /*                 raise ValueError("Expected filter bank with 4 filters, got filter bank with %d filters" % len(filters)) */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      Py_INCREF(__pyx_v_filters);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_filters);
      __pyx_6 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_3 = PyNumber_Remainder(__pyx_k65p, __pyx_6); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
      __pyx_3 = 0;
      __pyx_6 = PyObject_Call(__pyx_2, __pyx_4, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_6, 0, 0);
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 161; goto __pyx_L1;}
      goto __pyx_L5;
    }
    __pyx_L5:;

    /* "D:\wt\trunk\src/_pywt.pyx":162 */
    /*             try: */
    /*try:*/ {

      /* "D:\wt\trunk\src/_pywt.pyx":163 */
      /*                 dec_lo = map(float, filters[0]) */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_map); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_float); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      __pyx_6 = PyObject_GetItem(__pyx_v_filters, __pyx_4); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_6);
      __pyx_2 = 0;
      __pyx_6 = 0;
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 163; goto __pyx_L6;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_v_dec_lo);
      __pyx_v_dec_lo = __pyx_2;
      __pyx_2 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":164 */
      /*                 dec_hi = map(float, filters[1]) */
      __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_map); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_float); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      __pyx_2 = PyObject_GetItem(__pyx_v_filters, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_2);
      __pyx_3 = 0;
      __pyx_2 = 0;
      __pyx_3 = PyObject_Call(__pyx_6, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 164; goto __pyx_L6;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_v_dec_hi);
      __pyx_v_dec_hi = __pyx_3;
      __pyx_3 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":165 */
      /*                 rec_lo = map(float, filters[2]) */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_map); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_float); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      __pyx_4 = PyInt_FromLong(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      __pyx_3 = PyObject_GetItem(__pyx_v_filters, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_6);
      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
      __pyx_6 = 0;
      __pyx_3 = 0;
      __pyx_6 = PyObject_Call(__pyx_2, __pyx_4, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 165; goto __pyx_L6;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_v_rec_lo);
      __pyx_v_rec_lo = __pyx_6;
      __pyx_6 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":166 */
      /*                 rec_hi = map(float, filters[3]) */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_map); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_float); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      __pyx_4 = PyInt_FromLong(3); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      __pyx_6 = PyObject_GetItem(__pyx_v_filters, __pyx_4); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_6);
      __pyx_2 = 0;
      __pyx_6 = 0;
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 166; goto __pyx_L6;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_v_rec_hi);
      __pyx_v_rec_hi = __pyx_2;
      __pyx_2 = 0;
    }
    goto __pyx_L7;
    __pyx_L6:;
    Py_XDECREF(__pyx_6); __pyx_6 = 0;
    Py_XDECREF(__pyx_3); __pyx_3 = 0;
    Py_XDECREF(__pyx_4); __pyx_4 = 0;
    Py_XDECREF(__pyx_2); __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":167 */
    /*             except TypeError: */
    __pyx_6 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; goto __pyx_L1;}
    __pyx_1 = PyErr_ExceptionMatches(__pyx_6);
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    if (__pyx_1) {
      __Pyx_AddTraceback("_pywt.__new__");
      __pyx_3 = __Pyx_GetExcValue(); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 167; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":168 */
      /*                 raise TypeError("Filter bank with float or int values required") */
      __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; goto __pyx_L1;}
      __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_INCREF(__pyx_k66p);
      PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k66p);
      __pyx_6 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      __Pyx_Raise(__pyx_6, 0, 0);
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 168; goto __pyx_L1;}
      goto __pyx_L7;
    }
    goto __pyx_L1;
    __pyx_L7:;

    /* "D:\wt\trunk\src/_pywt.pyx":170 */
    /*             max_length = max(len(dec_lo), len(dec_hi), len(rec_lo), len(rec_hi)) */
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_max); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_INCREF(__pyx_v_dec_lo);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_dec_lo);
    __pyx_6 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_INCREF(__pyx_v_dec_hi);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_dec_hi);
    __pyx_7 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_INCREF(__pyx_v_rec_lo);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_rec_lo);
    __pyx_8 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_INCREF(__pyx_v_rec_hi);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_rec_hi);
    __pyx_9 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_9) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = PyTuple_New(4); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_6);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_7);
    PyTuple_SET_ITEM(__pyx_4, 2, __pyx_8);
    PyTuple_SET_ITEM(__pyx_4, 3, __pyx_9);
    __pyx_6 = 0;
    __pyx_7 = 0;
    __pyx_8 = 0;
    __pyx_9 = 0;
    __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 170; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_v_max_length);
    __pyx_v_max_length = __pyx_2;
    __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":171 */
    /*             if max_length == 0: */
    __pyx_6 = PyInt_FromLong(0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_v_max_length, __pyx_6, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; goto __pyx_L1;}
    __pyx_1 = __pyx_1 == 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":172 */
      /*                 raise ValueError("Filter bank can not be zero-length") */
      __pyx_7 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; goto __pyx_L1;}
      __pyx_8 = PyTuple_New(1); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; goto __pyx_L1;}
      Py_INCREF(__pyx_k67p);
      PyTuple_SET_ITEM(__pyx_8, 0, __pyx_k67p);
      __pyx_9 = PyObject_Call(__pyx_7, __pyx_8, 0); if (!__pyx_9) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; goto __pyx_L1;}
      Py_DECREF(__pyx_7); __pyx_7 = 0;
      Py_DECREF(__pyx_8); __pyx_8 = 0;
      __Pyx_Raise(__pyx_9, 0, 0);
      Py_DECREF(__pyx_9); __pyx_9 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 172; goto __pyx_L1;}
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "D:\wt\trunk\src/_pywt.pyx":174 */
    /*             self.w = <c_wt.Wavelet*> c_wt.blank_wavelet(max_length) */
    __pyx_10 = PyInt_AsSsize_t(__pyx_v_max_length); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 174; goto __pyx_L1;}
    ((struct WaveletObject *)__pyx_v_self)->w = ((Wavelet (*))blank_wavelet(__pyx_10));

    /* "D:\wt\trunk\src/_pywt.pyx":175 */
    /*             if self.w == NULL: */
    __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w == 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":176 */
      /*                 raise MemoryError("Could not allocate memory for given filter bank") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_MemoryError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; goto __pyx_L1;}
      Py_INCREF(__pyx_k68p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k68p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; goto __pyx_L1;}
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "D:\wt\trunk\src/_pywt.pyx":179 */
    /*             copy_object_to_double_array(dec_lo, self.w.dec_lo) */
    __pyx_1 = __pyx_f_5_pywt_copy_object_to_double_array(__pyx_v_dec_lo,((struct WaveletObject *)__pyx_v_self)->w->dec_lo); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; goto __pyx_L1;}

    /* "D:\wt\trunk\src/_pywt.pyx":180 */
    /*             copy_object_to_double_array(dec_hi, self.w.dec_hi) */
    __pyx_1 = __pyx_f_5_pywt_copy_object_to_double_array(__pyx_v_dec_hi,((struct WaveletObject *)__pyx_v_self)->w->dec_hi); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; goto __pyx_L1;}

    /* "D:\wt\trunk\src/_pywt.pyx":181 */
    /*             copy_object_to_double_array(rec_lo, self.w.rec_lo) */
    __pyx_1 = __pyx_f_5_pywt_copy_object_to_double_array(__pyx_v_rec_lo,((struct WaveletObject *)__pyx_v_self)->w->rec_lo); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 181; goto __pyx_L1;}

    /* "D:\wt\trunk\src/_pywt.pyx":182 */
    /*             copy_object_to_double_array(rec_hi, self.w.rec_hi) */
    __pyx_1 = __pyx_f_5_pywt_copy_object_to_double_array(__pyx_v_rec_hi,((struct WaveletObject *)__pyx_v_self)->w->rec_hi); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 182; goto __pyx_L1;}

    /* "D:\wt\trunk\src/_pywt.pyx":184 */
    /*             self.name = name */
    __pyx_6 = PyString_FromString(__pyx_v_name); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 184; goto __pyx_L1;}
    Py_DECREF(((struct WaveletObject *)__pyx_v_self)->name);
    ((struct WaveletObject *)__pyx_v_self)->name = __pyx_6;
    __pyx_6 = 0;
  }
  __pyx_L3:;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  Py_XDECREF(__pyx_9);
  __Pyx_AddTraceback("_pywt.Wavelet.__new__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_c);
  Py_DECREF(__pyx_v_nr);
  Py_DECREF(__pyx_v_filters);
  Py_DECREF(__pyx_v_dec_lo);
  Py_DECREF(__pyx_v_dec_hi);
  Py_DECREF(__pyx_v_rec_lo);
  Py_DECREF(__pyx_v_rec_hi);
  Py_DECREF(__pyx_v_max_length);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_filter_bank);
  return __pyx_r;
}

static void __pyx_f_5_pywt_7Wavelet___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_5_pywt_7Wavelet___dealloc__(PyObject *__pyx_v_self) {
  int __pyx_1;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":187 */
  /*         if self.w != NULL: */
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w != 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":188 */
    /*             c_wt.free_wavelet(self.w) # if w._builtin is 0, it frees also the filter arrays */
    free_wavelet(((struct WaveletObject *)__pyx_v_self)->w);

    /* "D:\wt\trunk\src/_pywt.pyx":189 */
    /*             self.w = NULL */
    ((struct WaveletObject *)__pyx_v_self)->w = 0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_pywt.Wavelet.__dealloc__");
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
}

static PyObject *__pyx_n_dec_len;

static Py_ssize_t __pyx_f_5_pywt_7Wavelet___len__(PyObject *__pyx_v_self); /*proto*/
static Py_ssize_t __pyx_f_5_pywt_7Wavelet___len__(PyObject *__pyx_v_self) {
  Py_ssize_t __pyx_r;
  PyObject *__pyx_1 = 0;
  Py_ssize_t __pyx_2;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":192 */
  /*         return self.dec_len */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_dec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 192; goto __pyx_L1;}
  __pyx_2 = PyInt_AsSsize_t(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 192; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_r = __pyx_2;
  goto __pyx_L0;

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.__len__");
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_6dec_lo___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_6dec_lo___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":197 */
  /*             return double_array_to_list(self.w.dec_lo, self.w.dec_len) */
  __pyx_1 = __pyx_f_5_pywt_double_array_to_list(((struct WaveletObject *)__pyx_v_self)->w->dec_lo,((struct WaveletObject *)__pyx_v_self)->w->dec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 197; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.dec_lo.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_6dec_hi___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_6dec_hi___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":202 */
  /*             return double_array_to_list(self.w.dec_hi, self.w.dec_len) */
  __pyx_1 = __pyx_f_5_pywt_double_array_to_list(((struct WaveletObject *)__pyx_v_self)->w->dec_hi,((struct WaveletObject *)__pyx_v_self)->w->dec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 202; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.dec_hi.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_6rec_lo___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_6rec_lo___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":207 */
  /*             return double_array_to_list(self.w.rec_lo, self.w.rec_len) */
  __pyx_1 = __pyx_f_5_pywt_double_array_to_list(((struct WaveletObject *)__pyx_v_self)->w->rec_lo,((struct WaveletObject *)__pyx_v_self)->w->rec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 207; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.rec_lo.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_6rec_hi___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_6rec_hi___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":212 */
  /*             return double_array_to_list(self.w.rec_hi, self.w.rec_len) */
  __pyx_1 = __pyx_f_5_pywt_double_array_to_list(((struct WaveletObject *)__pyx_v_self)->w->rec_hi,((struct WaveletObject *)__pyx_v_self)->w->rec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 212; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.rec_hi.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_7rec_len___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_7rec_len___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":217 */
  /*             return self.w.rec_len */
  __pyx_1 = PyInt_FromSsize_t(((struct WaveletObject *)__pyx_v_self)->w->rec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.rec_len.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_7dec_len___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_7dec_len___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":222 */
  /*             return self.w.dec_len */
  __pyx_1 = PyInt_FromSsize_t(((struct WaveletObject *)__pyx_v_self)->w->dec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 222; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.dec_len.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_11family_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_11family_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":227 */
  /*             return self.w.family_name */
  __pyx_1 = PyString_FromString(((struct WaveletObject *)__pyx_v_self)->w->family_name); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 227; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.family_name.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_10short_name___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_10short_name___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":232 */
  /*             return self.w.short_name */
  __pyx_1 = PyString_FromString(((struct WaveletObject *)__pyx_v_self)->w->short_name); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 232; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.Wavelet.short_name.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_bool;

static PyObject *__pyx_f_5_pywt_7Wavelet_10orthogonal___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_10orthogonal___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":237 */
  /*             return bool(self.w.orthogonal) */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_bool); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(((struct WaveletObject *)__pyx_v_self)->w->orthogonal); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 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);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.Wavelet.orthogonal.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_12biorthogonal___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_12biorthogonal___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":242 */
  /*             return bool(self.w.biorthogonal) */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_bool); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 242; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(((struct WaveletObject *)__pyx_v_self)->w->biorthogonal); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 242; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 242; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 242; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 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);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.Wavelet.biorthogonal.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_asymmetric;
static PyObject *__pyx_n_symmetric;
static PyObject *__pyx_n_unknown;

static PyObject *__pyx_k70p;

static char (__pyx_k70[]) = "near symmetric";

static PyObject *__pyx_f_5_pywt_7Wavelet_8symmetry___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_8symmetry___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  int __pyx_1;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":250 */
  /*             if self.w.symmetry == c_wt.ASYMMETRIC: */
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w->symmetry == ASYMMETRIC);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":251 */
    /*                 return "asymmetric" */
    Py_INCREF(__pyx_n_asymmetric);
    __pyx_r = __pyx_n_asymmetric;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w->symmetry == NEAR_SYMMETRIC);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":253 */
    /*                 return "near symmetric" */
    Py_INCREF(__pyx_k70p);
    __pyx_r = __pyx_k70p;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w->symmetry == SYMMETRIC);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":255 */
    /*                 return "symmetric" */
    Py_INCREF(__pyx_n_symmetric);
    __pyx_r = __pyx_n_symmetric;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":257 */
    /*                 return "unknown" */
    Py_INCREF(__pyx_n_unknown);
    __pyx_r = __pyx_n_unknown;
    goto __pyx_L0;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("_pywt.Wavelet.symmetry.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_21vanishing_moments_psi___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_21vanishing_moments_psi___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":262 */
  /*             if self.w.vanishing_moments_psi > 0: */
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w->vanishing_moments_psi > 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":263 */
    /*                 return self.w.vanishing_moments_psi */
    __pyx_2 = PyInt_FromLong(((struct WaveletObject *)__pyx_v_self)->w->vanishing_moments_psi); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 263; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_pywt.Wavelet.vanishing_moments_psi.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_21vanishing_moments_phi___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_21vanishing_moments_phi___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":268 */
  /*             if self.w.vanishing_moments_phi > 0: */
  __pyx_1 = (((struct WaveletObject *)__pyx_v_self)->w->vanishing_moments_phi > 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":269 */
    /*                 return self.w.vanishing_moments_phi */
    __pyx_2 = PyInt_FromLong(((struct WaveletObject *)__pyx_v_self)->w->vanishing_moments_phi); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 269; goto __pyx_L1;}
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("_pywt.Wavelet.vanishing_moments_phi.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_7Wavelet_8_builtin___get__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet_8_builtin___get__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":274 */
  /*             return bool(self.w._builtin) */
  __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_bool); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(((struct WaveletObject *)__pyx_v_self)->w->_builtin); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 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);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.Wavelet._builtin.__get__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_dec_lo;
static PyObject *__pyx_n_dec_hi;
static PyObject *__pyx_n_rec_lo;
static PyObject *__pyx_n_rec_hi;

static PyObject *__pyx_f_5_pywt_7Wavelet_get_filters_coeffs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_7Wavelet_get_filters_coeffs[] = "List of wavelet filters coefficients\n        [dec_lo, dec_hi, rec_lo, rec_hi]\n        ";
static PyObject *__pyx_f_5_pywt_7Wavelet_get_filters_coeffs(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":280 */
  /*         return (self.dec_lo, self.dec_hi, self.rec_lo, self.rec_hi) */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_dec_lo); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_dec_hi); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; goto __pyx_L1;}
  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_rec_lo); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; goto __pyx_L1;}
  __pyx_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_rec_hi); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 280; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_1);
  PyTuple_SET_ITEM(__pyx_5, 1, __pyx_2);
  PyTuple_SET_ITEM(__pyx_5, 2, __pyx_3);
  PyTuple_SET_ITEM(__pyx_5, 3, __pyx_4);
  __pyx_1 = 0;
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_4 = 0;
  __pyx_r = __pyx_5;
  __pyx_5 = 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_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("_pywt.Wavelet.get_filters_coeffs");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_short_name;
static PyObject *__pyx_n_a;
static PyObject *__pyx_n_d;


static PyObject *__pyx_f_5_pywt_7Wavelet_wavefun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_7Wavelet_wavefun[] = "wavefun(level)\n        \n        Calculates aproximations of wavelet function (psi) and associated\n        scaling function (*phi*) at given level of refinement.\n\n        For orthogonal wavelet returns scaling and wavelet function.\n        For biorthogonal wavelet returns scaling and wavelet function both\n        for decomposition and reconstruction.\n        ";
static PyObject *__pyx_f_5_pywt_7Wavelet_wavefun(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_level;
  double coef;
  double pas;
  PyObject *__pyx_v_other_name;
  PyObject *__pyx_v_other;
  PyObject *__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;
  PyObject *__pyx_7 = 0;
  PyObject *__pyx_8 = 0;
  static char *__pyx_argnames[] = {"level",0};
  __pyx_v_level = __pyx_k33;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|i", __pyx_argnames, &__pyx_v_level)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_other_name = Py_None; Py_INCREF(Py_None);
  __pyx_v_other = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":295 */
  /*         coef = c_math.pow(c_math.sqrt(2.), <double>level) */
  coef = pow(sqrt(2.),((double )__pyx_v_level));

  /* "D:\wt\trunk\src/_pywt.pyx":296 */
  /*         pas  = 1./(c_math.pow(2., <double>level)) */
  pas = (1. / pow(2.,((double )__pyx_v_level)));

  /* "D:\wt\trunk\src/_pywt.pyx":298 */
  /*         if self.short_name == "sym" or self.short_name == "coif": */
  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_2, __pyx_n_sym, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; goto __pyx_L1;}
  __pyx_1 = __pyx_1 == 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (!__pyx_1) {
    __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_2, __pyx_n_coif, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 298; goto __pyx_L1;}
    __pyx_1 = __pyx_1 == 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":299 */
    /*             return upcoef('a', [coef], self, level), upcoef('d', [-coef], self, level) */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_3 = PyFloat_FromDouble(coef); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_4 = PyList_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyInt_FromLong(__pyx_v_level); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    Py_INCREF(__pyx_n_a);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_n_a);
    PyTuple_SET_ITEM(__pyx_5, 1, __pyx_4);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 3, __pyx_3);
    __pyx_4 = 0;
    __pyx_3 = 0;
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_5, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_2 = PyFloat_FromDouble((-coef)); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_5 = PyList_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_5, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyInt_FromLong(__pyx_v_level); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(4); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    Py_INCREF(__pyx_n_d);
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_n_d);
    PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_6, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_6, 3, __pyx_2);
    __pyx_5 = 0;
    __pyx_2 = 0;
    __pyx_5 = PyObject_Call(__pyx_3, __pyx_6, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_2 = PyTuple_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 299; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5);
    __pyx_4 = 0;
    __pyx_5 = 0;
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; goto __pyx_L1;}
  __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; goto __pyx_L1;}
  Py_INCREF(__pyx_n_bior);
  PyTuple_SET_ITEM(__pyx_6, 0, __pyx_n_bior);
  Py_INCREF(__pyx_n_rbio);
  PyTuple_SET_ITEM(__pyx_6, 1, __pyx_n_rbio);
  __pyx_1 = PySequence_Contains(__pyx_6, __pyx_3); if (__pyx_1 < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 301; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_6); __pyx_6 = 0;
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":302 */
    /*             if self.short_name == "bior": */
    __pyx_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_4, __pyx_n_bior, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 302; goto __pyx_L1;}
    __pyx_1 = __pyx_1 == 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":303 */
      /*                 other_name = "rbio" + self.name[4:] */
      __pyx_5 = PySequence_GetSlice(((struct WaveletObject *)__pyx_v_self)->name, 4, PY_SSIZE_T_MAX); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; goto __pyx_L1;}
      __pyx_2 = PyNumber_Add(__pyx_n_rbio, __pyx_5); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 303; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      Py_DECREF(__pyx_v_other_name);
      __pyx_v_other_name = __pyx_2;
      __pyx_2 = 0;
      goto __pyx_L3;
    }
    __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_3, __pyx_n_rbio, &__pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 304; goto __pyx_L1;}
    __pyx_1 = __pyx_1 == 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":305 */
      /*                 other_name = "bior" + self.name[4:] */
      __pyx_6 = PySequence_GetSlice(((struct WaveletObject *)__pyx_v_self)->name, 4, PY_SSIZE_T_MAX); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 305; goto __pyx_L1;}
      __pyx_4 = PyNumber_Add(__pyx_n_bior, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 305; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
      Py_DECREF(__pyx_v_other_name);
      __pyx_v_other_name = __pyx_4;
      __pyx_4 = 0;
      goto __pyx_L3;
    }
    __pyx_L3:;

    /* "D:\wt\trunk\src/_pywt.pyx":306 */
    /*             other = Wavelet(other_name) */
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; goto __pyx_L1;}
    Py_INCREF(__pyx_v_other_name);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_other_name);
    __pyx_2 = PyObject_Call(((PyObject*)__pyx_ptype_5_pywt_Wavelet), __pyx_5, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 306; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_v_other);
    __pyx_v_other = __pyx_2;
    __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":307 */
    /*             return upcoef('a', [1], self, level), upcoef('d', [1], self, level), upcoef('a', [1], other, level), upcoef('d', [1], other, level) */
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_6 = PyInt_FromLong(1); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_4 = PyList_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_4, 0, __pyx_6);
    __pyx_6 = 0;
    __pyx_5 = PyInt_FromLong(__pyx_v_level); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_INCREF(__pyx_n_a);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_n_a);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_4);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_2, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_2, 3, __pyx_5);
    __pyx_4 = 0;
    __pyx_5 = 0;
    __pyx_6 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_3 = PyList_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_3, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_2 = PyInt_FromLong(__pyx_v_level); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_INCREF(__pyx_n_d);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_n_d);
    PyTuple_SET_ITEM(__pyx_5, 1, __pyx_3);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 3, __pyx_2);
    __pyx_3 = 0;
    __pyx_2 = 0;
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_5, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_5 = PyList_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_5, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyInt_FromLong(__pyx_v_level); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_7 = PyTuple_New(4); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_INCREF(__pyx_n_a);
    PyTuple_SET_ITEM(__pyx_7, 0, __pyx_n_a);
    PyTuple_SET_ITEM(__pyx_7, 1, __pyx_5);
    Py_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_7, 2, __pyx_v_other);
    PyTuple_SET_ITEM(__pyx_7, 3, __pyx_4);
    __pyx_5 = 0;
    __pyx_4 = 0;
    __pyx_5 = PyObject_Call(__pyx_2, __pyx_7, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_7); __pyx_7 = 0;
    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_7 = PyList_New(1); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_7, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyInt_FromLong(__pyx_v_level); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    __pyx_8 = PyTuple_New(4); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_INCREF(__pyx_n_d);
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_n_d);
    PyTuple_SET_ITEM(__pyx_8, 1, __pyx_7);
    Py_INCREF(__pyx_v_other);
    PyTuple_SET_ITEM(__pyx_8, 2, __pyx_v_other);
    PyTuple_SET_ITEM(__pyx_8, 3, __pyx_2);
    __pyx_7 = 0;
    __pyx_2 = 0;
    __pyx_7 = PyObject_Call(__pyx_4, __pyx_8, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_8); __pyx_8 = 0;
    __pyx_2 = PyTuple_New(4); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 307; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_6);
    PyTuple_SET_ITEM(__pyx_2, 1, __pyx_3);
    PyTuple_SET_ITEM(__pyx_2, 2, __pyx_5);
    PyTuple_SET_ITEM(__pyx_2, 3, __pyx_7);
    __pyx_6 = 0;
    __pyx_3 = 0;
    __pyx_5 = 0;
    __pyx_7 = 0;
    __pyx_r = __pyx_2;
    __pyx_2 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":310 */
    /*             return upcoef('a', [coef], self, level), upcoef('d', [coef], self, level) */
    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_8 = PyFloat_FromDouble(coef); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_6 = PyList_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_6, 0, __pyx_8);
    __pyx_8 = 0;
    __pyx_3 = PyInt_FromLong(__pyx_v_level); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(4); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    Py_INCREF(__pyx_n_a);
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_n_a);
    PyTuple_SET_ITEM(__pyx_5, 1, __pyx_6);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_5, 3, __pyx_3);
    __pyx_6 = 0;
    __pyx_3 = 0;
    __pyx_7 = PyObject_Call(__pyx_4, __pyx_5, 0); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_upcoef); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_8 = PyFloat_FromDouble(coef); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_6 = PyList_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    PyList_SET_ITEM(__pyx_6, 0, __pyx_8);
    __pyx_8 = 0;
    __pyx_3 = PyInt_FromLong(__pyx_v_level); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(4); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    Py_INCREF(__pyx_n_d);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_n_d);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_6);
    Py_INCREF(__pyx_v_self);
    PyTuple_SET_ITEM(__pyx_4, 2, __pyx_v_self);
    PyTuple_SET_ITEM(__pyx_4, 3, __pyx_3);
    __pyx_6 = 0;
    __pyx_3 = 0;
    __pyx_5 = PyObject_Call(__pyx_2, __pyx_4, 0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_8 = PyTuple_New(2); if (!__pyx_8) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 310; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_8, 0, __pyx_7);
    PyTuple_SET_ITEM(__pyx_8, 1, __pyx_5);
    __pyx_7 = 0;
    __pyx_5 = 0;
    __pyx_r = __pyx_8;
    __pyx_8 = 0;
    goto __pyx_L0;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  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);
  Py_XDECREF(__pyx_7);
  Py_XDECREF(__pyx_8);
  __Pyx_AddTraceback("_pywt.Wavelet.wavefun");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_other_name);
  Py_DECREF(__pyx_v_other);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_n_family_name;
static PyObject *__pyx_n_orthogonal;
static PyObject *__pyx_n_biorthogonal;
static PyObject *__pyx_n_symmetry;

static PyObject *__pyx_k89p;

static char (__pyx_k89[]) = "Wavelet %s\n  Family name:    %s\n  Short name:     %s\n  Filters length: %d\n  Orthogonal:     %s\n  Biorthogonal:   %s\n  Symmetry:       %s";

static PyObject *__pyx_f_5_pywt_7Wavelet___str__(PyObject *__pyx_v_self); /*proto*/
static PyObject *__pyx_f_5_pywt_7Wavelet___str__(PyObject *__pyx_v_self) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  PyObject *__pyx_7 = 0;
  Py_INCREF(__pyx_v_self);

  /* "D:\wt\trunk\src/_pywt.pyx":313 */
  /*         return "Wavelet %s\n" \ */
  __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_family_name); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_v_self, __pyx_n_short_name); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_dec_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_orthogonal); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_biorthogonal); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_6 = PyObject_GetAttr(__pyx_v_self, __pyx_n_symmetry); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  __pyx_7 = PyTuple_New(7); if (!__pyx_7) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 320; goto __pyx_L1;}
  Py_INCREF(((struct WaveletObject *)__pyx_v_self)->name);
  PyTuple_SET_ITEM(__pyx_7, 0, ((struct WaveletObject *)__pyx_v_self)->name);
  PyTuple_SET_ITEM(__pyx_7, 1, __pyx_1);
  PyTuple_SET_ITEM(__pyx_7, 2, __pyx_2);
  PyTuple_SET_ITEM(__pyx_7, 3, __pyx_3);
  PyTuple_SET_ITEM(__pyx_7, 4, __pyx_4);
  PyTuple_SET_ITEM(__pyx_7, 5, __pyx_5);
  PyTuple_SET_ITEM(__pyx_7, 6, __pyx_6);
  __pyx_1 = 0;
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_4 = 0;
  __pyx_5 = 0;
  __pyx_6 = 0;
  __pyx_1 = PyNumber_Remainder(__pyx_k89p, __pyx_7); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 319; goto __pyx_L1;}
  Py_DECREF(__pyx_7); __pyx_7 = 0;
  __pyx_r = __pyx_1;
  __pyx_1 = 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_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  Py_XDECREF(__pyx_7);
  __Pyx_AddTraceback("_pywt.Wavelet.__str__");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_wavelet_from_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_5_pywt_wavelet_from_object(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_wavelet = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {"wavelet",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_wavelet)) return 0;
  Py_INCREF(__pyx_v_wavelet);

  /* "D:\wt\trunk\src/_pywt.pyx":323 */
  /*     return c_wavelet_from_object(wavelet) */
  __pyx_1 = __pyx_f_5_pywt_c_wavelet_from_object(__pyx_v_wavelet); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 323; goto __pyx_L1;}
  __pyx_r = __pyx_1;
  __pyx_1 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  __Pyx_AddTraceback("_pywt.wavelet_from_object");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_wavelet);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_c_wavelet_from_object(PyObject *__pyx_v_wavelet) {
  struct WaveletObject *__pyx_v_w;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_INCREF(__pyx_v_wavelet);
  __pyx_v_w = ((struct WaveletObject *)Py_None); Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":327 */
  /*     if c_python.PyObject_IsInstance(wavelet, Wavelet): */
  __pyx_1 = PyObject_IsInstance(__pyx_v_wavelet,((PyObject*)__pyx_ptype_5_pywt_Wavelet));
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":328 */
    /*         return wavelet */
    Py_INCREF(__pyx_v_wavelet);
    __pyx_r = __pyx_v_wavelet;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":330 */
    /*         return Wavelet(wavelet) */
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; goto __pyx_L1;}
    Py_INCREF(__pyx_v_wavelet);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_wavelet);
    __pyx_3 = PyObject_Call(((PyObject*)__pyx_ptype_5_pywt_Wavelet), __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 330; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __pyx_r = __pyx_3;
    __pyx_3 = 0;
    goto __pyx_L0;
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.c_wavelet_from_object");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_wavelet);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_dwt_max_level(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_dwt_max_level[] = "\n    dwt_max_level(int data_len, int filter_len) -> int\n    \n    Compute the maximum usefull level of decomposition\n    for given input data length and wavelet filter length.\n    ";
static PyObject *__pyx_f_5_pywt_dwt_max_level(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data_len = 0;
  PyObject *__pyx_v_filter_len = 0;
  PyObject *__pyx_r;
  index_t __pyx_1;
  index_t __pyx_2;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {"data_len","filter_len",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_data_len, &__pyx_v_filter_len)) return 0;
  Py_INCREF(__pyx_v_data_len);
  Py_INCREF(__pyx_v_filter_len);

  /* "D:\wt\trunk\src/_pywt.pyx":342 */
  /*     return c_wt.dwt_max_level(data_len, filter_len) */
  __pyx_1 = PyInt_AsSsize_t(__pyx_v_data_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; goto __pyx_L1;}
  __pyx_2 = PyInt_AsSsize_t(__pyx_v_filter_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(dwt_max_level(__pyx_1,__pyx_2)); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 342; goto __pyx_L1;}
  __pyx_r = __pyx_3;
  __pyx_3 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("_pywt.dwt_max_level");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_data_len);
  Py_DECREF(__pyx_v_filter_len);
  return __pyx_r;
}

static PyObject *__pyx_n_RuntimeError;

static PyObject *__pyx_k90p;
static PyObject *__pyx_k91p;
static PyObject *__pyx_k92p;
static PyObject *__pyx_k93p;
static PyObject *__pyx_k94p;
static PyObject *__pyx_k95p;
static PyObject *__pyx_k96p;

static char (__pyx_k90[]) = "Invalid data type, 1D array or iterable object required";
static char (__pyx_k91[]) = "Invalid input length (len(data) < 1)";
static char (__pyx_k92[]) = "Invalid output length";
static char (__pyx_k93[]) = "Getting data pointer for buffer failed";
static char (__pyx_k94[]) = "C dwt failed";
static char (__pyx_k95[]) = "Getting data pointer for buffer failed";
static char (__pyx_k96[]) = "C dwt failed";

static PyObject *__pyx_f_5_pywt_dwt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_dwt[] = "\n    (cA, cD) = dwt(data, wavelet, mode=\'sym\')\n\n    Single level Discrete Wavelet Transform\n\n    data    - input signal\n    wavelet - wavelet to use (Wavelet object or name)\n    mode    - signal extension mode, see MODES\n\n    Returns approximation (cA) and detail (cD) coefficients.\n\n    Length of coefficient arrays depends on the selected mode:\n\n        for all modes except periodization:\n            len(cA) == len(cD) == floor((len(data) + wavelet.dec_len - 1) / 2)\n\n        for periodization mode (\"per\"):\n            len(cA) == len(cD) == ceil(len(data) / 2)\n    ";
static PyObject *__pyx_f_5_pywt_dwt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_wavelet = 0;
  PyObject *__pyx_v_mode = 0;
  double (*__pyx_v_input_data);
  double (*__pyx_v_output_data);
  Py_ssize_t __pyx_v_input_len;
  Py_ssize_t __pyx_v_output_len;
  MODE __pyx_v_mode_;
  struct WaveletObject *__pyx_v_w;
  PyObject *__pyx_v_alternative_data;
  PyObject *__pyx_v_cA;
  PyObject *__pyx_v_cD;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  index_t __pyx_5;
  static char *__pyx_argnames[] = {"data","wavelet","mode",0};
  __pyx_v_mode = __pyx_k35;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_data, &__pyx_v_wavelet, &__pyx_v_mode)) return 0;
  Py_INCREF(__pyx_v_data);
  Py_INCREF(__pyx_v_wavelet);
  Py_INCREF(__pyx_v_mode);
  __pyx_v_w = ((struct WaveletObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_alternative_data = Py_None; Py_INCREF(Py_None);
  __pyx_v_cA = Py_None; Py_INCREF(Py_None);
  __pyx_v_cD = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":378 */
  /*     mode_ = c_mode_from_object(mode) */
  __pyx_1 = __pyx_f_5_pywt_c_mode_from_object(__pyx_v_mode); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 378; goto __pyx_L1;}
  __pyx_v_mode_ = __pyx_1;

  /* "D:\wt\trunk\src/_pywt.pyx":381 */
  /*     if object_as_buffer(data, &input_data, &input_len, c'r') < 0: */
  __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_data,(&__pyx_v_input_data),(&__pyx_v_input_len),'r') < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":382 */
    /*         alternative_data = contiguous_array_from_any(data) */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_contiguous_array_from_any); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; goto __pyx_L1;}
    Py_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_data);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 382; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_alternative_data);
    __pyx_v_alternative_data = __pyx_4;
    __pyx_4 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":383 */
    /*         if object_as_buffer(alternative_data, &input_data, &input_len, c'r'): */
    __pyx_1 = __pyx_f_5_pywt_object_as_buffer(__pyx_v_alternative_data,(&__pyx_v_input_data),(&__pyx_v_input_len),'r');
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":384 */
      /*             raise TypeError("Invalid data type, 1D array or iterable object required") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; goto __pyx_L1;}
      Py_INCREF(__pyx_k90p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k90p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 384; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":385 */
  /*     if input_len < 1: */
  __pyx_1 = (__pyx_v_input_len < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":386 */
    /*         raise ValueError("Invalid input length (len(data) < 1)") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; goto __pyx_L1;}
    Py_INCREF(__pyx_k91p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k91p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 386; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "D:\wt\trunk\src/_pywt.pyx":388 */
  /*     w = c_wavelet_from_object(wavelet) */
  __pyx_2 = __pyx_f_5_pywt_c_wavelet_from_object(__pyx_v_wavelet); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 388; goto __pyx_L1;}
  if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_5_pywt_Wavelet)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 388; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_w));
  __pyx_v_w = ((struct WaveletObject *)__pyx_2);
  __pyx_2 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":391 */
  /*     output_len = c_wt.dwt_buffer_length(input_len, w.dec_len, mode_) */
  __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_w), __pyx_n_dec_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 391; goto __pyx_L1;}
  __pyx_5 = PyInt_AsSsize_t(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 391; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_v_output_len = dwt_buffer_length(__pyx_v_input_len,__pyx_5,__pyx_v_mode_);

  /* "D:\wt\trunk\src/_pywt.pyx":392 */
  /*     if output_len < 1: */
  __pyx_1 = (__pyx_v_output_len < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":393 */
    /*         raise RuntimeError("Invalid output length") */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; goto __pyx_L1;}
    Py_INCREF(__pyx_k92p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k92p);
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 393; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "D:\wt\trunk\src/_pywt.pyx":396 */
  /*     cA = memory_buffer_object(output_len) */
  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; goto __pyx_L1;}
  __pyx_2 = PyInt_FromSsize_t(__pyx_v_output_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_Call(__pyx_4, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 396; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_v_cA);
  __pyx_v_cA = __pyx_2;
  __pyx_2 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":397 */
  /*     if object_as_buffer(cA, &output_data, &output_len, c'w') < 0: */
  __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cA,(&__pyx_v_output_data),(&__pyx_v_output_len),'w') < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":398 */
    /*         raise RuntimeError("Getting data pointer for buffer failed") */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 398; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 398; goto __pyx_L1;}
    Py_INCREF(__pyx_k93p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k93p);
    __pyx_2 = PyObject_Call(__pyx_4, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 398; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 398; goto __pyx_L1;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "D:\wt\trunk\src/_pywt.pyx":399 */
  /*     if c_wt.d_dec_a(input_data, input_len, w.w, output_data, output_len, mode_) < 0: */
  __pyx_1 = (d_dec_a(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_output_data,__pyx_v_output_len,__pyx_v_mode_) < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":400 */
    /*         raise RuntimeError("C dwt failed") */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; goto __pyx_L1;}
    Py_INCREF(__pyx_k94p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k94p);
    __pyx_2 = PyObject_Call(__pyx_4, __pyx_3, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 400; goto __pyx_L1;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "D:\wt\trunk\src/_pywt.pyx":403 */
  /*     cD = memory_buffer_object(output_len) */
  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; goto __pyx_L1;}
  __pyx_3 = PyInt_FromSsize_t(__pyx_v_output_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 403; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_cD);
  __pyx_v_cD = __pyx_3;
  __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":404 */
  /*     if object_as_buffer(cD, &output_data, &output_len, c'w') < 0: */
  __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cD,(&__pyx_v_output_data),(&__pyx_v_output_len),'w') < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":405 */
    /*         raise RuntimeError("Getting data pointer for buffer failed") */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; goto __pyx_L1;}
    Py_INCREF(__pyx_k95p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k95p);
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 405; goto __pyx_L1;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "D:\wt\trunk\src/_pywt.pyx":406 */
  /*     if c_wt.d_dec_d(input_data, input_len, w.w, output_data, output_len, mode_) < 0: */
  __pyx_1 = (d_dec_d(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_output_data,__pyx_v_output_len,__pyx_v_mode_) < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":407 */
    /*         raise RuntimeError("C dwt failed") */
    __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; goto __pyx_L1;}
    Py_INCREF(__pyx_k96p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k96p);
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 407; goto __pyx_L1;}
    goto __pyx_L9;
  }
  __pyx_L9:;

  /* "D:\wt\trunk\src/_pywt.pyx":410 */
  /*     return (cA, cD) */
  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 410; goto __pyx_L1;}
  Py_INCREF(__pyx_v_cA);
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_cA);
  Py_INCREF(__pyx_v_cD);
  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_cD);
  __pyx_r = __pyx_4;
  __pyx_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.dwt");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_alternative_data);
  Py_DECREF(__pyx_v_cA);
  Py_DECREF(__pyx_v_cD);
  Py_DECREF(__pyx_v_data);
  Py_DECREF(__pyx_v_wavelet);
  Py_DECREF(__pyx_v_mode);
  return __pyx_r;
}

static PyObject *__pyx_k97p;
static PyObject *__pyx_k98p;

static char (__pyx_k97[]) = "data_len must be > 0";
static char (__pyx_k98[]) = "data_len must be > 0";

static PyObject *__pyx_f_5_pywt_dwt_coeff_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_dwt_coeff_len[] = "\n    dwt_coeff_len(int data_len, int filter_len, mode) -> int\n\n    Returns length of dwt output for given data length, filter length and mode:\n\n        * for all modes except periodization:\n            len(cA) == len(cD) == floor((len(data) + wavelet.dec_len - 1) / 2)\n\n        * for periodization mode (\"per\"):\n            len(cA) == len(cD) == ceil(len(data) / 2)\n    ";
static PyObject *__pyx_f_5_pywt_dwt_coeff_len(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data_len = 0;
  PyObject *__pyx_v_filter_len = 0;
  PyObject *__pyx_v_mode = 0;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  index_t __pyx_5;
  index_t __pyx_6;
  static char *__pyx_argnames[] = {"data_len","filter_len","mode",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO", __pyx_argnames, &__pyx_v_data_len, &__pyx_v_filter_len, &__pyx_v_mode)) return 0;
  Py_INCREF(__pyx_v_data_len);
  Py_INCREF(__pyx_v_filter_len);
  Py_INCREF(__pyx_v_mode);

  /* "D:\wt\trunk\src/_pywt.pyx":425 */
  /*     if data_len < 1: */
  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_data_len, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 425; goto __pyx_L1;}
  __pyx_2 = __pyx_2 < 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":426 */
    /*         raise ValueError("data_len must be > 0") */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; goto __pyx_L1;}
    Py_INCREF(__pyx_k97p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k97p);
    __pyx_4 = PyObject_Call(__pyx_1, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 426; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":427 */
  /*     if filter_len < 1: */
  __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 427; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_filter_len, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 427; goto __pyx_L1;}
  __pyx_2 = __pyx_2 < 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":428 */
    /*         raise ValueError("data_len must be > 0") */
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; goto __pyx_L1;}
    Py_INCREF(__pyx_k98p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k98p);
    __pyx_1 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_1, 0, 0);
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 428; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "D:\wt\trunk\src/_pywt.pyx":430 */
  /*     mode = c_mode_from_object(mode) */
  __pyx_2 = __pyx_f_5_pywt_c_mode_from_object(__pyx_v_mode); if (__pyx_2 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 430; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(__pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 430; goto __pyx_L1;}
  Py_DECREF(__pyx_v_mode);
  __pyx_v_mode = __pyx_3;
  __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":432 */
  /*     return c_wt.dwt_buffer_length(data_len, filter_len, <int>mode) */
  __pyx_5 = PyInt_AsSsize_t(__pyx_v_data_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; goto __pyx_L1;}
  __pyx_6 = PyInt_AsSsize_t(__pyx_v_filter_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; goto __pyx_L1;}
  __pyx_4 = PyInt_FromSsize_t(dwt_buffer_length(__pyx_5,__pyx_6,((int )__pyx_v_mode))); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 432; goto __pyx_L1;}
  __pyx_r = __pyx_4;
  __pyx_4 = 0;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.dwt_coeff_len");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_data_len);
  Py_DECREF(__pyx_v_filter_len);
  Py_DECREF(__pyx_v_mode);
  return __pyx_r;
}

static PyObject *__pyx_n_rec_len;

static PyObject *__pyx_k99p;
static PyObject *__pyx_k100p;
static PyObject *__pyx_k101p;
static PyObject *__pyx_k102p;
static PyObject *__pyx_k103p;
static PyObject *__pyx_k104p;
static PyObject *__pyx_k105p;
static PyObject *__pyx_k106p;
static PyObject *__pyx_k107p;
static PyObject *__pyx_k108p;

static char (__pyx_k99[]) = "Coeffs not specified";
static char (__pyx_k100[]) = "Invalid cA type";
static char (__pyx_k101[]) = "len(cA) < 1";
static char (__pyx_k102[]) = "Invalid cD type";
static char (__pyx_k103[]) = "len(cD) < 1";
static char (__pyx_k104[]) = "Coefficient arrays lengths differs too much";
static char (__pyx_k105[]) = "Coefficient arrays must have the same size";
static char (__pyx_k106[]) = "Invalid coefficient arrays length for specified wavelet. Wavelet and mode must be the same as used for decomposition.";
static char (__pyx_k107[]) = "Getting data pointer for buffer failed";
static char (__pyx_k108[]) = "C idwt failed";

static PyObject *__pyx_f_5_pywt_idwt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_idwt[] = "\n    A = idwt(cA, cD, wavelet, mode=\'sym\', correct_size=0)\n\n    Single level Inverse Discrete Wavelet Transform\n\n    cA      - approximation coefficients\n    cD      - detail coefficients\n    wavelet - wavelet to use (Wavelet object or name)\n    mode    - signal extension mode, see MODES\n\n    correct_size - under normal conditions (all data lengths dyadic) Ca and cD\n                   coefficients lists must have the same lengths. With correct_size\n                   set to True, length of cA may be greater by one than length of cA.\n                   Useful when doing multilevel decomposition and reconstruction of\n                   non-dyadic length signals.\n    \n    Returns single level reconstruction of signal from given coefficients.\n    ";
static PyObject *__pyx_f_5_pywt_idwt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_cA = 0;
  PyObject *__pyx_v_cD = 0;
  PyObject *__pyx_v_wavelet = 0;
  PyObject *__pyx_v_mode = 0;
  int __pyx_v_correct_size;
  double (*__pyx_v_input_data_a);
  double (*__pyx_v_input_data_d);
  double (*__pyx_v_reconstruction_data);
  Py_ssize_t __pyx_v_input_len_a;
  Py_ssize_t __pyx_v_input_len_d;
  Py_ssize_t __pyx_v_input_len;
  Py_ssize_t __pyx_v_reconstruction_len;
  struct WaveletObject *__pyx_v_w;
  PyObject *__pyx_v_alternative_data_a;
  PyObject *__pyx_v_alternative_data_d;
  PyObject *__pyx_v_reconstruction;
  MODE __pyx_v_mode_;
  Py_ssize_t __pyx_v_diff;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_ssize_t __pyx_5;
  index_t __pyx_6;
  static char *__pyx_argnames[] = {"cA","cD","wavelet","mode","correct_size",0};
  __pyx_v_mode = __pyx_k36;
  __pyx_v_correct_size = __pyx_k37;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|Oi", __pyx_argnames, &__pyx_v_cA, &__pyx_v_cD, &__pyx_v_wavelet, &__pyx_v_mode, &__pyx_v_correct_size)) return 0;
  Py_INCREF(__pyx_v_cA);
  Py_INCREF(__pyx_v_cD);
  Py_INCREF(__pyx_v_wavelet);
  Py_INCREF(__pyx_v_mode);
  __pyx_v_w = ((struct WaveletObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_alternative_data_a = Py_None; Py_INCREF(Py_None);
  __pyx_v_alternative_data_d = Py_None; Py_INCREF(Py_None);
  __pyx_v_reconstruction = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":469 */
  /*     input_data_a = input_data_d = NULL */
  __pyx_v_input_data_a = 0;
  __pyx_v_input_data_d = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":470 */
  /*     input_len_a = input_len_d = 0 */
  __pyx_v_input_len_a = 0;
  __pyx_v_input_len_d = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":472 */
  /*     mode_ = c_mode_from_object(mode) */
  __pyx_1 = __pyx_f_5_pywt_c_mode_from_object(__pyx_v_mode); if (__pyx_1 == -1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 472; goto __pyx_L1;}
  __pyx_v_mode_ = __pyx_1;

  /* "D:\wt\trunk\src/_pywt.pyx":474 */
  /*     w = wavelet_from_object(wavelet) */
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_wavelet_from_object); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 474; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 474; goto __pyx_L1;}
  Py_INCREF(__pyx_v_wavelet);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_wavelet);
  __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 474; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_5_pywt_Wavelet)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 474; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_w));
  __pyx_v_w = ((struct WaveletObject *)__pyx_4);
  __pyx_4 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":476 */
  /*     if cA is None and cD is None: */
  __pyx_1 = __pyx_v_cA == Py_None;
  if (__pyx_1) {
    __pyx_1 = __pyx_v_cD == Py_None;
  }
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":477 */
    /*         raise ValueError("Coeffs not specified") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; goto __pyx_L1;}
    Py_INCREF(__pyx_k99p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k99p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 477; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":480 */
  /*     if cA is not None: */
  __pyx_1 = __pyx_v_cA != Py_None;
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":481 */
    /*         if object_as_buffer(cA, &input_data_a, &input_len_a, c'r') < 0: */
    __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cA,(&__pyx_v_input_data_a),(&__pyx_v_input_len_a),'r') < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":482 */
      /*             alternative_data_a = contiguous_array_from_any(cA) */
      __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_contiguous_array_from_any); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; goto __pyx_L1;}
      Py_INCREF(__pyx_v_cA);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cA);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 482; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_v_alternative_data_a);
      __pyx_v_alternative_data_a = __pyx_4;
      __pyx_4 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":483 */
      /*             if object_as_buffer(alternative_data_a, &input_data_a, &input_len_a, c'r'): */
      __pyx_1 = __pyx_f_5_pywt_object_as_buffer(__pyx_v_alternative_data_a,(&__pyx_v_input_data_a),(&__pyx_v_input_len_a),'r');
      if (__pyx_1) {

        /* "D:\wt\trunk\src/_pywt.pyx":484 */
        /*                 raise TypeError("Invalid cA type") */
        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 484; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 484; goto __pyx_L1;}
        Py_INCREF(__pyx_k100p);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k100p);
        __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 484; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __Pyx_Raise(__pyx_4, 0, 0);
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 484; goto __pyx_L1;}
        goto __pyx_L5;
      }
      __pyx_L5:;
      goto __pyx_L4;
    }
    __pyx_L4:;

    /* "D:\wt\trunk\src/_pywt.pyx":485 */
    /*         if input_len_a < 1: */
    __pyx_1 = (__pyx_v_input_len_a < 1);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":486 */
      /*             raise ValueError("len(cA) < 1") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 486; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 486; goto __pyx_L1;}
      Py_INCREF(__pyx_k101p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k101p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 486; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 486; goto __pyx_L1;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "D:\wt\trunk\src/_pywt.pyx":489 */
  /*     if cD is not None: */
  __pyx_1 = __pyx_v_cD != Py_None;
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":490 */
    /*         if object_as_buffer(cD, &input_data_d, &input_len_d, c'r') < 0: */
    __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cD,(&__pyx_v_input_data_d),(&__pyx_v_input_len_d),'r') < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":491 */
      /*             alternative_data_d = contiguous_array_from_any(cD) */
      __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_contiguous_array_from_any); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 491; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 491; goto __pyx_L1;}
      Py_INCREF(__pyx_v_cD);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_cD);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 491; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_v_alternative_data_d);
      __pyx_v_alternative_data_d = __pyx_4;
      __pyx_4 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":492 */
      /*             if object_as_buffer(alternative_data_d, &input_data_d, &input_len_d, c'r'): */
      __pyx_1 = __pyx_f_5_pywt_object_as_buffer(__pyx_v_alternative_data_d,(&__pyx_v_input_data_d),(&__pyx_v_input_len_d),'r');
      if (__pyx_1) {

        /* "D:\wt\trunk\src/_pywt.pyx":493 */
        /*                 raise TypeError("Invalid cD type") */
        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; goto __pyx_L1;}
        Py_INCREF(__pyx_k102p);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k102p);
        __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __Pyx_Raise(__pyx_4, 0, 0);
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 493; goto __pyx_L1;}
        goto __pyx_L9;
      }
      __pyx_L9:;
      goto __pyx_L8;
    }
    __pyx_L8:;

    /* "D:\wt\trunk\src/_pywt.pyx":494 */
    /*         if input_len_d < 1: */
    __pyx_1 = (__pyx_v_input_len_d < 1);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":495 */
      /*             raise ValueError("len(cD) < 1") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; goto __pyx_L1;}
      Py_INCREF(__pyx_k103p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k103p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 495; goto __pyx_L1;}
      goto __pyx_L10;
    }
    __pyx_L10:;
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "D:\wt\trunk\src/_pywt.pyx":499 */
  /*     if input_len_a > 0: */
  __pyx_1 = (__pyx_v_input_len_a > 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":500 */
    /*         if input_len_d > 0: */
    __pyx_1 = (__pyx_v_input_len_d > 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":501 */
      /*             diff = input_len_a - input_len_d */
      __pyx_v_diff = (__pyx_v_input_len_a - __pyx_v_input_len_d);

      /* "D:\wt\trunk\src/_pywt.pyx":502 */
      /*             if correct_size: */
      __pyx_1 = __pyx_v_correct_size;
      if (__pyx_1) {

        /* "D:\wt\trunk\src/_pywt.pyx":503 */
        /*                 if diff < 0 or diff > 1: */
        __pyx_1 = (__pyx_v_diff < 0);
        if (!__pyx_1) {
          __pyx_1 = (__pyx_v_diff > 1);
        }
        if (__pyx_1) {

          /* "D:\wt\trunk\src/_pywt.pyx":504 */
          /*                     raise ValueError("Coefficient arrays lengths differs too much") */
          __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 504; goto __pyx_L1;}
          __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 504; goto __pyx_L1;}
          Py_INCREF(__pyx_k104p);
          PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k104p);
          __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 504; goto __pyx_L1;}
          Py_DECREF(__pyx_2); __pyx_2 = 0;
          Py_DECREF(__pyx_3); __pyx_3 = 0;
          __Pyx_Raise(__pyx_4, 0, 0);
          Py_DECREF(__pyx_4); __pyx_4 = 0;
          {__pyx_filename = __pyx_f[1]; __pyx_lineno = 504; goto __pyx_L1;}
          goto __pyx_L14;
        }
        __pyx_L14:;

        /* "D:\wt\trunk\src/_pywt.pyx":505 */
        /*                 input_len = input_len_a -diff */
        __pyx_v_input_len = (__pyx_v_input_len_a - __pyx_v_diff);
        goto __pyx_L13;
      }
      __pyx_5 = __pyx_v_diff;
      if (__pyx_5) {

        /* "D:\wt\trunk\src/_pywt.pyx":507 */
        /*                 raise ValueError("Coefficient arrays must have the same size") */
        __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 507; goto __pyx_L1;}
        __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 507; goto __pyx_L1;}
        Py_INCREF(__pyx_k105p);
        PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k105p);
        __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 507; goto __pyx_L1;}
        Py_DECREF(__pyx_2); __pyx_2 = 0;
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        __Pyx_Raise(__pyx_4, 0, 0);
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 507; goto __pyx_L1;}
        goto __pyx_L13;
      }
      /*else*/ {

        /* "D:\wt\trunk\src/_pywt.pyx":509 */
        /*                 input_len = input_len_d */
        __pyx_v_input_len = __pyx_v_input_len_d;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    /*else*/ {

      /* "D:\wt\trunk\src/_pywt.pyx":511 */
      /*             input_len = input_len_a */
      __pyx_v_input_len = __pyx_v_input_len_a;
    }
    __pyx_L12:;
    goto __pyx_L11;
  }
  /*else*/ {

    /* "D:\wt\trunk\src/_pywt.pyx":513 */
    /*         input_len = input_len_d */
    __pyx_v_input_len = __pyx_v_input_len_d;
  }
  __pyx_L11:;

  /* "D:\wt\trunk\src/_pywt.pyx":516 */
  /*     reconstruction_len = c_wt.idwt_buffer_length(input_len, w.rec_len, mode_) */
  __pyx_2 = PyObject_GetAttr(((PyObject *)__pyx_v_w), __pyx_n_rec_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 516; goto __pyx_L1;}
  __pyx_6 = PyInt_AsSsize_t(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 516; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_v_reconstruction_len = idwt_buffer_length(__pyx_v_input_len,__pyx_6,__pyx_v_mode_);

  /* "D:\wt\trunk\src/_pywt.pyx":517 */
  /*     if reconstruction_len < 1: */
  __pyx_1 = (__pyx_v_reconstruction_len < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":518 */
    /*         raise ValueError("Invalid coefficient arrays length for specified wavelet. Wavelet and mode must be the same as used for decomposition.") */
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; goto __pyx_L1;}
    Py_INCREF(__pyx_k106p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k106p);
    __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_2, 0, 0);
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 518; goto __pyx_L1;}
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "D:\wt\trunk\src/_pywt.pyx":521 */
  /*     reconstruction = memory_buffer_object(reconstruction_len) */
  __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 521; goto __pyx_L1;}
  __pyx_4 = PyInt_FromSsize_t(__pyx_v_reconstruction_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 521; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 521; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
  __pyx_4 = 0;
  __pyx_4 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 521; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_reconstruction);
  __pyx_v_reconstruction = __pyx_4;
  __pyx_4 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":524 */
  /*     if object_as_buffer(reconstruction, &reconstruction_data, &reconstruction_len, c'w') < 0: */
  __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_reconstruction,(&__pyx_v_reconstruction_data),(&__pyx_v_reconstruction_len),'w') < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":525 */
    /*         raise RuntimeError("Getting data pointer for buffer failed") */
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 525; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 525; goto __pyx_L1;}
    Py_INCREF(__pyx_k107p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k107p);
    __pyx_4 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 525; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 525; goto __pyx_L1;}
    goto __pyx_L16;
  }
  __pyx_L16:;

  /* "D:\wt\trunk\src/_pywt.pyx":529 */
  /*     if c_wt.d_idwt(input_data_a, input_len_a, input_data_d, input_len_d, w.w, reconstruction_data, reconstruction_len, mode_, correct_size) < 0: */
  __pyx_1 = (d_idwt(__pyx_v_input_data_a,__pyx_v_input_len_a,__pyx_v_input_data_d,__pyx_v_input_len_d,__pyx_v_w->w,__pyx_v_reconstruction_data,__pyx_v_reconstruction_len,__pyx_v_mode_,__pyx_v_correct_size) < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":530 */
    /*         raise RuntimeError("C idwt failed") */
    __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; goto __pyx_L1;}
    Py_INCREF(__pyx_k108p);
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_k108p);
    __pyx_4 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 530; goto __pyx_L1;}
    goto __pyx_L17;
  }
  __pyx_L17:;

  /* "D:\wt\trunk\src/_pywt.pyx":532 */
  /*     return reconstruction */
  Py_INCREF(__pyx_v_reconstruction);
  __pyx_r = __pyx_v_reconstruction;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.idwt");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_alternative_data_a);
  Py_DECREF(__pyx_v_alternative_data_d);
  Py_DECREF(__pyx_v_reconstruction);
  Py_DECREF(__pyx_v_cA);
  Py_DECREF(__pyx_v_cD);
  Py_DECREF(__pyx_v_wavelet);
  Py_DECREF(__pyx_v_mode);
  return __pyx_r;
}

static PyObject *__pyx_k111p;
static PyObject *__pyx_k113p;
static PyObject *__pyx_k114p;
static PyObject *__pyx_k115p;
static PyObject *__pyx_k116p;
static PyObject *__pyx_k117p;
static PyObject *__pyx_k118p;
static PyObject *__pyx_k119p;

static char (__pyx_k111[]) = "Arument 1 must be 'a' or 'd' not %s";
static char (__pyx_k113[]) = "level must be greater than 0";
static char (__pyx_k114[]) = "Invalid data type, 1D array or iterable required";
static char (__pyx_k115[]) = "Invalid input length (len(data) < 1)";
static char (__pyx_k116[]) = "Invalid output length";
static char (__pyx_k117[]) = "Getting data pointer for buffer failed";
static char (__pyx_k118[]) = "C rec_a failed";
static char (__pyx_k119[]) = "C rec_d failed";

static PyObject *__pyx_f_5_pywt_upcoef(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_upcoef[] = "upcoef(part, coeffs, wavelet, level=1, take=0)\n    \n    Direct reconstruction from cefficients.\n\n    part    - coefficients type:\n      \'a\' - approximations reconstruction is performed\n      \'d\' - details reconstruction is performed\n    coeffs  - coefficients array\n    wavelet - wavelet to use (Wavelet object or name)\n    level   - multilevel reconstruction level\n    take    - take central part of length equal to \'take\' from the result\n    ";
static PyObject *__pyx_f_5_pywt_upcoef(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_part = 0;
  PyObject *__pyx_v_coeffs = 0;
  PyObject *__pyx_v_wavelet = 0;
  int __pyx_v_level;
  PyObject *__pyx_v_take = 0;
  double (*__pyx_v_input_data);
  double (*__pyx_v_reconstruction_data);
  Py_ssize_t __pyx_v_input_len;
  Py_ssize_t __pyx_v_reconstruction_len;
  struct WaveletObject *__pyx_v_w;
  PyObject *__pyx_v_data;
  PyObject *__pyx_v_alternative_data;
  PyObject *__pyx_v_reconstruction;
  int __pyx_v_i;
  int __pyx_v_rec_a;
  Py_ssize_t __pyx_v_left_bound;
  Py_ssize_t __pyx_v_right_bound;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  index_t __pyx_5;
  Py_ssize_t __pyx_6;
  static char *__pyx_argnames[] = {"part","coeffs","wavelet","level","take",0};
  __pyx_v_level = __pyx_k38;
  __pyx_v_take = __pyx_k39;
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOO|iO", __pyx_argnames, &__pyx_v_part, &__pyx_v_coeffs, &__pyx_v_wavelet, &__pyx_v_level, &__pyx_v_take)) return 0;
  Py_INCREF(__pyx_v_part);
  Py_INCREF(__pyx_v_coeffs);
  Py_INCREF(__pyx_v_wavelet);
  Py_INCREF(__pyx_v_take);
  __pyx_v_w = ((struct WaveletObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_data = Py_None; Py_INCREF(Py_None);
  __pyx_v_alternative_data = Py_None; Py_INCREF(Py_None);
  __pyx_v_reconstruction = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":562 */
  /*     input_data = NULL */
  __pyx_v_input_data = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":563 */
  /*     input_len = 0 */
  __pyx_v_input_len = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":565 */
  /*     if part not in ('a', 'd'): */
  __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 565; goto __pyx_L1;}
  Py_INCREF(__pyx_n_a);
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_n_a);
  Py_INCREF(__pyx_n_d);
  PyTuple_SET_ITEM(__pyx_1, 1, __pyx_n_d);
  __pyx_2 = PySequence_Contains(__pyx_1, __pyx_v_part); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 565; goto __pyx_L1;}
  __pyx_2 = !__pyx_2;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":566 */
    /*         raise ValueError("Arument 1 must be 'a' or 'd' not %s" % part) */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; goto __pyx_L1;}
    __pyx_3 = PyNumber_Remainder(__pyx_k111p, __pyx_v_part); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 566; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":567 */
  /*     rec_a = 0 */
  __pyx_v_rec_a = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":568 */
  /*     if part == 'a': */
  if (PyObject_Cmp(__pyx_v_part, __pyx_n_a, &__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 568; goto __pyx_L1;}
  __pyx_2 = __pyx_2 == 0;
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":569 */
    /*         rec_a = 1 */
    __pyx_v_rec_a = 1;
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "D:\wt\trunk\src/_pywt.pyx":571 */
  /*     w = wavelet_from_object(wavelet) */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_wavelet_from_object); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; goto __pyx_L1;}
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; goto __pyx_L1;}
  Py_INCREF(__pyx_v_wavelet);
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_wavelet);
  __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (!__Pyx_TypeTest(__pyx_3, __pyx_ptype_5_pywt_Wavelet)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 571; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_w));
  __pyx_v_w = ((struct WaveletObject *)__pyx_3);
  __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":573 */
  /*     if level < 1: */
  __pyx_2 = (__pyx_v_level < 1);
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":574 */
    /*         raise ValueError("level must be greater than 0") */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; goto __pyx_L1;}
    Py_INCREF(__pyx_k113p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k113p);
    __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 574; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "D:\wt\trunk\src/_pywt.pyx":577 */
  /*     if object_as_buffer(coeffs, &input_data, &input_len, c'r') < 0: */
  __pyx_2 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_coeffs,(&__pyx_v_input_data),(&__pyx_v_input_len),'r') < 0);
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":578 */
    /*         alternative_data = contiguous_array_from_any(coeffs) */
    __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_contiguous_array_from_any); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; goto __pyx_L1;}
    Py_INCREF(__pyx_v_coeffs);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_coeffs);
    __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 578; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_v_alternative_data);
    __pyx_v_alternative_data = __pyx_3;
    __pyx_3 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":579 */
    /*         if object_as_buffer(alternative_data, &input_data, &input_len, c'r'): */
    __pyx_2 = __pyx_f_5_pywt_object_as_buffer(__pyx_v_alternative_data,(&__pyx_v_input_data),(&__pyx_v_input_len),'r');
    if (__pyx_2) {

      /* "D:\wt\trunk\src/_pywt.pyx":580 */
      /*             raise TypeError("Invalid data type, 1D array or iterable required") */
      __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; goto __pyx_L1;}
      Py_INCREF(__pyx_k114p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k114p);
      __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_3, 0, 0);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 580; goto __pyx_L1;}
      goto __pyx_L6;
    }
    __pyx_L6:;
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "D:\wt\trunk\src/_pywt.pyx":581 */
  /*     if input_len < 1: */
  __pyx_2 = (__pyx_v_input_len < 1);
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":582 */
    /*         raise ValueError("Invalid input length (len(data) < 1)") */
    __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; goto __pyx_L1;}
    Py_INCREF(__pyx_k115p);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k115p);
    __pyx_3 = PyObject_Call(__pyx_1, __pyx_4, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 582; goto __pyx_L1;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "D:\wt\trunk\src/_pywt.pyx":584 */
  /*     for i from 0 <= i < level: */
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_level; ++__pyx_v_i) {

    /* "D:\wt\trunk\src/_pywt.pyx":586 */
    /*         reconstruction_len = c_wt.reconstruction_buffer_length(input_len, w.dec_len) */
    __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_w), __pyx_n_dec_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 586; goto __pyx_L1;}
    __pyx_5 = PyInt_AsSsize_t(__pyx_1); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 586; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    __pyx_v_reconstruction_len = reconstruction_buffer_length(__pyx_v_input_len,__pyx_5);

    /* "D:\wt\trunk\src/_pywt.pyx":587 */
    /*         if reconstruction_len < 1: */
    __pyx_2 = (__pyx_v_reconstruction_len < 1);
    if (__pyx_2) {

      /* "D:\wt\trunk\src/_pywt.pyx":588 */
      /*             raise RuntimeError("Invalid output length") */
      __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 588; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 588; goto __pyx_L1;}
      Py_INCREF(__pyx_k116p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k116p);
      __pyx_1 = PyObject_Call(__pyx_4, __pyx_3, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 588; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_1, 0, 0);
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 588; goto __pyx_L1;}
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "D:\wt\trunk\src/_pywt.pyx":591 */
    /*         reconstruction = memory_buffer_object(reconstruction_len) */
    __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; goto __pyx_L1;}
    __pyx_3 = PyInt_FromSsize_t(__pyx_v_reconstruction_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_Call(__pyx_4, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 591; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_v_reconstruction);
    __pyx_v_reconstruction = __pyx_3;
    __pyx_3 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":592 */
    /*         if object_as_buffer(reconstruction, &reconstruction_data, &reconstruction_len, c'w') < 0: */
    __pyx_2 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_reconstruction,(&__pyx_v_reconstruction_data),(&__pyx_v_reconstruction_len),'w') < 0);
    if (__pyx_2) {

      /* "D:\wt\trunk\src/_pywt.pyx":593 */
      /*             raise RuntimeError("Getting data pointer for buffer failed") */
      __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; goto __pyx_L1;}
      __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; goto __pyx_L1;}
      Py_INCREF(__pyx_k117p);
      PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k117p);
      __pyx_3 = PyObject_Call(__pyx_4, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __Pyx_Raise(__pyx_3, 0, 0);
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 593; goto __pyx_L1;}
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "D:\wt\trunk\src/_pywt.pyx":595 */
    /*         if rec_a: */
    __pyx_2 = __pyx_v_rec_a;
    if (__pyx_2) {

      /* "D:\wt\trunk\src/_pywt.pyx":596 */
      /*             if c_wt.d_rec_a(input_data, input_len, w.w, reconstruction_data, reconstruction_len) < 0: */
      __pyx_2 = (d_rec_a(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_reconstruction_data,__pyx_v_reconstruction_len) < 0);
      if (__pyx_2) {

        /* "D:\wt\trunk\src/_pywt.pyx":597 */
        /*                 raise RuntimeError("C rec_a failed") */
        __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; goto __pyx_L1;}
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; goto __pyx_L1;}
        Py_INCREF(__pyx_k118p);
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k118p);
        __pyx_3 = PyObject_Call(__pyx_4, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __Pyx_Raise(__pyx_3, 0, 0);
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 597; goto __pyx_L1;}
        goto __pyx_L13;
      }
      __pyx_L13:;
      goto __pyx_L12;
    }
    /*else*/ {

      /* "D:\wt\trunk\src/_pywt.pyx":599 */
      /*             if c_wt.d_rec_d(input_data, input_len, w.w, reconstruction_data, reconstruction_len) < 0: */
      __pyx_2 = (d_rec_d(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_reconstruction_data,__pyx_v_reconstruction_len) < 0);
      if (__pyx_2) {

        /* "D:\wt\trunk\src/_pywt.pyx":600 */
        /*                 raise RuntimeError("C rec_d failed") */
        __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; goto __pyx_L1;}
        __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; goto __pyx_L1;}
        Py_INCREF(__pyx_k119p);
        PyTuple_SET_ITEM(__pyx_1, 0, __pyx_k119p);
        __pyx_3 = PyObject_Call(__pyx_4, __pyx_1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; goto __pyx_L1;}
        Py_DECREF(__pyx_4); __pyx_4 = 0;
        Py_DECREF(__pyx_1); __pyx_1 = 0;
        __Pyx_Raise(__pyx_3, 0, 0);
        Py_DECREF(__pyx_3); __pyx_3 = 0;
        {__pyx_filename = __pyx_f[1]; __pyx_lineno = 600; goto __pyx_L1;}
        goto __pyx_L14;
      }
      __pyx_L14:;
    }
    __pyx_L12:;

    /* "D:\wt\trunk\src/_pywt.pyx":601 */
    /*         rec_a = 1 */
    __pyx_v_rec_a = 1;

    /* "D:\wt\trunk\src/_pywt.pyx":603 */
    /*         data = reconstruction # keep reference */
    Py_INCREF(__pyx_v_reconstruction);
    Py_DECREF(__pyx_v_data);
    __pyx_v_data = __pyx_v_reconstruction;

    /* "D:\wt\trunk\src/_pywt.pyx":604 */
    /*         input_len = reconstruction_len */
    __pyx_v_input_len = __pyx_v_reconstruction_len;

    /* "D:\wt\trunk\src/_pywt.pyx":605 */
    /*         input_data = reconstruction_data */
    __pyx_v_input_data = __pyx_v_reconstruction_data;
    __pyx_L8:;
  }
  __pyx_L9:;

  /* "D:\wt\trunk\src/_pywt.pyx":607 */
  /*     if take > 0: */
  __pyx_4 = PyInt_FromLong(0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 607; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_v_take, __pyx_4, &__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 607; goto __pyx_L1;}
  __pyx_2 = __pyx_2 > 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (__pyx_2) {

    /* "D:\wt\trunk\src/_pywt.pyx":608 */
    /*         if take < reconstruction_len: */
    __pyx_1 = PyInt_FromSsize_t(__pyx_v_reconstruction_len); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; goto __pyx_L1;}
    if (PyObject_Cmp(__pyx_v_take, __pyx_1, &__pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 608; goto __pyx_L1;}
    __pyx_2 = __pyx_2 < 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    if (__pyx_2) {

      /* "D:\wt\trunk\src/_pywt.pyx":609 */
      /*             left_bound = right_bound = (reconstruction_len-take)/2 */
      __pyx_3 = PyInt_FromSsize_t(__pyx_v_reconstruction_len); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      __pyx_4 = PyNumber_Subtract(__pyx_3, __pyx_v_take); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_1 = PyInt_FromLong(2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      __pyx_3 = PyNumber_Divide(__pyx_4, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      __pyx_6 = PyInt_AsSsize_t(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      __pyx_v_left_bound = __pyx_6;
      __pyx_6 = PyInt_AsSsize_t(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 609; goto __pyx_L1;}
      __pyx_v_right_bound = __pyx_6;
      Py_DECREF(__pyx_3); __pyx_3 = 0;

      /* "D:\wt\trunk\src/_pywt.pyx":610 */
      /*             if (reconstruction_len-take)%2: */
      __pyx_4 = PyInt_FromSsize_t(__pyx_v_reconstruction_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; goto __pyx_L1;}
      __pyx_1 = PyNumber_Subtract(__pyx_4, __pyx_v_take); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; goto __pyx_L1;}
      __pyx_4 = PyNumber_Remainder(__pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; goto __pyx_L1;}
      Py_DECREF(__pyx_1); __pyx_1 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_2 = PyObject_IsTrue(__pyx_4); if (__pyx_2 < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 610; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      if (__pyx_2) {

        /* "D:\wt\trunk\src/_pywt.pyx":611 */
        /*                 left_bound = left_bound + 1 */
        __pyx_v_left_bound = (__pyx_v_left_bound + 1);
        goto __pyx_L17;
      }
      __pyx_L17:;

      /* "D:\wt\trunk\src/_pywt.pyx":613 */
      /*             return reconstruction[left_bound:-right_bound] */
      __pyx_1 = PySequence_GetSlice(__pyx_v_reconstruction, __pyx_v_left_bound, (-__pyx_v_right_bound)); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 613; goto __pyx_L1;}
      __pyx_r = __pyx_1;
      __pyx_1 = 0;
      goto __pyx_L0;
      goto __pyx_L16;
    }
    __pyx_L16:;
    goto __pyx_L15;
  }
  __pyx_L15:;

  /* "D:\wt\trunk\src/_pywt.pyx":615 */
  /*     return reconstruction */
  Py_INCREF(__pyx_v_reconstruction);
  __pyx_r = __pyx_v_reconstruction;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.upcoef");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_data);
  Py_DECREF(__pyx_v_alternative_data);
  Py_DECREF(__pyx_v_reconstruction);
  Py_DECREF(__pyx_v_part);
  Py_DECREF(__pyx_v_coeffs);
  Py_DECREF(__pyx_v_wavelet);
  Py_DECREF(__pyx_v_take);
  return __pyx_r;
}

static PyObject *__pyx_f_5_pywt_swt_max_level(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_swt_max_level[] = "\n    swt_max_level(int input_len)\n\n    Returns maximum level of Stationary Wavelet Transform for data of given length.\n    ";
static PyObject *__pyx_f_5_pywt_swt_max_level(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_input_len = 0;
  PyObject *__pyx_r;
  index_t __pyx_1;
  PyObject *__pyx_2 = 0;
  static char *__pyx_argnames[] = {"input_len",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_input_len)) return 0;
  Py_INCREF(__pyx_v_input_len);

  /* "D:\wt\trunk\src/_pywt.pyx":626 */
  /*     return c_wt.swt_max_level(input_len) */
  __pyx_1 = PyInt_AsSsize_t(__pyx_v_input_len); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 626; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(swt_max_level(__pyx_1)); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 626; goto __pyx_L1;}
  __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_2);
  __Pyx_AddTraceback("_pywt.swt_max_level");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_input_len);
  return __pyx_r;
}

static PyObject *__pyx_k120p;
static PyObject *__pyx_k121p;
static PyObject *__pyx_k122p;
static PyObject *__pyx_k123p;
static PyObject *__pyx_k124p;
static PyObject *__pyx_k125p;
static PyObject *__pyx_k126p;
static PyObject *__pyx_k127p;
static PyObject *__pyx_k128p;
static PyObject *__pyx_k129p;

static char (__pyx_k120[]) = "Invalid data type, 1D array or iterable object required";
static char (__pyx_k121[]) = "Invalid input data length";
static char (__pyx_k122[]) = "Length of data must be even";
static char (__pyx_k123[]) = "Level must be strictly positive number";
static char (__pyx_k124[]) = "Level value too high (max level for current input len is %d)";
static char (__pyx_k125[]) = "Invalid output length";
static char (__pyx_k126[]) = "Getting data pointer for buffer failed";
static char (__pyx_k127[]) = "C dwt failed";
static char (__pyx_k128[]) = "Getting data pointer for buffer failed";
static char (__pyx_k129[]) = "C dwt failed";

static PyObject *__pyx_f_5_pywt_swt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_5_pywt_swt[] = "\n    swt(object data, object wavelet, int level)\n    \n    Performs multilevel Stationary Wavelet Transform.\n\n    data    - input signal\n    wavelet - wavelet to use (Wavelet object or name)\n    level   - transform level\n\n    Returns list of coefficient pairs in form\n        [(cA1, cD1), (cA2, cD2), ..., (cAn, cDn)], where n = level\n    ";
static PyObject *__pyx_f_5_pywt_swt(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_data = 0;
  PyObject *__pyx_v_wavelet = 0;
  int __pyx_v_level;
  double (*__pyx_v_input_data);
  double (*__pyx_v_output_data);
  Py_ssize_t __pyx_v_input_len;
  Py_ssize_t __pyx_v_output_len;
  struct WaveletObject *__pyx_v_w;
  PyObject *__pyx_v_alternative_data;
  PyObject *__pyx_v_cA;
  PyObject *__pyx_v_cD;
  int __pyx_v_i;
  PyObject *__pyx_v_ret;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  Py_ssize_t __pyx_5;
  static char *__pyx_argnames[] = {"data","wavelet","level",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOi", __pyx_argnames, &__pyx_v_data, &__pyx_v_wavelet, &__pyx_v_level)) return 0;
  Py_INCREF(__pyx_v_data);
  Py_INCREF(__pyx_v_wavelet);
  __pyx_v_w = ((struct WaveletObject *)Py_None); Py_INCREF(Py_None);
  __pyx_v_alternative_data = Py_None; Py_INCREF(Py_None);
  __pyx_v_cA = Py_None; Py_INCREF(Py_None);
  __pyx_v_cD = Py_None; Py_INCREF(Py_None);
  __pyx_v_ret = Py_None; Py_INCREF(Py_None);

  /* "D:\wt\trunk\src/_pywt.pyx":655 */
  /*     if object_as_buffer(data, &input_data, &input_len, c'r') < 0: */
  __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_data,(&__pyx_v_input_data),(&__pyx_v_input_len),'r') < 0);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":656 */
    /*         alternative_data = contiguous_array_from_any(data) */
    __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_contiguous_array_from_any); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 656; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 656; goto __pyx_L1;}
    Py_INCREF(__pyx_v_data);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_data);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 656; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_alternative_data);
    __pyx_v_alternative_data = __pyx_4;
    __pyx_4 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":657 */
    /*         if object_as_buffer(alternative_data, &input_data, &input_len, c'r'): */
    __pyx_1 = __pyx_f_5_pywt_object_as_buffer(__pyx_v_alternative_data,(&__pyx_v_input_data),(&__pyx_v_input_len),'r');
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":658 */
      /*             raise TypeError("Invalid data type, 1D array or iterable object required") */
      __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_TypeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; goto __pyx_L1;}
      __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; goto __pyx_L1;}
      Py_INCREF(__pyx_k120p);
      PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k120p);
      __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; goto __pyx_L1;}
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __Pyx_Raise(__pyx_4, 0, 0);
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 658; goto __pyx_L1;}
      goto __pyx_L3;
    }
    __pyx_L3:;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "D:\wt\trunk\src/_pywt.pyx":659 */
  /*     if input_len < 1: */
  __pyx_1 = (__pyx_v_input_len < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":660 */
    /*         raise ValueError("Invalid input data length") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 660; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 660; goto __pyx_L1;}
    Py_INCREF(__pyx_k121p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k121p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 660; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 660; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_5 = (__pyx_v_input_len % 2);
  if (__pyx_5) {

    /* "D:\wt\trunk\src/_pywt.pyx":662 */
    /*         raise ValueError("Length of data must be even") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 662; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 662; goto __pyx_L1;}
    Py_INCREF(__pyx_k122p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k122p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 662; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 662; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "D:\wt\trunk\src/_pywt.pyx":665 */
  /*     w = wavelet_from_object(wavelet) */
  __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_n_wavelet_from_object); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 665; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 665; goto __pyx_L1;}
  Py_INCREF(__pyx_v_wavelet);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_wavelet);
  __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 665; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (!__Pyx_TypeTest(__pyx_4, __pyx_ptype_5_pywt_Wavelet)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 665; goto __pyx_L1;}
  Py_DECREF(((PyObject *)__pyx_v_w));
  __pyx_v_w = ((struct WaveletObject *)__pyx_4);
  __pyx_4 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":668 */
  /*     if level < 1: */
  __pyx_1 = (__pyx_v_level < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":669 */
    /*         raise ValueError("Level must be strictly positive number") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 669; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 669; goto __pyx_L1;}
    Py_INCREF(__pyx_k123p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k123p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 669; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 669; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_1 = (__pyx_v_level > swt_max_level(__pyx_v_input_len));
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":671 */
    /*         raise ValueError("Level value too high (max level for current input len is %d)" % c_wt.swt_max_level(input_len)) */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(swt_max_level(__pyx_v_input_len)); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    __pyx_4 = PyNumber_Remainder(__pyx_k124p, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 671; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "D:\wt\trunk\src/_pywt.pyx":674 */
  /*     output_len = c_wt.swt_buffer_length(input_len) */
  __pyx_v_output_len = swt_buffer_length(__pyx_v_input_len);

  /* "D:\wt\trunk\src/_pywt.pyx":675 */
  /*     if output_len < 1: */
  __pyx_1 = (__pyx_v_output_len < 1);
  if (__pyx_1) {

    /* "D:\wt\trunk\src/_pywt.pyx":676 */
    /*         raise RuntimeError("Invalid output length") */
    __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 676; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 676; goto __pyx_L1;}
    Py_INCREF(__pyx_k125p);
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_k125p);
    __pyx_4 = PyObject_Call(__pyx_2, __pyx_3, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 676; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[1]; __pyx_lineno = 676; goto __pyx_L1;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "D:\wt\trunk\src/_pywt.pyx":678 */
  /*     ret = [] */
  __pyx_2 = PyList_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 678; goto __pyx_L1;}
  Py_DECREF(__pyx_v_ret);
  __pyx_v_ret = __pyx_2;
  __pyx_2 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":679 */
  /*     for i from 1 <= i <= level: */
  for (__pyx_v_i = 1; __pyx_v_i <= __pyx_v_level; ++__pyx_v_i) {

    /* "D:\wt\trunk\src/_pywt.pyx":681 */
    /*         cD = memory_buffer_object(output_len) */
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 681; goto __pyx_L1;}
    __pyx_4 = PyInt_FromSsize_t(__pyx_v_output_len); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 681; goto __pyx_L1;}
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 681; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 681; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_v_cD);
    __pyx_v_cD = __pyx_4;
    __pyx_4 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":682 */
    /*         cA = memory_buffer_object(output_len) */
    __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_n_memory_buffer_object); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 682; goto __pyx_L1;}
    __pyx_2 = PyInt_FromSsize_t(__pyx_v_output_len); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 682; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 682; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 682; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_v_cA);
    __pyx_v_cA = __pyx_2;
    __pyx_2 = 0;

    /* "D:\wt\trunk\src/_pywt.pyx":685 */
    /*         if object_as_buffer(cD, &output_data, &output_len, c'w') < 0: */
    __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cD,(&__pyx_v_output_data),(&__pyx_v_output_len),'w') < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":686 */
      /*             raise RuntimeError("Getting data pointer for buffer failed") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 686; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 686; goto __pyx_L1;}
      Py_INCREF(__pyx_k126p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k126p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 686; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 686; goto __pyx_L1;}
      goto __pyx_L9;
    }
    __pyx_L9:;

    /* "D:\wt\trunk\src/_pywt.pyx":687 */
    /*         if c_wt.d_swt_d(input_data, input_len, w.w, output_data, output_len, i) < 0: */
    __pyx_1 = (d_swt_d(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_output_data,__pyx_v_output_len,__pyx_v_i) < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":688 */
      /*             raise RuntimeError("C dwt failed") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; goto __pyx_L1;}
      Py_INCREF(__pyx_k127p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k127p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 688; goto __pyx_L1;}
      goto __pyx_L10;
    }
    __pyx_L10:;

    /* "D:\wt\trunk\src/_pywt.pyx":691 */
    /*         if object_as_buffer(cA, &output_data, &output_len, c'w') < 0: */
    __pyx_1 = (__pyx_f_5_pywt_object_as_buffer(__pyx_v_cA,(&__pyx_v_output_data),(&__pyx_v_output_len),'w') < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":692 */
      /*             raise RuntimeError("Getting data pointer for buffer failed") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 692; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 692; goto __pyx_L1;}
      Py_INCREF(__pyx_k128p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k128p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 692; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 692; goto __pyx_L1;}
      goto __pyx_L11;
    }
    __pyx_L11:;

    /* "D:\wt\trunk\src/_pywt.pyx":693 */
    /*         if c_wt.d_swt_a(input_data, input_len, w.w, output_data, output_len, i) < 0: */
    __pyx_1 = (d_swt_a(__pyx_v_input_data,__pyx_v_input_len,__pyx_v_w->w,__pyx_v_output_data,__pyx_v_output_len,__pyx_v_i) < 0);
    if (__pyx_1) {

      /* "D:\wt\trunk\src/_pywt.pyx":694 */
      /*             raise RuntimeError("C dwt failed") */
      __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_RuntimeError); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; goto __pyx_L1;}
      Py_INCREF(__pyx_k129p);
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_k129p);
      __pyx_2 = PyObject_Call(__pyx_3, __pyx_4, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      __Pyx_Raise(__pyx_2, 0, 0);
      Py_DECREF(__pyx_2); __pyx_2 = 0;
      {__pyx_filename = __pyx_f[1]; __pyx_lineno = 694; goto __pyx_L1;}
      goto __pyx_L12;
    }
    __pyx_L12:;

    /* "D:\wt\trunk\src/_pywt.pyx":695 */
    /*         input_data = output_data # a -> input */
    __pyx_v_input_data = __pyx_v_output_data;

    /* "D:\wt\trunk\src/_pywt.pyx":696 */
    /*         input_len = output_len */
    __pyx_v_input_len = __pyx_v_output_len;

    /* "D:\wt\trunk\src/_pywt.pyx":698 */
    /*         ret.append((cA, cD)) */
    __pyx_3 = PyObject_GetAttr(__pyx_v_ret, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; goto __pyx_L1;}
    Py_INCREF(__pyx_v_cA);
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_cA);
    Py_INCREF(__pyx_v_cD);
    PyTuple_SET_ITEM(__pyx_4, 1, __pyx_v_cD);
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_Call(__pyx_3, __pyx_2, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 698; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_L7:;
  }
  __pyx_L8:;

  /* "D:\wt\trunk\src/_pywt.pyx":699 */
  /*     return ret */
  Py_INCREF(__pyx_v_ret);
  __pyx_r = __pyx_v_ret;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("_pywt.swt");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_w);
  Py_DECREF(__pyx_v_alternative_data);
  Py_DECREF(__pyx_v_cA);
  Py_DECREF(__pyx_v_cD);
  Py_DECREF(__pyx_v_ret);
  Py_DECREF(__pyx_v_data);
  Py_DECREF(__pyx_v_wavelet);
  return __pyx_r;
}

static __Pyx_InternTabEntry __pyx_intern_tab[] = {
  {&__pyx_n_Exception, "Exception"},
  {&__pyx_n_MODES, "MODES"},
  {&__pyx_n_MemoryError, "MemoryError"},
  {&__pyx_n_RuntimeError, "RuntimeError"},
  {&__pyx_n_TypeError, "TypeError"},
  {&__pyx_n_ValueError, "ValueError"},
  {&__pyx_n_Wavelet, "Wavelet"},
  {&__pyx_n___all__, "__all__"},
  {&__pyx_n___array_struct__, "__array_struct__"},
  {&__pyx_n___doc__, "__doc__"},
  {&__pyx_n___from_object, "__from_object"},
  {&__pyx_n___id__, "__id__"},
  {&__pyx_n__asym, "_asym"},
  {&__pyx_n_a, "a"},
  {&__pyx_n_append, "append"},
  {&__pyx_n_asymmetric, "asymmetric"},
  {&__pyx_n_bior, "bior"},
  {&__pyx_n_biorthogonal, "biorthogonal"},
  {&__pyx_n_bool, "bool"},
  {&__pyx_n_c_array_interface, "c_array_interface"},
  {&__pyx_n_c_math, "c_math"},
  {&__pyx_n_c_python, "c_python"},
  {&__pyx_n_c_wt, "c_wt"},
  {&__pyx_n_coif, "coif"},
  {&__pyx_n_contiguous_array_from_any, "contiguous_array_from_any"},
  {&__pyx_n_cpd, "cpd"},
  {&__pyx_n_d, "d"},
  {&__pyx_n_db, "db"},
  {&__pyx_n_dec_hi, "dec_hi"},
  {&__pyx_n_dec_len, "dec_len"},
  {&__pyx_n_dec_lo, "dec_lo"},
  {&__pyx_n_dmey, "dmey"},
  {&__pyx_n_dwt, "dwt"},
  {&__pyx_n_dwt_coeff_len, "dwt_coeff_len"},
  {&__pyx_n_dwt_max_level, "dwt_max_level"},
  {&__pyx_n_family_name, "family_name"},
  {&__pyx_n_float, "float"},
  {&__pyx_n_from_object, "from_object"},
  {&__pyx_n_get_filters_coeffs, "get_filters_coeffs"},
  {&__pyx_n_haar, "haar"},
  {&__pyx_n_hasattr, "hasattr"},
  {&__pyx_n_idwt, "idwt"},
  {&__pyx_n_int, "int"},
  {&__pyx_n_len, "len"},
  {&__pyx_n_lower, "lower"},
  {&__pyx_n_map, "map"},
  {&__pyx_n_max, "max"},
  {&__pyx_n_memory_buffer_object, "memory_buffer_object"},
  {&__pyx_n_modes, "modes"},
  {&__pyx_n_numerix, "numerix"},
  {&__pyx_n_object, "object"},
  {&__pyx_n_orthogonal, "orthogonal"},
  {&__pyx_n_per, "per"},
  {&__pyx_n_ppd, "ppd"},
  {&__pyx_n_rbio, "rbio"},
  {&__pyx_n_rec_hi, "rec_hi"},
  {&__pyx_n_rec_len, "rec_len"},
  {&__pyx_n_rec_lo, "rec_lo"},
  {&__pyx_n_short_name, "short_name"},
  {&__pyx_n_sp1, "sp1"},
  {&__pyx_n_staticmethod, "staticmethod"},
  {&__pyx_n_swt, "swt"},
  {&__pyx_n_swt_max_level, "swt_max_level"},
  {&__pyx_n_sym, "sym"},
  {&__pyx_n_symmetric, "symmetric"},
  {&__pyx_n_symmetry, "symmetry"},
  {&__pyx_n_unknown, "unknown"},
  {&__pyx_n_upcoef, "upcoef"},
  {&__pyx_n_wavelet_from_object, "wavelet_from_object"},
  {&__pyx_n_zpd, "zpd"},
  {0, 0}
};

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_k15p, __pyx_k15, sizeof(__pyx_k15)},
  {&__pyx_k17p, __pyx_k17, sizeof(__pyx_k17)},
  {&__pyx_k18p, __pyx_k18, sizeof(__pyx_k18)},
  {&__pyx_k23p, __pyx_k23, sizeof(__pyx_k23)},
  {&__pyx_k50p, __pyx_k50, sizeof(__pyx_k50)},
  {&__pyx_k51p, __pyx_k51, sizeof(__pyx_k51)},
  {&__pyx_k52p, __pyx_k52, sizeof(__pyx_k52)},
  {&__pyx_k57p, __pyx_k57, sizeof(__pyx_k57)},
  {&__pyx_k59p, __pyx_k59, sizeof(__pyx_k59)},
  {&__pyx_k62p, __pyx_k62, sizeof(__pyx_k62)},
  {&__pyx_k63p, __pyx_k63, sizeof(__pyx_k63)},
  {&__pyx_k64p, __pyx_k64, sizeof(__pyx_k64)},
  {&__pyx_k65p, __pyx_k65, sizeof(__pyx_k65)},
  {&__pyx_k66p, __pyx_k66, sizeof(__pyx_k66)},
  {&__pyx_k67p, __pyx_k67, sizeof(__pyx_k67)},
  {&__pyx_k68p, __pyx_k68, sizeof(__pyx_k68)},
  {&__pyx_k70p, __pyx_k70, sizeof(__pyx_k70)},
  {&__pyx_k89p, __pyx_k89, sizeof(__pyx_k89)},
  {&__pyx_k90p, __pyx_k90, sizeof(__pyx_k90)},
  {&__pyx_k91p, __pyx_k91, sizeof(__pyx_k91)},
  {&__pyx_k92p, __pyx_k92, sizeof(__pyx_k92)},
  {&__pyx_k93p, __pyx_k93, sizeof(__pyx_k93)},
  {&__pyx_k94p, __pyx_k94, sizeof(__pyx_k94)},
  {&__pyx_k95p, __pyx_k95, sizeof(__pyx_k95)},
  {&__pyx_k96p, __pyx_k96, sizeof(__pyx_k96)},
  {&__pyx_k97p, __pyx_k97, sizeof(__pyx_k97)},
  {&__pyx_k98p, __pyx_k98, sizeof(__pyx_k98)},
  {&__pyx_k99p, __pyx_k99, sizeof(__pyx_k99)},
  {&__pyx_k100p, __pyx_k100, sizeof(__pyx_k100)},
  {&__pyx_k101p, __pyx_k101, sizeof(__pyx_k101)},
  {&__pyx_k102p, __pyx_k102, sizeof(__pyx_k102)},
  {&__pyx_k103p, __pyx_k103, sizeof(__pyx_k103)},
  {&__pyx_k104p, __pyx_k104, sizeof(__pyx_k104)},
  {&__pyx_k105p, __pyx_k105, sizeof(__pyx_k105)},
  {&__pyx_k106p, __pyx_k106, sizeof(__pyx_k106)},
  {&__pyx_k107p, __pyx_k107, sizeof(__pyx_k107)},
  {&__pyx_k108p, __pyx_k108, sizeof(__pyx_k108)},
  {&__pyx_k111p, __pyx_k111, sizeof(__pyx_k111)},
  {&__pyx_k113p, __pyx_k113, sizeof(__pyx_k113)},
  {&__pyx_k114p, __pyx_k114, sizeof(__pyx_k114)},
  {&__pyx_k115p, __pyx_k115, sizeof(__pyx_k115)},
  {&__pyx_k116p, __pyx_k116, sizeof(__pyx_k116)},
  {&__pyx_k117p, __pyx_k117, sizeof(__pyx_k117)},
  {&__pyx_k118p, __pyx_k118, sizeof(__pyx_k118)},
  {&__pyx_k119p, __pyx_k119, sizeof(__pyx_k119)},
  {&__pyx_k120p, __pyx_k120, sizeof(__pyx_k120)},
  {&__pyx_k121p, __pyx_k121, sizeof(__pyx_k121)},
  {&__pyx_k122p, __pyx_k122, sizeof(__pyx_k122)},
  {&__pyx_k123p, __pyx_k123, sizeof(__pyx_k123)},
  {&__pyx_k124p, __pyx_k124, sizeof(__pyx_k124)},
  {&__pyx_k125p, __pyx_k125, sizeof(__pyx_k125)},
  {&__pyx_k126p, __pyx_k126, sizeof(__pyx_k126)},
  {&__pyx_k127p, __pyx_k127, sizeof(__pyx_k127)},
  {&__pyx_k128p, __pyx_k128, sizeof(__pyx_k128)},
  {&__pyx_k129p, __pyx_k129, sizeof(__pyx_k129)},
  {0, 0, 0}
};

static PyObject *__pyx_tp_new_5_pywt_Wavelet(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  struct WaveletObject *p = (struct WaveletObject *)o;
  p->name = Py_None; Py_INCREF(Py_None);
  p->number = Py_None; Py_INCREF(Py_None);
  if (__pyx_f_5_pywt_7Wavelet___new__(o, a, k) < 0) {
    Py_DECREF(o); o = 0;
  }
  return o;
}

static void __pyx_tp_dealloc_5_pywt_Wavelet(PyObject *o) {
  struct WaveletObject *p = (struct WaveletObject *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_5_pywt_7Wavelet___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(p->name);
  Py_XDECREF(p->number);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_5_pywt_Wavelet(PyObject *o, visitproc v, void *a) {
  int e;
  struct WaveletObject *p = (struct WaveletObject *)o;
  if (p->name) {
    e = (*v)(p->name, a); if (e) return e;
  }
  if (p->number) {
    e = (*v)(p->number, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_5_pywt_Wavelet(PyObject *o) {
  struct WaveletObject *p = (struct WaveletObject *)o;
  Py_XDECREF(p->name);
  p->name = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(p->number);
  p->number = Py_None; Py_INCREF(Py_None);
  return 0;
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_dec_lo(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_6dec_lo___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_dec_hi(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_6dec_hi___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_rec_lo(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_6rec_lo___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_rec_hi(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_6rec_hi___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_rec_len(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_7rec_len___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_dec_len(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_7dec_len___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_family_name(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_11family_name___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_short_name(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_10short_name___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_orthogonal(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_10orthogonal___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_biorthogonal(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_12biorthogonal___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_symmetry(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_8symmetry___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_vanishing_moments_psi(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_21vanishing_moments_psi___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet_vanishing_moments_phi(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_21vanishing_moments_phi___get__(o);
}

static PyObject *__pyx_getprop_5_pywt_7Wavelet__builtin(PyObject *o, void *x) {
  return __pyx_f_5_pywt_7Wavelet_8_builtin___get__(o);
}

static struct PyMethodDef __pyx_methods_5_pywt_Wavelet[] = {
  {"get_filters_coeffs", (PyCFunction)__pyx_f_5_pywt_7Wavelet_get_filters_coeffs, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_7Wavelet_get_filters_coeffs},
  {"wavefun", (PyCFunction)__pyx_f_5_pywt_7Wavelet_wavefun, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_7Wavelet_wavefun},
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_5_pywt_Wavelet[] = {
  {"name", T_OBJECT, offsetof(struct WaveletObject, name), READONLY, 0},
  {"number", T_OBJECT, offsetof(struct WaveletObject, number), READONLY, 0},
  {0, 0, 0, 0, 0}
};

static struct PyGetSetDef __pyx_getsets_5_pywt_Wavelet[] = {
  {"dec_lo", __pyx_getprop_5_pywt_7Wavelet_dec_lo, 0, __pyx_k1, 0},
  {"dec_hi", __pyx_getprop_5_pywt_7Wavelet_dec_hi, 0, __pyx_k2, 0},
  {"rec_lo", __pyx_getprop_5_pywt_7Wavelet_rec_lo, 0, __pyx_k3, 0},
  {"rec_hi", __pyx_getprop_5_pywt_7Wavelet_rec_hi, 0, __pyx_k4, 0},
  {"rec_len", __pyx_getprop_5_pywt_7Wavelet_rec_len, 0, __pyx_k5, 0},
  {"dec_len", __pyx_getprop_5_pywt_7Wavelet_dec_len, 0, __pyx_k6, 0},
  {"family_name", __pyx_getprop_5_pywt_7Wavelet_family_name, 0, __pyx_k7, 0},
  {"short_name", __pyx_getprop_5_pywt_7Wavelet_short_name, 0, __pyx_k8, 0},
  {"orthogonal", __pyx_getprop_5_pywt_7Wavelet_orthogonal, 0, __pyx_k9, 0},
  {"biorthogonal", __pyx_getprop_5_pywt_7Wavelet_biorthogonal, 0, __pyx_k10, 0},
  {"symmetry", __pyx_getprop_5_pywt_7Wavelet_symmetry, 0, __pyx_k11, 0},
  {"vanishing_moments_psi", __pyx_getprop_5_pywt_7Wavelet_vanishing_moments_psi, 0, __pyx_k12, 0},
  {"vanishing_moments_phi", __pyx_getprop_5_pywt_7Wavelet_vanishing_moments_phi, 0, __pyx_k13, 0},
  {"_builtin", __pyx_getprop_5_pywt_7Wavelet__builtin, 0, __pyx_k14, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Wavelet = {
  0, /*nb_add*/
  0, /*nb_subtract*/
  0, /*nb_multiply*/
  0, /*nb_divide*/
  0, /*nb_remainder*/
  0, /*nb_divmod*/
  0, /*nb_power*/
  0, /*nb_negative*/
  0, /*nb_positive*/
  0, /*nb_absolute*/
  0, /*nb_nonzero*/
  0, /*nb_invert*/
  0, /*nb_lshift*/
  0, /*nb_rshift*/
  0, /*nb_and*/
  0, /*nb_xor*/
  0, /*nb_or*/
  0, /*nb_coerce*/
  0, /*nb_int*/
  0, /*nb_long*/
  0, /*nb_float*/
  0, /*nb_oct*/
  0, /*nb_hex*/
  0, /*nb_inplace_add*/
  0, /*nb_inplace_subtract*/
  0, /*nb_inplace_multiply*/
  0, /*nb_inplace_divide*/
  0, /*nb_inplace_remainder*/
  0, /*nb_inplace_power*/
  0, /*nb_inplace_lshift*/
  0, /*nb_inplace_rshift*/
  0, /*nb_inplace_and*/
  0, /*nb_inplace_xor*/
  0, /*nb_inplace_or*/
  0, /*nb_floor_divide*/
  0, /*nb_true_divide*/
  0, /*nb_inplace_floor_divide*/
  0, /*nb_inplace_true_divide*/
};

static PySequenceMethods __pyx_tp_as_sequence_Wavelet = {
  __pyx_f_5_pywt_7Wavelet___len__, /*sq_length*/
  0, /*sq_concat*/
  0, /*sq_repeat*/
  0, /*sq_item*/
  0, /*sq_slice*/
  0, /*sq_ass_item*/
  0, /*sq_ass_slice*/
  0, /*sq_contains*/
  0, /*sq_inplace_concat*/
  0, /*sq_inplace_repeat*/
};

static PyMappingMethods __pyx_tp_as_mapping_Wavelet = {
  __pyx_f_5_pywt_7Wavelet___len__, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

static PyBufferProcs __pyx_tp_as_buffer_Wavelet = {
  0, /*bf_getreadbuffer*/
  0, /*bf_getwritebuffer*/
  0, /*bf_getsegcount*/
  0, /*bf_getcharbuffer*/
};

DL_EXPORT(PyTypeObject) WaveletType = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "_pywt.Wavelet", /*tp_name*/
  sizeof(struct WaveletObject), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_5_pywt_Wavelet, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Wavelet, /*tp_as_number*/
  &__pyx_tp_as_sequence_Wavelet, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Wavelet, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  __pyx_f_5_pywt_7Wavelet___str__, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Wavelet, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    Wavelet(name, filter_bank=None) object describe properties of\n    a wavelet identified by name. In order to use a built-in wavelet\n    the parameter name must be a valid name from wavelist() list.\n    Otherwise a filter_bank argument must be provided.\n    ", /*tp_doc*/
  __pyx_tp_traverse_5_pywt_Wavelet, /*tp_traverse*/
  __pyx_tp_clear_5_pywt_Wavelet, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_5_pywt_Wavelet, /*tp_methods*/
  __pyx_members_5_pywt_Wavelet, /*tp_members*/
  __pyx_getsets_5_pywt_Wavelet, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  0, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_5_pywt_Wavelet, /*tp_new*/
  0, /*tp_free*/
  0, /*tp_is_gc*/
  0, /*tp_bases*/
  0, /*tp_mro*/
  0, /*tp_cache*/
  0, /*tp_subclasses*/
  0, /*tp_weaklist*/
};

static struct PyMethodDef __pyx_methods[] = {
  {"__from_object", (PyCFunction)__pyx_f_5_pywt___from_object, METH_VARARGS|METH_KEYWORDS, 0},
  {"wavelet_from_object", (PyCFunction)__pyx_f_5_pywt_wavelet_from_object, METH_VARARGS|METH_KEYWORDS, 0},
  {"dwt_max_level", (PyCFunction)__pyx_f_5_pywt_dwt_max_level, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_dwt_max_level},
  {"dwt", (PyCFunction)__pyx_f_5_pywt_dwt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_dwt},
  {"dwt_coeff_len", (PyCFunction)__pyx_f_5_pywt_dwt_coeff_len, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_dwt_coeff_len},
  {"idwt", (PyCFunction)__pyx_f_5_pywt_idwt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_idwt},
  {"upcoef", (PyCFunction)__pyx_f_5_pywt_upcoef, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_upcoef},
  {"swt_max_level", (PyCFunction)__pyx_f_5_pywt_swt_max_level, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_swt_max_level},
  {"swt", (PyCFunction)__pyx_f_5_pywt_swt, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5_pywt_swt},
  {0, 0, 0, 0}
};

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

PyMODINIT_FUNC init_pywt(void); /*proto*/
PyMODINIT_FUNC init_pywt(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  PyObject *__pyx_5 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("_pywt", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;};
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;};
  if (__Pyx_InternStrings(__pyx_intern_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;};
  WaveletType.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&WaveletType) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "Wavelet", (PyObject *)&WaveletType) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 126; goto __pyx_L1;}
  __pyx_ptype_5_pywt_Wavelet = &WaveletType;

  /* "D:\wt\trunk\src/_pywt.pyx":3 */
  /* from pywt.numerix import contiguous_array_from_any */
  __pyx_1 = PyList_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;}
  Py_INCREF(__pyx_n_contiguous_array_from_any);
  PyList_SET_ITEM(__pyx_1, 0, __pyx_n_contiguous_array_from_any);
  __pyx_2 = __Pyx_Import(__pyx_k15p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_contiguous_array_from_any); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_contiguous_array_from_any, __pyx_1) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 3; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":5 */
  /* __id__ = "$Id: _pywt.c 57 2006-11-28 21:42:41Z filipw $" */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___id__, __pyx_k17p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 5; goto __pyx_L1;}

  /* "D:\wt\trunk\src/_pywt.pyx":6 */
  /* __doc__ = """Pyrex wrapper for low-level C wavelet transform implementation.""" */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___doc__, __pyx_k18p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 6; goto __pyx_L1;}

  /* "D:\wt\trunk\src/_pywt.pyx":18 */
  /* from numerix import contiguous_array_from_any, memory_buffer_object */
  __pyx_2 = PyList_New(2); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  Py_INCREF(__pyx_n_contiguous_array_from_any);
  PyList_SET_ITEM(__pyx_2, 0, __pyx_n_contiguous_array_from_any);
  Py_INCREF(__pyx_n_memory_buffer_object);
  PyList_SET_ITEM(__pyx_2, 1, __pyx_n_memory_buffer_object);
  __pyx_1 = __Pyx_Import(__pyx_n_numerix, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_contiguous_array_from_any); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_contiguous_array_from_any, __pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_memory_buffer_object); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_memory_buffer_object, __pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 18; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":52 */
  /* class MODES(object): */
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_object); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  if (PyDict_SetItemString(__pyx_1, "__doc__", __pyx_k23p) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  __pyx_2 = __Pyx_CreateClass(__pyx_3, __pyx_1, __pyx_n_MODES, "_pywt"); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":73 */
  /*     zpd = c_wt.MODE_ZEROPAD */
  __pyx_3 = PyInt_FromLong(MODE_ZEROPAD); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_zpd, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 73; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":74 */
  /*     cpd = c_wt.MODE_CONSTANT_EDGE */
  __pyx_3 = PyInt_FromLong(MODE_CONSTANT_EDGE); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_cpd, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 74; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":75 */
  /*     sym = c_wt.MODE_SYMMETRIC */
  __pyx_3 = PyInt_FromLong(MODE_SYMMETRIC); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_sym, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 75; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":76 */
  /*     ppd = c_wt.MODE_PERIODIC */
  __pyx_3 = PyInt_FromLong(MODE_PERIODIC); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_ppd, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 76; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":77 */
  /*     sp1 = c_wt.MODE_SMOOTH */
  __pyx_3 = PyInt_FromLong(MODE_SMOOTH); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_sp1, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 77; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":78 */
  /*     per = c_wt.MODE_PERIODIZATION */
  __pyx_3 = PyInt_FromLong(MODE_PERIODIZATION); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n_per, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 78; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":80 */
  /*     _asym = c_wt.MODE_ASYMMETRIC */
  __pyx_3 = PyInt_FromLong(MODE_ASYMMETRIC); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_2, __pyx_n__asym, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 80; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":82 */
  /*     modes = ["zpd", "cpd", "sym", "ppd", "sp1", "per"] */
  __pyx_3 = PyList_New(6); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; goto __pyx_L1;}
  Py_INCREF(__pyx_n_zpd);
  PyList_SET_ITEM(__pyx_3, 0, __pyx_n_zpd);
  Py_INCREF(__pyx_n_cpd);
  PyList_SET_ITEM(__pyx_3, 1, __pyx_n_cpd);
  Py_INCREF(__pyx_n_sym);
  PyList_SET_ITEM(__pyx_3, 2, __pyx_n_sym);
  Py_INCREF(__pyx_n_ppd);
  PyList_SET_ITEM(__pyx_3, 3, __pyx_n_ppd);
  Py_INCREF(__pyx_n_sp1);
  PyList_SET_ITEM(__pyx_3, 4, __pyx_n_sp1);
  Py_INCREF(__pyx_n_per);
  PyList_SET_ITEM(__pyx_3, 5, __pyx_n_per);
  if (PyObject_SetAttr(__pyx_2, __pyx_n_modes, __pyx_3) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 82; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":84 */
  /*     from_object = staticmethod(__from_object) */
  __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_staticmethod); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; goto __pyx_L1;}
  __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_n___from_object); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
  __pyx_4 = 0;
  __pyx_4 = PyObject_Call(__pyx_3, __pyx_5, 0); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  if (PyObject_SetAttr(__pyx_2, __pyx_n_from_object, __pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 84; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (PyObject_SetAttr(__pyx_m, __pyx_n_MODES, __pyx_2) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 52; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":141 */
  /*     def __new__(self, char* name="", object filter_bank=None): */
  __pyx_k31 = __pyx_k30;
  Py_INCREF(Py_None);
  __pyx_k32 = Py_None;

  /* "D:\wt\trunk\src/_pywt.pyx":282 */
  /*     def wavefun(self, int level=3): */
  __pyx_k33 = 3;

  /* "D:\wt\trunk\src/_pywt.pyx":344 */
  /* def dwt(object data, object wavelet, object mode='sym'): */
  Py_INCREF(__pyx_n_sym);
  __pyx_k35 = __pyx_n_sym;

  /* "D:\wt\trunk\src/_pywt.pyx":437 */
  /* def idwt(object cA, object cD, object wavelet, object mode = c_wt.MODE_SYMMETRIC, int correct_size = 0): */
  __pyx_3 = PyInt_FromLong(MODE_SYMMETRIC); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 437; goto __pyx_L1;}
  __pyx_k36 = __pyx_3;
  __pyx_3 = 0;
  __pyx_k37 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":537 */
  /* def upcoef(part, coeffs, wavelet, int level=1, take=0): */
  __pyx_k38 = 1;
  __pyx_5 = PyInt_FromLong(0); if (!__pyx_5) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 537; goto __pyx_L1;}
  __pyx_k39 = __pyx_5;
  __pyx_5 = 0;

  /* "D:\wt\trunk\src/_pywt.pyx":703 */
  /* __all__ = ['MODES', 'Wavelet', 'dwt', 'dwt_coeff_len', 'dwt_max_level', */
  __pyx_4 = PyList_New(9); if (!__pyx_4) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; goto __pyx_L1;}
  Py_INCREF(__pyx_n_MODES);
  PyList_SET_ITEM(__pyx_4, 0, __pyx_n_MODES);
  Py_INCREF(__pyx_n_Wavelet);
  PyList_SET_ITEM(__pyx_4, 1, __pyx_n_Wavelet);
  Py_INCREF(__pyx_n_dwt);
  PyList_SET_ITEM(__pyx_4, 2, __pyx_n_dwt);
  Py_INCREF(__pyx_n_dwt_coeff_len);
  PyList_SET_ITEM(__pyx_4, 3, __pyx_n_dwt_coeff_len);
  Py_INCREF(__pyx_n_dwt_max_level);
  PyList_SET_ITEM(__pyx_4, 4, __pyx_n_dwt_max_level);
  Py_INCREF(__pyx_n_idwt);
  PyList_SET_ITEM(__pyx_4, 5, __pyx_n_idwt);
  Py_INCREF(__pyx_n_swt);
  PyList_SET_ITEM(__pyx_4, 6, __pyx_n_swt);
  Py_INCREF(__pyx_n_swt_max_level);
  PyList_SET_ITEM(__pyx_4, 7, __pyx_n_swt_max_level);
  Py_INCREF(__pyx_n_upcoef);
  PyList_SET_ITEM(__pyx_4, 8, __pyx_n_upcoef);
  if (PyObject_SetAttr(__pyx_m, __pyx_n___all__, __pyx_4) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 703; goto __pyx_L1;}
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  __Pyx_AddTraceback("_pywt");
}

static char *__pyx_filenames[] = {
  "arraytools.pxi",
  "_pywt.pyx",
};

/* Runtime support code */

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

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) {
    PyObject *__import__ = 0;
    PyObject *empty_list = 0;
    PyObject *module = 0;
    PyObject *global_dict = 0;
    PyObject *empty_dict = 0;
    PyObject *list;
    __import__ = PyObject_GetAttrString(__pyx_b, "__import__");
    if (!__import__)
        goto bad;
    if (from_list)
        list = from_list;
    else {
        empty_list = PyList_New(0);
        if (!empty_list)
            goto bad;
        list = empty_list;
    }
    global_dict = PyModule_GetDict(__pyx_m);
    if (!global_dict)
        goto bad;
    empty_dict = PyDict_New();
    if (!empty_dict)
        goto bad;
    module = PyObject_CallFunction(__import__, "OOOO",
        name, global_dict, empty_dict, list);
bad:
    Py_XDECREF(empty_list);
    Py_XDECREF(__import__);
    Py_XDECREF(empty_dict);
    return module;
}

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 PyObject *__Pyx_CreateClass(
    PyObject *bases, PyObject *dict, PyObject *name, char *modname)
{
    PyObject *py_modname;
    PyObject *result = 0;
    
    py_modname = PyString_FromString(modname);
    if (!py_modname)
        goto bad;
    if (PyDict_SetItemString(dict, "__module__", py_modname) < 0)
        goto bad;
    result = PyClass_New(bases, dict, name);
bad:
    Py_XDECREF(py_modname);
    return result;
}

static PyObject *__Pyx_GetExcValue(void) {
    PyObject *type = 0, *value = 0, *tb = 0;
    PyObject *result = 0;
    PyThreadState *tstate = PyThreadState_Get();
    PyErr_Fetch(&type, &value, &tb);
    PyErr_NormalizeException(&type, &value, &tb);
    if (PyErr_Occurred())
        goto bad;
    if (!value) {
        value = Py_None;
        Py_INCREF(value);
    }
    Py_XDECREF(tstate->exc_type);
    Py_XDECREF(tstate->exc_value);
    Py_XDECREF(tstate->exc_traceback);
    tstate->exc_type = type;
    tstate->exc_value = value;
    tstate->exc_traceback = tb;
    result = value;
    Py_XINCREF(result);
    type = 0;
    value = 0;
    tb = 0;
bad:
    Py_XDECREF(type);
    Py_XDECREF(value);
    Py_XDECREF(tb);
    return result;
}

static void __Pyx_ReRaise(void) {
    PyThreadState *tstate = PyThreadState_Get();
    PyObject *type = tstate->exc_type;
    PyObject *value = tstate->exc_value;
    PyObject *tb = tstate->exc_traceback;
    Py_XINCREF(type);
    Py_XINCREF(value);
    Py_XINCREF(tb);
    PyErr_Restore(type, value, tb);
}

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);
    }
    /* Next, repeatedly, replace a tuple exception with its first item */
    while (PyTuple_Check(type) && PyTuple_Size(type) > 0) {
        PyObject *tmp = type;
        type = PyTuple_GET_ITEM(type, 0);
        Py_INCREF(type);
        Py_DECREF(tmp);
    }
    if (PyString_CheckExact(type)) {
        /* Raising builtin string is deprecated but still allowed --
         * do nothing.  Raising an instance of a new-style str
         * subclass is right out. */
        if (PyErr_Warn(PyExc_DeprecationWarning,
                   "raising a string exception is deprecated"))
                goto raise_error;
    }
    else if (PyType_Check(type) || PyClass_Check(type))
        ; /* PyErr_NormalizeException(&type, &value, &tb); */
    else if (PyInstance_Check(type)) {
        /* 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;
        }
        else {
            /* Normalize to raise <class>, <instance> */
            Py_DECREF(value);
            value = type;
            type = (PyObject*) ((PyInstanceObject*)type)->in_class;
            Py_INCREF(type);
        }
    }
    else if (PyType_IsSubtype(type->ob_type, (PyTypeObject*)PyExc_Exception)) {
        /* Raising a new-style object (in Py2.5).
           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;
        }
        else {
                /* Normalize to raise <class>, <instance> */
                Py_DECREF(value);
                value = type;
                type = (PyObject*) type->ob_type;
                Py_INCREF(type);
        }
    }
    else {
        /* Not something you can raise.  You get an exception
           anyway, just not what you specified :-) */
        PyErr_Format(PyExc_TypeError,
                     "exceptions must be classes, instances, or "
                     "strings (deprecated), not %s",
                     type->ob_type->tp_name);
        goto raise_error;
    }
    PyErr_Restore(type, value, tb);
    return;
raise_error:
    Py_XDECREF(value);
    Py_XDECREF(type);
    Py_XDECREF(tb);
    return;
}

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

static PyObject *__Pyx_UnpackItem(PyObject *seq, Py_ssize_t i) {
  PyObject *item;
  if (!(item = PySequence_GetItem(seq, i))) {
    if (PyErr_ExceptionMatches(PyExc_IndexError))
    	__Pyx_UnpackError();
  }
  return item;
}

static int __Pyx_EndUnpack(PyObject *seq, Py_ssize_t i) {
  PyObject *item;
  if ((item = PySequence_GetItem(seq, i))) {
    Py_DECREF(item);
    __Pyx_UnpackError();
    return -1;
  }
  PyErr_Clear();
    return 0;
}

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) {
    if (!type) {
        PyErr_Format(PyExc_SystemError, "Missing type object");
        return 0;
    }
    if (obj == Py_None || PyObject_TypeCheck(obj, type))
        return 1;
    PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s",
        obj->ob_type->tp_name, type->tp_name);
    return 0;
}

static int __Pyx_InternStrings(__Pyx_InternTabEntry *t) {
    while (t->p) {
        *t->p = PyString_InternFromString(t->s);
        if (!*t->p)
            return -1;
        ++t;
    }
    return 0;
}

static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) {
    while (t->p) {
        *t->p = PyString_FromStringAndSize(t->s, t->n - 1);
        if (!*t->p)
            return -1;
        ++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);
}
