/* Generated by Pyrex 0.9.8.5 on Fri May 22 14:37:43 2009 */

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


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

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

static char __pyx_mdoc[] = "\nClass LazyFunction is defined here.\n";

static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/

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

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

static int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v); /*proto*/

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

static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/

static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/

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

/* Declarations from pymc.LazyFunction */


/* Declarations from implementation of pymc.LazyFunction */

struct __pyx_obj_4pymc_12LazyFunction_NumberHolder {
  PyObject_HEAD
  int number;
};

struct __pyx_obj_4pymc_12LazyFunction_PointerHolder {
  PyObject_HEAD
  int *my_pointer;
};

struct __pyx_obj_4pymc_12LazyFunction_Counter {
  PyObject_HEAD
  long count;
  long totcount;
  long lastcount;
};

struct __pyx_obj_4pymc_12LazyFunction_LazyFunction {
  PyObject_HEAD
  struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *__pyx_vtab;
  PyObject *arguments;
  PyObject *fun;
  PyObject *argument_values;
  int cache_depth;
  int n_ultimate_args;
  PyObject *ultimate_args;
  PyObject *cached_values;
  int *frame_queue;
  long *cached_counts;
  long **ultimate_arg_counters;
};





struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction {
  int (*check_argument_caches)(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *);
  void (*cache)(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *,PyObject *);
};
static struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *__pyx_vtabptr_4pymc_12LazyFunction_LazyFunction;

static PyTypeObject *__pyx_ptype_4pymc_12LazyFunction_NumberHolder = 0;
static PyTypeObject *__pyx_ptype_4pymc_12LazyFunction_PointerHolder = 0;
static PyTypeObject *__pyx_ptype_4pymc_12LazyFunction_Counter = 0;
static PyTypeObject *__pyx_ptype_4pymc_12LazyFunction_LazyFunction = 0;

static char __pyx_k1[] = "iterkeys";
static char __pyx_k2[] = "range";
static char __pyx_k3[] = "append";
static char __pyx_k4[] = "counter";
static char __pyx_k5[] = "np";
static char __pyx_k6[] = "empty";
static char __pyx_k7[] = "dtype";
static char __pyx_k8[] = "value";
static char __pyx_k9[] = "reStructuredText";
static char __pyx_k10[] = "__docformat__";
static char __pyx_k11[] = "Anand Patil, anand.prabhakar.patil@gmail.com";
static char __pyx_k12[] = "__author__";
static char __pyx_k13[] = "PyMCObjects";
static char __pyx_k14[] = "Node";
static char __pyx_k15[] = "ContainerBase";
static char __pyx_k16[] = "Variable";
static char __pyx_k17[] = "numpy";

static PyObject *__pyx_n_ContainerBase;
static PyObject *__pyx_n_Node;
static PyObject *__pyx_n_PyMCObjects;
static PyObject *__pyx_n_Variable;
static PyObject *__pyx_n___author__;
static PyObject *__pyx_n___docformat__;
static PyObject *__pyx_n_append;
static PyObject *__pyx_n_counter;
static PyObject *__pyx_n_dtype;
static PyObject *__pyx_n_empty;
static PyObject *__pyx_n_iterkeys;
static PyObject *__pyx_n_np;
static PyObject *__pyx_n_numpy;
static PyObject *__pyx_n_range;
static PyObject *__pyx_n_reStructuredText;
static PyObject *__pyx_n_value;

static PyObject *__pyx_k11p;

static __Pyx_StringTabEntry __pyx_string_tab[] = {
  {&__pyx_n_ContainerBase, 1, __pyx_k15, sizeof(__pyx_k15)},
  {&__pyx_n_Node, 1, __pyx_k14, sizeof(__pyx_k14)},
  {&__pyx_n_PyMCObjects, 1, __pyx_k13, sizeof(__pyx_k13)},
  {&__pyx_n_Variable, 1, __pyx_k16, sizeof(__pyx_k16)},
  {&__pyx_n___author__, 1, __pyx_k12, sizeof(__pyx_k12)},
  {&__pyx_n___docformat__, 1, __pyx_k10, sizeof(__pyx_k10)},
  {&__pyx_n_append, 1, __pyx_k3, sizeof(__pyx_k3)},
  {&__pyx_n_counter, 1, __pyx_k4, sizeof(__pyx_k4)},
  {&__pyx_n_dtype, 1, __pyx_k7, sizeof(__pyx_k7)},
  {&__pyx_n_empty, 1, __pyx_k6, sizeof(__pyx_k6)},
  {&__pyx_n_iterkeys, 1, __pyx_k1, sizeof(__pyx_k1)},
  {&__pyx_n_np, 1, __pyx_k5, sizeof(__pyx_k5)},
  {&__pyx_n_numpy, 1, __pyx_k17, sizeof(__pyx_k17)},
  {&__pyx_n_range, 1, __pyx_k2, sizeof(__pyx_k2)},
  {&__pyx_n_reStructuredText, 1, __pyx_k9, sizeof(__pyx_k9)},
  {&__pyx_n_value, 1, __pyx_k8, sizeof(__pyx_k8)},
  {&__pyx_k11p, 0, __pyx_k11, sizeof(__pyx_k11)},
  {0, 0, 0, 0}
};



/* Implementation of pymc.LazyFunction */

