[Pyrex] C compile issues when using Numeric (ArrayType) stuff

Norman Shelley Norman.Shelley at motorola.com
Fri Oct 17 20:01:46 CEST 2003


I build a pyx file which tries to wrap some Numeric and fortran code.

The attached pyx file generates a C file which then fails the HPUX cc compiler.
I modified the C code slightly and it compiles fine now (both C files are
attached.)

Any ideas?

Norman Shelley

-------------- next part --------------
#
#  This example demonstrates how to access the internals
# Copied from Pyrex0.9  test directory and modified.
##Copyright stuff: Pyrex is free of restrictions. You
##can use, redistribute and/or modify it however you want.
#  of a Numeric array object.
#


from Numeric import ravel, transpose
cdef extern from "stdlib.h":
	int free(void*)
	void *malloc(int)
	int sizeof()

cdef extern from "Numeric/arrayobject.h":
	ctypedef enum PyArray_TYPES:
		PyArray_CHAR
		PyArray_UBYTE
		PyArray_SBYTE
		PyArray_SHORT
		PyArray_USHORT 
		PyArray_INT
		PyArray_UINT 
		PyArray_LONG
		PyArray_FLOAT
		PyArray_DOUBLE 
		PyArray_CFLOAT
		PyArray_CDOUBLE
		PyArray_OBJECT
		PyArray_NTYPES
		PyArray_NOTYPE
		
	struct PyArray_Descr:
		int type_num, elsize
		char type
		
	ctypedef class Numeric.ArrayType [object PyArrayObject]:
		cdef char *data
		cdef int nd
		cdef int *dimensions
		cdef int *strides
		cdef object base
		cdef PyArray_Descr *descr
		cdef int flags

	ArrayType PyArrayFromDims(int, int*, int)


cdef extern from "":
	# User defined Integer Array
	# User defined Real(Double) Array
	# User defined Funtion
	# A Fortran function so everything is passed by address
	void dn2fb_(int *N, int *P, double *X, double *B[], (void *())CALCR,
		int *IV, int *LIV, int *LV, double *V, int *UI, double *UR, void *UF)
	
def print_2d_array(ArrayType a):
	print "Type:", chr(a.descr.type)
	if chr(a.descr.type) <> "f":
		raise TypeError("Float array required")
	if a.nd <> 2:
		raise ValueError("2 dimensional array required")
	cdef int nrows, ncols
	cdef float *elems, x
	nrows = a.dimensions[0]
	ncols = a.dimensions[1]
	elems = <float *>a.data
	hyphen = "-"
	divider = ("+" + 10 * hyphen) * ncols + "+"
	print divider
	for row in range(nrows):
		for col in range(ncols):
			x = elems[row * ncols + col]
			print "| %8f" % x,
		print "|"
		print divider


cdef void calcr(int *N, int *P, double *X, int *NF, double *V, 
	object UI, object UR, object UF
):
	pass


def dn2fb(ArrayType X, ArrayType B,
	object UI, object UR, object UF
):
	cdef int bytes
	cdef int N
	cdef int P
	cdef int LV
	cdef int LIV
	cdef int *IV
	cdef double *V
	cdef ArrayType Bfortran
	
	if X.nd != 1:
		raise ValueError("1 dimensional array required")
	P = X.dimensions[0]
	
	if B.nd != 2:
		raise ValueError("2 dimensional array required")
	if B.dimensions[0] != 2 or B.dimensions[1] != P:
		raise ValueError("Bounds array's shape must be (2,P), (%s,%s)" % (
			B.dimensions[0],B.dimensions[1]))
			
	if UI.nd != 1:
		raise ValueError("1 dimensional array required")
	if UR.nd != 1:
		raise ValueError("1 dimensional array required")
	
	# Transpose from C/Numeric's row-major order to Fortran's
	# column-major order and make sure the new array is contiguous
	Bfortran = <ArrayType>ravel(transpose(B))
	B = Bfortran
	print "Hello"
	# Number of residuals
	N = 5
	LIV = 82 + 4*P
	LV = 105 + P*(N + 2*P + 21) + 2*N
	
	bytes = sizeof(int)*LIV
	IV = <int *>malloc(bytes)
	if not <int>IV:
		raise MemoryError("unable to allocate %s bytes" %s)
		
	bytes = sizeof(double)*LV
	V = <double *>malloc(bytes)
	if not <int>V:
		raise MemoryError("unable to allocate %s bytes" %s)
		
	dn2fb_(&N, &P, <double *>(X.data), <double **>(B.data), <void *()>calcr,
		IV, &LIV, &LV, V, <int *>UI, <double *>UR, <void *>UF)
		
	free(IV)
	free(V)
		
		
			
def return_new_array():
	Result = array([1,2,3.2])
	
	## vvvv Doesn't work vvvv
	##Result = ArrayType()
	##  TypeError: cannot create 'array' instances
	
	
	##cdef int lengths[1]
	##lengths[0] = 50
	##Result = PyArrayFromDims(1, lengths, PyArray_DOUBLE)
	return Result
	
	
	

-------------- next part --------------
/* Generated by Pyrex 0.9 on Fri Oct 17 10:56:48 2003 */

#include "Python.h"
#include "structmember.h"
#include "stdlib.h"
#include "Numeric/arrayobject.h"


static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
static int __Pyx_EndUnpack(PyObject *, int); /*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 PyObject *__Pyx_GetName(PyObject *dict, char *name); /*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[], int 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_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
staticforward char **__pyx_f;

/* Declarations from numeric_test */

static PyTypeObject *__pyx_ptype_12numeric_test_ArrayType = 0;
static void (__pyx_f_12numeric_test_calcr(int (*),int (*),double (*),int (*),double (*),PyObject *,PyObject *,PyObject *)); /*proto*/

/* Implementation of numeric_test */

static char (__pyx_k1[]) = "Numeric";
static char (__pyx_k2[]) = "ravel";
static char (__pyx_k3[]) = "transpose";

static char (__pyx_k4[]) = "Type:";
static char (__pyx_k5[]) = "f";
static char (__pyx_k6[]) = "Float array required";
static char (__pyx_k7[]) = "2 dimensional array required";
static char (__pyx_k8[]) = "-";
static char (__pyx_k9[]) = "+";
static char (__pyx_k10[]) = "+";
static char (__pyx_k11[]) = "| %8f";
static char (__pyx_k12[]) = "|";

static PyObject *__pyx_f_12numeric_test_print_2d_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_print_2d_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_a = 0;
  int __pyx_v_nrows;
  int __pyx_v_ncols;
  float (*__pyx_v_elems);
  float __pyx_v_x;
  PyObject *__pyx_v_hyphen;
  PyObject *__pyx_v_divider;
  PyObject *__pyx_v_row;
  PyObject *__pyx_v_col;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  static char *__pyx_argnames[] = {"a",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_a)) return 0;
  Py_INCREF(__pyx_v_a);
  __pyx_v_hyphen = Py_None; Py_INCREF(__pyx_v_hyphen);
  __pyx_v_divider = Py_None; Py_INCREF(__pyx_v_divider);
  __pyx_v_row = Py_None; Py_INCREF(__pyx_v_row);
  __pyx_v_col = Py_None; Py_INCREF(__pyx_v_col);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_12numeric_test_ArrayType, 1, "a")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":59 */
  __pyx_1 = PyString_FromString(__pyx_k4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  if (__Pyx_PrintItem(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = __Pyx_GetName(__pyx_b, "chr"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_v_a->descr->type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":60 */
  __pyx_1 = __Pyx_GetName(__pyx_b, "chr"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(__pyx_v_a->descr->type); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyString_FromString(__pyx_k5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_4 = __pyx_4 != 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":61 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "TypeError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 61; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":62 */
  __pyx_4 = (__pyx_v_a->nd != 2);
  if (__pyx_4) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":63 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    __pyx_1 = PyString_FromString(__pyx_k7); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
    __pyx_1 = 0;
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 63; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":66 */
  __pyx_v_nrows = (__pyx_v_a->dimensions[0]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":67 */
  __pyx_v_ncols = (__pyx_v_a->dimensions[1]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":68 */
  __pyx_v_elems = ((float (*))__pyx_v_a->data);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":69 */
  __pyx_2 = PyString_FromString(__pyx_k8); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
  Py_DECREF(__pyx_v_hyphen);
  __pyx_v_hyphen = __pyx_2;
  __pyx_2 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":70 */
  __pyx_3 = PyString_FromString(__pyx_k9); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_1 = PyInt_FromLong(10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_2 = PyNumber_Multiply(__pyx_1, __pyx_v_hyphen); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyNumber_Add(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_2 = PyNumber_Multiply(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_1 = PyString_FromString(__pyx_k10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_3 = PyNumber_Add(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_divider);
  __pyx_v_divider = __pyx_3;
  __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":71 */
  if (__Pyx_PrintItem(__pyx_v_divider) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":72 */
  __pyx_2 = __Pyx_GetName(__pyx_b, "range"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  __pyx_1 = PyInt_FromLong(__pyx_v_nrows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
  __pyx_1 = 0;
  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  for (;;) {
    __pyx_L4:;
    __pyx_3 = PyIter_Next(__pyx_2);
    if (!__pyx_3) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
      break;
    }
    Py_DECREF(__pyx_v_row);
    __pyx_v_row = __pyx_3;
    __pyx_3 = 0;

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":73 */
    __pyx_1 = __Pyx_GetName(__pyx_b, "range"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_1 = PyObject_GetIter(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    for (;;) {
      __pyx_L6:;
      __pyx_5 = PyIter_Next(__pyx_1);
      if (!__pyx_5) {
        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
        break;
      }
      Py_DECREF(__pyx_v_col);
      __pyx_v_col = __pyx_5;
      __pyx_5 = 0;

      /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":74 */
      __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      __pyx_5 = PyNumber_Multiply(__pyx_v_row, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_3 = PyNumber_Add(__pyx_5, __pyx_v_col); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_v_x = (__pyx_v_elems[__pyx_4]);

      /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":75 */
      __pyx_5 = PyString_FromString(__pyx_k11); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_3 = PyFloat_FromDouble(__pyx_v_x); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_6 = PyNumber_Remainder(__pyx_5, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      if (__Pyx_PrintItem(__pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
    }
    __pyx_L7:;
    Py_DECREF(__pyx_1); __pyx_1 = 0;

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":76 */
    __pyx_5 = PyString_FromString(__pyx_k12); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
    if (__Pyx_PrintItem(__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":77 */
    if (__Pyx_PrintItem(__pyx_v_divider) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
  }
  __pyx_L5:;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("numeric_test.print_2d_array");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_hyphen);
  Py_DECREF(__pyx_v_divider);
  Py_DECREF(__pyx_v_row);
  Py_DECREF(__pyx_v_col);
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}


static void __pyx_f_12numeric_test_calcr(int (*__pyx_v_N),int (*__pyx_v_P),double (*__pyx_v_X),int (*__pyx_v_NF),double (*__pyx_v_V),PyObject *__pyx_v_UI,PyObject *__pyx_v_UR,PyObject *__pyx_v_UF) {
  Py_INCREF(__pyx_v_UI);
  Py_INCREF(__pyx_v_UR);
  Py_INCREF(__pyx_v_UF);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":83 */

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_WriteUnraisable("numeric_test.calcr");
  __pyx_L0:;
  Py_DECREF(__pyx_v_UI);
  Py_DECREF(__pyx_v_UR);
  Py_DECREF(__pyx_v_UF);
}

static char (__pyx_k13[]) = "1 dimensional array required";
static char (__pyx_k14[]) = "2 dimensional array required";
static char (__pyx_k15[]) = "Bounds array's shape must be (2,P), (%s,%s)";
static char (__pyx_k16[]) = "1 dimensional array required";
static char (__pyx_k17[]) = "1 dimensional array required";
static char (__pyx_k18[]) = "Hello";
static char (__pyx_k19[]) = "unable to allocate %s bytes";
static char (__pyx_k20[]) = "unable to allocate %s bytes";

static PyObject *__pyx_f_12numeric_test_dn2fb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_dn2fb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_X = 0;
  PyArrayObject *__pyx_v_B = 0;
  PyObject *__pyx_v_UI = 0;
  PyObject *__pyx_v_UR = 0;
  PyObject *__pyx_v_UF = 0;
  int __pyx_v_bytes;
  int __pyx_v_N;
  int __pyx_v_P;
  int __pyx_v_LV;
  int __pyx_v_LIV;
  int (*__pyx_v_IV);
  double (*__pyx_v_V);
  PyArrayObject *__pyx_v_Bfortran;
  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;
  static char *__pyx_argnames[] = {"X","B","UI","UR","UF",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOO", __pyx_argnames, &__pyx_v_X, &__pyx_v_B, &__pyx_v_UI, &__pyx_v_UR, &__pyx_v_UF)) return 0;
  Py_INCREF(__pyx_v_X);
  Py_INCREF(__pyx_v_B);
  Py_INCREF(__pyx_v_UI);
  Py_INCREF(__pyx_v_UR);
  Py_INCREF(__pyx_v_UF);
  ((PyObject*)__pyx_v_Bfortran) = Py_None; Py_INCREF(((PyObject*)__pyx_v_Bfortran));
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_12numeric_test_ArrayType, 1, "X")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_12numeric_test_ArrayType, 1, "B")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":98 */
  __pyx_1 = (__pyx_v_X->nd != 1);
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":99 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k13); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 99; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":100 */
  __pyx_v_P = (__pyx_v_X->dimensions[0]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":102 */
  __pyx_1 = (__pyx_v_B->nd != 2);
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":103 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    __pyx_4 = PyString_FromString(__pyx_k14); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; 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[0]; __pyx_lineno = 103; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":104 */
  __pyx_1 = ((__pyx_v_B->dimensions[0]) != 2);
  if (!__pyx_1) {
    __pyx_1 = ((__pyx_v_B->dimensions[1]) != __pyx_v_P);
  }
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":105 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k15); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    __pyx_4 = PyInt_FromLong((__pyx_v_B->dimensions[0])); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_5 = PyInt_FromLong((__pyx_v_B->dimensions[1])); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4);
    PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
    __pyx_4 = 0;
    __pyx_5 = 0;
    __pyx_4 = PyNumber_Remainder(__pyx_3, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":108 */
  __pyx_6 = PyObject_GetAttrString(__pyx_v_UI, "nd"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_6, __pyx_4, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  __pyx_1 = __pyx_1 != 0;
  Py_DECREF(__pyx_6); __pyx_6 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":109 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    __pyx_5 = PyString_FromString(__pyx_k16); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_6, 0, 0);
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":110 */
  __pyx_4 = PyObject_GetAttrString(__pyx_v_UR, "nd"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_4, __pyx_5, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_1 = __pyx_1 != 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":111 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k17); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":115 */
  __pyx_5 = __Pyx_GetName(__pyx_m, "ravel"); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  __pyx_3 = __Pyx_GetName(__pyx_m, "transpose"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_INCREF(((PyObject *)__pyx_v_B));
  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_B));
  __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_6);
  __pyx_6 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_INCREF(((PyObject *)__pyx_3));
  Py_DECREF(((PyObject *)__pyx_v_Bfortran));
  ((PyObject *)__pyx_v_Bfortran) = ((PyObject *)__pyx_3);
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":116 */
  Py_INCREF(((PyObject *)__pyx_v_Bfortran));
  Py_DECREF(((PyObject *)__pyx_v_B));
  ((PyObject *)__pyx_v_B) = ((PyObject *)__pyx_v_Bfortran);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":117 */
  __pyx_2 = PyString_FromString(__pyx_k18); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
  if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":119 */
  __pyx_v_N = 5;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":120 */
  __pyx_v_LIV = (82 + (4 * __pyx_v_P));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":121 */
  __pyx_v_LV = ((105 + (__pyx_v_P * ((__pyx_v_N + (2 * __pyx_v_P)) + 21))) + (2 * __pyx_v_N));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":123 */
  __pyx_v_bytes = ((sizeof(int )) * __pyx_v_LIV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":124 */
  __pyx_v_IV = ((int (*))malloc(__pyx_v_bytes));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":125 */
  __pyx_1 = (!((int )__pyx_v_IV));
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":126 */
    __pyx_6 = __Pyx_GetName(__pyx_b, "MemoryError"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_5 = PyString_FromString(__pyx_k19); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_4 = __Pyx_GetName(__pyx_b, "s"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_3 = PyNumber_Remainder(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_5 = PyObject_CallObject(__pyx_6, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 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[0]; __pyx_lineno = 126; goto __pyx_L1;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":128 */
  __pyx_v_bytes = ((sizeof(double )) * __pyx_v_LV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":129 */
  __pyx_v_V = ((double (*))malloc(__pyx_v_bytes));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":130 */
  __pyx_1 = (!((int )__pyx_v_V));
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":131 */
    __pyx_4 = __Pyx_GetName(__pyx_b, "MemoryError"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k20); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_6 = __Pyx_GetName(__pyx_b, "s"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_2 = PyNumber_Remainder(__pyx_3, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":133 */
  dn2fb_((&__pyx_v_N),(&__pyx_v_P),((double (*))__pyx_v_X->data),((double (*(*)))__pyx_v_B->data),((void (*))__pyx_f_12numeric_test_calcr),__pyx_v_IV,(&__pyx_v_LIV),(&__pyx_v_LV),__pyx_v_V,((int (*))__pyx_v_UI),((double (*))__pyx_v_UR),((void (*))__pyx_v_UF));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":136 */
  free(__pyx_v_IV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":137 */
  free(__pyx_v_V);

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("numeric_test.dn2fb");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_Bfortran);
  Py_DECREF(__pyx_v_X);
  Py_DECREF(__pyx_v_B);
  Py_DECREF(__pyx_v_UI);
  Py_DECREF(__pyx_v_UR);
  Py_DECREF(__pyx_v_UF);
  return __pyx_r;
}


static PyObject *__pyx_f_12numeric_test_return_new_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_return_new_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Result;
  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;
  __pyx_v_Result = Py_None; Py_INCREF(__pyx_v_Result);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":142 */
  __pyx_1 = __Pyx_GetName(__pyx_b, "array"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_4 = PyFloat_FromDouble(3.2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_5 = PyList_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_5, 0, __pyx_2);
  PyList_SET_ITEM(__pyx_5, 1, __pyx_3);
  PyList_SET_ITEM(__pyx_5, 2, __pyx_4);
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_4 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
  __pyx_5 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_Result);
  __pyx_v_Result = __pyx_3;
  __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":152 */
  Py_INCREF(__pyx_v_Result);
  __pyx_r = __pyx_v_Result;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  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("numeric_test.return_new_array");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_Result);
  return __pyx_r;
}

static struct PyMethodDef __pyx_methods[] = {
  {"print_2d_array", (PyCFunction)__pyx_f_12numeric_test_print_2d_array, METH_VARARGS|METH_KEYWORDS, 0},
  {"dn2fb", (PyCFunction)__pyx_f_12numeric_test_dn2fb, METH_VARARGS|METH_KEYWORDS, 0},
  {"return_new_array", (PyCFunction)__pyx_f_12numeric_test_return_new_array, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

DL_EXPORT(void) initnumeric_test(void); /*proto*/
DL_EXPORT(void) initnumeric_test(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  __pyx_m = Py_InitModule4("numeric_test", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  __pyx_b = PyImport_AddModule("__builtin__");
  PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b);
  __pyx_ptype_12numeric_test_ArrayType = __Pyx_ImportType("Numeric", "ArrayType", sizeof(PyArrayObject)); if (!__pyx_ptype_12numeric_test_ArrayType) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":10 */
  __pyx_1 = PyString_FromString(__pyx_k1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_2 = PyString_FromString(__pyx_k2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_3 = PyString_FromString(__pyx_k3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
  PyList_SET_ITEM(__pyx_4, 1, __pyx_3);
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_2 = __Pyx_Import(__pyx_1, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  __pyx_3 = PyObject_GetAttrString(__pyx_2, "ravel"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "ravel", __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_3 = PyObject_GetAttrString(__pyx_2, "transpose"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "transpose", __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":141 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("numeric_test");
}

static char *__pyx_filenames[] = {
  "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx",
};
statichere char **__pyx_f = __pyx_filenames;

/* Runtime support code */

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
	if (!type) {
		PyErr_Format(PyExc_SystemError, "Missing type object");
		return 0;
	}
	if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
		return 1;
	PyErr_Format(PyExc_TypeError,
		"Argument '%s' has incorrect type (expected %s, got %s)",
		name, type->tp_name, obj->ob_type->tp_name);
	return 0;
}

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, char *name) {
	PyObject *result;
	result = PyObject_GetAttrString(dict, name);
	if (!result)
		PyErr_SetString(PyExc_NameError, name);
	return result;
}

static PyObject *__Pyx_GetStdout(void) {
	PyObject *f = PySys_GetObject("stdout");
	if (!f) {
		PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
	}
	return f;
}

static int __Pyx_PrintItem(PyObject *v) {
	PyObject *f;
	
	if (!(f = __Pyx_GetStdout()))
		return -1;
	if (PyFile_SoftSpace(f, 1)) {
		if (PyFile_WriteString(" ", f) < 0)
			return -1;
	}
	if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
		return -1;
	if (PyString_Check(v)) {
		char *s = PyString_AsString(v);
		int len = PyString_Size(v);
		if (len > 0 &&
			isspace(Py_CHARMASK(s[len-1])) &&
			s[len-1] != ' ')
				PyFile_SoftSpace(f, 0);
	}
	return 0;
}

static int __Pyx_PrintNewline(void) {
	PyObject *f;
	
	if (!(f = __Pyx_GetStdout()))
		return -1;
	if (PyFile_WriteString("\n", f) < 0)
		return -1;
	PyFile_SoftSpace(f, 0);
	return 0;
}

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_Check(type))
		;
	else if (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 {
		/* Not something you can raise.  You get an exception
		   anyway, just not what you specified :-) */
		PyErr_Format(PyExc_TypeError,
			     "exceptions must be strings, classes, or "
			     "instances, 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_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 PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
	long size) 
{
	PyObject *py_module_name = 0;
	PyObject *py_class_name = 0;
	PyObject *py_name_list = 0;
	PyObject *py_module = 0;
	PyObject *result = 0;
	
	py_module_name = PyString_FromString(module_name);
	if (!py_module_name)
		goto bad;
	py_class_name = PyString_FromString(class_name);
	if (!py_class_name)
		goto bad;
	py_name_list = PyList_New(1);
	if (!py_name_list)
		goto bad;
	Py_INCREF(py_class_name);
	if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)
		goto bad;
	py_module = __Pyx_Import(py_module_name, py_name_list);
	if (!py_module)
		goto bad;
	result = PyObject_GetAttr(py_module, py_class_name);
	if (!result)
		goto bad;
	if (!PyType_Check(result)) {
		PyErr_Format(PyExc_TypeError, 
			"%s.%s is not a type object",
			module_name, class_name);
		goto bad;
	}
	if (((PyTypeObject *)result)->tp_basicsize != size) {
		PyErr_Format(PyExc_ValueError, 
			"%s.%s does not appear to be the correct type object",
			module_name, class_name);
		goto bad;
	}
	goto done;
bad:
	Py_XDECREF(result);
	result = 0;
done:
	Py_XDECREF(py_module_name);
	Py_XDECREF(py_class_name);
	Py_XDECREF(py_name_list);
	return (PyTypeObject *)result;
}

#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);
}
-------------- next part --------------
/* Generated by Pyrex 0.9 on Fri Oct 17 10:43:06 2003 */

#include "Python.h"
#include "structmember.h"
#include "stdlib.h"
#include "Numeric/arrayobject.h"


static PyObject *__Pyx_UnpackItem(PyObject *, int); /*proto*/
static int __Pyx_EndUnpack(PyObject *, int); /*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 PyObject *__Pyx_GetName(PyObject *dict, char *name); /*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[], int 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_m;
static PyObject *__pyx_b;
static int __pyx_lineno;
static char *__pyx_filename;
staticforward char **__pyx_f;

/* Declarations from numeric_test */

static PyTypeObject *__pyx_ptype_12numeric_test_ArrayType = 0;
static void (__pyx_f_12numeric_test_calcr(int (*),int (*),double (*),int (*),double (*),PyObject *,PyObject *,PyObject *)); /*proto*/

/* Implementation of numeric_test */

static char (__pyx_k1[]) = "Numeric";
static char (__pyx_k2[]) = "ravel";
static char (__pyx_k3[]) = "transpose";

static char (__pyx_k4[]) = "Type:";
static char (__pyx_k5[]) = "f";
static char (__pyx_k6[]) = "Float array required";
static char (__pyx_k7[]) = "2 dimensional array required";
static char (__pyx_k8[]) = "-";
static char (__pyx_k9[]) = "+";
static char (__pyx_k10[]) = "+";
static char (__pyx_k11[]) = "| %8f";
static char (__pyx_k12[]) = "|";

static PyObject *__pyx_f_12numeric_test_print_2d_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_print_2d_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_a = 0;
  int __pyx_v_nrows;
  int __pyx_v_ncols;
  float (*__pyx_v_elems);
  float __pyx_v_x;
  PyObject *__pyx_v_hyphen;
  PyObject *__pyx_v_divider;
  PyObject *__pyx_v_row;
  PyObject *__pyx_v_col;
  PyObject *__pyx_r;
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  int __pyx_4;
  PyObject *__pyx_5 = 0;
  PyObject *__pyx_6 = 0;
  static char *__pyx_argnames[] = {"a",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "O", __pyx_argnames, &__pyx_v_a)) return 0;
  Py_INCREF(__pyx_v_a);
  __pyx_v_hyphen = Py_None; Py_INCREF(__pyx_v_hyphen);
  __pyx_v_divider = Py_None; Py_INCREF(__pyx_v_divider);
  __pyx_v_row = Py_None; Py_INCREF(__pyx_v_row);
  __pyx_v_col = Py_None; Py_INCREF(__pyx_v_col);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_a), __pyx_ptype_12numeric_test_ArrayType, 1, "a")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 58; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":59 */
  __pyx_1 = PyString_FromString(__pyx_k4); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  if (__Pyx_PrintItem(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = __Pyx_GetName(__pyx_b, "chr"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(__pyx_v_a->descr->type); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2);
  __pyx_2 = 0;
  __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":60 */
  __pyx_1 = __Pyx_GetName(__pyx_b, "chr"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(__pyx_v_a->descr->type); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
  __pyx_3 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_1 = PyString_FromString(__pyx_k5); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_3, __pyx_1, &__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; goto __pyx_L1;}
  __pyx_4 = __pyx_4 != 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  if (__pyx_4) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":61 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "TypeError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k6); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 61; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":62 */
  __pyx_4 = (__pyx_v_a->nd != 2);
  if (__pyx_4) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":63 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    __pyx_1 = PyString_FromString(__pyx_k7); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
    __pyx_1 = 0;
    __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 63; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":66 */
  __pyx_v_nrows = (__pyx_v_a->dimensions[0]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":67 */
  __pyx_v_ncols = (__pyx_v_a->dimensions[1]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":68 */
  __pyx_v_elems = ((float (*))__pyx_v_a->data);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":69 */
  __pyx_2 = PyString_FromString(__pyx_k8); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 69; goto __pyx_L1;}
  Py_DECREF(__pyx_v_hyphen);
  __pyx_v_hyphen = __pyx_2;
  __pyx_2 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":70 */
  __pyx_3 = PyString_FromString(__pyx_k9); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_1 = PyInt_FromLong(10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_2 = PyNumber_Multiply(__pyx_1, __pyx_v_hyphen); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  __pyx_1 = PyNumber_Add(__pyx_3, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_2 = PyNumber_Multiply(__pyx_1, __pyx_3); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_1 = PyString_FromString(__pyx_k10); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  __pyx_3 = PyNumber_Add(__pyx_2, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_v_divider);
  __pyx_v_divider = __pyx_3;
  __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":71 */
  if (__Pyx_PrintItem(__pyx_v_divider) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":72 */
  __pyx_2 = __Pyx_GetName(__pyx_b, "range"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  __pyx_1 = PyInt_FromLong(__pyx_v_nrows); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
  __pyx_1 = 0;
  __pyx_1 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_2 = PyObject_GetIter(__pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  for (;;) {
    __pyx_L4:;
    __pyx_3 = PyIter_Next(__pyx_2);
    if (!__pyx_3) {
      if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 72; goto __pyx_L1;}
      break;
    }
    Py_DECREF(__pyx_v_row);
    __pyx_v_row = __pyx_3;
    __pyx_3 = 0;

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":73 */
    __pyx_1 = __Pyx_GetName(__pyx_b, "range"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    Py_DECREF(__pyx_1); __pyx_1 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __pyx_1 = PyObject_GetIter(__pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    for (;;) {
      __pyx_L6:;
      __pyx_5 = PyIter_Next(__pyx_1);
      if (!__pyx_5) {
        if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; goto __pyx_L1;}
        break;
      }
      Py_DECREF(__pyx_v_col);
      __pyx_v_col = __pyx_5;
      __pyx_5 = 0;

      /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":74 */
      __pyx_3 = PyInt_FromLong(__pyx_v_ncols); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      __pyx_5 = PyNumber_Multiply(__pyx_v_row, __pyx_3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_3 = PyNumber_Add(__pyx_5, __pyx_v_col); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      __pyx_4 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; goto __pyx_L1;}
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      __pyx_v_x = (__pyx_v_elems[__pyx_4]);

      /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":75 */
      __pyx_5 = PyString_FromString(__pyx_k11); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_3 = PyFloat_FromDouble(__pyx_v_x); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      __pyx_6 = PyNumber_Remainder(__pyx_5, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      Py_DECREF(__pyx_5); __pyx_5 = 0;
      Py_DECREF(__pyx_3); __pyx_3 = 0;
      if (__Pyx_PrintItem(__pyx_6) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 75; goto __pyx_L1;}
      Py_DECREF(__pyx_6); __pyx_6 = 0;
    }
    __pyx_L7:;
    Py_DECREF(__pyx_1); __pyx_1 = 0;

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":76 */
    __pyx_5 = PyString_FromString(__pyx_k12); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
    if (__Pyx_PrintItem(__pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":77 */
    if (__Pyx_PrintItem(__pyx_v_divider) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
    if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; goto __pyx_L1;}
  }
  __pyx_L5:;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("numeric_test.print_2d_array");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_hyphen);
  Py_DECREF(__pyx_v_divider);
  Py_DECREF(__pyx_v_row);
  Py_DECREF(__pyx_v_col);
  Py_DECREF(__pyx_v_a);
  return __pyx_r;
}


static void __pyx_f_12numeric_test_calcr(int (*__pyx_v_N),int (*__pyx_v_P),double (*__pyx_v_X),int (*__pyx_v_NF),double (*__pyx_v_V),PyObject *__pyx_v_UI,PyObject *__pyx_v_UR,PyObject *__pyx_v_UF) {
  Py_INCREF(__pyx_v_UI);
  Py_INCREF(__pyx_v_UR);
  Py_INCREF(__pyx_v_UF);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":83 */

  goto __pyx_L0;
  __pyx_L1:;
  __Pyx_WriteUnraisable("numeric_test.calcr");
  __pyx_L0:;
  Py_DECREF(__pyx_v_UI);
  Py_DECREF(__pyx_v_UR);
  Py_DECREF(__pyx_v_UF);
}

static char (__pyx_k13[]) = "1 dimensional array required";
static char (__pyx_k14[]) = "2 dimensional array required";
static char (__pyx_k15[]) = "Bounds array's shape must be (2,P), (%s,%s)";
static char (__pyx_k16[]) = "1 dimensional array required";
static char (__pyx_k17[]) = "1 dimensional array required";
static char (__pyx_k18[]) = "Hello";
static char (__pyx_k19[]) = "unable to allocate %s bytes";
static char (__pyx_k20[]) = "unable to allocate %s bytes";

static PyObject *__pyx_f_12numeric_test_dn2fb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_dn2fb(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyArrayObject *__pyx_v_X = 0;
  PyArrayObject *__pyx_v_B = 0;
  PyObject *__pyx_v_UI = 0;
  PyObject *__pyx_v_UR = 0;
  PyObject *__pyx_v_UF = 0;
  int __pyx_v_bytes;
  int __pyx_v_N;
  int __pyx_v_P;
  int __pyx_v_LV;
  int __pyx_v_LIV;
  int (*__pyx_v_IV);
  double (*__pyx_v_V);
  PyArrayObject *__pyx_v_Bfortran;
  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;
  static char *__pyx_argnames[] = {"X","B","UI","UR","UF",0};
  if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OOOOO", __pyx_argnames, &__pyx_v_X, &__pyx_v_B, &__pyx_v_UI, &__pyx_v_UR, &__pyx_v_UF)) return 0;
  Py_INCREF(__pyx_v_X);
  Py_INCREF(__pyx_v_B);
  Py_INCREF(__pyx_v_UI);
  Py_INCREF(__pyx_v_UR);
  Py_INCREF(__pyx_v_UF);
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_X), __pyx_ptype_12numeric_test_ArrayType, 1, "X")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
  if (!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_B), __pyx_ptype_12numeric_test_ArrayType, 1, "B")) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":98 */
  __pyx_1 = (__pyx_v_X->nd != 1);
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":99 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k13); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_4, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 99; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 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[0]; __pyx_lineno = 99; goto __pyx_L1;}
    goto __pyx_L2;
  }
  __pyx_L2:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":100 */
  __pyx_v_P = (__pyx_v_X->dimensions[0]);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":102 */
  __pyx_1 = (__pyx_v_B->nd != 2);
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":103 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    __pyx_4 = PyString_FromString(__pyx_k14); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; 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[0]; __pyx_lineno = 103; goto __pyx_L1;}
    goto __pyx_L3;
  }
  __pyx_L3:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":104 */
  __pyx_1 = ((__pyx_v_B->dimensions[0]) != 2);
  if (!__pyx_1) {
    __pyx_1 = ((__pyx_v_B->dimensions[1]) != __pyx_v_P);
  }
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":105 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k15); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    __pyx_4 = PyInt_FromLong((__pyx_v_B->dimensions[0])); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_5 = PyInt_FromLong((__pyx_v_B->dimensions[1])); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_4);
    PyTuple_SET_ITEM(__pyx_6, 1, __pyx_5);
    __pyx_4 = 0;
    __pyx_5 = 0;
    __pyx_4 = PyNumber_Remainder(__pyx_3, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_4);
    __pyx_4 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_2, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; goto __pyx_L1;}
    goto __pyx_L4;
  }
  __pyx_L4:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":108 */
  __pyx_6 = PyObject_GetAttrString(__pyx_v_UI, "nd"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  __pyx_4 = PyInt_FromLong(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_6, __pyx_4, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
  __pyx_1 = __pyx_1 != 0;
  Py_DECREF(__pyx_6); __pyx_6 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":109 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    __pyx_5 = PyString_FromString(__pyx_k16); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5);
    __pyx_5 = 0;
    __pyx_6 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    __Pyx_Raise(__pyx_6, 0, 0);
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; goto __pyx_L1;}
    goto __pyx_L5;
  }
  __pyx_L5:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":110 */
  __pyx_4 = PyObject_GetAttrString(__pyx_v_UR, "nd"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_5 = PyInt_FromLong(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  if (PyObject_Cmp(__pyx_4, __pyx_5, &__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
  __pyx_1 = __pyx_1 != 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":111 */
    __pyx_2 = __Pyx_GetName(__pyx_b, "ValueError"); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k17); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    __pyx_6 = PyTuple_New(1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_6, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_6); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    Py_DECREF(__pyx_2); __pyx_2 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __Pyx_Raise(__pyx_4, 0, 0);
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
    goto __pyx_L6;
  }
  __pyx_L6:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":115 */
  __pyx_5 = __Pyx_GetName(__pyx_m, "ravel"); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  __pyx_3 = __Pyx_GetName(__pyx_m, "transpose"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_INCREF(((PyObject *)__pyx_v_B));
  PyTuple_SET_ITEM(__pyx_2, 0, ((PyObject *)__pyx_v_B));
  __pyx_6 = PyObject_CallObject(__pyx_3, __pyx_2); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  __pyx_4 = PyTuple_New(1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_4, 0, __pyx_6);
  __pyx_6 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
  Py_DECREF(__pyx_5); __pyx_5 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  Py_INCREF(((PyObject *)__pyx_3));
  __pyx_v_Bfortran = (PyArrayObject*)__pyx_3;
  Py_DECREF(__pyx_3); __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":116 */
  Py_INCREF(((PyObject *)__pyx_v_Bfortran));
  Py_DECREF(((PyObject *)__pyx_v_B));
  __pyx_v_B = __pyx_v_Bfortran;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":117 */
  __pyx_2 = PyString_FromString(__pyx_k18); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
  if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":119 */
  __pyx_v_N = 5;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":120 */
  __pyx_v_LIV = (82 + (4 * __pyx_v_P));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":121 */
  __pyx_v_LV = ((105 + (__pyx_v_P * ((__pyx_v_N + (2 * __pyx_v_P)) + 21))) + (2 * __pyx_v_N));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":123 */
  __pyx_v_bytes = ((sizeof(int )) * __pyx_v_LIV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":124 */
  __pyx_v_IV = ((int (*))malloc(__pyx_v_bytes));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":125 */
  __pyx_1 = (!((int )__pyx_v_IV));
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":126 */
    __pyx_6 = __Pyx_GetName(__pyx_b, "MemoryError"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_5 = PyString_FromString(__pyx_k19); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_4 = __Pyx_GetName(__pyx_b, "s"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    __pyx_3 = PyNumber_Remainder(__pyx_5, __pyx_4); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_2, 0, __pyx_3);
    __pyx_3 = 0;
    __pyx_5 = PyObject_CallObject(__pyx_6, __pyx_2); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 126; goto __pyx_L1;}
    Py_DECREF(__pyx_6); __pyx_6 = 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[0]; __pyx_lineno = 126; goto __pyx_L1;}
    goto __pyx_L7;
  }
  __pyx_L7:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":128 */
  __pyx_v_bytes = ((sizeof(double )) * __pyx_v_LV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":129 */
  __pyx_v_V = ((double (*))malloc(__pyx_v_bytes));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":130 */
  __pyx_1 = (!((int )__pyx_v_V));
  if (__pyx_1) {

    /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":131 */
    __pyx_4 = __Pyx_GetName(__pyx_b, "MemoryError"); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_3 = PyString_FromString(__pyx_k20); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_6 = __Pyx_GetName(__pyx_b, "s"); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    __pyx_2 = PyNumber_Remainder(__pyx_3, __pyx_6); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    Py_DECREF(__pyx_6); __pyx_6 = 0;
    __pyx_5 = PyTuple_New(1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    PyTuple_SET_ITEM(__pyx_5, 0, __pyx_2);
    __pyx_2 = 0;
    __pyx_3 = PyObject_CallObject(__pyx_4, __pyx_5); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    Py_DECREF(__pyx_4); __pyx_4 = 0;
    Py_DECREF(__pyx_5); __pyx_5 = 0;
    __Pyx_Raise(__pyx_3, 0, 0);
    Py_DECREF(__pyx_3); __pyx_3 = 0;
    {__pyx_filename = __pyx_f[0]; __pyx_lineno = 131; goto __pyx_L1;}
    goto __pyx_L8;
  }
  __pyx_L8:;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":133 */
  dn2fb_((&__pyx_v_N),(&__pyx_v_P),((double (*))__pyx_v_X->data),((double (*(*)))__pyx_v_B->data),((void (*))__pyx_f_12numeric_test_calcr),__pyx_v_IV,(&__pyx_v_LIV),(&__pyx_v_LV),__pyx_v_V,((int (*))__pyx_v_UI),((double (*))__pyx_v_UR),((void (*))__pyx_v_UF));

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":136 */
  free(__pyx_v_IV);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":137 */
  free(__pyx_v_V);

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  goto __pyx_L0;
  __pyx_L1:;
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  Py_XDECREF(__pyx_5);
  Py_XDECREF(__pyx_6);
  __Pyx_AddTraceback("numeric_test.dn2fb");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_Bfortran);
  Py_DECREF(__pyx_v_X);
  Py_DECREF(__pyx_v_B);
  Py_DECREF(__pyx_v_UI);
  Py_DECREF(__pyx_v_UR);
  Py_DECREF(__pyx_v_UF);
  return __pyx_r;
}


static PyObject *__pyx_f_12numeric_test_return_new_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
static PyObject *__pyx_f_12numeric_test_return_new_array(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
  PyObject *__pyx_v_Result;
  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;
  __pyx_v_Result = Py_None; Py_INCREF(__pyx_v_Result);

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":142 */
  __pyx_1 = __Pyx_GetName(__pyx_b, "array"); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_2 = PyInt_FromLong(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_3 = PyInt_FromLong(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_4 = PyFloat_FromDouble(3.2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  __pyx_5 = PyList_New(3); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_5, 0, __pyx_2);
  PyList_SET_ITEM(__pyx_5, 1, __pyx_3);
  PyList_SET_ITEM(__pyx_5, 2, __pyx_4);
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_4 = 0;
  __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5);
  __pyx_5 = 0;
  __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;
  Py_DECREF(__pyx_v_Result);
  __pyx_v_Result = __pyx_3;
  __pyx_3 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":152 */
  Py_INCREF(__pyx_v_Result);
  __pyx_r = __pyx_v_Result;
  goto __pyx_L0;

  __pyx_r = Py_None; Py_INCREF(__pyx_r);
  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("numeric_test.return_new_array");
  __pyx_r = 0;
  __pyx_L0:;
  Py_DECREF(__pyx_v_Result);
  return __pyx_r;
}

static struct PyMethodDef __pyx_methods[] = {
  {"print_2d_array", (PyCFunction)__pyx_f_12numeric_test_print_2d_array, METH_VARARGS|METH_KEYWORDS, 0},
  {"dn2fb", (PyCFunction)__pyx_f_12numeric_test_dn2fb, METH_VARARGS|METH_KEYWORDS, 0},
  {"return_new_array", (PyCFunction)__pyx_f_12numeric_test_return_new_array, METH_VARARGS|METH_KEYWORDS, 0},
  {0, 0, 0, 0}
};

DL_EXPORT(void) initnumeric_test(void); /*proto*/
DL_EXPORT(void) initnumeric_test(void) {
  PyObject *__pyx_1 = 0;
  PyObject *__pyx_2 = 0;
  PyObject *__pyx_3 = 0;
  PyObject *__pyx_4 = 0;
  __pyx_m = Py_InitModule4("numeric_test", __pyx_methods, 0, 0, PYTHON_API_VERSION);
  __pyx_b = PyImport_AddModule("__builtin__");
  PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b);
  __pyx_ptype_12numeric_test_ArrayType = __Pyx_ImportType("Numeric", "ArrayType", sizeof(PyArrayObject)); if (!__pyx_ptype_12numeric_test_ArrayType) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; goto __pyx_L1;}

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":10 */
  __pyx_1 = PyString_FromString(__pyx_k1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_2 = PyString_FromString(__pyx_k2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_3 = PyString_FromString(__pyx_k3); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  __pyx_4 = PyList_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  PyList_SET_ITEM(__pyx_4, 0, __pyx_2);
  PyList_SET_ITEM(__pyx_4, 1, __pyx_3);
  __pyx_2 = 0;
  __pyx_3 = 0;
  __pyx_2 = __Pyx_Import(__pyx_1, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_1); __pyx_1 = 0;
  Py_DECREF(__pyx_4); __pyx_4 = 0;
  __pyx_3 = PyObject_GetAttrString(__pyx_2, "ravel"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "ravel", __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  __pyx_3 = PyObject_GetAttrString(__pyx_2, "transpose"); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  if (PyObject_SetAttrString(__pyx_m, "transpose", __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 10; goto __pyx_L1;}
  Py_DECREF(__pyx_3); __pyx_3 = 0;
  Py_DECREF(__pyx_2); __pyx_2 = 0;

  /* "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx":141 */
  return;
  __pyx_L1:;
  Py_XDECREF(__pyx_1);
  Py_XDECREF(__pyx_2);
  Py_XDECREF(__pyx_3);
  Py_XDECREF(__pyx_4);
  __Pyx_AddTraceback("numeric_test");
}

static char *__pyx_filenames[] = {
  "/apps/mot_ddl_rfif/lib/python2.2/mot_ddl_wssg/lib/optimizers/numeric_test.pyx",
};
statichere char **__pyx_f = __pyx_filenames;

/* Runtime support code */

static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, char *name) {
	if (!type) {
		PyErr_Format(PyExc_SystemError, "Missing type object");
		return 0;
	}
	if ((none_allowed && obj == Py_None) || PyObject_TypeCheck(obj, type))
		return 1;
	PyErr_Format(PyExc_TypeError,
		"Argument '%s' has incorrect type (expected %s, got %s)",
		name, type->tp_name, obj->ob_type->tp_name);
	return 0;
}

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, char *name) {
	PyObject *result;
	result = PyObject_GetAttrString(dict, name);
	if (!result)
		PyErr_SetString(PyExc_NameError, name);
	return result;
}

static PyObject *__Pyx_GetStdout(void) {
	PyObject *f = PySys_GetObject("stdout");
	if (!f) {
		PyErr_SetString(PyExc_RuntimeError, "lost sys.stdout");
	}
	return f;
}

static int __Pyx_PrintItem(PyObject *v) {
	PyObject *f;
	
	if (!(f = __Pyx_GetStdout()))
		return -1;
	if (PyFile_SoftSpace(f, 1)) {
		if (PyFile_WriteString(" ", f) < 0)
			return -1;
	}
	if (PyFile_WriteObject(v, f, Py_PRINT_RAW) < 0)
		return -1;
	if (PyString_Check(v)) {
		char *s = PyString_AsString(v);
		int len = PyString_Size(v);
		if (len > 0 &&
			isspace(Py_CHARMASK(s[len-1])) &&
			s[len-1] != ' ')
				PyFile_SoftSpace(f, 0);
	}
	return 0;
}

static int __Pyx_PrintNewline(void) {
	PyObject *f;
	
	if (!(f = __Pyx_GetStdout()))
		return -1;
	if (PyFile_WriteString("\n", f) < 0)
		return -1;
	PyFile_SoftSpace(f, 0);
	return 0;
}

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_Check(type))
		;
	else if (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 {
		/* Not something you can raise.  You get an exception
		   anyway, just not what you specified :-) */
		PyErr_Format(PyExc_TypeError,
			     "exceptions must be strings, classes, or "
			     "instances, 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_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 PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, 
	long size) 
{
	PyObject *py_module_name = 0;
	PyObject *py_class_name = 0;
	PyObject *py_name_list = 0;
	PyObject *py_module = 0;
	PyObject *result = 0;
	
	py_module_name = PyString_FromString(module_name);
	if (!py_module_name)
		goto bad;
	py_class_name = PyString_FromString(class_name);
	if (!py_class_name)
		goto bad;
	py_name_list = PyList_New(1);
	if (!py_name_list)
		goto bad;
	Py_INCREF(py_class_name);
	if (PyList_SetItem(py_name_list, 0, py_class_name) < 0)
		goto bad;
	py_module = __Pyx_Import(py_module_name, py_name_list);
	if (!py_module)
		goto bad;
	result = PyObject_GetAttr(py_module, py_class_name);
	if (!result)
		goto bad;
	if (!PyType_Check(result)) {
		PyErr_Format(PyExc_TypeError, 
			"%s.%s is not a type object",
			module_name, class_name);
		goto bad;
	}
	if (((PyTypeObject *)result)->tp_basicsize != size) {
		PyErr_Format(PyExc_ValueError, 
			"%s.%s does not appear to be the correct type object",
			module_name, class_name);
		goto bad;
	}
	goto done;
bad:
	Py_XDECREF(result);
	result = 0;
done:
	Py_XDECREF(py_module_name);
	Py_XDECREF(py_class_name);
	Py_XDECREF(py_name_list);
	return (PyTypeObject *)result;
}

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


More information about the Pyrex mailing list