static int __pyx_f_4pymc_12LazyFunction_12NumberHolder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4pymc_12LazyFunction_12NumberHolder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
  Py_INCREF(__pyx_v_self);
  ((struct __pyx_obj_4pymc_12LazyFunction_NumberHolder *)__pyx_v_self)->number = 1000;

  __pyx_r = 0;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_4pymc_12LazyFunction_13PointerHolder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4pymc_12LazyFunction_13PointerHolder___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_number_holder = 0;
  struct __pyx_obj_4pymc_12LazyFunction_NumberHolder *__pyx_v_real_holder;
  int __pyx_r;
  static char *__pyx_argnames[] = {"number_holder",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_number_holder)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_number_holder);
  __pyx_v_real_holder = ((struct __pyx_obj_4pymc_12LazyFunction_NumberHolder *)Py_None); Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":28 */
  if (!__Pyx_TypeTest(__pyx_v_number_holder, __pyx_ptype_4pymc_12LazyFunction_NumberHolder)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;}
  Py_INCREF(__pyx_v_number_holder);
  Py_DECREF(((PyObject *)__pyx_v_real_holder));
  __pyx_v_real_holder = ((struct __pyx_obj_4pymc_12LazyFunction_NumberHolder *)__pyx_v_number_holder);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":29 */
  ((struct __pyx_obj_4pymc_12LazyFunction_PointerHolder *)__pyx_v_self)->my_pointer = (&__pyx_v_real_holder->number);

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("pymc.LazyFunction.PointerHolder.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_real_holder);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_number_holder);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_13PointerHolder_get_number(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_13PointerHolder_get_number(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromLong((((struct __pyx_obj_4pymc_12LazyFunction_PointerHolder *)__pyx_v_self)->my_pointer[0])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; 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("pymc.LazyFunction.PointerHolder.get_number");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_4pymc_12LazyFunction_7Counter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4pymc_12LazyFunction_7Counter___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
  Py_INCREF(__pyx_v_self);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":38 */
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->count = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":39 */
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->totcount = 0;

  __pyx_r = 0;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_get_count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_get_count(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->count); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; 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("pymc.LazyFunction.Counter.get_count");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_click(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_click(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":43 */
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->lastcount = ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->count;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":44 */
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->count = (((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->totcount + 1);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":45 */
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->totcount += 1;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_unclick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_7Counter_unclick(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_r;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->count = ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_v_self)->lastcount;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static int __pyx_f_4pymc_12LazyFunction_12LazyFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static int __pyx_f_4pymc_12LazyFunction_12LazyFunction___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_fun = 0;
  PyObject *__pyx_v_arguments = 0;
  PyObject *__pyx_v_ultimate_args = 0;
  PyObject *__pyx_v_cache_depth = 0;
  PyObject *__pyx_v_arg;
  PyObject *__pyx_v_name;
  int __pyx_v_i;
  struct __pyx_obj_4pymc_12LazyFunction_Counter *__pyx_v_this_counter;
  int __pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  Py_ssize_t __pyx_4;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  static char *__pyx_argnames[] = {"fun","arguments","ultimate_args","cache_depth",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOO", __pyx_argnames, &__pyx_v_fun, &__pyx_v_arguments, &__pyx_v_ultimate_args, &__pyx_v_cache_depth)) return -1;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_fun);
  Py_INCREF(__pyx_v_arguments);
  Py_INCREF(__pyx_v_ultimate_args);
  Py_INCREF(__pyx_v_cache_depth);
  __pyx_v_arg = Py_None; Py_INCREF(Py_None);
  __pyx_v_name = Py_None; Py_INCREF(Py_None);
  __pyx_v_this_counter = ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)Py_None); Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":119 */
  Py_INCREF(__pyx_v_arguments);
  Py_DECREF(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->arguments);
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->arguments = __pyx_v_arguments;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":121 */
  __pyx_1 = PyInt_AsLong(__pyx_v_cache_depth); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; goto __pyx_L1;}
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth = __pyx_1;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":124 */
  __pyx_2 = PyObject_GetAttr(__pyx_v_arguments, __pyx_n_iterkeys); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
  __pyx_3 = PyObject_CallObject(__pyx_2, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  for (;;) {
    __pyx_3 = PyIter_Next(__pyx_2);
    if (!__pyx_3) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; goto __pyx_L1;}
      break;
    }
    Py_DECREF(__pyx_v_name);
    __pyx_v_name = __pyx_3;
    __pyx_3 = 0;
    __pyx_3 = PyObject_GetItem(__pyx_v_arguments, __pyx_v_name); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    Py_DECREF(__pyx_v_arg);
    __pyx_v_arg = __pyx_3;
    __pyx_3 = 0;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":128 */
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  Py_INCREF(__pyx_v_ultimate_args);
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_ultimate_args);
  __pyx_2 = PyObject_CallObject(((PyObject *)(&PyList_Type)), __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_args);
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_args = __pyx_2;
  __pyx_2 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":129 */
  __pyx_4 = PyObject_Length(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_args); if (__pyx_4 == -1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args = __pyx_4;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":132 */
  __pyx_3 = PyList_New(0); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; goto __pyx_L1;}
  Py_DECREF(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_values);
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_values = __pyx_3;
  __pyx_3 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":133 */
  __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_range); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  for (;;) {
    __pyx_5 = PyIter_Next(__pyx_2);
    if (!__pyx_5) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
      break;
    }
    __pyx_1 = PyInt_AsLong(__pyx_5); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 133; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_v_i = __pyx_1;
    __pyx_3 = PyObject_GetAttr(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_values, __pyx_n_append); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    Py_INCREF(Py_None);
    PyTuple_SET_ITEM(__pyx_5, 0, Py_None);
    __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_5); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 134; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
  }
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":137 */
  Py_INCREF(__pyx_v_fun);
  Py_DECREF(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->fun);
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->fun = __pyx_v_fun;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":140 */
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->frame_queue = ((int *)malloc(((sizeof(int)) * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth)));

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":141 */
  __pyx_1 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; ++__pyx_v_i) {
    (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->frame_queue[__pyx_v_i]) = __pyx_v_i;
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":144 */
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_arg_counters = ((long **)malloc(((sizeof(long *)) * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args)));

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":145 */
  __pyx_1 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; ++__pyx_v_i) {

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":146 */
    __pyx_3 = __Pyx_GetItemInt(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_args, __pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; goto __pyx_L1;}
    __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_n_counter); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    if (!__Pyx_TypeTest(__pyx_5, __pyx_ptype_4pymc_12LazyFunction_Counter)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; goto __pyx_L1;}
    Py_DECREF(((PyObject *)__pyx_v_this_counter));
    __pyx_v_this_counter = ((struct __pyx_obj_4pymc_12LazyFunction_Counter *)__pyx_5);
    __pyx_5 = 0;

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":147 */
    (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_arg_counters[__pyx_v_i]) = (&__pyx_v_this_counter->count);
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":149 */
  ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_counts = ((long *)malloc((((sizeof(long)) * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args) * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth)));

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":150 */
  __pyx_1 = (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth);
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; ++__pyx_v_i) {
    (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_counts[__pyx_v_i]) = (-1);
  }

  __pyx_r = 0;
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.__init__");
  __pyx_r = -1;
  __pyx_L0:;
  Py_DECREF(__pyx_v_arg);
  Py_DECREF(__pyx_v_name);
  Py_DECREF(__pyx_v_this_counter);
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_fun);
  Py_DECREF(__pyx_v_arguments);
  Py_DECREF(__pyx_v_ultimate_args);
  Py_DECREF(__pyx_v_cache_depth);
  return __pyx_r;
}

static void __pyx_f_4pymc_12LazyFunction_12LazyFunction___dealloc__(PyObject *__pyx_v_self); /*proto*/
static void __pyx_f_4pymc_12LazyFunction_12LazyFunction___dealloc__(PyObject *__pyx_v_self) {
  Py_INCREF(__pyx_v_self);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":154 */
  free(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->frame_queue);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":155 */
  free(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_arg_counters);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":156 */
  free(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_counts);

  Py_DECREF(__pyx_v_self);
}

static int __pyx_f_4pymc_12LazyFunction_12LazyFunction_check_argument_caches(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *__pyx_v_self) {
  int __pyx_v_i;
  int __pyx_v_j;
  int __pyx_v_k;
  int __pyx_v_mismatch;
  int __pyx_v_this_testval;
  int __pyx_r;
  int __pyx_1;
  int __pyx_2;
  int __pyx_3;
  long __pyx_4;
  Py_INCREF(__pyx_v_self);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":170 */
  __pyx_1 = __pyx_v_self->cache_depth;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_1; ++__pyx_v_i) {

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":171 */
    __pyx_v_mismatch = 0;

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":173 */
    __pyx_2 = __pyx_v_self->n_ultimate_args;
    for (__pyx_v_j = 0; __pyx_v_j < __pyx_2; ++__pyx_v_j) {

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":174 */
      __pyx_v_this_testval = ((__pyx_v_self->ultimate_arg_counters[__pyx_v_j])[0]);

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":175 */
      __pyx_3 = (!(__pyx_v_this_testval == (__pyx_v_self->cached_counts[((__pyx_v_i * __pyx_v_self->n_ultimate_args) + __pyx_v_j)])));
      if (__pyx_3) {

        /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":176 */
        __pyx_v_mismatch = 1;

        /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":177 */
        goto __pyx_L5;
        goto __pyx_L6;
      }
      __pyx_L6:;
    }
    __pyx_L5:;

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":179 */
    __pyx_3 = (__pyx_v_mismatch == 0);
    if (__pyx_3) {

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":182 */
      __pyx_2 = __pyx_v_self->cache_depth;
      for (__pyx_v_j = 0; __pyx_v_j < __pyx_2; ++__pyx_v_j) {
        __pyx_3 = ((__pyx_v_self->frame_queue[__pyx_v_j]) == __pyx_v_i);
        if (__pyx_3) {
          goto __pyx_L9;
          goto __pyx_L10;
        }
        __pyx_L10:;
      }
      __pyx_L9:;

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":185 */
      __pyx_4 = (__pyx_v_self->cache_depth - 1);
      for (__pyx_v_k = __pyx_v_j; __pyx_v_k < __pyx_4; ++__pyx_v_k) {
        (__pyx_v_self->frame_queue[__pyx_v_k]) = (__pyx_v_self->frame_queue[(__pyx_v_k + 1)]);
      }

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":187 */
      (__pyx_v_self->frame_queue[(__pyx_v_self->cache_depth - 1)]) = __pyx_v_i;

      /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":188 */
      __pyx_r = __pyx_v_i;
      goto __pyx_L0;
      goto __pyx_L7;
    }
    __pyx_L7:;
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":190 */
  __pyx_v_i = (-1);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":193 */
  __pyx_r = __pyx_v_i;
  goto __pyx_L0;

  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static void __pyx_f_4pymc_12LazyFunction_12LazyFunction_cache(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *__pyx_v_self,PyObject *__pyx_v_value) {
  int __pyx_v_j;
  int __pyx_v_cur_frame;
  long __pyx_1;
  int __pyx_2;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_value);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":202 */
  __pyx_v_cur_frame = (__pyx_v_self->frame_queue[0]);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":203 */
  __pyx_1 = (__pyx_v_self->cache_depth - 1);
  for (__pyx_v_j = 0; __pyx_v_j < __pyx_1; ++__pyx_v_j) {
    (__pyx_v_self->frame_queue[__pyx_v_j]) = (__pyx_v_self->frame_queue[(__pyx_v_j + 1)]);
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":205 */
  (__pyx_v_self->frame_queue[(__pyx_v_self->cache_depth - 1)]) = __pyx_v_cur_frame;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":208 */
  if (__Pyx_SetItemInt(__pyx_v_self->cached_values, __pyx_v_cur_frame, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":209 */
  __pyx_2 = __pyx_v_self->n_ultimate_args;
  for (__pyx_v_j = 0; __pyx_v_j < __pyx_2; ++__pyx_v_j) {
    (__pyx_v_self->cached_counts[((__pyx_v_cur_frame * __pyx_v_self->n_ultimate_args) + __pyx_v_j)]) = ((__pyx_v_self->ultimate_arg_counters[__pyx_v_j])[0]);
  }

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.cache");
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_value);
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_frame_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_frame_queue(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_i;
  PyObject *__pyx_v_out;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  int __pyx_5;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_out = Py_None; Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":215 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
  __pyx_1 = 0;
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  if (PyDict_SetItem(__pyx_1, __pyx_n_dtype, ((PyObject *)(&PyInt_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_3, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_out);
  __pyx_v_out = __pyx_4;
  __pyx_4 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":216 */
  __pyx_5 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_5; ++__pyx_v_i) {
    __pyx_2 = PyInt_FromLong((((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->frame_queue[__pyx_v_i])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
    if (__Pyx_SetItemInt(__pyx_v_out, __pyx_v_i, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":218 */
  Py_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  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);
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.get_frame_queue");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_out);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_cached_counts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_cached_counts(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_i;
  int __pyx_v_cf;
  PyObject *__pyx_v_out;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  int __pyx_5;
  int __pyx_6;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_out = Py_None; Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":223 */
  __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_n_np); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_n_empty); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyInt_FromLong(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
  PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
  __pyx_1 = 0;
  __pyx_3 = 0;
  __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_1, 0, __pyx_4);
  __pyx_4 = 0;
  __pyx_3 = PyDict_New(); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  if (PyDict_SetItem(__pyx_3, __pyx_n_dtype, ((PyObject *)(&PyLong_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, __pyx_1, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_v_out);
  __pyx_v_out = __pyx_4;
  __pyx_4 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":224 */
  __pyx_5 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth;
  for (__pyx_v_cf = 0; __pyx_v_cf < __pyx_5; ++__pyx_v_cf) {
    __pyx_6 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args;
    for (__pyx_v_i = 0; __pyx_v_i < __pyx_6; ++__pyx_v_i) {
      __pyx_2 = PyInt_FromLong((((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_counts[((__pyx_v_cf * ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args) + __pyx_v_i)])); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
      __pyx_1 = PyInt_FromLong(__pyx_v_i); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
      __pyx_3 = PyInt_FromLong(__pyx_v_cf); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
      __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
      PyTuple_SET_ITEM(__pyx_4, 0, __pyx_1);
      PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
      __pyx_1 = 0;
      __pyx_3 = 0;
      if (PyObject_SetItem(__pyx_v_out, __pyx_4, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
      Py_DECREF(__pyx_4); __pyx_4 = 0;
      Py_DECREF(__pyx_2); __pyx_2 = 0;
    }
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":227 */
  Py_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  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);
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.get_cached_counts");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_out);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_ultimate_arg_counter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_ultimate_arg_counter(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_out;
  int __pyx_v_i;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  int __pyx_2;
  PyObject *__pyx_3 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_out = Py_None; Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":232 */
  __pyx_1 = PyDict_New(); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
  Py_DECREF(__pyx_v_out);
  __pyx_v_out = __pyx_1;
  __pyx_1 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":233 */
  __pyx_2 = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->n_ultimate_args;
  for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; ++__pyx_v_i) {
    __pyx_1 = PyInt_FromLong(((((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_arg_counters[__pyx_v_i])[0])); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    __pyx_3 = __Pyx_GetItemInt(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->ultimate_args, __pyx_v_i); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    if (PyObject_SetItem(__pyx_v_out, __pyx_3, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 234; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_1); __pyx_1 = 0;
  }

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":235 */
  Py_INCREF(__pyx_v_out);
  __pyx_r = __pyx_v_out;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_3);
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.get_ultimate_arg_counter");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_out);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_cache(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4pymc_12LazyFunction_12LazyFunction_force_cache[] = "\n        Forces an arbitrary value into the cache, associated with\n        self\'s current input arguments. Use with caution!\n        ";
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_cache(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_value = 0;
  int __pyx_v_match_index;
  PyObject *__pyx_r;
  int __pyx_1;
  static char *__pyx_argnames[] = {"value",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_value)) return 0;
  Py_INCREF(__pyx_v_self);
  Py_INCREF(__pyx_v_value);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":245 */
  __pyx_1 = ((struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *)((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->__pyx_vtab)->check_argument_caches(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; goto __pyx_L1;}
  __pyx_v_match_index = __pyx_1;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":246 */
  __pyx_1 = (__pyx_v_match_index < 0);
  if (__pyx_1) {
    ((struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *)((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->__pyx_vtab)->cache(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self),__pyx_v_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; goto __pyx_L1;}
    goto __pyx_L2;
  }
  /*else*/ {
    if (__Pyx_SetItemInt(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_values, __pyx_v_match_index, __pyx_v_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
  }
  __pyx_L2:;

  __pyx_r = Py_None; Py_INCREF(Py_None);
  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_AddTraceback("pymc.LazyFunction.LazyFunction.force_cache");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_self);
  Py_DECREF(__pyx_v_value);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_compute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4pymc_12LazyFunction_12LazyFunction_force_compute[] = "\n        For debugging purposes. Skip cache checking and compute a value.\n        ";
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_compute(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_value;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_value = Py_None; Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":256 */
  __pyx_1 = PyTuple_New(0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  __pyx_2 = PyObject_GetAttr(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->arguments, __pyx_n_value); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  __pyx_3 = PyEval_CallObjectWithKeywords(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->fun, __pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_value);
  __pyx_v_value = __pyx_3;
  __pyx_3 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":258 */
  __pyx_4 = (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth > 0);
  if (__pyx_4) {
    ((struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *)((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->__pyx_vtab)->cache(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self),__pyx_v_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  __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("pymc.LazyFunction.LazyFunction.force_compute");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_value);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static char __pyx_doc_4pymc_12LazyFunction_12LazyFunction_get[] = "\n        Call this method to cause the LazyFunction to refresh its arguments\'\n        values, decide whether it needs to recompute, and return its current\n        value.\n        ";
static PyObject *__pyx_f_4pymc_12LazyFunction_12LazyFunction_get(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  int __pyx_v_match_index;
  PyObject *__pyx_v_value;
  PyObject *__pyx_r;
  int __pyx_1;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  static char *__pyx_argnames[] = {0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
  Py_INCREF(__pyx_v_self);
  __pyx_v_value = Py_None; Py_INCREF(Py_None);

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":271 */
  __pyx_1 = (((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cache_depth == 0);
  if (__pyx_1) {
    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
    __pyx_3 = PyObject_GetAttr(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->arguments, __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
    __pyx_4 = PyEval_CallObjectWithKeywords(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->fun, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 272; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __pyx_r = __pyx_4;
    __pyx_4 = 0;
    goto __pyx_L0;
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":274 */
  __pyx_1 = ((struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *)((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->__pyx_vtab)->check_argument_caches(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; goto __pyx_L1;}
  __pyx_v_match_index = __pyx_1;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":276 */
  __pyx_1 = (__pyx_v_match_index < 0);
  if (__pyx_1) {

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":279 */
    __pyx_2 = PyTuple_New(0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
    __pyx_3 = PyObject_GetAttr(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->arguments, __pyx_n_value); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
    __pyx_4 = PyEval_CallObjectWithKeywords(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->fun, __pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 279; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_4;
    __pyx_4 = 0;

    /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":280 */
    ((struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction *)((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->__pyx_vtab)->cache(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self),__pyx_v_value); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 280; goto __pyx_L1;}
    goto __pyx_L3;
  }
  /*else*/ {
    __pyx_2 = __Pyx_GetItemInt(((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)__pyx_v_self)->cached_values, __pyx_v_match_index); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 283; goto __pyx_L1;}
    Py_DECREF(__pyx_v_value);
    __pyx_v_value = __pyx_2;
    __pyx_2 = 0;
  }
  __pyx_L3:;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":285 */
  Py_INCREF(__pyx_v_value);
  __pyx_r = __pyx_v_value;
  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("pymc.LazyFunction.LazyFunction.get");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_value);
  Py_DECREF(__pyx_v_self);
  return __pyx_r;
}

static PyObject *__pyx_tp_new_4pymc_12LazyFunction_NumberHolder(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_4pymc_12LazyFunction_NumberHolder(PyObject *o) {
  (*o->ob_type->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_4pymc_12LazyFunction_NumberHolder[] = {
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_NumberHolder = {
  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*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_NumberHolder = {
  0, /*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_NumberHolder = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4pymc_12LazyFunction_NumberHolder = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "pymc.LazyFunction.NumberHolder", /*tp_name*/
  sizeof(struct __pyx_obj_4pymc_12LazyFunction_NumberHolder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4pymc_12LazyFunction_NumberHolder, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_NumberHolder, /*tp_as_number*/
  &__pyx_tp_as_sequence_NumberHolder, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_NumberHolder, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_NumberHolder, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4pymc_12LazyFunction_NumberHolder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_4pymc_12LazyFunction_12NumberHolder___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4pymc_12LazyFunction_NumberHolder, /*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 PyObject *__pyx_tp_new_4pymc_12LazyFunction_PointerHolder(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_4pymc_12LazyFunction_PointerHolder(PyObject *o) {
  (*o->ob_type->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_4pymc_12LazyFunction_PointerHolder[] = {
  {"get_number", (PyCFunction)__pyx_f_4pymc_12LazyFunction_13PointerHolder_get_number, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_PointerHolder = {
  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*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_PointerHolder = {
  0, /*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_PointerHolder = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4pymc_12LazyFunction_PointerHolder = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "pymc.LazyFunction.PointerHolder", /*tp_name*/
  sizeof(struct __pyx_obj_4pymc_12LazyFunction_PointerHolder), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4pymc_12LazyFunction_PointerHolder, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_PointerHolder, /*tp_as_number*/
  &__pyx_tp_as_sequence_PointerHolder, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_PointerHolder, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_PointerHolder, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4pymc_12LazyFunction_PointerHolder, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_4pymc_12LazyFunction_13PointerHolder___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4pymc_12LazyFunction_PointerHolder, /*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 PyObject *__pyx_tp_new_4pymc_12LazyFunction_Counter(PyTypeObject *t, PyObject *a, PyObject *k) {
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  return o;
}

static void __pyx_tp_dealloc_4pymc_12LazyFunction_Counter(PyObject *o) {
  (*o->ob_type->tp_free)(o);
}

static struct PyMethodDef __pyx_methods_4pymc_12LazyFunction_Counter[] = {
  {"get_count", (PyCFunction)__pyx_f_4pymc_12LazyFunction_7Counter_get_count, METH_VARARGS|METH_KEYWORDS, 0},
  {"click", (PyCFunction)__pyx_f_4pymc_12LazyFunction_7Counter_click, METH_VARARGS|METH_KEYWORDS, 0},
  {"unclick", (PyCFunction)__pyx_f_4pymc_12LazyFunction_7Counter_unclick, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_Counter = {
  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*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_Counter = {
  0, /*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_Counter = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4pymc_12LazyFunction_Counter = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "pymc.LazyFunction.Counter", /*tp_name*/
  sizeof(struct __pyx_obj_4pymc_12LazyFunction_Counter), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4pymc_12LazyFunction_Counter, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_Counter, /*tp_as_number*/
  &__pyx_tp_as_sequence_Counter, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_Counter, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_Counter, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE, /*tp_flags*/
  0, /*tp_doc*/
  0, /*tp_traverse*/
  0, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4pymc_12LazyFunction_Counter, /*tp_methods*/
  0, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_4pymc_12LazyFunction_7Counter___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4pymc_12LazyFunction_Counter, /*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 __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction __pyx_vtable_4pymc_12LazyFunction_LazyFunction;

static PyObject *__pyx_tp_new_4pymc_12LazyFunction_LazyFunction(PyTypeObject *t, PyObject *a, PyObject *k) {
  struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *p;
  PyObject *o = (*t->tp_alloc)(t, 0);
  if (!o) return 0;
  p = ((struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)o);
  *(struct __pyx_vtabstruct_4pymc_12LazyFunction_LazyFunction **)&p->__pyx_vtab = __pyx_vtabptr_4pymc_12LazyFunction_LazyFunction;
  p->arguments = Py_None; Py_INCREF(Py_None);
  p->fun = Py_None; Py_INCREF(Py_None);
  p->argument_values = Py_None; Py_INCREF(Py_None);
  p->ultimate_args = Py_None; Py_INCREF(Py_None);
  p->cached_values = Py_None; Py_INCREF(Py_None);
  return o;
}

static void __pyx_tp_dealloc_4pymc_12LazyFunction_LazyFunction(PyObject *o) {
  struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *p = (struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)o;
  {
    PyObject *etype, *eval, *etb;
    PyErr_Fetch(&etype, &eval, &etb);
    ++o->ob_refcnt;
    __pyx_f_4pymc_12LazyFunction_12LazyFunction___dealloc__(o);
    if (PyErr_Occurred()) PyErr_WriteUnraisable(o);
    --o->ob_refcnt;
    PyErr_Restore(etype, eval, etb);
  }
  Py_XDECREF(p->arguments);
  Py_XDECREF(p->fun);
  Py_XDECREF(p->argument_values);
  Py_XDECREF(p->ultimate_args);
  Py_XDECREF(p->cached_values);
  (*o->ob_type->tp_free)(o);
}

static int __pyx_tp_traverse_4pymc_12LazyFunction_LazyFunction(PyObject *o, visitproc v, void *a) {
  int e;
  struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *p = (struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)o;
  if (p->arguments) {
    e = (*v)(p->arguments, a); if (e) return e;
  }
  if (p->fun) {
    e = (*v)(p->fun, a); if (e) return e;
  }
  if (p->argument_values) {
    e = (*v)(p->argument_values, a); if (e) return e;
  }
  if (p->ultimate_args) {
    e = (*v)(p->ultimate_args, a); if (e) return e;
  }
  if (p->cached_values) {
    e = (*v)(p->cached_values, a); if (e) return e;
  }
  return 0;
}

static int __pyx_tp_clear_4pymc_12LazyFunction_LazyFunction(PyObject *o) {
  struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *p = (struct __pyx_obj_4pymc_12LazyFunction_LazyFunction *)o;
  PyObject *t;
  t = p->arguments; 
  p->arguments = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->fun; 
  p->fun = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->argument_values; 
  p->argument_values = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->ultimate_args; 
  p->ultimate_args = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  t = p->cached_values; 
  p->cached_values = Py_None; Py_INCREF(Py_None);
  Py_XDECREF(t);
  return 0;
}

static struct PyMethodDef __pyx_methods_4pymc_12LazyFunction_LazyFunction[] = {
  {"get_frame_queue", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_frame_queue, METH_VARARGS|METH_KEYWORDS, 0},
  {"get_cached_counts", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_cached_counts, METH_VARARGS|METH_KEYWORDS, 0},
  {"get_ultimate_arg_counter", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_get_ultimate_arg_counter, METH_VARARGS|METH_KEYWORDS, 0},
  {"force_cache", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_cache, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4pymc_12LazyFunction_12LazyFunction_force_cache},
  {"force_compute", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_force_compute, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4pymc_12LazyFunction_12LazyFunction_force_compute},
  {"get", (PyCFunction)__pyx_f_4pymc_12LazyFunction_12LazyFunction_get, METH_VARARGS|METH_KEYWORDS, __pyx_doc_4pymc_12LazyFunction_12LazyFunction_get},
  {0, 0, 0, 0}
};

static struct PyMemberDef __pyx_members_4pymc_12LazyFunction_LazyFunction[] = {
  {"arguments", T_OBJECT, offsetof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction, arguments), 0, 0},
  {"fun", T_OBJECT, offsetof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction, fun), 0, 0},
  {"argument_values", T_OBJECT, offsetof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction, argument_values), 0, 0},
  {"ultimate_args", T_OBJECT, offsetof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction, ultimate_args), 0, 0},
  {"cached_values", T_OBJECT, offsetof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction, cached_values), 0, 0},
  {0, 0, 0, 0, 0}
};

static PyNumberMethods __pyx_tp_as_number_LazyFunction = {
  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*/
  #if Py_TPFLAGS_DEFAULT & Py_TPFLAGS_HAVE_INDEX
  0, /*nb_index*/
  #endif
};

static PySequenceMethods __pyx_tp_as_sequence_LazyFunction = {
  0, /*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_LazyFunction = {
  0, /*mp_length*/
  0, /*mp_subscript*/
  0, /*mp_ass_subscript*/
};

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

PyTypeObject __pyx_type_4pymc_12LazyFunction_LazyFunction = {
  PyObject_HEAD_INIT(0)
  0, /*ob_size*/
  "pymc.LazyFunction.LazyFunction", /*tp_name*/
  sizeof(struct __pyx_obj_4pymc_12LazyFunction_LazyFunction), /*tp_basicsize*/
  0, /*tp_itemsize*/
  __pyx_tp_dealloc_4pymc_12LazyFunction_LazyFunction, /*tp_dealloc*/
  0, /*tp_print*/
  0, /*tp_getattr*/
  0, /*tp_setattr*/
  0, /*tp_compare*/
  0, /*tp_repr*/
  &__pyx_tp_as_number_LazyFunction, /*tp_as_number*/
  &__pyx_tp_as_sequence_LazyFunction, /*tp_as_sequence*/
  &__pyx_tp_as_mapping_LazyFunction, /*tp_as_mapping*/
  0, /*tp_hash*/
  0, /*tp_call*/
  0, /*tp_str*/
  0, /*tp_getattro*/
  0, /*tp_setattro*/
  &__pyx_tp_as_buffer_LazyFunction, /*tp_as_buffer*/
  Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_GC, /*tp_flags*/
  "\n    A function that is bound to its arguments, and which caches\n    its last few evaluations so as to skip computation when possible.\n\n\n\n    L = LazyFunction(fun, arguments[, cache_depth])\n    L.get()\n\n\n\n    :Arguments:\n    fun:        The function that the LazyFunction uses to compute its\n                values.\n\n    arguments:  A dictionary of arguments that the LazyFunction passes\n                to its function. If any of the arguments is a Stochastic,\n                Deterministic, or Container, that argument\'s \'value\' attribute\n                will be substituted for it when passed to fun.\n\n    cache_depth:    The number of prior computations to \'memoize\' in\n                    order to skip unnecessary computations.\n\n\n\n    Externally-accessible methods:\n\n    refresh_argument_values():  Iterates over LazyFunction\'s parents that are\n                                Stochastics, Deterministics, or Containers and\n                                records their current values for passing to self\'s\n                                internal function.\n\n    get():  Refreshes argument values, checks cache, calls internal function if\n            necessary, returns value.\n\n\n\n    Externally-accessible attributes:\n\n    arguments:  A dictionary containing self\'s arguments.\n\n    fun:        Self\'s internal function.\n\n    argument_values:    A dictionary containing self\'s arguments, in which\n                        Stochastics, Deterministics, and Containers have been\n                        replaced by their \'value\' attributes.\n\n\n\n    :SeeAlso: Stochastic, Deterministic, Container\n    ", /*tp_doc*/
  __pyx_tp_traverse_4pymc_12LazyFunction_LazyFunction, /*tp_traverse*/
  __pyx_tp_clear_4pymc_12LazyFunction_LazyFunction, /*tp_clear*/
  0, /*tp_richcompare*/
  0, /*tp_weaklistoffset*/
  0, /*tp_iter*/
  0, /*tp_iternext*/
  __pyx_methods_4pymc_12LazyFunction_LazyFunction, /*tp_methods*/
  __pyx_members_4pymc_12LazyFunction_LazyFunction, /*tp_members*/
  0, /*tp_getset*/
  0, /*tp_base*/
  0, /*tp_dict*/
  0, /*tp_descr_get*/
  0, /*tp_descr_set*/
  0, /*tp_dictoffset*/
  __pyx_f_4pymc_12LazyFunction_12LazyFunction___init__, /*tp_init*/
  0, /*tp_alloc*/
  __pyx_tp_new_4pymc_12LazyFunction_LazyFunction, /*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[] = {
  {0, 0, 0, 0}
};

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

PyMODINIT_FUNC initLazyFunction(void); /*proto*/
PyMODINIT_FUNC initLazyFunction(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  __pyx_init_filenames();
  __pyx_m = Py_InitModule4("LazyFunction", __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION);
  if (!__pyx_m) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  Py_INCREF(__pyx_m);
  __pyx_b = PyImport_AddModule("__builtin__");
  if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; goto __pyx_L1;};
  if (PyType_Ready(&__pyx_type_4pymc_12LazyFunction_NumberHolder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "NumberHolder", (PyObject *)&__pyx_type_4pymc_12LazyFunction_NumberHolder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 19; goto __pyx_L1;}
  __pyx_ptype_4pymc_12LazyFunction_NumberHolder = &__pyx_type_4pymc_12LazyFunction_NumberHolder;
  if (PyType_Ready(&__pyx_type_4pymc_12LazyFunction_PointerHolder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "PointerHolder", (PyObject *)&__pyx_type_4pymc_12LazyFunction_PointerHolder) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; goto __pyx_L1;}
  __pyx_ptype_4pymc_12LazyFunction_PointerHolder = &__pyx_type_4pymc_12LazyFunction_PointerHolder;
  if (PyType_Ready(&__pyx_type_4pymc_12LazyFunction_Counter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "Counter", (PyObject *)&__pyx_type_4pymc_12LazyFunction_Counter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
  __pyx_ptype_4pymc_12LazyFunction_Counter = &__pyx_type_4pymc_12LazyFunction_Counter;
  __pyx_vtabptr_4pymc_12LazyFunction_LazyFunction = &__pyx_vtable_4pymc_12LazyFunction_LazyFunction;
  *(void(**)(void))&__pyx_vtable_4pymc_12LazyFunction_LazyFunction.check_argument_caches = (void(*)(void))__pyx_f_4pymc_12LazyFunction_12LazyFunction_check_argument_caches;
  *(void(**)(void))&__pyx_vtable_4pymc_12LazyFunction_LazyFunction.cache = (void(*)(void))__pyx_f_4pymc_12LazyFunction_12LazyFunction_cache;
  __pyx_type_4pymc_12LazyFunction_LazyFunction.tp_free = _PyObject_GC_Del;
  if (PyType_Ready(&__pyx_type_4pymc_12LazyFunction_LazyFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
  if (__Pyx_SetVtable(__pyx_type_4pymc_12LazyFunction_LazyFunction.tp_dict, __pyx_vtabptr_4pymc_12LazyFunction_LazyFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "LazyFunction", (PyObject *)&__pyx_type_4pymc_12LazyFunction_LazyFunction) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; goto __pyx_L1;}
  __pyx_ptype_4pymc_12LazyFunction_LazyFunction = &__pyx_type_4pymc_12LazyFunction_LazyFunction;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":5 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___docformat__, __pyx_n_reStructuredText) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; goto __pyx_L1;}

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":7 */
  if (PyObject_SetAttr(__pyx_m, __pyx_n___author__, __pyx_k11p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; goto __pyx_L1;}

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":9 */
  __pyx_1 = PyList_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  Py_INCREF(__pyx_n_Node);
  PyList_SET_ITEM(__pyx_1, 0, __pyx_n_Node);
  Py_INCREF(__pyx_n_ContainerBase);
  PyList_SET_ITEM(__pyx_1, 1, __pyx_n_ContainerBase);
  Py_INCREF(__pyx_n_Variable);
  PyList_SET_ITEM(__pyx_1, 2, __pyx_n_Variable);
  __pyx_2 = __Pyx_Import(__pyx_n_PyMCObjects, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_Node); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_Node, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_ContainerBase); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_ContainerBase, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_n_Variable); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_Variable, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":10 */
  __pyx_2 = __Pyx_Import(__pyx_n_numpy, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (PyObject_SetAttr(__pyx_m, __pyx_n_np, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/Users/anand/renearch/pymc-git/pymc/LazyFunction.pyx":262 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  __Pyx_AddTraceback("pymc.LazyFunction");
}

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

/* Runtime support code */

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

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 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_GetItemInt(PyObject *o, Py_ssize_t i) {
    PyTypeObject *t = o->ob_type;
    PyObject *r;
    if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
        r = PySequence_GetItem(o, i);
    else {
        PyObject *j = PyInt_FromLong(i);
        if (!j)
            return 0;
        r = PyObject_GetItem(o, j);
        Py_DECREF(j);
    }
    return r;
}

static int __Pyx_SetItemInt(PyObject *o, Py_ssize_t i, PyObject *v) {
    PyTypeObject *t = o->ob_type;
    int r;
    if (t->tp_as_sequence && t->tp_as_sequence->sq_item)
        r = PySequence_SetItem(o, i, v);
    else {
        PyObject *j = PyInt_FromLong(i);
        if (!j)
            return -1;
        r = PyObject_SetItem(o, j, v);
        Py_DECREF(j);
    }
    return r;
}

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

static int __Pyx_SetVtable(PyObject *dict, void *vtable) {
    PyObject *pycobj = 0;
    int result;
    
    pycobj = PyCObject_FromVoidPtr(vtable, 0);
    if (!pycobj)
        goto bad;
    if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0)
        goto bad;
    result = 0;
    goto done;

bad:
    result = -1;
done:
    Py_XDECREF(pycobj);
    return result;
}

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;
}

#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);
}
