From scipy-svn at scipy.org Tue Nov 2 01:44:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 2 Nov 2010 00:44:29 -0500 (CDT) Subject: [Scipy-svn] r6857 - trunk/scipy/signal Message-ID: <20101102054429.6588237CD03@scipy.org> Author: warren.weckesser Date: 2010-11-02 00:44:28 -0500 (Tue, 02 Nov 2010) New Revision: 6857 Modified: trunk/scipy/signal/wavelets.py trunk/scipy/signal/windows.py Log: Remove an unused import. Update 'raise' syntax. Modified: trunk/scipy/signal/wavelets.py =================================================================== --- trunk/scipy/signal/wavelets.py 2010-10-25 20:10:06 UTC (rev 6856) +++ trunk/scipy/signal/wavelets.py 2010-11-02 05:44:28 UTC (rev 6857) @@ -62,8 +62,8 @@ q = q / np.sum(q) * sqrt(2) return q.c[::-1] else: - raise ValueError, "Polynomial factorization does not work "\ - "well for p too large." + raise ValueError("Polynomial factorization does not work " + "well for p too large.") def qmf(hk): """Return high-pass qmf filter from low-pass @@ -118,9 +118,9 @@ N = len(hk)-1 if (J > 30 - np.log2(N+1)): - raise ValueError, "Too many levels." + raise ValueError("Too many levels.") if (J < 1): - raise ValueError, "Too few levels." + raise ValueError("Too few levels.") # construct matrices needed Modified: trunk/scipy/signal/windows.py =================================================================== --- trunk/scipy/signal/windows.py 2010-10-25 20:10:06 UTC (rev 6856) +++ trunk/scipy/signal/windows.py 2010-11-02 05:44:28 UTC (rev 6857) @@ -1,7 +1,5 @@ """The suite of window functions.""" -import types - import numpy as np from scipy import special, linalg from scipy.fftpack import fft @@ -340,8 +338,8 @@ """ if (M*width > 27.38): - raise ValueError, "Cannot reliably obtain slepian sequences for"\ - " M*width > 27.38." + raise ValueError("Cannot reliably obtain slepian sequences for" + " M*width > 27.38.") if M < 1: return np.array([]) if M == 1: @@ -473,7 +471,7 @@ elif winstr in ['chebwin', 'cheb']: winfunc = chebwin else: - raise ValueError, "Unknown window type." + raise ValueError("Unknown window type.") params = (Nx,) + args + (sym,) else: From scipy-svn at scipy.org Tue Nov 2 02:05:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 2 Nov 2010 01:05:12 -0500 (CDT) Subject: [Scipy-svn] r6858 - trunk/scipy/signal Message-ID: <20101102060512.6700337D433@scipy.org> Author: warren.weckesser Date: 2010-11-02 01:05:10 -0500 (Tue, 02 Nov 2010) New Revision: 6858 Modified: trunk/scipy/signal/bsplines.py Log: ENH: signal: In bsplines.py, don't use 'import *', and update 'raise' statements. Modified: trunk/scipy/signal/bsplines.py =================================================================== --- trunk/scipy/signal/bsplines.py 2010-11-02 05:44:28 UTC (rev 6857) +++ trunk/scipy/signal/bsplines.py 2010-11-02 06:05:10 UTC (rev 6858) @@ -4,10 +4,15 @@ piecewise, array, arctan2, tan, zeros, arange, floor from numpy.core.umath import sqrt, exp, greater, less, cos, add, sin, \ less_equal, greater_equal -from spline import * # C-modules + +# From splinemodule.c +from spline import cspline2d, qspline2d, sepfir2d, symiirorder1, symiirorder2 + from scipy.misc import comb + gamma = scipy.special.gamma + def factorial(n): return gamma(n+1) @@ -31,7 +36,7 @@ out = sepfir2d(ckr, hcol, hcol) out = out.astype(intype) else: - raise TypeError; + raise TypeError("Invalid data type for Iin") return out _splinefunc_cache = {} @@ -181,7 +186,7 @@ c0 = 5040 P = array([1,120,1191,2416,1191, 120, 1]) else: - raise ValueError, "Unknown order." + raise ValueError("Unknown order %d" % order) def _coeff_smooth(lam): xi = 1 - 96*lam + 24*lam * sqrt(3 + 144*lam) @@ -302,7 +307,7 @@ Cubic spline coefficients. """ if lamb != 0.0: - raise ValueError, "Smoothing quadratic splines not supported yet." + raise ValueError("Smoothing quadratic splines not supported yet.") else: return _quadratic_coeff(signal) From scipy-svn at scipy.org Tue Nov 2 11:19:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 2 Nov 2010 10:19:29 -0500 (CDT) Subject: [Scipy-svn] r6859 - trunk Message-ID: <20101102151929.7E88337CCE9@scipy.org> Author: rgommers Date: 2010-11-02 10:19:28 -0500 (Tue, 02 Nov 2010) New Revision: 6859 Modified: trunk/pavement.py Log: REL: Update pavement.py for 0.9.0 and add paths for python 2.7. Modified: trunk/pavement.py =================================================================== --- trunk/pavement.py 2010-11-02 06:05:10 UTC (rev 6858) +++ trunk/pavement.py 2010-11-02 15:19:28 UTC (rev 6859) @@ -77,22 +77,26 @@ if sys.platform == "win32": WINE_PY25 = [r"C:\Python25\python.exe"] WINE_PY26 = [r"C:\Python26\python26.exe"] + WINE_PY27 = [r"C:\Python27\python27.exe"] MAKENSIS = ["makensis"] elif sys.platform == "darwin": WINE_PY25 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] WINE_PY26 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"] + WINE_PY27 = ["wine", os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"] MAKENSIS = ["wine", "makensis"] else: WINE_PY25 = [os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] WINE_PY26 = [os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"] + WINE_PY27 = [os.environ['HOME'] + "/.wine/drive_c/Python27/python.exe"] MAKENSIS = ["wine", "makensis"] -WINE_PYS = {'2.6' : WINE_PY26, '2.5': WINE_PY25} +WINE_PYS = {'2.7' : WINE_PY27, '2.6' : WINE_PY26, '2.5': WINE_PY25} SUPERPACK_BUILD = 'build-superpack' SUPERPACK_BINDIR = os.path.join(SUPERPACK_BUILD, 'binaries') # XXX: fix this in a sane way MPKG_PYTHON = {"2.5": "/Library/Frameworks/Python.framework/Versions/2.5/bin/python", - "2.6": "/Library/Frameworks/Python.framework/Versions/2.6/bin/python"} + "2.6": "/Library/Frameworks/Python.framework/Versions/2.6/bin/python", + "2.7": "/Library/Frameworks/Python.framework/Versions/2.7/bin/python"} # Full path to the *static* gfortran runtime LIBGFORTRAN_A_PATH = "/usr/local/lib/libgfortran.a" @@ -106,10 +110,10 @@ DOC_BLD_LATEX = DOC_BLD / "latex" # Source of the release notes -RELEASE = 'doc/release/0.8.0-notes.rst' +RELEASE = 'doc/release/0.9.0-notes.rst' # Start/end of the log (from git) -LOG_START = 'svn/tags/0.7.0' +LOG_START = 'svn/tags/0.8.0' LOG_END = 'master' # Virtualenv bootstrap stuff @@ -124,7 +128,7 @@ options(sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'), virtualenv=Bunch(script_name=BOOTSTRAP_SCRIPT, - packages_to_install=["sphinx==0.6.5"]), + packages_to_install=["sphinx==1.0.4"]), wininst=Bunch(pyver=PYVER, scratch=True)) def parse_numpy_version(pyexec): From scipy-svn at scipy.org Thu Nov 11 19:55:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:55:57 -0600 (CST) Subject: [Scipy-svn] r6860 - trunk/scipy/io/matlab Message-ID: <20101112005557.7721C32340@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:55:56 -0600 (Thu, 11 Nov 2010) New Revision: 6860 Modified: trunk/scipy/io/matlab/mio5_utils.pyx Log: ENH: allow non-conforming strings with zero bytes and non-zero length Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-02 15:19:28 UTC (rev 6859) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:55:56 UTC (rev 6860) @@ -705,7 +705,7 @@ return scipy.sparse.csc_matrix( (data,rowind,indptr), shape=(M,N)) - + cpdef cnp.ndarray read_char(self, VarHeader5 header): ''' Read char matrices from stream as arrays @@ -713,7 +713,7 @@ string by later processing in ``array_from_header`` ''' '''Notes to friendly fellow-optimizer - + This routine is not much optimized. If I was going to do it, I'd store the codecs as an object pointer array, as for the .dtypes, I might use python_string.PyBytes_Decode for decoding, @@ -724,7 +724,7 @@ deals with unicode strings passed as memory, My own unicode introduction here: - https://cirl.berkeley.edu/mb312/pydagogue/python_unicode.html + http://matthew-brett.github.com/pydagogue/python_unicode.html ''' cdef: cnp.uint32_t mdtype, byte_count @@ -732,14 +732,23 @@ size_t el_count object data, res, codec cnp.ndarray arr + cnp.dtype dt cdef size_t length = self.size_from_header(header) data = self.read_element( &mdtype, &byte_count, &data_ptr, True) + # There are mat files in the wild that have 0 byte count strings, but + # maybe with non-zero length. + if byte_count == 0: + arr = np.array(' ' * length, dtype='U') + return np.ndarray(shape=header.dims, + dtype=self.U1_dtype, + buffer=arr, + order='F') # Character data can be of apparently numerical types, # specifically np.uint8, np.int8, np.uint16. np.unit16 can have # a length 1 type encoding, like ascii, or length 2 type # encoding - cdef cnp.dtype dt = self.dtypes[mdtype] + dt = self.dtypes[mdtype] if mdtype == miUINT16: codec = self.uint16_codec if self.codecs['uint16_len'] == 1: # need LSBs only @@ -759,14 +768,13 @@ uc_str = data.decode(codec) # cast to array to deal with 2, 4 byte width characters arr = np.array(uc_str, dtype='U') - dt = self.U1_dtype # could take this to numpy C-API level, but probably not worth # it return np.ndarray(shape=header.dims, - dtype=dt, + dtype=self.U1_dtype, buffer=arr, order='F') - + cpdef cnp.ndarray read_cells(self, VarHeader5 header): ''' Read cell array from stream ''' cdef: From scipy-svn at scipy.org Thu Nov 11 19:56:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:02 -0600 (CST) Subject: [Scipy-svn] r6861 - trunk/scipy/io/matlab Message-ID: <20101112005602.2D8723234F@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:02 -0600 (Thu, 11 Nov 2010) New Revision: 6861 Modified: trunk/scipy/io/matlab/mio5.py Log: ENH: add utility function to pull variables out of mat file as individual mat files Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:55:56 UTC (rev 6860) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:02 UTC (rev 6861) @@ -436,7 +436,76 @@ break return mdict - + +def varmats_from_mat(file_obj): + """ Pull variables out of mat 5 file as a sequence of mat file objects + + This can be useful with a difficult mat file, containing unreadable + variables. This routine pulls the variables out in raw form and puts them, + unread, back into a file stream for saving or reading. Another use is the + pathological case where there is more than one variable of the same name in + the file; this routine returns the duplicates, whereas the standard reader + will overwrite duplicates in the returned dictionary. + + The file pointer in `file_obj` will be undefined. File pointers for the + returned file-like objects are set at 0. + + Parameters + ---------- + file_obj : file-like + file object containing mat file + + Returns + ------- + named_mats : list + list contains tuples of (name, BytesIO) where BytesIO is a file-like + object containing mat file contents as for a single variable. The + BytesIO contains a string with the original header and a single var. If + ``var_file_obj`` is an individual BytesIO instance, then save as a mat + file with something like ``open('test.mat', + 'wb').write(var_file_obj.read())`` + + Example + ------- + >>> import scipy.io + + BytesIO is from the ``io`` module in python 3, and is ``cStringIO`` for + python < 3. + + >>> mat_fileobj = BytesIO() + >>> scipy.io.savemat(mat_fileobj, {'b': np.arange(10), 'a': 'a string'}) + >>> varmats = varmats_from_mat(mat_fileobj) + >>> sorted([name for name, str_obj in varmats]) + ['a', 'b'] + """ + rdr = MatFile5Reader(file_obj) + file_obj.seek(0) + # Raw read of top-level file header + hdr_len = np.dtype(mdtypes_template['file_header']).itemsize + raw_hdr = file_obj.read(hdr_len) + # Initialize variable reading + file_obj.seek(0) + rdr.initialize_read() + mdict = rdr.read_file_header() + next_position = file_obj.tell() + named_mats = [] + while not rdr.end_of_stream(): + start_position = next_position + hdr, next_position = rdr.read_var_header() + name = asstr(hdr.name) + # Read raw variable string + file_obj.seek(start_position) + byte_count = next_position - start_position + var_str = file_obj.read(byte_count) + # write to stringio object + out_obj = BytesIO() + out_obj.write(raw_hdr) + out_obj.write(var_str) + out_obj.seek(0) + named_mats.append((name, out_obj)) + return named_mats + + def to_writeable(source): ''' Convert input object ``source`` to something we can write From scipy-svn at scipy.org Thu Nov 11 19:56:10 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:10 -0600 (CST) Subject: [Scipy-svn] r6862 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005610.355553234F@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:10 -0600 (Thu, 11 Nov 2010) New Revision: 6862 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/mio5_params.py trunk/scipy/io/matlab/mio5_utils.pyx trunk/scipy/io/matlab/tests/test_mio5_utils.py Log: RF: move dtype etc calculation to readers / writers Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:02 UTC (rev 6861) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:10 UTC (rev 6862) @@ -86,8 +86,10 @@ import scipy.sparse +import byteordercodes as boc + from miobase import MatFileReader, docfiller, matdims, \ - read_dtype, convert_dtypes, arr_to_chars, arr_dtype_number, \ + read_dtype, arr_to_chars, arr_dtype_number, \ MatWriteError, MatReadError # Reader object for matlab 5 format variables @@ -95,139 +97,12 @@ # Constants and helper objects from mio5_params import MatlabObject, MatlabFunction, \ - miINT8, miUINT8, miINT16, miUINT16, miINT32, miUINT32, \ - miSINGLE, miDOUBLE, miINT64, miUINT64, miMATRIX, \ - miCOMPRESSED, miUTF8, miUTF16, miUTF32, \ - mxCELL_CLASS, mxSTRUCT_CLASS, mxOBJECT_CLASS, mxCHAR_CLASS, \ - mxSPARSE_CLASS, mxDOUBLE_CLASS, mxSINGLE_CLASS, mxINT8_CLASS, \ - mxUINT8_CLASS, mxINT16_CLASS, mxUINT16_CLASS, mxINT32_CLASS, \ - mxUINT32_CLASS, mxINT64_CLASS, mxUINT64_CLASS + MDTYPES, NP_TO_MTYPES, NP_TO_MXTYPES, \ + miCOMPRESSED, miMATRIX, miINT8, miUTF8, miUINT32, \ + mxCELL_CLASS, mxSTRUCT_CLASS, mxOBJECT_CLASS, mxCHAR_CLASS, \ + mxSPARSE_CLASS, mxDOUBLE_CLASS -mdtypes_template = { - miINT8: 'i1', - miUINT8: 'u1', - miINT16: 'i2', - miUINT16: 'u2', - miINT32: 'i4', - miUINT32: 'u4', - miSINGLE: 'f4', - miDOUBLE: 'f8', - miINT64: 'i8', - miUINT64: 'u8', - miUTF8: 'u1', - miUTF16: 'u2', - miUTF32: 'u4', - 'file_header': [('description', 'S116'), - ('subsystem_offset', 'i8'), - ('version', 'u2'), - ('endian_test', 'S2')], - 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], - 'tag_smalldata':[('byte_count_mdtype', 'u4'), ('data', 'S4')], - 'array_flags': [('data_type', 'u4'), - ('byte_count', 'u4'), - ('flags_class','u4'), - ('nzmax', 'u4')], - 'U1': 'U1', - } - -mclass_dtypes_template = { - mxINT8_CLASS: 'i1', - mxUINT8_CLASS: 'u1', - mxINT16_CLASS: 'i2', - mxUINT16_CLASS: 'u2', - mxINT32_CLASS: 'i4', - mxUINT32_CLASS: 'u4', - mxINT64_CLASS: 'i8', - mxUINT64_CLASS: 'u8', - mxSINGLE_CLASS: 'f4', - mxDOUBLE_CLASS: 'f8', - } - - -np_to_mtypes = { - 'f8': miDOUBLE, - 'c32': miDOUBLE, - 'c24': miDOUBLE, - 'c16': miDOUBLE, - 'f4': miSINGLE, - 'c8': miSINGLE, - 'i1': miINT8, - 'i2': miINT16, - 'i4': miINT32, - 'i8': miINT64, - 'u1': miUINT8, - 'u2': miUINT16, - 'u4': miUINT32, - 'u8': miUINT64, - 'S1': miUINT8, - 'U1': miUTF16, - } - - -np_to_mxtypes = { - 'f8': mxDOUBLE_CLASS, - 'c32': mxDOUBLE_CLASS, - 'c24': mxDOUBLE_CLASS, - 'c16': mxDOUBLE_CLASS, - 'f4': mxSINGLE_CLASS, - 'c8': mxSINGLE_CLASS, - 'i8': mxINT64_CLASS, - 'i4': mxINT32_CLASS, - 'i2': mxINT16_CLASS, - 'u8': mxUINT64_CLASS, - 'u2': mxUINT16_CLASS, - 'u1': mxUINT8_CLASS, - 'S1': mxUINT8_CLASS, - } - - - -''' Before release v7.1 (release 14) matlab (TM) used the system -default character encoding scheme padded out to 16-bits. Release 14 -and later use Unicode. When saving character data, R14 checks if it -can be encoded in 7-bit ascii, and saves in that format if so.''' - -codecs_template = { - miUTF8: {'codec': 'utf_8', 'width': 1}, - miUTF16: {'codec': 'utf_16', 'width': 2}, - miUTF32: {'codec': 'utf_32','width': 4}, - } - - -def convert_codecs(template, byte_order): - ''' Convert codec template mapping to byte order - - Set codecs not on this system to None - - Parameters - ---------- - template : mapping - key, value are respectively codec name, and root name for codec - (without byte order suffix) - byte_order : {'<', '>'} - code for little or big endian - - Returns - ------- - codecs : dict - key, value are name, codec (as in .encode(codec)) - ''' - codecs = {} - postfix = byte_order == '<' and '_le' or '_be' - for k, v in template.items(): - codec = v['codec'] - try: - " ".encode(codec) - except LookupError: - codecs[k] = None - continue - if v['width'] > 1: - codec += postfix - codecs[k] = codec - return codecs.copy() - - class MatFile5Reader(MatFileReader): ''' Reader for Mat 5 mat files Adds the following attribute to base class @@ -281,10 +156,6 @@ if not uint16_codec: uint16_codec = sys.getdefaultencoding() self.uint16_codec = uint16_codec - # placeholders for dtypes, codecs - see initialize_read - self.dtypes = None - self.class_dtypes = None - self.codecs = None # placeholders for readers - see initialize_read method self._file_reader = None self._matrix_reader = None @@ -300,7 +171,8 @@ def read_file_header(self): ''' Read in mat 5 file header ''' hdict = {} - hdr = read_dtype(self.mat_stream, self.dtypes['file_header']) + hdr_dtype = MDTYPES[self.byte_order]['dtypes']['file_header'] + hdr = read_dtype(self.mat_stream, hdr_dtype) hdict['__header__'] = hdr['description'].item().strip(asbytes(' \t\n\000')) v_major = hdr['version'] >> 8 v_minor = hdr['version'] & 0xFF @@ -312,15 +184,6 @@ Sets up readers from parameters in `self` ''' - self.dtypes = convert_dtypes(mdtypes_template, self.byte_order) - self.class_dtypes = convert_dtypes(mclass_dtypes_template, - self.byte_order) - self.codecs = convert_codecs(codecs_template, self.byte_order) - uint16_codec = self.uint16_codec - # Set length of miUINT16 char encoding - self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ - - len(" ".encode(uint16_codec)) - self.codecs['uint16_codec'] = uint16_codec # reader for top level stream. We need this extra top-level # reader because we use the matrix_reader object to contain # compressed matrices (so they have their own stream) @@ -481,7 +344,7 @@ rdr = MatFile5Reader(file_obj) file_obj.seek(0) # Raw read of top-level file header - hdr_len = np.dtype(mdtypes_template['file_header']).itemsize + hdr_len = MDTYPES[boc.native_code]['dtypes']['file_header'].itemsize raw_hdr = file_obj.read(hdr_len) # Initialize variable reading file_obj.seek(0) @@ -594,9 +457,16 @@ return narr +# Native byte ordered dtypes for convenience for writers +NDT_FILE_HDR = MDTYPES[boc.native_code]['dtypes']['file_header'] +NDT_TAG_FULL = MDTYPES[boc.native_code]['dtypes']['tag_full'] +NDT_TAG_SMALL = MDTYPES[boc.native_code]['dtypes']['tag_smalldata'] +NDT_ARRAY_FLAGS = MDTYPES[boc.native_code]['dtypes']['array_flags'] + + class VarWriter5(object): ''' Generic matlab matrix writing class ''' - mat_tag = np.zeros((), mdtypes_template['tag_full']) + mat_tag = np.zeros((), NDT_TAG_FULL) mat_tag['mdtype'] = miMATRIX def __init__(self, file_writer): @@ -617,7 +487,7 @@ def write_element(self, arr, mdtype=None): ''' write tag and data ''' if mdtype is None: - mdtype = np_to_mtypes[arr.dtype.str[1:]] + mdtype = NP_TO_MTYPES[arr.dtype.str[1:]] byte_count = arr.size*arr.itemsize if byte_count <= 4: self.write_smalldata_element(arr, mdtype, byte_count) @@ -626,7 +496,7 @@ def write_smalldata_element(self, arr, mdtype, byte_count): # write tag with embedded data - tag = np.zeros((), mdtypes_template['tag_smalldata']) + tag = np.zeros((), NDT_TAG_SMALL) tag['byte_count_mdtype'] = (byte_count << 16) + mdtype # if arr.tostring is < 4, the element will be zero-padded as needed. tag['data'] = arr.tostring(order='F') @@ -634,7 +504,7 @@ def write_regular_element(self, arr, mdtype, byte_count): # write tag, data - tag = np.zeros((), mdtypes_template['tag_full']) + tag = np.zeros((), NDT_TAG_FULL) tag['mdtype'] = mdtype tag['byte_count'] = byte_count self.write_bytes(tag) @@ -668,7 +538,7 @@ self._mat_tag_pos = self.file_stream.tell() self.write_bytes(self.mat_tag) # write array flags (complex, global, logical, class, nzmax) - af = np.zeros((), mdtypes_template['array_flags']) + af = np.zeros((), NDT_ARRAY_FLAGS) af['data_type'] = miUINT32 af['byte_count'] = 8 flags = is_complex << 3 | is_global << 2 | is_logical << 1 @@ -755,7 +625,7 @@ def write_numeric(self, arr): imagf = arr.dtype.kind == 'c' try: - mclass = np_to_mxtypes[arr.dtype.str[1:]] + mclass = NP_TO_MXTYPES[arr.dtype.str[1:]] except KeyError: if imagf: arr = arr.astype('c128') @@ -875,6 +745,7 @@ class MatFile5Writer(object): ''' Class for writing mat5 files ''' + @docfiller def __init__(self, file_stream, do_compression=False, @@ -912,7 +783,7 @@ def write_file_header(self): # write header - hdr = np.zeros((), mdtypes_template['file_header']) + hdr = np.zeros((), NDT_FILE_HDR) hdr['description']='MATLAB 5.0 MAT-file Platform: %s, Created on: %s' \ % (os.name,time.asctime()) hdr['version']= 0x0100 @@ -953,7 +824,7 @@ self._matrix_writer.file_stream = stream self._matrix_writer.write_top(var, asbytes(name), is_global) out_str = zlib.compress(stream.getvalue()) - tag = np.empty((), mdtypes_template['tag_full']) + tag = np.empty((), NDT_TAG_FULL) tag['mdtype'] = miCOMPRESSED tag['byte_count'] = len(out_str) self.file_stream.write(tag.tostring() + out_str) Modified: trunk/scipy/io/matlab/mio5_params.py =================================================================== --- trunk/scipy/io/matlab/mio5_params.py 2010-11-12 00:56:02 UTC (rev 6861) +++ trunk/scipy/io/matlab/mio5_params.py 2010-11-12 00:56:10 UTC (rev 6862) @@ -7,6 +7,7 @@ import numpy as np +from miobase import convert_dtypes miINT8 = 1 miUINT8 = 2 @@ -51,7 +52,137 @@ # https://www-old.cae.wisc.edu/pipermail/octave-maintainers/2007-May/002824.html mxOBJECT_CLASS_FROM_MATRIX_H = 18 +mdtypes_template = { + miINT8: 'i1', + miUINT8: 'u1', + miINT16: 'i2', + miUINT16: 'u2', + miINT32: 'i4', + miUINT32: 'u4', + miSINGLE: 'f4', + miDOUBLE: 'f8', + miINT64: 'i8', + miUINT64: 'u8', + miUTF8: 'u1', + miUTF16: 'u2', + miUTF32: 'u4', + 'file_header': [('description', 'S116'), + ('subsystem_offset', 'i8'), + ('version', 'u2'), + ('endian_test', 'S2')], + 'tag_full': [('mdtype', 'u4'), ('byte_count', 'u4')], + 'tag_smalldata':[('byte_count_mdtype', 'u4'), ('data', 'S4')], + 'array_flags': [('data_type', 'u4'), + ('byte_count', 'u4'), + ('flags_class','u4'), + ('nzmax', 'u4')], + 'U1': 'U1', + } +mclass_dtypes_template = { + mxINT8_CLASS: 'i1', + mxUINT8_CLASS: 'u1', + mxINT16_CLASS: 'i2', + mxUINT16_CLASS: 'u2', + mxINT32_CLASS: 'i4', + mxUINT32_CLASS: 'u4', + mxINT64_CLASS: 'i8', + mxUINT64_CLASS: 'u8', + mxSINGLE_CLASS: 'f4', + mxDOUBLE_CLASS: 'f8', + } + + +NP_TO_MTYPES = { + 'f8': miDOUBLE, + 'c32': miDOUBLE, + 'c24': miDOUBLE, + 'c16': miDOUBLE, + 'f4': miSINGLE, + 'c8': miSINGLE, + 'i1': miINT8, + 'i2': miINT16, + 'i4': miINT32, + 'i8': miINT64, + 'u1': miUINT8, + 'u2': miUINT16, + 'u4': miUINT32, + 'u8': miUINT64, + 'S1': miUINT8, + 'U1': miUTF16, + } + + +NP_TO_MXTYPES = { + 'f8': mxDOUBLE_CLASS, + 'c32': mxDOUBLE_CLASS, + 'c24': mxDOUBLE_CLASS, + 'c16': mxDOUBLE_CLASS, + 'f4': mxSINGLE_CLASS, + 'c8': mxSINGLE_CLASS, + 'i8': mxINT64_CLASS, + 'i4': mxINT32_CLASS, + 'i2': mxINT16_CLASS, + 'u8': mxUINT64_CLASS, + 'u2': mxUINT16_CLASS, + 'u1': mxUINT8_CLASS, + 'S1': mxUINT8_CLASS, + } + +''' Before release v7.1 (release 14) matlab (TM) used the system +default character encoding scheme padded out to 16-bits. Release 14 +and later use Unicode. When saving character data, R14 checks if it +can be encoded in 7-bit ascii, and saves in that format if so.''' + +codecs_template = { + miUTF8: {'codec': 'utf_8', 'width': 1}, + miUTF16: {'codec': 'utf_16', 'width': 2}, + miUTF32: {'codec': 'utf_32','width': 4}, + } + + +def _convert_codecs(template, byte_order): + ''' Convert codec template mapping to byte order + + Set codecs not on this system to None + + Parameters + ---------- + template : mapping + key, value are respectively codec name, and root name for codec + (without byte order suffix) + byte_order : {'<', '>'} + code for little or big endian + + Returns + ------- + codecs : dict + key, value are name, codec (as in .encode(codec)) + ''' + codecs = {} + postfix = byte_order == '<' and '_le' or '_be' + for k, v in template.items(): + codec = v['codec'] + try: + " ".encode(codec) + except LookupError: + codecs[k] = None + continue + if v['width'] > 1: + codec += postfix + codecs[k] = codec + return codecs.copy() + + +MDTYPES = {} +for _bytecode in '<>': + _def = {} + _def['dtypes'] = convert_dtypes(mdtypes_template, _bytecode) + _def['classes'] = convert_dtypes(mclass_dtypes_template, _bytecode) + _def['codecs'] = _convert_codecs(codecs_template, _bytecode) + MDTYPES[_bytecode] = _def + + class mat_struct(object): ''' Placeholder for holding read data from structs Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:02 UTC (rev 6861) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:10 UTC (rev 6862) @@ -135,8 +135,6 @@ cdef PyObject* dtypes[_N_MIS] # pointers to stuff in preader.class_dtypes cdef PyObject* class_dtypes[_N_MXS] - # necessary to keep memory alive for .dtypes, .class_dtypes - cdef object preader # cached here for convenience in later array creation cdef cnp.dtype U1_dtype cdef cnp.dtype bool_dtype @@ -145,9 +143,22 @@ int mat_dtype int squeeze_me int chars_as_strings - + + """ Initialize from file reader object + + preader needs the following fields defined: + + * mat_stream (file-like) + * byte_order (str) + * uint16_codec (str) + * struct_as_record (bool) + * chars_as_strings (bool) + * mat_dtype (bool) + * squeeze_me (bool) + """ def __new__(self, preader): - self.is_swapped = preader.byte_order == swapped_code + byte_order = preader.byte_order + self.is_swapped = byte_order == swapped_code if self.is_swapped: self.little_endian = not sys_is_le else: @@ -155,24 +166,27 @@ # option affecting reading of matlab struct arrays self.struct_as_record = preader.struct_as_record # store codecs for text matrix reading - self.codecs = preader.codecs + self.codecs = mio5p.MDTYPES[byte_order]['codecs'].copy() self.uint16_codec = preader.uint16_codec + uint16_codec = self.uint16_codec + # Set length of miUINT16 char encoding + self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ + - len(" ".encode(uint16_codec)) + self.codecs['uint16_codec'] = uint16_codec # set c-optimized stream object from python file-like object self.set_stream(preader.mat_stream) # options for element processing self.mat_dtype = preader.mat_dtype self.chars_as_strings = preader.chars_as_strings self.squeeze_me = preader.squeeze_me - # copy refs to dtypes into object pointer array. Store preader - # to keep preader.dtypes, class_dtypes alive. We only need the + # copy refs to dtypes into object pointer array. We only need the # integer-keyed dtypes - self.preader = preader - for key, dt in preader.dtypes.items(): + for key, dt in mio5p.MDTYPES[byte_order]['dtypes'].items(): if isinstance(key, str): continue self.dtypes[key] = dt # copy refs to class_dtypes into object pointer array - for key, dt in preader.class_dtypes.items(): + for key, dt in mio5p.MDTYPES[byte_order]['classes'].items(): if isinstance(key, str): continue self.class_dtypes[key] = dt Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:02 UTC (rev 6861) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:10 UTC (rev 6862) @@ -20,8 +20,7 @@ import scipy.io.matlab.byteordercodes as boc import scipy.io.matlab.streams as streams -import scipy.io.matlab.miobase as miob -import scipy.io.matlab.mio5 as mio5 +import scipy.io.matlab.mio5_params as mio5p import scipy.io.matlab.mio5_utils as m5u @@ -84,11 +83,8 @@ pass r = R() r.byte_order = boc.native_code - r.dtypes = {} - r.class_dtypes = {} - r.codecs = {} r.struct_as_record = True - r.uint16_codec = None + r.uint16_codec = sys.getdefaultencoding() r.chars_as_strings = False r.mat_dtype = False r.squeeze_me = False @@ -105,14 +101,14 @@ # This works for StringIO but _not_ cStringIO yield assert_raises, IOError, c_reader.read_tag # bad SDE - tag = _make_tag('i4', 1, mio5.miINT32, sde=True) + tag = _make_tag('i4', 1, mio5p.miINT32, sde=True) tag['byte_count'] = 5 _write_stream(str_io, tag.tostring()) yield assert_raises, ValueError, c_reader.read_tag def test_read_stream(): - tag = _make_tag('i4', 1, mio5.miINT32, sde=True) + tag = _make_tag('i4', 1, mio5p.miINT32, sde=True) tag_str = tag.tostring() str_io = cStringIO(tag_str) st = streams.make_stream(str_io) @@ -127,12 +123,12 @@ r.mat_stream = str_io # check simplest of tags for base_dt, val, mdtype in ( - ('u2', 30, mio5.miUINT16), - ('i4', 1, mio5.miINT32), - ('i2', -1, mio5.miINT16)): + ('u2', 30, mio5p.miUINT16), + ('i4', 1, mio5p.miINT32), + ('i2', -1, mio5p.miINT16)): for byte_code in ('<', '>'): r.byte_order = byte_code - r.dtypes = miob.convert_dtypes(mio5.mdtypes_template, byte_code) + r.dtypes = mio5p.MDTYPES[byte_code]['dtypes'] c_reader = m5u.VarReader5(r) yield assert_equal, c_reader.little_endian, byte_code == '<' yield assert_equal, c_reader.is_swapped, byte_code != boc.native_code @@ -149,22 +145,22 @@ yield assert_equal, el, val el = c_reader.read_numeric() yield assert_equal, el, val - + def test_read_numeric_writeable(): # make reader-like thing str_io = cStringIO() r = _make_readerlike() r.mat_stream = str_io r.byte_order = '<' - r.dtypes = miob.convert_dtypes(mio5.mdtypes_template, '<') c_reader = m5u.VarReader5(r) dt = np.dtype(' Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:16 -0600 (Thu, 11 Nov 2010) New Revision: 6863 Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py Log: RF - small refactoring of tests to reflect refactoring of mio5 and friends Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:10 UTC (rev 6862) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:16 UTC (rev 6863) @@ -78,11 +78,12 @@ stream.seek(0) -def _make_readerlike(): +def _make_readerlike(stream, byte_order=boc.native_code): class R(object): pass r = R() - r.byte_order = boc.native_code + r.mat_stream = stream + r.byte_order = byte_order r.struct_as_record = True r.uint16_codec = sys.getdefaultencoding() r.chars_as_strings = False @@ -95,8 +96,7 @@ # mainly to test errors # make reader-like thing str_io = BytesIO() - r = _make_readerlike() - r.mat_stream = str_io + r = _make_readerlike(str_io) c_reader = m5u.VarReader5(r) # This works for StringIO but _not_ cStringIO yield assert_raises, IOError, c_reader.read_tag @@ -119,8 +119,7 @@ def test_read_numeric(): # make reader-like thing str_io = cStringIO() - r = _make_readerlike() - r.mat_stream = str_io + r = _make_readerlike(str_io) # check simplest of tags for base_dt, val, mdtype in ( ('u2', 30, mio5p.miUINT16), @@ -128,7 +127,6 @@ ('i2', -1, mio5p.miINT16)): for byte_code in ('<', '>'): r.byte_order = byte_code - r.dtypes = mio5p.MDTYPES[byte_code]['dtypes'] c_reader = m5u.VarReader5(r) yield assert_equal, c_reader.little_endian, byte_code == '<' yield assert_equal, c_reader.is_swapped, byte_code != boc.native_code @@ -150,9 +148,7 @@ def test_read_numeric_writeable(): # make reader-like thing str_io = cStringIO() - r = _make_readerlike() - r.mat_stream = str_io - r.byte_order = '<' + r = _make_readerlike(str_io, '<') c_reader = m5u.VarReader5(r) dt = np.dtype(' Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:23 -0600 (Thu, 11 Nov 2010) New Revision: 6864 Modified: trunk/scipy/io/matlab/mio5_utils.pyx trunk/scipy/io/matlab/tests/test_mio5_utils.py Log: TEST: added test for zero bytes char read Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:16 UTC (rev 6863) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:23 UTC (rev 6864) @@ -124,7 +124,17 @@ cdef public int is_global cdef size_t nzmax + def set_dims(self, dims): + """ Allow setting of dimensions from python + This is for constructing headers for tests + """ + self.dims = dims + self.n_dims = len(dims) + for i, dim in enumerate(dims): + self.dims_ptr[i] = int(dim) + + cdef class VarReader5: cdef public int is_swapped, little_endian cdef int struct_as_record @@ -571,6 +581,7 @@ ''' # calculate number of items in array from dims product cdef size_t size = 1 + cdef int i for i in range(header.n_dims): size *= header.dims_ptr[i] return size Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:16 UTC (rev 6863) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:56:23 UTC (rev 6864) @@ -158,5 +158,35 @@ yield assert_true, el.flags.writeable +def test_zero_byte_string(): + # Tests hack to allow chars of non-zero length, but 0 bytes + # make reader-like thing + str_io = cStringIO() + r = _make_readerlike(str_io, '<') + c_reader = m5u.VarReader5(r) + tag_dt = np.dtype([('mdtype', 'u4'), ('byte_count', 'u4')]) + tag = np.zeros((1,), dtype=tag_dt) + tag['mdtype'] = mio5p.miINT8 + tag['byte_count'] = 1 + hdr = m5u.VarHeader5() + # Try when string is 1 length + hdr.set_dims([1,]) + _write_stream(str_io, tag.tostring() + ' ') + str_io.seek(0) + val = c_reader.read_char(hdr) + assert_equal(val, u' ') + # Now when string has 0 bytes 1 length + tag['byte_count'] = 0 + _write_stream(str_io, tag.tostring()) + str_io.seek(0) + val = c_reader.read_char(hdr) + assert_equal(val, u' ') + # Now when string has 0 bytes 4 length + str_io.seek(0) + hdr.set_dims([4,]) + val = c_reader.read_char(hdr) + assert_array_equal(val, [u' '] * 4) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Thu Nov 11 19:56:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:29 -0600 (CST) Subject: [Scipy-svn] r6865 - in trunk/scipy/io/matlab/tests: . data Message-ID: <20101112005629.8C46A32361@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:28 -0600 (Thu, 11 Nov 2010) New Revision: 6865 Added: trunk/scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat trunk/scipy/io/matlab/tests/test_pathological.py Log: TEST - failing test for duplicate fieldnames Added: trunk/scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat =================================================================== --- trunk/scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat (rev 0) +++ trunk/scipy/io/matlab/tests/data/nasty_duplicate_fieldnames.mat 2010-11-12 00:56:28 UTC (rev 6865) @@ -0,0 +1,9 @@ +MATLAB 5.0 MAT-file, Platform: PCWIN, Created on: Mon Oct 04 09:42:29 2010 IM`SummaryTop_QMiddle_QBottom_QLeft_QRight_QTotal_QDepthCellsTrackMean_VelBoat_VelStation_QStation_QStation_QStation_QTrack_ReferenceUnits@" @" @" @" @" @" @" ??????j??? Zd??????? ???@?????$??@?$???????@??????(??@5^@` @?A`@??K@@^? @?Z @?Z @?? @@? +@`b +@??S @?? @`7? @ ?G +@?G?@??@??t@ X9@@?@??n@ -?@`??@?@@" @@@????@@@@ @&@.@2@4@7@9@;@<@=@=@=@<@<@;@:@6@5@5@5@5@6@6@6@6@P" `?t??/? @ l@?k@?#@V'@X?+@??0@ C\2@ ??4@?R7@`??9@?8<@@f?>@s?@@??A@`??B@`(D@ ?`E@??F@?f?G@?v?H@??J@`?.K@?LL@? cM@?}uN@?j?O@??FP@???P@ ?FQ@?"?Q@@[=R@?=?R@`????????@&S??`????????N@???vO???@????%????Di???h? +????????????`=j ??'o#????&??x *???-??!?0? Eg2? 04???6?`??7???9?@x;?@Jj=? ?n?? ?@????A?`?B????C?? E?P" @?0??`iY?? P???@???? ?,???q&??@????w???`??????????$??` +?????-?????????@X????&???@?????v??`?9??`???? o??? .????b???`????`????p???????? i????m??S????A????"???8??`u?????-????A??@_i???O??????????4??`(???@ +:??@(???@k????(??????`?Z??????????@?t??@O +??@?q???????`????`o???G????*??? 1N??@ o??`z ??@?Q??`?Y????q????R???????`V???????p" @`?t????E???????????? ?G? X9??O??????@#J?`??? ???@??@{??k ?`??? ?F???m???U????? ??@?????????A??,??`???Mb??'??????-???A`??M??@? +???!????????`????????Y???`vOn?@????Q???????@?U?? ?D???Pk???????):??@*?S???F??Mbp?@*?c?@*?3??t?X?@*?C??Mb???{??Q?~??????t?x????o??N@???R? Q?k?`?L??????*???Mb???b???6Z????`vO~????????6z??R?@?zd?@?}m?@?zd???6Z?@*????+ei???6z??O??@" @" @" @" @" ????????????????????????????????????????????????????????????????????8?Top_QMiddle_QBottom_QLeft_QRight_QTotal_QDepthCellsTrackMean_VelBoat_VelStation_QTrack_Reference8m3/s8m3/s8m3/s8m3/s8m3/s8m3/s8m08m8m/s8m/s8m3/s0 \ No newline at end of file Added: trunk/scipy/io/matlab/tests/test_pathological.py =================================================================== --- trunk/scipy/io/matlab/tests/test_pathological.py (rev 0) +++ trunk/scipy/io/matlab/tests/test_pathological.py 2010-11-12 00:56:28 UTC (rev 6865) @@ -0,0 +1,31 @@ +""" Test reading of files not conforming to matlab specification + +We try and read any file that matlab reads, these files included +""" +from os.path import dirname, join as pjoin +import sys + +if sys.version_info[0] >= 3: + from io import BytesIO + cStringIO = BytesIO +else: + from cStringIO import StringIO as cStringIO + from StringIO import StringIO as BytesIO + +import numpy as np + +from nose.tools import assert_true, assert_false, \ + assert_equal, assert_raises + +from numpy.testing import assert_array_equal, assert_array_almost_equal, \ + run_module_suite + +from scipy.io.matlab.mio import loadmat + +TEST_DATA_PATH = pjoin(dirname(__file__), 'data') + +def test_multiple_fieldnames(): + # Example provided by Dharhas Pothina + # Extracted using mio5.varmats_from_mat + multi_fname = pjoin(TEST_DATA_PATH, 'nasty_duplicate_fieldnames.mat') + vars = loadmat(multi_fname) From scipy-svn at scipy.org Thu Nov 11 19:56:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:41 -0600 (CST) Subject: [Scipy-svn] r6866 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005641.B307532350@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:41 -0600 (Thu, 11 Nov 2010) New Revision: 6866 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/mio5_utils.c trunk/scipy/io/matlab/mio5_utils.pyx trunk/scipy/io/matlab/tests/test_mio.py trunk/scipy/io/matlab/tests/test_pathological.py Log: NF - duplicate fieldnames as hidden feature, with tests Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:28 UTC (rev 6865) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:41 UTC (rev 6866) @@ -270,6 +270,12 @@ while not self.end_of_stream(): hdr, next_position = self.read_var_header() name = asstr(hdr.name) + if name in mdict: + warnings.warn('Duplicate variable name "%s" in stream' + ' - replacing previous with new\n' + 'Consider mio5.varmats_from_mat to split ' + 'file into single variable files' % name, + UserWarning, stacklevel=2) if name == '': # can only be a matlab 7 function workspace name = '__function_workspace__' Modified: trunk/scipy/io/matlab/mio5_utils.c =================================================================== --- trunk/scipy/io/matlab/mio5_utils.c 2010-11-12 00:56:28 UTC (rev 6865) +++ trunk/scipy/io/matlab/mio5_utils.c 2010-11-12 00:56:41 UTC (rev 6866) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.13 on Sat Sep 11 22:32:56 2010 */ +/* Generated by Cython 0.13 on Mon Oct 11 20:27:08 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -196,9 +196,10 @@ #endif #include #define __PYX_HAVE_API__scipy__io__matlab__mio5_utils +#include "stdlib.h" +#include "string.h" #include "stdio.h" #include "pythread.h" -#include "stdlib.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" #include "numpy_rephrasing.h" @@ -372,7 +373,7 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/streams.pxd":6 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":6 * cdef object fobj * * cpdef int seek(self, long int offset, int whence=*) except -1 # <<<<<<<<<<<<<< @@ -385,7 +386,7 @@ int whence; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/streams.pxd":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":9 * cpdef long int tell(self) except -1 * cdef int read_into(self, void *buf, size_t n) except -1 * cdef object read_string(self, size_t n, void **pp, int copy=*) # <<<<<<<<<<<<<< @@ -398,7 +399,7 @@ int copy; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":65 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":68 * * * cdef enum: # <<<<<<<<<<<<<< @@ -424,7 +425,7 @@ __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUTF32 = 18 }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":82 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":85 * miUTF32 = 18 * * cdef enum: # see comments in mio5_params # <<<<<<<<<<<<<< @@ -453,7 +454,7 @@ __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOBJECT_CLASS_FROM_MATRIX_H = 18 }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":289 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":316 * return 1 * * cdef object read_element(self, # <<<<<<<<<<<<<< @@ -466,7 +467,7 @@ int copy; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":385 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":412 * return 0 * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -479,7 +480,7 @@ int copy; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":564 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":592 * return size * * cdef read_mi_matrix(self, int process=1): # <<<<<<<<<<<<<< @@ -492,7 +493,7 @@ int process; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":596 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":624 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -505,7 +506,7 @@ int process; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/streams.pxd":3 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -519,7 +520,7 @@ PyObject *fobj; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":116 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":119 * * * cdef class VarHeader5: # <<<<<<<<<<<<<< @@ -540,7 +541,7 @@ size_t nzmax; }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":128 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":141 * * * cdef class VarReader5: # <<<<<<<<<<<<<< @@ -559,7 +560,6 @@ struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *cstream; PyObject *dtypes[20]; PyObject *class_dtypes[20]; - PyObject *preader; PyArray_Descr *U1_dtype; PyArray_Descr *bool_dtype; int mat_dtype; @@ -568,7 +568,7 @@ }; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/streams.pxd":3 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -585,7 +585,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":128 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":141 * * * cdef class VarReader5: # <<<<<<<<<<<<<< @@ -836,6 +836,8 @@ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_uint32(npy_uint32); +static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject *); + static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_int32(npy_int32); @@ -968,6 +970,10 @@ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from libc.stdlib */ + +/* Module declarations from libc.string */ + /* Module declarations from cpython.version */ /* Module declarations from cpython.ref */ @@ -1041,8 +1047,6 @@ /* Module declarations from cpython */ -/* Module declarations from libc.stdlib */ - /* Module declarations from numpy */ /* Module declarations from numpy */ @@ -1075,48 +1079,53 @@ int __pyx_module_is_main_scipy__io__matlab__mio5_utils = 0; /* Implementation of scipy.io.matlab.mio5_utils */ +static PyObject *__pyx_builtin_enumerate; static PyObject *__pyx_builtin_ValueError; static PyObject *__pyx_builtin_TypeError; static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_object; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "> 8 & 0xff00u)) | * (u4 >> 24)) # <<<<<<<<<<<<<< @@ -1447,7 +1473,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":112 * * * cpdef cnp.uint32_t byteswap_u4(cnp.uint32_t u4): # <<<<<<<<<<<<<< @@ -1463,7 +1489,7 @@ __Pyx_RefNannySetupContext("byteswap_u4"); __pyx_self = __pyx_self; assert(__pyx_arg_u4); { - __pyx_v_u4 = __Pyx_PyInt_from_py_npy_uint32(__pyx_arg_u4); if (unlikely((__pyx_v_u4 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_u4 = __Pyx_PyInt_from_py_npy_uint32(__pyx_arg_u4); if (unlikely((__pyx_v_u4 == (npy_uint32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } goto __pyx_L4_argument_unpacking_done; __pyx_L3_error:; @@ -1472,7 +1498,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4(__pyx_v_u4, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4(__pyx_v_u4, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1490,7 +1516,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":117 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":120 * * cdef class VarHeader5: * cdef readonly object name # <<<<<<<<<<<<<< @@ -1514,7 +1540,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":118 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":121 * cdef class VarHeader5: * cdef readonly object name * cdef readonly int mclass # <<<<<<<<<<<<<< @@ -1528,7 +1554,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->mclass); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->mclass); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1546,7 +1572,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":119 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":122 * cdef readonly object name * cdef readonly int mclass * cdef readonly object dims # <<<<<<<<<<<<<< @@ -1570,7 +1596,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":124 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":127 * cdef int is_complex * cdef int is_logical * cdef public int is_global # <<<<<<<<<<<<<< @@ -1584,7 +1610,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->is_global); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->is_global); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1607,7 +1633,7 @@ int __pyx_r; int __pyx_t_1; __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 127; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->is_global = __pyx_t_1; __pyx_r = 0; @@ -1620,8 +1646,138 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":129 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":130 + * cdef size_t nzmax * + * def set_dims(self, dims): # <<<<<<<<<<<<<< + * """ Allow setting of dimensions from python + * + */ + +static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarHeader5_set_dims(PyObject *__pyx_v_self, PyObject *__pyx_v_dims); /*proto*/ +static char __pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarHeader5_set_dims[] = " Allow setting of dimensions from python\n\n This is for constructing headers for tests\n "; +static PyObject *__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarHeader5_set_dims(PyObject *__pyx_v_self, PyObject *__pyx_v_dims) { + PyObject *__pyx_v_i; + PyObject *__pyx_v_dim; + PyObject *__pyx_r = NULL; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + __pyx_t_5numpy_int32_t __pyx_t_6; + Py_ssize_t __pyx_t_7; + __Pyx_RefNannySetupContext("set_dims"); + __pyx_v_i = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_dim = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":135 + * This is for constructing headers for tests + * """ + * self.dims = dims # <<<<<<<<<<<<<< + * self.n_dims = len(dims) + * for i, dim in enumerate(dims): + */ + __Pyx_INCREF(__pyx_v_dims); + __Pyx_GIVEREF(__pyx_v_dims); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->dims); + __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->dims); + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->dims = __pyx_v_dims; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":136 + * """ + * self.dims = dims + * self.n_dims = len(dims) # <<<<<<<<<<<<<< + * for i, dim in enumerate(dims): + * self.dims_ptr[i] = int(dim) + */ + __pyx_t_1 = PyObject_Length(__pyx_v_dims); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->n_dims = __pyx_t_1; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":137 + * self.dims = dims + * self.n_dims = len(dims) + * for i, dim in enumerate(dims): # <<<<<<<<<<<<<< + * self.dims_ptr[i] = int(dim) + * + */ + __Pyx_INCREF(__pyx_int_0); + __pyx_t_2 = __pyx_int_0; + if (PyList_CheckExact(__pyx_v_dims) || PyTuple_CheckExact(__pyx_v_dims)) { + __pyx_t_1 = 0; __pyx_t_3 = __pyx_v_dims; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_v_dims); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_4 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_4 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_4); __pyx_t_1++; + } else { + __pyx_t_4 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_4) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_4); + } + __Pyx_DECREF(__pyx_v_dim); + __pyx_v_dim = __pyx_t_4; + __pyx_t_4 = 0; + __Pyx_INCREF(__pyx_t_2); + __Pyx_DECREF(__pyx_v_i); + __pyx_v_i = __pyx_t_2; + __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); + __pyx_t_2 = __pyx_t_4; + __pyx_t_4 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":138 + * self.n_dims = len(dims) + * for i, dim in enumerate(dims): + * self.dims_ptr[i] = int(dim) # <<<<<<<<<<<<<< + * + * + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(__pyx_v_dim); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_dim); + __Pyx_GIVEREF(__pyx_v_dim); + __pyx_t_5 = PyObject_Call(((PyObject *)((PyObject*)&PyInt_Type)), __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_6 = __Pyx_PyInt_from_py_npy_int32(__pyx_t_5); if (unlikely((__pyx_t_6 == (npy_int32)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_7 = __Pyx_PyIndex_AsSsize_t(__pyx_v_i); if (unlikely((__pyx_t_7 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 138; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_self)->dims_ptr[__pyx_t_7]) = __pyx_t_6; + } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarHeader5.set_dims"); + __pyx_r = NULL; + __pyx_L0:; + __Pyx_DECREF(__pyx_v_i); + __Pyx_DECREF(__pyx_v_dim); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":142 + * * cdef class VarReader5: * cdef public int is_swapped, little_endian # <<<<<<<<<<<<<< * cdef int struct_as_record @@ -1634,7 +1790,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1657,7 +1813,7 @@ int __pyx_r; int __pyx_t_1; __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped = __pyx_t_1; __pyx_r = 0; @@ -1676,7 +1832,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("__get__"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -1699,7 +1855,7 @@ int __pyx_r; int __pyx_t_1; __Pyx_RefNannySetupContext("__set__"); - __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_AsInt(__pyx_v_value); if (unlikely((__pyx_t_1 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = __pyx_t_1; __pyx_r = 0; @@ -1712,30 +1868,32 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":149 - * int chars_as_strings - * +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":172 + * * squeeze_me (bool) + * """ * def __new__(self, preader): # <<<<<<<<<<<<<< - * self.is_swapped = preader.byte_order == swapped_code - * if self.is_swapped: + * byte_order = preader.byte_order + * self.is_swapped = byte_order == swapped_code */ static int __pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5___new__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_preader = 0; + PyObject *__pyx_v_byte_order; + PyObject *__pyx_v_uint16_codec; PyObject *__pyx_v_key; PyObject *__pyx_v_dt; PyObject *__pyx_v_bool_dtype; int __pyx_r; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; + int __pyx_t_3; int __pyx_t_4; - int __pyx_t_5; + PyObject *__pyx_t_5 = NULL; Py_ssize_t __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + Py_ssize_t __pyx_t_7; PyObject *__pyx_t_8 = NULL; - Py_ssize_t __pyx_t_9; + PyObject *__pyx_t_9 = NULL; static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__preader,0}; __Pyx_RefNannySetupContext("__cinit__"); if (unlikely(__pyx_kwds)) { @@ -1753,7 +1911,7 @@ else goto __pyx_L5_argtuple_error; } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__new__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__new__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_preader = values[0]; } else if (PyTuple_GET_SIZE(__pyx_args) != 1) { @@ -1763,270 +1921,367 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__new__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__new__", 1, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.__cinit__"); __Pyx_RefNannyFinishContext(); return -1; __pyx_L4_argument_unpacking_done:; + __pyx_v_byte_order = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_uint16_codec = Py_None; __Pyx_INCREF(Py_None); __pyx_v_key = Py_None; __Pyx_INCREF(Py_None); __pyx_v_dt = Py_None; __Pyx_INCREF(Py_None); __pyx_v_bool_dtype = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":150 - * + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":173 + * """ * def __new__(self, preader): - * self.is_swapped = preader.byte_order == swapped_code # <<<<<<<<<<<<<< + * byte_order = preader.byte_order # <<<<<<<<<<<<<< + * self.is_swapped = byte_order == swapped_code * if self.is_swapped: + */ + __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__byte_order); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_byte_order); + __pyx_v_byte_order = __pyx_t_1; + __pyx_t_1 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":174 + * def __new__(self, preader): + * byte_order = preader.byte_order + * self.is_swapped = byte_order == swapped_code # <<<<<<<<<<<<<< + * if self.is_swapped: * self.little_endian = not sys_is_le */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__byte_order); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__swapped_code); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__swapped_code); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_v_byte_order, __pyx_t_1, Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_t_2, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped = __pyx_t_4; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":151 - * def __new__(self, preader): - * self.is_swapped = preader.byte_order == swapped_code + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":175 + * byte_order = preader.byte_order + * self.is_swapped = byte_order == swapped_code * if self.is_swapped: # <<<<<<<<<<<<<< * self.little_endian = not sys_is_le * else: */ if (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":152 - * self.is_swapped = preader.byte_order == swapped_code + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":176 + * self.is_swapped = byte_order == swapped_code * if self.is_swapped: * self.little_endian = not sys_is_le # <<<<<<<<<<<<<< * else: * self.little_endian = sys_is_le */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = (!__pyx_t_5); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = (!__pyx_t_4); goto __pyx_L6; } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":154 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":178 * self.little_endian = not sys_is_le * else: * self.little_endian = sys_is_le # <<<<<<<<<<<<<< * # option affecting reading of matlab struct arrays * self.struct_as_record = preader.struct_as_record */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = __pyx_t_4; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian = __pyx_t_3; } __pyx_L6:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":156 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":180 * self.little_endian = sys_is_le * # option affecting reading of matlab struct arrays * self.struct_as_record = preader.struct_as_record # <<<<<<<<<<<<<< * # store codecs for text matrix reading - * self.codecs = preader.codecs + * self.codecs = mio5p.MDTYPES[byte_order]['codecs'].copy() */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__struct_as_record); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->struct_as_record = __pyx_t_4; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__struct_as_record); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->struct_as_record = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":158 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":182 * self.struct_as_record = preader.struct_as_record * # store codecs for text matrix reading - * self.codecs = preader.codecs # <<<<<<<<<<<<<< + * self.codecs = mio5p.MDTYPES[byte_order]['codecs'].copy() # <<<<<<<<<<<<<< * self.uint16_codec = preader.uint16_codec - * # set c-optimized stream object from python file-like object + * uint16_codec = self.uint16_codec */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__codecs); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MDTYPES); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetItem(__pyx_t_1, __pyx_v_byte_order); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__codecs)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs); __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs = __pyx_t_3; - __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":159 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":183 * # store codecs for text matrix reading - * self.codecs = preader.codecs + * self.codecs = mio5p.MDTYPES[byte_order]['codecs'].copy() * self.uint16_codec = preader.uint16_codec # <<<<<<<<<<<<<< - * # set c-optimized stream object from python file-like object - * self.set_stream(preader.mat_stream) + * uint16_codec = self.uint16_codec + * # Set length of miUINT16 char encoding */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__uint16_codec); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 159; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__uint16_codec); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec); __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec = __pyx_t_3; - __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":161 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":184 + * self.codecs = mio5p.MDTYPES[byte_order]['codecs'].copy() * self.uint16_codec = preader.uint16_codec + * uint16_codec = self.uint16_codec # <<<<<<<<<<<<<< + * # Set length of miUINT16 char encoding + * self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ + */ + __Pyx_INCREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec); + __Pyx_DECREF(__pyx_v_uint16_codec); + __pyx_v_uint16_codec = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->uint16_codec; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":186 + * uint16_codec = self.uint16_codec + * # Set length of miUINT16 char encoding + * self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ # <<<<<<<<<<<<<< + * - len(" ".encode(uint16_codec)) + * self.codecs['uint16_codec'] = uint16_codec + */ + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_1), __pyx_n_s__encode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_uint16_codec); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_uint16_codec); + __Pyx_GIVEREF(__pyx_v_uint16_codec); + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_6 = PyObject_Length(__pyx_t_5); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":187 + * # Set length of miUINT16 char encoding + * self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ + * - len(" ".encode(uint16_codec)) # <<<<<<<<<<<<<< + * self.codecs['uint16_codec'] = uint16_codec * # set c-optimized stream object from python file-like object + */ + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_kp_s_2), __pyx_n_s__encode); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_uint16_codec); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_uint16_codec); + __Pyx_GIVEREF(__pyx_v_uint16_codec); + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_7 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_7 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromSsize_t((__pyx_t_6 - __pyx_t_7)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":186 + * uint16_codec = self.uint16_codec + * # Set length of miUINT16 char encoding + * self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ # <<<<<<<<<<<<<< + * - len(" ".encode(uint16_codec)) + * self.codecs['uint16_codec'] = uint16_codec + */ + if (PyObject_SetItem(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs, ((PyObject *)__pyx_n_s__uint16_len), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":188 + * self.codecs['uint16_len'] = len(" ".encode(uint16_codec)) \ + * - len(" ".encode(uint16_codec)) + * self.codecs['uint16_codec'] = uint16_codec # <<<<<<<<<<<<<< + * # set c-optimized stream object from python file-like object + * self.set_stream(preader.mat_stream) + */ + if (PyObject_SetItem(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->codecs, ((PyObject *)__pyx_n_s__uint16_codec), __pyx_v_uint16_codec) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":190 + * self.codecs['uint16_codec'] = uint16_codec + * # set c-optimized stream object from python file-like object * self.set_stream(preader.mat_stream) # <<<<<<<<<<<<<< * # options for element processing * self.mat_dtype = preader.mat_dtype */ - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__set_stream); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__set_stream); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_stream); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":163 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":192 * self.set_stream(preader.mat_stream) * # options for element processing * self.mat_dtype = preader.mat_dtype # <<<<<<<<<<<<<< * self.chars_as_strings = preader.chars_as_strings * self.squeeze_me = preader.squeeze_me */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__mat_dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->mat_dtype = __pyx_t_4; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->mat_dtype = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":164 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":193 * # options for element processing * self.mat_dtype = preader.mat_dtype * self.chars_as_strings = preader.chars_as_strings # <<<<<<<<<<<<<< * self.squeeze_me = preader.squeeze_me - * # copy refs to dtypes into object pointer array. Store preader + * # copy refs to dtypes into object pointer array. We only need the */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__chars_as_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__chars_as_strings); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 193; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->chars_as_strings = __pyx_t_4; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->chars_as_strings = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":165 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":194 * self.mat_dtype = preader.mat_dtype * self.chars_as_strings = preader.chars_as_strings * self.squeeze_me = preader.squeeze_me # <<<<<<<<<<<<<< - * # copy refs to dtypes into object pointer array. Store preader - * # to keep preader.dtypes, class_dtypes alive. We only need the + * # copy refs to dtypes into object pointer array. We only need the + * # integer-keyed dtypes */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__squeeze_me); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__squeeze_me); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 165; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_3 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->squeeze_me = __pyx_t_4; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->squeeze_me = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":169 - * # to keep preader.dtypes, class_dtypes alive. We only need the + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":197 + * # copy refs to dtypes into object pointer array. We only need the * # integer-keyed dtypes - * self.preader = preader # <<<<<<<<<<<<<< - * for key, dt in preader.dtypes.items(): + * for key, dt in mio5p.MDTYPES[byte_order]['dtypes'].items(): # <<<<<<<<<<<<<< * if isinstance(key, str): - */ - __Pyx_INCREF(__pyx_v_preader); - __Pyx_GIVEREF(__pyx_v_preader); - __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->preader); - __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->preader); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->preader = __pyx_v_preader; - - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":170 - * # integer-keyed dtypes - * self.preader = preader - * for key, dt in preader.dtypes.items(): # <<<<<<<<<<<<<< - * if isinstance(key, str): * continue */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__dtypes); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__items); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MDTYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_t_5, __pyx_v_byte_order); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { - __pyx_t_6 = 0; __pyx_t_1 = __pyx_t_2; __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtypes)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = 0; __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); } - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { - if (likely(PyList_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyList_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; - } else if (likely(PyTuple_CheckExact(__pyx_t_1))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_1)) break; - __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_1, __pyx_t_6); __Pyx_INCREF(__pyx_t_2); __pyx_t_6++; + if (likely(PyList_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; + } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; } else { - __pyx_t_2 = PyIter_Next(__pyx_t_1); - if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_2); + __Pyx_GOTREF(__pyx_t_5); } - if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { - PyObject* tuple = __pyx_t_2; - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - __pyx_t_7 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_8 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_dt = __pyx_t_8; + __pyx_t_8 = 0; } else { - __pyx_t_8 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_key = __pyx_t_1; + __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_dt = __pyx_t_8; + __pyx_t_8 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":171 - * self.preader = preader - * for key, dt in preader.dtypes.items(): + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":198 + * # integer-keyed dtypes + * for key, dt in mio5p.MDTYPES[byte_order]['dtypes'].items(): * if isinstance(key, str): # <<<<<<<<<<<<<< * continue * self.dtypes[key] = dt */ - __pyx_t_5 = PyString_Check(__pyx_v_key); - if (__pyx_t_5) { + __pyx_t_4 = PyString_Check(__pyx_v_key); + if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":172 - * for key, dt in preader.dtypes.items(): + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":199 + * for key, dt in mio5p.MDTYPES[byte_order]['dtypes'].items(): * if isinstance(key, str): * continue # <<<<<<<<<<<<<< * self.dtypes[key] = dt @@ -2037,97 +2292,106 @@ } __pyx_L9:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":173 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":200 * if isinstance(key, str): * continue * self.dtypes[key] = dt # <<<<<<<<<<<<<< * # copy refs to class_dtypes into object pointer array - * for key, dt in preader.class_dtypes.items(): + * for key, dt in mio5p.MDTYPES[byte_order]['classes'].items(): */ - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->dtypes[__pyx_t_9]) = ((PyObject *)__pyx_v_dt); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->dtypes[__pyx_t_6]) = ((PyObject *)__pyx_v_dt); __pyx_L7_continue:; } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":175 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":202 * self.dtypes[key] = dt * # copy refs to class_dtypes into object pointer array - * for key, dt in preader.class_dtypes.items(): # <<<<<<<<<<<<<< + * for key, dt in mio5p.MDTYPES[byte_order]['classes'].items(): # <<<<<<<<<<<<<< * if isinstance(key, str): * continue */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_preader, __pyx_n_s__class_dtypes); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MDTYPES); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { - __pyx_t_6 = 0; __pyx_t_2 = __pyx_t_1; __Pyx_INCREF(__pyx_t_2); + __pyx_t_2 = PyObject_GetItem(__pyx_t_5, __pyx_v_byte_order); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__classes)); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__items); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyList_CheckExact(__pyx_t_5) || PyTuple_CheckExact(__pyx_t_5)) { + __pyx_t_7 = 0; __pyx_t_2 = __pyx_t_5; __Pyx_INCREF(__pyx_t_2); } else { - __pyx_t_6 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = -1; __pyx_t_2 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); } - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; for (;;) { if (likely(PyList_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyList_GET_SIZE(__pyx_t_2)) break; - __pyx_t_1 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (__pyx_t_7 >= PyList_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyList_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; } else if (likely(PyTuple_CheckExact(__pyx_t_2))) { - if (__pyx_t_6 >= PyTuple_GET_SIZE(__pyx_t_2)) break; - __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_6); __Pyx_INCREF(__pyx_t_1); __pyx_t_6++; + if (__pyx_t_7 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_5 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_7); __Pyx_INCREF(__pyx_t_5); __pyx_t_7++; } else { - __pyx_t_1 = PyIter_Next(__pyx_t_2); - if (!__pyx_t_1) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyIter_Next(__pyx_t_2); + if (!__pyx_t_5) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } - __Pyx_GOTREF(__pyx_t_1); + __Pyx_GOTREF(__pyx_t_5); } - if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { - PyObject* tuple = __pyx_t_1; - __pyx_t_7 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_7); - __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_5) && likely(PyTuple_GET_SIZE(__pyx_t_5) == 2)) { + PyObject* tuple = __pyx_t_5; + __pyx_t_8 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_8); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_key = __pyx_t_8; + __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_dt = __pyx_t_1; + __pyx_t_1 = 0; } else { - __pyx_t_8 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetIter(__pyx_t_5); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_8 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_7 = __Pyx_UnpackItem(__pyx_t_8, 0); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_8, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - if (__Pyx_EndUnpack(__pyx_t_8, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 175; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (__Pyx_EndUnpack(__pyx_t_9, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_v_key); - __pyx_v_key = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_key = __pyx_t_8; + __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_dt); - __pyx_v_dt = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_dt = __pyx_t_1; + __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":176 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":203 * # copy refs to class_dtypes into object pointer array - * for key, dt in preader.class_dtypes.items(): + * for key, dt in mio5p.MDTYPES[byte_order]['classes'].items(): * if isinstance(key, str): # <<<<<<<<<<<<<< * continue * self.class_dtypes[key] = dt */ - __pyx_t_5 = PyString_Check(__pyx_v_key); - if (__pyx_t_5) { + __pyx_t_4 = PyString_Check(__pyx_v_key); + if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":177 - * for key, dt in preader.class_dtypes.items(): + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":204 + * for key, dt in mio5p.MDTYPES[byte_order]['classes'].items(): * if isinstance(key, str): * continue # <<<<<<<<<<<<<< * self.class_dtypes[key] = dt @@ -2138,20 +2402,20 @@ } __pyx_L12:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":178 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":205 * if isinstance(key, str): * continue * self.class_dtypes[key] = dt # <<<<<<<<<<<<<< * # cache correctly byte ordered dtypes * if self.little_endian: */ - __pyx_t_9 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_9 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->class_dtypes[__pyx_t_9]) = ((PyObject *)__pyx_v_dt); + __pyx_t_6 = __Pyx_PyIndex_AsSsize_t(__pyx_v_key); if (unlikely((__pyx_t_6 == (Py_ssize_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->class_dtypes[__pyx_t_6]) = ((PyObject *)__pyx_v_dt); __pyx_L10_continue:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":180 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":207 * self.class_dtypes[key] = dt * # cache correctly byte ordered dtypes * if self.little_endian: # <<<<<<<<<<<<<< @@ -2160,88 +2424,88 @@ */ if (((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->little_endian) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":181 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":208 * # cache correctly byte ordered dtypes * if self.little_endian: * self.U1_dtype = np.dtype('U1') */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__dtype); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 181; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_3); + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype); __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype)); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_3); - __pyx_t_3 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L13; } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":183 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":210 * self.U1_dtype = np.dtype('U1') # <<<<<<<<<<<<<< * bool_dtype = np.dtype('bool') * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_2)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); - __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 183; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GIVEREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GIVEREF(__pyx_t_5); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype); __Pyx_DECREF(((PyObject *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype)); - ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_1); - __pyx_t_1 = 0; + ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->U1_dtype = ((PyArray_Descr *)__pyx_t_5); + __pyx_t_5 = 0; } __pyx_L13:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":184 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":211 * else: * self.U1_dtype = np.dtype('>U1') * bool_dtype = np.dtype('bool') # <<<<<<<<<<<<<< * * def set_stream(self, fobj): */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__dtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_n_s__bool)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__bool)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_n_s__bool)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__bool)); - __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_bool_dtype); __pyx_v_bool_dtype = __pyx_t_2; __pyx_t_2 = 0; @@ -2251,12 +2515,14 @@ __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.__cinit__"); __pyx_r = -1; __pyx_L0:; + __Pyx_DECREF(__pyx_v_byte_order); + __Pyx_DECREF(__pyx_v_uint16_codec); __Pyx_DECREF(__pyx_v_key); __Pyx_DECREF(__pyx_v_dt); __Pyx_DECREF(__pyx_v_bool_dtype); @@ -2264,7 +2530,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":186 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":213 * bool_dtype = np.dtype('bool') * * def set_stream(self, fobj): # <<<<<<<<<<<<<< @@ -2279,14 +2545,14 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("set_stream"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":191 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":218 * Called from Python when initiating a variable read * ''' * self.cstream = streams.make_stream(fobj) # <<<<<<<<<<<<<< * * def read_tag(self): */ - __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_7streams_make_stream(__pyx_v_fobj, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_7streams_make_stream(__pyx_v_fobj, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->cstream); @@ -2306,7 +2572,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":193 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":220 * self.cstream = streams.make_stream(fobj) * * def read_tag(self): # <<<<<<<<<<<<<< @@ -2330,7 +2596,7 @@ PyObject *__pyx_t_5 = NULL; __Pyx_RefNannySetupContext("read_tag"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":214 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":241 * cdef char tag_ptr[4] * cdef int tag_res * cdef object tag_data = None # <<<<<<<<<<<<<< @@ -2340,17 +2606,17 @@ __Pyx_INCREF(Py_None); __pyx_v_tag_data = Py_None; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":215 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":242 * cdef int tag_res * cdef object tag_data = None * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) # <<<<<<<<<<<<<< * if tag_res == 2: # sde format * tag_data = tag_ptr[:byte_count] */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count), __pyx_v_tag_ptr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count), __pyx_v_tag_ptr); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 242; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tag_res = __pyx_t_1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":216 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":243 * cdef object tag_data = None * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) * if tag_res == 2: # sde format # <<<<<<<<<<<<<< @@ -2360,14 +2626,14 @@ __pyx_t_2 = (__pyx_v_tag_res == 2); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":217 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":244 * tag_res = self.cread_tag(&mdtype, &byte_count, tag_ptr) * if tag_res == 2: # sde format * tag_data = tag_ptr[:byte_count] # <<<<<<<<<<<<<< * return (mdtype, byte_count, tag_data) * */ - __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_tag_ptr + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyBytes_FromStringAndSize(__pyx_v_tag_ptr + 0, __pyx_v_byte_count - 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_v_tag_data); __pyx_v_tag_data = ((PyObject *)__pyx_t_3); @@ -2376,7 +2642,7 @@ } __pyx_L5:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":218 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":245 * if tag_res == 2: # sde format * tag_data = tag_ptr[:byte_count] * return (mdtype, byte_count, tag_data) # <<<<<<<<<<<<<< @@ -2384,11 +2650,11 @@ * cdef int cread_tag(self, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 245; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -2418,7 +2684,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":220 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":247 * return (mdtype, byte_count, tag_data) * * cdef int cread_tag(self, # <<<<<<<<<<<<<< @@ -2439,7 +2705,7 @@ PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("cread_tag"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":235 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":262 * cdef cnp.uint16_t mdtype_sde, byte_count_sde * cdef cnp.uint32_t mdtype * cdef cnp.uint32_t* u4_ptr = data_ptr # <<<<<<<<<<<<<< @@ -2448,16 +2714,16 @@ */ __pyx_v_u4_ptr = ((__pyx_t_5numpy_uint32_t *)__pyx_v_data_ptr); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":263 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":290 * # first four bytes are two little-endian uint16 values, first * # ``mdtype`` and second ``byte_count``. * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * if self.is_swapped: * mdtype = byteswap_u4(u4s[0]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 263; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":264 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":291 * # ``mdtype`` and second ``byte_count``. * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< @@ -2466,7 +2732,7 @@ */ if (__pyx_v_self->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":265 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":292 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * mdtype = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -2478,7 +2744,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":267 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":294 * mdtype = byteswap_u4(u4s[0]) * else: * mdtype = u4s[0] # <<<<<<<<<<<<<< @@ -2489,7 +2755,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":270 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":297 * # The most significant two bytes of a U4 *mdtype* will always be * # 0, if they are not, this must be SDE format * byte_count_sde = mdtype >> 16 # <<<<<<<<<<<<<< @@ -2498,7 +2764,7 @@ */ __pyx_v_byte_count_sde = (__pyx_v_mdtype >> 16); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":271 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":298 * # 0, if they are not, this must be SDE format * byte_count_sde = mdtype >> 16 * if byte_count_sde: # small data element format # <<<<<<<<<<<<<< @@ -2507,7 +2773,7 @@ */ if (__pyx_v_byte_count_sde) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":272 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":299 * byte_count_sde = mdtype >> 16 * if byte_count_sde: # small data element format * mdtype_sde = mdtype & 0xffff # <<<<<<<<<<<<<< @@ -2516,7 +2782,7 @@ */ __pyx_v_mdtype_sde = (__pyx_v_mdtype & 0xffff); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":273 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":300 * if byte_count_sde: # small data element format * mdtype_sde = mdtype & 0xffff * if byte_count_sde > 4: # <<<<<<<<<<<<<< @@ -2526,26 +2792,26 @@ __pyx_t_2 = (__pyx_v_byte_count_sde > 4); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":274 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":301 * mdtype_sde = mdtype & 0xffff * if byte_count_sde > 4: * raise ValueError('Error in SDE format data') # <<<<<<<<<<<<<< * return -1 * u4_ptr[0] = u4s[1] */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":275 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":302 * if byte_count_sde > 4: * raise ValueError('Error in SDE format data') * return -1 # <<<<<<<<<<<<<< @@ -2558,7 +2824,7 @@ } __pyx_L5:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":276 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":303 * raise ValueError('Error in SDE format data') * return -1 * u4_ptr[0] = u4s[1] # <<<<<<<<<<<<<< @@ -2567,7 +2833,7 @@ */ (__pyx_v_u4_ptr[0]) = (__pyx_v_u4s[1]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":277 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":304 * return -1 * u4_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype_sde # <<<<<<<<<<<<<< @@ -2576,7 +2842,7 @@ */ (__pyx_v_mdtype_ptr[0]) = __pyx_v_mdtype_sde; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":278 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":305 * u4_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype_sde * byte_count_ptr[0] = byte_count_sde # <<<<<<<<<<<<<< @@ -2585,7 +2851,7 @@ */ (__pyx_v_byte_count_ptr[0]) = __pyx_v_byte_count_sde; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":279 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":306 * mdtype_ptr[0] = mdtype_sde * byte_count_ptr[0] = byte_count_sde * return 2 # <<<<<<<<<<<<<< @@ -2598,7 +2864,7 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":281 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":308 * return 2 * # regular element * if self.is_swapped: # <<<<<<<<<<<<<< @@ -2607,7 +2873,7 @@ */ if (__pyx_v_self->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":282 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":309 * # regular element * if self.is_swapped: * byte_count_ptr[0] = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -2619,7 +2885,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":284 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":311 * byte_count_ptr[0] = byteswap_u4(u4s[1]) * else: * byte_count_ptr[0] = u4s[1] # <<<<<<<<<<<<<< @@ -2630,7 +2896,7 @@ } __pyx_L6:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":285 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":312 * else: * byte_count_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype # <<<<<<<<<<<<<< @@ -2639,7 +2905,7 @@ */ (__pyx_v_mdtype_ptr[0]) = __pyx_v_mdtype; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":286 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":313 * byte_count_ptr[0] = u4s[1] * mdtype_ptr[0] = mdtype * u4_ptr[0] = 0 # <<<<<<<<<<<<<< @@ -2648,7 +2914,7 @@ */ (__pyx_v_u4_ptr[0]) = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":287 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":314 * mdtype_ptr[0] = mdtype * u4_ptr[0] = 0 * return 1 # <<<<<<<<<<<<<< @@ -2670,7 +2936,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":289 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":316 * return 1 * * cdef object read_element(self, # <<<<<<<<<<<<<< @@ -2680,7 +2946,7 @@ static PyObject *__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element(struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *__pyx_v_self, __pyx_t_5numpy_uint32_t *__pyx_v_mdtype_ptr, __pyx_t_5numpy_uint32_t *__pyx_v_byte_count_ptr, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element *__pyx_optional_args) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":293 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":320 * cnp.uint32_t *byte_count_ptr, * void **pp, * int copy=True): # <<<<<<<<<<<<<< @@ -2709,17 +2975,17 @@ } __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":329 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":356 * cdef int tag_res = self.cread_tag(mdtype_ptr, * byte_count_ptr, * tag_data) # <<<<<<<<<<<<<< * mdtype = mdtype_ptr[0] * byte_count = byte_count_ptr[0] */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, __pyx_v_tag_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 327; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, __pyx_v_tag_data); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 354; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_tag_res = __pyx_t_1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":330 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":357 * byte_count_ptr, * tag_data) * mdtype = mdtype_ptr[0] # <<<<<<<<<<<<<< @@ -2728,7 +2994,7 @@ */ __pyx_v_mdtype = (__pyx_v_mdtype_ptr[0]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":331 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":358 * tag_data) * mdtype = mdtype_ptr[0] * byte_count = byte_count_ptr[0] # <<<<<<<<<<<<<< @@ -2737,7 +3003,7 @@ */ __pyx_v_byte_count = (__pyx_v_byte_count_ptr[0]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":332 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":359 * mdtype = mdtype_ptr[0] * byte_count = byte_count_ptr[0] * if tag_res == 1: # full format # <<<<<<<<<<<<<< @@ -2747,7 +3013,7 @@ __pyx_t_2 = (__pyx_v_tag_res == 1); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":336 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":363 * byte_count, * pp, * copy) # <<<<<<<<<<<<<< @@ -2756,13 +3022,13 @@ */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = __pyx_v_copy; - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_string(__pyx_v_self->cstream, __pyx_v_byte_count, __pyx_v_pp, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 333; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_string(__pyx_v_self->cstream, __pyx_v_byte_count, __pyx_v_pp, &__pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 360; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":338 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":365 * copy) * # Seek to next 64-bit boundary * mod8 = byte_count % 8 # <<<<<<<<<<<<<< @@ -2771,7 +3037,7 @@ */ __pyx_v_mod8 = __Pyx_mod_long(__pyx_v_byte_count, 8); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":339 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":366 * # Seek to next 64-bit boundary * mod8 = byte_count % 8 * if mod8: # <<<<<<<<<<<<<< @@ -2780,7 +3046,7 @@ */ if (__pyx_v_mod8) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":340 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":367 * mod8 = byte_count % 8 * if mod8: * self.cstream.seek(8 - mod8, 1) # <<<<<<<<<<<<<< @@ -2789,7 +3055,7 @@ */ __pyx_t_5.__pyx_n = 1; __pyx_t_5.whence = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 340; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_5); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 367; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; @@ -2797,32 +3063,32 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":342 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":369 * self.cstream.seek(8 - mod8, 1) * else: # SDE format, make safer home for data * data = PyBytes_FromStringAndSize(tag_data, byte_count) # <<<<<<<<<<<<<< * pp[0] = data * return data */ - __pyx_t_3 = ((PyObject *)PyBytes_FromStringAndSize(__pyx_v_tag_data, __pyx_v_byte_count)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 342; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)PyBytes_FromStringAndSize(__pyx_v_tag_data, __pyx_v_byte_count)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 369; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":343 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":370 * else: # SDE format, make safer home for data * data = PyBytes_FromStringAndSize(tag_data, byte_count) * pp[0] = data # <<<<<<<<<<<<<< * return data * */ - __pyx_t_6 = PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 343; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 370; __pyx_clineno = __LINE__; goto __pyx_L1_error;} (__pyx_v_pp[0]) = __pyx_t_6; } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":344 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":371 * data = PyBytes_FromStringAndSize(tag_data, byte_count) * pp[0] = data * return data # <<<<<<<<<<<<<< @@ -2847,7 +3113,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":346 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":373 * return data * * cdef int read_element_into(self, # <<<<<<<<<<<<<< @@ -2865,17 +3131,17 @@ struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_3; __Pyx_RefNannySetupContext("read_element_into"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":375 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":402 * mdtype_ptr, * byte_count_ptr, * ptr) # <<<<<<<<<<<<<< * cdef cnp.uint32_t byte_count = byte_count_ptr[0] * if res == 1: # full format */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, ((char *)__pyx_v_ptr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 372; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_tag(__pyx_v_self, __pyx_v_mdtype_ptr, __pyx_v_byte_count_ptr, ((char *)__pyx_v_ptr)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 399; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":376 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":403 * byte_count_ptr, * ptr) * cdef cnp.uint32_t byte_count = byte_count_ptr[0] # <<<<<<<<<<<<<< @@ -2884,7 +3150,7 @@ */ __pyx_v_byte_count = (__pyx_v_byte_count_ptr[0]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":377 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":404 * ptr) * cdef cnp.uint32_t byte_count = byte_count_ptr[0] * if res == 1: # full format # <<<<<<<<<<<<<< @@ -2894,17 +3160,17 @@ __pyx_t_2 = (__pyx_v_res == 1); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":378 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":405 * cdef cnp.uint32_t byte_count = byte_count_ptr[0] * if res == 1: # full format * res = self.cstream.read_into(ptr, byte_count) # <<<<<<<<<<<<<< * # Seek to next 64-bit boundary * mod8 = byte_count % 8 */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, __pyx_v_ptr, __pyx_v_byte_count); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 378; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, __pyx_v_ptr, __pyx_v_byte_count); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":380 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":407 * res = self.cstream.read_into(ptr, byte_count) * # Seek to next 64-bit boundary * mod8 = byte_count % 8 # <<<<<<<<<<<<<< @@ -2913,7 +3179,7 @@ */ __pyx_v_mod8 = __Pyx_mod_long(__pyx_v_byte_count, 8); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":381 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":408 * # Seek to next 64-bit boundary * mod8 = byte_count % 8 * if mod8: # <<<<<<<<<<<<<< @@ -2922,7 +3188,7 @@ */ if (__pyx_v_mod8) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":382 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":409 * mod8 = byte_count % 8 * if mod8: * self.cstream.seek(8 - mod8, 1) # <<<<<<<<<<<<<< @@ -2931,7 +3197,7 @@ */ __pyx_t_3.__pyx_n = 1; __pyx_t_3.whence = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 382; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->seek(__pyx_v_self->cstream, (8 - __pyx_v_mod8), 0, &__pyx_t_3); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 409; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L4; } __pyx_L4:; @@ -2939,7 +3205,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":383 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":410 * if mod8: * self.cstream.seek(8 - mod8, 1) * return 0 # <<<<<<<<<<<<<< @@ -2959,7 +3225,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":385 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":412 * return 0 * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -2995,21 +3261,21 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_numeric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_numeric); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyInt_FromLong(__pyx_v_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_copy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3018,7 +3284,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":398 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":425 * cdef cnp.ndarray el * cdef object data = self.read_element( * &mdtype, &byte_count, &data_ptr, copy) # <<<<<<<<<<<<<< @@ -3027,12 +3293,12 @@ */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = __pyx_v_copy; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 397; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 424; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":399 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":426 * cdef object data = self.read_element( * &mdtype, &byte_count, &data_ptr, copy) * cdef cnp.dtype dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< @@ -3043,7 +3309,7 @@ __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_5))); __pyx_v_dt = ((PyArray_Descr *)__pyx_t_5); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":400 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":427 * &mdtype, &byte_count, &data_ptr, copy) * cdef cnp.dtype dt = self.dtypes[mdtype] * el_count = byte_count // dt.itemsize # <<<<<<<<<<<<<< @@ -3052,11 +3318,11 @@ */ if (unlikely(__pyx_v_dt->elsize == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 400; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 427; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_el_count = (__pyx_v_byte_count / __pyx_v_dt->elsize); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":401 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":428 * cdef cnp.dtype dt = self.dtypes[mdtype] * el_count = byte_count // dt.itemsize * cdef int flags = 0 # <<<<<<<<<<<<<< @@ -3065,7 +3331,7 @@ */ __pyx_v_flags = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":402 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":429 * el_count = byte_count // dt.itemsize * cdef int flags = 0 * if copy: # <<<<<<<<<<<<<< @@ -3074,7 +3340,7 @@ */ if (__pyx_v_copy) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":403 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":430 * cdef int flags = 0 * if copy: * flags = cnp.NPY_WRITEABLE # <<<<<<<<<<<<<< @@ -3086,7 +3352,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":404 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":431 * if copy: * flags = cnp.NPY_WRITEABLE * Py_INCREF( dt) # <<<<<<<<<<<<<< @@ -3095,20 +3361,20 @@ */ Py_INCREF(((PyObject *)__pyx_v_dt)); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":412 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":439 * data_ptr, * flags, * NULL) # <<<<<<<<<<<<<< * Py_INCREF( data) * PyArray_Set_BASE(el, data) */ - __pyx_t_1 = ((PyObject *)PyArray_NewFromDescr((&PyArray_Type), __pyx_v_dt, 1, (&__pyx_v_el_count), NULL, ((void *)__pyx_v_data_ptr), __pyx_v_flags, ((PyObject *)NULL))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)PyArray_NewFromDescr((&PyArray_Type), __pyx_v_dt, 1, (&__pyx_v_el_count), NULL, ((void *)__pyx_v_data_ptr), __pyx_v_flags, ((PyObject *)NULL))); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 432; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_el)); __pyx_v_el = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":413 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":440 * flags, * NULL) * Py_INCREF( data) # <<<<<<<<<<<<<< @@ -3117,7 +3383,7 @@ */ Py_INCREF(__pyx_v_data); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":414 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":441 * NULL) * Py_INCREF( data) * PyArray_Set_BASE(el, data) # <<<<<<<<<<<<<< @@ -3126,7 +3392,7 @@ */ PyArray_Set_BASE(__pyx_v_el, __pyx_v_data); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":415 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":442 * Py_INCREF( data) * PyArray_Set_BASE(el, data) * return el # <<<<<<<<<<<<<< @@ -3155,7 +3421,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":385 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":412 * return 0 * * cpdef inline cnp.ndarray read_numeric(self, int copy=True): # <<<<<<<<<<<<<< @@ -3188,24 +3454,24 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_numeric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "read_numeric") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } if (values[0]) { - __pyx_v_copy = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_copy = __Pyx_PyInt_AsInt(values[0]); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_copy = ((int)1); } } else { __pyx_v_copy = ((int)1); switch (PyTuple_GET_SIZE(__pyx_args)) { - case 1: __pyx_v_copy = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 1: __pyx_v_copy = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_copy == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 0: break; default: goto __pyx_L5_argtuple_error; } } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("read_numeric", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("read_numeric", 0, 0, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_numeric"); __Pyx_RefNannyFinishContext(); @@ -3214,7 +3480,7 @@ __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.copy = __pyx_v_copy; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_numeric(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 385; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_numeric(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 412; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -3232,7 +3498,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":417 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":444 * return el * * cdef inline object read_int8_string(self): # <<<<<<<<<<<<<< @@ -3252,20 +3518,20 @@ __Pyx_RefNannySetupContext("read_int8_string"); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":429 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":456 * void *ptr * object data * data = self.read_element(&mdtype, &byte_count, &ptr) # <<<<<<<<<<<<<< * if mdtype != miINT8: * raise TypeError('Expecting miINT8 as data type') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), (&__pyx_v_ptr), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), (&__pyx_v_ptr), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 456; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":430 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":457 * object data * data = self.read_element(&mdtype, &byte_count, &ptr) * if mdtype != miINT8: # <<<<<<<<<<<<<< @@ -3275,29 +3541,29 @@ __pyx_t_2 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":431 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":458 * data = self.read_element(&mdtype, &byte_count, &ptr) * if mdtype != miINT8: * raise TypeError('Expecting miINT8 as data type') # <<<<<<<<<<<<<< * return data * */ - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_4)); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_4)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_4)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":432 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":459 * if mdtype != miINT8: * raise TypeError('Expecting miINT8 as data type') * return data # <<<<<<<<<<<<<< @@ -3323,7 +3589,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":434 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":461 * return data * * cdef int read_into_int32s(self, cnp.int32_t *int32p) except -1: # <<<<<<<<<<<<<< @@ -3344,16 +3610,16 @@ int __pyx_t_5; __Pyx_RefNannySetupContext("read_into_int32s"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":451 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":478 * cnp.uint32_t mdtype, byte_count * int i * self.read_element_into(&mdtype, &byte_count, int32p) # <<<<<<<<<<<<<< * if mdtype != miINT32: * raise TypeError('Expecting miINT32 as data type') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element_into(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void *)__pyx_v_int32p)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 451; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element_into(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void *)__pyx_v_int32p)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":452 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":479 * int i * self.read_element_into(&mdtype, &byte_count, int32p) * if mdtype != miINT32: # <<<<<<<<<<<<<< @@ -3363,26 +3629,26 @@ __pyx_t_2 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT32); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":453 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":480 * self.read_element_into(&mdtype, &byte_count, int32p) * if mdtype != miINT32: * raise TypeError('Expecting miINT32 as data type') # <<<<<<<<<<<<<< * return -1 * cdef int n_ints = byte_count // 4 */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_5)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_5)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 453; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 480; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":454 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":481 * if mdtype != miINT32: * raise TypeError('Expecting miINT32 as data type') * return -1 # <<<<<<<<<<<<<< @@ -3395,7 +3661,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":455 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":482 * raise TypeError('Expecting miINT32 as data type') * return -1 * cdef int n_ints = byte_count // 4 # <<<<<<<<<<<<<< @@ -3404,7 +3670,7 @@ */ __pyx_v_n_ints = __Pyx_div_long(__pyx_v_byte_count, 4); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":456 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":483 * return -1 * cdef int n_ints = byte_count // 4 * if self.is_swapped: # <<<<<<<<<<<<<< @@ -3413,7 +3679,7 @@ */ if (__pyx_v_self->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":457 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":484 * cdef int n_ints = byte_count // 4 * if self.is_swapped: * for i in range(n_ints): # <<<<<<<<<<<<<< @@ -3424,7 +3690,7 @@ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_1; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":458 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":485 * if self.is_swapped: * for i in range(n_ints): * int32p[i] = byteswap_u4(int32p[i]) # <<<<<<<<<<<<<< @@ -3437,7 +3703,7 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":459 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":486 * for i in range(n_ints): * int32p[i] = byteswap_u4(int32p[i]) * return n_ints # <<<<<<<<<<<<<< @@ -3459,7 +3725,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":461 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":488 * return n_ints * * def read_full_tag(self): # <<<<<<<<<<<<<< @@ -3479,16 +3745,16 @@ PyObject *__pyx_t_4 = NULL; __Pyx_RefNannySetupContext("read_full_tag"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":478 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":505 * ''' * cdef cnp.uint32_t mdtype, byte_count * self.cread_full_tag(&mdtype, &byte_count) # <<<<<<<<<<<<<< * return mdtype, byte_count * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_full_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_full_tag(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_mdtype), (&__pyx_v_byte_count)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":479 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":506 * cdef cnp.uint32_t mdtype, byte_count * self.cread_full_tag(&mdtype, &byte_count) * return mdtype, byte_count # <<<<<<<<<<<<<< @@ -3496,11 +3762,11 @@ * cdef int cread_full_tag(self, */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_byte_count); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 479; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -3526,7 +3792,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":481 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":508 * return mdtype, byte_count * * cdef int cread_full_tag(self, # <<<<<<<<<<<<<< @@ -3540,16 +3806,16 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("cread_full_tag"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":486 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":513 * ''' C method for reading full u4, u4 tag from stream''' * cdef cnp.uint32_t u4s[2] * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * if self.is_swapped: * mdtype[0] = byteswap_u4(u4s[0]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":487 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":514 * cdef cnp.uint32_t u4s[2] * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< @@ -3558,7 +3824,7 @@ */ if (__pyx_v_self->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":488 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":515 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * mdtype[0] = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -3567,7 +3833,7 @@ */ (__pyx_v_mdtype[0]) = __pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4((__pyx_v_u4s[0]), 0); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":489 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":516 * if self.is_swapped: * mdtype[0] = byteswap_u4(u4s[0]) * byte_count[0] = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -3579,7 +3845,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":491 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":518 * byte_count[0] = byteswap_u4(u4s[1]) * else: * mdtype[0] = u4s[0] # <<<<<<<<<<<<<< @@ -3588,7 +3854,7 @@ */ (__pyx_v_mdtype[0]) = (__pyx_v_u4s[0]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":492 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":519 * else: * mdtype[0] = u4s[0] * byte_count[0] = u4s[1] # <<<<<<<<<<<<<< @@ -3599,7 +3865,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":493 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":520 * mdtype[0] = u4s[0] * byte_count[0] = u4s[1] * return 0 # <<<<<<<<<<<<<< @@ -3619,7 +3885,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":495 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":522 * return 0 * * cpdef VarHeader5 read_header(self): # <<<<<<<<<<<<<< @@ -3647,13 +3913,13 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_header)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3662,25 +3928,25 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":509 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":536 * VarHeader5 header * # Read and discard mdtype and byte_count * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * # get array flags and nzmax * self.cstream.read_into(u4s, 8) */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":511 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":538 * self.cstream.read_into(u4s, 8) * # get array flags and nzmax * self.cstream.read_into(u4s, 8) # <<<<<<<<<<<<<< * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self->cstream->__pyx_vtab)->read_into(__pyx_v_self->cstream, ((void *)__pyx_v_u4s), 8); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":512 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":539 * # get array flags and nzmax * self.cstream.read_into(u4s, 8) * if self.is_swapped: # <<<<<<<<<<<<<< @@ -3689,7 +3955,7 @@ */ if (__pyx_v_self->is_swapped) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":513 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":540 * self.cstream.read_into(u4s, 8) * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) # <<<<<<<<<<<<<< @@ -3698,7 +3964,7 @@ */ __pyx_v_flags_class = __pyx_f_5scipy_2io_6matlab_10mio5_utils_byteswap_u4((__pyx_v_u4s[0]), 0); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":514 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":541 * if self.is_swapped: * flags_class = byteswap_u4(u4s[0]) * nzmax = byteswap_u4(u4s[1]) # <<<<<<<<<<<<<< @@ -3710,7 +3976,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":516 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":543 * nzmax = byteswap_u4(u4s[1]) * else: * flags_class = u4s[0] # <<<<<<<<<<<<<< @@ -3719,7 +3985,7 @@ */ __pyx_v_flags_class = (__pyx_v_u4s[0]); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":517 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":544 * else: * flags_class = u4s[0] * nzmax = u4s[1] # <<<<<<<<<<<<<< @@ -3730,20 +3996,20 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":518 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":545 * flags_class = u4s[0] * nzmax = u4s[1] * header = VarHeader5() # <<<<<<<<<<<<<< * mc = flags_class & 0xFF * header.mclass = mc */ - __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5)), ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 545; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_header)); __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":519 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":546 * nzmax = u4s[1] * header = VarHeader5() * mc = flags_class & 0xFF # <<<<<<<<<<<<<< @@ -3752,7 +4018,7 @@ */ __pyx_v_mc = (__pyx_v_flags_class & 0xFF); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":520 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":547 * header = VarHeader5() * mc = flags_class & 0xFF * header.mclass = mc # <<<<<<<<<<<<<< @@ -3761,7 +4027,7 @@ */ __pyx_v_header->mclass = __pyx_v_mc; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":521 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":548 * mc = flags_class & 0xFF * header.mclass = mc * header.is_logical = flags_class >> 9 & 1 # <<<<<<<<<<<<<< @@ -3770,7 +4036,7 @@ */ __pyx_v_header->is_logical = ((__pyx_v_flags_class >> 9) & 1); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":522 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":549 * header.mclass = mc * header.is_logical = flags_class >> 9 & 1 * header.is_global = flags_class >> 10 & 1 # <<<<<<<<<<<<<< @@ -3779,7 +4045,7 @@ */ __pyx_v_header->is_global = ((__pyx_v_flags_class >> 10) & 1); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":523 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":550 * header.is_logical = flags_class >> 9 & 1 * header.is_global = flags_class >> 10 & 1 * header.is_complex = flags_class >> 11 & 1 # <<<<<<<<<<<<<< @@ -3788,7 +4054,7 @@ */ __pyx_v_header->is_complex = ((__pyx_v_flags_class >> 11) & 1); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":524 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":551 * header.is_global = flags_class >> 10 & 1 * header.is_complex = flags_class >> 11 & 1 * header.nzmax = nzmax # <<<<<<<<<<<<<< @@ -3797,7 +4063,7 @@ */ __pyx_v_header->nzmax = __pyx_v_nzmax; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":527 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":554 * # all miMATRIX types except the mxOPAQUE_CLASS have dims and a * # name. * if mc == mxOPAQUE_CLASS: # <<<<<<<<<<<<<< @@ -3807,7 +4073,7 @@ __pyx_t_4 = (__pyx_v_mc == __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOPAQUE_CLASS); if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":528 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":555 * # name. * if mc == mxOPAQUE_CLASS: * header.name = None # <<<<<<<<<<<<<< @@ -3820,7 +4086,7 @@ __Pyx_DECREF(__pyx_v_header->name); __pyx_v_header->name = Py_None; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":529 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":556 * if mc == mxOPAQUE_CLASS: * header.name = None * header.dims = None # <<<<<<<<<<<<<< @@ -3833,7 +4099,7 @@ __Pyx_DECREF(__pyx_v_header->dims); __pyx_v_header->dims = Py_None; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":530 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":557 * header.name = None * header.dims = None * return header # <<<<<<<<<<<<<< @@ -3848,17 +4114,17 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":531 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":558 * header.dims = None * return header * header.n_dims = self.read_into_int32s(header.dims_ptr) # <<<<<<<<<<<<<< * if header.n_dims > _MAT_MAXDIMS: * raise ValueError('Too many dimensions (%d) for numpy arrays' */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, __pyx_v_header->dims_ptr); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 531; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, __pyx_v_header->dims_ptr); if (unlikely(__pyx_t_3 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_header->n_dims = __pyx_t_3; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":532 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":559 * return header * header.n_dims = self.read_into_int32s(header.dims_ptr) * if header.n_dims > _MAT_MAXDIMS: # <<<<<<<<<<<<<< @@ -3868,41 +4134,41 @@ __pyx_t_4 = (__pyx_v_header->n_dims > 32); if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":534 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":561 * if header.n_dims > _MAT_MAXDIMS: * raise ValueError('Too many dimensions (%d) for numpy arrays' * % header.n_dims) # <<<<<<<<<<<<<< * # convert dims to list * header.dims = [] */ - __pyx_t_1 = PyInt_FromLong(__pyx_v_header->n_dims); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyInt_FromLong(__pyx_v_header->n_dims); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_6), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 534; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 561; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_2, 0, 0); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 533; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":536 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":563 * % header.n_dims) * # convert dims to list * header.dims = [] # <<<<<<<<<<<<<< * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 536; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __Pyx_GOTREF(__pyx_v_header->dims); @@ -3910,7 +4176,7 @@ __pyx_v_header->dims = ((PyObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":537 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":564 * # convert dims to list * header.dims = [] * for i in range(header.n_dims): # <<<<<<<<<<<<<< @@ -3921,29 +4187,29 @@ for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_3; __pyx_t_5+=1) { __pyx_v_i = __pyx_t_5; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":538 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":565 * header.dims = [] * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) # <<<<<<<<<<<<<< * header.name = self.read_int8_string() * return header */ - __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32((__pyx_v_header->dims_ptr[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_to_py_npy_int32((__pyx_v_header->dims_ptr[__pyx_v_i])); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_header->dims, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 538; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyObject_Append(__pyx_v_header->dims, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":539 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":566 * for i in range(header.n_dims): * header.dims.append(header.dims_ptr[i]) * header.name = self.read_int8_string() # <<<<<<<<<<<<<< * return header * */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 539; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 566; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __Pyx_GOTREF(__pyx_v_header->name); @@ -3951,7 +4217,7 @@ __pyx_v_header->name = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":540 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":567 * header.dims.append(header.dims_ptr[i]) * header.name = self.read_int8_string() * return header # <<<<<<<<<<<<<< @@ -3977,7 +4243,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":495 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":522 * return 0 * * cpdef VarHeader5 read_header(self): # <<<<<<<<<<<<<< @@ -3992,7 +4258,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_header"); __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -4010,7 +4276,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":542 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":569 * return header * * cdef inline size_t size_from_header(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -4026,18 +4292,18 @@ int __pyx_t_2; __Pyx_RefNannySetupContext("size_from_header"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":559 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":586 * ''' * # calculate number of items in array from dims product * cdef size_t size = 1 # <<<<<<<<<<<<<< + * cdef int i * for i in range(header.n_dims): - * size *= header.dims_ptr[i] */ __pyx_v_size = 1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":560 - * # calculate number of items in array from dims product + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":588 * cdef size_t size = 1 + * cdef int i * for i in range(header.n_dims): # <<<<<<<<<<<<<< * size *= header.dims_ptr[i] * return size @@ -4046,8 +4312,8 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":561 - * cdef size_t size = 1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":589 + * cdef int i * for i in range(header.n_dims): * size *= header.dims_ptr[i] # <<<<<<<<<<<<<< * return size @@ -4056,7 +4322,7 @@ __pyx_v_size *= (__pyx_v_header->dims_ptr[__pyx_v_i]); } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":562 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":590 * for i in range(header.n_dims): * size *= header.dims_ptr[i] * return size # <<<<<<<<<<<<<< @@ -4072,7 +4338,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":564 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":592 * return size * * cdef read_mi_matrix(self, int process=1): # <<<<<<<<<<<<<< @@ -4100,16 +4366,16 @@ } __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":585 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":613 * object arr * # read full tag * self.cread_full_tag(&mdtype, &byte_count) # <<<<<<<<<<<<<< * if mdtype != miMATRIX: * raise TypeError('Expecting matrix here') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_full_tag(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_full_tag(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 613; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":586 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":614 * # read full tag * self.cread_full_tag(&mdtype, &byte_count) * if mdtype != miMATRIX: # <<<<<<<<<<<<<< @@ -4119,29 +4385,29 @@ __pyx_t_2 = (__pyx_v_mdtype != __pyx_e_5scipy_2io_6matlab_10mio5_utils_miMATRIX); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":587 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":615 * self.cread_full_tag(&mdtype, &byte_count) * if mdtype != miMATRIX: * raise TypeError('Expecting matrix here') # <<<<<<<<<<<<<< * if byte_count == 0: # empty matrix * if process and self.squeeze_me: */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_7)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_7)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_s_9)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_9)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 615; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":588 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":616 * if mdtype != miMATRIX: * raise TypeError('Expecting matrix here') * if byte_count == 0: # empty matrix # <<<<<<<<<<<<<< @@ -4151,7 +4417,7 @@ __pyx_t_2 = (__pyx_v_byte_count == 0); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":589 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":617 * raise TypeError('Expecting matrix here') * if byte_count == 0: # empty matrix * if process and self.squeeze_me: # <<<<<<<<<<<<<< @@ -4165,7 +4431,7 @@ } if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":590 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":618 * if byte_count == 0: # empty matrix * if process and self.squeeze_me: * return np.array([]) # <<<<<<<<<<<<<< @@ -4173,19 +4439,19 @@ * return np.array([[]]) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 590; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 618; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -4196,7 +4462,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":592 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":620 * return np.array([]) * else: * return np.array([[]]) # <<<<<<<<<<<<<< @@ -4204,24 +4470,24 @@ * return self.array_from_header(header, process) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__array); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_4)); __Pyx_GIVEREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_t_3)); __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 620; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -4234,20 +4500,20 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":593 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":621 * else: * return np.array([[]]) * header = self.read_header() # <<<<<<<<<<<<<< * return self.array_from_header(header, process) * */ - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_header(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 593; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_header(__pyx_v_self, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 621; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_v_header)); __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":594 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":622 * return np.array([[]]) * header = self.read_header() * return self.array_from_header(header, process) # <<<<<<<<<<<<<< @@ -4257,7 +4523,7 @@ __Pyx_XDECREF(__pyx_r); __pyx_t_6.__pyx_n = 1; __pyx_t_6.process = __pyx_v_process; - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->array_from_header(__pyx_v_self, __pyx_v_header, 0, &__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->array_from_header(__pyx_v_self, __pyx_v_header, 0, &__pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 622; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_r = __pyx_t_3; __pyx_t_3 = 0; @@ -4278,7 +4544,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":596 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":624 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -4312,13 +4578,13 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__array_from_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__array_from_header); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_array_from_header)) { __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = PyInt_FromLong(__pyx_v_process); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyInt_FromLong(__pyx_v_process); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_header)); @@ -4326,7 +4592,7 @@ PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = __pyx_t_2; @@ -4337,7 +4603,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":614 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":642 * object arr * cnp.dtype mat_dtype * cdef int mc = header.mclass # <<<<<<<<<<<<<< @@ -4346,7 +4612,7 @@ */ __pyx_v_mc = __pyx_v_header->mclass; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":615 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":643 * cnp.dtype mat_dtype * cdef int mc = header.mclass * if (mc == mxDOUBLE_CLASS # <<<<<<<<<<<<<< @@ -4355,7 +4621,7 @@ */ switch (__pyx_v_mc) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":616 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":644 * cdef int mc = header.mclass * if (mc == mxDOUBLE_CLASS * or mc == mxSINGLE_CLASS # <<<<<<<<<<<<<< @@ -4364,7 +4630,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxDOUBLE_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":617 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":645 * if (mc == mxDOUBLE_CLASS * or mc == mxSINGLE_CLASS * or mc == mxINT8_CLASS # <<<<<<<<<<<<<< @@ -4373,7 +4639,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSINGLE_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":618 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":646 * or mc == mxSINGLE_CLASS * or mc == mxINT8_CLASS * or mc == mxUINT8_CLASS # <<<<<<<<<<<<<< @@ -4382,7 +4648,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT8_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":619 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":647 * or mc == mxINT8_CLASS * or mc == mxUINT8_CLASS * or mc == mxINT16_CLASS # <<<<<<<<<<<<<< @@ -4391,7 +4657,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT8_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":620 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":648 * or mc == mxUINT8_CLASS * or mc == mxINT16_CLASS * or mc == mxUINT16_CLASS # <<<<<<<<<<<<<< @@ -4400,7 +4666,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT16_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":621 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":649 * or mc == mxINT16_CLASS * or mc == mxUINT16_CLASS * or mc == mxINT32_CLASS # <<<<<<<<<<<<<< @@ -4409,7 +4675,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT16_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":622 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":650 * or mc == mxUINT16_CLASS * or mc == mxINT32_CLASS * or mc == mxUINT32_CLASS # <<<<<<<<<<<<<< @@ -4418,7 +4684,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT32_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":623 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":651 * or mc == mxINT32_CLASS * or mc == mxUINT32_CLASS * or mc == mxINT64_CLASS # <<<<<<<<<<<<<< @@ -4427,7 +4693,7 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT32_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":624 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":652 * or mc == mxUINT32_CLASS * or mc == mxINT64_CLASS * or mc == mxUINT64_CLASS): # numeric matrix # <<<<<<<<<<<<<< @@ -4437,20 +4703,20 @@ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxINT64_CLASS: case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxUINT64_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":625 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":653 * or mc == mxINT64_CLASS * or mc == mxUINT64_CLASS): # numeric matrix * arr = self.read_real_complex(header) # <<<<<<<<<<<<<< * if process and self.mat_dtype: # might need to recast * if header.is_logical: */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_real_complex(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 625; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_real_complex(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 653; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":626 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":654 * or mc == mxUINT64_CLASS): # numeric matrix * arr = self.read_real_complex(header) * if process and self.mat_dtype: # might need to recast # <<<<<<<<<<<<<< @@ -4464,7 +4730,7 @@ } if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":627 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":655 * arr = self.read_real_complex(header) * if process and self.mat_dtype: # might need to recast * if header.is_logical: # <<<<<<<<<<<<<< @@ -4473,7 +4739,7 @@ */ if (__pyx_v_header->is_logical) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":628 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":656 * if process and self.mat_dtype: # might need to recast * if header.is_logical: * mat_dtype = self.bool_dtype # <<<<<<<<<<<<<< @@ -4487,7 +4753,7 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":630 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":658 * mat_dtype = self.bool_dtype * else: * mat_dtype = self.class_dtypes[mc] # <<<<<<<<<<<<<< @@ -4495,28 +4761,28 @@ * elif mc == mxSPARSE_CLASS: */ __pyx_t_5 = (__pyx_v_self->class_dtypes[__pyx_v_mc]); - if (!(likely(((((PyObject *)__pyx_t_5)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_t_5), __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 630; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((((PyObject *)__pyx_t_5)) == Py_None) || likely(__Pyx_TypeTest(((PyObject *)__pyx_t_5), __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 658; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(((PyObject *)__pyx_t_5)); __Pyx_DECREF(((PyObject *)__pyx_v_mat_dtype)); __pyx_v_mat_dtype = ((PyArray_Descr *)((PyObject *)__pyx_t_5)); } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":631 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":659 * else: * mat_dtype = self.class_dtypes[mc] * arr = arr.astype(mat_dtype) # <<<<<<<<<<<<<< * elif mc == mxSPARSE_CLASS: * arr = self.read_sparse(header) */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_arr, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_mat_dtype)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_mat_dtype)); __Pyx_GIVEREF(((PyObject *)__pyx_v_mat_dtype)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 631; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4528,7 +4794,7 @@ __pyx_L3:; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":632 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":660 * mat_dtype = self.class_dtypes[mc] * arr = arr.astype(mat_dtype) * elif mc == mxSPARSE_CLASS: # <<<<<<<<<<<<<< @@ -4537,20 +4803,20 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSPARSE_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":633 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":661 * arr = arr.astype(mat_dtype) * elif mc == mxSPARSE_CLASS: * arr = self.read_sparse(header) # <<<<<<<<<<<<<< * # no current processing makes sense for sparse * return arr */ - __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_sparse(__pyx_v_self, __pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 633; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_sparse(__pyx_v_self, __pyx_v_header); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 661; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":635 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":663 * arr = self.read_sparse(header) * # no current processing makes sense for sparse * return arr # <<<<<<<<<<<<<< @@ -4563,7 +4829,7 @@ goto __pyx_L0; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":636 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":664 * # no current processing makes sense for sparse * return arr * elif mc == mxCHAR_CLASS: # <<<<<<<<<<<<<< @@ -4572,20 +4838,20 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxCHAR_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":637 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":665 * return arr * elif mc == mxCHAR_CLASS: * arr = self.read_char(header) # <<<<<<<<<<<<<< * if process and self.chars_as_strings: * arr = chars_to_strings(arr) */ - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_char(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 637; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_char(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 665; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":638 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":666 * elif mc == mxCHAR_CLASS: * arr = self.read_char(header) * if process and self.chars_as_strings: # <<<<<<<<<<<<<< @@ -4599,21 +4865,21 @@ } if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":639 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":667 * arr = self.read_char(header) * if process and self.chars_as_strings: * arr = chars_to_strings(arr) # <<<<<<<<<<<<<< * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 639; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 667; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4625,7 +4891,7 @@ __pyx_L5:; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":640 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":668 * if process and self.chars_as_strings: * arr = chars_to_strings(arr) * elif mc == mxCELL_CLASS: # <<<<<<<<<<<<<< @@ -4634,21 +4900,21 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxCELL_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":641 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":669 * arr = chars_to_strings(arr) * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) # <<<<<<<<<<<<<< * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_cells(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 641; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_cells(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":642 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":670 * elif mc == mxCELL_CLASS: * arr = self.read_cells(header) * elif mc == mxSTRUCT_CLASS: # <<<<<<<<<<<<<< @@ -4657,21 +4923,21 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxSTRUCT_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":643 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":671 * arr = self.read_cells(header) * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) # <<<<<<<<<<<<<< * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = asstr(self.read_int8_string()) */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 643; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 671; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":644 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":672 * elif mc == mxSTRUCT_CLASS: * arr = self.read_struct(header) * elif mc == mxOBJECT_CLASS: # like structs, but with classname # <<<<<<<<<<<<<< @@ -4680,23 +4946,23 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOBJECT_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":645 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":673 * arr = self.read_struct(header) * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = asstr(self.read_int8_string()) # <<<<<<<<<<<<<< * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 645; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -4704,32 +4970,32 @@ __pyx_v_classname = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":646 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":674 * elif mc == mxOBJECT_CLASS: # like structs, but with classname * classname = asstr(self.read_int8_string()) * arr = self.read_struct(header) # <<<<<<<<<<<<<< * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type */ - __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 646; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_struct(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 674; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":647 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":675 * classname = asstr(self.read_int8_string()) * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) # <<<<<<<<<<<<<< * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MatlabObject); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__MatlabObject); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_arr); @@ -4737,7 +5003,7 @@ __Pyx_INCREF(__pyx_v_classname); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_classname); __Pyx_GIVEREF(__pyx_v_classname); - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 647; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 675; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -4746,7 +5012,7 @@ __pyx_t_1 = 0; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":648 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":676 * arr = self.read_struct(header) * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type # <<<<<<<<<<<<<< @@ -4755,37 +5021,37 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxFUNCTION_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":649 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":677 * arr = mio5p.MatlabObject(arr, classname) * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() # <<<<<<<<<<<<<< * arr = mio5p.MatlabFunction(arr) * # to make them more re-writeable - don't squeeze */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 649; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 677; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":650 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":678 * elif mc == mxFUNCTION_CLASS: # just a matrix of struct type * arr = self.read_mi_matrix() * arr = mio5p.MatlabFunction(arr) # <<<<<<<<<<<<<< * # to make them more re-writeable - don't squeeze * return arr */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__MatlabFunction); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__MatlabFunction); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 650; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 678; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4793,7 +5059,7 @@ __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":652 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":680 * arr = mio5p.MatlabFunction(arr) * # to make them more re-writeable - don't squeeze * return arr # <<<<<<<<<<<<<< @@ -4806,7 +5072,7 @@ goto __pyx_L0; break; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":653 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":681 * # to make them more re-writeable - don't squeeze * return arr * elif mc == mxOPAQUE_CLASS: # <<<<<<<<<<<<<< @@ -4815,37 +5081,37 @@ */ case __pyx_e_5scipy_2io_6matlab_10mio5_utils_mxOPAQUE_CLASS: - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":654 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":682 * return arr * elif mc == mxOPAQUE_CLASS: * arr = self.read_opaque(header) # <<<<<<<<<<<<<< * arr = mio5p.MatlabOpaque(arr) * # to make them more re-writeable - don't squeeze */ - __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_opaque(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 654; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_opaque(__pyx_v_self, __pyx_v_header, 0)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 682; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_arr); __pyx_v_arr = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":655 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":683 * elif mc == mxOPAQUE_CLASS: * arr = self.read_opaque(header) * arr = mio5p.MatlabOpaque(arr) # <<<<<<<<<<<<<< * # to make them more re-writeable - don't squeeze * return arr */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__MatlabOpaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__MatlabOpaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 655; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -4853,7 +5119,7 @@ __pyx_v_arr = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":657 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":685 * arr = mio5p.MatlabOpaque(arr) * # to make them more re-writeable - don't squeeze * return arr # <<<<<<<<<<<<<< @@ -4867,7 +5133,7 @@ break; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":658 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":686 * # to make them more re-writeable - don't squeeze * return arr * if process and self.squeeze_me: # <<<<<<<<<<<<<< @@ -4881,7 +5147,7 @@ } if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":659 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":687 * return arr * if process and self.squeeze_me: * return squeeze_element(arr) # <<<<<<<<<<<<<< @@ -4889,14 +5155,14 @@ * */ __Pyx_XDECREF(__pyx_r); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_arr); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_arr); __Pyx_GIVEREF(__pyx_v_arr); - __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 659; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -4907,7 +5173,7 @@ } __pyx_L6:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":660 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":688 * if process and self.squeeze_me: * return squeeze_element(arr) * return arr # <<<<<<<<<<<<<< @@ -4936,7 +5202,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":596 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":624 * return self.array_from_header(header, process) * * cpdef array_from_header(self, VarHeader5 header, int process=1): # <<<<<<<<<<<<<< @@ -4975,18 +5241,18 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_from_header") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "array_from_header") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)values[0]); if (values[1]) { - __pyx_v_process = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_process = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { __pyx_v_process = ((int)1); } } else { __pyx_v_process = ((int)1); switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_process = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_process = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_process == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_header = ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)PyTuple_GET_ITEM(__pyx_args, 0)); break; default: goto __pyx_L5_argtuple_error; @@ -4994,17 +5260,17 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("array_from_header", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("array_from_header", 0, 1, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.array_from_header"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); __pyx_t_2.__pyx_n = 1; __pyx_t_2.process = __pyx_v_process; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->array_from_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), __pyx_v_header, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 596; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->array_from_header(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), __pyx_v_header, 1, &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 624; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5022,7 +5288,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":662 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":690 * return arr * * cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5046,19 +5312,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_real_complex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_real_complex); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_real_complex)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5067,7 +5333,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":666 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":694 * cdef: * cnp.ndarray res, res_j * if header.is_complex: # <<<<<<<<<<<<<< @@ -5076,7 +5342,7 @@ */ if (__pyx_v_header->is_complex) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":668 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":696 * if header.is_complex: * # avoid array copy to save memory * res = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5085,13 +5351,13 @@ */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 668; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 696; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res)); __pyx_v_res = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":669 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":697 * # avoid array copy to save memory * res = self.read_numeric(False) * res_j = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5100,28 +5366,28 @@ */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 669; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 697; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res_j)); __pyx_v_res_j = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":670 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":698 * res = self.read_numeric(False) * res_j = self.read_numeric(False) * res = res + (res_j * 1j) # <<<<<<<<<<<<<< * else: * res = self.read_numeric() */ - __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_res_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_res_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_res), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_res), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 670; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_res)); __pyx_v_res = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5129,14 +5395,14 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":672 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":700 * res = res + (res_j * 1j) * else: * res = self.read_numeric() # <<<<<<<<<<<<<< * return res.reshape(header.dims[::-1]).T * */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 672; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_res)); __pyx_v_res = ((PyArrayObject *)__pyx_t_1); @@ -5144,7 +5410,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":673 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":701 * else: * res = self.read_numeric() * return res.reshape(header.dims[::-1]).T # <<<<<<<<<<<<<< @@ -5152,26 +5418,26 @@ * cdef object read_sparse(self, VarHeader5 header): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_3); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_3); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 673; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -5192,7 +5458,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":662 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":690 * return arr * * cpdef cnp.ndarray read_real_complex(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5206,9 +5472,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_real_complex"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_real_complex(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 662; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_real_complex(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 690; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -5226,7 +5492,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":675 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":703 * return res.reshape(header.dims[::-1]).T * * cdef object read_sparse(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5258,33 +5524,33 @@ __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_data_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":679 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":707 * cdef cnp.ndarray rowind, indptr, data, data_j * cdef size_t M, N, nnz * rowind = self.read_numeric() # <<<<<<<<<<<<<< * indptr = self.read_numeric() * if header.is_complex: */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 679; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_rowind)); __pyx_v_rowind = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":680 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":708 * cdef size_t M, N, nnz * rowind = self.read_numeric() * indptr = self.read_numeric() # <<<<<<<<<<<<<< * if header.is_complex: * # avoid array copy to save memory */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 680; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_indptr)); __pyx_v_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":681 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":709 * rowind = self.read_numeric() * indptr = self.read_numeric() * if header.is_complex: # <<<<<<<<<<<<<< @@ -5293,7 +5559,7 @@ */ if (__pyx_v_header->is_complex) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":683 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":711 * if header.is_complex: * # avoid array copy to save memory * data = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5302,13 +5568,13 @@ */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 683; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":684 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":712 * # avoid array copy to save memory * data = self.read_numeric(False) * data_j = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5317,28 +5583,28 @@ */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 684; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data_j)); __pyx_v_data_j = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":685 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":713 * data = self.read_numeric(False) * data_j = self.read_numeric(False) * data = data + (data_j * 1j) # <<<<<<<<<<<<<< * else: * data = self.read_numeric() */ - __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 685; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5346,14 +5612,14 @@ } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":687 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":715 * data = data + (data_j * 1j) * else: * data = self.read_numeric() # <<<<<<<<<<<<<< * ''' From the matlab (TM) API documentation, last found here: * http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 687; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); @@ -5361,7 +5627,7 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":700 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":728 * to each rowind * ''' * M,N = header.dims # <<<<<<<<<<<<<< @@ -5371,86 +5637,86 @@ if (PyTuple_CheckExact(__pyx_v_header->dims) && likely(PyTuple_GET_SIZE(__pyx_v_header->dims) == 2)) { PyObject* tuple = __pyx_v_header->dims; __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_M = __pyx_t_4; __pyx_v_N = __pyx_t_5; } else { - __pyx_t_6 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_M = __pyx_t_5; __pyx_v_N = __pyx_t_4; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":701 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":729 * ''' * M,N = header.dims * indptr = indptr[:N+1] # <<<<<<<<<<<<<< * nnz = indptr[-1] * rowind = rowind[:nnz] */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_indptr)); __pyx_v_indptr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":702 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":730 * M,N = header.dims * indptr = indptr[:N+1] * nnz = indptr[-1] # <<<<<<<<<<<<<< * rowind = rowind[:nnz] * data = data[:nnz] */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 702; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_nnz = __pyx_t_4; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":703 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":731 * indptr = indptr[:N+1] * nnz = indptr[-1] * rowind = rowind[:nnz] # <<<<<<<<<<<<<< * data = data[:nnz] * return scipy.sparse.csc_matrix( */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rowind)); __pyx_v_rowind = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":704 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":732 * nnz = indptr[-1] * rowind = rowind[:nnz] * data = data[:nnz] # <<<<<<<<<<<<<< * return scipy.sparse.csc_matrix( * (data,rowind,indptr), */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":705 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":733 * rowind = rowind[:nnz] * data = data[:nnz] * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< @@ -5458,23 +5724,23 @@ * shape=(M,N)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":706 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":734 * data = data[:nnz] * return scipy.sparse.csc_matrix( * (data,rowind,indptr), # <<<<<<<<<<<<<< * shape=(M,N)) * */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_data)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_data)); @@ -5485,34 +5751,34 @@ __Pyx_INCREF(((PyObject *)__pyx_v_indptr)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_indptr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indptr)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":705 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":733 * rowind = rowind[:nnz] * data = data[:nnz] * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< * (data,rowind,indptr), * shape=(M,N)) */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":707 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":735 * return scipy.sparse.csc_matrix( * (data,rowind,indptr), * shape=(M,N)) # <<<<<<<<<<<<<< * * cpdef cnp.ndarray read_char(self, VarHeader5 header): */ - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -5520,9 +5786,9 @@ __Pyx_GIVEREF(__pyx_t_8); __pyx_t_7 = 0; __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5552,7 +5818,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":709 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":737 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5568,40 +5834,41 @@ PyObject *__pyx_v_data; PyObject *__pyx_v_codec; PyArrayObject *__pyx_v_arr; + PyArray_Descr *__pyx_v_dt; size_t __pyx_v_length; - PyArray_Descr *__pyx_v_dt = 0; PyObject *__pyx_v_uc_str; PyArrayObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_element __pyx_t_4; - PyObject *__pyx_t_5; - int __pyx_t_6; - PyObject *__pyx_t_7 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + PyObject *__pyx_t_7; int __pyx_t_8; __Pyx_RefNannySetupContext("read_char"); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); __pyx_v_codec = Py_None; __Pyx_INCREF(Py_None); __pyx_v_arr = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_dt = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_uc_str = Py_None; __Pyx_INCREF(Py_None); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5610,53 +5877,146 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":735 - * object data, res, codec + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":764 * cnp.ndarray arr + * cnp.dtype dt * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< * data = self.read_element( * &mdtype, &byte_count, &data_ptr, True) */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":737 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":766 * cdef size_t length = self.size_from_header(header) * data = self.read_element( * &mdtype, &byte_count, &data_ptr, True) # <<<<<<<<<<<<<< - * # Character data can be of apparently numerical types, - * # specifically np.uint8, np.int8, np.uint16. np.unit16 can have + * # There are mat files in the wild that have 0 byte count strings, but + * # maybe with non-zero length. */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":742 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":769 + * # There are mat files in the wild that have 0 byte count strings, but + * # maybe with non-zero length. + * if byte_count == 0: # <<<<<<<<<<<<<< + * arr = np.array(' ' * length, dtype='U') + * return np.ndarray(shape=header.dims, + */ + __pyx_t_5 = (__pyx_v_byte_count == 0); + if (__pyx_t_5) { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":770 + * # maybe with non-zero length. + * if byte_count == 0: + * arr = np.array(' ' * length, dtype='U') # <<<<<<<<<<<<<< + * return np.ndarray(shape=header.dims, + * dtype=self.U1_dtype, + */ + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_2), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_arr)); + __pyx_v_arr = ((PyArrayObject *)__pyx_t_6); + __pyx_t_6 = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":771 + * if byte_count == 0: + * arr = np.array(' ' * length, dtype='U') + * return np.ndarray(shape=header.dims, # <<<<<<<<<<<<<< + * dtype=self.U1_dtype, + * buffer=arr, + */ + __Pyx_XDECREF(((PyObject *)__pyx_r)); + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":772 + * arr = np.array(' ' * length, dtype='U') + * return np.ndarray(shape=header.dims, + * dtype=self.U1_dtype, # <<<<<<<<<<<<<< + * buffer=arr, + * order='F') + */ + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":773 + * return np.ndarray(shape=header.dims, + * dtype=self.U1_dtype, + * buffer=arr, # <<<<<<<<<<<<<< + * order='F') + * # Character data can be of apparently numerical types, + */ + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; + goto __pyx_L0; + goto __pyx_L3; + } + __pyx_L3:; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":779 * # a length 1 type encoding, like ascii, or length 2 type * # encoding - * cdef cnp.dtype dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< + * dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< * if mdtype == miUINT16: * codec = self.uint16_codec */ - __pyx_t_5 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); - __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_5))); - __pyx_v_dt = ((PyArray_Descr *)__pyx_t_5); + __pyx_t_7 = (__pyx_v_self->dtypes[__pyx_v_mdtype]); + __Pyx_INCREF(((PyObject *)((PyArray_Descr *)__pyx_t_7))); + __Pyx_DECREF(((PyObject *)__pyx_v_dt)); + __pyx_v_dt = ((PyArray_Descr *)__pyx_t_7); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":743 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":780 * # encoding - * cdef cnp.dtype dt = self.dtypes[mdtype] + * dt = self.dtypes[mdtype] * if mdtype == miUINT16: # <<<<<<<<<<<<<< * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only */ - __pyx_t_6 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT16); - if (__pyx_t_6) { + __pyx_t_5 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT16); + if (__pyx_t_5) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":744 - * cdef cnp.dtype dt = self.dtypes[mdtype] + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":781 + * dt = self.dtypes[mdtype] * if mdtype == miUINT16: * codec = self.uint16_codec # <<<<<<<<<<<<<< * if self.codecs['uint16_len'] == 1: # need LSBs only @@ -5666,111 +6026,111 @@ __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = __pyx_v_self->uint16_codec; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":745 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":782 * if mdtype == miUINT16: * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only # <<<<<<<<<<<<<< * arr = np.ndarray(shape=(length,), * dtype=dt, */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->codecs, ((PyObject *)__pyx_n_s__uint16_len)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_self->codecs, ((PyObject *)__pyx_n_s__uint16_len)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 745; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_6) { + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + if (__pyx_t_5) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":746 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":783 * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), # <<<<<<<<<<<<<< * dtype=dt, * buffer=data) */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_2); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__shape), __pyx_t_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":747 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":784 * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), * dtype=dt, # <<<<<<<<<<<<<< * buffer=data) * data = arr.astype(np.uint8).tostring() */ - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":748 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":785 * arr = np.ndarray(shape=(length,), * dtype=dt, * buffer=data) # <<<<<<<<<<<<<< * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: */ - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__buffer), __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 746; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); - __pyx_v_arr = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":749 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":786 * dtype=dt, * buffer=data) * data = arr.astype(np.uint8).tostring() # <<<<<<<<<<<<<< * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' */ - __pyx_t_7 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__astype); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_7, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tostring); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tostring); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - goto __pyx_L4; + goto __pyx_L5; } - __pyx_L4:; - goto __pyx_L3; + __pyx_L5:; + goto __pyx_L4; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":750 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":787 * buffer=data) * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: # <<<<<<<<<<<<<< @@ -5780,15 +6140,15 @@ switch (__pyx_v_mdtype) { case __pyx_e_5scipy_2io_6matlab_10mio5_utils_miINT8: case __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT8: - __pyx_t_6 = 1; + __pyx_t_5 = 1; break; default: - __pyx_t_6 = 0; + __pyx_t_5 = 0; break; } - if (__pyx_t_6) { + if (__pyx_t_5) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":751 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":788 * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' # <<<<<<<<<<<<<< @@ -5798,207 +6158,196 @@ __Pyx_INCREF(((PyObject *)__pyx_n_s__ascii)); __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = ((PyObject *)__pyx_n_s__ascii); - goto __pyx_L3; + goto __pyx_L4; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":752 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":789 * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data # <<<<<<<<<<<<<< * codec = self.codecs[mdtype] * if not codec: */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = ((PySequence_Contains(__pyx_v_self->codecs, __pyx_t_1))); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 752; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PySequence_Contains(__pyx_v_self->codecs, __pyx_t_1))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (__pyx_t_6) { + if (__pyx_t_5) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":753 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":790 * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] # <<<<<<<<<<<<<< * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 753; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":754 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":791 * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] * if not codec: # <<<<<<<<<<<<<< * raise TypeError('Do not support encoding %d' % mdtype) * else: */ - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 754; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = (!__pyx_t_6); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = (!__pyx_t_5); if (__pyx_t_8) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":755 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":792 * codec = self.codecs[mdtype] * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) # <<<<<<<<<<<<<< * else: * raise ValueError('Type %d does not appear to be char type' */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_8), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_t_3)); - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 755; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L5; + __Pyx_Raise(__pyx_t_6, 0, 0); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; } - __pyx_L5:; - goto __pyx_L3; + __pyx_L6:; + goto __pyx_L4; } /*else*/ { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":758 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":795 * else: * raise ValueError('Type %d does not appear to be char type' * % mdtype) # <<<<<<<<<<<<<< * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters */ - __pyx_t_3 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_9), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 758; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_1, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_L3:; + __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":759 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":796 * raise ValueError('Type %d does not appear to be char type' * % mdtype) * uc_str = data.decode(codec) # <<<<<<<<<<<<<< * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str, dtype='U') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_codec); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_codec); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_codec); __Pyx_GIVEREF(__pyx_v_codec); - __pyx_t_7 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_uc_str); - __pyx_v_uc_str = __pyx_t_7; - __pyx_t_7 = 0; + __pyx_v_uc_str = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":761 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":798 * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str, dtype='U') # <<<<<<<<<<<<<< - * dt = self.U1_dtype * # could take this to numpy C-API level, but probably not worth + * # it */ - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_uc_str); - PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_uc_str); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_uc_str); __Pyx_GIVEREF(__pyx_v_uc_str); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_7, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 761; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":762 - * # cast to array to deal with 2, 4 byte width characters - * arr = np.array(uc_str, dtype='U') - * dt = self.U1_dtype # <<<<<<<<<<<<<< + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":801 * # could take this to numpy C-API level, but probably not worth * # it - */ - __Pyx_INCREF(((PyObject *)__pyx_v_self->U1_dtype)); - __Pyx_DECREF(((PyObject *)__pyx_v_dt)); - __pyx_v_dt = __pyx_v_self->U1_dtype; - - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":765 - * # could take this to numpy C-API level, but probably not worth - * # it * return np.ndarray(shape=header.dims, # <<<<<<<<<<<<<< - * dtype=dt, + * dtype=self.U1_dtype, * buffer=arr, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":766 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":802 * # it * return np.ndarray(shape=header.dims, - * dtype=dt, # <<<<<<<<<<<<<< + * dtype=self.U1_dtype, # <<<<<<<<<<<<<< * buffer=arr, * order='F') */ - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":767 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":803 * return np.ndarray(shape=header.dims, - * dtype=dt, + * dtype=self.U1_dtype, * buffer=arr, # <<<<<<<<<<<<<< * order='F') * */ - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_7); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_7) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_7, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_7); - __pyx_t_7 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -6007,21 +6356,21 @@ __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_7); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("scipy.io.matlab.mio5_utils.VarReader5.read_char"); __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_data); __Pyx_DECREF(__pyx_v_codec); __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_XDECREF((PyObject *)__pyx_v_dt); + __Pyx_DECREF((PyObject *)__pyx_v_dt); __Pyx_DECREF(__pyx_v_uc_str); __Pyx_XGIVEREF((PyObject *)__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":709 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":737 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6035,9 +6384,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_char"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 709; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6055,7 +6404,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":770 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":806 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6094,19 +6443,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_cells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_cells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_cells)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6115,31 +6464,31 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":776 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":812 * cnp.ndarray[object, ndim=1] result * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) */ - __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_tupdims)); __pyx_v_tupdims = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":777 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":813 * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -6148,34 +6497,34 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":778 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":814 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * result[i] = self.read_mi_matrix() */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6192,14 +6541,14 @@ } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":779 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":815 * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< @@ -6210,21 +6559,21 @@ for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":780 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":816 * result = np.empty(length, dtype=object) * for i in range(length): * result[i] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return result.reshape(tupdims).T * */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = __pyx_v_i; __pyx_t_6 = -1; if (unlikely(__pyx_t_12 >= (size_t)__pyx_bshape_0_result)) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_12, __pyx_bstride_0_result); __Pyx_GOTREF(*__pyx_t_13); @@ -6234,7 +6583,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":781 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":817 * for i in range(length): * result[i] = self.read_mi_matrix() * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -6242,21 +6591,21 @@ * def read_fieldnames(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_tupdims)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_tupdims)); __Pyx_GIVEREF(((PyObject *)__pyx_v_tupdims)); - __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -6285,7 +6634,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":770 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":806 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6299,9 +6648,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_cells"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_cells(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_cells(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6319,7 +6668,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":783 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":819 * return result.reshape(tupdims).T * * def read_fieldnames(self): # <<<<<<<<<<<<<< @@ -6335,7 +6684,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_fieldnames"); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":789 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":825 * ''' * cdef int n_names * return self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< @@ -6343,7 +6692,7 @@ * cdef inline object cread_fieldnames(self, int *n_names_ptr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_fieldnames(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_fieldnames(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6361,7 +6710,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":791 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":827 * return self.cread_fieldnames(&n_names) * * cdef inline object cread_fieldnames(self, int *n_names_ptr): # <<<<<<<<<<<<<< @@ -6377,7 +6726,11 @@ PyObject *__pyx_v_field_names; int __pyx_v_res; PyObject *__pyx_v_names = 0; + int *__pyx_v_n_duplicates; + char **__pyx_v_name_ptrs; char *__pyx_v_n_ptr; + int __pyx_v_j; + int __pyx_v_dup_no; PyObject *__pyx_r = NULL; int __pyx_t_1; int __pyx_t_2; @@ -6387,21 +6740,23 @@ char *__pyx_t_6; int __pyx_t_7; PyObject *__pyx_t_8 = NULL; + int __pyx_t_9; + int __pyx_t_10; __Pyx_RefNannySetupContext("cread_fieldnames"); __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); __pyx_v_field_names = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":797 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":833 * object name, field_names * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) # <<<<<<<<<<<<<< * if res != 1: * raise ValueError('Only one value for namelength') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, (&__pyx_v_namelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, (&__pyx_v_namelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":798 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":834 * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) * if res != 1: # <<<<<<<<<<<<<< @@ -6411,149 +6766,292 @@ __pyx_t_2 = (__pyx_v_res != 1); if (__pyx_t_2) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":799 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":835 * cdef int res = self.read_into_int32s(&namelength) * if res != 1: * raise ValueError('Only one value for namelength') # <<<<<<<<<<<<<< * cdef object names = self.read_int8_string() * field_names = [] */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_s_10)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_10)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_10)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 799; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":800 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":836 * if res != 1: * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() # <<<<<<<<<<<<<< * field_names = [] * n_names = PyBytes_Size(names) // namelength */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_names = __pyx_t_4; __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":801 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":837 * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() * field_names = [] # <<<<<<<<<<<<<< * n_names = PyBytes_Size(names) // namelength - * cdef char *n_ptr = names + * # Make n_duplicates and pointer arrays */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_v_field_names); __pyx_v_field_names = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":802 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":838 * cdef object names = self.read_int8_string() * field_names = [] * n_names = PyBytes_Size(names) // namelength # <<<<<<<<<<<<<< - * cdef char *n_ptr = names - * for i in range(n_names): + * # Make n_duplicates and pointer arrays + * cdef: */ - __pyx_t_5 = PyBytes_Size(__pyx_v_names); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_Size(__pyx_v_names); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_v_namelength == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_namelength == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_n_names = __Pyx_div_Py_ssize_t(__pyx_t_5, __pyx_v_namelength); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":803 - * field_names = [] - * n_names = PyBytes_Size(names) // namelength - * cdef char *n_ptr = names # <<<<<<<<<<<<<< + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":843 + * int *n_duplicates + * char **name_ptrs + * n_duplicates = calloc(n_names, sizeof(int)) # <<<<<<<<<<<<<< + * name_ptrs = calloc(n_names, sizeof(char *)) + * cdef: + */ + __pyx_v_n_duplicates = ((int *)calloc(__pyx_v_n_names, (sizeof(int)))); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":844 + * char **name_ptrs + * n_duplicates = calloc(n_names, sizeof(int)) + * name_ptrs = calloc(n_names, sizeof(char *)) # <<<<<<<<<<<<<< + * cdef: + * char *n_ptr = names + */ + __pyx_v_name_ptrs = ((char **)calloc(__pyx_v_n_names, (sizeof(char *)))); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":846 + * name_ptrs = calloc(n_names, sizeof(char *)) + * cdef: + * char *n_ptr = names # <<<<<<<<<<<<<< + * int j, dup_no * for i in range(n_names): - * name = PyBytes_FromString(n_ptr) */ - __pyx_t_6 = PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 803; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n_ptr = __pyx_t_6; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":804 - * n_names = PyBytes_Size(names) // namelength - * cdef char *n_ptr = names + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":848 + * char *n_ptr = names + * int j, dup_no * for i in range(n_names): # <<<<<<<<<<<<<< - * name = PyBytes_FromString(n_ptr) - * field_names.append(asstr(name)) + * name = asstr(PyBytes_FromString(n_ptr)) + * # Check if this is a duplicate field, rename if so */ __pyx_t_1 = __pyx_v_n_names; for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":805 - * cdef char *n_ptr = names + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":849 + * int j, dup_no * for i in range(n_names): - * name = PyBytes_FromString(n_ptr) # <<<<<<<<<<<<<< - * field_names.append(asstr(name)) - * n_ptr += namelength + * name = asstr(PyBytes_FromString(n_ptr)) # <<<<<<<<<<<<<< + * # Check if this is a duplicate field, rename if so + * name_ptrs[i] = n_ptr */ - __pyx_t_4 = ((PyObject *)PyBytes_FromString(__pyx_v_n_ptr)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 805; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = ((PyObject *)PyBytes_FromString(__pyx_v_n_ptr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_name); - __pyx_v_name = __pyx_t_4; - __pyx_t_4 = 0; + __pyx_v_name = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":806 - * for i in range(n_names): - * name = PyBytes_FromString(n_ptr) - * field_names.append(asstr(name)) # <<<<<<<<<<<<<< + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":851 + * name = asstr(PyBytes_FromString(n_ptr)) + * # Check if this is a duplicate field, rename if so + * name_ptrs[i] = n_ptr # <<<<<<<<<<<<<< + * dup_no = 0 + * for j in range(i): + */ + (__pyx_v_name_ptrs[__pyx_v_i]) = __pyx_v_n_ptr; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":852 + * # Check if this is a duplicate field, rename if so + * name_ptrs[i] = n_ptr + * dup_no = 0 # <<<<<<<<<<<<<< + * for j in range(i): + * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same + */ + __pyx_v_dup_no = 0; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":853 + * name_ptrs[i] = n_ptr + * dup_no = 0 + * for j in range(i): # <<<<<<<<<<<<<< + * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same + * n_duplicates[j] += 1 + */ + __pyx_t_9 = __pyx_v_i; + for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { + __pyx_v_j = __pyx_t_10; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":854 + * dup_no = 0 + * for j in range(i): + * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same # <<<<<<<<<<<<<< + * n_duplicates[j] += 1 + * dup_no = n_duplicates[j] + */ + __pyx_t_2 = (strcmp(__pyx_v_n_ptr, (__pyx_v_name_ptrs[__pyx_v_j])) == 0); + if (__pyx_t_2) { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":855 + * for j in range(i): + * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same + * n_duplicates[j] += 1 # <<<<<<<<<<<<<< + * dup_no = n_duplicates[j] + * break + */ + (__pyx_v_n_duplicates[__pyx_v_j]) += 1; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":856 + * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same + * n_duplicates[j] += 1 + * dup_no = n_duplicates[j] # <<<<<<<<<<<<<< + * break + * if dup_no != 0: + */ + __pyx_v_dup_no = (__pyx_v_n_duplicates[__pyx_v_j]); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":857 + * n_duplicates[j] += 1 + * dup_no = n_duplicates[j] + * break # <<<<<<<<<<<<<< + * if dup_no != 0: + * name = '_%d_%s' % (dup_no, name) + */ + goto __pyx_L7_break; + goto __pyx_L8; + } + __pyx_L8:; + } + __pyx_L7_break:; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":858 + * dup_no = n_duplicates[j] + * break + * if dup_no != 0: # <<<<<<<<<<<<<< + * name = '_%d_%s' % (dup_no, name) + * field_names.append(name) + */ + __pyx_t_2 = (__pyx_v_dup_no != 0); + if (__pyx_t_2) { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":859 + * break + * if dup_no != 0: + * name = '_%d_%s' % (dup_no, name) # <<<<<<<<<<<<<< + * field_names.append(name) * n_ptr += namelength - * n_names_ptr[0] = n_names */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_dup_no); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_name); + PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name); + __Pyx_GIVEREF(__pyx_v_name); + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_v_name); + __pyx_v_name = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + goto __pyx_L9; + } + __pyx_L9:; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":860 + * if dup_no != 0: + * name = '_%d_%s' % (dup_no, name) + * field_names.append(name) # <<<<<<<<<<<<<< + * n_ptr += namelength + * free(n_duplicates) + */ + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_field_names, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(__pyx_v_name); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_name); - __Pyx_GIVEREF(__pyx_v_name); - __pyx_t_8 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_8); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_field_names, __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":807 - * name = PyBytes_FromString(n_ptr) - * field_names.append(asstr(name)) + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":861 + * name = '_%d_%s' % (dup_no, name) + * field_names.append(name) * n_ptr += namelength # <<<<<<<<<<<<<< - * n_names_ptr[0] = n_names - * return field_names + * free(n_duplicates) + * free(name_ptrs) */ __pyx_v_n_ptr += __pyx_v_namelength; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":808 - * field_names.append(asstr(name)) + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":862 + * field_names.append(name) * n_ptr += namelength + * free(n_duplicates) # <<<<<<<<<<<<<< + * free(name_ptrs) + * n_names_ptr[0] = n_names + */ + free(__pyx_v_n_duplicates); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":863 + * n_ptr += namelength + * free(n_duplicates) + * free(name_ptrs) # <<<<<<<<<<<<<< + * n_names_ptr[0] = n_names + * return field_names + */ + free(__pyx_v_name_ptrs); + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":864 + * free(n_duplicates) + * free(name_ptrs) * n_names_ptr[0] = n_names # <<<<<<<<<<<<<< * return field_names * */ (__pyx_v_n_names_ptr[0]) = __pyx_v_n_names; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":809 - * n_ptr += namelength + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":865 + * free(name_ptrs) * n_names_ptr[0] = n_names * return field_names # <<<<<<<<<<<<<< * @@ -6581,7 +7079,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":811 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":867 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6636,19 +7134,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6657,43 +7155,43 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":824 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":880 * object dt, tupdims * # Read field names into list * cdef object field_names = self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< * # Prepare struct array * tupdims = tuple(header.dims[::-1]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_field_names = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":826 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":882 * cdef object field_names = self.cread_fieldnames(&n_names) * # Prepare struct array * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays */ - __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_tupdims); __pyx_v_tupdims = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":827 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":883 * # Prepare struct array * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -6702,7 +7200,7 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":828 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":884 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays # <<<<<<<<<<<<<< @@ -6711,7 +7209,7 @@ */ if (__pyx_v_self->struct_as_record) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":829 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":885 * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays * if not n_names: # <<<<<<<<<<<<<< @@ -6721,7 +7219,7 @@ __pyx_t_4 = (!__pyx_v_n_names); if (__pyx_t_4) { - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":833 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":889 * # representation we can use, falling back to empty * # object * return np.empty(tupdims, dtype=object).T # <<<<<<<<<<<<<< @@ -6729,28 +7227,28 @@ * rec_res = np.empty(length, dtype=dt) */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -6758,19 +7256,19 @@ } __pyx_L4:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":834 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":890 * # object * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] # <<<<<<<<<<<<<< * rec_res = np.empty(length, dtype=dt) * for i in range(length): */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_5); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); } for (;;) { @@ -6783,7 +7281,7 @@ } else { __pyx_t_3 = PyIter_Next(__pyx_t_5); if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_3); @@ -6791,7 +7289,7 @@ __Pyx_DECREF(__pyx_v_field_name); __pyx_v_field_name = __pyx_t_3; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_field_name); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field_name); @@ -6799,7 +7297,7 @@ __Pyx_INCREF(__pyx_builtin_object); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_object); __Pyx_GIVEREF(__pyx_builtin_object); - if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 834; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -6808,39 +7306,39 @@ __pyx_v_dt = ((PyObject *)__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":835 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":891 * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) # <<<<<<<<<<<<<< * for i in range(length): * for field_name in field_names: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rec_res)); __pyx_v_rec_res = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":836 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":892 * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) * for i in range(length): # <<<<<<<<<<<<<< @@ -6851,7 +7349,7 @@ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":837 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":893 * rec_res = np.empty(length, dtype=dt) * for i in range(length): * for field_name in field_names: # <<<<<<<<<<<<<< @@ -6861,7 +7359,7 @@ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } for (;;) { @@ -6874,7 +7372,7 @@ } else { __pyx_t_2 = PyIter_Next(__pyx_t_1); if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_2); @@ -6883,25 +7381,25 @@ __pyx_v_field_name = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":838 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":894 * for i in range(length): * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(__pyx_t_3, __pyx_v_field_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_v_field_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":839 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":895 * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() * return rec_res.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -6909,21 +7407,21 @@ * obj_template = mio5p.mat_struct() */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -6931,62 +7429,62 @@ } __pyx_L3:; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":841 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":897 * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() # <<<<<<<<<<<<<< * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mat_struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mat_struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_obj_template); __pyx_v_obj_template = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":842 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":898 * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names # <<<<<<<<<<<<<< * result = np.empty(length, dtype=object) * for i in range(length): */ - if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_n_s___fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_n_s___fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":843 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":899 * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * item = pycopy(obj_template) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -7003,14 +7501,14 @@ } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":844 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":900 * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< @@ -7021,21 +7519,21 @@ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":845 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":901 * result = np.empty(length, dtype=object) * for i in range(length): * item = pycopy(obj_template) # <<<<<<<<<<<<<< * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pycopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pycopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_obj_template); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj_template); __Pyx_GIVEREF(__pyx_v_obj_template); - __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 845; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7043,7 +7541,7 @@ __pyx_v_item = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":846 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":902 * for i in range(length): * item = pycopy(obj_template) * for name in field_names: # <<<<<<<<<<<<<< @@ -7053,7 +7551,7 @@ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } for (;;) { @@ -7066,7 +7564,7 @@ } else { __pyx_t_2 = PyIter_Next(__pyx_t_1); if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_2); @@ -7075,24 +7573,24 @@ __pyx_v_name = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":847 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":903 * item = pycopy(obj_template) * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * result[i] = item * return result.reshape(tupdims).T */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s____dict__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s____dict__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_5, __pyx_v_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 847; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_5, __pyx_v_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":848 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":904 * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() * result[i] = item # <<<<<<<<<<<<<< @@ -7107,7 +7605,7 @@ } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_result)) __pyx_t_14 = 0; if (unlikely(__pyx_t_14 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_13, __pyx_bstride_0_result); __Pyx_GOTREF(*__pyx_t_15); @@ -7116,7 +7614,7 @@ __Pyx_GIVEREF(*__pyx_t_15); } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":849 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":905 * item.__dict__[name] = self.read_mi_matrix() * result[i] = item * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -7124,21 +7622,21 @@ * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -7174,7 +7672,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":811 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":867 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -7188,9 +7686,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_struct"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_struct(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_struct(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7208,7 +7706,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":851 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":907 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -7229,19 +7727,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_hdr)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_hdr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_hdr)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7250,100 +7748,100 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":867 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":923 * See the comments at the beginning of ``mio5.py`` * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) # <<<<<<<<<<<<<< * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":868 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":924 * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s0), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 868; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s0), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":869 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":925 * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 869; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":870 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":926 * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['arr'] = self.read_mi_matrix() * return res */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 870; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":871 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":927 * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return res */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 871; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":872 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":928 * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() * return res # <<<<<<<<<<<<<< @@ -7369,7 +7867,7 @@ return __pyx_r; } -/* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":851 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":907 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -7383,9 +7881,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_opaque"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hdr), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "hdr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hdr), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "hdr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_opaque(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_hdr), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 851; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_opaque(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_hdr), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7403,7 +7901,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":188 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -7438,7 +7936,7 @@ __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":194 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -7447,7 +7945,7 @@ */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":195 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -7456,7 +7954,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":197 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -7465,7 +7963,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":199 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -7475,7 +7973,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":200 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -7487,7 +7985,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":202 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":202 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -7498,7 +7996,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":204 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -7508,7 +8006,7 @@ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":205 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -7522,7 +8020,7 @@ } if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":206 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":206 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -7531,9 +8029,9 @@ */ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_11)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_14)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_14)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_14)); __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -7544,7 +8042,7 @@ } __pyx_L6:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":208 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -7554,7 +8052,7 @@ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":209 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -7568,7 +8066,7 @@ } if (__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":210 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":210 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< @@ -7577,9 +8075,9 @@ */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_12)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_15)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -7590,7 +8088,7 @@ } __pyx_L7:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":212 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -7599,7 +8097,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":213 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -7608,7 +8106,7 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":214 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -7617,7 +8115,7 @@ */ if (__pyx_v_copy_shape) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":217 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -7626,7 +8124,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":218 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -7635,7 +8133,7 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":219 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -7646,7 +8144,7 @@ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":220 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -7655,7 +8153,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":221 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -7668,7 +8166,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":223 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -7677,7 +8175,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":224 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -7688,7 +8186,7 @@ } __pyx_L8:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":225 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -7697,7 +8195,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":226 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -7706,7 +8204,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":227 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -7715,7 +8213,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":230 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -7724,7 +8222,7 @@ */ __pyx_v_f = NULL; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":231 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -7734,7 +8232,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":235 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -7743,7 +8241,7 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":237 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -7759,7 +8257,7 @@ } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":239 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -7775,7 +8273,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":242 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -7790,7 +8288,7 @@ } __pyx_L11:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":244 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -7800,7 +8298,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":245 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -7809,7 +8307,7 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":246 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -7824,7 +8322,7 @@ } if (!__pyx_t_2) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":247 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -7844,7 +8342,7 @@ } if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":248 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -7853,9 +8351,9 @@ */ __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; @@ -7866,7 +8364,7 @@ } __pyx_L13:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":249 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -7879,7 +8377,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":250 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -7892,7 +8390,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":251 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -7905,7 +8403,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":252 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -7918,7 +8416,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":253 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -7931,7 +8429,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":254 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -7944,7 +8442,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":255 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -7957,7 +8455,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":256 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -7970,7 +8468,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":257 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -7983,7 +8481,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":258 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -7996,7 +8494,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":259 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -8009,7 +8507,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":260 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -8022,7 +8520,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":261 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -8035,7 +8533,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":262 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -8048,7 +8546,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":263 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -8061,7 +8559,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":264 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -8074,7 +8572,7 @@ goto __pyx_L14; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":265 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":265 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -8088,7 +8586,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":267 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -8097,7 +8595,7 @@ */ __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_17), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -8114,7 +8612,7 @@ } __pyx_L14:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":268 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -8123,7 +8621,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":269 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":269 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -8136,7 +8634,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":271 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -8145,7 +8643,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":272 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -8154,7 +8652,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":273 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":273 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -8163,7 +8661,7 @@ */ __pyx_v_offset = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":276 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< @@ -8173,7 +8671,7 @@ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":277 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":277 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -8205,7 +8703,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":279 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -8218,7 +8716,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("__releasebuffer__"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":280 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -8228,7 +8726,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":281 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -8240,7 +8738,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":282 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -8250,7 +8748,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":283 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":283 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -8265,7 +8763,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":756 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -8278,7 +8776,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":757 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -8304,7 +8802,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":759 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -8317,7 +8815,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":760 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":760 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -8343,7 +8841,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":762 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -8356,7 +8854,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":763 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -8382,7 +8880,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":765 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -8395,7 +8893,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":766 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -8421,7 +8919,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":768 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -8434,7 +8932,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":769 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -8460,7 +8958,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":771 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -8494,7 +8992,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":778 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -8503,7 +9001,7 @@ */ __pyx_v_endian_detector = 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":779 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":779 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -8512,7 +9010,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":782 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -8531,7 +9029,7 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":783 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -8545,7 +9043,7 @@ __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":784 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":784 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -8568,7 +9066,7 @@ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 784; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":786 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -8593,7 +9091,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":787 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":787 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< @@ -8602,9 +9100,9 @@ */ __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_15)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_15)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_15)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_18)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_18)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_18)); __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -8615,7 +9113,7 @@ } __pyx_L5:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":789 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -8630,7 +9128,7 @@ } if (!__pyx_t_7) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":790 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -8650,7 +9148,7 @@ } if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":791 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":791 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -8659,9 +9157,9 @@ */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_13)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_13)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_13)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_16)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -8672,7 +9170,7 @@ } __pyx_L6:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":801 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -8689,7 +9187,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":802 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -8698,7 +9196,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":803 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -8707,7 +9205,7 @@ */ __pyx_v_f += 1; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":804 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":804 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -8717,7 +9215,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":806 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":806 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -8726,7 +9224,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":808 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -8736,7 +9234,7 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":809 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< @@ -8749,7 +9247,7 @@ __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":810 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -8759,7 +9257,7 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":811 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":811 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< @@ -8768,9 +9266,9 @@ */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_16)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_16)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_16)); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_19)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_19)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_19)); __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 811; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; @@ -8781,7 +9279,7 @@ } __pyx_L10:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":814 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< @@ -8800,7 +9298,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":815 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< @@ -8819,7 +9317,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":816 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< @@ -8838,7 +9336,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":817 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< @@ -8857,7 +9355,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":818 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< @@ -8876,7 +9374,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":819 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< @@ -8895,7 +9393,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":820 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< @@ -8914,7 +9412,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":821 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< @@ -8933,7 +9431,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":822 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< @@ -8952,7 +9450,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":823 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< @@ -8971,7 +9469,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":824 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< @@ -8990,7 +9488,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":825 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< @@ -9009,7 +9507,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":826 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< @@ -9028,7 +9526,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":827 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< @@ -9049,7 +9547,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":828 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< @@ -9070,7 +9568,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":829 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< @@ -9091,7 +9589,7 @@ goto __pyx_L11; } - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":830 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":830 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< @@ -9111,14 +9609,14 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":832 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_14), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_17), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 832; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); @@ -9134,7 +9632,7 @@ } __pyx_L11:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":833 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":833 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -9146,7 +9644,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":837 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -9160,7 +9658,7 @@ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":838 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":838 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -9189,7 +9687,7 @@ return __pyx_r; } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":953 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":953 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -9202,7 +9700,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("set_array_base"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":955 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -9212,7 +9710,7 @@ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":956 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":956 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -9224,7 +9722,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":958 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -9233,7 +9731,7 @@ */ Py_INCREF(__pyx_v_base); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":959 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -9244,7 +9742,7 @@ } __pyx_L3:; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":960 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -9253,7 +9751,7 @@ */ Py_XDECREF(__pyx_v_arr->base); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":961 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":961 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -9265,7 +9763,7 @@ __Pyx_RefNannyFinishContext(); } -/* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":963 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -9278,7 +9776,7 @@ int __pyx_t_1; __Pyx_RefNannySetupContext("get_array_base"); - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":964 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -9288,7 +9786,7 @@ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":965 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":965 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -9303,7 +9801,7 @@ } /*else*/ { - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/numpy.pxd":967 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":967 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -9390,6 +9888,7 @@ } static PyMethodDef __pyx_methods_5scipy_2io_6matlab_10mio5_utils_VarHeader5[] = { + {__Pyx_NAMESTR("set_dims"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarHeader5_set_dims, METH_O, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_10mio5_utils_10VarHeader5_set_dims)}, {0, 0, 0, 0} }; @@ -9565,7 +10064,6 @@ p->codecs = Py_None; Py_INCREF(Py_None); p->uint16_codec = Py_None; Py_INCREF(Py_None); p->cstream = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)Py_None); Py_INCREF(Py_None); - p->preader = Py_None; Py_INCREF(Py_None); p->U1_dtype = ((PyArray_Descr *)Py_None); Py_INCREF(Py_None); p->bool_dtype = ((PyArray_Descr *)Py_None); Py_INCREF(Py_None); if (__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5___new__(o, a, k) < 0) { @@ -9579,7 +10077,6 @@ Py_XDECREF(p->codecs); Py_XDECREF(p->uint16_codec); Py_XDECREF(((PyObject *)p->cstream)); - Py_XDECREF(p->preader); Py_XDECREF(((PyObject *)p->U1_dtype)); Py_XDECREF(((PyObject *)p->bool_dtype)); (*Py_TYPE(o)->tp_free)(o); @@ -9597,9 +10094,6 @@ if (p->cstream) { e = (*v)(((PyObject*)p->cstream), a); if (e) return e; } - if (p->preader) { - e = (*v)(p->preader, a); if (e) return e; - } if (p->U1_dtype) { e = (*v)(((PyObject*)p->U1_dtype), a); if (e) return e; } @@ -9621,9 +10115,6 @@ tmp = ((PyObject*)p->cstream); p->cstream = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); - tmp = ((PyObject*)p->preader); - p->preader = Py_None; Py_INCREF(Py_None); - Py_XDECREF(tmp); tmp = ((PyObject*)p->U1_dtype); p->U1_dtype = ((PyArray_Descr *)Py_None); Py_INCREF(Py_None); Py_XDECREF(tmp); @@ -9846,7 +10337,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mio5_utils"), - __Pyx_DOCSTR(__pyx_k_17), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_20), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -9859,24 +10350,24 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, {&__pyx_kp_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 0}, - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, - {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, - {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_s_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 0, 1, 0}, + {&__pyx_kp_s_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 0, 1, 0}, + {&__pyx_kp_s_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 0, 1, 0}, {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, {&__pyx_kp_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, - {&__pyx_n_s_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 0, 1, 1}, - {&__pyx_n_s_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 0, 1, 1}, + {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, + {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, + {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, - {&__pyx_n_s_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 1, 1}, {&__pyx_n_s_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 1, 1}, {&__pyx_n_s_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 1, 1}, {&__pyx_n_s_23, __pyx_k_23, sizeof(__pyx_k_23), 0, 0, 1, 1}, - {&__pyx_kp_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 0}, - {&__pyx_kp_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 0}, - {&__pyx_kp_u_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 1, 0, 0}, - {&__pyx_kp_u_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 1, 0, 0}, - {&__pyx_kp_u_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 1, 0, 0}, + {&__pyx_n_s_24, __pyx_k_24, sizeof(__pyx_k_24), 0, 0, 1, 1}, + {&__pyx_n_s_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 1, 1}, + {&__pyx_n_s_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 1, 1}, + {&__pyx_kp_s_27, __pyx_k_27, sizeof(__pyx_k_27), 0, 0, 1, 0}, + {&__pyx_kp_s_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 1, 0}, {&__pyx_kp_u_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 1, 0, 0}, {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, {&__pyx_kp_u_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0, 0}, @@ -9887,13 +10378,18 @@ {&__pyx_kp_u_35, __pyx_k_35, sizeof(__pyx_k_35), 0, 1, 0, 0}, {&__pyx_kp_u_36, __pyx_k_36, sizeof(__pyx_k_36), 0, 1, 0, 0}, {&__pyx_kp_u_37, __pyx_k_37, sizeof(__pyx_k_37), 0, 1, 0, 0}, + {&__pyx_kp_u_38, __pyx_k_38, sizeof(__pyx_k_38), 0, 1, 0, 0}, + {&__pyx_kp_u_39, __pyx_k_39, sizeof(__pyx_k_39), 0, 1, 0, 0}, {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_u_40, __pyx_k_40, sizeof(__pyx_k_40), 0, 1, 0, 0}, + {&__pyx_kp_u_41, __pyx_k_41, sizeof(__pyx_k_41), 0, 1, 0, 0}, {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, {&__pyx_kp_s_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 1, 0}, {&__pyx_kp_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 0}, {&__pyx_kp_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 0}, {&__pyx_n_s__F, __pyx_k__F, sizeof(__pyx_k__F), 0, 0, 1, 1}, + {&__pyx_n_s__MDTYPES, __pyx_k__MDTYPES, sizeof(__pyx_k__MDTYPES), 0, 0, 1, 1}, {&__pyx_n_s__MatlabFunction, __pyx_k__MatlabFunction, sizeof(__pyx_k__MatlabFunction), 0, 0, 1, 1}, {&__pyx_n_s__MatlabObject, __pyx_k__MatlabObject, sizeof(__pyx_k__MatlabObject), 0, 0, 1, 1}, {&__pyx_n_s__MatlabOpaque, __pyx_k__MatlabOpaque, sizeof(__pyx_k__MatlabOpaque), 0, 0, 1, 1}, @@ -9904,6 +10400,7 @@ {&__pyx_n_s__U, __pyx_k__U, sizeof(__pyx_k__U), 0, 0, 1, 1}, {&__pyx_n_s__U1_dtype, __pyx_k__U1_dtype, sizeof(__pyx_k__U1_dtype), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s__VarHeader5, __pyx_k__VarHeader5, sizeof(__pyx_k__VarHeader5), 0, 0, 1, 1}, {&__pyx_n_s__VarReader5, __pyx_k__VarReader5, sizeof(__pyx_k__VarReader5), 0, 0, 1, 1}, {&__pyx_n_s____dict__, __pyx_k____dict__, sizeof(__pyx_k____dict__), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, @@ -9926,6 +10423,7 @@ {&__pyx_n_s__chars_as_strings, __pyx_k__chars_as_strings, sizeof(__pyx_k__chars_as_strings), 0, 0, 1, 1}, {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, {&__pyx_n_s__class_dtypes, __pyx_k__class_dtypes, sizeof(__pyx_k__class_dtypes), 0, 0, 1, 1}, + {&__pyx_n_s__classes, __pyx_k__classes, sizeof(__pyx_k__classes), 0, 0, 1, 1}, {&__pyx_n_s__codecs, __pyx_k__codecs, sizeof(__pyx_k__codecs), 0, 0, 1, 1}, {&__pyx_n_s__copy, __pyx_k__copy, sizeof(__pyx_k__copy), 0, 0, 1, 1}, {&__pyx_n_s__cread_fieldnames, __pyx_k__cread_fieldnames, sizeof(__pyx_k__cread_fieldnames), 0, 0, 1, 1}, @@ -9940,6 +10438,8 @@ {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, {&__pyx_n_s__dtypes, __pyx_k__dtypes, sizeof(__pyx_k__dtypes), 0, 0, 1, 1}, {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__encode, __pyx_k__encode, sizeof(__pyx_k__encode), 0, 0, 1, 1}, + {&__pyx_n_s__enumerate, __pyx_k__enumerate, sizeof(__pyx_k__enumerate), 0, 0, 1, 1}, {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, @@ -9998,6 +10498,7 @@ {&__pyx_n_s__s2, __pyx_k__s2, sizeof(__pyx_k__s2), 0, 0, 1, 1}, {&__pyx_n_s__scipy, __pyx_k__scipy, sizeof(__pyx_k__scipy), 0, 0, 1, 1}, {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__set_dims, __pyx_k__set_dims, sizeof(__pyx_k__set_dims), 0, 0, 1, 1}, {&__pyx_n_s__set_stream, __pyx_k__set_stream, sizeof(__pyx_k__set_stream), 0, 0, 1, 1}, {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, {&__pyx_n_s__size_from_header, __pyx_k__size_from_header, sizeof(__pyx_k__size_from_header), 0, 0, 1, 1}, @@ -10018,10 +10519,11 @@ {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 274; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 431; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 457; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; @@ -10030,6 +10532,7 @@ static int __Pyx_InitGlobals(void) { if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; @@ -10076,7 +10579,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio5_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_17), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio5_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_20), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -10098,8 +10601,8 @@ __pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE = ((PyArray_Descr *)Py_None); Py_INCREF(Py_None); /*--- Function export code ---*/ /*--- Type init code ---*/ - if (PyType_Ready(&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarHeader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "VarHeader5", (PyObject *)&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarHeader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarHeader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "VarHeader5", (PyObject *)&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarHeader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5 = &__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarHeader5; __pyx_vtabptr_5scipy_2io_6matlab_10mio5_utils_VarReader5 = &__pyx_vtable_5scipy_2io_6matlab_10mio5_utils_VarReader5; #if PY_MAJOR_VERSION >= 3 @@ -10141,9 +10644,9 @@ *(void(**)(void))&__pyx_vtable_5scipy_2io_6matlab_10mio5_utils_VarReader5.read_struct = (void(*)(void))__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct; *(void(**)(void))&__pyx_vtable_5scipy_2io_6matlab_10mio5_utils_VarReader5.read_opaque = (void(*)(void))__pyx_f_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque; #endif - if (PyType_Ready(&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetVtable(__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5.tp_dict, __pyx_vtabptr_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__Pyx_SetAttrString(__pyx_m, "VarReader5", (PyObject *)&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyType_Ready(&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetVtable(__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5.tp_dict, __pyx_vtabptr_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "VarReader5", (PyObject *)&__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarReader5 = &__pyx_type_5scipy_2io_6matlab_10mio5_utils_VarReader5; /*--- Type import code ---*/ __pyx_ptype_7cpython_4bool_bool = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "bool", sizeof(PyBoolObject), 0); if (unlikely(!__pyx_ptype_7cpython_4bool_bool)) {__pyx_filename = __pyx_f[2]; __pyx_lineno = 8; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -10160,7 +10663,7 @@ Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; /*--- Execution code ---*/ - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":15 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":15 * ''' * * import sys # <<<<<<<<<<<<<< @@ -10172,12 +10675,12 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 15; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":17 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":17 * import sys * * from copy import copy as pycopy # <<<<<<<<<<<<<< * - * from cpython cimport Py_INCREF, Py_DECREF + * from libc.stdlib cimport calloc, free */ __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); @@ -10193,26 +10696,26 @@ __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":29 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":32 * PyBytes_FromStringAndSize * * import numpy as np # <<<<<<<<<<<<<< * from numpy.compat import asbytes, asstr * cimport numpy as cnp */ - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":30 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":33 * * import numpy as np * from numpy.compat import asbytes, asstr # <<<<<<<<<<<<<< * cimport numpy as cnp * */ - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_n_s__asbytes)); PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__asbytes)); @@ -10220,20 +10723,20 @@ __Pyx_INCREF(((PyObject *)__pyx_n_s__asstr)); PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__asstr)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__asstr)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_18), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asbytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asbytes); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__asbytes, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__asbytes, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asstr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__asstr); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__asstr, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__asstr, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":52 * # Numpy must be initialized before any code using the numpy C-API * # directly * cnp.import_array() # <<<<<<<<<<<<<< @@ -10242,32 +10745,32 @@ */ import_array(); - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":59 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":62 * * cimport streams * import scipy.io.matlab.miobase as miob # <<<<<<<<<<<<<< * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_n_s_20)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_20)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_20)); - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_19), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_n_s_23)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_23)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_22), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__miob, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 59; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__miob, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":60 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":63 * cimport streams * import scipy.io.matlab.miobase as miob * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings # <<<<<<<<<<<<<< * import scipy.io.matlab.mio5_params as mio5p * import scipy.sparse */ - __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyList_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_INCREF(((PyObject *)__pyx_n_s__squeeze_element)); PyList_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_n_s__squeeze_element)); @@ -10275,153 +10778,163 @@ __Pyx_INCREF(((PyObject *)__pyx_n_s__chars_to_strings)); PyList_SET_ITEM(__pyx_t_3, 1, ((PyObject *)__pyx_n_s__chars_to_strings)); __Pyx_GIVEREF(((PyObject *)__pyx_n_s__chars_to_strings)); - __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_21), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_24), ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__squeeze_element); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__squeeze_element, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__squeeze_element, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chars_to_strings, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__chars_to_strings, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":61 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":64 * import scipy.io.matlab.miobase as miob * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p # <<<<<<<<<<<<<< * import scipy.sparse * */ - __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(((PyObject *)__pyx_n_s_20)); - PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_20)); - __Pyx_GIVEREF(((PyObject *)__pyx_n_s_20)); - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_22), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_n_s_23)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s_23)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s_23)); + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_25), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mio5p, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 61; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__mio5p, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":62 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":65 * from scipy.io.matlab.mio_utils import squeeze_element, chars_to_strings * import scipy.io.matlab.mio5_params as mio5p * import scipy.sparse # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_23), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_Import(((PyObject *)__pyx_n_s_26), 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scipy, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scipy, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":102 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":105 * mxOBJECT_CLASS_FROM_MATRIX_H = 18 * * sys_is_le = sys.byteorder == 'little' # <<<<<<<<<<<<<< * native_code = sys_is_le and '<' or '>' * swapped_code = sys_is_le and '>' or '<' */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__byteorder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__byteorder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__little), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_n_s__little), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys_is_le, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__sys_is_le, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":103 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":106 * * sys_is_le = sys.byteorder == 'little' * native_code = sys_is_le and '<' or '>' # <<<<<<<<<<<<<< * swapped_code = sys_is_le and '>' or '<' * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); - __pyx_t_2 = __pyx_kp_s_24; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); + __pyx_t_2 = __pyx_kp_s_27; } else { __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; } - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_4) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); - __pyx_t_3 = __pyx_kp_s_25; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_28)); + __pyx_t_3 = __pyx_kp_s_28; } else { __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__native_code, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__native_code, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":104 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":107 * sys_is_le = sys.byteorder == 'little' * native_code = sys_is_le and '<' or '>' * swapped_code = sys_is_le and '>' or '<' # <<<<<<<<<<<<<< * * cdef cnp.dtype OPAQUE_DTYPE = mio5p.OPAQUE_DTYPE */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__sys_is_le); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_t_4) { __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_25)); - __pyx_t_2 = __pyx_kp_s_25; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_28)); + __pyx_t_2 = __pyx_kp_s_28; } else { __pyx_t_2 = __pyx_t_3; __pyx_t_3 = 0; } - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (!__pyx_t_4) { __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_INCREF(((PyObject *)__pyx_kp_s_24)); - __pyx_t_3 = __pyx_kp_s_24; + __Pyx_INCREF(((PyObject *)__pyx_kp_s_27)); + __pyx_t_3 = __pyx_kp_s_27; } else { __pyx_t_3 = __pyx_t_2; __pyx_t_2 = 0; } - if (PyObject_SetAttr(__pyx_m, __pyx_n_s__swapped_code, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__swapped_code, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":106 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":109 * swapped_code = sys_is_le and '>' or '<' * * cdef cnp.dtype OPAQUE_DTYPE = mio5p.OPAQUE_DTYPE # <<<<<<<<<<<<<< * * */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__OPAQUE_DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__OPAQUE_DTYPE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)); __Pyx_DECREF(((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)); __Pyx_GIVEREF(__pyx_t_2); __pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE = ((PyArray_Descr *)__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/wrk/scipy/scipy/scipy/io/matlab/mio5_utils.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":1 * ''' Cython mio5 utility routines (-*- python -*- like) # <<<<<<<<<<<<<< * * ''' */ __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarHeader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__set_dims); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_29), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__set_stream); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -10430,7 +10943,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_26), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_30), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10440,7 +10953,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_27), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_31), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10450,7 +10963,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_28), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_32), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10460,7 +10973,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_29), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_33), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10470,7 +10983,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_30), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_34), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10480,7 +10993,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_31), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_35), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10490,7 +11003,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_32), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_36), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10500,7 +11013,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_33), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_37), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10510,7 +11023,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_34), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_38), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10520,7 +11033,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_35), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_39), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10530,7 +11043,7 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_36), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_40), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__VarReader5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); @@ -10540,12 +11053,12 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_5, "__doc__"); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_37), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_41), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "/usr/local/lib/python2.6/dist-packages/Cython-0.13-py2.6-linux-i686.egg/Cython/Includes/cpython/type.pxd":2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/cpython/type.pxd":2 * * cdef extern from "Python.h": # <<<<<<<<<<<<<< * # The C structure of the objects used to describe built-in types. @@ -11377,6 +11890,58 @@ } } +static CYTHON_INLINE npy_int32 __Pyx_PyInt_from_py_npy_int32(PyObject* x) { + const npy_int32 neg_one = (npy_int32)-1, const_zero = (npy_int32)0; + const int is_unsigned = const_zero < neg_one; + if (sizeof(npy_int32) == sizeof(char)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedChar(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedChar(x); + } else if (sizeof(npy_int32) == sizeof(short)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedShort(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedShort(x); + } else if (sizeof(npy_int32) == sizeof(int)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedInt(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedInt(x); + } else if (sizeof(npy_int32) == sizeof(long)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedLong(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedLong(x); + } else if (sizeof(npy_int32) == sizeof(PY_LONG_LONG)) { + if (is_unsigned) + return (npy_int32)__Pyx_PyInt_AsUnsignedLongLong(x); + else + return (npy_int32)__Pyx_PyInt_AsSignedLongLong(x); + } else { + npy_int32 val; + PyObject *v = __Pyx_PyNumber_Int(x); + #if PY_VERSION_HEX < 0x03000000 + if (likely(v) && !PyLong_Check(v)) { + PyObject *tmp = v; + v = PyNumber_Long(tmp); + Py_DECREF(tmp); + } + #endif + if (likely(v)) { + int one = 1; int is_little = (int)*(unsigned char *)&one; + unsigned char *bytes = (unsigned char *)&val; + int ret = _PyLong_AsByteArray((PyLongObject *)v, + bytes, sizeof(val), + is_little, !is_unsigned); + Py_DECREF(v); + if (likely(!ret)) + return val; + } + return (npy_int32)-1; + } +} + #if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:28 UTC (rev 6865) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:41 UTC (rev 6866) @@ -16,6 +16,9 @@ from copy import copy as pycopy +from libc.stdlib cimport calloc, free +from libc.string cimport strcmp, strlen + from cpython cimport Py_INCREF, Py_DECREF from cpython cimport PyObject @@ -833,14 +836,34 @@ cdef object names = self.read_int8_string() field_names = [] n_names = PyBytes_Size(names) // namelength - cdef char *n_ptr = names + # Make n_duplicates and pointer arrays + cdef: + int *n_duplicates + char **name_ptrs + n_duplicates = calloc(n_names, sizeof(int)) + name_ptrs = calloc(n_names, sizeof(char *)) + cdef: + char *n_ptr = names + int j, dup_no for i in range(n_names): - name = PyBytes_FromString(n_ptr) - field_names.append(asstr(name)) + name = asstr(PyBytes_FromString(n_ptr)) + # Check if this is a duplicate field, rename if so + name_ptrs[i] = n_ptr + dup_no = 0 + for j in range(i): + if strcmp(n_ptr, name_ptrs[j]) == 0: # the same + n_duplicates[j] += 1 + dup_no = n_duplicates[j] + break + if dup_no != 0: + name = '_%d_%s' % (dup_no, name) + field_names.append(name) n_ptr += namelength + free(n_duplicates) + free(name_ptrs) n_names_ptr[0] = n_names return field_names - + cpdef cnp.ndarray read_struct(self, VarHeader5 header): ''' Read struct or object array from stream Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:28 UTC (rev 6865) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:41 UTC (rev 6866) @@ -636,12 +636,12 @@ savemat_future(stream, {'c': c}) d = loadmat(stream, struct_as_record=False) c2 = d['c'][0,0] - yield assert_equal, c2.field1, 1 - yield assert_equal, c2.field2, 'a string' + assert_equal(c2.field1, 1) + assert_equal(c2.field2, 'a string') d = loadmat(stream, struct_as_record=True) c2 = d['c'][0,0] - yield assert_equal, c2['field1'], 1 - yield assert_equal, c2['field2'], 'a string' + assert_equal(c2['field1'], 1) + assert_equal(c2['field2'], 'a string') def test_read_opts(): @@ -790,5 +790,15 @@ res = loadmat(stream) assert_array_equal(res['a'], out_arr_u) + +def test_fieldnames(): + # Check that field names are as expected + stream = BytesIO() + savemat_future(stream, {'a': {'a':1, 'b':2}}) + res = loadmat(stream) + field_names = res['a'].dtype.names + assert_equal(set(field_names), set(('a', 'b'))) + + if __name__ == "__main__": run_module_suite() Modified: trunk/scipy/io/matlab/tests/test_pathological.py =================================================================== --- trunk/scipy/io/matlab/tests/test_pathological.py 2010-11-12 00:56:28 UTC (rev 6865) +++ trunk/scipy/io/matlab/tests/test_pathological.py 2010-11-12 00:56:41 UTC (rev 6866) @@ -29,3 +29,6 @@ # Extracted using mio5.varmats_from_mat multi_fname = pjoin(TEST_DATA_PATH, 'nasty_duplicate_fieldnames.mat') vars = loadmat(multi_fname) + funny_names = vars['Summary'].dtype.names + assert_true(set(['_1_Station_Q', '_2_Station_Q', + '_3_Station_Q']).issubset(funny_names)) From scipy-svn at scipy.org Thu Nov 11 19:56:46 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:46 -0600 (CST) Subject: [Scipy-svn] r6867 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005646.3282D32369@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:45 -0600 (Thu, 11 Nov 2010) New Revision: 6867 Modified: trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/tests/test_mio.py Log: NF - added variable_names list to top level load API Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-12 00:56:41 UTC (rev 6866) +++ trunk/scipy/io/matlab/mio.py 2010-11-12 00:56:45 UTC (rev 6867) @@ -123,6 +123,12 @@ %(append_arg)s %(load_args)s %(struct_arg)s + variable_names : None or sequence + If None (the default) - read all variables in file. Otherwise + `variable_names` should be a sequence of strings, giving names of the + matlab variables to read from the file. The reader will skip any + variable with a name not in this sequence, possibly saving some read + processing. Returns ------- @@ -138,8 +144,13 @@ files. Because scipy does not supply one, we do not implement the HDF5 / 7.3 interface here. ''' + if 'variable_names' in kwargs: + variable_names = kwargs['variable_names'] + del kwargs['variable_names'] + else: + variable_names = None MR = mat_reader_factory(file_name, appendmat, **kwargs) - matfile_dict = MR.get_variables() + matfile_dict = MR.get_variables(variable_names) if mdict is not None: mdict.update(matfile_dict) else: Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:41 UTC (rev 6866) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:45 UTC (rev 6867) @@ -800,5 +800,19 @@ assert_equal(set(field_names), set(('a', 'b'))) +def test_loadmat_varnames(): + # Test that we can get just one variable from a mat file using loadmat + eg_file = pjoin(test_data_path, 'testmulti_7.4_GLNX86.mat') + sys_v_names = ['__globals__', + '__header__', + '__version__'] + vars = loadmat(eg_file) + assert_equal(set(vars.keys()), set(['a', 'theta'] + sys_v_names)) + vars = loadmat(eg_file, variable_names=['a']) + assert_equal(set(vars.keys()), set(['a'] + sys_v_names)) + vars = loadmat(eg_file, variable_names=['theta']) + assert_equal(set(vars.keys()), set(['theta'] + sys_v_names)) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Thu Nov 11 19:56:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:56:57 -0600 (CST) Subject: [Scipy-svn] r6868 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005657.5291332368@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:56:57 -0600 (Thu, 11 Nov 2010) New Revision: 6868 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/mio5_params.py trunk/scipy/io/matlab/mio5_utils.c trunk/scipy/io/matlab/mio5_utils.pyx trunk/scipy/io/matlab/tests/test_mio.py Log: BF - filled in some missing output types; return complex16 for matlab complex 16 input Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:45 UTC (rev 6867) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:56:57 UTC (rev 6868) @@ -633,6 +633,8 @@ try: mclass = NP_TO_MXTYPES[arr.dtype.str[1:]] except KeyError: + # No matching matlab type, probably complex256 / float128 / float96 + # Cast data to complex128 / float64. if imagf: arr = arr.astype('c128') else: Modified: trunk/scipy/io/matlab/mio5_params.py =================================================================== --- trunk/scipy/io/matlab/mio5_params.py 2010-11-12 00:56:45 UTC (rev 6867) +++ trunk/scipy/io/matlab/mio5_params.py 2010-11-12 00:56:57 UTC (rev 6868) @@ -100,14 +100,14 @@ 'c16': miDOUBLE, 'f4': miSINGLE, 'c8': miSINGLE, + 'i8': miINT64, + 'i4': miINT32, + 'i2': miINT16, 'i1': miINT8, - 'i2': miINT16, - 'i4': miINT32, - 'i8': miINT64, + 'u8': miUINT64, + 'u4': miUINT32, + 'u2': miUINT16, 'u1': miUINT8, - 'u2': miUINT16, - 'u4': miUINT32, - 'u8': miUINT64, 'S1': miUINT8, 'U1': miUTF16, } @@ -123,7 +123,9 @@ 'i8': mxINT64_CLASS, 'i4': mxINT32_CLASS, 'i2': mxINT16_CLASS, + 'i1': mxINT8_CLASS, 'u8': mxUINT64_CLASS, + 'u4': mxUINT32_CLASS, 'u2': mxUINT16_CLASS, 'u1': mxUINT8_CLASS, 'S1': mxUINT8_CLASS, Modified: trunk/scipy/io/matlab/mio5_utils.c =================================================================== --- trunk/scipy/io/matlab/mio5_utils.c 2010-11-12 00:56:45 UTC (rev 6867) +++ trunk/scipy/io/matlab/mio5_utils.c 2010-11-12 00:56:57 UTC (rev 6868) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.13 on Mon Oct 11 20:27:08 2010 */ +/* Generated by Cython 0.13 on Tue Oct 12 04:08:15 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -1121,11 +1121,11 @@ static char __pyx_k_34[] = "VarReader5.read_header (line 522)"; static char __pyx_k_35[] = "VarReader5.array_from_header (line 624)"; static char __pyx_k_36[] = "VarReader5.read_real_complex (line 690)"; -static char __pyx_k_37[] = "VarReader5.read_char (line 737)"; -static char __pyx_k_38[] = "VarReader5.read_cells (line 806)"; -static char __pyx_k_39[] = "VarReader5.read_fieldnames (line 819)"; -static char __pyx_k_40[] = "VarReader5.read_struct (line 867)"; -static char __pyx_k_41[] = "VarReader5.read_opaque (line 907)"; +static char __pyx_k_37[] = "VarReader5.read_char (line 743)"; +static char __pyx_k_38[] = "VarReader5.read_cells (line 812)"; +static char __pyx_k_39[] = "VarReader5.read_fieldnames (line 825)"; +static char __pyx_k_40[] = "VarReader5.read_struct (line 873)"; +static char __pyx_k_41[] = "VarReader5.read_opaque (line 913)"; static char __pyx_k__B[] = "B"; static char __pyx_k__F[] = "F"; static char __pyx_k__H[] = "H"; @@ -1146,18 +1146,21 @@ static char __pyx_k__Zd[] = "Zd"; static char __pyx_k__Zf[] = "Zf"; static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__c8[] = "c8"; static char __pyx_k__np[] = "np"; static char __pyx_k__s0[] = "s0"; static char __pyx_k__s1[] = "s1"; static char __pyx_k__s2[] = "s2"; static char __pyx_k__arr[] = "arr"; static char __pyx_k__buf[] = "buf"; +static char __pyx_k__c16[] = "c16"; static char __pyx_k__obj[] = "obj"; static char __pyx_k__sys[] = "sys"; static char __pyx_k__base[] = "base"; static char __pyx_k__bool[] = "bool"; static char __pyx_k__copy[] = "copy"; static char __pyx_k__dims[] = "dims"; +static char __pyx_k__imag[] = "imag"; static char __pyx_k__miob[] = "miob"; static char __pyx_k__name[] = "name"; static char __pyx_k__ndim[] = "ndim"; @@ -1343,6 +1346,8 @@ static PyObject *__pyx_n_s__buffer; static PyObject *__pyx_n_s__byte_order; static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__c16; +static PyObject *__pyx_n_s__c8; static PyObject *__pyx_n_s__chars_as_strings; static PyObject *__pyx_n_s__chars_to_strings; static PyObject *__pyx_n_s__class_dtypes; @@ -1366,6 +1371,7 @@ static PyObject *__pyx_n_s__fields; static PyObject *__pyx_n_s__format; static PyObject *__pyx_n_s__header; +static PyObject *__pyx_n_s__imag; static PyObject *__pyx_n_s__is_complex; static PyObject *__pyx_n_s__is_global; static PyObject *__pyx_n_s__is_logical; @@ -1441,6 +1447,7 @@ static PyObject *__pyx_n_s__uint8; static PyObject *__pyx_int_0; static PyObject *__pyx_int_1; +static PyObject *__pyx_int_4; static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_15; @@ -5305,6 +5312,7 @@ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; struct __pyx_opt_args_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_numeric __pyx_t_4; + int __pyx_t_5; __Pyx_RefNannySetupContext("read_real_complex"); __pyx_v_res = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_res_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -5347,7 +5355,7 @@ * # avoid array copy to save memory * res = self.read_numeric(False) # <<<<<<<<<<<<<< * res_j = self.read_numeric(False) - * res = res + (res_j * 1j) + * # Use c8 for f4s and c16 for f8 input. Just ``res = res + res_j * */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 0; @@ -5361,8 +5369,8 @@ * # avoid array copy to save memory * res = self.read_numeric(False) * res_j = self.read_numeric(False) # <<<<<<<<<<<<<< - * res = res + (res_j * 1j) - * else: + * # Use c8 for f4s and c16 for f8 input. Just ``res = res + res_j * + * # 1j`` upcasts to c16 regardless of input type. */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 0; @@ -5372,45 +5380,101 @@ __pyx_v_res_j = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":698 - * res = self.read_numeric(False) - * res_j = self.read_numeric(False) - * res = res + (res_j * 1j) # <<<<<<<<<<<<<< - * else: - * res = self.read_numeric() + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":700 + * # Use c8 for f4s and c16 for f8 input. Just ``res = res + res_j * + * # 1j`` upcasts to c16 regardless of input type. + * if res.itemsize == 4: # <<<<<<<<<<<<<< + * res = res.astype('c8') + * else: */ - __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__itemsize); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_res_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_1, __pyx_int_4, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_res), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 698; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(((PyObject *)__pyx_v_res)); - __pyx_v_res = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + if (__pyx_t_5) { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":701 + * # 1j`` upcasts to c16 regardless of input type. + * if res.itemsize == 4: + * res = res.astype('c8') # <<<<<<<<<<<<<< + * else: + * res = res.astype('c16') + */ + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c8)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__c8)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c8)); + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_res)); + __pyx_v_res = ((PyArrayObject *)__pyx_t_2); + __pyx_t_2 = 0; + goto __pyx_L4; + } + /*else*/ { + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":703 + * res = res.astype('c8') + * else: + * res = res.astype('c16') # <<<<<<<<<<<<<< + * res.imag = res_j + * else: + */ + __pyx_t_2 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__c16)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__c16)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__c16)); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 703; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_res)); + __pyx_v_res = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; + } + __pyx_L4:; + + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":704 + * else: + * res = res.astype('c16') + * res.imag = res_j # <<<<<<<<<<<<<< + * else: + * res = self.read_numeric() + */ + if (PyObject_SetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__imag, ((PyObject *)__pyx_v_res_j)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 704; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } /*else*/ { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":700 - * res = res + (res_j * 1j) + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":706 + * res.imag = res_j * else: * res = self.read_numeric() # <<<<<<<<<<<<<< * return res.reshape(header.dims[::-1]).T * */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 700; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 706; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(((PyObject *)__pyx_v_res)); - __pyx_v_res = ((PyArrayObject *)__pyx_t_1); - __pyx_t_1 = 0; + __pyx_v_res = ((PyArrayObject *)__pyx_t_3); + __pyx_t_3 = 0; } __pyx_L3:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":701 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":707 * else: * res = self.read_numeric() * return res.reshape(header.dims[::-1]).T # <<<<<<<<<<<<<< @@ -5418,28 +5482,28 @@ * cdef object read_sparse(self, VarHeader5 header): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_3); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 701; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = ((PyArrayObject *)__pyx_t_3); - __pyx_t_3 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; goto __pyx_L0; __pyx_r = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); @@ -5492,7 +5556,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":703 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":709 * return res.reshape(header.dims[::-1]).T * * cdef object read_sparse(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5524,33 +5588,33 @@ __pyx_v_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_data_j = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":707 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":713 * cdef cnp.ndarray rowind, indptr, data, data_j * cdef size_t M, N, nnz * rowind = self.read_numeric() # <<<<<<<<<<<<<< * indptr = self.read_numeric() * if header.is_complex: */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 707; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_rowind)); __pyx_v_rowind = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":708 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":714 * cdef size_t M, N, nnz * rowind = self.read_numeric() * indptr = self.read_numeric() # <<<<<<<<<<<<<< * if header.is_complex: * # avoid array copy to save memory */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_indptr)); __pyx_v_indptr = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":709 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":715 * rowind = self.read_numeric() * indptr = self.read_numeric() * if header.is_complex: # <<<<<<<<<<<<<< @@ -5559,7 +5623,7 @@ */ if (__pyx_v_header->is_complex) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":711 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":717 * if header.is_complex: * # avoid array copy to save memory * data = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5568,13 +5632,13 @@ */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":712 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":718 * # avoid array copy to save memory * data = self.read_numeric(False) * data_j = self.read_numeric(False) # <<<<<<<<<<<<<< @@ -5583,28 +5647,28 @@ */ __pyx_t_2.__pyx_n = 1; __pyx_t_2.copy = 0; - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 712; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, &__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 718; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data_j)); __pyx_v_data_j = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":713 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":719 * data = self.read_numeric(False) * data_j = self.read_numeric(False) * data = data + (data_j * 1j) # <<<<<<<<<<<<<< * else: * data = self.read_numeric() */ - __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyComplex_FromDoubles(0.0, 1.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_v_data_j), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Add(((PyObject *)__pyx_v_data), __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 713; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 719; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; @@ -5612,14 +5676,14 @@ } /*else*/ { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":715 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":721 * data = data + (data_j * 1j) * else: * data = self.read_numeric() # <<<<<<<<<<<<<< * ''' From the matlab (TM) API documentation, last found here: * http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/ */ - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 715; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_numeric(__pyx_v_self, 0, NULL)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 721; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_1); @@ -5627,7 +5691,7 @@ } __pyx_L3:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":728 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":734 * to each rowind * ''' * M,N = header.dims # <<<<<<<<<<<<<< @@ -5637,86 +5701,86 @@ if (PyTuple_CheckExact(__pyx_v_header->dims) && likely(PyTuple_GET_SIZE(__pyx_v_header->dims) == 2)) { PyObject* tuple = __pyx_v_header->dims; __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_M = __pyx_t_4; __pyx_v_N = __pyx_t_5; } else { - __pyx_t_6 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetIter(__pyx_v_header->dims); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_6, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_AsSize_t(__pyx_t_1); if (unlikely((__pyx_t_5 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_6, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 728; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_EndUnpack(__pyx_t_6, 2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __pyx_v_M = __pyx_t_5; __pyx_v_N = __pyx_t_4; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":729 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":735 * ''' * M,N = header.dims * indptr = indptr[:N+1] # <<<<<<<<<<<<<< * nnz = indptr[-1] * rowind = rowind[:nnz] */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_indptr), 0, (__pyx_v_N + 1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 729; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_indptr)); __pyx_v_indptr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":730 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":736 * M,N = header.dims * indptr = indptr[:N+1] * nnz = indptr[-1] # <<<<<<<<<<<<<< * rowind = rowind[:nnz] * data = data[:nnz] */ - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_indptr), -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_AsSize_t(__pyx_t_3); if (unlikely((__pyx_t_4 == (size_t)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 736; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_v_nnz = __pyx_t_4; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":731 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":737 * indptr = indptr[:N+1] * nnz = indptr[-1] * rowind = rowind[:nnz] # <<<<<<<<<<<<<< * data = data[:nnz] * return scipy.sparse.csc_matrix( */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_rowind), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rowind)); __pyx_v_rowind = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":732 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":738 * nnz = indptr[-1] * rowind = rowind[:nnz] * data = data[:nnz] # <<<<<<<<<<<<<< * return scipy.sparse.csc_matrix( * (data,rowind,indptr), */ - __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PySequence_GetSlice(((PyObject *)__pyx_v_data), 0, __pyx_v_nnz); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_data)); __pyx_v_data = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":733 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":739 * rowind = rowind[:nnz] * data = data[:nnz] * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< @@ -5724,23 +5788,23 @@ * shape=(M,N)) */ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__sparse); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__csc_matrix); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":734 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":740 * data = data[:nnz] * return scipy.sparse.csc_matrix( * (data,rowind,indptr), # <<<<<<<<<<<<<< * shape=(M,N)) * */ - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 740; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(((PyObject *)__pyx_v_data)); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_v_data)); @@ -5751,34 +5815,34 @@ __Pyx_INCREF(((PyObject *)__pyx_v_indptr)); PyTuple_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_v_indptr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_indptr)); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":733 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":739 * rowind = rowind[:nnz] * data = data[:nnz] * return scipy.sparse.csc_matrix( # <<<<<<<<<<<<<< * (data,rowind,indptr), * shape=(M,N)) */ - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":735 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":741 * return scipy.sparse.csc_matrix( * (data,rowind,indptr), * shape=(M,N)) # <<<<<<<<<<<<<< * * cpdef cnp.ndarray read_char(self, VarHeader5 header): */ - __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyInt_FromSize_t(__pyx_v_M); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_PyInt_FromSize_t(__pyx_v_N); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 741; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); @@ -5786,9 +5850,9 @@ __Pyx_GIVEREF(__pyx_t_8); __pyx_t_7 = 0; __pyx_t_8 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__shape), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 733; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_6, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -5818,7 +5882,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":737 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":743 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -5856,19 +5920,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_char); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_char)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5877,7 +5941,7 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":764 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":770 * cnp.ndarray arr * cnp.dtype dt * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -5886,7 +5950,7 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":766 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":772 * cdef size_t length = self.size_from_header(header) * data = self.read_element( * &mdtype, &byte_count, &data_ptr, True) # <<<<<<<<<<<<<< @@ -5895,13 +5959,13 @@ */ __pyx_t_4.__pyx_n = 1; __pyx_t_4.copy = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_element(__pyx_v_self, (&__pyx_v_mdtype), (&__pyx_v_byte_count), ((void **)(&__pyx_v_data_ptr)), &__pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":769 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":775 * # There are mat files in the wild that have 0 byte count strings, but * # maybe with non-zero length. * if byte_count == 0: # <<<<<<<<<<<<<< @@ -5911,42 +5975,42 @@ __pyx_t_5 = (__pyx_v_byte_count == 0); if (__pyx_t_5) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":770 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":776 * # maybe with non-zero length. * if byte_count == 0: * arr = np.array(' ' * length, dtype='U') # <<<<<<<<<<<<<< * return np.ndarray(shape=header.dims, * dtype=self.U1_dtype, */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__array); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_2), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_2), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_2)); __Pyx_GIVEREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_6) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_6, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_6); __pyx_t_6 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":771 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":777 * if byte_count == 0: * arr = np.array(' ' * length, dtype='U') * return np.ndarray(shape=header.dims, # <<<<<<<<<<<<<< @@ -5954,38 +6018,38 @@ * buffer=arr, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":772 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":778 * arr = np.array(' ' * length, dtype='U') * return np.ndarray(shape=header.dims, * dtype=self.U1_dtype, # <<<<<<<<<<<<<< * buffer=arr, * order='F') */ - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":773 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":779 * return np.ndarray(shape=header.dims, * dtype=self.U1_dtype, * buffer=arr, # <<<<<<<<<<<<<< * order='F') * # Character data can be of apparently numerical types, */ - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_2, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; @@ -5993,7 +6057,7 @@ } __pyx_L3:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":779 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":785 * # a length 1 type encoding, like ascii, or length 2 type * # encoding * dt = self.dtypes[mdtype] # <<<<<<<<<<<<<< @@ -6005,7 +6069,7 @@ __Pyx_DECREF(((PyObject *)__pyx_v_dt)); __pyx_v_dt = ((PyArray_Descr *)__pyx_t_7); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":780 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":786 * # encoding * dt = self.dtypes[mdtype] * if mdtype == miUINT16: # <<<<<<<<<<<<<< @@ -6015,7 +6079,7 @@ __pyx_t_5 = (__pyx_v_mdtype == __pyx_e_5scipy_2io_6matlab_10mio5_utils_miUINT16); if (__pyx_t_5) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":781 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":787 * dt = self.dtypes[mdtype] * if mdtype == miUINT16: * codec = self.uint16_codec # <<<<<<<<<<<<<< @@ -6026,99 +6090,99 @@ __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = __pyx_v_self->uint16_codec; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":782 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":788 * if mdtype == miUINT16: * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only # <<<<<<<<<<<<<< * arr = np.ndarray(shape=(length,), * dtype=dt, */ - __pyx_t_1 = PyObject_GetItem(__pyx_v_self->codecs, ((PyObject *)__pyx_n_s__uint16_len)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetItem(__pyx_v_self->codecs, ((PyObject *)__pyx_n_s__uint16_len)); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_RichCompare(__pyx_t_1, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_6); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 788; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; if (__pyx_t_5) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":783 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":789 * codec = self.uint16_codec * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), # <<<<<<<<<<<<<< * dtype=dt, * buffer=data) */ - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyDict_New(); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__shape), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":784 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":790 * if self.codecs['uint16_len'] == 1: # need LSBs only * arr = np.ndarray(shape=(length,), * dtype=dt, # <<<<<<<<<<<<<< * buffer=data) * data = arr.astype(np.uint8).tostring() */ - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_dt)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":785 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":791 * arr = np.ndarray(shape=(length,), * dtype=dt, * buffer=data) # <<<<<<<<<<<<<< * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: */ - if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_6, ((PyObject *)__pyx_n_s__buffer), __pyx_v_data) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_6)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":786 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":792 * dtype=dt, * buffer=data) * data = arr.astype(np.uint8).tostring() # <<<<<<<<<<<<<< * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' */ - __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(((PyObject *)__pyx_v_arr), __pyx_n_s__astype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_6, __pyx_n_s__uint8); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tostring); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__tostring); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_v_data); @@ -6130,7 +6194,7 @@ goto __pyx_L4; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":787 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":793 * buffer=data) * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: # <<<<<<<<<<<<<< @@ -6148,7 +6212,7 @@ } if (__pyx_t_5) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":788 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":794 * data = arr.astype(np.uint8).tostring() * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' # <<<<<<<<<<<<<< @@ -6161,66 +6225,66 @@ goto __pyx_L4; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":789 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":795 * elif mdtype == miINT8 or mdtype == miUINT8: * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data # <<<<<<<<<<<<<< * codec = self.codecs[mdtype] * if not codec: */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = ((PySequence_Contains(__pyx_v_self->codecs, __pyx_t_1))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 789; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = ((PySequence_Contains(__pyx_v_self->codecs, __pyx_t_1))); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; if (__pyx_t_5) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":790 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":796 * codec = 'ascii' * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] # <<<<<<<<<<<<<< * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) */ - __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_v_self->codecs, __pyx_v_mdtype, sizeof(__pyx_t_5numpy_uint32_t)+1, __Pyx_PyInt_to_py_npy_uint32); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_codec); __pyx_v_codec = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":791 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":797 * elif mdtype in self.codecs: # encoded char data * codec = self.codecs[mdtype] * if not codec: # <<<<<<<<<<<<<< * raise TypeError('Do not support encoding %d' % mdtype) * else: */ - __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 791; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_v_codec); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_8 = (!__pyx_t_5); if (__pyx_t_8) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":792 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":798 * codec = self.codecs[mdtype] * if not codec: * raise TypeError('Do not support encoding %d' % mdtype) # <<<<<<<<<<<<<< * else: * raise ValueError('Type %d does not appear to be char type' */ - __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_10), __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_6)); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_t_6)); __Pyx_GIVEREF(((PyObject *)__pyx_t_6)); __pyx_t_6 = 0; - __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_builtin_TypeError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_6, 0, 0); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 792; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; @@ -6228,47 +6292,47 @@ } /*else*/ { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":795 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":801 * else: * raise ValueError('Type %d does not appear to be char type' * % mdtype) # <<<<<<<<<<<<<< * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters */ - __pyx_t_6 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyInt_to_py_npy_uint32(__pyx_v_mdtype); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 795; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_11), __pyx_t_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); PyTuple_SET_ITEM(__pyx_t_6, 0, ((PyObject *)__pyx_t_1)); __Pyx_GIVEREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_6, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_Raise(__pyx_t_1, 0, 0); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 794; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L4:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":796 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":802 * raise ValueError('Type %d does not appear to be char type' * % mdtype) * uc_str = data.decode(codec) # <<<<<<<<<<<<<< * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str, dtype='U') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_data, __pyx_n_s__decode); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(__pyx_v_codec); PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_v_codec); __Pyx_GIVEREF(__pyx_v_codec); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 796; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_6, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 802; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; @@ -6276,37 +6340,37 @@ __pyx_v_uc_str = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":798 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":804 * uc_str = data.decode(codec) * # cast to array to deal with 2, 4 byte width characters * arr = np.array(uc_str, dtype='U') # <<<<<<<<<<<<<< * # could take this to numpy C-API level, but probably not worth * # it */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__array); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_uc_str); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_uc_str); __Pyx_GIVEREF(__pyx_v_uc_str); - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__U)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_t_6, __pyx_t_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 798; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 804; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":801 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":807 * # could take this to numpy C-API level, but probably not worth * # it * return np.ndarray(shape=header.dims, # <<<<<<<<<<<<<< @@ -6314,38 +6378,38 @@ * buffer=arr, */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ndarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__shape), __pyx_v_header->dims) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":802 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":808 * # it * return np.ndarray(shape=header.dims, * dtype=self.U1_dtype, # <<<<<<<<<<<<<< * buffer=arr, * order='F') */ - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_self->U1_dtype)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":803 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":809 * return np.ndarray(shape=header.dims, * dtype=self.U1_dtype, * buffer=arr, # <<<<<<<<<<<<<< * order='F') * */ - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__buffer), ((PyObject *)__pyx_v_arr)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__order), ((PyObject *)__pyx_n_s__F)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 801; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 807; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -6370,7 +6434,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":737 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":743 * shape=(M,N)) * * cpdef cnp.ndarray read_char(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6384,9 +6448,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_char"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_char(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 743; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6404,7 +6468,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":806 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":812 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6443,19 +6507,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_cells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_cells); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_cells)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -6464,31 +6528,31 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":812 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":818 * cnp.ndarray[object, ndim=1] result * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) */ - __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_tupdims)); __pyx_v_tupdims = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":813 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":819 * # Account for fortran indexing of cells * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -6497,34 +6561,34 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":814 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":820 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * result[i] = self.read_mi_matrix() */ - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -6541,14 +6605,14 @@ } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":815 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":821 * cdef size_t length = self.size_from_header(header) * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< @@ -6559,21 +6623,21 @@ for (__pyx_t_11 = 0; __pyx_t_11 < __pyx_t_10; __pyx_t_11+=1) { __pyx_v_i = __pyx_t_11; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":816 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":822 * result = np.empty(length, dtype=object) * for i in range(length): * result[i] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return result.reshape(tupdims).T * */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_t_12 = __pyx_v_i; __pyx_t_6 = -1; if (unlikely(__pyx_t_12 >= (size_t)__pyx_bshape_0_result)) __pyx_t_6 = 0; if (unlikely(__pyx_t_6 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_6); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_13 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_12, __pyx_bstride_0_result); __Pyx_GOTREF(*__pyx_t_13); @@ -6583,7 +6647,7 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":817 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":823 * for i in range(length): * result[i] = self.read_mi_matrix() * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -6591,21 +6655,21 @@ * def read_fieldnames(self): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_v_tupdims)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_tupdims)); __Pyx_GIVEREF(((PyObject *)__pyx_v_tupdims)); - __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__T); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -6634,7 +6698,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":806 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":812 * order='F') * * cpdef cnp.ndarray read_cells(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -6648,9 +6712,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_cells"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_cells(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 806; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_cells(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 812; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6668,7 +6732,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":819 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":825 * return result.reshape(tupdims).T * * def read_fieldnames(self): # <<<<<<<<<<<<<< @@ -6684,7 +6748,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_fieldnames"); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":825 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":831 * ''' * cdef int n_names * return self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< @@ -6692,7 +6756,7 @@ * cdef inline object cread_fieldnames(self, int *n_names_ptr): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_fieldnames(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->cread_fieldnames(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -6710,7 +6774,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":827 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":833 * return self.cread_fieldnames(&n_names) * * cdef inline object cread_fieldnames(self, int *n_names_ptr): # <<<<<<<<<<<<<< @@ -6746,17 +6810,17 @@ __pyx_v_name = Py_None; __Pyx_INCREF(Py_None); __pyx_v_field_names = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":833 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":839 * object name, field_names * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) # <<<<<<<<<<<<<< * if res != 1: * raise ValueError('Only one value for namelength') */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, (&__pyx_v_namelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 833; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_into_int32s(__pyx_v_self, (&__pyx_v_namelength)); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 839; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = __pyx_t_1; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":834 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":840 * # Read field names into list * cdef int res = self.read_into_int32s(&namelength) * if res != 1: # <<<<<<<<<<<<<< @@ -6766,72 +6830,72 @@ __pyx_t_2 = (__pyx_v_res != 1); if (__pyx_t_2) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":835 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":841 * cdef int res = self.read_into_int32s(&namelength) * if res != 1: * raise ValueError('Only one value for namelength') # <<<<<<<<<<<<<< * cdef object names = self.read_int8_string() * field_names = [] */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_s_12)); PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_12)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_12)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_4, 0, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 835; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 841; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":836 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":842 * if res != 1: * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() # <<<<<<<<<<<<<< * field_names = [] * n_names = PyBytes_Size(names) // namelength */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 842; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_names = __pyx_t_4; __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":837 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":843 * raise ValueError('Only one value for namelength') * cdef object names = self.read_int8_string() * field_names = [] # <<<<<<<<<<<<<< * n_names = PyBytes_Size(names) // namelength * # Make n_duplicates and pointer arrays */ - __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 837; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyList_New(0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 843; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_4)); __Pyx_DECREF(__pyx_v_field_names); __pyx_v_field_names = ((PyObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":838 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":844 * cdef object names = self.read_int8_string() * field_names = [] * n_names = PyBytes_Size(names) // namelength # <<<<<<<<<<<<<< * # Make n_duplicates and pointer arrays * cdef: */ - __pyx_t_5 = PyBytes_Size(__pyx_v_names); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyBytes_Size(__pyx_v_names); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (unlikely(__pyx_v_namelength == 0)) { PyErr_Format(PyExc_ZeroDivisionError, "integer division or modulo by zero"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else if (sizeof(Py_ssize_t) == sizeof(long) && unlikely(__pyx_v_namelength == -1) && unlikely(UNARY_NEG_WOULD_OVERFLOW(__pyx_t_5))) { PyErr_Format(PyExc_OverflowError, "value too large to perform division"); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 838; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 844; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_v_n_names = __Pyx_div_Py_ssize_t(__pyx_t_5, __pyx_v_namelength); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":843 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":849 * int *n_duplicates * char **name_ptrs * n_duplicates = calloc(n_names, sizeof(int)) # <<<<<<<<<<<<<< @@ -6840,7 +6904,7 @@ */ __pyx_v_n_duplicates = ((int *)calloc(__pyx_v_n_names, (sizeof(int)))); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":844 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":850 * char **name_ptrs * n_duplicates = calloc(n_names, sizeof(int)) * name_ptrs = calloc(n_names, sizeof(char *)) # <<<<<<<<<<<<<< @@ -6849,17 +6913,17 @@ */ __pyx_v_name_ptrs = ((char **)calloc(__pyx_v_n_names, (sizeof(char *)))); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":846 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":852 * name_ptrs = calloc(n_names, sizeof(char *)) * cdef: * char *n_ptr = names # <<<<<<<<<<<<<< * int j, dup_no * for i in range(n_names): */ - __pyx_t_6 = PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 846; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyBytes_AsString(__pyx_v_names); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 852; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_n_ptr = __pyx_t_6; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":848 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":854 * char *n_ptr = names * int j, dup_no * for i in range(n_names): # <<<<<<<<<<<<<< @@ -6870,23 +6934,23 @@ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_1; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":849 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":855 * int j, dup_no * for i in range(n_names): * name = asstr(PyBytes_FromString(n_ptr)) # <<<<<<<<<<<<<< * # Check if this is a duplicate field, rename if so * name_ptrs[i] = n_ptr */ - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__asstr); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = ((PyObject *)PyBytes_FromString(__pyx_v_n_ptr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = ((PyObject *)PyBytes_FromString(__pyx_v_n_ptr)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 849; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, __pyx_t_8, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 855; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; @@ -6894,7 +6958,7 @@ __pyx_v_name = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":851 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":857 * name = asstr(PyBytes_FromString(n_ptr)) * # Check if this is a duplicate field, rename if so * name_ptrs[i] = n_ptr # <<<<<<<<<<<<<< @@ -6903,7 +6967,7 @@ */ (__pyx_v_name_ptrs[__pyx_v_i]) = __pyx_v_n_ptr; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":852 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":858 * # Check if this is a duplicate field, rename if so * name_ptrs[i] = n_ptr * dup_no = 0 # <<<<<<<<<<<<<< @@ -6912,7 +6976,7 @@ */ __pyx_v_dup_no = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":853 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":859 * name_ptrs[i] = n_ptr * dup_no = 0 * for j in range(i): # <<<<<<<<<<<<<< @@ -6923,7 +6987,7 @@ for (__pyx_t_10 = 0; __pyx_t_10 < __pyx_t_9; __pyx_t_10+=1) { __pyx_v_j = __pyx_t_10; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":854 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":860 * dup_no = 0 * for j in range(i): * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same # <<<<<<<<<<<<<< @@ -6933,7 +6997,7 @@ __pyx_t_2 = (strcmp(__pyx_v_n_ptr, (__pyx_v_name_ptrs[__pyx_v_j])) == 0); if (__pyx_t_2) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":855 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":861 * for j in range(i): * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same * n_duplicates[j] += 1 # <<<<<<<<<<<<<< @@ -6942,7 +7006,7 @@ */ (__pyx_v_n_duplicates[__pyx_v_j]) += 1; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":856 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":862 * if strcmp(n_ptr, name_ptrs[j]) == 0: # the same * n_duplicates[j] += 1 * dup_no = n_duplicates[j] # <<<<<<<<<<<<<< @@ -6951,7 +7015,7 @@ */ __pyx_v_dup_no = (__pyx_v_n_duplicates[__pyx_v_j]); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":857 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":863 * n_duplicates[j] += 1 * dup_no = n_duplicates[j] * break # <<<<<<<<<<<<<< @@ -6965,7 +7029,7 @@ } __pyx_L7_break:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":858 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":864 * dup_no = n_duplicates[j] * break * if dup_no != 0: # <<<<<<<<<<<<<< @@ -6975,16 +7039,16 @@ __pyx_t_2 = (__pyx_v_dup_no != 0); if (__pyx_t_2) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":859 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":865 * break * if dup_no != 0: * name = '_%d_%s' % (dup_no, name) # <<<<<<<<<<<<<< * field_names.append(name) * n_ptr += namelength */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_dup_no); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_dup_no); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -6992,7 +7056,7 @@ PyTuple_SET_ITEM(__pyx_t_8, 1, __pyx_v_name); __Pyx_GIVEREF(__pyx_v_name); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 859; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_13), __pyx_t_8); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 865; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_v_name); @@ -7002,18 +7066,18 @@ } __pyx_L9:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":860 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":866 * if dup_no != 0: * name = '_%d_%s' % (dup_no, name) * field_names.append(name) # <<<<<<<<<<<<<< * n_ptr += namelength * free(n_duplicates) */ - __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_field_names, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 860; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_PyObject_Append(__pyx_v_field_names, __pyx_v_name); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 866; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":861 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":867 * name = '_%d_%s' % (dup_no, name) * field_names.append(name) * n_ptr += namelength # <<<<<<<<<<<<<< @@ -7023,7 +7087,7 @@ __pyx_v_n_ptr += __pyx_v_namelength; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":862 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":868 * field_names.append(name) * n_ptr += namelength * free(n_duplicates) # <<<<<<<<<<<<<< @@ -7032,7 +7096,7 @@ */ free(__pyx_v_n_duplicates); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":863 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":869 * n_ptr += namelength * free(n_duplicates) * free(name_ptrs) # <<<<<<<<<<<<<< @@ -7041,7 +7105,7 @@ */ free(__pyx_v_name_ptrs); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":864 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":870 * free(n_duplicates) * free(name_ptrs) * n_names_ptr[0] = n_names # <<<<<<<<<<<<<< @@ -7050,7 +7114,7 @@ */ (__pyx_v_n_names_ptr[0]) = __pyx_v_n_names; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":865 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":871 * free(name_ptrs) * n_names_ptr[0] = n_names * return field_names # <<<<<<<<<<<<<< @@ -7079,7 +7143,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":867 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":873 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -7134,19 +7198,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_struct); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_struct)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_header)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_header)); __Pyx_GIVEREF(((PyObject *)__pyx_v_header)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7155,43 +7219,43 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":880 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":886 * object dt, tupdims * # Read field names into list * cdef object field_names = self.cread_fieldnames(&n_names) # <<<<<<<<<<<<<< * # Prepare struct array * tupdims = tuple(header.dims[::-1]) */ - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 880; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->cread_fieldnames(__pyx_v_self, (&__pyx_v_n_names)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 886; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_field_names = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":882 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":888 * cdef object field_names = self.cread_fieldnames(&n_names) * # Prepare struct array * tupdims = tuple(header.dims[::-1]) # <<<<<<<<<<<<<< * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays */ - __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PySlice_New(Py_None, Py_None, __pyx_int_neg_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_header->dims, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 882; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)&PyTuple_Type)), __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 888; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_tupdims); __pyx_v_tupdims = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":883 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":889 * # Prepare struct array * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) # <<<<<<<<<<<<<< @@ -7200,7 +7264,7 @@ */ __pyx_v_length = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->size_from_header(__pyx_v_self, __pyx_v_header); - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":884 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":890 * tupdims = tuple(header.dims[::-1]) * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays # <<<<<<<<<<<<<< @@ -7209,7 +7273,7 @@ */ if (__pyx_v_self->struct_as_record) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":885 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":891 * cdef size_t length = self.size_from_header(header) * if self.struct_as_record: # to record arrays * if not n_names: # <<<<<<<<<<<<<< @@ -7219,7 +7283,7 @@ __pyx_t_4 = (!__pyx_v_n_names); if (__pyx_t_4) { - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":889 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":895 * # representation we can use, falling back to empty * # object * return np.empty(tupdims, dtype=object).T # <<<<<<<<<<<<<< @@ -7227,28 +7291,28 @@ * rec_res = np.empty(length, dtype=dt) */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 889; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -7256,19 +7320,19 @@ } __pyx_L4:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":890 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":896 * # object * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] # <<<<<<<<<<<<<< * rec_res = np.empty(length, dtype=dt) * for i in range(length): */ - __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyList_New(0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_5 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_5); } else { - __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); } for (;;) { @@ -7281,7 +7345,7 @@ } else { __pyx_t_3 = PyIter_Next(__pyx_t_5); if (!__pyx_t_3) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_3); @@ -7289,7 +7353,7 @@ __Pyx_DECREF(__pyx_v_field_name); __pyx_v_field_name = __pyx_t_3; __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_field_name); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_field_name); @@ -7297,7 +7361,7 @@ __Pyx_INCREF(__pyx_builtin_object); PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_builtin_object); __Pyx_GIVEREF(__pyx_builtin_object); - if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 890; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyList_Append(__pyx_t_2, (PyObject*)__pyx_t_3))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 896; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; } __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -7306,39 +7370,39 @@ __pyx_v_dt = ((PyObject *)__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":891 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":897 * return np.empty(tupdims, dtype=object).T * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) # <<<<<<<<<<<<<< * for i in range(length): * for field_name in field_names: */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_v_dt) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 891; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_rec_res)); __pyx_v_rec_res = ((PyArrayObject *)__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":892 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":898 * dt = [(field_name, object) for field_name in field_names] * rec_res = np.empty(length, dtype=dt) * for i in range(length): # <<<<<<<<<<<<<< @@ -7349,7 +7413,7 @@ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":893 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":899 * rec_res = np.empty(length, dtype=dt) * for i in range(length): * for field_name in field_names: # <<<<<<<<<<<<<< @@ -7359,7 +7423,7 @@ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } for (;;) { @@ -7372,7 +7436,7 @@ } else { __pyx_t_2 = PyIter_Next(__pyx_t_1); if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 893; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_2); @@ -7381,25 +7445,25 @@ __pyx_v_field_name = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":894 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":900 * for i in range(length): * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_rec_res), __pyx_v_i, sizeof(int), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (PyObject_SetItem(__pyx_t_3, __pyx_v_field_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 894; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_3, __pyx_v_field_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 900; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":895 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":901 * for field_name in field_names: * rec_res[i][field_name] = self.read_mi_matrix() * return rec_res.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -7407,21 +7471,21 @@ * obj_template = mio5p.mat_struct() */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_rec_res), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 895; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -7429,62 +7493,62 @@ } __pyx_L3:; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":897 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":903 * return rec_res.reshape(tupdims).T * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() # <<<<<<<<<<<<<< * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__mio5p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mat_struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__mat_struct); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 897; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_obj_template); __pyx_v_obj_template = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":898 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":904 * # Backward compatibility with previous format * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names # <<<<<<<<<<<<<< * result = np.empty(length, dtype=object) * for i in range(length): */ - if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_n_s___fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 898; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_obj_template, __pyx_n_s___fieldnames, __pyx_v_field_names) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":899 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":905 * obj_template = mio5p.mat_struct() * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) # <<<<<<<<<<<<<< * for i in range(length): * item = pycopy(obj_template) */ - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_length); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__dtype), __pyx_builtin_object) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_1, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_9 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -7501,14 +7565,14 @@ } __pyx_bstride_0_result = __pyx_bstruct_result.strides[0]; __pyx_bshape_0_result = __pyx_bstruct_result.shape[0]; - if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 899; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_9 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_result)); __pyx_v_result = ((PyArrayObject *)__pyx_t_5); __pyx_t_5 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":900 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":906 * obj_template._fieldnames = field_names * result = np.empty(length, dtype=object) * for i in range(length): # <<<<<<<<<<<<<< @@ -7519,21 +7583,21 @@ for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_7; __pyx_t_8+=1) { __pyx_v_i = __pyx_t_8; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":901 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":907 * result = np.empty(length, dtype=object) * for i in range(length): * item = pycopy(obj_template) # <<<<<<<<<<<<<< * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() */ - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pycopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__pycopy); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_obj_template); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_obj_template); __Pyx_GIVEREF(__pyx_v_obj_template); - __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 901; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -7541,7 +7605,7 @@ __pyx_v_item = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":902 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":908 * for i in range(length): * item = pycopy(obj_template) * for name in field_names: # <<<<<<<<<<<<<< @@ -7551,7 +7615,7 @@ if (PyList_CheckExact(__pyx_v_field_names) || PyTuple_CheckExact(__pyx_v_field_names)) { __pyx_t_6 = 0; __pyx_t_1 = __pyx_v_field_names; __Pyx_INCREF(__pyx_t_1); } else { - __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = -1; __pyx_t_1 = PyObject_GetIter(__pyx_v_field_names); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); } for (;;) { @@ -7564,7 +7628,7 @@ } else { __pyx_t_2 = PyIter_Next(__pyx_t_1); if (!__pyx_t_2) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 902; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 908; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_2); @@ -7573,24 +7637,24 @@ __pyx_v_name = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":903 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":909 * item = pycopy(obj_template) * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() # <<<<<<<<<<<<<< * result[i] = item * return result.reshape(tupdims).T */ - __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s____dict__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_item, __pyx_n_s____dict__); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - if (PyObject_SetItem(__pyx_t_5, __pyx_v_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 903; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_5, __pyx_v_name, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 909; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; } __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":904 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":910 * for name in field_names: * item.__dict__[name] = self.read_mi_matrix() * result[i] = item # <<<<<<<<<<<<<< @@ -7605,7 +7669,7 @@ } else if (unlikely(__pyx_t_13 >= __pyx_bshape_0_result)) __pyx_t_14 = 0; if (unlikely(__pyx_t_14 != -1)) { __Pyx_RaiseBufferIndexError(__pyx_t_14); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 904; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 910; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_15 = __Pyx_BufPtrStrided1d(PyObject **, __pyx_bstruct_result.buf, __pyx_t_13, __pyx_bstride_0_result); __Pyx_GOTREF(*__pyx_t_15); @@ -7614,7 +7678,7 @@ __Pyx_GIVEREF(*__pyx_t_15); } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":905 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":911 * item.__dict__[name] = self.read_mi_matrix() * result[i] = item * return result.reshape(tupdims).T # <<<<<<<<<<<<<< @@ -7622,21 +7686,21 @@ * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): */ __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_result), __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tupdims); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tupdims); __Pyx_GIVEREF(__pyx_v_tupdims); - __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 905; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 911; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -7672,7 +7736,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":867 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":873 * return field_names * * cpdef cnp.ndarray read_struct(self, VarHeader5 header): # <<<<<<<<<<<<<< @@ -7686,9 +7750,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_struct"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_header), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "header", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_struct(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 867; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_struct(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_header), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 873; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -7706,7 +7770,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":907 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":913 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -7727,19 +7791,19 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__read_opaque); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_10mio5_utils_10VarReader5_read_opaque)) { __Pyx_XDECREF(((PyObject *)__pyx_r)); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_v_hdr)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_hdr)); __Pyx_GIVEREF(((PyObject *)__pyx_v_hdr)); - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -7748,100 +7812,100 @@ __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":923 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":929 * See the comments at the beginning of ``mio5.py`` * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) # <<<<<<<<<<<<<< * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() */ - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_v_5scipy_2io_6matlab_10mio5_utils_OPAQUE_DTYPE)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 923; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 929; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_res = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":924 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":930 * ''' * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s0), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 924; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s0), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 930; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":925 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":931 * cdef cnp.ndarray res = np.empty((1,), dtype=OPAQUE_DTYPE) * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 925; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s1), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 931; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":926 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":932 * res[0]['s0'] = self.read_int8_string() * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() # <<<<<<<<<<<<<< * res[0]['arr'] = self.read_mi_matrix() * return res */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_int8_string(__pyx_v_self); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 926; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__s2), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 932; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":927 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":933 * res[0]['s1'] = self.read_int8_string() * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() # <<<<<<<<<<<<<< * return res */ - __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self->__pyx_vtab)->read_mi_matrix(__pyx_v_self, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_res), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 927; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__arr), __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 933; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":928 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":934 * res[0]['s2'] = self.read_int8_string() * res[0]['arr'] = self.read_mi_matrix() * return res # <<<<<<<<<<<<<< @@ -7867,7 +7931,7 @@ return __pyx_r; } -/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":907 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio5_utils.pyx":913 * return result.reshape(tupdims).T * * cpdef cnp.ndarray read_opaque(self, VarHeader5 hdr): # <<<<<<<<<<<<<< @@ -7881,9 +7945,9 @@ PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("read_opaque"); - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hdr), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "hdr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_hdr), __pyx_ptype_5scipy_2io_6matlab_10mio5_utils_VarHeader5, 1, "hdr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_opaque(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_hdr), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 907; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = ((PyObject *)((struct __pyx_vtabstruct_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self)->__pyx_vtab)->read_opaque(((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarReader5 *)__pyx_v_self), ((struct __pyx_obj_5scipy_2io_6matlab_10mio5_utils_VarHeader5 *)__pyx_v_hdr), 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 913; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -10420,6 +10484,8 @@ {&__pyx_n_s__buffer, __pyx_k__buffer, sizeof(__pyx_k__buffer), 0, 0, 1, 1}, {&__pyx_n_s__byte_order, __pyx_k__byte_order, sizeof(__pyx_k__byte_order), 0, 0, 1, 1}, {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__c16, __pyx_k__c16, sizeof(__pyx_k__c16), 0, 0, 1, 1}, + {&__pyx_n_s__c8, __pyx_k__c8, sizeof(__pyx_k__c8), 0, 0, 1, 1}, {&__pyx_n_s__chars_as_strings, __pyx_k__chars_as_strings, sizeof(__pyx_k__chars_as_strings), 0, 0, 1, 1}, {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, {&__pyx_n_s__class_dtypes, __pyx_k__class_dtypes, sizeof(__pyx_k__class_dtypes), 0, 0, 1, 1}, @@ -10443,6 +10509,7 @@ {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, {&__pyx_n_s__header, __pyx_k__header, sizeof(__pyx_k__header), 0, 0, 1, 1}, + {&__pyx_n_s__imag, __pyx_k__imag, sizeof(__pyx_k__imag), 0, 0, 1, 1}, {&__pyx_n_s__is_complex, __pyx_k__is_complex, sizeof(__pyx_k__is_complex), 0, 0, 1, 1}, {&__pyx_n_s__is_global, __pyx_k__is_global, sizeof(__pyx_k__is_global), 0, 0, 1, 1}, {&__pyx_n_s__is_logical, __pyx_k__is_logical, sizeof(__pyx_k__is_logical), 0, 0, 1, 1}, @@ -10523,7 +10590,7 @@ __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 301; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_TypeError = __Pyx_GetName(__pyx_b, __pyx_n_s__TypeError); if (!__pyx_builtin_TypeError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 458; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; @@ -10534,6 +10601,7 @@ if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; Modified: trunk/scipy/io/matlab/mio5_utils.pyx =================================================================== --- trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:45 UTC (rev 6867) +++ trunk/scipy/io/matlab/mio5_utils.pyx 2010-11-12 00:56:57 UTC (rev 6868) @@ -695,7 +695,13 @@ # avoid array copy to save memory res = self.read_numeric(False) res_j = self.read_numeric(False) - res = res + (res_j * 1j) + # Use c8 for f4s and c16 for f8 input. Just ``res = res + res_j * + # 1j`` upcasts to c16 regardless of input type. + if res.itemsize == 4: + res = res.astype('c8') + else: + res = res.astype('c16') + res.imag = res_j else: res = self.read_numeric() return res.reshape(header.dims[::-1]).T Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:45 UTC (rev 6867) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:56:57 UTC (rev 6868) @@ -814,5 +814,17 @@ assert_equal(set(vars.keys()), set(['theta'] + sys_v_names)) +def test_round_types(): + # Check that saving, loading preserves dtype in most cases + arr = np.arange(10) + stream = BytesIO() + for dts in ('f8','f4','i8','i4','i2','i1', + 'u8','u4','u2','u1','c16','c8'): + stream.truncate(0) + savemat_future(stream, {'arr': arr.astype(dts)}) + vars = loadmat(stream) + assert_equal(np.dtype(dts), vars['arr'].dtype) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Thu Nov 11 19:57:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:57:03 -0600 (CST) Subject: [Scipy-svn] r6869 - trunk/scipy/io/matlab Message-ID: <20101112005703.118573236F@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:57:02 -0600 (Thu, 11 Nov 2010) New Revision: 6869 Modified: trunk/scipy/io/matlab/mio.py Log: RF - learned kwargs.pop trick from Paulis git-cherry-tree code Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-12 00:56:57 UTC (rev 6868) +++ trunk/scipy/io/matlab/mio.py 2010-11-12 00:57:02 UTC (rev 6869) @@ -144,11 +144,7 @@ files. Because scipy does not supply one, we do not implement the HDF5 / 7.3 interface here. ''' - if 'variable_names' in kwargs: - variable_names = kwargs['variable_names'] - del kwargs['variable_names'] - else: - variable_names = None + variable_names = kwargs.pop('variable_names', None) MR = mat_reader_factory(file_name, appendmat, **kwargs) matfile_dict = MR.get_variables(variable_names) if mdict is not None: From scipy-svn at scipy.org Thu Nov 11 19:57:18 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:57:18 -0600 (CST) Subject: [Scipy-svn] r6870 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005718.72AB532340@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:57:18 -0600 (Thu, 11 Nov 2010) New Revision: 6870 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/tests/test_mio.py trunk/scipy/io/matlab/tests/test_mio5_utils.py Log: FIX - fix python3 testing errors introduced by new tests Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:02 UTC (rev 6869) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:18 UTC (rev 6870) @@ -411,8 +411,8 @@ array([], dtype=float64) >>> to_writeable(None) - >>> to_writeable('a string').dtype - dtype('|S8') + >>> to_writeable('a string').dtype.type == np.str_ + True >>> to_writeable(1) array(1) >>> to_writeable([1]) Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:02 UTC (rev 6869) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:18 UTC (rev 6870) @@ -821,6 +821,7 @@ for dts in ('f8','f4','i8','i4','i2','i1', 'u8','u4','u2','u1','c16','c8'): stream.truncate(0) + stream.seek(0) # needed for BytesIO in python 3 savemat_future(stream, {'arr': arr.astype(dts)}) vars = loadmat(stream) assert_equal(np.dtype(dts), vars['arr'].dtype) Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:57:02 UTC (rev 6869) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-11-12 00:57:18 UTC (rev 6870) @@ -12,6 +12,8 @@ import numpy as np +from numpy.compat import asbytes + from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises @@ -171,7 +173,7 @@ hdr = m5u.VarHeader5() # Try when string is 1 length hdr.set_dims([1,]) - _write_stream(str_io, tag.tostring() + ' ') + _write_stream(str_io, tag.tostring() + asbytes(' ')) str_io.seek(0) val = c_reader.read_char(hdr) assert_equal(val, u' ') From scipy-svn at scipy.org Thu Nov 11 19:57:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 11 Nov 2010 18:57:30 -0600 (CST) Subject: [Scipy-svn] r6871 - in trunk/scipy/io/matlab: . tests Message-ID: <20101112005730.CFD5532368@scipy.org> Author: matthew.brett at gmail.com Date: 2010-11-11 18:57:30 -0600 (Thu, 11 Nov 2010) New Revision: 6871 Modified: trunk/scipy/io/matlab/mio5.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/matlab/tests/test_mio.py Log: TESTS - add tests for varmat_from_mat; rename warning from Paulis suggestions Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:18 UTC (rev 6870) +++ trunk/scipy/io/matlab/mio5.py 2010-11-12 00:57:30 UTC (rev 6871) @@ -90,7 +90,7 @@ from miobase import MatFileReader, docfiller, matdims, \ read_dtype, arr_to_chars, arr_dtype_number, \ - MatWriteError, MatReadError + MatWriteError, MatReadError, MatReadWarning # Reader object for matlab 5 format variables from mio5_utils import VarReader5 @@ -275,7 +275,7 @@ ' - replacing previous with new\n' 'Consider mio5.varmats_from_mat to split ' 'file into single variable files' % name, - UserWarning, stacklevel=2) + MatReadWarning, stacklevel=2) if name == '': # can only be a matlab 7 function workspace name = '__function_workspace__' @@ -806,10 +806,10 @@ Parameters ---------- mdict : mapping - mapping with method ``items`` return name, contents pairs - where ``name`` which will appeak in the matlab workspace in - file load, and ``contents`` is something writeable to a - matlab file, such as a numpy array. + mapping with method ``items`` returns name, contents pairs where + ``name`` which will appear in the matlab workspace in file load, and + ``contents`` is something writeable to a matlab file, such as a numpy + array. write_header : {None, True, False} If True, then write the matlab file header before writing the variables. If None (the default) then write the file header Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-11-12 00:57:18 UTC (rev 6870) +++ trunk/scipy/io/matlab/miobase.py 2010-11-12 00:57:30 UTC (rev 6871) @@ -20,6 +20,8 @@ class MatWriteError(Exception): pass +class MatReadWarning(UserWarning): pass + doc_dict = \ {'file_arg': '''file_name : string Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:18 UTC (rev 6870) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-12 00:57:30 UTC (rev 6871) @@ -40,7 +40,7 @@ from scipy.io.matlab.mio import find_mat_file, mat_reader_factory, \ loadmat, savemat from scipy.io.matlab.mio5 import MatlabObject, MatFile5Writer, \ - MatFile5Reader, MatlabFunction + MatFile5Reader, MatlabFunction, varmats_from_mat # Use future defaults to silence unwanted test warnings savemat_future = partial(savemat, oned_as='row') @@ -827,5 +827,25 @@ assert_equal(np.dtype(dts), vars['arr'].dtype) +def test_varmats_from_mat(): + # Make a mat file with several variables, write it, read it back + names_vars = (('arr', mlarr(np.arange(10))), + ('mystr', mlarr('a string')), + ('mynum', mlarr(10))) + # Dict like thing to give variables in defined order + class C(object): + def items(self): return names_vars + stream = BytesIO() + savemat_future(stream, C()) + varmats = varmats_from_mat(stream) + assert_equal(len(varmats), 3) + for i in range(3): + name, var_stream = varmats[i] + exp_name, exp_res = names_vars[i] + assert_equal(name, exp_name) + res = loadmat(var_stream) + assert_array_equal(res[name], exp_res) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Nov 13 12:19:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 11:19:03 -0600 (CST) Subject: [Scipy-svn] r6872 - in trunk: doc/release doc/source scipy/signal scipy/signal/tests Message-ID: <20101113171903.340AE37BA40@scipy.org> Author: warren.weckesser Date: 2010-11-13 11:19:02 -0600 (Sat, 13 Nov 2010) New Revision: 6872 Added: trunk/scipy/signal/tests/test_fir_filter_design.py Modified: trunk/doc/release/0.9.0-notes.rst trunk/doc/source/signal.rst trunk/scipy/signal/fir_filter_design.py trunk/scipy/signal/info.py trunk/scipy/signal/tests/test_filter_design.py Log: ENH: signal: firwin() can now create highpass, bandpass, bandstop and multi-band FIR filters. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-12 00:57:30 UTC (rev 6871) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-13 17:19:02 UTC (rev 6872) @@ -108,5 +108,15 @@ equation systems (``scipy.linalg.solve_triangular``). +Improved FIR filter design functions (``scipy.signal``) +------------------------------------------------------- + +The function ``scipy.signal.firwin`` was enhanced to allow the +design of highpass, bandpass, bandstop and multi-band FIR filters. + +The functions ``scipy.signal.kaiser_atten`` and ``scipy.signal.kaiser_beta`` +were added. + + Removed features ================ Modified: trunk/doc/source/signal.rst =================================================================== --- trunk/doc/source/signal.rst 2010-11-12 00:57:30 UTC (rev 6871) +++ trunk/doc/source/signal.rst 2010-11-13 17:19:02 UTC (rev 6872) @@ -68,6 +68,8 @@ freqz iirdesign iirfilter + kaiser_atten + kaiser_beta kaiserord remez Modified: trunk/scipy/signal/fir_filter_design.py =================================================================== --- trunk/scipy/signal/fir_filter_design.py 2010-11-12 00:57:30 UTC (rev 6871) +++ trunk/scipy/signal/fir_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) @@ -1,10 +1,80 @@ """Functions for FIR filter design.""" import numpy -from numpy import pi, ceil -from scipy import special +from numpy import pi, ceil, cos +from scipy.special import sinc +# Some notes on function parameters: +# +# `cutoff` and `width` are given as a numbers between 0 and 1. These +# are relative frequencies, expressed as a fraction of the Nyquist rate. +# For example, if the Nyquist rate is 2KHz, then width=0.15 is a width +# of 300 Hz. +# +# The `order` of a FIR filter is one less than the number of taps. +# This is a potential source of confusion, so in the following code, +# we will always use the number of taps as the parameterization of +# the 'size' of the filter. The "number of taps" means the number +# of coefficients, which is the same as the length of the impulse +# response of the filter. + +def kaiser_beta(a): + """Compute the Kaiser parameter `beta`, given the attenuation `a`. + + Parameters + ---------- + a : float + The desired attenuation in the stopband and maximum ripple in + the passband, in dB. This should be a *positive* number. + + Returns + ------- + beta : float + The `beta` parameter to be used in the formula for a Kaiser window. + + References + ---------- + Oppenheim, Schafer, "Discrete-Time Signal Processing", p.475-476. + """ + if a > 50: + beta = 0.1102 * (a - 8.7) + elif a > 21: + beta = 0.5842 * (a - 21)**0.4 + 0.07886 * (a - 21) + else: + beta = 0.0 + return beta + + +def kaiser_atten(N, width): + """Compute the attenuation of a Kaiser FIR filter. + + Given the number of taps `N` and the transition width `width`, compute the + attenuation `a` in dB, given by Kaiser's formula: + + a = 2.285 * (N - 1) * pi * width + 7.95 + + Parameters + ---------- + N : int + The number of taps in the FIR filter. + width : float + The desired width of the transition region between passband and stopband + (or, in general, at any discontinuity) for the filter. + + Returns + ------- + a : float + The attenuation of the ripple, in dB. + + See Also + -------- + kaiserord, kaiser_beta + """ + a = 2.285 * (N - 1) * pi * width + 7.95 + return a + + def kaiserord(ripple, width): """Design a Kaiser window to limit ripple and width of transition region. @@ -20,7 +90,7 @@ Returns ------- N : int - The order parameter for the kaiser window. + The length of the kaiser window. beta : The beta parameter for the kaiser window. @@ -29,62 +99,193 @@ There are several ways to obtain the Kaiser window: signal.kaiser(N, beta, sym=0) - signal.get_window(beta,N) - signal.get_window(('kaiser',beta),N) + signal.get_window(beta, N) + signal.get_window(('kaiser', beta), N) The empirical equations discovered by Kaiser are used. + See Also + -------- + kaiser_beta, kaiser_atten + References ---------- Oppenheim, Schafer, "Discrete-Time Signal Processing", p.475-476. """ A = abs(ripple) # in case somebody is confused as to what's meant - if (A>50): - beta = 0.1102*(A-8.7) - elif (A>21): - beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) - else: - beta = 0.0 - N = (A-8)/2.285/(pi*width) - return ceil(N), beta + if A < 8: + # Formula for N is not valid in this range. + raise ValueError("Requested maximum ripple attentuation %f is too " + "small for the Kaiser formula." % A) + beta = kaiser_beta(A) -def firwin(N, cutoff, width=None, window='hamming'): + # Kaiser's formula (as given in Oppenheim and Schafer) is for the filter + # order, so we have to add 1 to get the number of taps. + N = (A - 7.95) / 2.285 / (pi * width) + 1 + + return int(ceil(N)), beta + + +def firwin(N, cutoff, width=None, window='hamming', pass_zero=True, scale=True): """ - FIR Filter Design using windowed ideal filter method. + FIR filter design using the window method. + + This function computes the coefficients of a finite impulse response filter. + The filter will have linear phase; it will be Type I if `N` is odd and + Type II if `N` is even. + + Type II filters always have zero response at the Nyquist rate, so a + ValueError exception is raised if firwin is called with `N` even and + having a passband whose right end is at the Nyquist rate. Parameters ---------- N : int - Order of filter (number of taps). - cutoff : float - Cutoff frequency of filter (normalized so that 1 corresponds to Nyquist - or pi radians / sample) - width : float - If `width` is not None, then assume it is the approximate width of the - transition region (normalized so that 1 corresonds to pi) for use in - kaiser FIR filter design. - window : str. optional - Desired window to use. See `get_window` for a list of windows and - required parameters. Default is 'hamming'. + Length of the filter (number of coefficients, i.e. the filter + order + 1). `N` must be even if a passband includes the Nyquist + frequency. + cutoff : float or 1D array_like + Cutoff frequency of filter (normalized so that 1 corresponds to + Nyquist or pi radians / sample) OR an array of cutoff frequencies + (that is, band edges). In the latter case, the frequencies in + `cutoff` should be positive and monotonically increasing between + 0 and 1. The values 0 and 1 must not be included in `cutoff`. + + width : float or None + If `width` is not None, then assume it is the approximate width of + the transition region (normalized so that 1 corresponds to pi) + for use in Kaiser FIR filter design. In this case, the `window` + argument is ignored. + + window : string or tuple of string and parameter values + Desired window to use. See `scipy.signal.get_window` for a list of + windows and required parameters. + + pass_zero : bool + If True, the gain at the frequency 0 (i.e. the "DC gain") is 1. + Otherwise the DC gain is 0. + + scale : bool + Set to True to scale the coefficients so that the frequency + response is exactly unity at a certain frequency. + That frequency is either: + 0 (DC) if the first passband starts at 0 (i.e. pass_zero + is True); + 1 (Nyquist) if the first passband ends at 1 (i.e the + filter is a single band highpass filter); + center of first passband otherwise. + Returns ------- - h : ndarray + h : 1D ndarray Coefficients of length N FIR filter. + Raises + ------ + ValueError + If any value in cutoff is less than or equal to 0 or greater + than or equal to 1, if the values in cutoff are not strictly + monotonically increasing, or if `N` is even but a passband + includes the Nyquist frequency. + + Examples + -------- + + Low-pass from 0 to f:: + + >>> firwin(N, f) + + Use a specific window function:: + + >>> firwin(N, f, window='nuttall') + + High-pass ('stop' from 0 to f):: + + >>> firwin(N, f, pass_zero=False) + + Band-pass:: + + >>> firwin(N, [f1, f2], pass_zero=False) + + Band-stop:: + + >>> firwin(N, [f1, f2]) + + Multi-band (passbands are [0, f1], [f2, f3] and [f4, 1]):: + + >>>firwin(N, [f1, f2, f3, f4]) + + Multi-band (passbands are [f1, f2] and [f3,f4]):: + + >>> firwin(N, [f1, f2, f3, f4], pass_zero=False) + """ + # The major enhancements to this function added in November 2010 were + # developed by Tom Krauss (see ticket #902). + + cutoff = numpy.atleast_1d(cutoff) + + # Check for invalid input. + if cutoff.ndim > 1: + raise ValueError("The cutoff argument must be at most one-dimensional.") + if cutoff.size == 0: + raise ValueError("At least one cutoff frequency must be given.") + if cutoff.min() <= 0 or cutoff.max() >= 1: + raise ValueError("Invalid cutoff frequency: frequencies must be greater than 0 and less than 1.") + if numpy.any(numpy.diff(cutoff) <= 0): + raise ValueError("Invalid cutoff frequencies: the frequencies must be strictly increasing.") + + if width is not None: + # A width was given. Verify that it is a float, find the beta parameter + # of the Kaiser window, and set `window`. This overrides the value of + # `window` passed in. + if isinstance(width, float): + atten = kaiser_atten(N, width) + beta = kaiser_beta(atten) + window = ('kaiser', beta) + else: + raise ValueError("Invalid value for width: %s", width) + + pass_nyquist = bool(cutoff.size & 1) ^ pass_zero + if pass_nyquist and N % 2 == 0: + raise ValueError("A filter with an even number of coefficients must " + "have zero response at the Nyquist rate.") + + # Insert 0 and/or 1 at the ends of cutoff so that the length of cutoff is even, + # and each pair in cutoff corresponds to passband. + cutoff = numpy.hstack(([0.0]*pass_zero, cutoff, [1.0]*pass_nyquist)) + + # `bands` is a 2D array; each row gives the left and right edges of a passband. + bands = cutoff.reshape(-1,2) + + # Build up the coefficients. + alpha = 0.5 * (N-1) + m = numpy.arange(0, N) - alpha + h = 0 + for left, right in bands: + h += right * sinc(right * m) + h -= left * sinc(left * m) + + # Get and apply the window function. from signaltools import get_window - if isinstance(width,float): - A = 2.285*N*width + 8 - if (A < 21): beta = 0.0 - elif (A <= 50): beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) - else: beta = 0.1102*(A-8.7) - window=('kaiser',beta) - - win = get_window(window,N,fftbins=1) - alpha = N//2 - m = numpy.arange(0,N) - h = win*special.sinc(cutoff*(m-alpha)) - return h / numpy.sum(h,axis=0) + win = get_window(window, N, fftbins=False) + h *= win + + # Now handle scaling if desired. + if scale: + # Get the first passband. + left, right = bands[0] + if left == 0: + scale_frequency = 0.0 + elif right == 1: + scale_frequency = 1.0 + else: + scale_frequency = 0.5 * (left + right) + c = cos(pi * m * scale_frequency) + s = numpy.sum(h * c) + h /= s + + return h Modified: trunk/scipy/signal/info.py =================================================================== --- trunk/scipy/signal/info.py 2010-11-12 00:57:30 UTC (rev 6871) +++ trunk/scipy/signal/info.py 2010-11-13 17:19:02 UTC (rev 6872) @@ -82,6 +82,11 @@ IIR filter design given order and critical frequencies. invres: Inverse partial fraction expansion. + kaiser_beta: + Compute the Kaiser parameter beta, given the desired FIR filter attenuation. + kaiser_atten: + Compute the attenuation of a Kaiser FIR filter, given the number of taps + and the transition width at discontinuities in the frequency response. kaiserord: Design a Kaiser window to limit ripple and width of transition region. remez: Modified: trunk/scipy/signal/tests/test_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_filter_design.py 2010-11-12 00:57:30 UTC (rev 6871) +++ trunk/scipy/signal/tests/test_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) @@ -3,7 +3,7 @@ import numpy as np from numpy.testing import TestCase, assert_array_almost_equal, assert_ -from scipy.signal import tf2zpk, bessel, BadCoefficients, kaiserord, firwin, freqz, remez +from scipy.signal import tf2zpk, bessel, BadCoefficients, freqz, remez class TestTf2zpk(TestCase): @@ -39,17 +39,7 @@ warnings.simplefilter("always", BadCoefficients) -class TestFirWin(TestCase): - def test_lowpass(self): - width = 0.04 - ntaps, beta = kaiserord(120, width) - taps = firwin(ntaps, cutoff=0.5, window=('kaiser', beta)) - freq_samples = np.array([0.0, 0.25, 0.5-width/2, 0.5+width/2, 0.75, 1.0]) - freqs, response = freqz(taps, worN=np.pi*freq_samples) - assert_array_almost_equal(np.abs(response), - [1.0, 1.0, 1.0, 0.0, 0.0, 0.0], decimal=5) - class TestRemez(TestCase): def test_hilbert(self): Added: trunk/scipy/signal/tests/test_fir_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_fir_filter_design.py (rev 0) +++ trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) @@ -0,0 +1,193 @@ + +import numpy as np +from numpy.testing import TestCase, run_module_suite, assert_raises, \ + assert_array_almost_equal + +from scipy.signal import firwin, kaiserord, freqz + + +class TestFirwin(TestCase): + + def check_response(self, h, expected_response, tol=.05): + N = len(h) + alpha = 0.5 * (N-1) + m = np.arange(0,N) - alpha # time indices of taps + for freq, expected in expected_response: + actual = abs(np.sum(h*np.exp(-1.j*np.pi*m*freq))) + mse = abs(actual-expected)**2 + self.assertTrue(mse < tol, 'response not as expected, mse=%g > %g'\ + %(mse, tol)) + + def test_response(self): + N = 51 + f = .5 + # increase length just to try even/odd + h = firwin(N, f) # low-pass from 0 to f + self.check_response(h, [(.25,1), (.75,0)]) + + h = firwin(N+1, f, window='nuttall') # specific window + self.check_response(h, [(.25,1), (.75,0)]) + + h = firwin(N+2, f, pass_zero=False) # stop from 0 to f --> high-pass + self.check_response(h, [(.25,0), (.75,1)]) + + f1, f2, f3, f4 = .2, .4, .6, .8 + h = firwin(N+3, [f1, f2], pass_zero=False) # band-pass filter + self.check_response(h, [(.1,0), (.3,1), (.5,0)]) + + h = firwin(N+4, [f1, f2]) # band-stop filter + self.check_response(h, [(.1,1), (.3,0), (.5,1)]) + + h = firwin(N+5, [f1, f2, f3, f4], pass_zero=False, scale=False) + self.check_response(h, [(.1,0), (.3,1), (.5,0), (.7,1), (.9,0)]) + + h = firwin(N+6, [f1, f2, f3, f4]) # multiband filter + self.check_response(h, [(.1,1), (.3,0), (.5,1), (.7,0), (.9,1)]) + + h = firwin(N+7, 0.1, width=.03) # low-pass + self.check_response(h, [(.05,1), (.75,0)]) + + h = firwin(N+8, 0.1, pass_zero=False) # high-pass + self.check_response(h, [(.05,0), (.75,1)]) + + def mse(self, h, bands): + """Compute mean squared error versus ideal response across frequency + band. + h -- coefficients + bands -- list of (left, right) tuples relative to 1==Nyquist of + passbands + """ + w, H = freqz(h, worN=1024) + f = w/np.pi + passIndicator = np.zeros(len(w), bool) + for left, right in bands: + passIndicator |= (f>=left) & (f Author: warren.weckesser Date: 2010-11-13 13:28:08 -0600 (Sat, 13 Nov 2010) New Revision: 6873 Modified: trunk/scipy/signal/fir_filter_design.py trunk/scipy/signal/signaltools.py trunk/scipy/signal/tests/test_filter_design.py trunk/scipy/signal/tests/test_fir_filter_design.py Log: REF: signal: move remez from signaltools.py to fir_filter_design.py Modified: trunk/scipy/signal/fir_filter_design.py =================================================================== --- trunk/scipy/signal/fir_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) +++ trunk/scipy/signal/fir_filter_design.py 2010-11-13 19:28:08 UTC (rev 6873) @@ -1,8 +1,9 @@ """Functions for FIR filter design.""" import numpy -from numpy import pi, ceil, cos +from numpy import pi, ceil, cos, asarray from scipy.special import sinc +import sigtools # Some notes on function parameters: # @@ -289,3 +290,101 @@ h /= s return h + + +def remez(numtaps, bands, desired, weight=None, Hz=1, type='bandpass', + maxiter=25, grid_density=16): + """ + Calculate the minimax optimal filter using the Remez exchange algorithm. + + Calculate the filter-coefficients for the finite impulse response + (FIR) filter whose transfer function minimizes the maximum error + between the desired gain and the realized gain in the specified + frequency bands using the Remez exchange algorithm. + + Parameters + ---------- + numtaps : int + The desired number of taps in the filter. The number of taps is + the number of terms in the filter, or the filter order plus one. + bands : array_like + A monotonic sequence containing the band edges in Hz. + All elements must be non-negative and less than half the sampling + frequency as given by `Hz`. + desired : array_like + A sequence half the size of bands containing the desired gain + in each of the specified bands. + weight : array_like, optional + A relative weighting to give to each band region. The length of + `weight` has to be half the length of `bands`. + Hz : scalar, optional + The sampling frequency in Hz. Default is 1. + type : {'bandpass', 'differentiator', 'hilbert'}, optional + The type of filter: + + 'bandpass' : flat response in bands. This is the default. + + 'differentiator' : frequency proportional response in bands. + + 'hilbert' : filter with odd symmetry, that is, type III + (for even order) or type IV (for odd order) + linear phase filters. + + maxiter : int, optional + Maximum number of iterations of the algorithm. Default is 25. + grid_density : int, optional + Grid density. The dense grid used in `remez` is of size + ``(numtaps + 1) * grid_density``. Default is 16. + + Returns + ------- + out : ndarray + A rank-1 array containing the coefficients of the optimal + (in a minimax sense) filter. + + See Also + -------- + freqz : Compute the frequency response of a digital filter. + + References + ---------- + .. [1] J. H. McClellan and T. W. Parks, "A unified approach to the + design of optimum FIR linear phase digital filters", + IEEE Trans. Circuit Theory, vol. CT-20, pp. 697-701, 1973. + .. [2] J. H. McClellan, T. W. Parks and L. R. Rabiner, "A Computer + Program for Designing Optimum FIR Linear Phase Digital + Filters", IEEE Trans. Audio Electroacoust., vol. AU-21, + pp. 506-525, 1973. + + Examples + -------- + We want to construct a filter with a passband at 0.2-0.4 Hz, and + stop bands at 0-0.1 Hz and 0.45-0.5 Hz. Note that this means that the + behavior in the frequency ranges between those bands is unspecified and + may overshoot. + + >>> bpass = sp.signal.remez(72, [0, 0.1, 0.2, 0.4, 0.45, 0.5], [0, 1, 0]) + >>> freq, response = sp.signal.freqz(bpass) + >>> ampl = np.abs(response) + + >>> import matplotlib.pyplot as plt + >>> fig = plt.figure() + >>> ax1 = fig.add_subplot(111) + >>> ax1.semilogy(freq/(2*np.pi), ampl, 'b-') # freq in Hz + [] + >>> plt.show() + + """ + # Convert type + try: + tnum = {'bandpass':1, 'differentiator':2, 'hilbert':3}[type] + except KeyError: + raise ValueError("Type must be 'bandpass', 'differentiator', or 'hilbert'") + + # Convert weight + if weight is None: + weight = [1] * len(desired) + + bands = asarray(bands).copy() + return sigtools._remez(numtaps, bands, desired, weight, tnum, Hz, + maxiter, grid_density) Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2010-11-13 17:19:02 UTC (rev 6872) +++ trunk/scipy/signal/signaltools.py 2010-11-13 19:28:08 UTC (rev 6873) @@ -540,103 +540,8 @@ return sigtools._medfilt2d(image, kernel_size) -def remez(numtaps, bands, desired, weight=None, Hz=1, type='bandpass', - maxiter=25, grid_density=16): - """ - Calculate the minimax optimal filter using the Remez exchange algorithm. - Calculate the filter-coefficients for the finite impulse response - (FIR) filter whose transfer function minimizes the maximum error - between the desired gain and the realized gain in the specified - frequency bands using the Remez exchange algorithm. - Parameters - ---------- - numtaps : int - The desired number of taps in the filter. The number of taps is - the number of terms in the filter, or the filter order plus one. - bands : array_like - A monotonic sequence containing the band edges in Hz. - All elements must be non-negative and less than half the sampling - frequency as given by `Hz`. - desired : array_like - A sequence half the size of bands containing the desired gain - in each of the specified bands. - weight : array_like, optional - A relative weighting to give to each band region. The length of - `weight` has to be half the length of `bands`. - Hz : scalar, optional - The sampling frequency in Hz. Default is 1. - type : {'bandpass', 'differentiator', 'hilbert'}, optional - The type of filter: - - 'bandpass' : flat response in bands. This is the default. - - 'differentiator' : frequency proportional response in bands. - - 'hilbert' : filter with odd symmetry, that is, type III - (for even order) or type IV (for odd order) - linear phase filters. - - maxiter : int, optional - Maximum number of iterations of the algorithm. Default is 25. - grid_density : int, optional - Grid density. The dense grid used in `remez` is of size - ``(numtaps + 1) * grid_density``. Default is 16. - - Returns - ------- - out : ndarray - A rank-1 array containing the coefficients of the optimal - (in a minimax sense) filter. - - See Also - -------- - freqz : Compute the frequency response of a digital filter. - - References - ---------- - .. [1] J. H. McClellan and T. W. Parks, "A unified approach to the - design of optimum FIR linear phase digital filters", - IEEE Trans. Circuit Theory, vol. CT-20, pp. 697-701, 1973. - .. [2] J. H. McClellan, T. W. Parks and L. R. Rabiner, "A Computer - Program for Designing Optimum FIR Linear Phase Digital - Filters", IEEE Trans. Audio Electroacoust., vol. AU-21, - pp. 506-525, 1973. - - Examples - -------- - We want to construct a filter with a passband at 0.2-0.4 Hz, and - stop bands at 0-0.1 Hz and 0.45-0.5 Hz. Note that this means that the - behavior in the frequency ranges between those bands is unspecified and - may overshoot. - - >>> bpass = sp.signal.remez(72, [0, 0.1, 0.2, 0.4, 0.45, 0.5], [0, 1, 0]) - >>> freq, response = sp.signal.freqz(bpass) - >>> ampl = np.abs(response) - - >>> import matplotlib.pyplot as plt - >>> fig = plt.figure() - >>> ax1 = fig.add_subplot(111) - >>> ax1.semilogy(freq/(2*np.pi), ampl, 'b-') # freq in Hz - [] - >>> plt.show() - - """ - # Convert type - try: - tnum = {'bandpass':1, 'differentiator':2, 'hilbert':3}[type] - except KeyError: - raise ValueError("Type must be 'bandpass', 'differentiator', or 'hilbert'") - - # Convert weight - if weight is None: - weight = [1] * len(desired) - - bands = asarray(bands).copy() - return sigtools._remez(numtaps, bands, desired, weight, tnum, Hz, - maxiter, grid_density) - def lfilter(b, a, x, axis=-1, zi=None): """ Filter data along one-dimension with an IIR or FIR filter. Modified: trunk/scipy/signal/tests/test_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) +++ trunk/scipy/signal/tests/test_filter_design.py 2010-11-13 19:28:08 UTC (rev 6873) @@ -1,9 +1,9 @@ import warnings import numpy as np -from numpy.testing import TestCase, assert_array_almost_equal, assert_ +from numpy.testing import TestCase, assert_array_almost_equal -from scipy.signal import tf2zpk, bessel, BadCoefficients, freqz, remez +from scipy.signal import tf2zpk, bessel, BadCoefficients class TestTf2zpk(TestCase): @@ -37,36 +37,3 @@ pass finally: warnings.simplefilter("always", BadCoefficients) - - - -class TestRemez(TestCase): - - def test_hilbert(self): - N = 11 # number of taps in the filter - a = 0.1 # width of the transition band - - # design an unity gain hilbert bandpass filter from w to 0.5-w - h = remez(11, [ a, 0.5-a ], [ 1 ], type='hilbert') - - # make sure the filter has correct # of taps - assert_(len(h) == N, "Number of Taps") - - # make sure it is type III (anti-symmtric tap coefficients) - assert_array_almost_equal(h[:(N-1)/2], -h[:-(N-1)/2-1:-1]) - - # Since the requested response is symmetric, all even coeffcients - # should be zero (or in this case really small) - assert_((abs(h[1::2]) < 1e-15).all(), "Even Coefficients Equal Zero") - - # now check the frequency response - w, H = freqz(h, 1) - f = w/2/np.pi - Hmag = abs(H) - - # should have a zero at 0 and pi (in this case close to zero) - assert_((Hmag[ [0,-1] ] < 0.02).all(), "Zero at zero and pi") - - # check that the pass band is close to unity - idx = (f > a) * (f < 0.5-a) - assert_((abs(Hmag[idx] - 1) < 0.015).all(), "Pass Band Close To Unity") Modified: trunk/scipy/signal/tests/test_fir_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-13 17:19:02 UTC (rev 6872) +++ trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-13 19:28:08 UTC (rev 6873) @@ -1,9 +1,9 @@ import numpy as np from numpy.testing import TestCase, run_module_suite, assert_raises, \ - assert_array_almost_equal + assert_array_almost_equal, assert_ -from scipy.signal import firwin, kaiserord, freqz +from scipy.signal import firwin, kaiserord, freqz, remez class TestFirwin(TestCase): @@ -189,5 +189,37 @@ assert_raises(ValueError, firwin, 40, [.25, 0.5]) +class TestRemez(TestCase): + + def test_hilbert(self): + N = 11 # number of taps in the filter + a = 0.1 # width of the transition band + + # design an unity gain hilbert bandpass filter from w to 0.5-w + h = remez(11, [ a, 0.5-a ], [ 1 ], type='hilbert') + + # make sure the filter has correct # of taps + assert_(len(h) == N, "Number of Taps") + + # make sure it is type III (anti-symmtric tap coefficients) + assert_array_almost_equal(h[:(N-1)/2], -h[:-(N-1)/2-1:-1]) + + # Since the requested response is symmetric, all even coeffcients + # should be zero (or in this case really small) + assert_((abs(h[1::2]) < 1e-15).all(), "Even Coefficients Equal Zero") + + # now check the frequency response + w, H = freqz(h, 1) + f = w/2/np.pi + Hmag = abs(H) + + # should have a zero at 0 and pi (in this case close to zero) + assert_((Hmag[ [0,-1] ] < 0.02).all(), "Zero at zero and pi") + + # check that the pass band is close to unity + idx = (f > a) * (f < 0.5-a) + assert_((abs(Hmag[idx] - 1) < 0.015).all(), "Pass Band Close To Unity") + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Nov 13 15:04:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 14:04:36 -0600 (CST) Subject: [Scipy-svn] r6874 - trunk/scipy/signal Message-ID: <20101113200436.F0A2737A194@scipy.org> Author: warren.weckesser Date: 2010-11-13 14:04:36 -0600 (Sat, 13 Nov 2010) New Revision: 6874 Modified: trunk/scipy/signal/filter_design.py Log: DOC-BUG: signal: removed incorrect 'Note' from zpk2tf--this function doesn't call normalize(), so it will never cause a BadCoefficients warning. Modified: trunk/scipy/signal/filter_design.py =================================================================== --- trunk/scipy/signal/filter_design.py 2010-11-13 19:28:08 UTC (rev 6873) +++ trunk/scipy/signal/filter_design.py 2010-11-13 20:04:36 UTC (rev 6874) @@ -215,10 +215,6 @@ a : ndarray Numerator and denominator polynomials. - Note - ---- - If some values of b are too close to 0, they are removed. In that case, a - BadCoefficients warning is emitted. """ z = atleast_1d(z) k = atleast_1d(k) From scipy-svn at scipy.org Sat Nov 13 15:20:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 14:20:24 -0600 (CST) Subject: [Scipy-svn] r6875 - trunk/scipy/signal/tests Message-ID: <20101113202024.86D1637BA40@scipy.org> Author: warren.weckesser Date: 2010-11-13 14:20:24 -0600 (Sat, 13 Nov 2010) New Revision: 6875 Modified: trunk/scipy/signal/tests/test_filter_design.py Log: TST: signal: simplify a test--in the old version, the warning was actually triggered in the call to bessel(), so the line containing tf2zpk in the test was never reached. Modified: trunk/scipy/signal/tests/test_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_filter_design.py 2010-11-13 20:04:36 UTC (rev 6874) +++ trunk/scipy/signal/tests/test_filter_design.py 2010-11-13 20:20:24 UTC (rev 6875) @@ -1,12 +1,13 @@ import warnings import numpy as np -from numpy.testing import TestCase, assert_array_almost_equal +from numpy.testing import TestCase, assert_array_almost_equal, assert_raises from scipy.signal import tf2zpk, bessel, BadCoefficients class TestTf2zpk(TestCase): + def test_simple(self): z_r = np.array([0.5, -0.5]) p_r = np.array([1.j / np.sqrt(2), -1.j / np.sqrt(2)]) @@ -28,12 +29,6 @@ filter coefficients.""" warnings.simplefilter("error", BadCoefficients) try: - try: - b, a = bessel(20, 0.1) - z, p, k = tf2zpk(b, a) - raise AssertionError("tf2zpk did not warn about bad "\ - "coefficients") - except BadCoefficients: - pass + assert_raises(BadCoefficients, tf2zpk, [1e-15], [1.0, 1.0]) finally: warnings.simplefilter("always", BadCoefficients) From scipy-svn at scipy.org Sat Nov 13 15:36:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 14:36:14 -0600 (CST) Subject: [Scipy-svn] r6876 - trunk/scipy/signal Message-ID: <20101113203614.F2B0437A194@scipy.org> Author: warren.weckesser Date: 2010-11-13 14:36:14 -0600 (Sat, 13 Nov 2010) New Revision: 6876 Modified: trunk/scipy/signal/filter_design.py trunk/scipy/signal/ltisys.py trunk/scipy/signal/signaltools.py Log: ENH: signal: update 'raise' statements. Modified: trunk/scipy/signal/filter_design.py =================================================================== --- trunk/scipy/signal/filter_design.py 2010-11-13 20:20:24 UTC (rev 6875) +++ trunk/scipy/signal/filter_design.py 2010-11-13 20:36:14 UTC (rev 6876) @@ -238,9 +238,9 @@ """ b,a = map(atleast_1d,(b,a)) if len(a.shape) != 1: - raise ValueError, "Denominator polynomial must be rank-1 array." + raise ValueError("Denominator polynomial must be rank-1 array.") if len(b.shape) > 2: - raise ValueError, "Numerator polynomial must be rank-1 or rank-2 array." + raise ValueError("Numerator polynomial must be rank-1 or rank-2 array.") if len(b.shape) == 1: b = asarray([b],b.dtype.char) while a[0] == 0.0 and len(a) > 1: @@ -451,9 +451,9 @@ try: ordfunc = filter_dict[ftype][1] except KeyError: - raise ValueError, "Invalid IIR filter type." + raise ValueError("Invalid IIR filter type: %s" % ftype) except IndexError: - raise ValueError, "%s does not have order selection use iirfilter function." % ftype + raise ValueError("%s does not have order selection use iirfilter function." % ftype) wp = atleast_1d(wp) ws = atleast_1d(ws) @@ -515,15 +515,15 @@ try: btype = band_dict[btype] except KeyError: - raise ValueError, "%s is an invalid bandtype for filter." % btype + raise ValueError("%s is an invalid bandtype for filter." % btype) try: typefunc = filter_dict[ftype][0] except KeyError: - raise ValueError, "%s is not a valid basic iir filter." % ftype + raise ValueError("%s is not a valid basic iir filter." % ftype) if output not in ['ba', 'zpk']: - raise ValueError, "%s is not a valid output form." % output + raise ValueError("%s is not a valid output form." % output) #pre-warp frequencies for digital filter design if not analog: @@ -544,15 +544,15 @@ z, p, k = typefunc(N) elif typefunc == cheb1ap: if rp is None: - raise ValueError, "passband ripple (rp) must be provided to design a Chebyshev I filter." + raise ValueError("passband ripple (rp) must be provided to design a Chebyshev I filter.") z, p, k = typefunc(N, rp) elif typefunc == cheb2ap: if rs is None: - raise ValueError, "stopband atteunatuion (rs) must be provided to design an Chebyshev II filter." + raise ValueError("stopband atteunatuion (rs) must be provided to design an Chebyshev II filter.") z, p, k = typefunc(N, rs) else: # Elliptic filters if rs is None or rp is None: - raise ValueError, "Both rp and rs must be provided to design an elliptic filter." + raise ValueError("Both rp and rs must be provided to design an elliptic filter.") z, p, k = typefunc(N, rp, rs) b, a = zpk2tf(z,p,k) @@ -694,7 +694,7 @@ d1 = special.ellipk([arg1**2, 1-arg1**2]) n = (d0[0]*d1[1] / (d0[1]*d1[0])) else: - raise ValueError, "Incorrect type: ", type + raise ValueError("Incorrect type: %s" % type) return n def buttord(wp, ws, gpass, gstop, analog=0): @@ -800,7 +800,7 @@ passb[0]*passb[1]) WN = numpy.sort(abs(WN)) else: - raise ValueError, "Bad type." + raise ValueError("Bad type: %s" % filter_type) if not analog: wn = (2.0/pi)*arctan(WN) @@ -1179,7 +1179,7 @@ ck1 = eps / numpy.sqrt(10**(0.1*rs)-1) ck1p = numpy.sqrt(1-ck1*ck1) if ck1p == 1: - raise ValueError, "Cannot design a filter with given rp and rs specifications." + raise ValueError("Cannot design a filter with given rp and rs specifications.") wp = 1 val = special.ellipk([ck1*ck1,ck1p*ck1p]) @@ -1585,7 +1585,7 @@ -.2373280669322028974199184-1.211476658382565356579418*1j, -.2373280669322028974199184+1.211476658382565356579418*1j] else: - raise ValueError, "Bessel Filter not supported for order %d" % N + raise ValueError("Bessel Filter not supported for order %d" % N) return z, p, k Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-11-13 20:20:24 UTC (rev 6875) +++ trunk/scipy/signal/ltisys.py 2010-11-13 20:36:14 UTC (rev 6876) @@ -50,7 +50,7 @@ M = num.shape[1] K = len(den) if (M > K): - raise ValueError, "Improper transfer function." + raise ValueError("Improper transfer function.") if (M == 0 or K == 0): # Null system return array([],float), array([], float), array([], float), \ array([], float) @@ -87,7 +87,7 @@ if ((len(A.shape) > 2) or (len(B.shape) > 2) or \ (len(C.shape) > 2) or (len(D.shape) > 2)): - raise ValueError, "A, B, C, D arrays can be no larger than rank-2." + raise ValueError("A, B, C, D arrays can be no larger than rank-2.") MA, NA = A.shape MB, NB = B.shape @@ -108,15 +108,15 @@ A = zeros(MA, NA) if MA != NA: - raise ValueError, "A must be square." + raise ValueError("A must be square.") if MA != MB: - raise ValueError, "A and B must have the same number of rows." + raise ValueError("A and B must have the same number of rows.") if NA != NC: - raise ValueError, "A and C must have the same number of columns." + raise ValueError("A and C must have the same number of columns.") if MD != MC: - raise ValueError, "C and D must have the same number of rows." + raise ValueError("C and D must have the same number of rows.") if ND != NB: - raise ValueError, "B and D must have the same number of columns." + raise ValueError("B and D must have the same number of columns.") return A, B, C, D @@ -145,7 +145,7 @@ nout, nin = D.shape if input >= nin: - raise ValueError, "System does not have the input specified." + raise ValueError("System does not have the input specified.") # make MOSI from possibly MOMI system. if B.shape[-1] != 0: @@ -256,7 +256,7 @@ self.inputs = self.B.shape[-1] self.outputs = self.C.shape[0] else: - raise ValueError, "Needs 2, 3, or 4 arguments." + raise ValueError("Needs 2, 3, or 4 arguments.") def __setattr__(self, attr, val): if attr in ['num','den']: @@ -368,7 +368,7 @@ T = atleast_1d(T) if len(T.shape) != 1: - raise ValueError, "T must be a rank-1 array." + raise ValueError("T must be a rank-1 array.") if U is not None: U = atleast_1d(U) @@ -459,12 +459,12 @@ U = U.reshape((U.shape[0],1)) sU = U.shape if len(T.shape) != 1: - raise ValueError, "T must be a rank-1 array." + raise ValueError("T must be a rank-1 array.") if sU[0] != len(T): raise ValueError("U must have the same number of rows " "as elements in T.") if sU[1] != sys.inputs: - raise ValueError, "System does not define that many inputs." + raise ValueError("System does not define that many inputs.") if X0 is None: X0 = zeros(sys.B.shape[0], sys.A.dtype) @@ -634,7 +634,7 @@ sys = lti(*system) B = sys.B if B.shape[-1] != 1: - raise ValueError, "impulse2() requires a single-input system." + raise ValueError("impulse2() requires a single-input system.") B = B.squeeze() if X0 is None: X0 = zeros_like(B) Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2010-11-13 20:20:24 UTC (rev 6875) +++ trunk/scipy/signal/signaltools.py 2010-11-13 20:36:14 UTC (rev 6876) @@ -39,8 +39,8 @@ val = _modedict[mode] except KeyError: if mode not in [0,1,2]: - raise ValueError, "Acceptable mode flags are 'valid' (0)," \ - "'same' (1), or 'full' (2)." + raise ValueError("Acceptable mode flags are 'valid' (0)," + " 'same' (1), or 'full' (2).") val = mode return val @@ -49,8 +49,8 @@ val = _boundarydict[boundary] << 2 except KeyError: if val not in [0,1,2] : - raise ValueError, "Acceptable boundary flags are 'fill', 'wrap'" \ - " (or 'circular'), \n and 'symm' (or 'symmetric')." + raise ValueError("Acceptable boundary flags are 'fill', 'wrap'" + " (or 'circular'), \n and 'symm' (or 'symmetric').") val = boundary << 2 return val @@ -297,8 +297,8 @@ size = domain.shape for k in range(len(size)): if (size[k] % 2) != 1: - raise ValueError, "Each dimension of domain argument " \ - "should have an odd number of elements." + raise ValueError("Each dimension of domain argument " + " should have an odd number of elements.") return sigtools._order_filterND(a, domain, rank) @@ -336,7 +336,7 @@ for k in range(len(volume.shape)): if (kernel_size[k] % 2) != 1: - raise ValueError, "Each element of kernel_size should be odd." + raise ValueError("Each element of kernel_size should be odd.") domain = ones(kernel_size) @@ -536,7 +536,7 @@ for size in kernel_size: if (size % 2) != 1: - raise ValueError, "Each element of kernel_size should be odd." + raise ValueError("Each element of kernel_size should be odd.") return sigtools._medfilt2d(image, kernel_size) @@ -724,7 +724,7 @@ if N is None: N = x.shape[axis] if N <=0: - raise ValueError, "N must be positive." + raise ValueError("N must be positive.") if iscomplexobj(x): print "Warning: imaginary part of x ignored." x = real(x) @@ -773,7 +773,7 @@ N = x.shape if len(N) < 2: if N <=0: - raise ValueError, "N must be positive." + raise ValueError("N must be positive.") N = (N,N) if iscomplexobj(x): print "Warning: imaginary part of x ignored." @@ -1257,7 +1257,7 @@ """ if type not in ['linear','l','constant','c']: - raise ValueError, "Trend type must be linear or constant" + raise ValueError("Trend type must be 'linear' or 'constant'.") data = asarray(data) dtype = data.dtype.char if dtype not in 'dfDF': @@ -1270,8 +1270,8 @@ N = dshape[axis] bp = sort(unique(r_[0,bp,N])) if any(bp > N): - raise ValueError, "Breakpoints must be less than length " \ - "of data along given axis." + raise ValueError("Breakpoints must be less than length " + "of data along given axis.") Nreg = len(bp) - 1 # Restructure data so that axis is along first dimension and # all other dimensions are collapsed into second dimension @@ -1331,12 +1331,12 @@ edge=ntaps*3 if x.ndim != 1: - raise ValueError, "filtfilt only accepts 1-d arrays." + raise ValueError("filtfilt only accepts 1-d arrays.") #x must be bigger than edge if x.size < edge: - raise ValueError, "Input vector needs to be bigger than " \ - "3 * max(len(a),len(b)." + raise ValueError("Input vector needs to be bigger than " + "3 * max(len(a),len(b).") if len(a) < ntaps: a=r_[a,zeros(len(b)-len(a))] @@ -1392,7 +1392,7 @@ """ if not isinstance(q, int): - raise TypeError, "q must be an integer" + raise TypeError("q must be an integer") if n is None: if ftype == 'fir': From scipy-svn at scipy.org Sat Nov 13 16:15:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 15:15:40 -0600 (CST) Subject: [Scipy-svn] r6877 - trunk/scipy/signal/tests Message-ID: <20101113211540.290C637BBD8@scipy.org> Author: warren.weckesser Date: 2010-11-13 15:15:39 -0600 (Sat, 13 Nov 2010) New Revision: 6877 Modified: trunk/scipy/signal/tests/test_ltisys.py Log: TST: signal: suppress a known warning in test_ltisys.py Modified: trunk/scipy/signal/tests/test_ltisys.py =================================================================== --- trunk/scipy/signal/tests/test_ltisys.py 2010-11-13 20:36:14 UTC (rev 6876) +++ trunk/scipy/signal/tests/test_ltisys.py 2010-11-13 21:15:39 UTC (rev 6877) @@ -1,3 +1,6 @@ + +import warnings + import numpy as np from numpy.testing import assert_almost_equal, assert_equal, run_module_suite @@ -2,4 +5,4 @@ from scipy.signal.ltisys import ss2tf, lsim2, impulse2, step2, lti +from scipy.signal.filter_design import BadCoefficients - class TestSS2TF: @@ -61,9 +64,10 @@ assert_almost_equal(x[:,0], expected_x) def test_05(self): - # This test triggers a "BadCoefficients" warning from scipy.signal.filter_design, - # but the test passes. I think the warning is related to the incomplete handling - # of multi-input systems in scipy.signal. + # The call to lsim2 triggers a "BadCoefficients" warning from + # scipy.signal.filter_design, but the test passes. I think the warning + # is related to the incomplete handling of multi-input systems in + # scipy.signal. # A system with two state variables, two inputs, and one output. A = np.array([[-1.0, 0.0], [0.0, -2.0]]) @@ -72,7 +76,11 @@ D = np.zeros((1,2)) t = np.linspace(0, 10.0, 101) - tout, y, x = lsim2((A,B,C,D), T=t, X0=[1.0, 1.0]) + warnings.simplefilter("ignore", BadCoefficients) + try: + tout, y, x = lsim2((A,B,C,D), T=t, X0=[1.0, 1.0]) + finally: + del warnings.filters[0] expected_y = np.exp(-tout) expected_x0 = np.exp(-tout) expected_x1 = np.exp(-2.0*tout) From scipy-svn at scipy.org Sun Nov 14 00:38:11 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 23:38:11 -0600 (CST) Subject: [Scipy-svn] r6878 - trunk/scipy/stats Message-ID: <20101114053811.267E437A197@scipy.org> Author: rgommers Date: 2010-11-13 23:38:10 -0600 (Sat, 13 Nov 2010) New Revision: 6878 Modified: trunk/scipy/stats/stats.py Log: DOC: merge wiki edits for stats. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-13 21:15:39 UTC (rev 6877) +++ trunk/scipy/stats/stats.py 2010-11-14 05:38:10 UTC (rev 6878) @@ -244,17 +244,37 @@ ######## def nanmean(x, axis=0): - """Compute the mean over the given axis ignoring nans. + """ + Compute the mean over the given axis ignoring nans. - :Parameters: - x : ndarray - input array - axis : int - axis along which the mean is computed. + Parameters + ---------- + x : ndarray + Input array. + axis : int, optional + Axis along which the mean is computed. Default is 0, i.e. the + first axis. - :Results: - m : float - the mean.""" + Returns + ------- + m : float + The mean of `x`, ignoring nans. + + See Also + -------- + nanstd, nanmedian + + Examples + -------- + >>> from scipy import stats + >>> a = np.linspace(0, 4, 3) + >>> a + array([ 0., 2., 4.]) + >>> a[-1] = np.nan + >>> stats.nanmean(a) + 1.0 + + """ x, axis = _chk_asarray(x,axis) x = x.copy() Norig = x.shape[axis] @@ -264,20 +284,44 @@ return np.mean(x,axis)/factor def nanstd(x, axis=0, bias=False): - """Compute the standard deviation over the given axis ignoring nans + """ + Compute the standard deviation over the given axis, ignoring nans. - :Parameters: - x : ndarray - input array - axis : int - axis along which the standard deviation is computed. - bias : boolean - If true, the biased (normalized by N) definition is used. If false, - the unbiased is used (the default). + Parameters + ---------- + x : array_like + Input array. + axis : int or None, optional + Axis along which the standard deviation is computed. Default is 0. + If None, compute over the whole array `x`. + bias : bool, optional + If True, the biased (normalized by N) definition is used. If False + (default), the unbiased definition is used. - :Results: - s : float - the standard deviation.""" + Returns + ------- + s : float + The standard deviation. + + See Also + -------- + nanmean, nanmedian + + Examples + -------- + >>> from scipy import stats + >>> a = np.arange(10, dtype=float) + >>> a[1:3] = np.nan + >>> np.std(a) + nan + >>> stats.nanstd(a) + 2.9154759474226504 + >>> stats.nanstd(a.reshape(2, 5), axis=1) + array([ 2.0817, 1.5811]) + >>> stats.nanstd(a.reshape(2, 5), axis=None) + 2.9154759474226504 + + """ x, axis = _chk_asarray(x,axis) x = x.copy() Norig = x.shape[axis] @@ -317,17 +361,52 @@ return np.median(x) def nanmedian(x, axis=0): - """ Compute the median along the given axis ignoring nan values + """ + Compute the median along the given axis ignoring nan values. - :Parameters: - x : ndarray - input array - axis : int - axis along which the median is computed. + Parameters + ---------- + x : array_like + Input array. + axis : int, optional + Axis along which the median is computed. Default is 0, i.e. the + first axis. - :Results: - m : float - the median.""" + Returns + ------- + m : float + The median of `x` along `axis`. + + See Also + -------- + nanstd, nanmean + + Examples + -------- + >>> from scipy import stats + >>> a = np.array([0, 3, 1, 5, 5, np.nan]) + >>> stats.nanmedian(a) + array(3.0) + + >>> b = np.array([0, 3, 1, 5, 5, np.nan, 5]) + >>> stats.nanmedian(b) + array(4.0) + + Example with axis: + + >>> c = np.arange(30.).reshape(5,6) + >>> idx = np.array([False, False, False, True, False] * 6).reshape(5,6) + >>> c[idx] = np.nan + >>> c + array([[ 0., 1., 2., nan, 4., 5.], + [ 6., 7., nan, 9., 10., 11.], + [ 12., nan, 14., 15., 16., 17.], + [ nan, 19., 20., 21., 22., nan], + [ 24., 25., 26., 27., nan, 29.]]) + >>> stats.nanmedian(c, axis=1) + array([ 2. , 9. , 15. , 20.5, 26. ]) + + """ x, axis = _chk_asarray(x,axis) x = x.copy() return np.apply_along_axis(_nanmedian,axis,x) @@ -405,15 +484,15 @@ Axis along which the harmonic mean is computed. dtype : dtype, optional Type of the returned array and of the accumulator in which the - elements are summed. If dtype is not specified, it defaults to the - dtype of a, unless a has an integer dtype with a precision less than - that of the default platform integer. In that case, the default + elements are summed. If `dtype` is not specified, it defaults to the + dtype of `a`, unless `a` has an integer `dtype` with a precision less + than that of the default platform integer. In that case, the default platform integer is used. Returns ------- hmean : ndarray, - see dtype parameter above + see `dtype` parameter above See Also -------- @@ -571,19 +650,42 @@ axis=0, ddof=1).""") def mode(a, axis=0): - """Returns an array of the modal (most common) value in the passed array. + """ + Returns an array of the modal (most common) value in the passed array. If there is more than one such value, only the first is returned. The bin-count for the modal bins is also returned. Parameters ---------- - a : array - axis=0 : int + a : array_like + n-dimensional array of which to find mode(s). + axis : int, optional + Axis along which to operate. Default is 0, i.e. the first axis. Returns ------- - (array of modal values, array of counts for each mode) + vals : ndarray + Array of modal values. + counts : ndarray + Array of counts for each mode. + + Examples + -------- + >>> a = np.array([[6, 8, 3, 0], + [3, 2, 1, 7], + [8, 1, 8, 4], + [5, 3, 0, 5], + [4, 7, 5, 9]]) + >>> from scipy import stats + >>> stats.mode(a) + (array([[ 3., 1., 0., 0.]]), array([[ 1., 1., 1., 1.]])) + + To get mode of whole array, specify axis=None: + + >>> stats.mode(a, axis=None) + (array([ 3.]), array([ 3.])) + """ a, axis = _chk_asarray(a, axis) scores = np.unique(np.ravel(a)) # get ALL unique values @@ -1248,16 +1350,40 @@ return a + (b - a)*fraction; def scoreatpercentile(a, per, limit=()): - """Calculate the score at the given 'per' percentile of the - sequence a. For example, the score at per=50 is the median. + """ + Calculate the score at the given `per` percentile of the sequence `a`. - If the desired quantile lies between two data points, we - interpolate between them. + For example, the score at per=50 is the median. If the desired quantile + lies between two data points, we interpolate between them. If the parameter + `limit` is provided, it should be a tuple (lower, upper) of two values. + Values of `a` outside this (closed) interval will be ignored. - If the parameter 'limit' is provided, it should be a tuple (lower, - upper) of two values. Values of 'a' outside this (closed) - interval will be ignored. + Parameters + ---------- + a : ndarray + Values from which to extract score. + per : int or float + Percentile at which to extract score. + limit : tuple, optional + Tuple of two scalars, the lower and upper limits within which to + compute the percentile. + Returns + ------- + score : float + Score at percentile. + + See Also + -------- + percentileofscore + + Examples + -------- + >>> from scipy import stats + >>> a = np.arange(100) + >>> stats.scoreatpercentile(a, 50) + 49.5 + """ # TODO: this should be a simple wrapper around a well-written quantile # function. GNU R provides 9 quantile algorithms (!), with differing @@ -1631,24 +1757,46 @@ def sem(a, axis=0, ddof=1): """ Calculates the standard error of the mean (or standard error of - measurement) of the values in the passed array. + measurement) of the values in the input array. Parameters ---------- - a: array like - An array containing the values for which - axis: int or None, optional. - if equal None, ravel array first. If equal to an integer, this will be + a : array_like + An array containing the values for which the standard error is + returned. + axis : int or None, optional. + If axis is None, ravel `a` first. If axis is an integer, this will be the axis over which to operate. Defaults to 0. - ddof: int - Delta degrees-of-freedom. How many degrees of freedom to adjust for - bias in limited samples relative to the population estimate of variance + ddof : int, optional + Delta degrees-of-freedom. How many degrees of freedom to adjust + for bias in limited samples relative to the population estimate + of variance. Defaults to 1. Returns ------- - The standard error of the mean in the sample(s), along the input axis + s : ndarray or float + The standard error of the mean in the sample(s), along the input axis. -""" + Notes + ----- + The default value for `ddof` is different to the default (0) used by other + ddof containing routines, such as np.std nd stats.nanstd. + + Examples + -------- + Find standard error along the first axis: + + >>> from scipy import stats + >>> a = np.arange(20).reshape(5,4) + >>> stats.sem(a) + array([ 2.8284, 2.8284, 2.8284, 2.8284]) + + Find standard error across the whole array, using n degrees of freedom: + + >>> stats.sem(a, axis=None, ddof=0) + 1.2893796958227628 + + """ a, axis = _chk_asarray(a, axis) n = a.shape[axis] #s = samplestd(a,axis) / np.sqrt(n-1) @@ -1691,23 +1839,51 @@ Parameters ---------- - a: array_like - An array like object containing the sample data - axis: int or None, optional - If axis is equal to None, the array is first ravel'd. If axis is an - integer, this is the axis over which to operate. Defaults to 0. + a : array_like + An array like object containing the sample data. + axis : int or None, optional + If `axis` is equal to None, the array is first raveled. If `axis` is + an integer, this is the axis over which to operate. Default is 0. + ddof : int, optional + Degrees of freedom correction in the calculation of the + standard deviation. Default is 0. Returns ------- - zscore: array_like - the z-scores, standardized by mean and standard deviation of input - array + zscore : array_like + The z-scores, standardized by mean and standard deviation of input + array `a`. Notes ----- - This function does not convert array classes, and works also with - matrices and masked arrays. + This function preserves ndarray subclasses, and works also with + matrices and masked arrays (it uses `asanyarray` instead of `asarray` + for parameters). + Examples + -------- + >>> a = np.array([ 0.7972, 0.0767, 0.4383, 0.7866, 0.8091, 0.1954, + 0.6307, 0.6599, 0.1065, 0.0508]) + >>> from scipy import stats + >>> stats.zscore(a) + array([ 1.1273, -1.247 , -0.0552, 1.0923, 1.1664, -0.8559, 0.5786, + 0.6748, -1.1488, -1.3324]) + + Computing along a specified axis, using n-1 degrees of freedom (``ddof=1``) + to calculate the standard deviation: + + >>> b = np.array([[ 0.3148, 0.0478, 0.6243, 0.4608], + [ 0.7149, 0.0775, 0.6072, 0.9656], + [ 0.6341, 0.1403, 0.9759, 0.4064], + [ 0.5918, 0.6948, 0.904 , 0.3721], + [ 0.0921, 0.2481, 0.1188, 0.1366]]) + >>> stats.zscore(b, axis=1, ddof=1) + array([[-1.1649, -1.4319, -0.8554, -1.0189], + [-0.8661, -1.5035, -0.9737, -0.6154], + [-0.888 , -1.3817, -0.5461, -1.1156], + [-2.3043, -2.2014, -1.9921, -2.5241], + [-2.0773, -1.9212, -2.0506, -2.0328]]) + """ a = np.asanyarray(a) mns = a.mean(axis=axis) @@ -1722,32 +1898,37 @@ def zmap(scores, compare, axis=0, ddof=0): """ - Calculates the zscores relative to the mean and standard deviation - of second input. + Calculates the relative z-scores. - Returns an array of z-scores, i.e. scores that are standardized to zero + Returns an array of z-scores, i.e., scores that are standardized to zero mean and unit variance, where mean and variance are calculated from the comparison array. Parameters ---------- - scores : array-like - The input for which z scores are calculated - compare : array-like - The input from which the mean and standard deviation of the - normalization are taken, assumed to have same dimension as scores - axis : integer or None, {optional, default 0) - axis over which mean and std of compare array are calculated + scores : array_like + The input for which z-scores are calculated. + compare : array_like + The input from which the mean and standard deviation of the + normalization are taken; assumed to have the same dimension as + `scores`. + axis : int or None, optional + Axis over which mean and variance of `compare` are calculated. + Default is 0. + ddof : int, optional + Degrees of freedom correction in the calculation of the + standard deviation. Default is 0. Returns ------- zscore : array_like - zscore in the same shape as scores + Z-scores, in the same shape as `scores`. Notes ----- - This function does not convert array classes, and works also with - matrices and masked arrays. + This function preserves ndarray subclasses, and works also with + matrices and masked arrays (it uses `asanyarray` instead of `asarray` + for parameters). """ scores, compare = map(np.asanyarray, [scores, compare]) @@ -1767,16 +1948,39 @@ ##################################### def threshold(a, threshmin=None, threshmax=None, newval=0): - """Clip array to a given value. + """ + Clip array to a given value. -Similar to numpy.clip(), except that values less than threshmin or -greater than threshmax are replaced by newval, instead of by -threshmin and threshmax respectively. + Similar to numpy.clip(), except that values less than `threshmin` or + greater than `threshmax` are replaced by `newval`, instead of by + `threshmin` and `threshmax` respectively. -Returns: a, with values less than threshmin or greater than threshmax - replaced with newval + Parameters + ---------- + a : array_like + Data to threshold. + threshmin : float, int or None, optional + Minimum threshold, defaults to None. + threshmax : float, int or None, optional + Maximum threshold, defaults to None. + newval : float or int, optional + Value to put in place of values in `a` outside of bounds. + Defaults to 0. -""" + Returns + ------- + out : ndarray + The clipped input array, with values less than `threshmin` or + greater than `threshmax` replaced with `newval`. + + Examples + -------- + >>> a = np.array([9, 9, 6, 3, 1, 6, 1, 0, 0, 8]) + >>> from scipy import stats + >>> stats.threshold(a, threshmin=2, threshmax=8, newval=-1) + array([-1, -1, 6, 3, -1, 6, -1, -1, -1, 8]) + + """ a = asarray(a).copy() mask = zeros(a.shape, dtype=bool) if threshmin is not None: @@ -1789,35 +1993,39 @@ def sigmaclip(a, low=4., high=4.): - """Iterative sigma-clipping of array elements. + """ + Iterative sigma-clipping of array elements. The output array contains only those elements of the input array `c` that satisfy the conditions :: mean(c) - std(c)*low < c < mean(c) + std(c)*high + Starting from the full sample, all elements outside the critical range are + removed. The iteration continues with a new critical range until no + elements are outside the range. + Parameters ---------- a : array_like - data array, will be raveled if not 1d - low : float - lower bound factor of sigma clipping - high : float - upper bound factor of sigma clipping + Data array, will be raveled if not 1-D. + low : float, optional + Lower bound factor of sigma clipping. Default is 4. + high : float, optional + Upper bound factor of sigma clipping. Default is 4. Returns ------- - c : array - input array with clipped elements removed + c : ndarray + Input array with clipped elements removed. critlower : float - lower threshold value use for clipping + Lower threshold value use for clipping. critlupper : float - upper threshold value use for clipping + Upper threshold value use for clipping. - Examples -------- - >>> a = np.concatenate((np.linspace(9.5,10.5,31),np.linspace(0,20,5))) + >>> a = np.concatenate((np.linspace(9.5,10.5,31), np.linspace(0,20,5))) >>> fact = 1.5 >>> c, low, upp = sigmaclip(a, fact, fact) >>> c @@ -1851,15 +2059,36 @@ def trimboth(a, proportiontocut): """ -Slices off the passed proportion of items from BOTH ends of the passed -array (i.e., with proportiontocut=0.1, slices 'leftmost' 10% AND -'rightmost' 10% of scores. You must pre-sort the array if you want -"proper" trimming. Slices off LESS if proportion results in a -non-integer slice index (i.e., conservatively slices off -proportiontocut). + Slices off a proportion of items from both ends of an array. -Returns: trimmed version of array a -""" + Slices off the passed proportion of items from both ends of the passed + array (i.e., with `proportiontocut` = 0.1, slices leftmost 10% **and** + rightmost 10% of scores). You must pre-sort the array if you want + 'proper' trimming. Slices off less if proportion results in a + non-integer slice index (i.e., conservatively slices off + `proportiontocut`). + + Parameters + ---------- + a : array_like + Data to trim. + proportiontocut : float or int + Proportion of total data set to trim of each end. + + Returns + ------- + out : ndarray + Trimmed version of array `a`. + + Examples + -------- + >>> from scipy import stats + >>> a = np.arange(20) + >>> b = stats.trimboth(a, 0.1) + >>> b.shape + (16,) + + """ a = asarray(a) lowercut = int(proportiontocut*len(a)) uppercut = len(a) - lowercut @@ -1973,35 +2202,35 @@ """ Performs a 1-way ANOVA. - The on-way ANOVA tests the null hypothesis that 2 or more groups have + The one-way ANOVA tests the null hypothesis that two or more groups have the same population mean. The test is applied to samples from two or more groups, possibly with differing sizes. Parameters ---------- sample1, sample2, ... : array_like - The sample measurements should be given as arguments. + The sample measurements for each group. Returns ------- F-value : float - The computed F-value of the test + The computed F-value of the test. p-value : float - The associated p-value from the F-distribution + The associated p-value from the F-distribution. Notes ----- The ANOVA test has important assumptions that must be satisfied in order for the associated p-value to be valid. - 1. The samples are independent - 2. Each sample is from a normally distributed population + 1. The samples are independent. + 2. Each sample is from a normally distributed population. 3. The population standard deviations of the groups are all equal. This - property is known as homocedasticity. + property is known as homoscedasticity. If these assumptions are not true for a given set of data, it may still be possible to use the Kruskal-Wallis H-test (`stats.kruskal`_) although with - some loss of power + some loss of power. The algorithm is from Heiman[2], pp.394-7. @@ -2095,12 +2324,12 @@ Calculates a Spearman rank-order correlation coefficient and the p-value to test for non-correlation. - The Spearman correlation is a nonparametric measure of the linear - relationship between two datasets. Unlike the Pearson correlation, the - Spearman correlation does not assume that both datasets are normally + The Spearman correlation is a nonparametric measure of the monotonicity + of the relationship between two datasets. Unlike the Pearson correlation, + the Spearman correlation does not assume that both datasets are normally distributed. Like other correlation coefficients, this one varies between -1 and +1 with 0 implying no correlation. Correlations of -1 or - +1 imply an exact linear relationship. Positive correlations imply that + +1 imply an exact monotonic relationship. Positive correlations imply that as x increases, so does y. Negative correlations imply that as x increases, y decreases. @@ -2109,37 +2338,34 @@ as the one computed from these datasets. The p-values are not entirely reliable but are probably reasonable for datasets larger than 500 or so. - spearmanr currently does not do any tie correction, and is only correct - if there are no ties in the data. - Parameters ---------- a, b : 1D or 2D array_like, b is optional One or two 1-D or 2-D arrays containing multiple variables and - observations. Each column of m represents a variable, and each row - entry a single observation of those variables. Also see axis below. - Both arrays need to have the same length in the `axis` dimension. - + observations. Each column of `a` and `b` represents a variable, and + each row entry a single observation of those variables. See also + `axis`. Both arrays need to have the same length in the `axis` + dimension. axis : int or None, optional If axis=0 (default), then each column represents a variable, with observations in the rows. If axis=0, the relationship is transposed: each row represents a variable, while the columns contain observations. - If axis=None, then both arrays will be raveled + If axis=None, then both arrays will be raveled. Returns ------- - rho: float or array (2D square) - Spearman correlation matrix or correlation coefficient (if only 2 variables - are given as parameters. Correlation matrix is square with length - equal to total number of variables (columns or rows) in a and b - combined + rho: float or ndarray (2-D square) + Spearman correlation matrix or correlation coefficient (if only 2 + variables are given as parameters. Correlation matrix is square with + length equal to total number of variables (columns or rows) in a and b + combined. p-value : float The two-sided p-value for a hypothesis test whose null hypothesis is - that two sets of data are uncorrelated, has same dimension as rho + that two sets of data are uncorrelated, has same dimension as rho. Notes ----- - changes in scipy 0.8: rewrite to add tie-handling, and axis + Changes in scipy 0.8.0: rewrite to add tie-handling, and axis. References ---------- @@ -2151,7 +2377,6 @@ Examples -------- - >>> spearmanr([1,2,3,4,5],[5,6,7,8,7]) (0.82078268166812329, 0.088587005313543798) >>> np.random.seed(1234321) @@ -2221,19 +2446,39 @@ implying no correlation. Correlations of -1 or +1 imply a determinative relationship. + This function uses a shortcut formula but produces the same result as + `pearsonr`. + Parameters ---------- - x : array of bools - y : array of floats + x : array_like of bools + Input array. + y : array_like + Input array. Returns ------- - (point-biserial r, - 2-tailed p-value) + r : float + R value + p-value : float + 2-tailed p-value References ---------- http://www.childrens-mercy.org/stats/definitions/biserial.htm + + Examples + -------- + >>> from scipy import stats + >>> a = np.array([0, 0, 0, 1, 1, 1, 1]) + >>> b = np.arange(7) + >>> stats.pointbiserialr(a, b) + (0.8660254037844386, 0.011724811003954652) + >>> stats.pearsonr(a, b) + (0.86602540378443871, 0.011724811003954626) + >>> np.corrcoef(a, b) + array([[ 1. , 0.8660254], + [ 0.8660254, 1. ]]) """ ## Test data: http://support.sas.com/ctx/samples/index.jsp?sid=490&tab=output @@ -3372,28 +3617,75 @@ ##################################### def ss(a, axis=0): - """Squares each value in the passed array, adds these squares, and - returns the result. + """ + Squares each element of the input array, and returns the square(s) of that. Parameters ---------- - a : array - axis : int or None + a : array_like + Input array. + axis : int or None, optional + The axis along which to calculate. If None, use whole array. + Default is 0, i.e. along the first axis. Returns ------- - The sum along the given axis for (a*a). + ss : ndarray + The sum along the given axis for (a**2). + + See also + -------- + square_of_sums : The square(s) of the sum(s) (the opposite of `ss`). + + Examples + -------- + >>> from scipy import stats + >>> a = np.array([1., 2., 5.]) + >>> stats.ss(a) + 30.0 + + And calculating along an axis: + + >>> b = np.array([[1., 2., 5.], [2., 5., 6.]]) + >>> stats.ss(b, axis=1) + array([ 30., 65.]) + """ a, axis = _chk_asarray(a, axis) return np.sum(a*a, axis) def square_of_sums(a, axis=0): - """Adds the values in the passed array, squares that sum, and returns the -result. + """ + Sums elements of the input array, and returns the square(s) of that sum. -Returns: the square of the sum over axis. -""" + Parameters + ---------- + a : array_like + Input array. + axis : int or None, optional + If axis is None, ravel `a` first. If `axis` is an integer, this will + be the axis over which to operate. Defaults to 0. + + Returns + ------- + ss : float or ndarray + The square of the sum over `axis`. + + See also + -------- + ss : The sum of squares (the opposite of `square_of_sums`). + + Examples + -------- + >>> from scipy import stats + >>> a = np.arange(20).reshape(5,4) + >>> stats.square_of_sums(a) + array([ 1600., 2025., 2500., 3025.]) + >>> stats.square_of_sums(a, axis=None) + 36100.0 + + """ a, axis = _chk_asarray(a, axis) s = np.sum(a,axis) if not np.isscalar(s): @@ -3421,25 +3713,28 @@ return as_, it def rankdata(a): - """Ranks the data in a, dealing with ties appropriately. + """ + Ranks the data, dealing with ties appropriately. Equal values are assigned a rank that is the average of the ranks that would have been otherwise assigned to all of the values within that set. Ranks begin at 1, not 0. - Example - ------- - In [15]: stats.rankdata([0, 2, 2, 3]) - Out[15]: array([ 1. , 2.5, 2.5, 4. ]) - Parameters ---------- - a : array + a : array_like This array is first flattened. Returns ------- - An array of length equal to the size of a, containing rank scores. + rankdata : ndarray + An array of length equal to the size of `a`, containing rank scores. + + Examples + -------- + >>> stats.rankdata([0, 2, 2, 3]) + array([ 1. , 2.5, 2.5, 4. ]) + """ a = np.ravel(a) n = len(a) From scipy-svn at scipy.org Sun Nov 14 00:39:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 13 Nov 2010 23:39:03 -0600 (CST) Subject: [Scipy-svn] r6879 - in trunk/scipy/io: . arff matlab Message-ID: <20101114053903.0A44C37A197@scipy.org> Author: rgommers Date: 2010-11-13 23:39:02 -0600 (Sat, 13 Nov 2010) New Revision: 6879 Modified: trunk/scipy/io/arff/arffread.py trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/miobase.py trunk/scipy/io/netcdf.py Log: DOC: merge wiki edits for io module. Modified: trunk/scipy/io/arff/arffread.py =================================================================== --- trunk/scipy/io/arff/arffread.py 2010-11-14 05:38:10 UTC (rev 6878) +++ trunk/scipy/io/arff/arffread.py 2010-11-14 05:39:02 UTC (rev 6879) @@ -455,8 +455,15 @@ def loadarff(filename): - """Read an arff file. + """ + Read an arff file. + The data is returned as a record array, which can be accessed much like + a dictionary of numpy arrays. For example, if one of the attributes is + called 'pressure', then its first 10 data points can be accessed from the + ``data`` record array like so: ``data['pressure'][0:10]`` + + Parameters ---------- filename : str @@ -465,22 +472,32 @@ Returns ------- data : record array - the data of the arff file. Each record corresponds to one attribute. - meta : MetaData - this contains information about the arff file, like type and - names of attributes, the relation (name of the dataset), etc... + The data of the arff file, accessible by attribute names. + meta : `MetaData` + Contains information about the arff file such as name and + type of attributes, the relation (name of the dataset), etc... + Raises + ------ + `ParseArffError` + This is raised if the given file is not ARFF-formatted. + NotImplementedError + The ARFF file has an attribute which is not supported yet. + Notes ----- This function should be able to read most arff files. Not - implemented functionalities include: + implemented functionality include: * date type attributes * string type attributes - It can read files with numeric and nominal attributes. It can read - files with sparse data (? in the file). + It can read files with numeric and nominal attributes. It cannot read + files with sparse data ({} in the file). However, this function can + read files with missing data (? in the file), representing the data + points as NaNs. + """ ofile = open(filename) Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-14 05:38:10 UTC (rev 6878) +++ trunk/scipy/io/matlab/mio.py 2010-11-14 05:39:02 UTC (rev 6879) @@ -22,7 +22,7 @@ Parameters ---------- - file_name : string + file_name : str file name for mat file %(append_arg)s @@ -113,13 +113,14 @@ @docfiller def loadmat(file_name, mdict=None, appendmat=True, **kwargs): - ''' Load Matlab(tm) file + """ + Load MATLAB file Parameters ---------- %(file_arg)s m_dict : dict, optional - dictionary in which to insert matfile variables + Dictionary in which to insert matfile variables. %(append_arg)s %(load_args)s %(struct_arg)s @@ -143,7 +144,8 @@ You will need an HDF5 python library to read matlab 7.3 format mat files. Because scipy does not supply one, we do not implement the HDF5 / 7.3 interface here. - ''' + + """ variable_names = kwargs.pop('variable_names', None) MR = mat_reader_factory(file_name, appendmat, **kwargs) matfile_dict = MR.get_variables(variable_names) @@ -154,31 +156,53 @@ return mdict @docfiller -def savemat(file_name, mdict, - appendmat=True, - format='5', +def savemat(file_name, mdict, + appendmat=True, + format='5', long_field_names=False, do_compression=False, oned_as=None): - """Save a dictionary of names and arrays into the MATLAB-style .mat file. + """ + Save a dictionary of names and arrays into a MATLAB-style .mat file. - This saves the arrayobjects in the given dictionary to a matlab + This saves the array objects in the given dictionary to a MATLAB- style .mat file. Parameters ---------- - file_name : {string, file-like object} - Name of the mat file (do not need .mat extension if - appendmat==True) Can also pass open file-like object + file_name : str or file-like object + Name of the .mat file (.mat extension not needed if ``appendmat == + True``). + Can also pass open file_like object. m_dict : dict - dictionary from which to save matfile variables + Dictionary from which to save matfile variables. %(append_arg)s - format : {'5', '4'} string, optional - '5' for matlab 5 (up to matlab 7.2) - '4' for matlab 4 mat files + format : {'5', '4'}, string, optional + '5' (the default) for MATLAB 5 and up (to 7.2), + '4' for MATLAB 4 .mat files %(long_fields)s %(do_compression)s %(oned_as)s + + See also + -------- + mio4.MatFile4Writer + mio5.MatFile5Writer + + Notes + ----- + If ``format == '4'``, `mio4.MatFile4Writer` is called, which sets + `oned_as` to 'row' if it had been None. If ``format == '5'``, + `mio5.MatFile5Writer` is called, which sets `oned_as` to 'column' if + it had been None, but first it executes: + + ``warnings.warn("Using oned_as default value ('column')" +`` + ``" This will change to 'row' in future versions",`` + ``FutureWarning, stacklevel=2)`` + + without being more specific as to precisely when the change will take + place. + """ file_is_string = isinstance(file_name, basestring) if file_is_string: Modified: trunk/scipy/io/matlab/miobase.py =================================================================== --- trunk/scipy/io/matlab/miobase.py 2010-11-14 05:38:10 UTC (rev 6878) +++ trunk/scipy/io/matlab/miobase.py 2010-11-14 05:39:02 UTC (rev 6879) @@ -24,55 +24,55 @@ doc_dict = \ {'file_arg': - '''file_name : string + '''file_name : str Name of the mat file (do not need .mat extension if - appendmat==True) Can also pass open file-like object''', + appendmat==True) Can also pass open file-like object.''', 'append_arg': - '''appendmat : {True, False} optional + '''appendmat : bool, optional True to append the .mat extension to the end of the given - filename, if not already present''', + filename, if not already present.''', 'load_args': - '''byte_order : {None, string}, optional + '''byte_order : str or None, optional None by default, implying byte order guessed from mat file. Otherwise can be one of ('native', '=', 'little', '<', - 'BIG', '>') -mat_dtype : {False, True} optional + 'BIG', '>'). +mat_dtype : bool, optional If True, return arrays in same dtype as would be loaded into - matlab (instead of the dtype with which they are saved) -squeeze_me : {False, True} optional - whether to squeeze unit matrix dimensions or not -chars_as_strings : {True, False} optional - whether to convert char arrays to string arrays -matlab_compatible : {False, True} - returns matrices as would be loaded by matlab (implies + MATLAB (instead of the dtype with which they are saved). +squeeze_me : bool, optional + Whether to squeeze unit matrix dimensions or not. +chars_as_strings : bool, optional + Whether to convert char arrays to string arrays. +matlab_compatible : bool, optional + Returns matrices as would be loaded by MATLAB (implies squeeze_me=False, chars_as_strings=False, mat_dtype=True, - struct_as_record=True)''', + struct_as_record=True).''', 'struct_arg': - '''struct_as_record : {True, False} optional - Whether to load matlab structs as numpy record arrays, or as + '''struct_as_record : bool, optional + Whether to load MATLAB structs as numpy record arrays, or as old-style numpy arrays with dtype=object. Setting this flag to False replicates the behaviour of scipy version 0.7.x (returning numpy object arrays). The default setting is True, because it - allows easier round-trip load and save of matlab files.''', + allows easier round-trip load and save of MATLAB files.''', 'matstream_arg': '''mat_stream : file-like - object with file API, open for reading''', + Object with file API, open for reading.''', 'long_fields': - '''long_field_names : boolean, optional, default=False + '''long_field_names : bool, optional * False - maximum field name length in a structure is 31 characters - which is the documented maximum length + which is the documented maximum length. This is the default. * True - maximum field name length in a structure is 63 characters which works for Matlab 7.6''', 'do_compression': - '''do_compression : {False, True} bool, optional - Whether to compress matrices on write. Default is False''', + '''do_compression : bool, optional + Whether to compress matrices on write. Default is False.''', 'oned_as': - '''oned_as : {'column', 'row'} string, optional - If 'column', write 1D numpy arrays as column vectors - If 'row', write 1D numpy arrays as row vectors''', + '''oned_as : {'column', 'row'}, optional + If 'column', write 1-D numpy arrays as column vectors. + If 'row', write 1D numpy arrays as row vectors.''', 'unicode_strings': - '''unicode_strings : {True, False} boolean, optional - If True, write strings as Unicode, else matlab usual encoding'''} + '''unicode_strings : bool, optional + If True, write strings as Unicode, else matlab usual encoding.'''} docfiller = doccer.filldoc(doc_dict) Modified: trunk/scipy/io/netcdf.py =================================================================== --- trunk/scipy/io/netcdf.py 2010-11-14 05:38:10 UTC (rev 6878) +++ trunk/scipy/io/netcdf.py 2010-11-14 05:39:02 UTC (rev 6879) @@ -1,52 +1,57 @@ """ NetCDF reader/writer module. -This module implements the Scientific.IO.NetCDF API to read and create -NetCDF files. The same API is also used in the PyNIO and pynetcdf -modules, allowing these modules to be used interchangebly when working -with NetCDF files. The major advantage of ``scipy.io.netcdf`` over other -modules is that it doesn't require the code to be linked to the NetCDF -libraries as the other modules do. +This module is used to read and create NetCDF files. NetCDF files are +accessed through the `netcdf_file` object. Data written to and from NetCDF +files are contained in `netcdf_variable` objects. Attributes are given +as member variables of the `netcdf_file` and `netcdf_variable` objects. -The code is based on the `NetCDF file format specification -`_. A -NetCDF file is a self-describing binary format, with a header followed -by data. The header contains metadata describing dimensions, variables -and the position of the data in the file, so access can be done in an -efficient manner without loading unnecessary data into memory. We use -the ``mmap`` module to create Numpy arrays mapped to the data on disk, -for the same purpose. +Notes +----- +NetCDF files are a self-describing binary data format. The file contains +metadata that describes the dimensions and variables in the file. More +details about NetCDF files can be found `here +`_. There +are three main sections to a NetCDF data structure: -The structure of a NetCDF file is as follows: +1. Dimensions +2. Variables +3. Attributes - C D F - - +The dimensions section records the name and length of each dimension used +by the variables. The variables would then indicate which dimensions it +uses and any attributes such as data units, along with containing the data +values for the variable. It is good practice to include a +variable that is the same name as a dimension to provide the values for +that axes. Lastly, the attributes section would contain additional +information such as the name of the file creator or the instrument used to +collect the data. -Record data refers to data where the first axis can be expanded at -will. All record variables share a same dimension at the first axis, -and they are stored at the end of the file per record, ie +When writing data to a NetCDF file, there is often the need to indicate the +'record dimension'. A record dimension is the unbounded dimension for a +variable. For example, a temperature variable may have dimensions of +latitude, longitude and time. If one wants to add more temperature data to +the NetCDF file as time progresses, then the temperature variable should +have the time dimension flagged as the record dimension. - A[0], B[0], ..., A[1], B[1], ..., etc, +This module implements the Scientific.IO.NetCDF API to read and create +NetCDF files. The same API is also used in the PyNIO and pynetcdf +modules, allowing these modules to be used interchangeably when working +with NetCDF files. The major advantage of this module over other +modules is that it doesn't require the code to be linked to the NetCDF +libraries. -so that new data can be appended to the file without changing its original -structure. Non-record data are padded to a 4n bytes boundary. Record data -are also padded, unless there is exactly one record variable in the file, -in which case the padding is dropped. All data is stored in big endian -byte order. +In addition, the NetCDF file header contains the position of the data in +the file, so access can be done in an efficient manner without loading +unnecessary data into memory. It uses the ``mmap`` module to create +Numpy arrays mapped to the data on disk, for the same purpose. -The Scientific.IO.NetCDF API allows attributes to be added directly to -instances of ``netcdf_file`` and ``netcdf_variable``. To differentiate -between user-set attributes and instance attributes, user-set attributes -are automatically stored in the ``_attributes`` attribute by overloading -``__setattr__``. This is the reason why the code sometimes uses -``obj.__dict__['key'] = value``, instead of simply ``obj.key = value``; -otherwise the key would be inserted into userspace attributes. +Examples +-------- +To create a NetCDF file: -To create a NetCDF file:: - - >>> import time - >>> f = netcdf_file('simple.nc', 'w') + >>> from scipy.io import netcdf + >>> f = netcdf.netcdf_file('simple.nc', 'w') >>> f.history = 'Created for a test' >>> f.createDimension('time', 10) >>> time = f.createVariable('time', 'i', ('time',)) @@ -54,9 +59,14 @@ >>> time.units = 'days since 2008-01-01' >>> f.close() -To read the NetCDF file we just created:: +Note the assignment of ``range(10)`` to ``time[:]``. Exposing the slice +of the time variable allows for the data to be set in the object, rather +than letting ``range(10)`` overwrite the ``time`` variable. - >>> f = netcdf_file('simple.nc', 'r') +To read the NetCDF file we just created: + + >>> from scipy.io import netcdf + >>> f = netcdf.netcdf_file('simple.nc', 'r') >>> print f.history Created for a test >>> time = f.variables['time'] @@ -68,13 +78,23 @@ 9 >>> f.close() -TODO: - * properly implement ``_FillValue``. - * implement Jeff Whitaker's patch for masked variables. - * fix character variables. - * implement PAGESIZE for Python 2.6? """ +#TODO: +# * properly implement ``_FillValue``. +# * implement Jeff Whitaker's patch for masked variables. +# * fix character variables. +# * implement PAGESIZE for Python 2.6? + +#The Scientific.IO.NetCDF API allows attributes to be added directly to +#instances of ``netcdf_file`` and ``netcdf_variable``. To differentiate +#between user-set attributes and instance attributes, user-set attributes +#are automatically stored in the ``_attributes`` attribute by overloading +#``__setattr__``. This is the reason why the code sometimes uses +#``obj.__dict__['key'] = value``, instead of simply ``obj.key = value``; +#otherwise the key would be inserted into userspace attributes. + + __all__ = ['netcdf_file', 'netcdf_variable'] @@ -122,35 +142,37 @@ class netcdf_file(object): """ - A ``netcdf_file`` object has two standard attributes: ``dimensions`` and - ``variables``. The values of both are dictionaries, mapping dimension + A file object for NetCDF data. + + A `netcdf_file` object has two standard attributes: `dimensions` and + `variables`. The values of both are dictionaries, mapping dimension names to their associated lengths and variable names to variables, respectively. Application programs should never modify these dictionaries. All other attributes correspond to global attributes defined in the NetCDF file. Global file attributes are created by assigning to an - attribute of the ``netcdf_file`` object. + attribute of the `netcdf_file` object. + Parameters + ---------- + filename : string or file-like + string -> filename + mode : {'r', 'w'}, optional + read-write mode, default is 'r' + mmap : None or bool, optional + Whether to mmap `filename` when reading. Default is True + when `filename` is a file name, False when `filename` is a + file-like object + version : {1, 2}, optional + version of netcdf to read / write, where 1 means *Classic + format* and 2 means *64-bit offset format*. Default is 1. See + `here `_ + for more info. + """ def __init__(self, filename, mode='r', mmap=None, version=1): - ''' Initialize netcdf_file from fileobj (string or file-like) - - Parameters - ---------- - filename : string or file-like - string -> filename - mode : {'r', 'w'}, optional - read-write mode, default is 'r' - mmap : None or bool, optional - Whether to mmap `filename` when reading. Default is True - when `filename` is a file name, False when `filename` is a - file-like object - version : {1, 2}, optional - version of netcdf to read / write, where 1 means *Classic - format* and 2 means *64-bit offset format*. Default is 1. See - http://www.unidata.ucar.edu/software/netcdf/docs/netcdf/Which-Format.html#Which-Format - ''' + """Initialize netcdf_file from fileobj (str or file-like).""" if hasattr(filename, 'seek'): # file-like self.fp = filename self.filename = 'None' @@ -192,6 +214,7 @@ self.__dict__[attr] = value def close(self): + """Closes the NetCDF file.""" if not self.fp.closed: try: self.flush() @@ -200,10 +223,59 @@ __del__ = close def createDimension(self, name, length): + """ + Adds a dimension to the Dimension section of the NetCDF data structure. + + Note that this function merely adds a new dimension that the variables can + reference. The values for the dimension, if desired, should be added as + a variable using `createVariable`, referring to this dimension. + + Parameters + ---------- + name : str + Name of the dimension (Eg, 'lat' or 'time'). + length : int + Length of the dimension. + + See Also + -------- + createVariable + + """ self.dimensions[name] = length self._dims.append(name) def createVariable(self, name, type, dimensions): + """ + Create an empty variable for the `netcdf_file` object, specifying its data + type and the dimensions it uses. + + Parameters + ---------- + name : str + Name of the new variable. + type : dtype or str + Data type of the variable. + dimensions : sequence of str + List of the dimension names used by the variable, in the desired order. + + Returns + ------- + variable : netcdf_variable + The newly created ``netcdf_variable`` object. + This object has also been added to the `netcdf_file` object as well. + + See Also + -------- + createDimension + + Notes + ----- + Any dimensions to be used by the variable should already exist in the + NetCDF data structure or should be created by `createDimension` prior to + creating the NetCDF variable. + + """ shape = tuple([self.dimensions[dim] for dim in dimensions]) shape_ = tuple([dim or 0 for dim in shape]) # replace None with 0 for numpy @@ -217,6 +289,14 @@ return self.variables[name] def flush(self): + """ + Perform a sync-to-disk flush if the `netcdf_file` object is in write mode. + + See Also + -------- + sync : Identical function + + """ if hasattr(self, 'mode') and self.mode is 'w': self._write() sync = flush @@ -649,12 +729,47 @@ shape = property(shape) def getValue(self): + """ + Retrieve a scalar value from a `netcdf_variable` of length one. + + Raises + ------ + ValueError + If the netcdf variable is an array of length greater than one, + this exception will be raised. + + """ return self.data.item() def assignValue(self, value): + """ + Assign a scalar value to a `netcdf_variable` of length one. + + Parameters + ---------- + value : scalar + Scalar value (of compatible type) to assign to a length-one netcdf + variable. This value will be written to file. + + Raises + ------ + ValueError + If the input is not a scalar, or if the destination is not a length-one + netcdf variable. + + """ self.data.itemset(value) def typecode(self): + """ + Return the typecode of the variable. + + Returns + ------- + typecode : char + The character typecode of the variable (eg, 'i' for int). + + """ return self._typecode def __getitem__(self, index): From scipy-svn at scipy.org Sun Nov 14 02:08:13 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 01:08:13 -0600 (CST) Subject: [Scipy-svn] r6880 - trunk/scipy/ndimage Message-ID: <20101114070813.63B8037A196@scipy.org> Author: rgommers Date: 2010-11-14 01:08:13 -0600 (Sun, 14 Nov 2010) New Revision: 6880 Modified: trunk/scipy/ndimage/measurements.py trunk/scipy/ndimage/morphology.py Log: DOC: merge wiki edits for ndimage module. Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-11-14 05:39:02 UTC (rev 6879) +++ trunk/scipy/ndimage/measurements.py 2010-11-14 07:08:13 UTC (rev 6880) @@ -165,14 +165,55 @@ return return_value, max_label def find_objects(input, max_label = 0): - """Find objects in a labeled array. + """ + Find objects in a labeled array. - The input must be an array with labeled objects. A list of slices - into the array is returned that contain the objects. The list - represents a sequence of the numbered objects. If a number is - missing, None is returned instead of a slice. If max_label > 0, it - gives the largest object number that is searched for, otherwise - all are returned. + Parameters + ---------- + input : ndarray of ints + Array containing objects defined by different labels. + max_label : int, optional + Maximum label to be searched for in `input`. If max_label is not + given, the positions of all objects are returned. + + Returns + ------- + object_slices : list of slices + A list of slices, one for the extent of each labeled object. + Slices correspond to the minimal parallelepiped that contains + the object. If a number is missing, None is returned instead + of a slice. + + See Also + -------- + label, center_of_mass + + Notes + ----- + This function is very useful for isolating a volume of interest inside + a 3-D array, that cannot be "seen through". + + Examples + -------- + >>> a = np.zeros((6,6), dtype=np.int) + >>> a[2:4, 2:4] = 1 + >>> a[4, 4] = 1 + >>> a[:2, :3] = 2 + >>> a[0, 5] = 3 + >>> a + array([[2, 2, 2, 0, 0, 3], + [2, 2, 2, 0, 0, 0], + [0, 0, 1, 1, 0, 0], + [0, 0, 1, 1, 0, 0], + [0, 0, 0, 0, 1, 0], + [0, 0, 0, 0, 0, 0]]) + >>> ndimage.find_objects(a) + [(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None)), (slice(0, 1, None), slice(5, 6, None))] + >>> ndimage.find_objects(a, max_label=2) + [(slice(2, 5, None), slice(2, 5, None)), (slice(0, 2, None), slice(0, 3, None))] + >>> ndimage.find_objects(a == 1, max_label=2) + [(slice(2, 5, None), slice(2, 5, None)), None] + """ input = numpy.asarray(input) if numpy.iscomplexobj(input): @@ -182,16 +223,74 @@ return _nd_image.find_objects(input, max_label) def labeled_comprehension(input, labels, index, func, out_dtype, default, pass_positions=False): - '''Roughly equivalent to [func(input[labels == i]) for i in index]. + """ + Roughly equivalent to [func(input[labels == i]) for i in index]. - Special cases: - - index a scalar: returns a single value - - index is None: returns func(inputs[labels > 0]) + Sequentially applies an arbitrary function (that works on array_like input) + to subsets of an n-D image array specified by `labels` and `index`. + The option exists to provide the function with positional parameters as the + second argument. - func will be called with linear indices as a second argument if - pass_positions is True. - ''' + Parameters + ---------- + input : array_like + Data from which to select `labels` to process. + labels : array_like, or None + Labels to objects in `input`. + If not None, array must be same shape as `input`. + If None, `func` is applied to raveled `input`. + index : int, sequence of int, or None + Subset of `labels` to which to apply `func`. + If a scalar, a single value is returned. + If None, `func` is applied to all non-zero values of `labels`. + func : callable + Python function to apply to `labels` from `input`. + out_dtype : dtype + Dtype to use for `result`. + default : int, float, or None + Default return value when a element of `index` does not exist + in `labels`. + pass_positions : bool, optional + If True, pass linear indices to `func` as a second argument. + Default is False. + Returns + ------- + result : ndarray + Result of applying `func` to each of `labels` to `input` in `index`. + + Examples + -------- + >>> a = np.array([[1, 2, 0, 0], + [5, 3, 0, 4], + [0, 0, 0, 7], + [9, 3, 0, 0]]) + >>> from scipy import ndimage + >>> lbl, nlbl = ndimage.label(a) + >>> lbls = np.arange(1, nlbl+1) + >>> ndimage.labeled_comprehension(a, lbl, lbls, np.mean, float, 0) + array([ 2.75, 5.5 , 6. ]) + + Falling back to `default`: + + >>> lbls = np.arange(1, nlbl+2) + >>> ndimage.labeled_comprehension(a, lbl, lbls, np.mean, float, -1) + array([ 2.75, 5.5 , 6. , -1. ]) + + Passing positions: + + >>> def fn(val, pos): + ... print "fn says:", val, ":", pos + ... return (val.sum()) if (pos.sum() % 2 == 0) else (-val.sum()) + ... + >>> ndimage.labeled_comprehension(a, lbl, lbls, fn, float, 0, True) + fn says: [1 2 5 3] : [0 1 4 5] + fn says: [4 7] : [7 11] + fn says: [9 3] : [12 13] + array([ 11., 11., -12.]) + + """ + as_scalar = numpy.isscalar(index) input = numpy.asarray(input) @@ -400,12 +499,52 @@ return sum / numpy.asanyarray(count).astype(numpy.float) def variance(input, labels = None, index = None): - """Calculate the variance of the values of an array at labels. + """ + Calculate the variance of the values of an n-D image array, optionally at + specified sub-regions. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- + input : array_like + Nd-image data to process. + labels : array_like, or None, optional + Labels defining sub-regions in `input`. + If not None, must be same shape as `input`. + index : None, int, or sequence of int, optional + `labels` to include in output. + If None, all values where `labels` is non-zero are used. - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + vars : float or ndarray + Values of variance, for each sub-region if `labels` and `index` are + specified. + + See Also + -------- + label, standard_deviation, maximum, minimum, extrema + + Examples + -------- + >>> a = np.array([[1, 2, 0, 0], + [5, 3, 0, 4], + [0, 0, 0, 7], + [9, 3, 0, 0]]) + >>> from scipy import ndimage + >>> ndimage.variance(a) + 7.609375 + + Features to process can be specified using `labels` and `index`: + + >>> lbl, nlbl = ndimage.label(a) + >>> ndimage.variance(a, lbl, index=np.arange(1, nlbl+1)) + array([ 2.1875, 2.25 , 9. ]) + + If no index is given, all non-zero `labels` are processed: + + >>> ndimage.variance(a, lbl) + 6.1875 + """ count, sum, sum_c_sq = _stats(input, labels, index, centered=True) @@ -413,12 +552,52 @@ return sum_c_sq / np.asanyarray(count).astype(float) def standard_deviation(input, labels = None, index = None): - """Calculate the standard deviation of the values of an array at labels. + """ + Calculate the standard deviation of the values of an n-D image array, + optionally at specified sub-regions. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- + input : array_like + Nd-image data to process. + labels : array_like, or None, optional + Labels to identify sub-regions in `input`. + If not None, must be same shape as `input`. + index : None, int, or sequence of int, optional + `labels` to include in output. + If None, all values where `labels` is non-zero are used. - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + std : float or ndarray + Values of standard deviation, for each sub-region if `labels` and + `index` are specified. + + See Also + -------- + label, variance, maximum, minimum, extrema + + Examples + -------- + >>> a = np.array([[1, 2, 0, 0], + [5, 3, 0, 4], + [0, 0, 0, 7], + [9, 3, 0, 0]]) + >>> from scipy import ndimage + >>> ndimage.standard_deviation(a) + 2.7585095613392387 + + Features to process can be specified using `labels` and `index`: + + >>> lbl, nlbl = ndimage.label(a) + >>> ndimage.standard_deviation(a, lbl, index=np.arange(1, nlbl+1)) + array([ 1.479, 1.5 , 3. ]) + + If no index is given, non-zero `labels` are processed: + + >>> ndimage.standard_deviation(a, lbl) + 2.4874685927665499 + """ return numpy.sqrt(variance(input, labels, index)) @@ -580,7 +759,7 @@ Parameters ---------- input : array_like - Array-like of values. For each region specified by `labels`, the + Array_like of values. For each region specified by `labels`, the maximal values of `input` over the region is computed. labels : array_like, optional An array of integers marking different regions over which the @@ -693,15 +872,57 @@ return [tuple(v) for v in (result.reshape(-1, 1) // dim_prod) % dims] def extrema(input, labels = None, index = None): - """Calculate the minimums and maximums of the values of an array + """ + Calculate the minimums and maximums of the values of an array at labels, along with their positions. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- + input : ndarray + Nd-image data to process. + labels : ndarray, or None, optional + Labels of features in input. + If not None, must be same shape as `input`. + index : None, int, or sequence of int, optional + Labels to include in output. + If None, all values where non-zero `labels` are used. - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + minimums, maximums : int or ndarray + Values of minimums and maximums in each feature. + min_positions, max_positions : tuple or list of tuples + Each tuple gives the n-D coordinates of the corresponding minimum + or maximum. - Returns: minimums, maximums, min_positions, max_positions + See Also + -------- + maximum, minimum, maximum_position, minimum_position, center_of_mass + + Examples + -------- + >>> a = np.array([[1, 2, 0, 0], + [5, 3, 0, 4], + [0, 0, 0, 7], + [9, 3, 0, 0]]) + >>> from scipy import ndimage + >>> ndimage.extrema(a) + (0, 9, (0, 2), (3, 0)) + + Features to process can be specified using `labels` and `index`: + + >>> lbl, nlbl = ndimage.label(a) + >>> ndimage.extrema(a, lbl, index=np.arange(1, nlbl+1)) + (array([1, 4, 3]), + array([5, 7, 9]), + [(0.0, 0.0), (1.0, 3.0), (3.0, 1.0)], + [(1.0, 0.0), (2.0, 3.0), (3.0, 0.0)]) + + If no index is given, non-zero `labels` are processed: + + >>> ndimage.extrema(a, lbl) + (1, 9, (0, 0), (3, 0)) + """ dims = numpy.array(numpy.asarray(input).shape) @@ -722,12 +943,46 @@ return minimums, maximums, min_positions, max_positions def center_of_mass(input, labels = None, index = None): - """Calculate the center of mass of the values of an array at labels. + """ + Calculate the center of mass of the values of an array at labels. - Labels must be None or an array of the same dimensions as the input. + Parameters + ---------- + input : ndarray + Data from which to calculate center-of-mass. + labels : ndarray or None, optional + Labels for objects in `input`, as generated by ndimage.labels. + Dimensions must be the same as `input`. + index : int, sequence of int, or None, optional + Labels for which to calculate centers-of-mass. If not specified, + all labels greater than zero are used. - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + centerofmass : tuple, or list of tuples + Co-ordinates of centers-of-masses. + + Examples + -------- + >>> a = np.array(([0,0,0,0], + [0,1,1,0], + [0,1,1,0], + [0,1,1,0])) + >>> from scipy import ndimage + >>> ndimage.measurements.center_of_mass(a) + (2.0, 1.5) + + Calculation of multiple objects in an image + + >>> b = np.array(([0,1,1,0], + [0,1,0,0], + [0,0,0,0], + [0,0,1,1], + [0,0,1,1])) + >>> lbl = ndimage.label(b)[0] + >>> ndimage.measurements.center_of_mass(b, lbl, [1,2]) + [(0.33333333333333331, 1.3333333333333333), (3.5, 2.5)] + """ normalizer = sum(input, labels, index) @@ -741,15 +996,55 @@ return [tuple(v) for v in numpy.array(results).T] def histogram(input, min, max, bins, labels = None, index = None): - """Calculate the histogram of the values of an array at labels. + """ + Calculate the histogram of the values of an array, optionally at labels. - Labels must be None or an array of the same dimensions as the input. + Histogram calculates the frequency of values in an array within bins + determined by `min`, `max`, and `bins`. `Labels` and `index` can limit + the scope of the histogram to specified sub-regions within the array. - The histograms are defined by the minimum and maximum values and the - number of bins. + Parameters + ---------- + input : array_like + Data for which to calculate histogram. + min, max : int + Minimum and maximum values of range of histogram bins. + bins : int + Number of bins. + labels : array_like or None, optional + Labels for objects in `input`. + If not None, must be same shape as `input`. + index : int, sequence of int, or None, optional + Label or labels for which to calculate histogram. If None, all values + where label is greater than zero are used - Index must be None, a single label or sequence of labels. If - none, all values where label is greater than zero are used. + Returns + ------- + hist : ndarray + Histogram counts. + + Examples + -------- + >>> a = np.array([[ 0. , 0.2146, 0.5962, 0. ], + [ 0. , 0.7778, 0. , 0. ], + [ 0. , 0. , 0. , 0. ], + [ 0. , 0. , 0.7181, 0.2787], + [ 0. , 0. , 0.6573, 0.3094]]) + >>> from scipy import ndimage + >>> ndimage.measurements.histogram(a, 0, 1, 10) + array([13, 0, 2, 1, 0, 1, 1, 2, 0, 0]) + + With labels and no indices, non-zero elements are counted: + + >>> lbl, nlbl = ndimage.label(a) + >>> ndimage.measurements.histogram(a, 0, 1, 10, lbl) + array([0, 0, 2, 1, 0, 1, 1, 2, 0, 0]) + + Indices can be used to count only certain objects: + + >>> ndimage.measurements.histogram(a, 0, 1, 10, lbl, 2) + array([0, 0, 1, 1, 0, 0, 1, 1, 0, 0]) + """ _bins = numpy.linspace(min, max, bins + 1) Modified: trunk/scipy/ndimage/morphology.py =================================================================== --- trunk/scipy/ndimage/morphology.py 2010-11-14 05:39:02 UTC (rev 6879) +++ trunk/scipy/ndimage/morphology.py 2010-11-14 07:08:13 UTC (rev 6880) @@ -2039,24 +2039,112 @@ def distance_transform_edt(input, sampling = None, return_distances = True, return_indices = False, distances = None, indices = None): - """Exact euclidean distance transform. + """ + Exact euclidean distance transform. In addition to the distance transform, the feature transform can be calculated. In this case the index of the closest background element is returned along the first axis of the result. - The return_distances, and return_indices flags can be used to - indicate if the distance transform, the feature transform, or both - must be returned. + Parameters + ---------- + input : array_like + Input data to transform. Can be any type but will be converted + into binary: 1 wherever input equates to True, 0 elsewhere. + sampling : float or int, or sequence of same, optional + Spacing of elements along each dimension. If a sequence, must be of + length equal to the input rank; if a single number, this is used for + all axes. If not specified, a grid spacing of unity is implied. + return_distances : bool, optional + Whether to return distance matrix. At least one of + return_distances/return_indices must be True. Default is True. + return_indices : bool, optional + Whether to return indices matrix. Default is False. + distance : ndarray, optional + Used for output of distance array, must be of type float64. + indices : ndarray, optional + Used for output of indices, must be of type int32. - Optionally the sampling along each axis can be given by the - sampling parameter which should be a sequence of length equal to - the input rank, or a single number in which the sampling is assumed - to be equal along all axes. + Returns + ------- + result : ndarray or list of ndarray + Either distance matrix, index matrix, or a list of the two, + depending on `return_x` flags and `distance` and `indices` + input parameters. - the distances and indices arguments can be used to give optional - output arrays that must be of the correct size and type (float64 - and int32). + Notes + ----- + The euclidean distance transform gives values of the euclidean + distance:: + + n + y_i = sqrt(sum (x[i]-b[i])**2) + i + + where b[i] is the background point (value 0) with the smallest + Euclidean distance to input points x[i], and n is the + number of dimensions. + + Examples + -------- + >>> a = np.array(([0,1,1,1,1], + [0,0,1,1,1], + [0,1,1,1,1], + [0,1,1,1,0], + [0,1,1,0,0])) + >>> from scipy import ndimage + >>> ndimage.distance_transform_edt(a) + array([[ 0. , 1. , 1.4142, 2.2361, 3. ], + [ 0. , 0. , 1. , 2. , 2. ], + [ 0. , 1. , 1.4142, 1.4142, 1. ], + [ 0. , 1. , 1.4142, 1. , 0. ], + [ 0. , 1. , 1. , 0. , 0. ]]) + + With a sampling of 2 units along x, 1 along y: + + >>> ndimage.distance_transform_edt(a, sampling=[2,1]) + array([[ 0. , 1. , 2. , 2.8284, 3.6056], + [ 0. , 0. , 1. , 2. , 3. ], + [ 0. , 1. , 2. , 2.2361, 2. ], + [ 0. , 1. , 2. , 1. , 0. ], + [ 0. , 1. , 1. , 0. , 0. ]]) + + Asking for indices as well: + + >>> edt, inds = ndimage.distance_transform_edt(a, return_indices=True) + >>> inds + array([[[0, 0, 1, 1, 3], + [1, 1, 1, 1, 3], + [2, 2, 1, 3, 3], + [3, 3, 4, 4, 3], + [4, 4, 4, 4, 4]], + [[0, 0, 1, 1, 4], + [0, 1, 1, 1, 4], + [0, 0, 1, 4, 4], + [0, 0, 3, 3, 4], + [0, 0, 3, 3, 4]]]) + + With arrays provided for inplace outputs: + + >>> indices = np.zeros(((np.rank(a),) + a.shape), dtype=np.int32) + >>> ndimage.distance_transform_edt(a, return_indices=True, indices=indices) + array([[ 0. , 1. , 1.4142, 2.2361, 3. ], + [ 0. , 0. , 1. , 2. , 2. ], + [ 0. , 1. , 1.4142, 1.4142, 1. ], + [ 0. , 1. , 1.4142, 1. , 0. ], + [ 0. , 1. , 1. , 0. , 0. ]]) + >>> indices + array([[[0, 0, 1, 1, 3], + [1, 1, 1, 1, 3], + [2, 2, 1, 3, 3], + [3, 3, 4, 4, 3], + [4, 4, 4, 4, 4]], + [[0, 0, 1, 1, 4], + [0, 1, 1, 1, 4], + [0, 0, 1, 4, 4], + [0, 0, 3, 3, 4], + [0, 0, 3, 3, 4]]]) + """ if (not return_distances) and (not return_indices): msg = 'at least one of distances/indices must be specified' From scipy-svn at scipy.org Sun Nov 14 04:57:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:57:33 -0600 (CST) Subject: [Scipy-svn] r6881 - trunk/scipy/linalg Message-ID: <20101114095733.DB11137B503@scipy.org> Author: rgommers Date: 2010-11-14 03:57:33 -0600 (Sun, 14 Nov 2010) New Revision: 6881 Modified: trunk/scipy/linalg/__init__.py trunk/scipy/linalg/basic.py trunk/scipy/linalg/special_matrices.py Log: DOC: merge wiki edits for linalg module. Modified: trunk/scipy/linalg/__init__.py =================================================================== --- trunk/scipy/linalg/__init__.py 2010-11-14 07:08:13 UTC (rev 6880) +++ trunk/scipy/linalg/__init__.py 2010-11-14 09:57:33 UTC (rev 6881) @@ -1,3 +1,98 @@ +""" +Linear Algebra +============== + +Basics +------ + +.. autosummary:: + :toctree: generated/ + + inv - Find the inverse of a square matrix + solve - Solve a linear system of equations + solve_banded - Solve a banded linear system + solveh_banded - Solve a Hermitian or symmetric banded system + det - Find the determinant of a square matrix + norm - Matrix and vector norm + lstsq - Solve a linear least-squares problem + pinv - Pseudo-inverse (Moore-Penrose) using lstsq + pinv2 - Pseudo-inverse using svd + +Eigenvalue Problems +------------------- + +.. autosummary:: + :toctree: generated/ + + eig - Find the eigenvalues and eigenvectors of a square matrix + eigvals - Find just the eigenvalues of a square matrix + eigh - Find the e-vals and e-vectors of a Hermitian or symmetric matrix + eigvalsh - Find just the eigenvalues of a Hermitian or symmetric matrix + eig_banded - Find the eigenvalues and eigenvectors of a banded matrix + eigvals_banded - Find just the eigenvalues of a banded matrix + +Decompositions +-------------- + +.. autosummary:: + :toctree: generated/ + + lu - LU decomposition of a matrix + lu_factor - LU decomposition returning unordered matrix and pivots + lu_solve - Solve Ax=b using back substitution with output of lu_factor + svd - Singular value decomposition of a matrix + svdvals - Singular values of a matrix + diagsvd - Construct matrix of singular values from output of svd + orth - Construct orthonormal basis for the range of A using svd + cholesky - Cholesky decomposition of a matrix + cholesky_banded - Cholesky decomp. of a sym. or Hermitian banded matrix + cho_factor - Cholesky decomposition for use in solving a linear system + cho_solve - Solve previously factored linear system + cho_solve_banded - Solve previously factored banded linear system + qr - QR decomposition of a matrix + schur - Schur decomposition of a matrix + rsf2csf - Real to complex Schur form + hessenberg - Hessenberg form of a matrix + +Matrix Functions +---------------- + +.. autosummary:: + :toctree: generated/ + + expm - Matrix exponential using Pade approximation + expm2 - Matrix exponential using eigenvalue decomposition + expm3 - Matrix exponential using Taylor-series expansion + logm - Matrix logarithm + cosm - Matrix cosine + sinm - Matrix sine + tanm - Matrix tangent + coshm - Matrix hyperbolic cosine + sinhm - Matrix hyperbolic sine + tanhm - Matrix hyperbolic tangent + signm - Matrix sign + sqrtm - Matrix square root + funm - Evaluating an arbitrary matrix function + +Special Matrices +---------------- + +.. autosummary:: + :toctree: generated/ + + block_diag - Construct a block diagonal matrix from submatrices + circulant - Circulant matrix + companion - Companion matrix + hadamard - Hadamard matrix of order 2**n + hankel - Hankel matrix + kron - Kronecker product of two arrays + leslie - Leslie matrix + toeplitz - Toeplitz matrix + tri - Construct a matrix filled with ones at and below a given diagonal + tril - Construct a lower-triangular matrix from a given matrix + triu - Construct an upper-triangular matrix from a given matrix + +""" # # linalg - Dense Linear Algebra routines # Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-11-14 07:08:13 UTC (rev 6880) +++ trunk/scipy/linalg/basic.py 2010-11-14 09:57:33 UTC (rev 6881) @@ -260,29 +260,35 @@ # matrix inversion def inv(a, overwrite_a=False): - """Compute the inverse of a matrix. + """ + Compute the inverse of a matrix. Parameters ---------- - a : array-like, shape (M, M) - Matrix to be inverted + a : array_like + Square matrix to be inverted. overwrite_a : bool, optional - Discard data in ``a`` (may improve performance) + Discard data in `a` (may improve performance). Default is False. Returns ------- - ainv : array-like, shape (M, M) - Inverse of the matrix a + ainv : ndarray + Inverse of the matrix `a`. - Raises LinAlgError if a is singular + Raises + ------ + LinAlgError : + If `a` is singular. + ValueError : + If `a` is not square, or not 2-dimensional. Examples -------- - >>> a = array([[1., 2.], [3., 4.]]) - >>> inv(a) + >>> a = np.array([[1., 2.], [3., 4.]]) + >>> sp.linalg.inv(a) array([[-2. , 1. ], [ 1.5, -0.5]]) - >>> dot(a, inv(a)) + >>> np.dot(a, sp.linalg.inv(a)) array([[ 1., 0.], [ 0., 1.]]) Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-11-14 07:08:13 UTC (rev 6880) +++ trunk/scipy/linalg/special_matrices.py 2010-11-14 09:57:33 UTC (rev 6881) @@ -118,27 +118,26 @@ """ Construct a Toeplitz matrix. - The Toepliz matrix has constant diagonals, with c as its first column - and r as its first row. If r is not given, r == conjugate(c) is + The Toeplitz matrix has constant diagonals, with c as its first column + and r as its first row. If r is not given, ``r == conjugate(c)`` is assumed. Parameters ---------- - c : array-like, 1D + c : array_like First column of the matrix. Whatever the actual shape of `c`, it - will be converted to a 1D array. - r : array-like, 1D - First row of the matrix. If None, `r = conjugate(c)` is assumed; in - this case, if `c[0]` is real, the result is a Hermitian matrix. - `r[0]` is ignored; the first row of the returned matrix is - `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be - converted to a 1D array. + will be converted to a 1-D array. + r : array_like + First row of the matrix. If None, ``r = conjugate(c)`` is assumed; + in this case, if c[0] is real, the result is a Hermitian matrix. + r[0] is ignored; the first row of the returned matrix is + ``[c[0], r[1:]]``. Whatever the actual shape of `r`, it will be + converted to a 1-D array. Returns ------- A : array, shape (len(c), len(r)) - The Toeplitz matrix. - dtype is the same as `(c[0] + r[0]).dtype`. + The Toeplitz matrix. Dtype is the same as ``(c[0] + r[0]).dtype``. See also -------- @@ -184,8 +183,8 @@ Parameters ---------- - c : array-like, 1D - First column of the matrix. + c : array_like + 1-D array, the first column of the matrix. Returns ------- @@ -227,20 +226,19 @@ Parameters ---------- - c : array-like, 1D + c : array_like First column of the matrix. Whatever the actual shape of `c`, it - will be converted to a 1D array. - r : array-like, 1D - Last row of the matrix. If None, `r = zeros_like(c)` is assumed. - `r[0]` is ignored; the last row of the returned matrix is - `[c[-1], r[1:]]`. Whatever the actual shape of `r`, it will be - converted to a 1D array. + will be converted to a 1-D array. + r : array_like, 1D + Last row of the matrix. If None, ``r = zeros_like(c)`` is assumed. + r[0] is ignored; the last row of the returned matrix is + ``[c[-1], r[1:]]``. Whatever the actual shape of `r`, it will be + converted to a 1-D array. Returns ------- A : array, shape (len(c), len(r)) - The Hankel matrix. - dtype is the same as `(c[0] + r[0]).dtype`. + The Hankel matrix. Dtype is the same as ``(c[0] + r[0]).dtype``. See also -------- @@ -331,28 +329,47 @@ def leslie(f, s): - """Create a Leslie matrix. - + """ + Create a Leslie matrix. + + Given the length n array of fecundity coefficients `f` and the length + n-1 array of survival coefficents `s`, return the associated Leslie matrix. + Parameters ---------- - f : array-like, 1D - The "fecundity" coefficients. - s : array-like, 1D - The "survival" coefficients. The length of `s` must be one less - than the length of `f`, and it must be at least 1. + f : array_like + The "fecundity" coefficients, has to be 1-D. + s : array_like + The "survival" coefficients, has to be 1-D. The length of `s` + must be one less than the length of `f`, and it must be at least 1. Returns ------- - L : ndarray, 2D - Returns a 2D numpy ndarray with shape `(n,n)`, where `n` is the + L : ndarray + Returns a 2-D ndarray of shape ``(n, n)``, where `n` is the length of `f`. The array is zero except for the first row, - which is `f`, and the first subdiagonal, which is `s`. - The data type of the array will be the data type of `f[0]+s[0]`. + which is `f`, and the first sub-diagonal, which is `s`. + The data-type of the array will be the data-type of ``f[0]+s[0]``. Notes ----- .. versionadded:: 0.8.0 + The Leslie matrix is used to model discrete-time, age-structured + population growth [1]_ [2]_. In a population with `n` age classes, two sets + of parameters define a Leslie matrix: the `n` "fecundity coefficients", + which give the number of offspring per-capita produced by each age + class, and the `n` - 1 "survival coefficients", which give the + per-capita survival rate of each age class. + + References + ---------- + .. [1] P. H. Leslie, On the use of matrices in certain population + mathematics, Biometrika, Vol. 33, No. 3, 183--212 (Nov. 1945) + .. [2] P. H. Leslie, Some further notes on the use of matrices in + population mathematics, Biometrika, Vol. 35, No. 3/4, 213--245 + (Dec. 1948) + Examples -------- >>> leslie([0.1, 2.0, 1.0, 0.1], [0.2, 0.8, 0.7]) @@ -360,6 +377,7 @@ [ 0.2, 0. , 0. , 0. ], [ 0. , 0.8, 0. , 0. ], [ 0. , 0. , 0.7, 0. ]]) + """ f = np.atleast_1d(f) s = np.atleast_1d(s) @@ -421,7 +439,8 @@ return np.concatenate(np.concatenate(o, axis=1), axis=1) def block_diag(*arrs): - """Create a block diagonal matrix from the provided arrays. + """ + Create a block diagonal matrix from provided arrays. Given the inputs `A`, `B` and `C`, the output will have these arrays arranged on the diagonal:: @@ -430,14 +449,11 @@ [0, B, 0], [0, 0, C]] - If all the input arrays are square, the output is known as a - block diagonal matrix. - Parameters ---------- - A, B, C, ... : array-like, up to 2D - Input arrays. A 1D array or array-like sequence with length n is - treated as a 2D array with shape (1,n). + A, B, C, ... : array_like, up to 2-D + Input arrays. A 1-D array or array_like sequence of length `n`is + treated as a 2-D array with shape ``(1,n)``. Returns ------- @@ -445,10 +461,10 @@ Array with `A`, `B`, `C`, ... on the diagonal. `D` has the same dtype as `A`. - References - ---------- - .. [1] Wikipedia, "Block matrix", - http://en.wikipedia.org/wiki/Block_diagonal_matrix + Notes + ----- + If all the input arrays are square, the output is known as a + block diagonal matrix. Examples -------- @@ -457,7 +473,7 @@ >>> B = [[3, 4, 5], ... [6, 7, 8]] >>> C = [[7]] - >>> print(block_diag(A, B, C)) + >>> block_diag(A, B, C) [[1 0 0 0 0 0] [0 1 0 0 0 0] [0 0 3 4 5 0] @@ -490,35 +506,49 @@ return out def companion(a): - """Create a companion matrix. + """ + Create a companion matrix. - Create the companion matrix associated with the polynomial whose + Create the companion matrix [1]_ associated with the polynomial whose coefficients are given in `a`. Parameters ---------- - a : array-like, 1D - Polynomial coefficients. The length of `a` must be at least two, - and `a[0]` must not be zero. + a : array_like + 1-D array of polynomial coefficients. The length of `a` must be + at least two, and ``a[0]`` must not be zero. Returns ------- c : ndarray - A square ndarray with shape `(n-1, n-1)`, where `n` is the length - of `a`. The first row of `c` is `-a[1:]/a[0]`, and the first - subdiagonal is all ones. The data type of the array is the same - as the data type of `1.0*a[0]`. + A square array of shape ``(n-1, n-1)``, where `n` is the length + of `a`. The first row of `c` is ``-a[1:]/a[0]``, and the first + sub-diagonal is all ones. The data-type of the array is the same + as the data-type of ``1.0*a[0]``. + Raises + ------ + ValueError + If any of the following are true: a) ``a.ndim != 1``; + b) ``a.size < 2``; c) ``a[0] == 0``. + Notes ----- .. versionadded:: 0.8.0 - + + References + ---------- + .. [1] R. A. Horn & C. R. Johnson, *Matrix Analysis*. Cambridge, UK: + Cambridge University Press, 1999, pp. 146-7. + Examples -------- - >>> companion([1, -10, 31, -30]) + >>> from scipy.linalg import companion + >>> companion([1, -10, 31, -30]) array([[ 10., -31., 30.], [ 1., 0., 0.], [ 0., 1., 0.]]) + """ a = np.atleast_1d(a) From scipy-svn at scipy.org Sun Nov 14 04:57:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:57:54 -0600 (CST) Subject: [Scipy-svn] r6882 - trunk/scipy/misc Message-ID: <20101114095754.0858E37B503@scipy.org> Author: rgommers Date: 2010-11-14 03:57:53 -0600 (Sun, 14 Nov 2010) New Revision: 6882 Modified: trunk/scipy/misc/__init__.py trunk/scipy/misc/common.py trunk/scipy/misc/pilutil.py Log: DOC: merge wiki edits for misc module. Modified: trunk/scipy/misc/__init__.py =================================================================== --- trunk/scipy/misc/__init__.py 2010-11-14 09:57:33 UTC (rev 6881) +++ trunk/scipy/misc/__init__.py 2010-11-14 09:57:53 UTC (rev 6882) @@ -1,4 +1,51 @@ +""" +Various utilities that don't have another home. +Note that the Python Imaging Library (PIL) is not a dependency +of SciPy and therefore the `pilutil` module is not available on +systems that don't have PIL installed. + +Modules +------- +.. autosummary:: + :toctree: generated/ + + common - Common functions requiring SciPy Base and Level 1 SciPy + doccer - Docstring fragment insertion utilities + helpmod - + pexec - + pilutil - Image utilities using the Python Imaging Library (PIL) + ppimport - Postpone module import to future + setup - + setupscons - + +Functions +--------- +.. autosummary:: + :toctree: generated/ + + bytescale - Byte scales an array (image) + central_diff_weights - Weights for an n-point central m-th derivative + comb - Combinations of N things taken k at a time, "N choose k" + derivative -\tFind the n-th derivative of a function at a point + factorial - The factorial function, n! = special.gamma(n+1) + factorial2 - Double factorial, (n!)! + factorialk - (...((n!)!)!...)! where there are k '!' + fromimage - Return a copy of a PIL image as a numpy array + imfilter - Simple filtering of an image + imread - Read an image file from a filename + imresize - Resize an image + imrotate - Rotate an image counter-clockwise + imsave - Save an array to an image file + imshow - Simple showing of an image through an external viewer + info - Get help information for a function, class, or module + lena - Get classic image processing example image Lena + pade - Pade approximation to function as the ratio of two polynomials + radon - + toimage - Takes a numpy array and returns a PIL image + +""" + from info import __doc__ __all__ = ['who', 'source', 'info'] Modified: trunk/scipy/misc/common.py =================================================================== --- trunk/scipy/misc/common.py 2010-11-14 09:57:33 UTC (rev 6881) +++ trunk/scipy/misc/common.py 2010-11-14 09:57:53 UTC (rev 6882) @@ -13,14 +13,38 @@ # to numpy perhaps? def factorial(n,exact=0): - """n! = special.gamma(n+1) + """ + The factorial function, n! = special.gamma(n+1). - If exact==0, then floating point precision is used, otherwise + If exact is 0, then floating point precision is used, otherwise exact long integer is computed. - Notes: - - Array argument accepted only for exact=0 case. - - If n<0, the return value is 0. + - Array argument accepted only for exact=0 case. + - If n<0, the return value is 0. + + Parameters + ---------- + n : int or array_like of ints + Calculate ``n!``. Arrays are only supported with `exact` set + to False. If ``n < 0``, the return value is 0. + exact : bool, optional + The result can be approximated rapidly using the gamma-formula + above. If `exact` is set to True, calculate the + answer exactly using integer arithmetic. Default is False. + + Returns + ------- + nf : float or int + Factorial of `n`, as an integer or a float depending on `exact`. + + Examples + -------- + >>> arr = np.array([3,4,5]) + >>> sc.factorial(arr, exact=False) + array([ 6., 24., 120.]) + >>> sc.factorial(5, exact=True) + 120L + """ if exact: if n < 0: @@ -39,9 +63,10 @@ def factorial2(n, exact=False): - """Double factorial. + """ + Double factorial. - This is the factorial with every second value is skipped, i.e., + This is the factorial with every second value skipped, i.e., ``7!! = 7 * 5 * 3 * 1``. It can be approximated numerically as:: n!! = special.gamma(n/2+1)*2**((m+1)/2)/sqrt(pi) n odd @@ -49,7 +74,7 @@ Parameters ---------- - n : int, array-like + n : int or array_like Calculate ``n!!``. Arrays are only supported with `exact` set to False. If ``n < 0``, the return value is 0. exact : bool, optional @@ -63,10 +88,12 @@ Double factorial of `n`, as an int or a float depending on `exact`. - References - ---------- - .. [1] Wikipedia, "Double Factorial", - http://en.wikipedia.org/wiki/Factorial#Double_factorial + Examples + -------- + >>> factorial2(7, exact=False) + array(105.00000000000001) + >>> factorial2(7, exact=True) + 105L """ if exact: @@ -100,7 +127,7 @@ Parameters ---------- - n : int, array-like + n : int, array_like Calculate multifactorial. Arrays are only supported with exact set to False. If n < 0, the return value is 0. exact : bool, optional @@ -117,6 +144,13 @@ NotImplementedError Raises when exact is False + Examples + -------- + >>> sc.factorialk(5, 1, exact=True) + 120L + >>> sc.factorialk(5, 3, exact=True) + 10L + """ if exact: if n < 1-k: @@ -133,14 +167,15 @@ def comb(N,k,exact=0): """ - Combinations of N things taken k at a time. + The number of combinations of N things taken k at a time. + This is often expressed as "N choose k". Parameters ---------- N : int, array - Nunmber of things. + Number of things. k : int, array - Numner of elements taken. + Number of elements taken. exact : int, optional If exact is 0, then floating point precision is used, otherwise exact long integer is computed. @@ -155,6 +190,15 @@ - Array arguments accepted only for exact=0 case. - If k > N, N < 0, or k < 0, then a 0 is returned. + Examples + -------- + >>> k = np.array([3, 4]) + >>> n = np.array([10, 10]) + >>> sc.comb(n, k, exact=False) + array([ 120., 210.]) + >>> sc.comb(10, 3, exact=True) + 120L + """ if exact: if (k > N) or (N < 0) or (k < 0): @@ -224,6 +268,14 @@ ----- Decreasing the step size too small can result in round-off error. + Examples + -------- + >>> def x2(x): + ... return x*x + ... + >>> derivative(x2, 2) + 4.0 + """ assert (order >= n+1), "Number of points must be at least the derivative order + 1." assert (order % 2 == 1), "Odd number of points only." @@ -282,6 +334,36 @@ return poly1d(p[::-1]), poly1d(q[::-1]) def lena(): + """ + Get classic image processing example image, Lena, at 8-bit grayscale + bit-depth, 512 x 512 size. + + Parameters + ---------- + None + + Returns + ------- + lena : ndarray + Lena image + + Examples + -------- + >>> import scipy.misc + >>> lena = scipy.misc.lena() + >>> lena.shape + (512, 512) + >>> lena.max() + 245 + >>> lena.dtype + dtype('int32') + + >>> import matplotlib.pyplot as plt + >>> plt.gray() + >>> plt.imshow(lena) + >>> plt.show() + + """ import cPickle, os fname = os.path.join(os.path.dirname(__file__),'lena.dat') f = open(fname,'rb') Modified: trunk/scipy/misc/pilutil.py =================================================================== --- trunk/scipy/misc/pilutil.py 2010-11-14 09:57:33 UTC (rev 6881) +++ trunk/scipy/misc/pilutil.py 2010-11-14 09:57:53 UTC (rev 6882) @@ -1,3 +1,10 @@ +""" +A collection of image utilities using the Python Imaging Library (PIL). + +Note that PIL is not a dependency of SciPy and this module is not +available on systems that don't have PIL installed. + +""" # Functions which need the PIL import numpy @@ -16,20 +23,44 @@ # Returns a byte-scaled image def bytescale(data, cmin=None, cmax=None, high=255, low=0): """ + Byte scales an array (image). + Parameters ---------- - im : PIL image - Input image. - flatten : bool - If true, convert the output to grey-scale + data : ndarray + PIL image data array. + cmin : Scalar + Bias scaling of small values, Default is data.min(). + cmax : scalar + Bias scaling of large values, Default is data.max(). + high : scalar + Scale max value to `high`. + low : scalar + Scale min value to `low`. Returns ------- img_array : ndarray - The different colour bands/channels are stored in the - third dimension, such that a grey-image is MxN, an - RGB-image MxNx3 and an RGBA-image MxNx4. + Bytescaled array. + Examples + -------- + >>> img = array([[ 91.06794177, 3.39058326, 84.4221549 ], + [ 73.88003259, 80.91433048, 4.88878881], + [ 51.53875334, 34.45808177, 27.5873488 ]]) + >>> bytescale(img) + array([[255, 0, 236], + [205, 225, 4], + [140, 90, 70]], dtype=uint8) + >>> bytescale(img, high=200, low=100) + array([[200, 100, 192], + [180, 188, 102], + [155, 135, 128]], dtype=uint8) + >>> bytescale(img, cmin=0, cmax=255) + array([[91, 3, 84], + [74, 81, 5], + [52, 34, 28]], dtype=uint8) + """ if data.dtype == uint8: return data @@ -255,8 +286,29 @@ return fromimage(im) def imshow(arr): - """Simple showing of an image through an external viewer. """ + Simple showing of an image through an external viewer. + + Uses the image viewer specified by the environment variable + SCIPY_PIL_IMAGE_VIEWER, or if that is not defined then `see`, + to view a temporary file generated from array data. + + Parameters + ---------- + arr : ndarray + Array of image data to show. + + Returns + ------- + None + + Examples + -------- + >>> a = np.tile(np.arange(255), (255,1)) + >>> from scipy import misc + >>> misc.pilutil.imshow(a) + + """ im = toimage(arr) fnum,fname = tempfile.mkstemp('.png') try: From scipy-svn at scipy.org Sun Nov 14 04:58:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:58:14 -0600 (CST) Subject: [Scipy-svn] r6883 - trunk/scipy/fftpack Message-ID: <20101114095814.0A2AA37BA40@scipy.org> Author: rgommers Date: 2010-11-14 03:58:13 -0600 (Sun, 14 Nov 2010) New Revision: 6883 Modified: trunk/scipy/fftpack/__init__.py trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/realtransforms.py Log: DOC: merge wiki edits for fftpack module. Modified: trunk/scipy/fftpack/__init__.py =================================================================== --- trunk/scipy/fftpack/__init__.py 2010-11-14 09:57:53 UTC (rev 6882) +++ trunk/scipy/fftpack/__init__.py 2010-11-14 09:58:13 UTC (rev 6883) @@ -1,3 +1,57 @@ +""" +Home of discrete Fourier transform algorithms + +Modules +======= + +.. autosummary:: + :toctree: generated/ + + basic - Basic discrete Fourier transform operators + convolve - Convolution functions + helper - TODO + pseudo_diffs - Differential and pseudo-differential operators + realtransforms - Real spectrum tranforms (DCT, DST, MDCT) + +Functions +========= + +Fast Fourier Transforms (FFTs) +------------------------------ + +.. autosummary:: + :toctree: generated/ + + fft - Fast (discrete) Fourier Transform (FFT) + ifft - Inverse FFT + fft2 - Two dimensional FFT + ifft2 - Two dimensional inverse FFT + fftn - n-dimensional FFT + ifftn - n-dimensional inverse FFT + rfft - FFT of strictly real-valued sequence + irfft - Inverse of rfft + rfftfreq - DFT sample frequencies (specific to rfft and irfft) + dct - Discrete cosine transform + idct - Inverse discrete cosine transform + +Differential and pseudo-differential operators +---------------------------------------------- + +.. autosummary:: + :toctree: generated/ + + diff - Differentiation and integration of periodic sequences + tilbert - Tilbert transform: cs_diff(x,h,h) + itilbert - Inverse Tilbert transform: sc_diff(x,h,h) + hilbert - Hilbert transform: cs_diff(x,inf,inf) + ihilbert - Inverse Hilbert transform: sc_diff(x,inf,inf) + cs_diff - cosh/sinh pseudo-derivative of periodic sequences + sc_diff - sinh/cosh pseudo-derivative of periodic sequences + ss_diff - sinh/sinh pseudo-derivative of periodic sequences + cc_diff - cosh/cosh pseudo-derivative of periodic sequences + shift - Shift periodic sequences + +""" # # fftpack - Discrete Fourier Transform algorithms. # Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2010-11-14 09:57:53 UTC (rev 6882) +++ trunk/scipy/fftpack/basic.py 2010-11-14 09:58:13 UTC (rev 6883) @@ -219,17 +219,27 @@ return swapaxes(tmp, axis, -1) def ifft(x, n=None, axis=-1, overwrite_x=0): - """ ifft(x, n=None, axis=-1, overwrite_x=0) -> y + """ + Return discrete inverse Fourier transform of real or complex sequence. - Return inverse discrete Fourier transform of arbitrary type - sequence x. + The returned complex array contains ``y(0), y(1),..., y(n-1)`` where - The returned complex array contains - [y(0),y(1),...,y(n-1)] - where - y(j) = 1/n sum[k=0..n-1] x[k] * exp(sqrt(-1)*j*k* 2*pi/n) + ``y(j) = (x * exp(2*pi*sqrt(-1)*j*np.arange(n)/n)).mean()``. - Optional input: see fft.__doc__ + Parameters + ---------- + x : array_like + Transformed data to invert. + n : int, optional + Length of the inverse Fourier transform. If ``n < x.shape[axis]``, + `x` is truncated. If ``n > x.shape[axis]``, `x` is zero-padded. + The default results in ``n = x.shape[axis]``. + axis : int, optional + Axis along which the ifft's are computed; the default is over the + last axis (i.e., ``axis=-1``). + overwrite_x : bool, optional + If True the contents of `x` can be destroyed; the default is False. + """ tmp = _asfarray(x) @@ -263,31 +273,45 @@ def rfft(x, n=None, axis=-1, overwrite_x=0): - """ rfft(x, n=None, axis=-1, overwrite_x=0) -> y + """ + Discrete Fourier transform of a real sequence. - Return discrete Fourier transform of real sequence x. + The returned real arrays contains:: - The returned real arrays contains [y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2))] if n is even [y(0),Re(y(1)),Im(y(1)),...,Re(y(n/2)),Im(y(n/2))] if n is odd + where - y(j) = sum[k=0..n-1] x[k] * exp(-sqrt(-1)*j*k* 2*pi/n) + :: + + y(j) = sum[k=0..n-1] x[k] * exp(-sqrt(-1)*j*k*2*pi/n) j = 0..n-1 - Note that y(-j) = y(n-j).conjugate(). - Optional input: - n - Defines the length of the Fourier transform. If n is not - specified then n=x.shape[axis] is set. If nx.shape[axis], x is zero-padded. - axis - The transform is applied along the given axis of the input - array (or the newly constructed array if n argument was used). - overwrite_x - If set to true, the contents of x can be destroyed. + Note that ``y(-j) == y(n-j).conjugate()``. - Notes: - y == rfft(irfft(y)) within numerical accuracy. + Parameters + ---------- + x : array_like, real-valued + The data to tranform. + n : int, optional + Defines the length of the Fourier transform. If `n` is not specified + (the default) then ``n = x.shape[axis]``. If ``n < x.shape[axis]``, + `x` is truncated, if ``n > x.shape[axis]``, `x` is zero-padded. + axis : int, optional + The axis along which the transform is applied. The default is the + last axis. + overwrite_x : bool, optional + If set to true, the contents of `x` can be overwritten. Default is + False. + + See also + -------- + fft, irfft, scipy.fftpack.basic + + Notes + ----- + Within numerical accuracy, ``y == rfft(irfft(y))``. + """ tmp = _asfarray(x) @@ -479,11 +503,17 @@ def ifft2(x, shape=None, axes=(-2,-1), overwrite_x=0): - """ ifft2(x, shape=None, axes=(-2,-1), overwrite_x=0) -> y + """ + 2-D discrete inverse Fourier transform of real or complex sequence. Return inverse two-dimensional discrete Fourier transform of arbitrary type sequence x. - See ifftn.__doc__ for more information. + See `ifft` for more information. + + See also + -------- + fft2, ifft + """ return ifftn(x,shape,axes,overwrite_x) Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2010-11-14 09:57:53 UTC (rev 6882) +++ trunk/scipy/fftpack/realtransforms.py 2010-11-14 09:58:13 UTC (rev 6883) @@ -19,7 +19,7 @@ Parameters ---------- - x : array-like + x : array_like The input array. type : {1, 2, 3}, optional Type of the DCT (see Notes). Default type is 2. @@ -42,7 +42,7 @@ Notes ----- For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to - matlab ``dct(x)``. + MATLAB ``dct(x)``. There are theoretically 8 types of the DCT, only the first 3 types are implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' @@ -115,11 +115,11 @@ def idct(x, type=2, n=None, axis=-1, norm=None): """ - Return the Inverse Discrete Cosine Transform of arbitrary type sequence x. + Return the Inverse Discrete Cosine Transform of an arbitrary type sequence. Parameters ---------- - x : array-like + x : array_like The input array. type : {1, 2, 3}, optional Type of the DCT (see Notes). Default type is 2. From scipy-svn at scipy.org Sun Nov 14 04:58:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:58:41 -0600 (CST) Subject: [Scipy-svn] r6884 - trunk/scipy/cluster Message-ID: <20101114095841.6677437B503@scipy.org> Author: rgommers Date: 2010-11-14 03:58:41 -0600 (Sun, 14 Nov 2010) New Revision: 6884 Modified: trunk/scipy/cluster/__init__.py trunk/scipy/cluster/hierarchy.py trunk/scipy/cluster/vq.py Log: DOC: merge wiki edits for cluster module. Modified: trunk/scipy/cluster/__init__.py =================================================================== --- trunk/scipy/cluster/__init__.py 2010-11-14 09:58:13 UTC (rev 6883) +++ trunk/scipy/cluster/__init__.py 2010-11-14 09:58:41 UTC (rev 6884) @@ -1,3 +1,20 @@ +""" +Vector Quantization / Kmeans +============================ +Clustering algorithms are useful in information theory, target detection, +communications, compression, and other areas. The `vq` module only +supports vector quantization and the k-means algorithms. Development of +self-organizing maps (SOM) and other approaches is underway. + +Hierarchical Clustering +======================= +The `hierarchy` module provides functions for hierarchical and +agglomerative clustering. Its features include generating hierarchical +clusters from distance matrices, computing distance matrices from +observation vectors, calculating statistics on clusters, cutting linkages +to generate flat clusters, and visualizing clusters with dendrograms. + +""" # # spatial - Distances # Modified: trunk/scipy/cluster/hierarchy.py =================================================================== --- trunk/scipy/cluster/hierarchy.py 2010-11-14 09:58:13 UTC (rev 6883) +++ trunk/scipy/cluster/hierarchy.py 2010-11-14 09:58:41 UTC (rev 6884) @@ -6,109 +6,75 @@ or find the roots of the forest formed by a cut by providing the flat cluster ids of each observation. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|fcluster |forms flat clusters from hierarchical clusters. | -+------------------+-------------------------------------------------+ -|fclusterdata |forms flat clusters directly from data. | -+------------------+-------------------------------------------------+ -|leaders |singleton root nodes for flat cluster. | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + fcluster + fclusterdata + leaders + These are routines for agglomerative clustering. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|linkage |agglomeratively clusters original observations. | -+------------------+-------------------------------------------------+ -|single |the single/min/nearest algorithm. (alias) | -+------------------+-------------------------------------------------+ -|complete |the complete/max/farthest algorithm. (alias) | -+------------------+-------------------------------------------------+ -|average |the average/UPGMA algorithm. (alias) | -+------------------+-------------------------------------------------+ -|weighted |the weighted/WPGMA algorithm. (alias) | -+------------------+-------------------------------------------------+ -|centroid |the centroid/UPGMC algorithm. (alias) | -+------------------+-------------------------------------------------+ -|median |the median/WPGMC algorithm. (alias) | -+------------------+-------------------------------------------------+ -|ward |the Ward/incremental algorithm. (alias) | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + linkage + single + complete + average + weighted + centroid + median + ward + These routines compute statistics on hierarchies. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|cophenet |computes the cophenetic distance between leaves. | -+------------------+-------------------------------------------------+ -|from_mlab_linkage |converts a linkage produced by MATLAB(TM). | -+------------------+-------------------------------------------------+ -|inconsistent |the inconsistency coefficients for cluster. | -+------------------+-------------------------------------------------+ -|maxinconsts |the maximum inconsistency coefficient for each | -| |cluster. | -+------------------+-------------------------------------------------+ -|maxdists |the maximum distance for each cluster. | -+------------------+-------------------------------------------------+ -|maxRstat |the maximum specific statistic for each cluster. | -+------------------+-------------------------------------------------+ -|to_mlab_linkage |converts a linkage to one MATLAB(TM) can | -| |understand. | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + cophenet + from_mlab_linkage + inconsistent + maxinconsts + maxdists + maxRstat + to_mlab_linkage + Routines for visualizing flat clusters. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|dendrogram |visualizes linkages (requires matplotlib). | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + dendrogram + These are data structures and routines for representing hierarchies as tree objects. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|ClusterNode |represents cluster nodes in a cluster hierarchy. | -+------------------+-------------------------------------------------+ -|leaves_list |a left-to-right traversal of the leaves. | -+------------------+-------------------------------------------------+ -|to_tree |represents a linkage matrix as a tree object. | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + ClusterNode + leaves_list + to_tree + These are predicates for checking the validity of linkage and inconsistency matrices as well as for checking isomorphism of two flat cluster assignments. -+------------------+-------------------------------------------------+ -|*Function* | *Description* | -+------------------+-------------------------------------------------+ -|is_valid_im |checks for a valid inconsistency matrix. | -+------------------+-------------------------------------------------+ -|is_valid_linkage |checks for a valid hierarchical clustering. | -+------------------+-------------------------------------------------+ -|is_isomorphic |checks if two flat clusterings are isomorphic. | -+------------------+-------------------------------------------------+ -|is_monotonic |checks if a linkage is monotonic. | -+------------------+-------------------------------------------------+ -|correspond |checks whether a condensed distance matrix | -| |corresponds with a linkage | -+------------------+-------------------------------------------------+ -|num_obs_linkage |the number of observations corresponding to a | -| |linkage matrix. | -+------------------+-------------------------------------------------+ +.. autosummary:: + :toctree: generated/ + is_valid_im + is_valid_linkage + is_isomorphic + is_monotonic + correspond + num_obs_linkage * MATLAB and MathWorks are registered trademarks of The MathWorks, Inc. * Mathematica is a registered trademark of The Wolfram Research, Inc. - References ---------- @@ -1332,38 +1298,40 @@ def fcluster(Z, t, criterion='inconsistent', depth=2, R=None, monocrit=None): """ Forms flat clusters from the hierarchical clustering defined by - the linkage matrix ``Z``. The threshold ``t`` is a required parameter. + the linkage matrix ``Z``. - :Arguments: + Parameters + ---------- + Z : ndarray + The hierarchical clustering encoded with the matrix returned + by the `linkage` function. + t : float + The threshold to apply when forming flat clusters. + criterion : str, optional + The criterion to use in forming flat clusters. This can + be any of the following values: - - Z : ndarray - The hierarchical clustering encoded with the matrix returned - by the ``linkage`` function. - - - t : double - The threshold to apply when forming flat clusters. - - - criterion : string (optional) - The criterion to use in forming flat clusters. This can - be any of the following values: - - * 'inconsistent': If a cluster node and all its - decendents have an inconsistent value less than or equal - to ``t`` then all its leaf descendents belong to the + 'inconsistent': + If a cluster node and all its + descendants have an inconsistent value less than or equal + to ``t`` then all its leaf descendants belong to the same flat cluster. When no non-singleton cluster meets this criterion, every node is assigned to its own cluster. (Default) - * 'distance': Forms flat clusters so that the original + 'distance': + Forms flat clusters so that the original observations in each flat cluster have no greater a cophenetic distance than ``t``. - * 'maxclust': Finds a minimum threshold ``r`` so that + 'maxclust': + Finds a minimum threshold ``r`` so that the cophenetic distance between any two original observations in the same flat cluster is no more than ``r`` and no more than ``t`` flat clusters are formed. - * 'monocrit': Forms a flat cluster from a cluster node c + 'monocrit': + Forms a flat cluster from a cluster node c with index i when ``monocrit[j] <= t``. For example, to threshold on the maximum mean distance @@ -1373,38 +1341,38 @@ MR = maxRstat(Z, R, 3) cluster(Z, t=0.8, criterion='monocrit', monocrit=MR) - * 'maxclust_monocrit': Forms a flat cluster from a + 'maxclust_monocrit': + Forms a flat cluster from a non-singleton cluster node ``c`` when ``monocrit[i] <= r`` for all cluster indices ``i`` below and including ``c``. ``r`` is minimized such that no more than ``t`` flat clusters are formed. monocrit must be monotonic. For example, to minimize the threshold t on maximum inconsistency values so that no more than 3 flat - clusters are formed, do: + clusters are formed, do:: MI = maxinconsts(Z, R) cluster(Z, t=3, criterion='maxclust_monocrit', monocrit=MI) - - depth : int (optional) - The maximum depth to perform the inconsistency calculation. - It has no meaning for the other criteria. (default=2) + depth : int, optional + The maximum depth to perform the inconsistency calculation. + It has no meaning for the other criteria. Default is 2. + R : ndarray, optional + The inconsistency matrix to use for the 'inconsistent' + criterion. This matrix is computed if not provided. + monocrit : ndarray, optional + An array of length n-1. ``monocrit[i]`` is the + statistics upon which non-singleton i is thresholded. The + monocrit vector must be monotonic, i.e. given a node c with + index i, for all node indices j corresponding to nodes + below c, ``monocrit[i] >= monocrit[j]``. - - R : ndarray (optional) - The inconsistency matrix to use for the 'inconsistent' - criterion. This matrix is computed if not provided. + Returns + ------- + fcluster : ndarray + An array of length n. T[i] is the flat cluster number to + which original observation i belongs. - - monocrit : ndarray (optional) - A ``(n-1)`` numpy vector of doubles. ``monocrit[i]`` is the - statistics upon which non-singleton ``i`` is thresholded. The - monocrit vector must be monotonic, i.e. given a node ``c`` with - index ``i``, for all node indices j corresponding to nodes - below ``c``, ``monocrit[i] >= monocrit[j]``. - - :Returns: - - - T : ndarray - A vector of length ``n``. ``T[i]`` is the flat cluster number to - which original observation ``i`` belongs. """ Z = np.asarray(Z, order='c') is_valid_linkage(Z, throw=True, name='Z') @@ -1444,67 +1412,56 @@ def fclusterdata(X, t, criterion='inconsistent', \ metric='euclidean', depth=2, method='single', R=None): """ - ``T = fclusterdata(X, t)`` + Cluster observation data using a given metric. - Clusters the original observations in the ``n`` by ``m`` data - matrix ``X`` (``n`` observations in ``m`` dimensions), using the - euclidean distance metric to calculate distances between original - observations, performs hierarchical clustering using the single - linkage algorithm, and forms flat clusters using the inconsistency - method with t as the cut-off threshold. + Clusters the original observations in the n-by-m data + matrix X (n observations in m dimensions), using the euclidean + distance metric to calculate distances between original observations, + performs hierarchical clustering using the single linkage algorithm, + and forms flat clusters using the inconsistency method with `t` as the + cut-off threshold. - A one-dimensional numpy array ``T`` of length ``n`` is - returned. ``T[i]`` is the index of the flat cluster to which the - original observation ``i`` belongs. + A one-dimensional array T of length n is returned. T[i] is the index + of the flat cluster to which the original observation i belongs. - :Arguments: + Parameters + ---------- + X : ndarray + n by m data matrix with n observations in m dimensions. + t : float + The threshold to apply when forming flat clusters. + criterion : str, optional + Specifies the criterion for forming flat clusters. Valid + values are 'inconsistent' (default), 'distance', or 'maxclust' + cluster formation algorithms. See `fcluster` for descriptions. + method : str, optional + The linkage method to use (single, complete, average, + weighted, median centroid, ward). See `linkage` for more + information. Default is "single". + metric : str, optional + The distance metric for calculating pairwise distances. See + `distance.pdist` for descriptions and linkage to verify + compatibility with the linkage method. + t : double, optional + The cut-off threshold for the cluster function or the + maximum number of clusters (criterion='maxclust'). + depth : int, optional + The maximum depth for the inconsistency calculation. See + `inconsistent` for more information. + R : ndarray, optional + The inconsistency matrix. It will be computed if necessary + if it is not passed. - - X : ndarray - ``n`` by ``m`` data matrix with ``n`` observations in ``m`` - dimensions. + Returns + ------- + T : ndarray + A vector of length n. T[i] is the flat cluster number to + which original observation i belongs. - - t : double - The threshold to apply when forming flat clusters. - - - criterion : string - Specifies the criterion for forming flat clusters. Valid - values are 'inconsistent', 'distance', or 'maxclust' cluster - formation algorithms. See ``fcluster`` for descriptions. - - - method : string - The linkage method to use (single, complete, average, - weighted, median centroid, ward). See ``linkage`` for more - information. - - - metric : string - The distance metric for calculating pairwise distances. See - distance.pdist for descriptions and linkage to verify - compatibility with the linkage method. - - - t : double - The cut-off threshold for the cluster function or the - maximum number of clusters (criterion='maxclust'). - - - depth : int - The maximum depth for the inconsistency calculation. See - ``inconsistent`` for more information. - - - R : ndarray - The inconsistency matrix. It will be computed if necessary - if it is not passed. - - - :Returns: - - - T : ndarray - A vector of length ``n``. ``T[i]`` is the flat cluster number to - which original observation ``i`` belongs. - Notes ----- + This function is similar to the MATLAB function clusterdata. - This function is similar to MATLAB(TM) clusterdata function. - """ X = np.asarray(X, order='c', dtype=np.double) Modified: trunk/scipy/cluster/vq.py =================================================================== --- trunk/scipy/cluster/vq.py 2010-11-14 09:58:13 UTC (rev 6883) +++ trunk/scipy/cluster/vq.py 2010-11-14 09:58:41 UTC (rev 6884) @@ -1,71 +1,77 @@ -""" K-means Clustering and Vector Quantization Module +""" +K-means Clustering and Vector Quantization Module - Provides routines for k-means clustering, generating code books - from k-means models, and quantizing vectors by comparing them with - centroids in a code book. +Provides routines for k-means clustering, generating code books +from k-means models, and quantizing vectors by comparing them with +centroids in a code book. - The k-means algorithm takes as input the number of clusters to - generate, k, and a set of observation vectors to cluster. It - returns a set of centroids, one for each of the k clusters. An - observation vector is classified with the cluster number or - centroid index of the centroid closest to it. +The k-means algorithm takes as input the number of clusters to +generate, k, and a set of observation vectors to cluster. It +returns a set of centroids, one for each of the k clusters. An +observation vector is classified with the cluster number or +centroid index of the centroid closest to it. - A vector v belongs to cluster i if it is closer to centroid i than - any other centroids. If v belongs to i, we say centroid i is the - dominating centroid of v. Common variants of k-means try to - minimize distortion, which is defined as the sum of the distances - between each observation vector and its dominating centroid. Each - step of the k-means algorithm refines the choices of centroids to - reduce distortion. The change in distortion is often used as a - stopping criterion: when the change is lower than a threshold, the - k-means algorithm is not making sufficient progress and - terminates. +A vector v belongs to cluster i if it is closer to centroid i than +any other centroids. If v belongs to i, we say centroid i is the +dominating centroid of v. The k-means algorithm tries to +minimize distortion, which is defined as the sum of the squared distances +between each observation vector and its dominating centroid. Each +step of the k-means algorithm refines the choices of centroids to +reduce distortion. The change in distortion is used as a +stopping criterion: when the change is lower than a threshold, the +k-means algorithm is not making sufficient progress and +terminates. One can also define a maximum number of iterations. - Since vector quantization is a natural application for k-means, - information theory terminology is often used. The centroid index - or cluster index is also referred to as a "code" and the table - mapping codes to centroids and vice versa is often referred as a - "code book". The result of k-means, a set of centroids, can be - used to quantize vectors. Quantization aims to find an encoding of - vectors that reduces the expected distortion. +Since vector quantization is a natural application for k-means, +information theory terminology is often used. The centroid index +or cluster index is also referred to as a "code" and the table +mapping codes to centroids and vice versa is often referred as a +"code book". The result of k-means, a set of centroids, can be +used to quantize vectors. Quantization aims to find an encoding of +vectors that reduces the expected distortion. - For example, suppose we wish to compress a 24-bit color image - (each pixel is represented by one byte for red, one for blue, and - one for green) before sending it over the web. By using a smaller - 8-bit encoding, we can reduce the amount of data by two - thirds. Ideally, the colors for each of the 256 possible 8-bit - encoding values should be chosen to minimize distortion of the - color. Running k-means with k=256 generates a code book of 256 - codes, which fills up all possible 8-bit sequences. Instead of - sending a 3-byte value for each pixel, the 8-bit centroid index - (or code word) of the dominating centroid is transmitted. The code - book is also sent over the wire so each 8-bit code can be - translated back to a 24-bit pixel value representation. If the - image of interest was of an ocean, we would expect many 24-bit - blues to be represented by 8-bit codes. If it was an image of a - human face, more flesh tone colors would be represented in the - code book. +All routines expect obs to be a M by N array where the rows are +the observation vectors. The codebook is a k by N array where the +i'th row is the centroid of code word i. The observation vectors +and centroids have the same feature dimension. - All routines expect obs to be a M by N array where the rows are - the observation vectors. The codebook is a k by N array where the - i'th row is the centroid of code word i. The observation vectors - and centroids have the same feature dimension. +As an example, suppose we wish to compress a 24-bit color image +(each pixel is represented by one byte for red, one for blue, and +one for green) before sending it over the web. By using a smaller +8-bit encoding, we can reduce the amount of data by two +thirds. Ideally, the colors for each of the 256 possible 8-bit +encoding values should be chosen to minimize distortion of the +color. Running k-means with k=256 generates a code book of 256 +codes, which fills up all possible 8-bit sequences. Instead of +sending a 3-byte value for each pixel, the 8-bit centroid index +(or code word) of the dominating centroid is transmitted. The code +book is also sent over the wire so each 8-bit code can be +translated back to a 24-bit pixel value representation. If the +image of interest was of an ocean, we would expect many 24-bit +blues to be represented by 8-bit codes. If it was an image of a +human face, more flesh tone colors would be represented in the +code book. - whiten(obs) -- - Normalize a group of observations so each feature has unit - variance. - vq(obs,code_book) -- - Calculate code book membership of a set of observation - vectors. - kmeans(obs,k_or_guess,iter=20,thresh=1e-5) -- - Clusters a set of observation vectors. Learns centroids with - the k-means algorithm, trying to minimize distortion. A code - book is generated that can be used to quantize vectors. - kmeans2 -- - A different implementation of k-means with more methods for - initializing centroids. Uses maximum number of iterations as - opposed to a distortion threshold as its stopping criterion. +Functions +--------- +`whiten` : + Normalize a group of observations so each feature has unit + variance. +`vq` : + Calculate code book membership of a set of observation + vectors. + +`kmeans` : + Clusters a set of observation vectors. Learns centroids with + the k-means algorithm, trying to minimize distortion. A code + book is generated that can be used to quantize vectors. + +`kmeans2` : + A different implementation of k-means with more methods for + initializing centroids. Uses maximum number of iterations as + opposed to a distortion threshold as its stopping criterion. + """ __docformat__ = 'restructuredtext' @@ -393,62 +399,68 @@ return code_book, avg_dist[-1] def kmeans(obs, k_or_guess, iter=20, thresh=1e-5): - """Performs k-means on a set of observation vectors forming k - clusters. This yields a code book mapping centroids to codes - and vice versa. The k-means algorithm adjusts the centroids - until sufficient progress cannot be made, i.e. the change in - distortion since the last iteration is less than some - threshold. + """ + Performs k-means on a set of observation vectors forming k clusters. - :Parameters: - obs : ndarray - Each row of the M by N array is an observation vector. The - columns are the features seen during each observation. - The features must be whitened first with the whiten - function. + The k-means algorithm adjusts the centroids until sufficient + progress cannot be made, i.e. the change in distortion since + the last iteration is less than some threshold. This yields + a code book mapping centroids to codes and vice versa. - k_or_guess : int or ndarray - The number of centroids to generate. A code is assigned to - each centroid, which is also the row index of the centroid - in the code_book matrix generated. + Distortion is defined as the sum of the squared differences + between the observations and the corresponding centroid. - The initial k centroids are chosen by randomly selecting - observations from the observation matrix. Alternatively, - passing a k by N array specifies the initial k centroids. + Parameters + ---------- + obs : ndarray + Each row of the M by N array is an observation vector. The + columns are the features seen during each observation. + The features must be whitened first with the `whiten` function. - iter : int - The number of times to run k-means, returning the codebook - with the lowest distortion. This argument is ignored if - initial centroids are specified with an array for the - k_or_guess paramter. This parameter does not represent the - number of iterations of the k-means algorithm. + k_or_guess : int or ndarray + The number of centroids to generate. A code is assigned to + each centroid, which is also the row index of the centroid + in the code_book matrix generated. - thresh : float - Terminates the k-means algorithm if the change in - distortion since the last k-means iteration is less than - thresh. + The initial k centroids are chosen by randomly selecting + observations from the observation matrix. Alternatively, + passing a k by N array specifies the initial k centroids. - :Returns: - codebook : ndarray - A k by N array of k centroids. The i'th centroid - codebook[i] is represented with the code i. The centroids - and codes generated represent the lowest distortion seen, - not necessarily the globally minimal distortion. + iter : int, optional + The number of times to run k-means, returning the codebook + with the lowest distortion. This argument is ignored if + initial centroids are specified with an array for the + ``k_or_guess`` parameter. This parameter does not represent the + number of iterations of the k-means algorithm. - distortion : float - The distortion between the observations passed and the - centroids generated. + thresh : float, optional + Terminates the k-means algorithm if the change in + distortion since the last k-means iteration is less than + or equal to thresh. - :SeeAlso: - - kmeans2: a different implementation of k-means clustering - with more methods for generating initial centroids but without - using a distortion change threshold as a stopping criterion. - - whiten: must be called prior to passing an observation matrix - to kmeans. + Returns + ------- + codebook : ndarray + A k by N array of k centroids. The i'th centroid + codebook[i] is represented with the code i. The centroids + and codes generated represent the lowest distortion seen, + not necessarily the globally minimal distortion. + distortion : float + The distortion between the observations passed and the + centroids generated. + + See Also + -------- + kmeans2 : a different implementation of k-means clustering + with more methods for generating initial centroids but without + using a distortion change threshold as a stopping criterion. + + whiten : must be called prior to passing an observation matrix + to kmeans. + Examples -------- - >>> from numpy import array >>> from scipy.cluster.vq import vq, kmeans, whiten >>> features = array([[ 1.9,2.3], From scipy-svn at scipy.org Sun Nov 14 04:59:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:59:06 -0600 (CST) Subject: [Scipy-svn] r6885 - trunk/scipy/interpolate Message-ID: <20101114095906.45A1237BA40@scipy.org> Author: rgommers Date: 2010-11-14 03:59:06 -0600 (Sun, 14 Nov 2010) New Revision: 6885 Modified: trunk/scipy/interpolate/__init__.py trunk/scipy/interpolate/interpolate.py trunk/scipy/interpolate/rbf.py Log: DOC: merge wiki edits for interpolate module. Modified: trunk/scipy/interpolate/__init__.py =================================================================== --- trunk/scipy/interpolate/__init__.py 2010-11-14 09:58:41 UTC (rev 6884) +++ trunk/scipy/interpolate/__init__.py 2010-11-14 09:59:06 UTC (rev 6885) @@ -1,3 +1,133 @@ +""" +Sub-package for objects used in interpolation. + +As listed below, this sub-package contains spline functions and classes, +one-dimensional and multi-dimensional (univariate and multivariate) +interpolation classes, Lagrange and Taylor polynomial interpolators, and +wrappers for `FITPACK `_ +and DFITPACK functions. + +Spline Functions +---------------- + +.. autosummary:: + :toctree: generated/ + + bisplev + bisplrep + insert + spalde + splev + spleval + splint + spline + splmake + splprep + splrep + spltopp + sproot + +Spline Classes +-------------- + +.. autosummary:: + :toctree: generated/ + + UnivariateSpline + InterpolatedUnivariateSpline + LSQUnivariateSpline + BivariateSpline + SmoothBivariateSpline + +Interpolation Classes (univariate) +---------------------------------- + +.. autosummary:: + :toctree: generated/ + + interp1d + BarycentricInterpolator + barycentric_interpolate + KroghInterpolator + krogh_interpolate + PiecewisePolynomial + piecewise_polynomial_interpolate + ppform + +Interpolation Classes (multivariate) +------------------------------------ + +.. autosummary:: + :toctree: generated/ + + interp2d + Rbf + +Additional tools +---------------- + +.. autosummary:: + :toctree: generated/ + + lagrange + approximate_taylor_polynomial + +Wrappers around FITPACK functions +--------------------------------- + +.. autosummary:: + :toctree: generated/ + + fitpack.bisplev + fitpack.bisplrep + fitpack.insert + fitpack.spalde + fitpack.splev + fitpack.splint + fitpack.splprep + fitpack.splrep + fitpack.sproot + +Wrappers around DFITPACK functions +---------------------------------- + + `dfitpack.bispeu` + `dfitpack.bispev` + `dfitpack.curfit` + `dfitpack.dblint` + `dfitpack.fpcurf0` + `dfitpack.fpcurf1` + `dfitpack.fpcurfm1` + `dfitpack.parcur` + `dfitpack.percur` + `dfitpack.regrid_smth` + `dfitpack.spalde` + `dfitpack.splder` + `dfitpack.splev` + `dfitpack.splint` + `dfitpack.sproot` + `dfitpack.surfit_lsq` + `dfitpack.surfit_smth` + +See Also +-------- + +.. autosummary:: + :toctree: generated/ + + ndimage.map_coordinates + ndimage.spline_filter + signal.resample + signal.bspline + signal.gauss_spline + signal.qspline1d + signal.cspline1d + signal.qspline1d_eval + signal.cspline1d_eval + signal.qspline2d + signal.cspline2d + +""" # # interpolate - Interpolation Tools # Modified: trunk/scipy/interpolate/interpolate.py =================================================================== --- trunk/scipy/interpolate/interpolate.py 2010-11-14 09:58:41 UTC (rev 6884) +++ trunk/scipy/interpolate/interpolate.py 2010-11-14 09:59:06 UTC (rev 6885) @@ -23,10 +23,22 @@ return all def lagrange(x, w): - """Return the Lagrange interpolating polynomial of the data-points (x,w) + """ + Return a Lagrange interpolating polynomial. - Warning: This implementation is numerically unstable; do not expect to + Given two 1-D arrays `x` and `w,` returns the Lagrange interpolating + polynomial through the points ``(x, w)``. + + Warning: This implementation is numerically unstable. Do not expect to be able to use more than about 20 points even if they are chosen optimally. + + Parameters + ---------- + x : array_like + `x` represents the x-coordinates of a set of datapoints. + w : array_like + `w` represents the y-coordinates of a set of datapoints, i.e. f(`x`). + """ M = len(x) p = poly1d(0.0) @@ -55,11 +67,11 @@ x, y : 1D arrays Arrays defining the coordinates of a 2D grid. If the points lie on a regular grid, `x` can specify the column coordinates - and `y` the row coordinates, e.g.:: + and `y` the row coordinates, for example: x = [0,1,2]; y = [0,3,7] - otherwise x and y must specify the full coordinates, i.e.:: + otherwise x and y must specify the full coordinates, for example: x = [0,1,2,0,1,2,0,1,2]; y = [0,0,0,3,3,3,7,7,7] Modified: trunk/scipy/interpolate/rbf.py =================================================================== --- trunk/scipy/interpolate/rbf.py 2010-11-14 09:58:41 UTC (rev 6884) +++ trunk/scipy/interpolate/rbf.py 2010-11-14 09:59:06 UTC (rev 6885) @@ -72,9 +72,9 @@ 'quintic': r**5 'thin_plate': r**2 * log(r) - If callable, then it must take 2 arguments (self, r). The epsilon parameter - will be available as self.epsilon. Other keyword arguments passed in will - be available as well. + If callable, then it must take 2 arguments (self, r). The epsilon + parameter will be available as self.epsilon. Other keyword + arguments passed in will be available as well. epsilon : float, optional Adjustable constant for gaussian or multiquadrics functions @@ -93,13 +93,14 @@ return sqrt( ((x1 - x2)**2).sum(axis=0) ) which is called with x1=x1[ndims,newaxis,:] and - x2=x2[ndims,:,newaxis] such that the result is a matrix of the distances - from each point in x1 to each point in x2. + x2=x2[ndims,:,newaxis] such that the result is a matrix of the + distances from each point in x1 to each point in x2. Examples -------- >>> rbfi = Rbf(x, y, z, d) # radial basis function interpolator instance >>> di = rbfi(xi, yi, zi) # interpolated values + """ def _euclidean_norm(self, x1, x2): From scipy-svn at scipy.org Sun Nov 14 04:59:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:59:33 -0600 (CST) Subject: [Scipy-svn] r6886 - in trunk/scipy/io: . arff matlab Message-ID: <20101114095933.4106B6F350@scipy.org> Author: rgommers Date: 2010-11-14 03:59:33 -0600 (Sun, 14 Nov 2010) New Revision: 6886 Modified: trunk/scipy/io/__init__.py trunk/scipy/io/arff/__init__.py trunk/scipy/io/data_store.py trunk/scipy/io/matlab/__init__.py trunk/scipy/io/matlab/mio.py trunk/scipy/io/netcdf.py trunk/scipy/io/wavfile.py Log: DOC: merge more wiki edits for io module. Modified: trunk/scipy/io/__init__.py =================================================================== --- trunk/scipy/io/__init__.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/__init__.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -1,3 +1,47 @@ +""" +Data input and output + +SciPy has many modules, classes, and functions available to read data +from and write data to a variety of file formats. + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + arff - Read ARFF files, the standard data format for WEKA + byteordercodes - System byteorder utilities - NumPy byteorder encoding + data_store - Load or save values to a file + dumbdbm_patched - A dumb and slow but simple dbm clone + matlab - Utilities for dealing with MATLAB(R) files + mmio - Matrix Market I/O in Python + netcdf - NetCDF reader/writer module + wavfile - module to read / write wav files using numpy arrays + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + netcdf_file - A file object for NetCDF data + netcdf_variable - A data object for the netcdf module + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + loadmat - Read a MATLAB style mat file (version 4 through 7.1) + savemat - Write a MATLAB style mat file (version 4 through 7.1) + mminfo - Query matrix info from Matrix Market formatted file + mmread - Read matrix from Matrix Market formatted file + mmwrite - Write matrix to Matrix Market formatted file + save_as_module - Data saved as module, accessed on load as attirbutes + +""" # # io - Data input and output # Modified: trunk/scipy/io/arff/__init__.py =================================================================== --- trunk/scipy/io/arff/__init__.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/arff/__init__.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -1,11 +1,42 @@ -"""Module to read arff files (weka format). +""" +Module to read ARFF files, which are the standard data format for WEKA. -arff is a simple file format which support numerical, string and data values. -It supports sparse data too. +ARFF is a text file format which support numerical, string and data values. +The format can also represent missing data and sparse data. -See http://weka.sourceforge.net/wekadoc/index.php/en:ARFF_(3.4.6) for more -details about arff format and available datasets.""" +See the `WEKA website +`_ +for more details about arff format and available datasets. +Examples +-------- + +>>> from scipy.io import arff +>>> content = \"\"\" +... @relation foo +... @attribute width numeric +... @attribute height numeric +... @attribute color {red,green,blue,yellow,black} +... @data +... 5.0,3.25,blue +... 4.5,3.75,green +... 3.0,4.00,red +... \"\"\" +>>> f = open('testdata.arff', 'w') +>>> f.write(content) +>>> f.close() +>>> data, meta = arff.loadarff('testdata.arff') +>>> data +array([(5.0, 3.25, 'blue'), (4.5, 3.75, 'green'), (3.0, 4.0, 'red')], + dtype=[('width', '>> meta +Dataset: foo +\twidth's type is numeric +\theight's type is numeric +\tcolor's type is nominal, range is ('red', 'green', 'blue', 'yellow', 'black') + +""" + from arffread import * import arffread Modified: trunk/scipy/io/data_store.py =================================================================== --- trunk/scipy/io/data_store.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/data_store.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -1,18 +1,29 @@ -""" Load or save values to a file. +""" +Load or save values to a file. - Shelves work well for storing data, but they are slow to access - repeatedly - especially for large data sets. This module allows - you to store data to a file and then load it back into the workspace. - When the data is stored, a python module is also created as the - "namespace for the data" - >>> import scipy.io - >>> import os - >>> a = 1 - >>> scipy.io.save_as_module('c:/temp/junker',{'a':a}) - >>> os.chdir('c:/temp') - >>> import junker - >>> junker.a - 1 +Shelves work well for storing data, but they are slow to access +repeatedly - especially for large data sets. This module allows +you to store data to a file and then load it back into the workspace. +When the data is stored, a python module is also created as the +"namespace for the data" + + +Examples +-------- + +Saving the data to a data store: + +>>> import scipy.io +>>> import os +>>> a = 1 +>>> scipy.io.save_as_module('junker', {'a':a}) + +Loading the data saved to a data store in the same directory: + +>>> import junker +>>> print junker.a +1 + """ __all__ = ['save_as_module'] Modified: trunk/scipy/io/matlab/__init__.py =================================================================== --- trunk/scipy/io/matlab/__init__.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/matlab/__init__.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -1,3 +1,12 @@ +""" +Utilities for dealing with MATLAB(R) files + +Notes +----- +MATLAB(R) is a registered trademark of The MathWorks, Inc., 3 Apple Hill +Drive, Natick, MA 01760-2098, USA. + +""" # Matlab file read and write utilities from mio import loadmat, savemat Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/matlab/mio.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -1,3 +1,4 @@ +"""Module for reading and writing MATLAB .mat files""" # Authors: Travis Oliphant, Matthew Brett """ Modified: trunk/scipy/io/netcdf.py =================================================================== --- trunk/scipy/io/netcdf.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/netcdf.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -684,22 +684,51 @@ class netcdf_variable(object): """ - ``netcdf_variable`` objects are constructed by calling the method - ``createVariable`` on the netcdf_file object. + A data object for the `netcdf` module. - ``netcdf_variable`` objects behave much like array objects defined in - Numpy, except that their data resides in a file. Data is read by - indexing and written by assigning to an indexed subset; the entire - array can be accessed by the index ``[:]`` or using the methods - ``getValue`` and ``assignValue``. ``netcdf_variable`` objects also - have attribute ``shape`` with the same meaning as for arrays, but - the shape cannot be modified. There is another read-only attribute - ``dimensions``, whose value is the tuple of dimension names. + `netcdf_variable` objects are constructed by calling the method + `netcdf_file.createVariable` on the `netcdf_file` object. `netcdf_variable` + objects behave much like array objects defined in numpy, except that their + data resides in a file. Data is read by indexing and written by assigning + to an indexed subset; the entire array can be accessed by the index ``[:]`` + or (for scalars) by using the methods `getValue` and `assignValue`. + `netcdf_variable` objects also have attribute `shape` with the same meaning + as for arrays, but the shape cannot be modified. There is another read-only + attribute `dimensions`, whose value is the tuple of dimension names. All other attributes correspond to variable attributes defined in the NetCDF file. Variable attributes are created by assigning to an - attribute of the ``netcdf_variable`` object. + attribute of the `netcdf_variable` object. + Parameters + ---------- + data : array_like + The data array that holds the values for the variable. + Typically, this is initialized as empty, but with the proper shape. + typecode : dtype character code + Desired data-type for the data array. + shape : sequence of ints + The shape of the array. This should match the lengths of the + variable's dimensions. + dimensions : sequence of strings + The names of the dimensions used by the variable. Must be in the + same order of the dimension lengths given by `shape`. + attributes : dict, optional + Attribute values (any type) keyed by string names. These attributes + become attributes for the netcdf_variable object. + + + Attributes + ---------- + dimensions : list of str + List of names of dimensions used by the variable object. + isrec, shape + Properties + + See also + -------- + isrec, shape + """ def __init__(self, data, typecode, shape, dimensions, attributes=None): self.data = data Modified: trunk/scipy/io/wavfile.py =================================================================== --- trunk/scipy/io/wavfile.py 2010-11-14 09:59:06 UTC (rev 6885) +++ trunk/scipy/io/wavfile.py 2010-11-14 09:59:33 UTC (rev 6886) @@ -3,9 +3,9 @@ Functions --------- -read: Return the sample rate (in samples/sec) and data from a WAV file. +`read`: Return the sample rate (in samples/sec) and data from a WAV file. -write: Write a numpy array as a WAV file. +`write`: Write a numpy array as a WAV file. """ import numpy From scipy-svn at scipy.org Sun Nov 14 04:59:58 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 03:59:58 -0600 (CST) Subject: [Scipy-svn] r6887 - in trunk/doc/source: . tutorial Message-ID: <20101114095958.251F36F350@scipy.org> Author: rgommers Date: 2010-11-14 03:59:58 -0600 (Sun, 14 Nov 2010) New Revision: 6887 Modified: trunk/doc/source/fftpack.rst trunk/doc/source/stats.rst trunk/doc/source/tutorial/basic.rst trunk/doc/source/tutorial/fftpack.rst trunk/doc/source/tutorial/general.rst trunk/doc/source/tutorial/io.rst trunk/doc/source/tutorial/special.rst Log: DOC: merge wiki edits for tutorials. Modified: trunk/doc/source/fftpack.rst =================================================================== --- trunk/doc/source/fftpack.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/fftpack.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -43,7 +43,7 @@ fftshift ifftshift - dftfreq + fftfreq rfftfreq Convolutions (:mod:`scipy.fftpack.convolve`) Modified: trunk/doc/source/stats.rst =================================================================== --- trunk/doc/source/stats.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/stats.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -197,6 +197,7 @@ z zs zmap + zscore .. autosummary:: :toctree: generated/ Modified: trunk/doc/source/tutorial/basic.rst =================================================================== --- trunk/doc/source/tutorial/basic.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/tutorial/basic.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -86,7 +86,7 @@ part will discuss the operation of :obj:`sp.mgrid` , :obj:`sp.ogrid` , :obj:`sp.r_` , and :obj:`sp.c_` for quickly constructing arrays. -One familiar with Matlab may complain that it is difficult to +One familiar with MATLAB (R) may complain that it is difficult to construct arrays from the interactive session with Python. Suppose, for example that one wants to construct an array that begins with 3 followed by 5 zeros and then contains 10 numbers spanning the range -1 Modified: trunk/doc/source/tutorial/fftpack.rst =================================================================== --- trunk/doc/source/tutorial/fftpack.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/tutorial/fftpack.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -47,7 +47,7 @@ Return the Discrete Cosine Transform [Mak]_ of arbitrary type sequence ``x``. For a single dimension array ``x``, ``dct(x, norm='ortho')`` is equal to -matlab ``dct(x)``. +MATLAB ``dct(x)``. There are theoretically 8 types of the DCT [WP]_, only the first 3 types are implemented in scipy. 'The' DCT generally refers to DCT type 2, and 'the' Modified: trunk/doc/source/tutorial/general.rst =================================================================== --- trunk/doc/source/tutorial/general.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/tutorial/general.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -10,7 +10,7 @@ user to high-level commands and classes for the manipulation and visualization of data. With SciPy, an interactive Python session becomes a data-processing and system-prototyping environment rivaling -sytems such as Matlab, IDL, Octave, R-Lab, and SciLab. +sytems such as MATLAB, IDL, Octave, R-Lab, and SciLab. The additional power of using SciPy within Python, however, is that a powerful programming language is also available for use in developing Modified: trunk/doc/source/tutorial/io.rst =================================================================== --- trunk/doc/source/tutorial/io.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/tutorial/io.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -7,7 +7,7 @@ .. seealso:: :ref:`numpy-reference.routines.io` (in numpy) -Matlab files +MATLAB files ------------ .. autosummary:: @@ -25,7 +25,8 @@ sio.loadmat sio.savemat -These are the high-level functions you will most likely use. You'll also find:: +These are the high-level functions you will most likely use. You'll +also find:: sio.matlab @@ -38,10 +39,10 @@ ``````````````` You may have a ``.mat`` file that you want to read into Scipy. Or, you -want to pass some variables from Scipy / Numpy into Matlab. +want to pass some variables from Scipy / Numpy into MATLAB. -To save us using a Matlab license, let's start in Octave_. Octave has -Matlab-compatible save / load functions. Start Octave (``octave`` at +To save us using a MATLAB license, let's start in Octave_. Octave has +MATLAB-compatible save / load functions. Start Octave (``octave`` at the command line for me): .. sourcecode:: octave @@ -72,7 +73,7 @@ - octave:3> save -6 octave_a.mat a % Matlab 6 compatible + octave:3> save -6 octave_a.mat a % MATLAB 6 compatible octave:4> ls octave_a.mat octave_a.mat @@ -82,7 +83,11 @@ >>> print mat_contents {'a': array([[[ 1., 4., 7., 10.], [ 2., 5., 8., 11.], - [ 3., 6., 9., 12.]]]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:13:40 UTC', '__globals__': []} + [ 3., 6., 9., 12.]]]), + '__version__': '1.0', + '__header__': 'MATLAB 5.0 MAT-file, written by + Octave 3.2.3, 2010-05-30 02:13:40 UTC', + '__globals__': []} >>> oct_a = mat_contents['a'] >>> print oct_a [[[ 1. 4. 7. 10.] @@ -131,7 +136,7 @@ >>> sio.savemat('np_vector.mat', {'vect':vect}, oned_as='row') -We can load this in Octave or Matlab: +We can load this in Octave or MATLAB: .. sourcecode:: octave @@ -147,12 +152,12 @@ 1 10 -Matlab structs +MATLAB structs `````````````` -Matlab structs are a little bit like Python dicts, except the field -names must be strings. Any Matlab object can be a value of a field. As -for all objects in Matlab, structs are in fact arrays of structs, where +MATLAB structs are a little bit like Python dicts, except the field +names must be strings. Any MATLAB object can be a value of a field. As +for all objects in MATLAB, structs are in fact arrays of structs, where a single struct is an array of shape (1, 1). .. sourcecode:: octave @@ -170,7 +175,7 @@ >>> mat_contents = sio.loadmat('octave_struct.mat') >>> print mat_contents - {'my_struct': array([[([[1.0]], [[2.0]])]], + {'my_struct': array([[([[1.0]], [[2.0]])]], dtype=[('field1', '|O8'), ('field2', '|O8')]), '__version__': '1.0', '__header__': 'MATLAB 5.0 MAT-file, written by Octave 3.2.3, 2010-05-30 02:00:26 UTC', '__globals__': []} >>> oct_struct = mat_contents['my_struct'] >>> print oct_struct.shape @@ -185,7 +190,7 @@ >>> print val.dtype [('field1', '|O8'), ('field2', '|O8')] -In this version of Scipy (0.8.0), Matlab structs come back as numpy +In this version of Scipy (0.8.0), MATLAB structs come back as numpy structured arrays, with fields named for the struct fields. You can see the field names in the ``dtype`` output above. Note also: @@ -200,7 +205,7 @@ 1 1 -So, in Matlab, the struct array must be at least 2D, and we replicate +So, in MATLAB, the struct array must be at least 2D, and we replicate that when we read into Scipy. If you want all length 1 dimensions squeezed out, try this: @@ -209,10 +214,10 @@ >>> oct_struct.shape () -Sometimes, it's more convenient to load the matlab structs as python +Sometimes, it's more convenient to load the MATLAB structs as python objects rather than numpy structured arrarys - it can make the access -syntax in python a bit more similar to that in matlab. In order to do -this, use the ``struct_as_record=False`` parameter to ``loadmat``. +syntax in python a bit more similar to that in MATLAB. In order to do +this, use the ``struct_as_record=False`` parameter to ``loadmat``. >>> mat_contents = sio.loadmat('octave_struct.mat', struct_as_record=False) >>> oct_struct = mat_contents['my_struct'] @@ -250,7 +255,7 @@ field1 = 0.50000 } -You can also save structs back again to Matlab (or Octave in our case) +You can also save structs back again to MATLAB (or Octave in our case) like this: >>> dt = [('f1', 'f8'), ('f2', 'S10')] @@ -263,11 +268,11 @@ >>> arr[1]['f2'] = 'not perl' >>> sio.savemat('np_struct_arr.mat', {'arr': arr}) -Matlab cell arrays +MATLAB cell arrays `````````````````` -Cell arrays in Matlab are rather like python lists, in the sense that -the elements in the arrays can contain any type of Matlab object. In +Cell arrays in MATLAB are rather like python lists, in the sense that +the elements in the arrays can contain any type of MATLAB object. In fact they are most similar to numpy object arrays, and that is how we load them into numpy. @@ -298,7 +303,7 @@ >>> print val.dtype float64 -Saving to a Matlab cell array just involves making a numpy object array: +Saving to a MATLAB cell array just involves making a numpy object array: >>> obj_arr = np.zeros((2,), dtype=np.object) >>> obj_arr[0] = 1 @@ -370,7 +375,6 @@ Allows reading of NetCDF files (version of pupynere_ package) - .. _pupynere: http://pypi.python.org/pypi/pupynere/ .. _octave: http://www.gnu.org/software/octave .. _matlab: http://www.mathworks.com/ Modified: trunk/doc/source/tutorial/special.rst =================================================================== --- trunk/doc/source/tutorial/special.rst 2010-11-14 09:59:33 UTC (rev 6886) +++ trunk/doc/source/tutorial/special.rst 2010-11-14 09:59:58 UTC (rev 6887) @@ -1,8 +1,6 @@ Special functions (:mod:`scipy.special`) ======================================== -.. sectionauthor:: Travis E. Oliphant - .. currentmodule:: scipy.special The main feature of the :mod:`scipy.special` package is the definition of @@ -21,3 +19,41 @@ need, consider writing it and contributing it to the library. You can write the function in either C, Fortran, or Python. Look in the source code of the library for examples of each of these kinds of functions. + +Bessel functions of real order(:func:`jn`, :func:`jn_zeros`) +-------------------------------------------------------------------------- +Bessel functions are a family of solutions to Bessel's differential equation +with real or complex order alpha: + +.. math:: + x^2 \frac{d^2 y}{dx^2} + x \frac{dy}{dx} + (x^2 - \alpha^2)y = 0 + +Among other uses, these functions arise in wave propagation problems such as +the vibrational modes of a thin drum head. Here is an example of a circular +drum head anchored at the edge: + +.. plot:: + >>> from scipy import * + >>> from scipy.special import jn, jn_zeros + >>> def drumhead_height(n, k, distance, angle, t): + ... nth_zero = jn_zeros(n, k) + ... return cos(t)*cos(n*angle)*jn(n, distance*nth_zero) + >>> theta = r_[0:2*pi:50j] + >>> radius = r_[0:1:50j] + >>> x = array([r*cos(theta) for r in radius]) + >>> y = array([r*sin(theta) for r in radius]) + >>> z = array([drumhead_height(1, 1, r, theta, 0.5) for r in radius]) + + >>> import pylab + >>> from mpl_toolkits.mplot3d import Axes3D + >>> from matplotlib import cm + >>> fig = pylab.figure() + >>> ax = Axes3D(fig) + >>> ax.plot_surface(x, y, z, rstride=1, cstride=1, cmap=cm.jet) + >>> ax.set_xlabel('X') + >>> ax.set_ylabel('Y') + >>> ax.set_zlabel('Z') + >>> pylab.show() + +.. :caption: Vibrating drum head using +.. :obj:`scipy.special.jn` From scipy-svn at scipy.org Sun Nov 14 05:00:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:00:16 -0600 (CST) Subject: [Scipy-svn] r6888 - trunk/scipy/ndimage Message-ID: <20101114100016.B4AE737BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:00:16 -0600 (Sun, 14 Nov 2010) New Revision: 6888 Modified: trunk/scipy/ndimage/__init__.py trunk/scipy/ndimage/filters.py trunk/scipy/ndimage/measurements.py Log: DOC: merge more wiki edits for ndimage module. Modified: trunk/scipy/ndimage/__init__.py =================================================================== --- trunk/scipy/ndimage/__init__.py 2010-11-14 09:59:58 UTC (rev 6887) +++ trunk/scipy/ndimage/__init__.py 2010-11-14 10:00:16 UTC (rev 6888) @@ -1,3 +1,70 @@ +""" +N-dimensional image package +=========================== + +This package contains various functions for multi-dimensional image +processing. + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + filters - + fourier - + interpolation - + io - + measurements - + morphology - + +Functions (partial list) +------------------------ + +.. autosummary:: + :toctree: generated/ + + affine_transform - Apply an affine transformation + center_of_mass - The center of mass of the values of an array at labels + convolve - Multi-dimensional convolution + convolve1d - 1-D convolution along the given axis + correlate - Multi-dimensional correlation + correlate1d - 1-D correlation along the given axis + extrema - Min's and max's of an array at labels, with their positions + find_objects - Find objects in a labeled array + generic_filter - Multi-dimensional filter using a given function + generic_filter1d - 1-D generic filter along the given axis + geometric_transform - Apply an arbritrary geometric transform + histogram - Histogram of the values of an array, optionally at labels + imread - Load an image from a file + label - Label features in an array + laplace - n-D Laplace filter based on approximate second derivatives + map_coordinates - Map input array to new coordinates by interpolation + mean - Mean of the values of an array at labels + median_filter - Calculates a multi-dimensional median filter + percentile_filter - Calculates a multi-dimensional percentile filter + rank_filter - Calculates a multi-dimensional rank filter + rotate - Rotate an array + shift - Shift an array + standard_deviation - Standard deviation of an n-D image array + sum - Sum of the values of the array + uniform_filter - Multi-dimensional uniform filter + uniform_filter1d - 1-D uniform filter along the given axis + variance - Variance of the values of an n-D image array + zoom - Zoom an array + +Note: the above is only roughly half the functions available in this +package + +Objects +------- + +.. autosummary:: + :toctree: generated/ + + docdict - + +""" # Copyright (C) 2003-2005 Peter J. Verveer # # Redistribution and use in source and binary forms, with or without Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2010-11-14 09:59:58 UTC (rev 6887) +++ trunk/scipy/ndimage/filters.py 2010-11-14 10:00:16 UTC (rev 6888) @@ -543,29 +543,104 @@ Parameters ---------- - input : array-like - input array to filter - weights : ndarray - array of weights, same number of dimensions as input - output : array, optional - The ``output`` parameter passes an array in which to store the + input : array_like + Input array to filter. + weights : array_like + Array of weights, same number of dimensions as input + output : ndarray, optional + The `output` parameter passes an array in which to store the filter output. mode : {'reflect','constant','nearest','mirror', 'wrap'}, optional - The ``mode`` parameter determines how the array borders are - handled, where ``cval`` is the value when mode is equal to - 'constant'. Default is 'reflect' + the `mode` parameter determines how the array borders are + handled. For 'constant' mode, values beyond borders are set to be + `cval`. Default is 'reflect'. cval : scalar, optional - Value to fill past edges of input if ``mode`` is 'constant'. Default + Value to fill past edges of input if `mode` is 'constant'. Default is 0.0 origin : scalar, optional - The ``origin`` parameter controls the placement of the filter. - Default 0 + The `origin` parameter controls the placement of the filter. + Default is 0. + Returns + ------- + result : ndarray + The result of convolution of `input` with `weights`. + See Also -------- - correlate : Correlate an image with a kernel. + Notes + ----- + Each value in result is :math:`C_i = \\sum_j{I_{i+j-k} W_j}`, where + W is the `weights` kernel, + j is the n-D spatial index over :math:`W`, + I is the `input` and k is the coordinate of the center of + W, specified by `origin` in the input parameters. + + Examples + -------- + Perhaps the simplest case to understand is ``mode='constant', cval=0.0``, + because in this case borders (i.e. where the `weights` kernel, centered + on any one value, extends beyond an edge of `input`. + + >>> a = np.array([[1, 2, 0, 0], + .... [5, 3, 0, 4], + .... [0, 0, 0, 7], + .... [9, 3, 0, 0]]) + >>> b = np.array([[1,1,1],[1,1,0],[1,0,0]]) + >>> from scipy import ndimage + >>> ndimage.convolve(a, k, mode='constant', cval=0.0) + array([[11, 10, 7, 4], + [10, 3, 11, 11], + [15, 12, 14, 7], + [12, 3, 7, 0]]) + + Setting ``cval=1.0`` is equivalent to padding the outer edge of `input` + with 1.0's (and then extracting only the original region of the result). + + >>> ndimage.convolve(a, k, mode='constant', cval=1.0) + array([[13, 11, 8, 7], + [11, 3, 11, 14], + [16, 12, 14, 10], + [15, 6, 10, 5]]) + + With ``mode='reflect'`` (the default), outer values are reflected at the + edge of `input` to fill in missing values. + + >>> b = np.array([[2, 0, 0], + [1, 0, 0], + [0, 0, 0]]) + >>> k = np.array([[0,1,0],[0,1,0],[0,1,0]]) + array([[5, 0, 0], + [3, 0, 0], + [1, 0, 0]]) + + This includes diagonally at the corners. + + >>> k = np.array([[1,0,0],[0,1,0],[0,0,1]]) + >>> ndimage.convolve(b, k) + array([[4, 2, 0], + [3, 2, 0], + [1, 1, 0]]) + + With ``mode='nearest'``, the single nearest value in to an edge in + `input` is repeated as many times as needed to match the overlapping + `weights`. + + >>> c = np.array([[2, 0, 1], + [1, 0, 0], + [0, 0, 0]]) + >>> k = np.array([[0, 1, 0], + [0, 1, 0], + [0, 1, 0], + [0, 1, 0], + [0, 1, 0]]) + >>> ndimage.convolve(c, k, mode='nearest') + array([[7, 0, 3], + [5, 0, 2], + [3, 0, 1]]) + """ return _correlate_or_convolve(input, weights, output, mode, cval, origin, True) Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-11-14 09:59:58 UTC (rev 6887) +++ trunk/scipy/ndimage/measurements.py 2010-11-14 10:00:16 UTC (rev 6888) @@ -75,8 +75,8 @@ An array-like object where each unique feature has a unique value num_features : int + How many objects were found - If `output` is None or a data type, this function returns a tuple, (`labeled_array`, `num_features`). @@ -486,13 +486,52 @@ return sum def mean(input, labels = None, index = None): - """Calculate the mean of the values of an array at labels. + """ + Calculate the mean of the values of an array at labels. - Labels must be None or an array that can be broadcast to the input. + Parameters + ---------- + input : array_like + Array on which to compute the mean of elements over distinct + regions. + labels : array_like, optional + Array of labels of same shape, or broadcastable to the same shape as + `input`. All elements sharing the same label form one region over + which the mean of the elements is computed. + index : int or sequence of ints, optional + Labels of the objects over which the mean is to be computed. + Default is None, in which case the mean for all values where label is + greater than 0 is calculated. - Index must be None, a single label or sequence of labels. If - None, the mean for all values where label is greater than 0 is - calculated. + Returns + ------- + out : list + Sequence of same length as ``index``, with the mean of the different + regions labeled by the labels in ``index``. + + See also + -------- + ndimage.variance, ndimage.standard_deviation, ndimage.minimum, + ndimage.maximum, ndimage.sum + ndimage.label + + Examples + -------- + >>> a = np.arange(25).reshape((5,5)) + >>> labels = np.zeros_like(a) + >>> labels[3:5,3:5] = 1 + >>> index = np.unique(labels) + >>> labels + array([[0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 0, 0], + [0, 0, 0, 1, 1], + [0, 0, 0, 1, 1]]) + >>> index + array([0, 1]) + >>> ndimage.mean(a, labels=labels, index=index) + [10.285714285714286, 21.0] + """ count, sum = _stats(input, labels, index) @@ -693,17 +732,17 @@ Parameters ---------- - input: array-like - Array-like of values. For each region specified by `labels`, the + input: array_like + Array_like of values. For each region specified by `labels`, the minimal values of `input` over the region is computed. - labels: array-like, optional - An array-like of integers marking different regions over which the + labels: array_like, optional + An array_like of integers marking different regions over which the minimum value of `input` is to be computed. `labels` must have the same shape as `input`. If `labels` is not specified, the minimum over the whole array is returned. - index: array-like, optional + index: array_like, optional A list of region labels that are taken into account for computing the minima. If index is None, the minimum over all elements where `labels` is non-zero is returned. From scipy-svn at scipy.org Sun Nov 14 05:00:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:00:34 -0600 (CST) Subject: [Scipy-svn] r6889 - trunk/scipy/odr Message-ID: <20101114100034.19F5937BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:00:33 -0600 (Sun, 14 Nov 2010) New Revision: 6889 Modified: trunk/scipy/odr/__init__.py trunk/scipy/odr/odrpack.py Log: DOC: merge wiki edits for odr module. Modified: trunk/scipy/odr/__init__.py =================================================================== --- trunk/scipy/odr/__init__.py 2010-11-14 10:00:16 UTC (rev 6888) +++ trunk/scipy/odr/__init__.py 2010-11-14 10:00:33 UTC (rev 6889) @@ -1,3 +1,90 @@ +""" +Orthogonal Distance Regression (:mod:`scipy.odr`) +================================================= + +Introduction +------------ + +Why Orthogonal Distance Regression (ODR)? Sometimes one has +measurement errors in the explanatory (a.k.a., "independent") +variable(s), not just the response (a.k.a., "dependent") variable(s). +Ordinary Least Squares (OLS) fitting procedures treat the data for +explanatory variables as fixed, i.e., not subject to error of any kind. +Furthermore, OLS procedures require that the response variables be an +explicit function of the explanatory variables; sometimes making the +equation explicit is impractical and/or introduces errors. ODR can +handle both of these cases with ease, and can even reduce to the OLS +case if that is sufficient for the problem. + +ODRPACK is a FORTRAN-77 library for performing ODR with possibly +non-linear fitting functions. It uses a modified trust-region +Levenberg-Marquardt-type algorithm [1]_ to estimate the function +parameters. The fitting functions are provided by Python functions +operating on NumPy arrays. The required derivatives may be provided +by Python functions as well, or may be estimated numerically. ODRPACK +can do explicit or implicit ODR fits, or it can do OLS. Input and +output variables may be multi-dimensional. Weights can be provided to +account for different variances of the observations, and even +covariances between dimensions of the variables. + +odr provides two interfaces: a single function, and a set of +high-level classes that wrap that function; please refer to their +docstrings for more information. While the docstring of the function +odr does not have a full explanation of its arguments, the classes do, +and arguments of the same name usually have the same requirements. +Furthermore, the user is urged to at least skim the `ODRPACK User's +Guide `_ - +"Know Thy Algorithm." + +Use +--- + +See the docstrings of `odr.odrpack` and the functions and classes for +usage instructions. The ODRPACK User's Guide (linked above) is also +quite helpful. + +References +---------- +.. [1] P. T. Boggs and J. E. Rogers, "Orthogonal Distance Regression," + in "Statistical analysis of measurement error models and + applications: proceedings of the AMS-IMS-SIAM joint summer research + conference held June 10-16, 1989," Contemporary Mathematics, + vol. 112, pg. 186, 1990. + +.. currentmodule:: scipy.odr + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + odrpack Python wrappers for FORTRAN77 ODRPACK. + models Model instances for use with odrpack. + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + ODR Gathers all info & manages the main fitting routine. + Data Stores the data to fit. + Model Stores information about the function to be fit. + Output + RealData Weights as actual std. dev.s and/or covariances. + odr_error + odr_stop + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + odr + +""" # # odr - Orthogonal Distance Regression # Modified: trunk/scipy/odr/odrpack.py =================================================================== --- trunk/scipy/odr/odrpack.py 2010-11-14 10:00:16 UTC (rev 6888) +++ trunk/scipy/odr/odrpack.py 2010-11-14 10:00:33 UTC (rev 6889) @@ -1,4 +1,5 @@ -""" Python wrappers for Orthogonal Distance Regression (ODRPACK). +""" +Python wrappers for Orthogonal Distance Regression (ODRPACK). Classes ======= @@ -28,43 +29,52 @@ Basic use: -1) Define the function you want to fit against: +1) Define the function you want to fit against. +:: def f(B, x): + ''' Linear function y = m*x + b ''' return B[0]*x + B[1] - B is a vector of the parameters. - x is an array of the current x values. (Same format as the x passed to Data or - RealData. Return an array in the same format as y passed to Data or - RealData.) + # B is a vector of the parameters. + # x is an array of the current x values. + # x is same format as the x passed to Data or RealData. + # Return an array in the same format as y passed to Data or RealData. + 2) Create a Model. +:: linear = Model(f) 3) Create a Data or RealData instance. +:: mydata = Data(x, y, wd=1./power(sx,2), we=1./power(sy,2)) - or +or +:: + mydata = RealData(x, y, sx=sx, sy=sy) 4) Instantiate ODR with your data, model and initial parameter estimate. +:: myodr = ODR(mydata, linear, beta0=[1., 2.]) 5) Run the fit. +:: myoutput = myodr.run() 6) Examine output. +:: myoutput.pprint() Read the docstrings and the accompanying tests for more advanced usage. - Notes ===== @@ -97,6 +107,7 @@ Robert Kern robert.kern at gmail.com + """ import numpy @@ -414,67 +425,72 @@ class Model(object): - """ The Model class stores information about the function you wish to fit. + """ + The Model class stores information about the function you wish to fit. - It stores the function itself, at the least, and optionally stores functions - which compute the Jacobians used during fitting. Also, one can provide - a function that will provide reasonable starting values for the fit - parameters possibly given the set of data. + It stores the function itself, at the least, and optionally stores + functions which compute the Jacobians used during fitting. Also, one + can provide a function that will provide reasonable starting values + for the fit parameters possibly given the set of data. - The initialization method stores these into members of the - same name. + The initialization method stores these into members of the same name. - fcn -- fit function: fcn(beta, x) --> y + fcn -- fit function + fcn(beta, x) --> y - fjacb -- Jacobian of fcn wrt the fit parameters beta: + fjacb -- Jacobian of fcn wrt the fit parameters beta fjacb(beta, x) --> @f_i(x,B)/@B_j - fjacd -- Jacobian of fcn wrt the (possibly multidimensional) input variable: + fjacd -- Jacobian of fcn wrt the (possibly multidimensional) input + variable fjacd(beta, x) --> @f_i(x,B)/@x_j extra_args -- if specified, extra_args should be a tuple of extra - arguments to pass to fcn, fjacb, and fjacd. Each will be called like - the following: apply(fcn, (beta, x) + extra_args) + arguments to pass to fcn, fjacb, and fjacd. Each will be called + like the following: apply(fcn, (beta, x) + extra_args) estimate -- provide estimates of the fit parameters from the data: estimate(data) --> estbeta implicit -- boolean variable which, if TRUE, specifies that the model is implicit; i.e fcn(beta, x) ~= 0 and there is no y data to fit - against. + against - meta -- an optional, freeform dictionary of metadata for the model + meta -- optional + freeform dictionary of metadata for the model Note that the fcn, fjacb, and fjacd operate on NumPy arrays and return - a NumPy array. estimate takes an instance of the Data class. + a NumPy array. The `estimate` object takes an instance of the Data class. Here are the rules for the shapes of the argument and return arrays: x -- if the input data is single-dimensional, then x is rank-1 array; i.e. x = array([1, 2, 3, ...]); x.shape = (n,) - If the input data is multi-dimensional, then x is a rank-2 array; i.e. - x = array([[1, 2, ...], [2, 4, ...]]); x.shape = (m, n) In all cases, it - has the same shape as the input data array passed to odr(). m is the - dimensionality of the input data, n is the number of observations. + If the input data is multi-dimensional, then x is a rank-2 array; + i.e., x = array([[1, 2, ...], [2, 4, ...]]); x.shape = (m, n) In + all cases, it has the same shape as the input data array passed to + odr(). m is the dimensionality of the input data, n is the number + of observations. - y -- if the response variable is single-dimensional, then y is a rank-1 - array; i.e. y = array([2, 4, ...]); y.shape = (n,) - If the response variable is multi-dimensional, then y is a rank-2 array; - i.e. y = array([[2, 4, ...], [3, 6, ...]]); y.shape = (q, n) where q is - the dimensionality of the response variable. + y -- if the response variable is single-dimensional, then y is a + rank-1 array, i.e., y = array([2, 4, ...]); y.shape = (n,) + If the response variable is multi-dimensional, then y is a rank-2 + array, i.e., y = array([[2, 4, ...], [3, 6, ...]]); y.shape = + (q, n) where q is the dimensionality of the response variable. beta -- rank-1 array of length p where p is the number of parameters; i.e. beta = array([B_1, B_2, ..., B_p]) - fjacb -- if the response variable is multi-dimensional, then the return - array's shape is (q, p, n) such that - fjacb(x,beta)[l,k,i] = @f_l(X,B)/@B_k evaluated at the i'th data point. - If q == 1, then the return array is only rank-2 and with shape (p, n). + fjacb -- if the response variable is multi-dimensional, then the + return array's shape is (q, p, n) such that fjacb(x,beta)[l,k,i] = + @f_l(X,B)/@B_k evaluated at the i'th data point. If q == 1, then + the return array is only rank-2 and with shape (p, n). - fjacd -- as with fjacb, only the return array's shape is (q, m, n) such that - fjacd(x,beta)[l,j,i] = @f_l(X,B)/@X_j at the i'th data point. - If q == 1, then the return array's shape is (m, n). If m == 1, the shape - is (q, n). If m == q == 1, the shape is (n,). + fjacd -- as with fjacb, only the return array's shape is (q, m, n) + such that fjacd(x,beta)[l,j,i] = @f_l(X,B)/@X_j at the i'th data + point. If q == 1, then the return array's shape is (m, n). If + m == 1, the shape is (q, n). If m == q == 1, the shape is (n,). + """ def __init__(self, fcn, fjacb=None, fjacd=None, @@ -516,56 +532,58 @@ class Output(object): - """ The Output class stores the output of an ODR run. + """ + The Output class stores the output of an ODR run. - Takes one argument for initialization: the return value from the - function odr(). + Takes one argument for initialization, the return value from the + function odr. Attributes ---------- - beta -- estimated parameter values [beta.shape == (q,)] - - sd_beta -- standard errors of the estimated parameters + beta : + estimated parameter values [beta.shape == (q,)] + sd_beta : + standard errors of the estimated parameters [sd_beta.shape == (p,)] - - cov_beta -- covariance matrix of the estimated parameters + cov_beta : + covariance matrix of the estimated parameters [cov_beta.shape == (p, p)] - Optional Attributes - ------------------- - Present if odr() was run with "full_output=1". + Following are present if odr() was run with "full_output=1". - delta -- array of estimated errors in input variables + delta : + array of estimated errors in input variables [delta.shape == data.x.shape] - - eps -- array of estimated errors in response variables + eps : + array of estimated errors in response variables [eps.shape == data.y.shape] - - xplus -- array of x + delta [xplus.shape == data.x.shape] - - y -- array of y = fcn(x + delta) [y.shape == data.y.shape] - - res_var -- residual variance [scalar] - - sum_sqare -- sum of squares error [scalar] - - sum_square_delta -- sum of squares of delta error [scalar] - - sum_square_eps -- sum of squares of eps error [scalar] - - inv_condnum -- inverse condition number [scalar] (cf. ODRPACK UG p. 77) - - rel_error -- relative error in function values computed within fcn [scalar] - - work -- final work array [array] - - work_ind -- indices into work for drawing out values [dictionary] + xplus : + array of x + delta [xplus.shape == data.x.shape] + y : + array of y = fcn(x + delta) [y.shape == data.y.shape] + res_var : float + residual variance + sum_sqare : float + sum of squares error + sum_square_delta : float + sum of squares of delta error + sum_square_eps : float + sum of squares of eps error + inv_condnum : float + inverse condition number (cf. ODRPACK UG p. 77) + rel_error : float + relative error in function values computed within fcn + work : ndarray + final work array + work_ind : dictionary + indices into work for drawing out values (cf. ODRPACK UG p. 83) - - info -- reason for returning (as output by ODRPACK) [integer] + info : int + reason for returning (as output by ODRPACK) (cf. ODRPACK UG p. 38) + stopreason : list of strings + "info" interpreted into English - stopreason -- "info" interpreted into English [list of strings] """ def __init__(self, output): @@ -595,7 +613,8 @@ class ODR(object): - """ The ODR class gathers all information and coordinates the running of the + """ + The ODR class gathers all information and coordinates the running of the main fitting routine. Members of instances of the ODR class have the same names as the arguments @@ -603,93 +622,92 @@ Parameters ---------- - Required: - data -- instance of the Data class - - model -- instance of the Model class - - beta0 -- a rank-1 sequence of initial parameter values. Optional if + data: + instance of the Data class + model: + instance of the Model class + beta0: + a rank-1 sequence of initial parameter values. Optional if model provides an "estimate" function to estimate these values. - - Optional: - delta0 -- a (double-precision) float array to hold the initial values of - the errors in the input variables. Must be same shape as data.x . - - ifixb -- sequence of integers with the same length as beta0 that determines + delta0: optional + a (double-precision) float array to hold the initial values of + the errors in the input variables. Must be same shape as data.x + ifixb: optional + sequence of integers with the same length as beta0 that determines which parameters are held fixed. A value of 0 fixes the parameter, a value > 0 makes the parameter free. - - ifixx -- an array of integers with the same shape as data.x that determines - which input observations are treated as fixed. One can use a sequence of - length m (the dimensionality of the input observations) to fix some + ifixx: optional + an array of integers with the same shape as data.x that determines + which input observations are treated as fixed. One can use a sequence + of length m (the dimensionality of the input observations) to fix some dimensions for all observations. A value of 0 fixes the observation, a value > 0 makes it free. - - job -- an integer telling ODRPACK what tasks to perform. See p. 31 of the + job: optional + an integer telling ODRPACK what tasks to perform. See p. 31 of the ODRPACK User's Guide if you absolutely must set the value here. Use the method set_job post-initialization for a more readable interface. - - iprint -- an integer telling ODRPACK what to print. See pp. 33-34 of the + iprint: optional + an integer telling ODRPACK what to print. See pp. 33-34 of the ODRPACK User's Guide if you absolutely must set the value here. Use the method set_iprint post-initialization for a more readable interface. - - errfile -- string with the filename to print ODRPACK errors to. *Do Not Open + errfile: optional + string with the filename to print ODRPACK errors to. *Do Not Open This File Yourself!* - - rptfile -- string with the filename to print ODRPACK summaries to. *Do Not + rptfile: optional + string with the filename to print ODRPACK summaries to. *Do Not Open This File Yourself!* - - ndigit -- integer specifying the number of reliable digits in the computation + ndigit: optional + integer specifying the number of reliable digits in the computation of the function. - - taufac -- float specifying the initial trust region. The default value is 1. + taufac: optional + float specifying the initial trust region. The default value is 1. The initial trust region is equal to taufac times the length of the first computed Gauss-Newton step. taufac must be less than 1. - - sstol -- float specifying the tolerance for convergence based on the relative + sstol: optional + float specifying the tolerance for convergence based on the relative change in the sum-of-squares. The default value is eps**(1/2) where eps is the smallest value such that 1 + eps > 1 for double precision computation on the machine. sstol must be less than 1. - - partol -- float specifying the tolerance for convergence based on the relative + partol: optional + float specifying the tolerance for convergence based on the relative change in the estimated parameters. The default value is eps**(2/3) for explicit models and eps**(1/3) for implicit models. partol must be less than 1. - - maxit -- integer specifying the maximum number of iterations to perform. For + maxit: optional + integer specifying the maximum number of iterations to perform. For first runs, maxit is the total number of iterations performed and defaults to 50. For restarts, maxit is the number of additional iterations to perform and defaults to 10. - - stpb -- sequence (len(stpb) == len(beta0)) of relative step sizes to compute + stpb: optional + sequence (len(stpb) == len(beta0)) of relative step sizes to compute finite difference derivatives wrt the parameters. - - stpd -- array (stpd.shape == data.x.shape or stpd.shape == (m,)) of relative + stpd: optional + array (stpd.shape == data.x.shape or stpd.shape == (m,)) of relative step sizes to compute finite difference derivatives wrt the input variable errors. If stpd is a rank-1 array with length m (the dimensionality of the input variable), then the values are broadcast to all observations. - - sclb -- sequence (len(stpb) == len(beta0)) of scaling factors for the + sclb: optional + sequence (len(stpb) == len(beta0)) of scaling factors for the parameters. The purpose of these scaling factors are to scale all of - the parameters to around unity. Normally appropriate scaling factors are - computed if this argument is not specified. Specify them yourself if the - automatic procedure goes awry. - - scld -- array (scld.shape == data.x.shape or scld.shape == (m,)) of scaling + the parameters to around unity. Normally appropriate scaling factors + are computed if this argument is not specified. Specify them yourself + if the automatic procedure goes awry. + scld: optional + array (scld.shape == data.x.shape or scld.shape == (m,)) of scaling factors for the *errors* in the input variables. Again, these factors are automatically computed if you do not provide them. If scld.shape == (m,), then the scaling factors are broadcast to all observations. + work: optional + array to hold the double-valued working data for ODRPACK. When + restarting, takes the value of self.output.work. + iwork: optional + array to hold the integer-valued working data for ODRPACK. When + restarting, takes the value of self.output.iwork. + output: + an instance if the Output class containing all of the returned + data from an invocation of ODR.run() or ODR.restart() - work -- array to hold the double-valued working data for ODRPACK. When - restarting, takes the value of self.output.work . - - iwork -- array to hold the integer-valued working data for ODRPACK. When - restarting, takes the value of self.output.iwork . - - Other Members (not supplied as initialization arguments): - output -- an instance if the Output class containing all of the returned - data from an invocation of ODR.run() or ODR.restart() """ def __init__(self, data, model, beta0=None, delta0=None, ifixb=None, @@ -867,47 +885,58 @@ def set_job(self, fit_type=None, deriv=None, var_calc=None, del_init=None, restart=None): - """ Sets the "job" parameter is a hopefully comprehensible way. + """ + Sets the "job" parameter is a hopefully comprehensible way. If an argument is not specified, then the value is left as is. The default value from class initialization is for all of these options set to 0. - ========= ===== ===================================================== - Parameter Value Meaning - ========= ===== ===================================================== - fit_type 0 explicit ODR - 1 implicit ODR - 2 ordinary least-squares + Parameters + ---------- + fit_type : {0, 1, 2} int + 0 -> explicit ODR - deriv 0 forward finite differences - 1 central finite differences - 2 user-supplied derivatives (Jacobians) with results - checked by ODRPACK - 3 user-supplied derivatives, no checking + 1 -> implicit ODR - var_calc 0 calculate asymptotic covariance matrix and fit - parameter uncertainties (V_B, s_B) using derivatives - recomputed at the final solution - 1 calculate V_B and s_B using derivatives from last - iteration - 2 do not calculate V_B and s_B + 2 -> ordinary least-squares + deriv : {0, 1, 2, 3} int + 0 -> forward finite differences - del_init 0 initial input variable offsets set to 0 - 1 initial offsets provided by user in variable "work" + 1 -> central finite differences - restart 0 fit is not a restart - 1 fit is a restart - ========= ===== ===================================================== + 2 -> user-supplied derivatives (Jacobians) with results + checked by ODRPACK + 3 -> user-supplied derivatives, no checking + var_calc : {0, 1, 2} int + 0 -> calculate asymptotic covariance matrix and fit + parameter uncertainties (V_B, s_B) using derivatives + recomputed at the final solution + + 1 -> calculate V_B and s_B using derivatives from last iteration + + 2 -> do not calculate V_B and s_B + del_init : {0, 1} int + 0 -> initial input variable offsets set to 0 + + 1 -> initial offsets provided by user in variable "work" + restart : {0, 1} int + 0 -> fit is not a restart + + 1 -> fit is a restart + + Notes + ----- The permissible values are different from those given on pg. 31 of the - ODRPACK User's Guide only in that one cannot specify numbers greater than the - last value for each variable. + ODRPACK User's Guide only in that one cannot specify numbers greater than + the last value for each variable. If one does not supply functions to compute the Jacobians, the fitting procedure will change deriv to 0, finite differences, as a default. To initialize the input variable offsets by yourself, set del_init to 1 and put the offsets into the "work" variable correctly. + """ if self.job is None: From scipy-svn at scipy.org Sun Nov 14 05:00:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:00:53 -0600 (CST) Subject: [Scipy-svn] r6890 - trunk/scipy/maxentropy Message-ID: <20101114100053.C00AB37BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:00:53 -0600 (Sun, 14 Nov 2010) New Revision: 6890 Modified: trunk/scipy/maxentropy/__init__.py trunk/scipy/maxentropy/maxentropy.py trunk/scipy/maxentropy/maxentutils.py Log: DOC: merge wiki edits for maxentropy module. Modified: trunk/scipy/maxentropy/__init__.py =================================================================== --- trunk/scipy/maxentropy/__init__.py 2010-11-14 10:00:33 UTC (rev 6889) +++ trunk/scipy/maxentropy/__init__.py 2010-11-14 10:00:53 UTC (rev 6890) @@ -1,3 +1,91 @@ +""" +Routines for fitting maximum entropy models +=========================================== + +Contains two classes for fitting maximum entropy models (also known +as "exponential family" models) subject to linear constraints on the +expectations of arbitrary feature statistics. One class, "model", is +for small discrete sample spaces, using explicit summation. The other, +"bigmodel", is for sample spaces that are either continuous (and +perhaps high-dimensional) or discrete but too large to sum over, and +uses importance sampling. conditional Monte Carlo methods. + +The maximum entropy model has exponential form + +.. + p(x) = exp(theta^T f(x)) / Z(theta) + +.. math:: + p\\left(x\\right)=\\exp\\left(\\frac{\\theta^{T}f\\left(x\\right)} + {Z\\left(\\theta\\right)}\\right) + +with a real parameter vector theta of the same length as the feature +statistic f(x), For more background, see, for example, Cover and +Thomas (1991), *Elements of Information Theory*. + +See the file bergerexample.py for a walk-through of how to use these +routines when the sample space is small enough to be enumerated. + +See bergerexamplesimulated.py for a a similar walk-through using +simulation. + +Copyright: Ed Schofield, 2003-2006 +License: BSD-style (see LICENSE.txt in main source directory) + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + maxentropy - + maxentutils - + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + DivergenceError - + basemodel - + bigmodel - + conditionalmodel - + model - + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + arrayexp - + arrayexpcomplex - + columnmeans - + columnvariances - + densefeaturematrix - + densefeatures - + dotprod - + flatten - + innerprod - + innerprodtranspose - + logsumexp - + logsumexp_naive - + robustlog - + rowmeans - + sample_wr - + sparsefeaturematrix - + sparsefeatures - + +Objects +------- + +.. autosummary:: + :toctree: generated/ + + division - + +""" from info import __doc__ from maxentropy import * Modified: trunk/scipy/maxentropy/maxentropy.py =================================================================== --- trunk/scipy/maxentropy/maxentropy.py 2010-11-14 10:00:33 UTC (rev 6889) +++ trunk/scipy/maxentropy/maxentropy.py 2010-11-14 10:00:53 UTC (rev 6890) @@ -790,7 +790,9 @@ class conditionalmodel(model): """ A conditional maximum-entropy (exponential-form) model p(x|w) on a - discrete sample space. This is useful for classification problems: + discrete sample space. + + This is useful for classification problems: given the context w, what is the probability of each class x? The form of such a model is:: Modified: trunk/scipy/maxentropy/maxentutils.py =================================================================== --- trunk/scipy/maxentropy/maxentutils.py 2010-11-14 10:00:33 UTC (rev 6889) +++ trunk/scipy/maxentropy/maxentutils.py 2010-11-14 10:00:53 UTC (rev 6890) @@ -1,5 +1,7 @@ -"""maxentutils.py: Utility routines for the maximum entropy module. Most -of them are either Python replacements for the corresponding Fortran +""" +Utility routines for the maximum entropy module. + +Most of them are either Python replacements for the corresponding Fortran routines or wrappers around matrices to allow the maxent module to manipulate ndarrays, scipy sparse matrices, and PySparse matrices a common interface. @@ -9,6 +11,7 @@ Copyright: Ed Schofield, 2003-2006 License: BSD-style (see LICENSE.txt in main source directory) + """ # Future imports must come before any code in 2.5 @@ -121,12 +124,15 @@ def arrayexp(x): - """Returns the elementwise antilog of the real array x. We try to - exponentiate with numpy.exp() and, if that fails, with python's - math.exp(). numpy.exp() is about 10 times faster but throws an - OverflowError exception for numerical underflow (e.g. exp(-800), + """ + Returns the elementwise antilog of the real array x. + + We try to exponentiate with numpy.exp() and, if that fails, with + python's math.exp(). numpy.exp() is about 10 times faster but throws + an OverflowError exception for numerical underflow (e.g. exp(-800), whereas python's math.exp() just returns zero, which is much more helpful. + """ try: ex = numpy.exp(x) @@ -139,12 +145,15 @@ return ex def arrayexpcomplex(x): - """Returns the elementwise antilog of the vector x. We try to - exponentiate with numpy.exp() and, if that fails, with python's + """ + Returns the elementwise antilog of the vector x. + + We try to exponentiate with numpy.exp() and, if that fails, with python's math.exp(). numpy.exp() is about 10 times faster but throws an OverflowError exception for numerical underflow (e.g. exp(-800), whereas python's math.exp() just returns zero, which is much more helpful. + """ try: ex = numpy.exp(x).real @@ -272,12 +281,15 @@ def dotprod(u,v): - """This is a wrapper around general dense or sparse dot products. + """ + This is a wrapper around general dense or sparse dot products. + It is not necessary except as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. Returns the dot product of the (1 x m) sparse array u with the (m x 1) (dense) numpy array v. + """ #print "Taking the dot product u.v, where" #print "u has shape " + str(u.shape) @@ -294,7 +306,9 @@ def innerprod(A,v): - """This is a wrapper around general dense or sparse dot products. + """ + This is a wrapper around general dense or sparse dot products. + It is not necessary except as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. @@ -302,6 +316,7 @@ with the n-element dense array v. This is a wrapper for A.dot(v) for dense arrays and spmatrix objects, and for A.matvec(v, result) for PySparse matrices. + """ # We assume A is sparse. @@ -337,7 +352,9 @@ def innerprodtranspose(A,v): - """This is a wrapper around general dense or sparse dot products. + """ + This is a wrapper around general dense or sparse dot products. + It is not necessary except as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. @@ -346,6 +363,7 @@ function is efficient for large matrices A. This is a wrapper for u.T.dot(v) for dense arrays and spmatrix objects, and for u.matvec_transp(v, result) for pysparse matrices. + """ (m, n) = A.shape @@ -382,8 +400,10 @@ def rowmeans(A): - """This is a wrapper for general dense or sparse dot products. It is - only necessary as a common interface for supporting ndarray, + """ + This is a wrapper for general dense or sparse dot products. + + It is only necessary as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. Returns a dense (m x 1) vector representing the mean of the rows of A, @@ -392,6 +412,7 @@ >>> a = numpy.array([[1,2],[3,4]], float) >>> rowmeans(a) array([ 1.5, 3.5]) + """ if type(A) is numpy.ndarray: return A.mean(1) @@ -406,8 +427,10 @@ return rowsum / float(n) def columnmeans(A): - """This is a wrapper for general dense or sparse dot products. It is - only necessary as a common interface for supporting ndarray, + """ + This is a wrapper for general dense or sparse dot products. + + It is only necessary as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. Returns a dense (1 x n) vector with the column averages of A, which can @@ -416,6 +439,7 @@ >>> a = numpy.array([[1,2],[3,4]],'d') >>> columnmeans(a) array([ 2., 3.]) + """ if type(A) is numpy.ndarray: return A.mean(0) @@ -430,8 +454,10 @@ return columnsum / float(m) def columnvariances(A): - """This is a wrapper for general dense or sparse dot products. It - is not necessary except as a common interface for supporting ndarray, + """ + This is a wrapper for general dense or sparse dot products. + + It is not necessary except as a common interface for supporting ndarray, scipy spmatrix, and PySparse arrays. Returns a dense (1 x n) vector with unbiased estimators for the column @@ -441,6 +467,7 @@ >>> a = numpy.array([[1,2], [3,4]], 'd') >>> columnvariances(a) array([ 2., 2.]) + """ if type(A) is numpy.ndarray: return numpy.std(A,0)**2 From scipy-svn at scipy.org Sun Nov 14 05:01:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:01:16 -0600 (CST) Subject: [Scipy-svn] r6891 - trunk/scipy/optimize Message-ID: <20101114100116.030BE37BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:01:15 -0600 (Sun, 14 Nov 2010) New Revision: 6891 Modified: trunk/scipy/optimize/__init__.py trunk/scipy/optimize/cobyla.py trunk/scipy/optimize/lbfgsb.py trunk/scipy/optimize/minpack.py trunk/scipy/optimize/optimize.py trunk/scipy/optimize/slsqp.py trunk/scipy/optimize/tnc.py Log: DOC: merge wiki edits for optimize module. Modified: trunk/scipy/optimize/__init__.py =================================================================== --- trunk/scipy/optimize/__init__.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/__init__.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -1,3 +1,137 @@ +""" +Optimization Tools +================== + +General-purpose Optimization Routines +------------------------------------- + +.. autosummary:: + :toctree: generated/ + + fmin - Nelder-Mead Simplex algorithm # + fmin_powell - Powell's (modified) level set method # + fmin_cg - Non-linear (Polak-Ribiere) conjugate gradient algorithm ## + fmin_bfgs - Quasi-Newton method (Broydon-Fletcher-Goldfarb-Shanno) ## + fmin_ncg - Line-search Newton Conjugate Gradient ### + leastsq - Minimize the sum of squares of M equations in N unknowns + +Constrained Optimizers (Multivariate) +------------------------------------- + +.. autosummary:: + :toctree: generated/ + + fmin_l_bfgs_b - Zhu, Byrd, and Nocedal's constrained optimizer % + fmin_tnc - Truncated Newton code %% + fmin_cobyla - Constrained optimization by linear approximation + fmin_slsqp - Minimization using sequential least-squares programming + nnls - Linear least-squares problem with non-negativity constraint + +Global Optimizers +----------------- + +.. autosummary:: + :toctree: generated/ + + anneal - Simulated annealing + brute - Brute force searching optimizer + +Scalar Function Minimizers +-------------------------- + +.. autosummary:: + :toctree: generated/ + + fminbound - Bounded minimization of a scalar function + brent - 1-D function minimization using Brent method + golden - 1-D function minimization using Golden Section method + bracket - Bracket a minimum, given two starting points + +General-purpose Root-finding Routines +------------------------------------- + +.. autosummary:: + :toctree: generated/ + + fsolve - Non-linear multi-variable equation solver + +Scalar Function Solvers +----------------------- + +.. autosummary:: + :toctree: generated/ + + brentq - quadratic interpolation Brent method + brenth - Brent method, modified by Harris with hyperbolic extrapolation + ridder - Ridder's method + bisect - Bisection method + newton - Secant method or Newton's method + fixed_point - Single-variable fixed-point solver + +General-purpose Non-linear Multidimensional Solvers +--------------------------------------------------- + +.. autosummary:: + :toctree: generated/ + + broyden1 - Broyden's first method $ + broyden2 - Broyden's second method $$ + broyden3 - Broyden's third method $$$ + broyden_generalized - Generalized Broyden's method & + anderson - Extended Anderson method && + anderson2 - The Anderson method &&& + +Utility Functions +----------------- + +.. autosummary:: + :toctree: generated/ + + line_search - Return a step that satisfies the strong Wolfe conditions + check_grad - Check the supplied derivative using finite differences + +Related Software +---------------- + +OpenOpt - A BSD-licensed optimization framework (see ``_) that includes: a number of constrained and +unconstrained solvers from and beyond the scipy.optimize module; unified +text and graphical output of convergence information; and automatic +differentiation. + +Notes +----- +# Uses only function calls + +## Can use function and gradient + +### Can use function, gradient, and Hessian + +% If you use fmin_l_bfgs_b, please cite Zhu, Byrd, and Nocedal's papers; see the function's docstring for references. + +%% Originally written by Stephen Nash, adapted to C by Jean-Sebastien Roy. + +$ broyden1 is a quasi-Newton-Raphson method for updating an approximate +Jacobian and then inverting it. + +$$ broyden2 is the same as broyden1, but updates the inverse Jacobian +directly. + +$$$ broyden3 is the same as broyden2, but instead of directly computing +the inverse Jacobian, it remembers how to construct it using vectors, and +when computing inv(J)*F, it uses those vectors to compute this product, +thus avoding the expensive NxN matrix multiplication. + +& broyden_generalized is the same as broyden2, but instead of +approximating the full NxN Jacobian, it constructs it at every iteration +in a way that avoids the NxN matrix multiplication. This is not as +precise as broyden3. + +&& anderson is the same as broyden_generalized, but (w_0**2)*I is added +before taking inversion to improve the stability. + +&&& anderson2 is the same as anderson, but formulated differently. + +""" # # optimize - Optimization Tools # Modified: trunk/scipy/optimize/cobyla.py =================================================================== --- trunk/scipy/optimize/cobyla.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/cobyla.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -18,13 +18,14 @@ Parameters ---------- - func : callable f(x, *args) - Function to minimize. + func : callable + Function to minimize. In the form func(x, \\*args). x0 : ndarray Initial guess. cons : sequence Constraint functions; must all be ``>=0`` (a single function - if only 1 constraint). + if only 1 constraint). Each function takes the parameters `x` + as its first argument. args : tuple Extra arguments to pass to function. consargs : tuple @@ -36,7 +37,7 @@ rhoend : Final accuracy in the optimization (not precisely guaranteed). iprint : {0, 1, 2, 3} - Controls the frequency of output; 0 implies no output. Deprecated + Controls the frequency of output; 0 implies no output. Deprecated. disp : {0, 1, 2, 3} Over-rides the iprint interface. Preferred. maxfun : int @@ -47,6 +48,30 @@ x : ndarray The argument that minimises `f`. + Examples + -------- + Minimize the objective function f(x,y) = x*y subject + to the constraints x**2 + y**2 < 1 and y > 0:: + + >>> def objective(x): + ... return x[0]*x[1] + ... + >>> def constr1(x): + ... return 1 - (x[0]**2 + x[1]**2) + ... + >>> def constr2(x): + ... return x[1] + ... + >>> fmin_cobyla(objective, [0.0, 0.1], [constr1, constr2], rhoend=1e-7) + + Normal return from subroutine COBYLA + + NFVALS = 64 F =-5.000000E-01 MAXCV = 1.998401E-14 + X =-7.071069E-01 7.071067E-01 + array([-0.70710685, 0.70710671]) + + The exact solution is (-sqrt(2)/2, sqrt(2)/2). + """ err = "cons must be a sequence of callable functions or a single"\ " callable function." Modified: trunk/scipy/optimize/lbfgsb.py =================================================================== --- trunk/scipy/optimize/lbfgsb.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/lbfgsb.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -79,8 +79,9 @@ calculating the gradient iprint : int Controls the frequency of output. ``iprint < 0`` means no output. - disp : int - If zero, then no output. If positive number, then this over-rides iprint + disp : int, optional + If zero, then no output. If positive number, then this over-rides + `iprint`. maxfun : int Maximum number of function evaluations. @@ -93,36 +94,35 @@ d : dict Information dictionary. - d['warnflag'] is - 0 if converged, - 1 if too many function evaluations, - 2 if stopped for another reason, given in d['task'] - d['grad'] is the gradient at the minimum (should be 0 ish) - d['funcalls'] is the number of function calls made. + * d['warnflag'] is + - 0 if converged, + - 1 if too many function evaluations, + - 2 if stopped for another reason, given in d['task'] + * d['grad'] is the gradient at the minimum (should be 0 ish) + * d['funcalls'] is the number of function calls made. - Notes - ----- + Notes + ----- + License of L-BFGS-B (Fortran code): - License of L-BFGS-B (Fortran code): + The version included here (in fortran code) is 2.1 (released in 1997). + It was written by Ciyou Zhu, Richard Byrd, and Jorge Nocedal + . It carries the following condition for use: - The version included here (in fortran code) is 2.1 (released in - 1997). It was written by Ciyou Zhu, Richard Byrd, and Jorge Nocedal - . It carries the following condition for use: + This software is freely available, but we expect that all publications + describing work using this software , or all commercial products using it, + quote at least one of the references given below. - This software is freely available, but we expect that all - publications describing work using this software, or all - commercial products using it, quote at least one of the references - given below. + References + ---------- + * R. H. Byrd, P. Lu and J. Nocedal. A Limited Memory Algorithm for Bound + Constrained Optimization, (1995), SIAM Journal on Scientific and + Statistical Computing , 16, 5, pp. 1190-1208. + * C. Zhu, R. H. Byrd and J. Nocedal. L-BFGS-B: Algorithm 778: L-BFGS-B, + FORTRAN routines for large scale bound constrained optimization (1997), + ACM Transactions on Mathematical Software, Vol 23, Num. 4, pp. 550 - 560. - References - * R. H. Byrd, P. Lu and J. Nocedal. A Limited Memory Algorithm for Bound - Constrained Optimization, (1995), SIAM Journal on Scientific and - Statistical Computing , 16, 5, pp. 1190-1208. - * C. Zhu, R. H. Byrd and J. Nocedal. L-BFGS-B: Algorithm 778: L-BFGS-B, - FORTRAN routines for large scale bound constrained optimization (1997), - ACM Transactions on Mathematical Software, Vol 23, Num. 4, pp. 550 - 560. - """ n = len(x0) Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/minpack.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -168,7 +168,8 @@ def leastsq(func, x0, args=(), Dfun=None, full_output=0, col_deriv=0, ftol=1.49012e-8, xtol=1.49012e-8, gtol=0.0, maxfev=0, epsfcn=0.0, factor=100, diag=None): - """Minimize the sum of squares of a set of equations. + """ + Minimize the sum of squares of a set of equations. :: @@ -226,7 +227,7 @@ residual standard deviation to get the covariance of the parameter estimates -- see curve_fit. infodict : dict - a dictionary of optional outputs with the keys:: + a dictionary of optional outputs with the key s:: - 'nfev' : the number of function calls - 'fvec' : the function evaluated at the output @@ -242,6 +243,7 @@ magnitude. Column j of p is column ipvt(j) of the identity matrix. - 'qtf' : the vector (transpose(q) * fvec). + mesg : str A string message giving information about the cause of failure. ier : int @@ -253,6 +255,19 @@ ----- "leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms. + cov_x is a Jacobian approximation to the Hessian of the least squares + objective function. + This approximation assumes that the objective function is based on the + difference between some observed target data (ydata) and a (non-linear) + function of the parameters `f(xdata, params)` :: + + func(params) = ydata - f(xdata, params) + + so that the objective function is :: + + min sum((ydata - f(xdata, params))**2, axis=0) + params + """ x0 = array(x0, ndmin=1) n = len(x0) Modified: trunk/scipy/optimize/optimize.py =================================================================== --- trunk/scipy/optimize/optimize.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/optimize.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -178,7 +178,8 @@ def fmin(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None): - """Minimize a function using the downhill simplex algorithm. + """ + Minimize a function using the downhill simplex algorithm. Parameters ---------- @@ -208,7 +209,7 @@ allvecs : list Solution at each iteration. - Other Parameters + Other parameters ---------------- xtol : float Relative error in xopt acceptable for convergence. @@ -219,7 +220,7 @@ maxfun : number Maximum number of function evaluations to make. full_output : bool - Set to True if fval and warnflag outputs are desired. + Set to True if fopt and warnflag outputs are desired. disp : bool Set to True to print convergence messages. retall : bool @@ -227,8 +228,8 @@ Notes ----- - Uses a Nelder-Mead simplex algorithm to find the minimum of - a function of one or more variables. + Uses a Nelder-Mead simplex algorithm to find the minimum of function of + one or more variables. """ fcalls, func = wrap_function(func, args) @@ -1422,7 +1423,8 @@ def fmin_powell(func, x0, args=(), xtol=1e-4, ftol=1e-4, maxiter=None, maxfun=None, full_output=0, disp=1, retall=0, callback=None, direc=None): - """Minimize a function using modified Powell's method. + """ + Minimize a function using modified Powell's method. Parameters ---------- @@ -1431,7 +1433,7 @@ x0 : ndarray Initial guess. args : tuple - Eextra arguments passed to func. + Extra arguments passed to func. callback : callable An optional user-supplied function, called after each iteration. Called as ``callback(xk)``, where ``xk`` is the Modified: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/slsqp.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -66,14 +66,14 @@ ---------- func : callable f(x,*args) Objective function. - x0 : ndarray of float + x0 : 1-D ndarray of float Initial guess for the independent variable(s). eqcons : list A list of functions of length n such that eqcons[j](x0,*args) == 0.0 in a successfully optimized problem. f_eqcons : callable f(x,*args) - Returns an array in which each element must equal 0.0 in a + Returns a 1-D array in which each element must equal 0.0 in a successfully optimized problem. If f_eqcons is specified, eqcons is ignored. ieqcons : list @@ -81,7 +81,7 @@ ieqcons[j](x0,*args) >= 0.0 in a successfully optimized problem. f_ieqcons : callable f(x0,*args) - Returns an array in which each element must be greater or + Returns a 1-D ndarray in which each element must be greater or equal to 0.0 in a successfully optimized problem. If f_ieqcons is specified, ieqcons is ignored. bounds : list Modified: trunk/scipy/optimize/tnc.py =================================================================== --- trunk/scipy/optimize/tnc.py 2010-11-14 10:00:53 UTC (rev 6890) +++ trunk/scipy/optimize/tnc.py 2010-11-14 10:01:15 UTC (rev 6891) @@ -83,21 +83,22 @@ messages=MSG_ALL, maxCGit=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=-1, xtol=-1, pgtol=-1, rescale=-1, disp=None): - """Minimize a function with variables subject to bounds, using + """ + Minimize a function with variables subject to bounds, using gradient information. Parameters ---------- - func : callable func(x, *args) + func : callable ``func(x, *args)`` Function to minimize. Should return f and g, where f is the value of the function and g its gradient (a list of floats). If the function returns None, the minimization is aborted. x0 : list of floats Initial estimate of minimum. - fprime : callable fprime(x, *args) + fprime : callable ``fprime(x, *args)`` Gradient of func. If None, then func must return the - function value and the gradient (f,g = func(x, *args)). + function value and the gradient (``f,g = func(x, *args)``). args : tuple Arguments to pass to function. approx_grad : bool @@ -164,7 +165,7 @@ The solution. nfeval : int The number of function evaluations. - rc : + rc : int Return code as defined in the RCSTRINGS dict. """ From scipy-svn at scipy.org Sun Nov 14 05:01:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:01:37 -0600 (CST) Subject: [Scipy-svn] r6892 - in trunk/scipy: signal sparse sparse/linalg/dsolve sparse/linalg/eigen/arpack Message-ID: <20101114100137.89C2D37BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:01:37 -0600 (Sun, 14 Nov 2010) New Revision: 6892 Modified: trunk/scipy/signal/ltisys.py trunk/scipy/sparse/__init__.py trunk/scipy/sparse/linalg/dsolve/__init__.py trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: DOC: merge wiki edits for sparse module and signal/ltisys.py Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-11-14 10:01:15 UTC (rev 6891) +++ trunk/scipy/signal/ltisys.py 2010-11-14 10:01:37 UTC (rev 6892) @@ -315,17 +315,17 @@ * 3: (zeros, poles, gain) * 4: (A, B, C, D) - U : ndarray or array-like (1D or 2D), optional + U : array_like (1D or 2D), optional An input array describing the input at each time T. Linear interpolation is used between given times. If there are multiple inputs, then each column of the rank-2 array represents an input. If U is not given, the input is assumed to be zero. - T : ndarray or array-like (1D or 2D), optional + T : array_like (1D or 2D), optional The time steps at which the input is defined and at which the output is desired. The default is 101 evenly spaced points on the interval [0,10.0]. - X0 : ndarray or array-like (1D), optional + X0 : array_like (1D), optional The initial condition of the state vector. If `X0` is not given, the initial conditions are assumed to be 0. kwargs : dict @@ -583,50 +583,62 @@ def impulse2(system, X0=None, T=None, N=None, **kwargs): - """Impulse response of a single-input continuous-time linear system. + """ + Impulse response of a single-input, continuous-time linear system. - The solution is generated by calling `scipy.signal.lsim2`, which uses - the differential equation solver `scipy.integrate.odeint`. Parameters ---------- system : an instance of the LTI class or a tuple describing the system. The following gives the number of elements in the tuple and - the interpretation. + the interpretation: 2 (num, den) 3 (zeros, poles, gain) 4 (A, B, C, D) - T : 1D ndarray or array-like, optional + T : 1-D array_like, optional The time steps at which the input is defined and at which the output is desired. If `T` is not given, the function will generate a set of time samples automatically. - X0 : 1D ndarray or array-like, optional - The initial condition of the state vector. If X0 is None, the - initial conditions are assumed to be 0. + X0 : 1-D array_like, optional + The initial condition of the state vector. Default: 0 (the + zero vector). N : int, optional - Number of time points to compute. If `N` is not given, 100 - points are used. - **kwargs : - Additional keyword arguments are passed on the function + Number of time points to compute. Default: 100. + kwargs : various types + Additional keyword arguments are passed on to the function `scipy.signal.lsim2`, which in turn passes them on to - :func:`scipy.integrate.odeint`. See the documentation for - :func:`scipy.integrate.odeint` for information about these - arguments. + `scipy.integrate.odeint`; see the latter's documentation for + information about these arguments. Returns ------- - T : 1D ndarray + T : ndarray The time values for the output. yout : ndarray The output response of the system. See Also -------- - scipy.signal.impulse + impulse, lsim2, integrate.odeint Notes ----- + The solution is generated by calling `scipy.signal.lsim2`, which uses + the differential equation solver `scipy.integrate.odeint`. + .. versionadded:: 0.8.0 + + + Examples + -------- + + Second order system with a repeated root: x''(t) + 2*x(t) + x(t) = u(t) + + >>> system = ([1.0], [1.0, 2.0, 1.0]) + >>> t, y = impulse2(system) + >>> import matplotlib.pyplot as plt + >>> plt.plot(t, y) + """ if isinstance(system, lti): sys = system Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2010-11-14 10:01:15 UTC (rev 6891) +++ trunk/scipy/sparse/__init__.py 2010-11-14 10:01:37 UTC (rev 6892) @@ -1,5 +1,174 @@ -"Sparse Matrix Support" +""" +Sparse Matrices +=============== +SciPy 2-D sparse matrix package. + +Original code by Travis Oliphant. +Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell. + +There are seven available sparse matrix types: + 1. csc_matrix: Compressed Sparse Column format + 2. csr_matrix: Compressed Sparse Row format + 3. bsr_matrix: Block Sparse Row format + 4. lil_matrix: List of Lists format + 5. dok_matrix: Dictionary of Keys format + 6. coo_matrix: COOrdinate format (aka IJV, triplet format) + 7. dia_matrix: DIAgonal format + +To construct a matrix efficiently, use either lil_matrix (recommended) or +dok_matrix. The lil_matrix class supports basic slicing and fancy +indexing with a similar syntax to NumPy arrays. As illustrated below, +the COO format may also be used to efficiently construct matrices. + +To perform manipulations such as multiplication or inversion, first +convert the matrix to either CSC or CSR format. The lil_matrix format is +row-based, so conversion to CSR is efficient, whereas conversion to CSC +is less so. + +All conversions among the CSR, CSC, and COO formats are efficient, +linear-time operations. + +Example 1 +--------- +Construct a 1000x1000 lil_matrix and add some values to it: + +>>> from scipy.sparse import lil_matrix +>>> from scipy.sparse.linalg import spsolve +>>> from numpy.linalg import solve, norm +>>> from numpy.random import rand + +>>> A = lil_matrix((1000, 1000)) +>>> A[0, :100] = rand(100) +>>> A[1, 100:200] = A[0, :100] +>>> A.setdiag(rand(1000)) + +Now convert it to CSR format and solve A x = b for x: + +>>> A = A.tocsr() +>>> b = rand(1000) +>>> x = spsolve(A, b) + +Convert it to a dense matrix and solve, and check that the result +is the same: + +>>> x_ = solve(A.todense(), b) + +Now we can compute norm of the error with: + +>>> err = norm(x-x_) +>>> err < 1e-10 +True + +It should be small :) + + +Example 2 +--------- + +Construct a matrix in COO format: + +>>> from scipy import sparse +>>> from numpy import array +>>> I = array([0,3,1,0]) +>>> J = array([0,3,1,2]) +>>> V = array([4,5,7,9]) +>>> A = sparse.coo_matrix((V,(I,J)),shape=(4,4)) + +Notice that the indices do not need to be sorted. + +Duplicate (i,j) entries are summed when converting to CSR or CSC. + +>>> I = array([0,0,1,3,1,0,0]) +>>> J = array([0,2,1,3,1,0,0]) +>>> V = array([1,1,1,1,1,1,1]) +>>> B = sparse.coo_matrix((V,(I,J)),shape=(4,4)).tocsr() + +This is useful for constructing finite-element stiffness and mass matrices. + +Further Details +--------------- + +CSR column indices are not necessarily sorted. Likewise for CSC row +indices. Use the .sorted_indices() and .sort_indices() methods when +sorted indices are required (e.g. when passing data to other libraries). + +Package Contents +================ + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + base - Base class for sparse matrices + bsr - Compressed Block Sparse Row matrix format + compressed - Sparse matrix base class using compressed storage + construct - Functions to construct sparse matrices + coo - A sparse matrix in COOrdinate or 'triplet' format + csc - Compressed Sparse Column matrix format + csgraph - Compressed Sparse graph algorithms + csr - Compressed Sparse Row matrix format + data - Base class for sparse matrice with a .data attribute + dia - Sparse DIAgonal format + dok - Dictionary Of Keys based matrix + extract - Functions to extract parts of sparse matrices + lil - LInked List sparse matrix class + linalg - + sparsetools - A collection of routines for sparse matrix operations + spfuncs - Functions that operate on sparse matrices + sputils - Utility functions for sparse matrix module + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + SparseEfficiencyWarning - + SparseWarning - + bsr_matrix - Block Sparse Row matrix + coo_matrix - A sparse matrix in COOrdinate format + csc_matrix - Compressed Sparse Column matrix + csr_matrix - Compressed Sparse Row matrix + dia_matrix - Sparse matrix with DIAgonal storage + dok_matrix - Dictionary Of Keys based sparse matrix + lil_matrix - Row-based linked list sparse matrix + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + bmat - Build a sparse matrix from sparse sub-blocks + cs_graph_components - + eye - Sparse MxN matrix whose k-th diagonal is all ones + find - + hstack - Stack sparse matrices horizontally (column wise) + identity - Identity matrix in sparse format + issparse - + isspmatrix - + isspmatrix_bsr - + isspmatrix_coo - + isspmatrix_csc - + isspmatrix_csr - + isspmatrix_dia - + isspmatrix_dok - + isspmatrix_lil - + kron - kronecker product of two sparse matrices + kronsum - kronecker sum of sparse matrices + lil_diags - Generate a lil_matrix with the given diagonals + lil_eye - RxC lil_matrix whose k-th diagonal set to one + rand - Random values in a given shape + spdiags - Return a sparse matrix from diagonals + tril - Lower triangular portion of a matrix in sparse format + triu - Upper triangular portion of a matrix in sparse format + vstack - Stack sparse matrices vertically (row wise) + +""" + from info import __doc__ from base import * Modified: trunk/scipy/sparse/linalg/dsolve/__init__.py =================================================================== --- trunk/scipy/sparse/linalg/dsolve/__init__.py 2010-11-14 10:01:15 UTC (rev 6891) +++ trunk/scipy/sparse/linalg/dsolve/__init__.py 2010-11-14 10:01:37 UTC (rev 6892) @@ -1,5 +1,56 @@ -"Direct Solvers for Sparse Linear Systems" +""" +Linear Solvers +============== +The default solver is SuperLU (included in the scipy distribution), +which can solve real or complex linear systems in both single and +double precisions. It is automatically replaced by UMFPACK, if +available. Note that UMFPACK works in double precision only, so +switch it off by + +>>> use_solver( useUmfpack = False ) + +to solve in the single precision. See also use_solver documentation. + +Example session: + +>>> from scipy.sparse import csc_matrix, spdiags +>>> from numpy import array +>>> from scipy.sparse.linalg import spsolve, use_solver +>>> +>>> print "Inverting a sparse linear system:" +>>> print "The sparse matrix (constructed from diagonals):" +>>> a = spdiags([[1, 2, 3, 4, 5], [6, 5, 8, 9, 10]], [0, 1], 5, 5) +>>> b = array([1, 2, 3, 4, 5]) +>>> print "Solve: single precision complex:" +>>> use_solver( useUmfpack = False ) +>>> a = a.astype('F') +>>> x = spsolve(a, b) +>>> print x +>>> print "Error: ", a*x-b +>>> +>>> print "Solve: double precision complex:" +>>> use_solver( useUmfpack = True ) +>>> a = a.astype('D') +>>> x = spsolve(a, b) +>>> print x +>>> print "Error: ", a*x-b +>>> +>>> print "Solve: double precision:" +>>> a = a.astype('d') +>>> x = spsolve(a, b) +>>> print x +>>> print "Error: ", a*x-b +>>> +>>> print "Solve: single precision:" +>>> use_solver( useUmfpack = False ) +>>> a = a.astype('f') +>>> x = spsolve(a, b.astype('f')) +>>> print x +>>> print "Error: ", a*x-b + +""" + from info import __doc__ #import umfpack Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-11-14 10:01:15 UTC (rev 6891) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-11-14 10:01:37 UTC (rev 6892) @@ -312,52 +312,46 @@ def eigen(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): - """Find k eigenvalues and eigenvectors of the square matrix A. + """ + Find k eigenvalues and eigenvectors of the square matrix A. - Solves A * x[i] = w[i] * x[i], the standard eigenvalue problem for - w[i] eigenvalues with corresponding eigenvectors x[i]. + Solves ``A * x[i] = w[i] * x[i]``, the standard eigenvalue problem + for w[i] eigenvalues with corresponding eigenvectors x[i]. - Parameters ---------- A : matrix, array, or object with matvec(x) method An N x N matrix, array, or an object with matvec(x) method to perform the matrix vector product A * x. The sparse matrix formats in scipy.sparse are appropriate for A. - k : integer The number of eigenvalues and eigenvectors desired Returns ------- w : array - Array of k eigenvalues - + Array of k eigenvalues. v : array - An array of k eigenvectors - The v[i] is the eigenvector corresponding to the eigenvector w[i] + An array of `k` eigenvectors. + ``v[:, i]`` is the eigenvector corresponding to the eigenvalue w[i]. Other Parameters ---------------- - M : matrix or array (Not implemented) A symmetric positive-definite matrix for the generalized - eigenvalue problem A * x = w * M * x - + eigenvalue problem ``A * x = w * M * x``. sigma : real or complex (Not implemented) Find eigenvalues near sigma. Shift spectrum by sigma. - v0 : array Starting vector for iteration. - ncv : integer The number of Lanczos vectors generated - ncv must be greater than k; it is recommended that ncv > 2*k - + `ncv` must be greater than `k`; it is recommended that ``ncv > 2*k``. which : string - Which k eigenvectors and eigenvalues to find: + Which `k` eigenvectors and eigenvalues to find: + - 'LM' : largest magnitude - 'SM' : smallest magnitude - 'LR' : largest real part @@ -367,10 +361,8 @@ maxiter : integer Maximum number of Arnoldi update iterations allowed - tol : float Relative accuracy for eigenvalues (stopping criterion) - return_eigenvectors : boolean Return eigenvectors (True) in addition to eigenvalues @@ -378,12 +370,17 @@ -------- eigen_symmetric : eigenvalues and eigenvectors for symmetric matrix A - Notes - ----- - Examples -------- + Find 6 eigenvectors of the identity matrix: + >>> id = np.identity(13) + >>> vals, vecs = sp.sparse.linalg.eigen(id, k=6) + >>> vals + array([ 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j, 1.+0.j]) + >>> vecs.shape + (13, 6) + """ A = aslinearoperator(A) if A.shape[0] != A.shape[1]: From scipy-svn at scipy.org Sun Nov 14 05:02:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:02:01 -0600 (CST) Subject: [Scipy-svn] r6893 - trunk/scipy/stats Message-ID: <20101114100201.8A0F137BA40@scipy.org> Author: rgommers Date: 2010-11-14 04:02:01 -0600 (Sun, 14 Nov 2010) New Revision: 6893 Modified: trunk/scipy/stats/__init__.py trunk/scipy/stats/distributions.py trunk/scipy/stats/morestats.py trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/stats.py Log: DOC: merge more wiki edits for stats module. Modified: trunk/scipy/stats/__init__.py =================================================================== --- trunk/scipy/stats/__init__.py 2010-11-14 10:01:37 UTC (rev 6892) +++ trunk/scipy/stats/__init__.py 2010-11-14 10:02:01 UTC (rev 6893) @@ -1,3 +1,259 @@ +""" +Statistical Functions +===================== + +This module contains a large number of probability distributions as +well as a growing library of statistical functions. + +Each included distribution is an instance of the class rv_continous. +For each given name the following methods are available. See docstring +for rv_continuous for more information + +:rvs: + random variates with the distribution +:pdf: + probability density function +:cdf: + cumulative distribution function +:sf: + survival function (1.0 - cdf) +:ppf: + percent-point function (inverse of cdf) +:isf: + inverse survival function +:stats: + mean, variance, and optionally skew and kurtosis + +Calling the instance as a function returns a frozen pdf whose shape, +location, and scale parameters are fixed. + +Distributions +--------------- + +The distributions available with the above methods are: + + +Continuous (Total == 81 distributions) +--------------------------------------- + +.. autosummary:: + :toctree: generated/ + + norm Normal (Gaussian) + alpha Alpha + anglit Anglit + arcsine Arcsine + beta Beta + betaprime Beta Prime + bradford Bradford + burr Burr + cauchy Cauchy + chi Chi + chi2 Chi-squared + cosine Cosine + dgamma Double Gamma + dweibull Double Weibull + erlang Erlang + expon Exponential + exponweib Exponentiated Weibull + exponpow Exponential Power + f F (Snecdor F) + fatiguelife Fatigue Life (Birnbaum-Sanders) + fisk Fisk + foldcauchy Folded Cauchy + foldnorm Folded Normal + frechet_r Frechet Right Sided, Extreme Value Type II (Extreme LB) or weibull_min + frechet_l Frechet Left Sided, Weibull_max + genlogistic Generalized Logistic + genpareto Generalized Pareto + genexpon Generalized Exponential + genextreme Generalized Extreme Value + gausshyper Gauss Hypergeometric + gamma Gamma + gengamma Generalized gamma + genhalflogistic Generalized Half Logistic + gompertz Gompertz (Truncated Gumbel) + gumbel_r Right Sided Gumbel, Log-Weibull, Fisher-Tippett, Extreme Value Type I + gumbel_l Left Sided Gumbel, etc. + halfcauchy Half Cauchy + halflogistic Half Logistic + halfnorm Half Normal + hypsecant Hyperbolic Secant + invgamma Inverse Gamma + invnorm Inverse Normal + invweibull Inverse Weibull + johnsonsb Johnson SB + johnsonsu Johnson SU + ksone Kolmogorov-Smirnov one-sided (no stats) + kstwobign Kolmogorov-Smirnov two-sided test for Large N (no stats) + laplace Laplace + logistic Logistic + loggamma Log-Gamma + loglaplace Log-Laplace (Log Double Exponential) + lognorm Log-Normal + gilbrat Gilbrat + lomax Lomax (Pareto of the second kind) + maxwell Maxwell + mielke Mielke's Beta-Kappa + nakagami Nakagami + ncx2 Non-central chi-squared + ncf Non-central F + nct Non-central Student's T + pareto Pareto + powerlaw Power-function + powerlognorm Power log normal + powernorm Power normal + rdist R distribution + reciprocal Reciprocal + rayleigh Rayleigh + rice Rice + recipinvgauss Reciprocal Inverse Gaussian + semicircular Semicircular + t Student's T + triang Triangular + truncexpon Truncated Exponential + truncnorm Truncated Normal + tukeylambda Tukey-Lambda + uniform Uniform + von_mises Von-Mises (Circular) + wald Wald + weibull_min Minimum Weibull (see Frechet) + weibull_max Maximum Weibull (see Frechet) + wrapcauchy Wrapped Cauchy + + +=============== ============================================================== +Discrete (Total == 10 distributions) +============================================================================== +binom Binomial +bernoulli Bernoulli +nbinom Negative Binomial +geom Geometric +hypergeom Hypergeometric +logser Logarithmic (Log-Series, Series) +poisson Poisson +planck Planck (Discrete Exponential) +boltzmann Boltzmann (Truncated Discrete Exponential) +randint Discrete Uniform +zipf Zipf +dlaplace Discrete Laplacian +=============== ============================================================== + +Statistical Functions (adapted from Gary Strangman) +----------------------------------------------------- + +================= ============================================================== +gmean Geometric mean +hmean Harmonic mean +mean Arithmetic mean +cmedian Computed median +median Median +mode Modal value +tmean Truncated arithmetic mean +tvar Truncated variance +tmin _ +tmax _ +tstd _ +tsem _ +moment Central moment +variation Coefficient of variation +skew Skewness +kurtosis Fisher or Pearson kurtosis +describe Descriptive statistics +skewtest _ +kurtosistest _ +normaltest _ +================= ============================================================== + +================= ============================================================== +itemfreq _ +scoreatpercentile _ +percentileofscore _ +histogram2 _ +histogram _ +cumfreq _ +relfreq _ +================= ============================================================== + +================= ============================================================== +obrientransform _ +samplevar _ +samplestd _ +signaltonoise _ +bayes_mvs _ +var _ +std _ +stderr _ +sem _ +z _ +zs _ +zmap _ +================= ============================================================== + +================= ============================================================== +threshold _ +trimboth _ +trim1 _ +cov _ +corrcoef _ +================= ============================================================== + +================= ============================================================== +f_oneway _ +paired _ +pearsonr _ +spearmanr _ +pointbiserialr _ +kendalltau _ +linregress _ +================= ============================================================== + +================= ============================================================== +ttest_1samp _ +ttest_ind _ +ttest_rel _ +kstest _ +chisquare _ +ks_2samp _ +meanwhitneyu _ +tiecorrect _ +ranksums _ +wilcoxon _ +kruskal _ +friedmanchisquare _ +================= ============================================================== + +================= ============================================================== +ansari _ +bartlett _ +levene _ +shapiro _ +anderson _ +binom_test _ +fligner _ +mood _ +oneway _ +================= ============================================================== + +================= ============================================================== +glm _ +anova _ +================= ============================================================== + + +================= ============================================================== +Plot-tests +================================================================================ +probplot _ +ppcc_max _ +ppcc_plot _ +================= ============================================================== + + +For many more stat related functions install the software R and the +interface package rpy. + +""" # # stats - Statistical Functions # Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-14 10:01:37 UTC (rev 6892) +++ trunk/scipy/stats/distributions.py 2010-11-14 10:02:01 UTC (rev 6893) @@ -1637,40 +1637,49 @@ def fit(self, data, *args, **kwds): """ - Return max like estimators to shape, location, and scale from data + Return MLEs for shape, location, and scale parameters from data. - Starting points for the fit are given by input arguments. For any - arguments not given starting points, self._fitstart(data) is called - to get the starting estimates. + MLE stands for Maximum Likelihood Estimate. Starting estimates for + the fit are given by input arguments; for any arguments not provided + with starting estimates, ``self._fitstart(data)`` is called to generate + such. - You can hold some parameters fixed to specific values by passing in - keyword arguments f0..fn for shape paramters and floc, fscale for - location and scale parameters. + One can hold some parameters fixed to specific values by passing in + keyword arguments ``f0``..[is this supposed to be an ellipsis?] ``fn`` + (for shape parameters) and ``floc`` and ``fscale`` (for location and + scale parameters, respectively). Parameters ---------- - data : array-like - Data to use in calculating the MLE - args : optional - Starting values for any shape arguments (those not specified - will be determined by _fitstart(data)) - kwds : loc, scale - Starting values for the location and scale parameters - Special keyword arguments are recognized as holding certain - parameters fixed: - f0..fn : hold respective shape paramters fixed - floc : hold location parameter fixed to specified value - fscale : hold scale parameter fixed to specified value - optimizer : The optimizer to use. The optimizer must take func, - and starting position as the first two arguments, - plus args (for extra arguments to pass to the - function to be optimized) and disp=0 to suppress - output as keyword arguments. - - Return - ------ - shape, loc, scale : tuple of float - MLE estimates for any shape arguments followed by location and scale + data : array_like + Data to use in calculating the MLEs + args : floats, optional + Starting value(s) for any shape-characterizing arguments (those not + provided will be determined by a call to ``_fitstart(data)``). + No default value. + kwds : floats, optional + Starting values for the location and scale parameters; no default. + Special keyword arguments are recognized as holding certain + parameters fixed: + + f0..fn : hold respective shape parameters fixed. + + floc : hold location parameter fixed to specified value. + + fscale : hold scale parameter fixed to specified value. + + optimizer : The optimizer to use. The optimizer must take func, + and starting position as the first two arguments, + plus args (for extra arguments to pass to the + function to be optimized) and disp=0 to suppress + output as keyword arguments. + + Returns + ------- + shape, loc, scale : tuple of floats + MLEs for any shape statistics, followed by those for location and + scale. + """ Narg = len(args) if Narg > self.numargs: Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-11-14 10:01:37 UTC (rev 6892) +++ trunk/scipy/stats/morestats.py 2010-11-14 10:02:01 UTC (rev 6893) @@ -196,10 +196,24 @@ ## def kstat(data,n=2): - """Return the nth k-statistic (1<=n<=4 so far). + """ + Return the nth k-statistic (1<=n<=4 so far). The nth k-statistic is the unique symmetric unbiased estimator of the nth - cumulant kappa_n + cumulant kappa_n. + + Parameters + ---------- + data : array_like + Input array. + n : int, {1, 2, 3, 4}, optional + Default is equal to 2. + + Returns + ------- + kstat : float + The nth k-statistic. + """ if n > 4 or n < 1: raise ValueError("k-statistics only supported for 1<=n<=4") @@ -223,8 +237,22 @@ raise ValueError("Should not be here.") def kstatvar(data,n=2): - """Returns an unbiased estimator of the variance of the k-statistic: n=1 or 2 """ + Returns an unbiased estimator of the variance of the k-statistic. + + Parameters + ---------- + data : array_like + Input array. + n : int, {1, 2}, optional + Default is equal to 2. + + Returns + ------- + kstatvar : float + The nth k-statistic variance. + + """ data = ravel(data) N = len(data) if n == 1: @@ -1343,8 +1371,25 @@ #return pdf_fromgamma(g1, g2, g3, g4) def circmean(samples, high=2*pi, low=0): - """Compute the circular mean for samples assumed to be in the range [low to high] """ + Compute the circular mean for samples assumed to be in the range + [low to high]. + + Parameters + ---------- + samples : array_like + Input array. + low : float or int, optional + Low boundary for circular mean range. Default is 0. + high : float or int, optional + High boundary for circular mean range. Default is 2*pi. + + Returns + ------- + circmean : float + Circular mean. + + """ ang = (samples - low)*2*pi / (high-low) res = angle(np.mean(exp(1j*ang), axis=0)) if (res < 0): @@ -1352,16 +1397,50 @@ return res*(high-low)/2.0/pi + low def circvar(samples, high=2*pi, low=0): - """Compute the circular variance for samples assumed to be in the range [low to high] """ + Compute the circular variance for samples assumed to be in the range + [low to high]. + + Parameters + ---------- + samples : array_like + Input array. + low : float or int, optional + Low boundary for circular variance range. Default is 0. + high : float or int, optional + High boundary for circular variance range. Default is 2*pi. + + Returns + ------- + circvar : float + Circular variance. + + """ ang = (samples - low)*2*pi / (high-low) res = np.mean(exp(1j*ang), axis=0) V = 1-abs(res) return ((high-low)/2.0/pi)**2 * V def circstd(samples, high=2*pi, low=0): - """Compute the circular standard deviation for samples assumed to be in the range [low to high] """ + Compute the circular standard deviation for samples assumed to be in the + range [low to high]. + + Parameters + ---------- + samples : array_like + Input array. + low : float or int, optional + Low boundary for circular standard deviation range. Default is 0. + high : float or int, optional + High boundary for circular standard deviation range. Default is 2*pi. + + Returns + ------- + circstd : float + Circular standard deviation. + + """ ang = (samples - low)*2*pi / (high-low) res = np.mean(exp(1j*ang), axis=0) V = 1-abs(res) Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-14 10:01:37 UTC (rev 6892) +++ trunk/scipy/stats/mstats_basic.py 2010-11-14 10:02:01 UTC (rev 6893) @@ -1465,21 +1465,45 @@ kurtosis.__doc__ = stats.kurtosis.__doc__ def describe(a, axis=0): - """Computes several descriptive statistics of the passed array. + """ + Computes several descriptive statistics of the passed array. Parameters ---------- a : array + axis : int or None Returns ------- - (size of the data (discarding missing values), - (min, max), - arithmetic mean, - unbiased variance, - biased skewness, - biased kurtosis) + n : int + (size of the data (discarding missing values) + mm : (int, int) + min, max + + arithmetic mean : float + + unbiased variance : float + + biased skewness : float + + biased kurtosis : float + + Examples + -------- + + >>> ma = np.ma.array(range(6), mask=[0, 0, 0, 1, 1, 1]) + >>> describe(ma) + (array(3), + (0, 2), + 1.0, + 1.0, + masked_array(data = 0.0, + mask = False, + fill_value = 1e+20) + , + -1.5) + """ a, axis = _chk_asarray(a, axis) n = a.count(axis) @@ -1523,6 +1547,30 @@ #####-------------------------------------------------------------------------- def skewtest(a, axis=0): + """ + Tests whether the skew is different from the normal distribution. + + This function tests the null hypothesis that the skewness of + the population that the sample was drawn from is the same + as that of a corresponding normal distribution. + + Parameters + ---------- + a : array + axis : int or None + + Returns + ------- + z-score : float + + p-value : float + a 2-sided p-value for the hypothesis test + + Notes + ----- + The sample size should be at least 8. + + """ a, axis = _chk_asarray(a, axis) if axis is None: a = a.ravel() @@ -1544,6 +1592,33 @@ skewtest.__doc__ = stats.skewtest.__doc__ def kurtosistest(a, axis=0): + """ + Tests whether a dataset has normal kurtosis + + This function tests the null hypothesis that the kurtosis + of the population from which the sample was drawn is that + of the normal distribution: kurtosis=3(n-1)/(n+1). + + Parameters + ---------- + a : array + array of the sample data + axis : int or None + the axis to operate along, or None to work on the whole array. + The default is the first axis. + + Returns + ------- + z-score : float + + p-value : float + The 2-sided p-value for the hypothesis test + + Notes + ----- + Valid only for n>20. The Z-score is set to 0 for bad entries. + + """ a, axis = _chk_asarray(a, axis) n = a.count(axis=axis).astype(float) if np.min(n) < 20: @@ -1610,9 +1685,9 @@ Parameters ---------- - a : array-like + a : array_like Input data, as a sequence or array of dimension at most 2. - prob : array-like, optional + prob : array_like, optional List of quantiles to compute. alpha : float, optional Plotting positions parameter, default is 0.4. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-14 10:01:37 UTC (rev 6892) +++ trunk/scipy/stats/stats.py 2010-11-14 10:02:01 UTC (rev 6893) @@ -996,13 +996,16 @@ def variation(a, axis=0): - """Computes the coefficient of variation, the ratio of the biased standard + """ + Computes the coefficient of variation, the ratio of the biased standard deviation to the mean. Parameters ---------- - a : array + a : array_like + Input array. axis : int or None + Axis along which to calculate the coefficient of variation. References ---------- @@ -1586,12 +1589,30 @@ def cumfreq(a, numbins=10, defaultreallimits=None, weights=None): """ -Returns a cumulative frequency histogram, using the histogram function. -Defaultreallimits can be None (use all data), or a 2-sequence containing -lower and upper limits on values to include. + Returns a cumulative frequency histogram, using the histogram function. -Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints -""" + Parameters + ---------- + a : array_like + Input array. + numbins : int, optional + Number of bins. + defaultreallimits : 2-sequence or None, optional + None (use all data), or a 2-sequence containing lower and upper limits + on values to include. + + Returns + ------- + cumfreq : ndarray + Binned values of cumulative frequency. + lowerreallimit : float + Lower real limit + binsize : float + Width of each bin. + extrapoints : int + Extra points. + + """ h,l,b,e = histogram(a, numbins, defaultreallimits, weights=weights) cumhist = np.cumsum(h*1, axis=0) return cumhist,l,b,e @@ -2099,12 +2120,27 @@ def trim1(a, proportiontocut, tail='right'): """ - Slices off the passed proportion of items from ONE end of the passed - array (i.e., if proportiontocut=0.1, slices off 'leftmost' or 'rightmost' - 10% of scores). Slices off LESS if proportion results in a non-integer - slice index (i.e., conservatively slices off proportiontocut). + Slices off a proportion of items from ONE end of the passed array + distribution. - Returns: trimmed version of array a + If `proportiontocut` = 0.1, slices off 'leftmost' or 'rightmost' + 10% of scores. Slices off LESS if proportion results in a non-integer + slice index (i.e., conservatively slices off `proportiontocut` ). + + Parameters + ---------- + a : array_like + Input array + proportiontocut : float + Fraction to cut off of 'left' or 'right' of distribution + tail : string, {'left', 'right'}, optional + Defaults to 'right'. + + Returns + ------- + trim1 : ndarray + Trimmed version of array `a` + """ a = asarray(a) if tail.lower() == 'right': @@ -2116,9 +2152,27 @@ return a[lowercut:uppercut] def trim_mean(a, proportiontocut): - """Return mean with proportiontocut chopped from each of the lower and - upper tails. """ + Return mean of array after trimming distribution from both lower and upper + tails. + + If `proportiontocut` = 0.1, slices off 'leftmost' and 'rightmost' 10% of + scores. Slices off LESS if proportion results in a non-integer slice + index (i.e., conservatively slices off `proportiontocut` ). + + Parameters + ---------- + a : array_like + Input array + proportiontocut : float + Fraction to cut off of both tails of the distribution + + Returns + ------- + trim_mean : ndarray + Mean of trimmed array. + + """ newa = trimboth(np.sort(a),proportiontocut) return np.mean(newa,axis=0) @@ -3466,20 +3520,23 @@ new_name="scipy.special.erfc") def chisqprob(chisq, df): - """Returns the (1-tail) probability value associated with the provided - chi-square value and degrees of freedom. + """ + Probability value (1-tail) for the Chi^2 probability distribution. Broadcasting rules apply. Parameters ---------- - chisq : array or float > 0 - df : array or float, probably int >= 1 + chisq : array_like or float > 0 + df : array_like or float, probably int >= 1 + Returns ------- - The area from chisq to infinity under the Chi^2 probability distribution - with degrees of freedom df. + chisqprob : ndarray + The area from `chisq` to infinity under the Chi^2 probability + distribution with degrees of freedom `df`. + """ return special.chdtrc(df,chisq) @@ -3487,7 +3544,8 @@ fprob = special.fdtrc def betai(a, b, x): - """Returns the incomplete beta function. + """ + Returns the incomplete beta function. I_x(a,b) = 1/B(a,b)*(Integral(0,x) of t^(a-1)(1-t)^(b-1) dt) @@ -3498,13 +3556,17 @@ Parameters ---------- - a : array or float > 0 - b : array or float > 0 - x : array or float + a : array_like or float > 0 + + b : array_like or float > 0 + + x : array_like or float x will be clipped to be no greater than 1.0 . Returns ------- + betai : ndarray + Incomplete beta function. """ x = np.asarray(x) From scipy-svn at scipy.org Sun Nov 14 05:12:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 04:12:37 -0600 (CST) Subject: [Scipy-svn] r6894 - trunk Message-ID: <20101114101237.1F6EC37A195@scipy.org> Author: rgommers Date: 2010-11-14 04:12:36 -0600 (Sun, 14 Nov 2010) New Revision: 6894 Modified: trunk/.gitignore Log: ENH: add __config__.py and version.py to gitignore. Modified: trunk/.gitignore =================================================================== --- trunk/.gitignore 2010-11-14 10:02:01 UTC (rev 6893) +++ trunk/.gitignore 2010-11-14 10:12:36 UTC (rev 6894) @@ -15,6 +15,8 @@ /dist /scipy.egg-info /site.cfg +/scipy/__config__.py +/scipy/version.py /doc/frontpage/build /doc/source/generated From scipy-svn at scipy.org Sun Nov 14 11:18:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 10:18:57 -0600 (CST) Subject: [Scipy-svn] r6895 - in trunk/scipy: cluster fftpack interpolate io linalg maxentropy misc ndimage odr optimize sparse stats Message-ID: <20101114161857.EFC2E37A194@scipy.org> Author: ptvirtan Date: 2010-11-14 10:18:57 -0600 (Sun, 14 Nov 2010) New Revision: 6895 Modified: trunk/scipy/cluster/__init__.py trunk/scipy/cluster/info.py trunk/scipy/fftpack/__init__.py trunk/scipy/fftpack/info.py trunk/scipy/interpolate/__init__.py trunk/scipy/interpolate/info.py trunk/scipy/io/__init__.py trunk/scipy/io/info.py trunk/scipy/linalg/__init__.py trunk/scipy/linalg/info.py trunk/scipy/maxentropy/__init__.py trunk/scipy/maxentropy/info.py trunk/scipy/misc/__init__.py trunk/scipy/misc/info.py trunk/scipy/ndimage/__init__.py trunk/scipy/ndimage/info.py trunk/scipy/odr/__init__.py trunk/scipy/odr/info.py trunk/scipy/optimize/__init__.py trunk/scipy/optimize/info.py trunk/scipy/sparse/__init__.py trunk/scipy/sparse/info.py trunk/scipy/stats/__init__.py trunk/scipy/stats/info.py Log: DOC: move docstrings of __init__.py back to info.py Modified: trunk/scipy/cluster/__init__.py =================================================================== --- trunk/scipy/cluster/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/cluster/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,20 +1,3 @@ -""" -Vector Quantization / Kmeans -============================ -Clustering algorithms are useful in information theory, target detection, -communications, compression, and other areas. The `vq` module only -supports vector quantization and the k-means algorithms. Development of -self-organizing maps (SOM) and other approaches is underway. - -Hierarchical Clustering -======================= -The `hierarchy` module provides functions for hierarchical and -agglomerative clustering. Its features include generating hierarchical -clusters from distance matrices, computing distance matrices from -observation vectors, calculating statistics on clusters, cutting linkages -to generate flat clusters, and visualizing clusters with dendrograms. - -""" # # spatial - Distances # Modified: trunk/scipy/cluster/info.py =================================================================== --- trunk/scipy/cluster/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/cluster/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,25 +1,17 @@ """ Vector Quantization / Kmeans ============================ +Clustering algorithms are useful in information theory, target detection, +communications, compression, and other areas. The `vq` module only +supports vector quantization and the k-means algorithms. Development of +self-organizing maps (SOM) and other approaches is underway. - Clustering algorithms are useful in information theory, target detection, - communications, compression, and other areas. The vq module only - supports vector quantization and the k-means algorithms. Development - of self-organizing maps (SOM) and other approaches is underway. - Hierarchical Clustering ======================= +The `hierarchy` module provides functions for hierarchical and +agglomerative clustering. Its features include generating hierarchical +clusters from distance matrices, computing distance matrices from +observation vectors, calculating statistics on clusters, cutting linkages +to generate flat clusters, and visualizing clusters with dendrograms. - The hierarchy module provides functions for hierarchical and agglomerative - clustering. Its features include generating hierarchical clusters from - distance matrices, computing distance matrices from observation vectors, - calculating statistics on clusters, cutting linkages to generate flat - clusters, and visualizing clusters with dendrograms. - -Distance Computation -==================== - - The distance module provides functions for computing distances between - pairs of vectors from a set of observation vectors. - """ Modified: trunk/scipy/fftpack/__init__.py =================================================================== --- trunk/scipy/fftpack/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/fftpack/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,57 +1,3 @@ -""" -Home of discrete Fourier transform algorithms - -Modules -======= - -.. autosummary:: - :toctree: generated/ - - basic - Basic discrete Fourier transform operators - convolve - Convolution functions - helper - TODO - pseudo_diffs - Differential and pseudo-differential operators - realtransforms - Real spectrum tranforms (DCT, DST, MDCT) - -Functions -========= - -Fast Fourier Transforms (FFTs) ------------------------------- - -.. autosummary:: - :toctree: generated/ - - fft - Fast (discrete) Fourier Transform (FFT) - ifft - Inverse FFT - fft2 - Two dimensional FFT - ifft2 - Two dimensional inverse FFT - fftn - n-dimensional FFT - ifftn - n-dimensional inverse FFT - rfft - FFT of strictly real-valued sequence - irfft - Inverse of rfft - rfftfreq - DFT sample frequencies (specific to rfft and irfft) - dct - Discrete cosine transform - idct - Inverse discrete cosine transform - -Differential and pseudo-differential operators ----------------------------------------------- - -.. autosummary:: - :toctree: generated/ - - diff - Differentiation and integration of periodic sequences - tilbert - Tilbert transform: cs_diff(x,h,h) - itilbert - Inverse Tilbert transform: sc_diff(x,h,h) - hilbert - Hilbert transform: cs_diff(x,inf,inf) - ihilbert - Inverse Hilbert transform: sc_diff(x,inf,inf) - cs_diff - cosh/sinh pseudo-derivative of periodic sequences - sc_diff - sinh/cosh pseudo-derivative of periodic sequences - ss_diff - sinh/sinh pseudo-derivative of periodic sequences - cc_diff - cosh/cosh pseudo-derivative of periodic sequences - shift - Shift periodic sequences - -""" # # fftpack - Discrete Fourier Transform algorithms. # Modified: trunk/scipy/fftpack/info.py =================================================================== --- trunk/scipy/fftpack/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/fftpack/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,45 +1,57 @@ # This file is executed by __init__.py and ppimport hooks. """ -Discrete Fourier Transform algorithms -===================================== +Discrete Fourier transform algorithms -Fast Fourier Transforms: +Modules +======= - fft --- FFT of arbitrary type periodic sequences - ifft --- Inverse of fft - fftn --- Multi-dimensional FFT - ifftn --- Inverse of fftn - fft2 --- Two-dimensional FFT - ifft2 --- Inverse of fft2 - rfft --- FFT of real periodic sequences - irfft --- Inverse of rfft +.. autosummary:: + :toctree: generated/ -Differential and pseudo-differential operators: + basic - Basic discrete Fourier transform operators + convolve - Convolution functions + helper - TODO + pseudo_diffs - Differential and pseudo-differential operators + realtransforms - Real spectrum tranforms (DCT, DST, MDCT) - diff --- Differentiation and integration of periodic sequences - tilbert --- Tilbert transform: cs_diff(x,h,h) - itilbert --- Inverse Tilbert transform: sc_diff(x,h,h) - hilbert --- Hilbert transform: cs_diff(x,inf,inf) - ihilbert --- Inverse Hilbert transform: sc_diff(x,inf,inf) - cs_diff --- cosh/sinh pseudo-derivative of periodic sequences - sc_diff --- sinh/cosh pseudo-derivative of periodic sequences - ss_diff --- sinh/sinh pseudo-derivative of periodic sequences - cc_diff --- cosh/cosh pseudo-derivative of periodic sequences - shift --- Shift periodic sequences +Functions +========= -Helper functions: +Fast Fourier Transforms (FFTs) +------------------------------ - fftshift --- Shift zero-frequency component to center of spectrum - ifftshift --- Inverse of freqshift - dftfreq --- DFT sample frequencies - rfftfreq --- DFT sample frequencies (specific to rfft,irfft) +.. autosummary:: + :toctree: generated/ -Extension modules: + fft - Fast (discrete) Fourier Transform (FFT) + ifft - Inverse FFT + fft2 - Two dimensional FFT + ifft2 - Two dimensional inverse FFT + fftn - n-dimensional FFT + ifftn - n-dimensional inverse FFT + rfft - FFT of strictly real-valued sequence + irfft - Inverse of rfft + rfftfreq - DFT sample frequencies (specific to rfft and irfft) + dct - Discrete cosine transform + idct - Inverse discrete cosine transform - _fftpack --- Provides functions zfft, drfft, zrfft, zfftnd, - destroy_*_cache - convolve --- Provides functions convolve, convolve_z, - init_convolution_kernel, destroy_convolve_cache +Differential and pseudo-differential operators +---------------------------------------------- + +.. autosummary:: + :toctree: generated/ + + diff - Differentiation and integration of periodic sequences + tilbert - Tilbert transform: cs_diff(x,h,h) + itilbert - Inverse Tilbert transform: sc_diff(x,h,h) + hilbert - Hilbert transform: cs_diff(x,inf,inf) + ihilbert - Inverse Hilbert transform: sc_diff(x,inf,inf) + cs_diff - cosh/sinh pseudo-derivative of periodic sequences + sc_diff - sinh/cosh pseudo-derivative of periodic sequences + ss_diff - sinh/sinh pseudo-derivative of periodic sequences + cc_diff - cosh/cosh pseudo-derivative of periodic sequences + shift - Shift periodic sequences + """ __all__ = ['fft','ifft','fftn','ifftn','rfft','irfft', Modified: trunk/scipy/interpolate/__init__.py =================================================================== --- trunk/scipy/interpolate/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/interpolate/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,133 +1,3 @@ -""" -Sub-package for objects used in interpolation. - -As listed below, this sub-package contains spline functions and classes, -one-dimensional and multi-dimensional (univariate and multivariate) -interpolation classes, Lagrange and Taylor polynomial interpolators, and -wrappers for `FITPACK `_ -and DFITPACK functions. - -Spline Functions ----------------- - -.. autosummary:: - :toctree: generated/ - - bisplev - bisplrep - insert - spalde - splev - spleval - splint - spline - splmake - splprep - splrep - spltopp - sproot - -Spline Classes --------------- - -.. autosummary:: - :toctree: generated/ - - UnivariateSpline - InterpolatedUnivariateSpline - LSQUnivariateSpline - BivariateSpline - SmoothBivariateSpline - -Interpolation Classes (univariate) ----------------------------------- - -.. autosummary:: - :toctree: generated/ - - interp1d - BarycentricInterpolator - barycentric_interpolate - KroghInterpolator - krogh_interpolate - PiecewisePolynomial - piecewise_polynomial_interpolate - ppform - -Interpolation Classes (multivariate) ------------------------------------- - -.. autosummary:: - :toctree: generated/ - - interp2d - Rbf - -Additional tools ----------------- - -.. autosummary:: - :toctree: generated/ - - lagrange - approximate_taylor_polynomial - -Wrappers around FITPACK functions ---------------------------------- - -.. autosummary:: - :toctree: generated/ - - fitpack.bisplev - fitpack.bisplrep - fitpack.insert - fitpack.spalde - fitpack.splev - fitpack.splint - fitpack.splprep - fitpack.splrep - fitpack.sproot - -Wrappers around DFITPACK functions ----------------------------------- - - `dfitpack.bispeu` - `dfitpack.bispev` - `dfitpack.curfit` - `dfitpack.dblint` - `dfitpack.fpcurf0` - `dfitpack.fpcurf1` - `dfitpack.fpcurfm1` - `dfitpack.parcur` - `dfitpack.percur` - `dfitpack.regrid_smth` - `dfitpack.spalde` - `dfitpack.splder` - `dfitpack.splev` - `dfitpack.splint` - `dfitpack.sproot` - `dfitpack.surfit_lsq` - `dfitpack.surfit_smth` - -See Also --------- - -.. autosummary:: - :toctree: generated/ - - ndimage.map_coordinates - ndimage.spline_filter - signal.resample - signal.bspline - signal.gauss_spline - signal.qspline1d - signal.cspline1d - signal.qspline1d_eval - signal.cspline1d_eval - signal.qspline2d - signal.cspline2d - -""" # # interpolate - Interpolation Tools # Modified: trunk/scipy/interpolate/info.py =================================================================== --- trunk/scipy/interpolate/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/interpolate/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,146 +1,132 @@ """ -Interpolation Tools -=================== +Sub-package for objects used in interpolation. -Wrappers around FITPACK functions ----------------------------------- +As listed below, this sub-package contains spline functions and classes, +one-dimensional and multi-dimensional (univariate and multivariate) +interpolation classes, Lagrange and Taylor polynomial interpolators, and +wrappers for `FITPACK `_ +and DFITPACK functions. - splrep - find smoothing spline given (x,y) points on curve. - splprep - find smoothing spline given parametrically defined curve. - splev - evaluate the spline or its derivatives. - splint - compute definite integral of a spline. - sproot - find the roots of a cubic spline. - spalde - compute all derivatives of a spline at given points. - bisplrep - find bivariate smoothing spline representation. - bisplev - evaluate bivariate smoothing spline. +Spline Functions +---------------- - UnivariateSpline - A more recent, object-oriented wrapper; finds a (possibly - smoothed) interpolating spline. +.. autosummary:: + :toctree: generated/ - InterpolatedUnivariateSpline + bisplev + bisplrep + insert + spalde + splev + spleval + splint + spline + splmake + splprep + splrep + spltopp + sproot - LSQUnivariateSpline +Spline Classes +-------------- - BivariateSpline - A more recent, object-oriented wrapper; finds a - interpolating spline for a bivariate function. +.. autosummary:: + :toctree: generated/ - SmoothBivariateSpline + UnivariateSpline + InterpolatedUnivariateSpline + LSQUnivariateSpline + BivariateSpline + SmoothBivariateSpline -Low-level Piece-wise Spline Tools ------------------------------------ - splmake - Create a spline representation from data-points - where the internal knots are the data-points. - - spleval - Evaluate a spline representation on a new set of - input data values. - - spline - Single-call interface to splmake and spleval - - spltopp - Return piecewise polynomial representation from a - spline representation. - - - Interpolation Classes (univariate) ------------------------------------ +---------------------------------- - interp1d - Create a class whose instances can linearly interpolate - to compute unknown values of a univariate function. +.. autosummary:: + :toctree: generated/ - BarycentricInterpolator - Compute with a numerically-stable version - of the Lagrange interpolating polynomial. + interp1d + BarycentricInterpolator + barycentric_interpolate + KroghInterpolator + krogh_interpolate + PiecewisePolynomial + piecewise_polynomial_interpolate + ppform - barycentric_interpolate - procedural interface to the above +Interpolation Classes (multivariate) +------------------------------------ - KroghInterpolator - Compute with the Hermite interpolating polynomial - (allows the specification of derivatives at some points). +.. autosummary:: + :toctree: generated/ - krogh_interpolate - procedural interface to the above + interp2d + Rbf - PiecewisePolynomial - Spline that is specified by giving positions and - derivatives at every knot; allows high orders and - efficient appending. +Additional tools +---------------- - piecewise_polynomial_interpolate - procedural interface to the above +.. autosummary:: + :toctree: generated/ - ppform - Class to create a piecewise polynomial representation of - a spline from the coefficients of the polynomial in each - section and the break-points + lagrange + approximate_taylor_polynomial -Interpolation Classes (multivariate) -------------------------------------- +Wrappers around FITPACK functions +--------------------------------- - interp2d - Create a class whose instances can interpolate - to compute unknown values of a bivariate function. +.. autosummary:: + :toctree: generated/ - Rbf - Apply Radial Basis Functions to interpolate scattered N-D data. + fitpack.bisplev + fitpack.bisplrep + fitpack.insert + fitpack.spalde + fitpack.splev + fitpack.splint + fitpack.splprep + fitpack.splrep + fitpack.sproot -Additional tools ------------------ +Wrappers around DFITPACK functions +---------------------------------- - lagrange - Compute the Lagrange interpolating polynomial. + `dfitpack.bispeu` + `dfitpack.bispev` + `dfitpack.curfit` + `dfitpack.dblint` + `dfitpack.fpcurf0` + `dfitpack.fpcurf1` + `dfitpack.fpcurfm1` + `dfitpack.parcur` + `dfitpack.percur` + `dfitpack.regrid_smth` + `dfitpack.spalde` + `dfitpack.splder` + `dfitpack.splev` + `dfitpack.splint` + `dfitpack.sproot` + `dfitpack.surfit_lsq` + `dfitpack.surfit_smth` - approximate_taylor_polynomial - compute an approximate Taylor polynomial for - a function using polynomial interpolation - - See Also ------------- +-------- - ndimage - map_coordinates - N-d interpolation from evenly-spaced data using - fast B-splines. +.. autosummary:: + :toctree: generated/ - spline_filter - Method to pre-compute spline coefficients to make - map_coordinates efficient for muliple calls on the same - set of interpolated points. + ndimage.map_coordinates + ndimage.spline_filter + signal.resample + signal.bspline + signal.gauss_spline + signal.qspline1d + signal.cspline1d + signal.qspline1d_eval + signal.cspline1d_eval + signal.qspline2d + signal.cspline2d - signal - resample - - Perform sinc-interpolation using a Fourier filter. - This function can decimate or interpolate to an evenly - sampled grid. - - bspline - gauss_spline - qspline1d - cspline1d - qspline1d_eval - cspline1d_eval - qspline2d - cspline2d - Low-level spline tools for regularly spaced data using - fast B-spline algorithms. - """ postpone_import = 1 Modified: trunk/scipy/io/__init__.py =================================================================== --- trunk/scipy/io/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/io/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,47 +1,3 @@ -""" -Data input and output - -SciPy has many modules, classes, and functions available to read data -from and write data to a variety of file formats. - -Modules -------- - -.. autosummary:: - :toctree: generated/ - - arff - Read ARFF files, the standard data format for WEKA - byteordercodes - System byteorder utilities - NumPy byteorder encoding - data_store - Load or save values to a file - dumbdbm_patched - A dumb and slow but simple dbm clone - matlab - Utilities for dealing with MATLAB(R) files - mmio - Matrix Market I/O in Python - netcdf - NetCDF reader/writer module - wavfile - module to read / write wav files using numpy arrays - -Classes -------- - -.. autosummary:: - :toctree: generated/ - - netcdf_file - A file object for NetCDF data - netcdf_variable - A data object for the netcdf module - -Functions ---------- - -.. autosummary:: - :toctree: generated/ - - loadmat - Read a MATLAB style mat file (version 4 through 7.1) - savemat - Write a MATLAB style mat file (version 4 through 7.1) - mminfo - Query matrix info from Matrix Market formatted file - mmread - Read matrix from Matrix Market formatted file - mmwrite - Write matrix to Matrix Market formatted file - save_as_module - Data saved as module, accessed on load as attirbutes - -""" # # io - Data input and output # Modified: trunk/scipy/io/info.py =================================================================== --- trunk/scipy/io/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/io/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -2,19 +2,45 @@ Data input and output ===================== - Functions +SciPy has many modules, classes, and functions available to read data +from and write data to a variety of file formats. - loadmat -- read a MATLAB style mat file (version 4 through 7.1) - savemat -- write a MATLAB (version through 7.1) style mat file - netcdf_file -- read NetCDF files (version of ``pupynere`` package) - save_as_module -- simple storing of Python dictionary into module - that can then be imported and the data accessed as - attributes of the module. - mminfo -- query matrix info from Matrix Market formatted file - mmread -- read matrix from Matrix Market formatted file - mmwrite -- write matrix to Matrix Market formatted file - wavfile -- module to read / write wav files using numpy arrays - arrf -- read files in Arff format +Modules +------- +.. autosummary:: + :toctree: generated/ + + arff - Read ARFF files, the standard data format for WEKA + byteordercodes - System byteorder utilities - NumPy byteorder encoding + data_store - Load or save values to a file + dumbdbm_patched - A dumb and slow but simple dbm clone + matlab - Utilities for dealing with MATLAB(R) files + mmio - Matrix Market I/O in Python + netcdf - NetCDF reader/writer module + wavfile - module to read / write wav files using numpy arrays + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + netcdf_file - A file object for NetCDF data + netcdf_variable - A data object for the netcdf module + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + loadmat - Read a MATLAB style mat file (version 4 through 7.1) + savemat - Write a MATLAB style mat file (version 4 through 7.1) + mminfo - Query matrix info from Matrix Market formatted file + mmread - Read matrix from Matrix Market formatted file + mmwrite - Write matrix to Matrix Market formatted file + save_as_module - Data saved as module, accessed on load as attirbutes + """ postpone_import = 1 Modified: trunk/scipy/linalg/__init__.py =================================================================== --- trunk/scipy/linalg/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/linalg/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,98 +1,3 @@ -""" -Linear Algebra -============== - -Basics ------- - -.. autosummary:: - :toctree: generated/ - - inv - Find the inverse of a square matrix - solve - Solve a linear system of equations - solve_banded - Solve a banded linear system - solveh_banded - Solve a Hermitian or symmetric banded system - det - Find the determinant of a square matrix - norm - Matrix and vector norm - lstsq - Solve a linear least-squares problem - pinv - Pseudo-inverse (Moore-Penrose) using lstsq - pinv2 - Pseudo-inverse using svd - -Eigenvalue Problems -------------------- - -.. autosummary:: - :toctree: generated/ - - eig - Find the eigenvalues and eigenvectors of a square matrix - eigvals - Find just the eigenvalues of a square matrix - eigh - Find the e-vals and e-vectors of a Hermitian or symmetric matrix - eigvalsh - Find just the eigenvalues of a Hermitian or symmetric matrix - eig_banded - Find the eigenvalues and eigenvectors of a banded matrix - eigvals_banded - Find just the eigenvalues of a banded matrix - -Decompositions --------------- - -.. autosummary:: - :toctree: generated/ - - lu - LU decomposition of a matrix - lu_factor - LU decomposition returning unordered matrix and pivots - lu_solve - Solve Ax=b using back substitution with output of lu_factor - svd - Singular value decomposition of a matrix - svdvals - Singular values of a matrix - diagsvd - Construct matrix of singular values from output of svd - orth - Construct orthonormal basis for the range of A using svd - cholesky - Cholesky decomposition of a matrix - cholesky_banded - Cholesky decomp. of a sym. or Hermitian banded matrix - cho_factor - Cholesky decomposition for use in solving a linear system - cho_solve - Solve previously factored linear system - cho_solve_banded - Solve previously factored banded linear system - qr - QR decomposition of a matrix - schur - Schur decomposition of a matrix - rsf2csf - Real to complex Schur form - hessenberg - Hessenberg form of a matrix - -Matrix Functions ----------------- - -.. autosummary:: - :toctree: generated/ - - expm - Matrix exponential using Pade approximation - expm2 - Matrix exponential using eigenvalue decomposition - expm3 - Matrix exponential using Taylor-series expansion - logm - Matrix logarithm - cosm - Matrix cosine - sinm - Matrix sine - tanm - Matrix tangent - coshm - Matrix hyperbolic cosine - sinhm - Matrix hyperbolic sine - tanhm - Matrix hyperbolic tangent - signm - Matrix sign - sqrtm - Matrix square root - funm - Evaluating an arbitrary matrix function - -Special Matrices ----------------- - -.. autosummary:: - :toctree: generated/ - - block_diag - Construct a block diagonal matrix from submatrices - circulant - Circulant matrix - companion - Companion matrix - hadamard - Hadamard matrix of order 2**n - hankel - Hankel matrix - kron - Kronecker product of two arrays - leslie - Leslie matrix - toeplitz - Toeplitz matrix - tri - Construct a matrix filled with ones at and below a given diagonal - tril - Construct a lower-triangular matrix from a given matrix - triu - Construct an upper-triangular matrix from a given matrix - -""" # # linalg - Dense Linear Algebra routines # Modified: trunk/scipy/linalg/info.py =================================================================== --- trunk/scipy/linalg/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/linalg/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -2,133 +2,96 @@ Linear Algebra ============== -Linear Algebra Basics: +Basics +------ - inv: - Find the inverse of a square matrix - solve: - Solve a linear system of equations - solve_banded: - Solve a linear system of equations with a banded matrix - solveh_banded: - Solve a linear system of equations with a Hermitian or symmetric - banded matrix - det: - Find the determinant of a square matrix - norm: - matrix and vector norm - lstsq: - Solve linear least-squares problem - pinv: - Pseudo-inverse (Moore-Penrose) using lstsq - pinv2: - Pseudo-inverse using svd +.. autosummary:: + :toctree: generated/ -Eigenvalue Problem: + inv - Find the inverse of a square matrix + solve - Solve a linear system of equations + solve_banded - Solve a banded linear system + solveh_banded - Solve a Hermitian or symmetric banded system + det - Find the determinant of a square matrix + norm - Matrix and vector norm + lstsq - Solve a linear least-squares problem + pinv - Pseudo-inverse (Moore-Penrose) using lstsq + pinv2 - Pseudo-inverse using svd - eig: - Find the eigenvalues and vectors of a square matrix - eigvals: - Find the eigenvalues of a square matrix - eigh: - Find the eigenvalues and eigenvectors of a complex Hermitian or - real symmetric matrix. - eigvalsh: - Find the eigenvalues of a complex Hermitian or real symmetric - matrix. - eig_banded: - Find the eigenvalues and vectors of a band matrix - eigvals_banded: - Find the eigenvalues of a band matrix +Eigenvalue Problems +------------------- -Decompositions: +.. autosummary:: + :toctree: generated/ - lu: - LU decomposition of a matrix - lu_factor: - LU decomposition returning unordered matrix and pivots - lu_solve: - solve Ax=b using back substitution with output of lu_factor - svd: - Singular value decomposition of a matrix - svdvals: - Singular values of a matrix - diagsvd: - construct matrix of singular values from output of svd - orth: - construct orthonormal basis for range of A using svd - cholesky: - Cholesky decomposition of a matrix - cholesky_banded: - Cholesky decomposition of a banded symmetric or Hermitian matrix - cho_factor: - Cholesky decomposition for use in solving linear system - cho_solve: - Solve previously factored linear system - cho_solve_banded: - Solve previously factored banded linear system. - qr: - QR decomposition of a matrix - schur: - Schur decomposition of a matrix - rsf2csf: - Real to complex schur form - hessenberg: - Hessenberg form of a matrix + eig - Find the eigenvalues and eigenvectors of a square matrix + eigvals - Find just the eigenvalues of a square matrix + eigh - Find the e-vals and e-vectors of a Hermitian or symmetric matrix + eigvalsh - Find just the eigenvalues of a Hermitian or symmetric matrix + eig_banded - Find the eigenvalues and eigenvectors of a banded matrix + eigvals_banded - Find just the eigenvalues of a banded matrix -Matrix Functions: +Decompositions +-------------- - expm: - matrix exponential using Pade approx. - expm2: - matrix exponential using Eigenvalue decomp. - expm3: - matrix exponential using Taylor-series expansion - logm: - matrix logarithm - cosm: - matrix cosine - sinm: - matrix sine - tanm: - matrix tangent - coshm: - matrix hyperbolic cosine - sinhm: - matrix hyperbolic sine - tanhm: - matrix hyperbolic tangent - signm: - matrix sign - sqrtm: - matrix square root - funm: - Evaluating an arbitrary matrix function. +.. autosummary:: + :toctree: generated/ -Special Matrices: + lu - LU decomposition of a matrix + lu_factor - LU decomposition returning unordered matrix and pivots + lu_solve - Solve Ax=b using back substitution with output of lu_factor + svd - Singular value decomposition of a matrix + svdvals - Singular values of a matrix + diagsvd - Construct matrix of singular values from output of svd + orth - Construct orthonormal basis for the range of A using svd + cholesky - Cholesky decomposition of a matrix + cholesky_banded - Cholesky decomp. of a sym. or Hermitian banded matrix + cho_factor - Cholesky decomposition for use in solving a linear system + cho_solve - Solve previously factored linear system + cho_solve_banded - Solve previously factored banded linear system + qr - QR decomposition of a matrix + schur - Schur decomposition of a matrix + rsf2csf - Real to complex Schur form + hessenberg - Hessenberg form of a matrix - block_diag: - Construct a block diagonal matrix from submatrices. - circulant: - Circulant matrix - companion: - Companion matrix - hadamard: - Hadamard matrix of order 2^n - hankel: - Hankel matrix - kron: - Kronecker product of two arrays. - leslie: - Leslie matrix - toeplitz: - Toeplitz matrix - tri: - Construct a matrix filled with ones at and below a given diagonal. - tril: - Construct a lower-triangular matrix from a given matrix. - triu: - Construct an upper-triangular matrix from a given matrix. +Matrix Functions +---------------- + +.. autosummary:: + :toctree: generated/ + + expm - Matrix exponential using Pade approximation + expm2 - Matrix exponential using eigenvalue decomposition + expm3 - Matrix exponential using Taylor-series expansion + logm - Matrix logarithm + cosm - Matrix cosine + sinm - Matrix sine + tanm - Matrix tangent + coshm - Matrix hyperbolic cosine + sinhm - Matrix hyperbolic sine + tanhm - Matrix hyperbolic tangent + signm - Matrix sign + sqrtm - Matrix square root + funm - Evaluating an arbitrary matrix function + +Special Matrices +---------------- + +.. autosummary:: + :toctree: generated/ + + block_diag - Construct a block diagonal matrix from submatrices + circulant - Circulant matrix + companion - Companion matrix + hadamard - Hadamard matrix of order 2**n + hankel - Hankel matrix + kron - Kronecker product of two arrays + leslie - Leslie matrix + toeplitz - Toeplitz matrix + tri - Construct a matrix filled with ones at and below a given diagonal + tril - Construct a lower-triangular matrix from a given matrix + triu - Construct an upper-triangular matrix from a given matrix + """ postpone_import = 1 Modified: trunk/scipy/maxentropy/__init__.py =================================================================== --- trunk/scipy/maxentropy/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/maxentropy/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,91 +1,3 @@ -""" -Routines for fitting maximum entropy models -=========================================== - -Contains two classes for fitting maximum entropy models (also known -as "exponential family" models) subject to linear constraints on the -expectations of arbitrary feature statistics. One class, "model", is -for small discrete sample spaces, using explicit summation. The other, -"bigmodel", is for sample spaces that are either continuous (and -perhaps high-dimensional) or discrete but too large to sum over, and -uses importance sampling. conditional Monte Carlo methods. - -The maximum entropy model has exponential form - -.. - p(x) = exp(theta^T f(x)) / Z(theta) - -.. math:: - p\\left(x\\right)=\\exp\\left(\\frac{\\theta^{T}f\\left(x\\right)} - {Z\\left(\\theta\\right)}\\right) - -with a real parameter vector theta of the same length as the feature -statistic f(x), For more background, see, for example, Cover and -Thomas (1991), *Elements of Information Theory*. - -See the file bergerexample.py for a walk-through of how to use these -routines when the sample space is small enough to be enumerated. - -See bergerexamplesimulated.py for a a similar walk-through using -simulation. - -Copyright: Ed Schofield, 2003-2006 -License: BSD-style (see LICENSE.txt in main source directory) - -Modules -------- - -.. autosummary:: - :toctree: generated/ - - maxentropy - - maxentutils - - -Classes -------- - -.. autosummary:: - :toctree: generated/ - - DivergenceError - - basemodel - - bigmodel - - conditionalmodel - - model - - -Functions ---------- - -.. autosummary:: - :toctree: generated/ - - arrayexp - - arrayexpcomplex - - columnmeans - - columnvariances - - densefeaturematrix - - densefeatures - - dotprod - - flatten - - innerprod - - innerprodtranspose - - logsumexp - - logsumexp_naive - - robustlog - - rowmeans - - sample_wr - - sparsefeaturematrix - - sparsefeatures - - -Objects -------- - -.. autosummary:: - :toctree: generated/ - - division - - -""" from info import __doc__ from maxentropy import * Modified: trunk/scipy/maxentropy/info.py =================================================================== --- trunk/scipy/maxentropy/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/maxentropy/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -2,13 +2,13 @@ Routines for fitting maximum entropy models =========================================== -Contains two classes for fitting maximum entropy models (also known as -"exponential family" models) subject to linear constraints on the expectations -of arbitrary feature statistics. One class, "model", is for small discrete sample -spaces, using explicit summation. The other, "bigmodel", is for sample spaces -that are either continuous (and perhaps high-dimensional) or discrete but too -large to sum over, and uses importance sampling. conditional Monte Carlo -methods. +Contains two classes for fitting maximum entropy models (also known +as "exponential family" models) subject to linear constraints on the +expectations of arbitrary feature statistics. One class, "model", is +for small discrete sample spaces, using explicit summation. The other, +"bigmodel", is for sample spaces that are either continuous (and +perhaps high-dimensional) or discrete but too large to sum over, and +uses importance sampling. conditional Monte Carlo methods. The maximum entropy model has exponential form @@ -16,9 +16,8 @@ p(x) = exp(theta^T f(x)) / Z(theta) .. math:: - \\renewcommand{\\v}[1]{\\mathbf{#1}} - p( \\v{x} ) = \\exp \\left( {\\v{\\theta}^\\mathsf{T} \\vec{f}( \\v{x} ) - \\over Z(\\v{\\theta}) } \\right) + p\\left(x\\right)=\\exp\\left(\\frac{\\theta^{T}f\\left(x\\right)} + {Z\\left(\\theta\\right)}\\right) with a real parameter vector theta of the same length as the feature statistic f(x), For more background, see, for example, Cover and @@ -33,6 +32,59 @@ Copyright: Ed Schofield, 2003-2006 License: BSD-style (see LICENSE.txt in main source directory) +Modules +------- + +.. autosummary:: + :toctree: generated/ + + maxentropy - + maxentutils - + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + DivergenceError - + basemodel - + bigmodel - + conditionalmodel - + model - + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + arrayexp - + arrayexpcomplex - + columnmeans - + columnvariances - + densefeaturematrix - + densefeatures - + dotprod - + flatten - + innerprod - + innerprodtranspose - + logsumexp - + logsumexp_naive - + robustlog - + rowmeans - + sample_wr - + sparsefeaturematrix - + sparsefeatures - + +Objects +------- + +.. autosummary:: + :toctree: generated/ + + division - + """ postpone_import = 1 Modified: trunk/scipy/misc/__init__.py =================================================================== --- trunk/scipy/misc/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/misc/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,51 +1,3 @@ -""" -Various utilities that don't have another home. - -Note that the Python Imaging Library (PIL) is not a dependency -of SciPy and therefore the `pilutil` module is not available on -systems that don't have PIL installed. - -Modules -------- -.. autosummary:: - :toctree: generated/ - - common - Common functions requiring SciPy Base and Level 1 SciPy - doccer - Docstring fragment insertion utilities - helpmod - - pexec - - pilutil - Image utilities using the Python Imaging Library (PIL) - ppimport - Postpone module import to future - setup - - setupscons - - -Functions ---------- -.. autosummary:: - :toctree: generated/ - - bytescale - Byte scales an array (image) - central_diff_weights - Weights for an n-point central m-th derivative - comb - Combinations of N things taken k at a time, "N choose k" - derivative -\tFind the n-th derivative of a function at a point - factorial - The factorial function, n! = special.gamma(n+1) - factorial2 - Double factorial, (n!)! - factorialk - (...((n!)!)!...)! where there are k '!' - fromimage - Return a copy of a PIL image as a numpy array - imfilter - Simple filtering of an image - imread - Read an image file from a filename - imresize - Resize an image - imrotate - Rotate an image counter-clockwise - imsave - Save an array to an image file - imshow - Simple showing of an image through an external viewer - info - Get help information for a function, class, or module - lena - Get classic image processing example image Lena - pade - Pade approximation to function as the ratio of two polynomials - radon - - toimage - Takes a numpy array and returns a PIL image - -""" - from info import __doc__ __all__ = ['who', 'source', 'info'] Modified: trunk/scipy/misc/info.py =================================================================== --- trunk/scipy/misc/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/misc/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,6 +1,49 @@ - """ Various utilities that don't have another home. + +Note that the Python Imaging Library (PIL) is not a dependency +of SciPy and therefore the `pilutil` module is not available on +systems that don't have PIL installed. + +Modules +------- +.. autosummary:: + :toctree: generated/ + + common - Common functions requiring SciPy Base and Level 1 SciPy + doccer - Docstring fragment insertion utilities + helpmod - + pexec - + pilutil - Image utilities using the Python Imaging Library (PIL) + ppimport - Postpone module import to future + setup - + setupscons - + +Functions +--------- +.. autosummary:: + :toctree: generated/ + + bytescale - Byte scales an array (image) + central_diff_weights - Weights for an n-point central m-th derivative + comb - Combinations of N things taken k at a time, "N choose k" + derivative -\tFind the n-th derivative of a function at a point + factorial - The factorial function, n! = special.gamma(n+1) + factorial2 - Double factorial, (n!)! + factorialk - (...((n!)!)!...)! where there are k '!' + fromimage - Return a copy of a PIL image as a numpy array + imfilter - Simple filtering of an image + imread - Read an image file from a filename + imresize - Resize an image + imrotate - Rotate an image counter-clockwise + imsave - Save an array to an image file + imshow - Simple showing of an image through an external viewer + info - Get help information for a function, class, or module + lena - Get classic image processing example image Lena + pade - Pade approximation to function as the ratio of two polynomials + radon - + toimage - Takes a numpy array and returns a PIL image + """ global_symbols = ['info','factorial','factorial2','factorialk','comb','who', Modified: trunk/scipy/ndimage/__init__.py =================================================================== --- trunk/scipy/ndimage/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/ndimage/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,70 +1,3 @@ -""" -N-dimensional image package -=========================== - -This package contains various functions for multi-dimensional image -processing. - -Modules -------- - -.. autosummary:: - :toctree: generated/ - - filters - - fourier - - interpolation - - io - - measurements - - morphology - - -Functions (partial list) ------------------------- - -.. autosummary:: - :toctree: generated/ - - affine_transform - Apply an affine transformation - center_of_mass - The center of mass of the values of an array at labels - convolve - Multi-dimensional convolution - convolve1d - 1-D convolution along the given axis - correlate - Multi-dimensional correlation - correlate1d - 1-D correlation along the given axis - extrema - Min's and max's of an array at labels, with their positions - find_objects - Find objects in a labeled array - generic_filter - Multi-dimensional filter using a given function - generic_filter1d - 1-D generic filter along the given axis - geometric_transform - Apply an arbritrary geometric transform - histogram - Histogram of the values of an array, optionally at labels - imread - Load an image from a file - label - Label features in an array - laplace - n-D Laplace filter based on approximate second derivatives - map_coordinates - Map input array to new coordinates by interpolation - mean - Mean of the values of an array at labels - median_filter - Calculates a multi-dimensional median filter - percentile_filter - Calculates a multi-dimensional percentile filter - rank_filter - Calculates a multi-dimensional rank filter - rotate - Rotate an array - shift - Shift an array - standard_deviation - Standard deviation of an n-D image array - sum - Sum of the values of the array - uniform_filter - Multi-dimensional uniform filter - uniform_filter1d - 1-D uniform filter along the given axis - variance - Variance of the values of an n-D image array - zoom - Zoom an array - -Note: the above is only roughly half the functions available in this -package - -Objects -------- - -.. autosummary:: - :toctree: generated/ - - docdict - - -""" # Copyright (C) 2003-2005 Peter J. Verveer # # Redistribution and use in source and binary forms, with or without Modified: trunk/scipy/ndimage/info.py =================================================================== --- trunk/scipy/ndimage/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/ndimage/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,8 +1,69 @@ -__doc__ = """ -n-dimensional image package +""" +N-dimensional image package =========================== -This package contains various functions for multi-dimensional image processing. +This package contains various functions for multi-dimensional image +processing. + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + filters - + fourier - + interpolation - + io - + measurements - + morphology - + +Functions (partial list) +------------------------ + +.. autosummary:: + :toctree: generated/ + + affine_transform - Apply an affine transformation + center_of_mass - The center of mass of the values of an array at labels + convolve - Multi-dimensional convolution + convolve1d - 1-D convolution along the given axis + correlate - Multi-dimensional correlation + correlate1d - 1-D correlation along the given axis + extrema - Min's and max's of an array at labels, with their positions + find_objects - Find objects in a labeled array + generic_filter - Multi-dimensional filter using a given function + generic_filter1d - 1-D generic filter along the given axis + geometric_transform - Apply an arbritrary geometric transform + histogram - Histogram of the values of an array, optionally at labels + imread - Load an image from a file + label - Label features in an array + laplace - n-D Laplace filter based on approximate second derivatives + map_coordinates - Map input array to new coordinates by interpolation + mean - Mean of the values of an array at labels + median_filter - Calculates a multi-dimensional median filter + percentile_filter - Calculates a multi-dimensional percentile filter + rank_filter - Calculates a multi-dimensional rank filter + rotate - Rotate an array + shift - Shift an array + standard_deviation - Standard deviation of an n-D image array + sum - Sum of the values of the array + uniform_filter - Multi-dimensional uniform filter + uniform_filter1d - 1-D uniform filter along the given axis + variance - Variance of the values of an n-D image array + zoom - Zoom an array + +Note: the above is only roughly half the functions available in this +package + +Objects +------- + +.. autosummary:: + :toctree: generated/ + + docdict - + """ postpone_import = 1 Modified: trunk/scipy/odr/__init__.py =================================================================== --- trunk/scipy/odr/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/odr/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,90 +1,3 @@ -""" -Orthogonal Distance Regression (:mod:`scipy.odr`) -================================================= - -Introduction ------------- - -Why Orthogonal Distance Regression (ODR)? Sometimes one has -measurement errors in the explanatory (a.k.a., "independent") -variable(s), not just the response (a.k.a., "dependent") variable(s). -Ordinary Least Squares (OLS) fitting procedures treat the data for -explanatory variables as fixed, i.e., not subject to error of any kind. -Furthermore, OLS procedures require that the response variables be an -explicit function of the explanatory variables; sometimes making the -equation explicit is impractical and/or introduces errors. ODR can -handle both of these cases with ease, and can even reduce to the OLS -case if that is sufficient for the problem. - -ODRPACK is a FORTRAN-77 library for performing ODR with possibly -non-linear fitting functions. It uses a modified trust-region -Levenberg-Marquardt-type algorithm [1]_ to estimate the function -parameters. The fitting functions are provided by Python functions -operating on NumPy arrays. The required derivatives may be provided -by Python functions as well, or may be estimated numerically. ODRPACK -can do explicit or implicit ODR fits, or it can do OLS. Input and -output variables may be multi-dimensional. Weights can be provided to -account for different variances of the observations, and even -covariances between dimensions of the variables. - -odr provides two interfaces: a single function, and a set of -high-level classes that wrap that function; please refer to their -docstrings for more information. While the docstring of the function -odr does not have a full explanation of its arguments, the classes do, -and arguments of the same name usually have the same requirements. -Furthermore, the user is urged to at least skim the `ODRPACK User's -Guide `_ - -"Know Thy Algorithm." - -Use ---- - -See the docstrings of `odr.odrpack` and the functions and classes for -usage instructions. The ODRPACK User's Guide (linked above) is also -quite helpful. - -References ----------- -.. [1] P. T. Boggs and J. E. Rogers, "Orthogonal Distance Regression," - in "Statistical analysis of measurement error models and - applications: proceedings of the AMS-IMS-SIAM joint summer research - conference held June 10-16, 1989," Contemporary Mathematics, - vol. 112, pg. 186, 1990. - -.. currentmodule:: scipy.odr - -Modules -------- - -.. autosummary:: - :toctree: generated/ - - odrpack Python wrappers for FORTRAN77 ODRPACK. - models Model instances for use with odrpack. - -Classes -------- - -.. autosummary:: - :toctree: generated/ - - ODR Gathers all info & manages the main fitting routine. - Data Stores the data to fit. - Model Stores information about the function to be fit. - Output - RealData Weights as actual std. dev.s and/or covariances. - odr_error - odr_stop - -Functions ---------- - -.. autosummary:: - :toctree: generated/ - - odr - -""" # # odr - Orthogonal Distance Regression # Modified: trunk/scipy/odr/info.py =================================================================== --- trunk/scipy/odr/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/odr/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,44 +1,88 @@ -"""Orthogonal Distance Regression +""" +Orthogonal Distance Regression (:mod:`scipy.odr`) +================================================= Introduction -============ +------------ -Why Orthogonal Distance Regression (ODR)? Sometimes one has measurement errors -in the explanatory variable, not just the response variable. Ordinary Least -Squares (OLS) fitting procedures treat the data for explanatory variables as -fixed. Furthermore, OLS procedures require that the response variable be an -explicit function of the explanatory variables; sometimes making the equation -explicit is unwieldy and introduces errors. ODR can handle both of these cases -with ease and can even reduce to the OLS case if necessary. +Why Orthogonal Distance Regression (ODR)? Sometimes one has +measurement errors in the explanatory (a.k.a., "independent") +variable(s), not just the response (a.k.a., "dependent") variable(s). +Ordinary Least Squares (OLS) fitting procedures treat the data for +explanatory variables as fixed, i.e., not subject to error of any kind. +Furthermore, OLS procedures require that the response variables be an +explicit function of the explanatory variables; sometimes making the +equation explicit is impractical and/or introduces errors. ODR can +handle both of these cases with ease, and can even reduce to the OLS +case if that is sufficient for the problem. -ODRPACK is a FORTRAN-77 library for performing ODR with possibly non-linear -fitting functions. It uses a modified trust-region Levenberg-Marquardt-type -algorithm to estimate the function parameters. The fitting functions are -provided by Python functions operating on NumPy arrays. The required derivatives -may be provided by Python functions as well or may be numerically estimated. -ODRPACK can do explicit or implicit ODR fits or can do OLS. Input and output -variables may be multi-dimensional. Weights can be provided to account for -different variances of the observations (even covariances between dimensions of -the variables). +ODRPACK is a FORTRAN-77 library for performing ODR with possibly +non-linear fitting functions. It uses a modified trust-region +Levenberg-Marquardt-type algorithm [1]_ to estimate the function +parameters. The fitting functions are provided by Python functions +operating on NumPy arrays. The required derivatives may be provided +by Python functions as well, or may be estimated numerically. ODRPACK +can do explicit or implicit ODR fits, or it can do OLS. Input and +output variables may be multi-dimensional. Weights can be provided to +account for different variances of the observations, and even +covariances between dimensions of the variables. -odr provides two interfaces: a single function and a set of high-level classes -that wrap that function. Please refer to their docstrings for more information. -While the docstring of the function, odr, does not have a full explanation of -its arguments, the classes do, and the arguments with the same name usually have -the same requirements. Furthermore, it is highly suggested that one at least -skim the ODRPACK User's Guide. Know Thy Algorithm. +odr provides two interfaces: a single function, and a set of +high-level classes that wrap that function; please refer to their +docstrings for more information. While the docstring of the function +odr does not have a full explanation of its arguments, the classes do, +and arguments of the same name usually have the same requirements. +Furthermore, the user is urged to at least skim the `ODRPACK User's +Guide `_ - +"Know Thy Algorithm." - Use -=== +--- -See the docstrings of odr.odrpack and the functions and classes for -usage instructions. The ODRPACK User's Guide is also quite helpful. It can be -found on one of the ODRPACK's original author's website: +See the docstrings of `odr.odrpack` and the functions and classes for +usage instructions. The ODRPACK User's Guide (linked above) is also +quite helpful. - http://www.boulder.nist.gov/mcsd/Staff/JRogers/odrpack.html +References +---------- +.. [1] P. T. Boggs and J. E. Rogers, "Orthogonal Distance Regression," + in "Statistical analysis of measurement error models and + applications: proceedings of the AMS-IMS-SIAM joint summer research + conference held June 10-16, 1989," Contemporary Mathematics, + vol. 112, pg. 186, 1990. -Robert Kern -robert.kern at gmail.com +.. currentmodule:: scipy.odr + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + odrpack Python wrappers for FORTRAN77 ODRPACK. + models Model instances for use with odrpack. + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + ODR Gathers all info & manages the main fitting routine. + Data Stores the data to fit. + Model Stores information about the function to be fit. + Output + RealData Weights as actual std. dev.s and/or covariances. + odr_error + odr_stop + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + odr + """ postpone_import = 1 Modified: trunk/scipy/optimize/__init__.py =================================================================== --- trunk/scipy/optimize/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/optimize/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,137 +1,3 @@ -""" -Optimization Tools -================== - -General-purpose Optimization Routines -------------------------------------- - -.. autosummary:: - :toctree: generated/ - - fmin - Nelder-Mead Simplex algorithm # - fmin_powell - Powell's (modified) level set method # - fmin_cg - Non-linear (Polak-Ribiere) conjugate gradient algorithm ## - fmin_bfgs - Quasi-Newton method (Broydon-Fletcher-Goldfarb-Shanno) ## - fmin_ncg - Line-search Newton Conjugate Gradient ### - leastsq - Minimize the sum of squares of M equations in N unknowns - -Constrained Optimizers (Multivariate) -------------------------------------- - -.. autosummary:: - :toctree: generated/ - - fmin_l_bfgs_b - Zhu, Byrd, and Nocedal's constrained optimizer % - fmin_tnc - Truncated Newton code %% - fmin_cobyla - Constrained optimization by linear approximation - fmin_slsqp - Minimization using sequential least-squares programming - nnls - Linear least-squares problem with non-negativity constraint - -Global Optimizers ------------------ - -.. autosummary:: - :toctree: generated/ - - anneal - Simulated annealing - brute - Brute force searching optimizer - -Scalar Function Minimizers --------------------------- - -.. autosummary:: - :toctree: generated/ - - fminbound - Bounded minimization of a scalar function - brent - 1-D function minimization using Brent method - golden - 1-D function minimization using Golden Section method - bracket - Bracket a minimum, given two starting points - -General-purpose Root-finding Routines -------------------------------------- - -.. autosummary:: - :toctree: generated/ - - fsolve - Non-linear multi-variable equation solver - -Scalar Function Solvers ------------------------ - -.. autosummary:: - :toctree: generated/ - - brentq - quadratic interpolation Brent method - brenth - Brent method, modified by Harris with hyperbolic extrapolation - ridder - Ridder's method - bisect - Bisection method - newton - Secant method or Newton's method - fixed_point - Single-variable fixed-point solver - -General-purpose Non-linear Multidimensional Solvers ---------------------------------------------------- - -.. autosummary:: - :toctree: generated/ - - broyden1 - Broyden's first method $ - broyden2 - Broyden's second method $$ - broyden3 - Broyden's third method $$$ - broyden_generalized - Generalized Broyden's method & - anderson - Extended Anderson method && - anderson2 - The Anderson method &&& - -Utility Functions ------------------ - -.. autosummary:: - :toctree: generated/ - - line_search - Return a step that satisfies the strong Wolfe conditions - check_grad - Check the supplied derivative using finite differences - -Related Software ----------------- - -OpenOpt - A BSD-licensed optimization framework (see ``_) that includes: a number of constrained and -unconstrained solvers from and beyond the scipy.optimize module; unified -text and graphical output of convergence information; and automatic -differentiation. - -Notes ------ -# Uses only function calls - -## Can use function and gradient - -### Can use function, gradient, and Hessian - -% If you use fmin_l_bfgs_b, please cite Zhu, Byrd, and Nocedal's papers; see the function's docstring for references. - -%% Originally written by Stephen Nash, adapted to C by Jean-Sebastien Roy. - -$ broyden1 is a quasi-Newton-Raphson method for updating an approximate -Jacobian and then inverting it. - -$$ broyden2 is the same as broyden1, but updates the inverse Jacobian -directly. - -$$$ broyden3 is the same as broyden2, but instead of directly computing -the inverse Jacobian, it remembers how to construct it using vectors, and -when computing inv(J)*F, it uses those vectors to compute this product, -thus avoding the expensive NxN matrix multiplication. - -& broyden_generalized is the same as broyden2, but instead of -approximating the full NxN Jacobian, it constructs it at every iteration -in a way that avoids the NxN matrix multiplication. This is not as -precise as broyden3. - -&& anderson is the same as broyden_generalized, but (w_0**2)*I is added -before taking inversion to improve the stability. - -&&& anderson2 is the same as anderson, but formulated differently. - -""" # # optimize - Optimization Tools # Modified: trunk/scipy/optimize/info.py =================================================================== --- trunk/scipy/optimize/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/optimize/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -2,101 +2,120 @@ Optimization Tools ================== -A collection of general-purpose optimization routines.:: +General-purpose Optimization Routines +------------------------------------- - fmin -- Nelder-Mead Simplex algorithm - (uses only function calls) - fmin_powell -- Powell's (modified) level set method (uses only - function calls) - fmin_cg -- Non-linear (Polak-Ribiere) conjugate gradient algorithm - (can use function and gradient). - fmin_bfgs -- Quasi-Newton method (Broydon-Fletcher-Goldfarb-Shanno); - (can use function and gradient) - fmin_ncg -- Line-search Newton Conjugate Gradient (can use - function, gradient and Hessian). - leastsq -- Minimize the sum of squares of M equations in - N unknowns given a starting estimate. +.. autosummary:: + :toctree: generated/ -Constrained Optimizers (multivariate):: + fmin - Nelder-Mead Simplex algorithm + fmin_powell - Powell's (modified) level set method + fmin_cg - Non-linear (Polak-Ribiere) conjugate gradient algorithm + fmin_bfgs - Quasi-Newton method (Broydon-Fletcher-Goldfarb-Shanno) + fmin_ncg - Line-search Newton Conjugate Gradient + leastsq - Minimize the sum of squares of M equations in N unknowns - fmin_l_bfgs_b -- Zhu, Byrd, and Nocedal's L-BFGS-B constrained optimizer - (if you use this please quote their papers -- see help) +Constrained Optimizers (Multivariate) +------------------------------------- - fmin_tnc -- Truncated Newton Code originally written by Stephen Nash and - adapted to C by Jean-Sebastien Roy. +.. autosummary:: + :toctree: generated/ - fmin_cobyla -- Constrained Optimization BY Linear Approximation + fmin_l_bfgs_b - Zhu, Byrd, and Nocedal's constrained optimizer + fmin_tnc - Truncated Newton code + fmin_cobyla - Constrained optimization by linear approximation + fmin_slsqp - Minimization using sequential least-squares programming + nnls - Linear least-squares problem with non-negativity constraint - fmin_slsqp -- Minimize a function using Sequential Least SQuares Programming +Global Optimizers +----------------- - nnls -- Solve linear least squares problem with non-negativity - constraint +.. autosummary:: + :toctree: generated/ -Global Optimizers:: + anneal - Simulated annealing + brute - Brute force searching optimizer - anneal -- Simulated Annealing - brute -- Brute force searching optimizer +Scalar Function Minimizers +-------------------------- -Scalar function minimizers:: +.. autosummary:: + :toctree: generated/ - fminbound -- Bounded minimization of a scalar function. - brent -- 1-D function minimization using Brent method. - golden -- 1-D function minimization using Golden Section method - bracket -- Bracket a minimum (given two starting points) + fminbound - Bounded minimization of a scalar function + brent - 1-D function minimization using Brent method + golden - 1-D function minimization using Golden Section method + bracket - Bracket a minimum, given two starting points -Also a collection of general-purpose root-finding routines:: +Fitting +======= - fsolve -- Non-linear multi-variable equation solver. +.. autosummary:: + :toctree: generated/ -Scalar function solvers:: + curve_fit - brentq -- quadratic interpolation Brent method - brenth -- Brent method (modified by Harris with hyperbolic - extrapolation) - ridder -- Ridder's method - bisect -- Bisection method - newton -- Secant method or Newton's method +Root finding +============ - fixed_point -- Single-variable fixed-point solver. +Scalar functions +---------------- -A collection of general-purpose nonlinear multidimensional solvers:: +.. autosummary:: + :toctree: generated/ - broyden1 -- Broyden's first method - is a quasi-Newton-Raphson - method for updating an approximate Jacobian and then - inverting it - broyden2 -- Broyden's second method - the same as broyden1, but - updates the inverse Jacobian directly - broyden3 -- Broyden's second method - the same as broyden2, but - instead of directly computing the inverse Jacobian, - it remembers how to construct it using vectors, and - when computing inv(J)*F, it uses those vectors to - compute this product, thus avoding the expensive NxN - matrix multiplication. - broyden_generalized -- Generalized Broyden's method, the same as broyden2, - but instead of approximating the full NxN Jacobian, - it construct it at every iteration in a way that - avoids the NxN matrix multiplication. This is not - as precise as broyden3. - anderson -- extended Anderson method, the same as the - broyden_generalized, but added w_0^2*I to before - taking inversion to improve the stability - anderson2 -- the Anderson method, the same as anderson, but - formulated differently + brentq - quadratic interpolation Brent method + brenth - Brent method, modified by Harris with hyperbolic extrapolation + ridder - Ridder's method + bisect - Bisection method + newton - Secant method or Newton's method -Utility Functions:: +Fixed point finding: - line_search -- Return a step that satisfies the strong Wolfe conditions. - check_grad -- Check the supplied derivative using finite difference - techniques. +.. autosummary:: + :toctree: generated/ -Related Software:: + fixed_point - Single-variable fixed-point solver - OpenOpt -- A BSD-licensed optimisation framework (see http://openopt.org), - which includes a number of constrained and unconstrained - solvers from and beyond scipy.optimize module, - unified text and graphical output of convergence - and automatic differentiation. +Multidimensional +---------------- + +General nonlinear solvers: + +.. autosummary:: + :toctree: generated/ + + fsolve - Non-linear multi-variable equation solver + broyden1 - Broyden's first method + broyden2 - Broyden's second method + +Large-scale nonlinear solvers: + +.. autosummary:: + :toctree: generated/ + + newton_krylov + anderson + +Simple iterations: + +.. autosummary:: + :toctree: generated/ + + excitingmixing + linearmixing + diagbroyden + +Utility Functions +================= + +.. autosummary:: + :toctree: generated/ + + line_search - Return a step that satisfies the strong Wolfe conditions + check_grad - Check the supplied derivative using finite differences + """ postpone_import = 1 Modified: trunk/scipy/sparse/__init__.py =================================================================== --- trunk/scipy/sparse/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/sparse/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,174 +1,3 @@ -""" -Sparse Matrices -=============== - -SciPy 2-D sparse matrix package. - -Original code by Travis Oliphant. -Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell. - -There are seven available sparse matrix types: - 1. csc_matrix: Compressed Sparse Column format - 2. csr_matrix: Compressed Sparse Row format - 3. bsr_matrix: Block Sparse Row format - 4. lil_matrix: List of Lists format - 5. dok_matrix: Dictionary of Keys format - 6. coo_matrix: COOrdinate format (aka IJV, triplet format) - 7. dia_matrix: DIAgonal format - -To construct a matrix efficiently, use either lil_matrix (recommended) or -dok_matrix. The lil_matrix class supports basic slicing and fancy -indexing with a similar syntax to NumPy arrays. As illustrated below, -the COO format may also be used to efficiently construct matrices. - -To perform manipulations such as multiplication or inversion, first -convert the matrix to either CSC or CSR format. The lil_matrix format is -row-based, so conversion to CSR is efficient, whereas conversion to CSC -is less so. - -All conversions among the CSR, CSC, and COO formats are efficient, -linear-time operations. - -Example 1 ---------- -Construct a 1000x1000 lil_matrix and add some values to it: - ->>> from scipy.sparse import lil_matrix ->>> from scipy.sparse.linalg import spsolve ->>> from numpy.linalg import solve, norm ->>> from numpy.random import rand - ->>> A = lil_matrix((1000, 1000)) ->>> A[0, :100] = rand(100) ->>> A[1, 100:200] = A[0, :100] ->>> A.setdiag(rand(1000)) - -Now convert it to CSR format and solve A x = b for x: - ->>> A = A.tocsr() ->>> b = rand(1000) ->>> x = spsolve(A, b) - -Convert it to a dense matrix and solve, and check that the result -is the same: - ->>> x_ = solve(A.todense(), b) - -Now we can compute norm of the error with: - ->>> err = norm(x-x_) ->>> err < 1e-10 -True - -It should be small :) - - -Example 2 ---------- - -Construct a matrix in COO format: - ->>> from scipy import sparse ->>> from numpy import array ->>> I = array([0,3,1,0]) ->>> J = array([0,3,1,2]) ->>> V = array([4,5,7,9]) ->>> A = sparse.coo_matrix((V,(I,J)),shape=(4,4)) - -Notice that the indices do not need to be sorted. - -Duplicate (i,j) entries are summed when converting to CSR or CSC. - ->>> I = array([0,0,1,3,1,0,0]) ->>> J = array([0,2,1,3,1,0,0]) ->>> V = array([1,1,1,1,1,1,1]) ->>> B = sparse.coo_matrix((V,(I,J)),shape=(4,4)).tocsr() - -This is useful for constructing finite-element stiffness and mass matrices. - -Further Details ---------------- - -CSR column indices are not necessarily sorted. Likewise for CSC row -indices. Use the .sorted_indices() and .sort_indices() methods when -sorted indices are required (e.g. when passing data to other libraries). - -Package Contents -================ - -Modules -------- - -.. autosummary:: - :toctree: generated/ - - base - Base class for sparse matrices - bsr - Compressed Block Sparse Row matrix format - compressed - Sparse matrix base class using compressed storage - construct - Functions to construct sparse matrices - coo - A sparse matrix in COOrdinate or 'triplet' format - csc - Compressed Sparse Column matrix format - csgraph - Compressed Sparse graph algorithms - csr - Compressed Sparse Row matrix format - data - Base class for sparse matrice with a .data attribute - dia - Sparse DIAgonal format - dok - Dictionary Of Keys based matrix - extract - Functions to extract parts of sparse matrices - lil - LInked List sparse matrix class - linalg - - sparsetools - A collection of routines for sparse matrix operations - spfuncs - Functions that operate on sparse matrices - sputils - Utility functions for sparse matrix module - -Classes -------- - -.. autosummary:: - :toctree: generated/ - - SparseEfficiencyWarning - - SparseWarning - - bsr_matrix - Block Sparse Row matrix - coo_matrix - A sparse matrix in COOrdinate format - csc_matrix - Compressed Sparse Column matrix - csr_matrix - Compressed Sparse Row matrix - dia_matrix - Sparse matrix with DIAgonal storage - dok_matrix - Dictionary Of Keys based sparse matrix - lil_matrix - Row-based linked list sparse matrix - -Functions ---------- - -.. autosummary:: - :toctree: generated/ - - bmat - Build a sparse matrix from sparse sub-blocks - cs_graph_components - - eye - Sparse MxN matrix whose k-th diagonal is all ones - find - - hstack - Stack sparse matrices horizontally (column wise) - identity - Identity matrix in sparse format - issparse - - isspmatrix - - isspmatrix_bsr - - isspmatrix_coo - - isspmatrix_csc - - isspmatrix_csr - - isspmatrix_dia - - isspmatrix_dok - - isspmatrix_lil - - kron - kronecker product of two sparse matrices - kronsum - kronecker sum of sparse matrices - lil_diags - Generate a lil_matrix with the given diagonals - lil_eye - RxC lil_matrix whose k-th diagonal set to one - rand - Random values in a given shape - spdiags - Return a sparse matrix from diagonals - tril - Lower triangular portion of a matrix in sparse format - triu - Upper triangular portion of a matrix in sparse format - vstack - Stack sparse matrices vertically (row wise) - -""" - from info import __doc__ from base import * Modified: trunk/scipy/sparse/info.py =================================================================== --- trunk/scipy/sparse/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/sparse/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,8 +1,8 @@ """ Sparse Matrices ---------------- +=============== -Scipy 2D sparse matrix module. +SciPy 2-D sparse matrix package. Original code by Travis Oliphant. Modified and extended by Ed Schofield, Robert Cimrman, and Nathan Bell. @@ -93,6 +93,80 @@ indices. Use the .sorted_indices() and .sort_indices() methods when sorted indices are required (e.g. when passing data to other libraries). +Package Contents +================ + +Modules +------- + +.. autosummary:: + :toctree: generated/ + + base - Base class for sparse matrices + bsr - Compressed Block Sparse Row matrix format + compressed - Sparse matrix base class using compressed storage + construct - Functions to construct sparse matrices + coo - A sparse matrix in COOrdinate or 'triplet' format + csc - Compressed Sparse Column matrix format + csgraph - Compressed Sparse graph algorithms + csr - Compressed Sparse Row matrix format + data - Base class for sparse matrice with a .data attribute + dia - Sparse DIAgonal format + dok - Dictionary Of Keys based matrix + extract - Functions to extract parts of sparse matrices + lil - LInked List sparse matrix class + linalg - + sparsetools - A collection of routines for sparse matrix operations + spfuncs - Functions that operate on sparse matrices + sputils - Utility functions for sparse matrix module + +Classes +------- + +.. autosummary:: + :toctree: generated/ + + SparseEfficiencyWarning - + SparseWarning - + bsr_matrix - Block Sparse Row matrix + coo_matrix - A sparse matrix in COOrdinate format + csc_matrix - Compressed Sparse Column matrix + csr_matrix - Compressed Sparse Row matrix + dia_matrix - Sparse matrix with DIAgonal storage + dok_matrix - Dictionary Of Keys based sparse matrix + lil_matrix - Row-based linked list sparse matrix + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + bmat - Build a sparse matrix from sparse sub-blocks + cs_graph_components - + eye - Sparse MxN matrix whose k-th diagonal is all ones + find - + hstack - Stack sparse matrices horizontally (column wise) + identity - Identity matrix in sparse format + issparse - + isspmatrix - + isspmatrix_bsr - + isspmatrix_coo - + isspmatrix_csc - + isspmatrix_csr - + isspmatrix_dia - + isspmatrix_dok - + isspmatrix_lil - + kron - kronecker product of two sparse matrices + kronsum - kronecker sum of sparse matrices + lil_diags - Generate a lil_matrix with the given diagonals + lil_eye - RxC lil_matrix whose k-th diagonal set to one + rand - Random values in a given shape + spdiags - Return a sparse matrix from diagonals + tril - Lower triangular portion of a matrix in sparse format + triu - Upper triangular portion of a matrix in sparse format + vstack - Stack sparse matrices vertically (row wise) + """ __docformat__ = "restructuredtext en" Modified: trunk/scipy/stats/__init__.py =================================================================== --- trunk/scipy/stats/__init__.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/stats/__init__.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -1,259 +1,3 @@ -""" -Statistical Functions -===================== - -This module contains a large number of probability distributions as -well as a growing library of statistical functions. - -Each included distribution is an instance of the class rv_continous. -For each given name the following methods are available. See docstring -for rv_continuous for more information - -:rvs: - random variates with the distribution -:pdf: - probability density function -:cdf: - cumulative distribution function -:sf: - survival function (1.0 - cdf) -:ppf: - percent-point function (inverse of cdf) -:isf: - inverse survival function -:stats: - mean, variance, and optionally skew and kurtosis - -Calling the instance as a function returns a frozen pdf whose shape, -location, and scale parameters are fixed. - -Distributions ---------------- - -The distributions available with the above methods are: - - -Continuous (Total == 81 distributions) ---------------------------------------- - -.. autosummary:: - :toctree: generated/ - - norm Normal (Gaussian) - alpha Alpha - anglit Anglit - arcsine Arcsine - beta Beta - betaprime Beta Prime - bradford Bradford - burr Burr - cauchy Cauchy - chi Chi - chi2 Chi-squared - cosine Cosine - dgamma Double Gamma - dweibull Double Weibull - erlang Erlang - expon Exponential - exponweib Exponentiated Weibull - exponpow Exponential Power - f F (Snecdor F) - fatiguelife Fatigue Life (Birnbaum-Sanders) - fisk Fisk - foldcauchy Folded Cauchy - foldnorm Folded Normal - frechet_r Frechet Right Sided, Extreme Value Type II (Extreme LB) or weibull_min - frechet_l Frechet Left Sided, Weibull_max - genlogistic Generalized Logistic - genpareto Generalized Pareto - genexpon Generalized Exponential - genextreme Generalized Extreme Value - gausshyper Gauss Hypergeometric - gamma Gamma - gengamma Generalized gamma - genhalflogistic Generalized Half Logistic - gompertz Gompertz (Truncated Gumbel) - gumbel_r Right Sided Gumbel, Log-Weibull, Fisher-Tippett, Extreme Value Type I - gumbel_l Left Sided Gumbel, etc. - halfcauchy Half Cauchy - halflogistic Half Logistic - halfnorm Half Normal - hypsecant Hyperbolic Secant - invgamma Inverse Gamma - invnorm Inverse Normal - invweibull Inverse Weibull - johnsonsb Johnson SB - johnsonsu Johnson SU - ksone Kolmogorov-Smirnov one-sided (no stats) - kstwobign Kolmogorov-Smirnov two-sided test for Large N (no stats) - laplace Laplace - logistic Logistic - loggamma Log-Gamma - loglaplace Log-Laplace (Log Double Exponential) - lognorm Log-Normal - gilbrat Gilbrat - lomax Lomax (Pareto of the second kind) - maxwell Maxwell - mielke Mielke's Beta-Kappa - nakagami Nakagami - ncx2 Non-central chi-squared - ncf Non-central F - nct Non-central Student's T - pareto Pareto - powerlaw Power-function - powerlognorm Power log normal - powernorm Power normal - rdist R distribution - reciprocal Reciprocal - rayleigh Rayleigh - rice Rice - recipinvgauss Reciprocal Inverse Gaussian - semicircular Semicircular - t Student's T - triang Triangular - truncexpon Truncated Exponential - truncnorm Truncated Normal - tukeylambda Tukey-Lambda - uniform Uniform - von_mises Von-Mises (Circular) - wald Wald - weibull_min Minimum Weibull (see Frechet) - weibull_max Maximum Weibull (see Frechet) - wrapcauchy Wrapped Cauchy - - -=============== ============================================================== -Discrete (Total == 10 distributions) -============================================================================== -binom Binomial -bernoulli Bernoulli -nbinom Negative Binomial -geom Geometric -hypergeom Hypergeometric -logser Logarithmic (Log-Series, Series) -poisson Poisson -planck Planck (Discrete Exponential) -boltzmann Boltzmann (Truncated Discrete Exponential) -randint Discrete Uniform -zipf Zipf -dlaplace Discrete Laplacian -=============== ============================================================== - -Statistical Functions (adapted from Gary Strangman) ------------------------------------------------------ - -================= ============================================================== -gmean Geometric mean -hmean Harmonic mean -mean Arithmetic mean -cmedian Computed median -median Median -mode Modal value -tmean Truncated arithmetic mean -tvar Truncated variance -tmin _ -tmax _ -tstd _ -tsem _ -moment Central moment -variation Coefficient of variation -skew Skewness -kurtosis Fisher or Pearson kurtosis -describe Descriptive statistics -skewtest _ -kurtosistest _ -normaltest _ -================= ============================================================== - -================= ============================================================== -itemfreq _ -scoreatpercentile _ -percentileofscore _ -histogram2 _ -histogram _ -cumfreq _ -relfreq _ -================= ============================================================== - -================= ============================================================== -obrientransform _ -samplevar _ -samplestd _ -signaltonoise _ -bayes_mvs _ -var _ -std _ -stderr _ -sem _ -z _ -zs _ -zmap _ -================= ============================================================== - -================= ============================================================== -threshold _ -trimboth _ -trim1 _ -cov _ -corrcoef _ -================= ============================================================== - -================= ============================================================== -f_oneway _ -paired _ -pearsonr _ -spearmanr _ -pointbiserialr _ -kendalltau _ -linregress _ -================= ============================================================== - -================= ============================================================== -ttest_1samp _ -ttest_ind _ -ttest_rel _ -kstest _ -chisquare _ -ks_2samp _ -meanwhitneyu _ -tiecorrect _ -ranksums _ -wilcoxon _ -kruskal _ -friedmanchisquare _ -================= ============================================================== - -================= ============================================================== -ansari _ -bartlett _ -levene _ -shapiro _ -anderson _ -binom_test _ -fligner _ -mood _ -oneway _ -================= ============================================================== - -================= ============================================================== -glm _ -anova _ -================= ============================================================== - - -================= ============================================================== -Plot-tests -================================================================================ -probplot _ -ppcc_max _ -ppcc_plot _ -================= ============================================================== - - -For many more stat related functions install the software R and the -interface package rpy. - -""" # # stats - Statistical Functions # Modified: trunk/scipy/stats/info.py =================================================================== --- trunk/scipy/stats/info.py 2010-11-14 10:12:36 UTC (rev 6894) +++ trunk/scipy/stats/info.py 2010-11-14 16:18:57 UTC (rev 6895) @@ -6,8 +6,8 @@ well as a growing library of statistical functions. Each included distribution is an instance of the class rv_continous. -For each given name the following methods are available. See docstring for -rv_continuous for more information +For each given name the following methods are available. See docstring +for rv_continuous for more information :rvs: random variates with the distribution @@ -32,93 +32,96 @@ The distributions available with the above methods are: -=============== ============================================================== + Continuous (Total == 81 distributions) -============================================================================== -norm Normal (Gaussian) -alpha Alpha -anglit Anglit -arcsine Arcsine -beta Beta -betaprime Beta Prime -bradford Bradford -burr Burr -fisk Fisk -cauchy Cauchy -chi Chi -chi2 Chi-squared -cosine Cosine -dgamma Double Gamma -dweibull Double Weibull -erlang Erlang -expon Exponential -exponweib Exponentiated Weibull -exponpow Exponential Power -fatiguelife Fatigue Life (Birnbaum-Sanders) -foldcauchy Folded Cauchy -f F (Snecdor F) -foldnorm Folded Normal -frechet_r Frechet Right Sided, Extreme Value Type II (Extreme LB) or weibull_min -frechet_l Frechet Left Sided, Weibull_max -genlogistic Generalized Logistic -genpareto Generalized Pareto -genexpon Generalized Exponential -genextreme Generalized Extreme Value -gausshyper Gauss Hypergeometric -gamma Gamma -gengamma Generalized gamma -genhalflogistic Generalized Half Logistic -gompertz Gompertz (Truncated Gumbel) -gumbel_r Right Sided Gumbel, Log-Weibull, Fisher-Tippett, Extreme Value Type I -gumbel_l Left Sided Gumbel, etc. -halfcauchy Half Cauchy -halflogistic Half Logistic -halfnorm Half Normal -hypsecant Hyperbolic Secant -invgamma Inverse Gamma -invnorm Inverse Normal -invweibull Inverse Weibull -johnsonsb Johnson SB -johnsonsu Johnson SU -laplace Laplace -logistic Logistic -loggamma Log-Gamma -loglaplace Log-Laplace (Log Double Exponential) -lognorm Log-Normal -gilbrat Gilbrat -lomax Lomax (Pareto of the second kind) -maxwell Maxwell -mielke Mielke's Beta-Kappa -nakagami Nakagami -ncx2 Non-central chi-squared -ncf Non-central F -t Student's T -nct Non-central Student's T -pareto Pareto -powerlaw Power-function -powerlognorm Power log normal -powernorm Power normal -rdist R distribution -reciprocal Reciprocal -rayleigh Rayleigh -rice Rice -recipinvgauss Reciprocal Inverse Gaussian -semicircular Semicircular -triang Triangular -truncexpon Truncated Exponential -truncnorm Truncated Normal -tukeylambda Tukey-Lambda -uniform Uniform -von_mises Von-Mises (Circular) -wald Wald -weibull_min Minimum Weibull (see Frechet) -weibull_max Maximum Weibull (see Frechet) -wrapcauchy Wrapped Cauchy -ksone Kolmogorov-Smirnov one-sided (no stats) -kstwobign Kolmogorov-Smirnov two-sided test for Large N (no stats) -=============== ============================================================== +--------------------------------------- +.. autosummary:: + :toctree: generated/ + norm Normal (Gaussian) + alpha Alpha + anglit Anglit + arcsine Arcsine + beta Beta + betaprime Beta Prime + bradford Bradford + burr Burr + cauchy Cauchy + chi Chi + chi2 Chi-squared + cosine Cosine + dgamma Double Gamma + dweibull Double Weibull + erlang Erlang + expon Exponential + exponweib Exponentiated Weibull + exponpow Exponential Power + f F (Snecdor F) + fatiguelife Fatigue Life (Birnbaum-Sanders) + fisk Fisk + foldcauchy Folded Cauchy + foldnorm Folded Normal + frechet_r Frechet Right Sided, Extreme Value Type II (Extreme LB) or weibull_min + frechet_l Frechet Left Sided, Weibull_max + genlogistic Generalized Logistic + genpareto Generalized Pareto + genexpon Generalized Exponential + genextreme Generalized Extreme Value + gausshyper Gauss Hypergeometric + gamma Gamma + gengamma Generalized gamma + genhalflogistic Generalized Half Logistic + gompertz Gompertz (Truncated Gumbel) + gumbel_r Right Sided Gumbel, Log-Weibull, Fisher-Tippett, Extreme Value Type I + gumbel_l Left Sided Gumbel, etc. + halfcauchy Half Cauchy + halflogistic Half Logistic + halfnorm Half Normal + hypsecant Hyperbolic Secant + invgamma Inverse Gamma + invnorm Inverse Normal + invweibull Inverse Weibull + johnsonsb Johnson SB + johnsonsu Johnson SU + ksone Kolmogorov-Smirnov one-sided (no stats) + kstwobign Kolmogorov-Smirnov two-sided test for Large N (no stats) + laplace Laplace + logistic Logistic + loggamma Log-Gamma + loglaplace Log-Laplace (Log Double Exponential) + lognorm Log-Normal + gilbrat Gilbrat + lomax Lomax (Pareto of the second kind) + maxwell Maxwell + mielke Mielke's Beta-Kappa + nakagami Nakagami + ncx2 Non-central chi-squared + ncf Non-central F + nct Non-central Student's T + pareto Pareto + powerlaw Power-function + powerlognorm Power log normal + powernorm Power normal + rdist R distribution + reciprocal Reciprocal + rayleigh Rayleigh + rice Rice + recipinvgauss Reciprocal Inverse Gaussian + semicircular Semicircular + t Student's T + triang Triangular + truncexpon Truncated Exponential + truncnorm Truncated Normal + tukeylambda Tukey-Lambda + uniform Uniform + von_mises Von-Mises (Circular) + wald Wald + weibull_min Minimum Weibull (see Frechet) + weibull_max Maximum Weibull (see Frechet) + wrapcauchy Wrapped Cauchy + + =============== ============================================================== Discrete (Total == 10 distributions) ============================================================================== From scipy-svn at scipy.org Sun Nov 14 11:23:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 10:23:56 -0600 (CST) Subject: [Scipy-svn] r6896 - trunk/scipy/interpolate Message-ID: <20101114162356.79FE137A194@scipy.org> Author: ptvirtan Date: 2010-11-14 10:23:56 -0600 (Sun, 14 Nov 2010) New Revision: 6896 Modified: trunk/scipy/interpolate/info.py Log: DOC: fix scipy.interpolate module docstring Modified: trunk/scipy/interpolate/info.py =================================================================== --- trunk/scipy/interpolate/info.py 2010-11-14 16:18:57 UTC (rev 6895) +++ trunk/scipy/interpolate/info.py 2010-11-14 16:23:56 UTC (rev 6896) @@ -7,114 +7,115 @@ wrappers for `FITPACK `_ and DFITPACK functions. -Spline Functions ----------------- +Univariate interpolation +======================== .. autosummary:: :toctree: generated/ - bisplev - bisplrep - insert - spalde - splev - spleval - splint - spline - splmake - splprep - splrep - spltopp - sproot + interp1d + BarycentricInterpolator + KroghInterpolator + PiecewisePolynomial + barycentric_interpolate + krogh_interpolate + piecewise_polynomial_interpolate -Spline Classes --------------- +Multivariate interpolation +========================== + +Unstructured data: + .. autosummary:: :toctree: generated/ + griddata + LinearNDInterpolator + NearestNDInterpolator + CloughTocher2DInterpolator + Rbf + +Data given on a regular grid: + +.. autosummary:: + :toctree: generated/ + + interp2d + + +1-D Splines +=========== + +.. autosummary:: + :toctree: generated/ + UnivariateSpline InterpolatedUnivariateSpline LSQUnivariateSpline - BivariateSpline - SmoothBivariateSpline -Interpolation Classes (univariate) ----------------------------------- +The above univariate spline classes have the following methods: + .. autosummary:: :toctree: generated/ - interp1d - BarycentricInterpolator - barycentric_interpolate - KroghInterpolator - krogh_interpolate - PiecewisePolynomial - piecewise_polynomial_interpolate - ppform + UnivariateSpline.__call__ + UnivariateSpline.derivatives + UnivariateSpline.integral + UnivariateSpline.roots + UnivariateSpline.get_coeffs + UnivariateSpline.get_knots + UnivariateSpline.get_residual + UnivariateSpline.set_smoothing_factor -Interpolation Classes (multivariate) ------------------------------------- +Low-level interface to FITPACK functions: + .. autosummary:: :toctree: generated/ - interp2d - Rbf + splrep + splprep + splev + splint + sproot + spalde + bisplrep + bisplev -Additional tools ----------------- +2-D Splines +=========== + +.. seealso:: scipy.ndimage.map_coordinates + .. autosummary:: :toctree: generated/ - lagrange - approximate_taylor_polynomial + BivariateSpline + SmoothBivariateSpline + LSQBivariateSpline -Wrappers around FITPACK functions ---------------------------------- +Low-level interface to FITPACK functions: .. autosummary:: :toctree: generated/ - fitpack.bisplev - fitpack.bisplrep - fitpack.insert - fitpack.spalde - fitpack.splev - fitpack.splint - fitpack.splprep - fitpack.splrep - fitpack.sproot + bisplrep + bisplev -Wrappers around DFITPACK functions ----------------------------------- +Additional tools +================ - `dfitpack.bispeu` - `dfitpack.bispev` - `dfitpack.curfit` - `dfitpack.dblint` - `dfitpack.fpcurf0` - `dfitpack.fpcurf1` - `dfitpack.fpcurfm1` - `dfitpack.parcur` - `dfitpack.percur` - `dfitpack.regrid_smth` - `dfitpack.spalde` - `dfitpack.splder` - `dfitpack.splev` - `dfitpack.splint` - `dfitpack.sproot` - `dfitpack.surfit_lsq` - `dfitpack.surfit_smth` - -See Also --------- - .. autosummary:: :toctree: generated/ + lagrange + approximate_taylor_polynomial + +.. seealso:: + ndimage.map_coordinates ndimage.spline_filter signal.resample From scipy-svn at scipy.org Sun Nov 14 15:52:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 14:52:47 -0600 (CST) Subject: [Scipy-svn] r6897 - trunk/scipy/signal Message-ID: <20101114205247.B8A8337A196@scipy.org> Author: warren.weckesser Date: 2010-11-14 14:52:47 -0600 (Sun, 14 Nov 2010) New Revision: 6897 Modified: trunk/scipy/signal/waveforms.py Log: DEP: signal: Remove deprecated 'chirp' code (nonscalar 'f0' and 'qshape' keyword--see the 0.8.0 release notes). Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-11-14 16:23:56 UTC (rev 6896) +++ trunk/scipy/signal/waveforms.py 2010-11-14 20:52:47 UTC (rev 6897) @@ -5,9 +5,8 @@ # Rewrote much of chirp() # Added sweep_poly() -import warnings from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \ - exp, cos, sin, polyval, polyint, size, log10 + exp, cos, sin, polyval, polyint def sawtooth(t, width=1): """ @@ -190,83 +189,9 @@ return yI, yQ, yenv -# This is chirp from scipy 0.7: - -def old_chirp(t, f0=0, t1=1, f1=100, method='linear', phi=0, qshape=None): +def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True): """Frequency-swept cosine generator. - Parameters - ---------- - t : ndarray - Times at which to evaluate the waveform. - f0 : float or ndarray, optional - Frequency (in Hz) of the waveform at time 0. If `f0` is an - ndarray, it specifies the frequency change as a polynomial in - `t` (see Notes below). - t1 : float, optional - Time at which `f1` is specified. - f1 : float, optional - Frequency (in Hz) of the waveform at time `t1`. - method : {'linear', 'quadratic', 'logarithmic'}, optional - Kind of frequency sweep. - phi : float - Phase offset, in degrees. - qshape : {'convex', 'concave'} - If method is 'quadratic', `qshape` specifies its shape. - - Notes - ----- - If `f0` is an array, it forms the coefficients of a polynomial in - `t` (see `numpy.polval`). The polynomial determines the waveform - frequency change in time. In this case, the values of `f1`, `t1`, - `method`, and `qshape` are ignored. - - This function is deprecated. It will be removed in SciPy version 0.9.0. - It exists so that during in version 0.8.0, the new chirp function can - call this function to preserve the old behavior of the quadratic chirp. - """ - warnings.warn("The function old_chirp is deprecated, and will be removed in " - "SciPy 0.9", DeprecationWarning) - # Convert to radians. - phi *= pi / 180 - if size(f0) > 1: - # We were given a polynomial. - return cos(2*pi*polyval(polyint(f0),t)+phi) - if method in ['linear','lin','li']: - beta = (f1-f0)/t1 - phase_angle = 2*pi * (f0*t + 0.5*beta*t*t) - elif method in ['quadratic','quad','q']: - if qshape == 'concave': - mxf = max(f0,f1) - mnf = min(f0,f1) - f1,f0 = mxf, mnf - elif qshape == 'convex': - mxf = max(f0,f1) - mnf = min(f0,f1) - f1,f0 = mnf, mxf - else: - raise ValueError("qshape must be either 'concave' or 'convex' but " - "a value of %r was given." % qshape) - beta = (f1-f0)/t1/t1 - phase_angle = 2*pi * (f0*t + beta*t*t*t/3) - elif method in ['logarithmic','log','lo']: - if f1 <= f0: - raise ValueError( - "For a logarithmic sweep, f1=%f must be larger than f0=%f." - % (f1, f0)) - beta = log10(f1-f0)/t1 - phase_angle = 2*pi * (f0*t + (pow(10,beta*t)-1)/(beta*log(10))) - else: - raise ValueError("method must be 'linear', 'quadratic', or " - "'logarithmic' but a value of %r was given." % method) - - return cos(phase_angle + phi) - - -def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True, - qshape=None): - """Frequency-swept cosine generator. - In the following, 'Hz' should be interpreted as 'cycles per time unit'; there is no assumption here that the time unit is one second. The important distinction is that the units of rotation are cycles, not @@ -291,10 +216,6 @@ This parameter is only used when `method` is 'quadratic'. It determines whether the vertex of the parabola that is the graph of the frequency is at t=0 or t=t1. - qshape : str (deprecated) - If `method` is `quadratic` and `qshape` is not None, chirp() will - use scipy.signal.waveforms.old_chirp to compute the wave form. - This parameter is deprecated, and will be removed in SciPy 0.9. Returns ------- @@ -354,24 +275,7 @@ f1 must be positive, and f0 must be greater than f1. """ - if size(f0) > 1: - # Preserve old behavior for one release cycle; this can be - # removed in scipy 0.9. - warnings.warn("Passing a list of polynomial coefficients in f0 to the " - "function chirp is deprecated. Use scipy.signal.sweep_poly.", - DeprecationWarning) - return old_chirp(t, f0, t1, f1, method, phi, qshape) - if method in ['quadratic', 'quad', 'q'] and qshape is not None: - # We must use the old version of the quadratic chirp. Fortunately, - # the old API *required* that qshape be either 'convex' or 'concave' - # if the quadratic method was selected--`None` would raise an error. - # So if the code reaches this point, we should use the old version. - warnings.warn("The qshape keyword argument is deprecated. " - "Use vertex_zero.", DeprecationWarning) - waveform = old_chirp(t, f0, t1, f1, method, phi, qshape) - return waveform - # 'phase' is computed in _chirp_phase, to make testing easier. phase = _chirp_phase(t, f0, t1, f1, method, vertex_zero) # Convert phi to radians. From scipy-svn at scipy.org Sun Nov 14 16:02:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 15:02:56 -0600 (CST) Subject: [Scipy-svn] r6898 - trunk/scipy/constants Message-ID: <20101114210256.5C1CD37A196@scipy.org> Author: warren.weckesser Date: 2010-11-14 15:02:56 -0600 (Sun, 14 Nov 2010) New Revision: 6898 Modified: trunk/scipy/constants/codata.py Log: DEP: constants: Change the default value of the 'disp' argument of the 'find' function to False (see the 0.8.0 release notes). Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-11-14 20:52:47 UTC (rev 6897) +++ trunk/scipy/constants/codata.py 2010-11-14 21:02:56 UTC (rev 6898) @@ -24,8 +24,6 @@ """ -import warnings -import string from math import pi, sqrt __all__ = ['physical_constants', 'value', 'unit', 'precision', 'find'] @@ -467,15 +465,10 @@ """ return physical_constants[key][2] / physical_constants[key][0] -def find(sub=None, disp=True) : +def find(sub=None, disp=False): """ Return list of codata.physical_constant keys containing a given string - Deprecation Warning - ------------------- - In Scipy version 0.8.0, the keyword argument 'disp' was added to find(), - with the default value True. In 0.9.0, the default will be False. - Parameters ---------- sub : str, unicode @@ -496,9 +489,6 @@ dictionary literal object, does not itself possess a docstring. """ - warnings.warn("In Scipy version 0.8.0, the keyword argument 'disp' was added to " - "find(), with the default value True. In 0.9.0, the default will be False.", - DeprecationWarning) if sub is None: result = physical_constants.keys() else: From scipy-svn at scipy.org Sun Nov 14 16:17:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 15:17:52 -0600 (CST) Subject: [Scipy-svn] r6899 - in trunk/scipy/linalg: . tests Message-ID: <20101114211752.70B2737A4BD@scipy.org> Author: warren.weckesser Date: 2010-11-14 15:17:52 -0600 (Sun, 14 Nov 2010) New Revision: 6899 Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/tests/test_basic.py Log: DEP: linalg: change return value of solveh_banded to just the solution (see the 0.8.0 release notes) Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-11-14 21:02:56 UTC (rev 6898) +++ trunk/scipy/linalg/basic.py 2010-11-14 21:17:52 UTC (rev 6899) @@ -6,8 +6,6 @@ __all__ = ['solve', 'solve_triangular', 'solveh_banded', 'solve_banded', 'inv', 'det', 'lstsq', 'pinv', 'pinv2'] -from warnings import warn - from numpy import asarray, zeros, sum, conjugate, dot, transpose, \ asarray_chkfinite, single import numpy @@ -227,19 +225,10 @@ Returns ------- - c : array, shape (u+1, M) - Cholesky factorization of a, in the same banded format as ab x : array, shape (M,) or (M, K) The solution to the system a x = b - - Notes - ----- - The inclusion of `c` in the return value is deprecated. In SciPy - version 0.9, the return value will be the solution `x` only. """ - warn("In SciPy 0.9, the return value of solveh_banded will be " - "the solution x only.", DeprecationWarning) ab, b = map(asarray_chkfinite, (ab, b)) @@ -255,7 +244,7 @@ if info < 0: raise ValueError('illegal value in %d-th argument of internal pbsv' % -info) - return c, x + return x # matrix inversion Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-11-14 21:02:56 UTC (rev 6898) +++ trunk/scipy/linalg/tests/test_basic.py 2010-11-14 21:17:52 UTC (rev 6899) @@ -19,10 +19,8 @@ python tests/test_basic.py """ -import warnings - from numpy import arange, array, dot, zeros, identity, conjugate, transpose, \ - float32, zeros_like + float32 import numpy.linalg as linalg from numpy.testing import TestCase, rand, run_module_suite, assert_raises, \ @@ -101,12 +99,8 @@ class TestSolveHBanded(TestCase): - # solveh_banded currently has a DeprecationWarning. When the warning - # is removed in scipy 0.9, the 'ignore' filters and the test for the - # warning can be removed. def test_01_upper(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -114,17 +108,10 @@ # with the RHS as a 1D array. ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) - # Remove the following part of this test in scipy 0.9. - a = array([[4.0, 1.0, 0.0], [1.0, 4.0, 1.0], [0.0, 1.0, 4.0]]) - fac = zeros_like(a) - fac[range(3),range(3)] = c[-1] - fac[(0,1),(1,2)] = c[0,1:] - assert_array_almost_equal(a, dot(fac.T, fac)) def test_02_upper(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -135,14 +122,13 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_03_upper(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -150,11 +136,10 @@ # with the RHS as a 2D array with shape (3,1). ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]).reshape(-1,1) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) assert_array_almost_equal(x, array([0.0, 1.0, 0.0]).reshape(-1,1)) def test_01_lower(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -163,11 +148,10 @@ ab = array([[4.0, 4.0, 4.0], [1.0, 1.0, -99]]) b = array([1.0, 4.0, 1.0]) - c, x = solveh_banded(ab, b, lower=True) + x = solveh_banded(ab, b, lower=True) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_lower(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -178,14 +162,13 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - c, x = solveh_banded(ab, b, lower=True) + x = solveh_banded(ab, b, lower=True) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_float32(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -193,11 +176,10 @@ # ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]], dtype=float32) b = array([1.0, 4.0, 1.0], dtype=float32) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_float32(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -208,14 +190,13 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]], dtype=float32) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_complex(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j] # [ j 4 -j] X = [4-j] @@ -223,11 +204,10 @@ # ab = array([[-99, -1.0j, -1.0j], [4.0, 4.0, 4.0]]) b = array([-1.0j, 4.0-1j, 4+1j]) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 1.0]) def test_02_complex(self): - warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j 4j] # [ j 4 -j] X = [4-j -1-j] @@ -238,15 +218,13 @@ b = array([[ -1j, 4.0j], [4.0-1j, -1.0-1j], [4.0+1j, 4.0]]) - c, x = solveh_banded(ab, b) + x = solveh_banded(ab, b) expected = array([[0.0, 1.0j], [1.0, 0.0], [1.0, 1.0]]) assert_array_almost_equal(x, expected) def test_bad_shapes(self): - warnings.simplefilter('ignore', category=DeprecationWarning) - ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([[1.0, 4.0], @@ -255,13 +233,7 @@ assert_raises(ValueError, solveh_banded, ab, [1.0, 2.0]) assert_raises(ValueError, solveh_banded, ab, [1.0]) - def test_00_deprecation_warning(self): - warnings.simplefilter('error', category=DeprecationWarning) - ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) - b = array([1.0, 4.0, 1.0]) - assert_raises(DeprecationWarning, solveh_banded, ab, b) - class TestSolve(TestCase): def test_20Feb04_bug(self): From scipy-svn at scipy.org Sun Nov 14 16:25:55 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 15:25:55 -0600 (CST) Subject: [Scipy-svn] r6900 - in trunk/scipy: fftpack misc Message-ID: <20101114212555.DF2C237A196@scipy.org> Author: warren.weckesser Date: 2010-11-14 15:25:55 -0600 (Sun, 14 Nov 2010) New Revision: 6900 Removed: trunk/scipy/misc/helpmod.py trunk/scipy/misc/pexec.py trunk/scipy/misc/ppimport.py Modified: trunk/scipy/fftpack/info.py trunk/scipy/misc/info.py Log: DEP: misc: removed deprecated modules helpdmod, ppimport and pexec (see the 0.8.0 release notes) Modified: trunk/scipy/fftpack/info.py =================================================================== --- trunk/scipy/fftpack/info.py 2010-11-14 21:17:52 UTC (rev 6899) +++ trunk/scipy/fftpack/info.py 2010-11-14 21:25:55 UTC (rev 6900) @@ -1,4 +1,4 @@ -# This file is executed by __init__.py and ppimport hooks. +# This file is executed by __init__.py. """ Discrete Fourier transform algorithms Deleted: trunk/scipy/misc/helpmod.py =================================================================== --- trunk/scipy/misc/helpmod.py 2010-11-14 21:17:52 UTC (rev 6899) +++ trunk/scipy/misc/helpmod.py 2010-11-14 21:25:55 UTC (rev 6900) @@ -1,217 +0,0 @@ -import inspect -import types -import sys -import pydoc - -import warnings -warnings.warn('The helpmod module is deprecated. It will be removed from SciPy in version 0.9.', - DeprecationWarning) - -__all__ = ['info','source'] - -# NOTE: pydoc defines a help function which works simliarly to this -# except it uses a pager to take over the screen. - -# combine name and arguments and split to multiple lines of -# width characters. End lines on a comma and begin argument list -# indented with the rest of the arguments. -def split_line(name, arguments, width): - firstwidth = len(name) - k = firstwidth - newstr = name - sepstr = ", " - arglist = arguments.split(sepstr) - for argument in arglist: - if k == firstwidth: - addstr = "" - else: - addstr = sepstr - k = k + len(argument) + len(addstr) - if k > width: - k = firstwidth + 1 + len(argument) - newstr = newstr + ",\n" + " "*(firstwidth+2) + argument - else: - newstr = newstr + addstr + argument - return newstr - -_namedict = None -_dictlist = None - -# Traverse all module directories underneath globals to see if something is defined -def makenamedict(): - import scipy - thedict = {'scipy':scipy.__dict__} - dictlist = ['scipy'] - totraverse = [scipy.__dict__] - while 1: - if len(totraverse) == 0: - break - thisdict = totraverse.pop(0) - for x in thisdict.keys(): - if isinstance(thisdict[x],types.ModuleType): - modname = thisdict[x].__name__ - if modname not in dictlist: - moddict = thisdict[x].__dict__ - dictlist.append(modname) - totraverse.append(moddict) - thedict[modname] = moddict - return thedict, dictlist - - -def info(object=None,maxwidth=76,output=sys.stdout,): - """Get help information for a function, class, or module. - - Example: - >>> from scipy import * - >>> info(polyval) - polyval(p, x) - - Evaluate the polymnomial p at x. - - Description: - If p is of length N, this function returns the value: - p[0]*(x**N-1) + p[1]*(x**N-2) + ... + p[N-2]*x + p[N-1] - """ - global _namedict, _dictlist - - if hasattr(object,'_ppimport_importer') or \ - hasattr(object, '_ppimport_module'): - object = object._ppimport_module - elif hasattr(object, '_ppimport_attr'): - object = object._ppimport_attr - - if object is None: - info(info) - elif isinstance(object, types.StringType): - if _namedict is None: - _namedict, _dictlist = makenamedict() - numfound = 0 - objlist = [] - for namestr in _dictlist: - try: - obj = _namedict[namestr][object] - if id(obj) in objlist: - print >> output, "\n *** Repeat reference found in %s *** " % namestr - else: - objlist.append(id(obj)) - print >> output, " *** Found in %s ***" % namestr - info(obj) - print >> output, "-"*maxwidth - numfound += 1 - except KeyError: - pass - if numfound == 0: - print >> output, "Help for %s not found." % object - else: - print >> output, "\n *** Total of %d references found. ***" % numfound - - elif inspect.isfunction(object): - name = object.func_name - arguments = apply(inspect.formatargspec, inspect.getargspec(object)) - - if len(name+arguments) > maxwidth: - argstr = split_line(name, arguments, maxwidth) - else: - argstr = name + arguments - - print >> output, " " + argstr + "\n" - print >> output, inspect.getdoc(object) - - elif inspect.isclass(object): - name = object.__name__ - if hasattr(object, '__init__'): - arguments = apply(inspect.formatargspec, inspect.getargspec(object.__init__.im_func)) - arglist = arguments.split(', ') - if len(arglist) > 1: - arglist[1] = "("+arglist[1] - arguments = ", ".join(arglist[1:]) - else: - arguments = "()" - else: - arguments = "()" - - if len(name+arguments) > maxwidth: - argstr = split_line(name, arguments, maxwidth) - else: - argstr = name + arguments - - print >> output, " " + argstr + "\n" - doc1 = inspect.getdoc(object) - if doc1 is None: - if hasattr(object,'__init__'): - print >> output, inspect.getdoc(object.__init__) - else: - print >> output, inspect.getdoc(object) - - methods = pydoc.allmethods(object) - if methods != []: - print >> output, "\n\nMethods:\n" - for meth in methods: - if meth[0] == '_': - continue - thisobj = getattr(object, meth, None) - if thisobj is not None: - methstr, other = pydoc.splitdoc(inspect.getdoc(thisobj) or "None") - print >> output, " %s -- %s" % (meth, methstr) - - elif type(object) is types.InstanceType: ## check for __call__ method - print >> output, "Instance of class: ", object.__class__.__name__ - print >> output - if hasattr(object, '__call__'): - arguments = apply(inspect.formatargspec, inspect.getargspec(object.__call__.im_func)) - arglist = arguments.split(', ') - if len(arglist) > 1: - arglist[1] = "("+arglist[1] - arguments = ", ".join(arglist[1:]) - else: - arguments = "()" - - if hasattr(object,'name'): - name = "%s" % object.name - else: - name = "" - if len(name+arguments) > maxwidth: - argstr = split_line(name, arguments, maxwidth) - else: - argstr = name + arguments - - print >> output, " " + argstr + "\n" - doc = inspect.getdoc(object.__call__) - if doc is not None: - print >> output, inspect.getdoc(object.__call__) - print >> output, inspect.getdoc(object) - - else: - print >> output, inspect.getdoc(object) - - elif inspect.ismethod(object): - name = object.__name__ - arguments = apply(inspect.formatargspec, inspect.getargspec(object.im_func)) - arglist = arguments.split(', ') - if len(arglist) > 1: - arglist[1] = "("+arglist[1] - arguments = ", ".join(arglist[1:]) - else: - arguments = "()" - - if len(name+arguments) > maxwidth: - argstr = split_line(name, arguments, maxwidth) - else: - argstr = name + arguments - - print >> output, " " + argstr + "\n" - print >> output, inspect.getdoc(object) - - elif hasattr(object, '__doc__'): - print >> output, inspect.getdoc(object) - - - -def source(object, output=sys.stdout): - """Write source for this object to output. - """ - try: - print >> output, "In file: %s\n" % inspect.getsourcefile(object) - print >> output, inspect.getsource(object) - except: - print >> output, "Not available for this object." Modified: trunk/scipy/misc/info.py =================================================================== --- trunk/scipy/misc/info.py 2010-11-14 21:17:52 UTC (rev 6899) +++ trunk/scipy/misc/info.py 2010-11-14 21:25:55 UTC (rev 6900) @@ -12,10 +12,7 @@ common - Common functions requiring SciPy Base and Level 1 SciPy doccer - Docstring fragment insertion utilities - helpmod - - pexec - pilutil - Image utilities using the Python Imaging Library (PIL) - ppimport - Postpone module import to future setup - setupscons - Deleted: trunk/scipy/misc/pexec.py =================================================================== --- trunk/scipy/misc/pexec.py 2010-11-14 21:17:52 UTC (rev 6899) +++ trunk/scipy/misc/pexec.py 2010-11-14 21:25:55 UTC (rev 6900) @@ -1,64 +0,0 @@ -# -# Title: Provides ParallelExec to execute commands in -# other (background or parallel) threads. -# Author: Pearu Peteson -# Created: October, 2003 -# - -__all__ = ['ParallelExec'] - -import sys -import threading -import Queue -import traceback - -import warnings -warnings.warn('The pexec module is deprecated. It will be removed from SciPy in version 0.9.', - DeprecationWarning) - - -class ParallelExec(threading.Thread): - """ Create a thread of parallel execution. - """ - def __init__(self): - threading.Thread.__init__(self) - self.__queue = Queue.Queue(0) - self.__frame = sys._getframe(1) - self.setDaemon(1) - self.start() - - def __call__(self,code,frame=None,wait=0): - """ Execute code in parallel thread inside given frame (default - frame is where this instance was created). - If wait is True then __call__ returns after code is executed, - otherwise code execution happens in background. - """ - if wait: - wait_for_code = threading.Event() - else: - wait_for_code = None - self.__queue.put((code,frame,wait_for_code)) - if wait: - wait_for_code.wait() - - def shutdown(self): - """ Shutdown parallel thread.""" - self.__queue.put((None,None,None)) - - def run(self): - """ Called by threading.Thread.""" - while 1: - code, frame, wait_for_code = self.__queue.get() - if code is None: - break - if frame is None: - frame = self.__frame - try: - exec (code, frame.f_globals,frame.f_locals) - except Exception: - try: - traceback.print_exc() - except AttributeError: - pass - if wait_for_code is not None: - wait_for_code.set() Deleted: trunk/scipy/misc/ppimport.py =================================================================== --- trunk/scipy/misc/ppimport.py 2010-11-14 21:17:52 UTC (rev 6899) +++ trunk/scipy/misc/ppimport.py 2010-11-14 21:25:55 UTC (rev 6900) @@ -1,444 +0,0 @@ -#!/usr/bin/env python -""" -Postpone module import to future. - -Python versions: 1.5.2 - 2.3.x -Author: Pearu Peterson -Created: March 2003 -$Revision: 922 $ -$Date: 2004-11-27 14:23:27 -0700 (Sat, 27 Nov 2004) $ -""" -__all__ = ['ppimport','ppimport_attr','ppresolve'] - -import os -import sys -import types -import traceback - -import warnings -warnings.warn('The ppimport module is deprecated. It will be removed from SciPy in version 0.9.', - DeprecationWarning) - -DEBUG=0 - -_ppimport_is_enabled = 1 -def enable(): - """ Enable postponed importing.""" - global _ppimport_is_enabled - _ppimport_is_enabled = 1 - -def disable(): - """ Disable postponed importing.""" - global _ppimport_is_enabled - _ppimport_is_enabled = 0 - -class PPImportError(ImportError): - pass - -def _get_so_ext(_cache={}): - so_ext = _cache.get('so_ext') - if so_ext is None: - if sys.platform[:5]=='linux': - so_ext = '.so' - else: - try: - # if possible, avoid expensive get_config_vars call - from distutils.sysconfig import get_config_vars - so_ext = get_config_vars('SO')[0] or '' - except ImportError: - #XXX: implement hooks for .sl, .dll to fully support - # Python 1.5.x - so_ext = '.so' - _cache['so_ext'] = so_ext - return so_ext - -def _get_frame(level=0): - try: - return sys._getframe(level+1) - except AttributeError: - # Python<=2.0 support - frame = sys.exc_info()[2].tb_frame - for i in range(level+1): - frame = frame.f_back - return frame - -def ppimport_attr(module, name): - """ ppimport(module, name) is 'postponed' getattr(module, name) - """ - global _ppimport_is_enabled - if _ppimport_is_enabled and isinstance(module, _ModuleLoader): - return _AttrLoader(module, name) - return getattr(module, name) - -class _AttrLoader(object): - def __init__(self, module, name): - self.__dict__['_ppimport_attr_module'] = module - self.__dict__['_ppimport_attr_name'] = name - - def _ppimport_attr_getter(self): - module = self.__dict__['_ppimport_attr_module'] - if isinstance(module, _ModuleLoader): - # in case pp module was loaded by other means - module = sys.modules[module.__name__] - attr = getattr(module, - self.__dict__['_ppimport_attr_name']) - try: - d = attr.__dict__ - if d is not None: - self.__dict__ = d - except AttributeError: - pass - self.__dict__['_ppimport_attr'] = attr - - return attr - - def __nonzero__(self): - return 1 - - def __getattr__(self, name): - try: - attr = self.__dict__['_ppimport_attr'] - except KeyError: - attr = self._ppimport_attr_getter() - if name=='_ppimport_attr': - return attr - return getattr(attr, name) - - def __repr__(self): - if '_ppimport_attr' in self.__dict__: - return repr(self._ppimport_attr) - module = self.__dict__['_ppimport_attr_module'] - name = self.__dict__['_ppimport_attr_name'] - return "" % (`name`,`module`) - - __str__ = __repr__ - - # For function and class attributes. - def __call__(self, *args, **kwds): - return self._ppimport_attr(*args,**kwds) - - - -def _is_local_module(p_dir,name,suffices): - base = os.path.join(p_dir,name) - for suffix in suffices: - if os.path.isfile(base+suffix): - if p_dir: - return base+suffix - return name+suffix - -def ppimport(name): - """ ppimport(name) -> module or module wrapper - - If name has been imported before, return module. Otherwise - return ModuleLoader instance that transparently postpones - module import until the first attempt to access module name - attributes. - """ - global _ppimport_is_enabled - - level = 1 - parent_frame = p_frame = _get_frame(level) - while '__name__' not in p_frame.f_locals: - level = level + 1 - p_frame = _get_frame(level) - - p_name = p_frame.f_locals['__name__'] - if p_name=='__main__': - p_dir = '' - fullname = name - elif '__path__' in p_frame.f_locals: - # python package - p_path = p_frame.f_locals['__path__'] - p_dir = p_path[0] - fullname = p_name + '.' + name - else: - # python module - p_file = p_frame.f_locals['__file__'] - p_dir = os.path.dirname(p_file) - fullname = p_name + '.' + name - - # module may be imported already - module = sys.modules.get(fullname) - if module is not None: - if _ppimport_is_enabled or isinstance(module, types.ModuleType): - return module - return module._ppimport_importer() - - so_ext = _get_so_ext() - py_exts = ('.py','.pyc','.pyo') - so_exts = (so_ext,'module'+so_ext) - - for d,n,fn,e in [\ - # name is local python module or local extension module - (p_dir, name, fullname, py_exts+so_exts), - # name is local package - (os.path.join(p_dir, name), '__init__', fullname, py_exts), - # name is package in parent directory (scipy specific) - (os.path.join(os.path.dirname(p_dir), name), '__init__', name, py_exts), - ]: - location = _is_local_module(d, n, e) - if location is not None: - fullname = fn - break - - if location is None: - # name is to be looked in python sys.path. - fullname = name - location = 'sys.path' - - # Try once more if module is imported. - # This covers the case when importing from python module - module = sys.modules.get(fullname) - - if module is not None: - if _ppimport_is_enabled or isinstance(module,types.ModuleType): - return module - return module._ppimport_importer() - # It is OK if name does not exists. The ImportError is - # postponed until trying to use the module. - - loader = _ModuleLoader(fullname,location,p_frame=parent_frame) - if _ppimport_is_enabled: - return loader - - return loader._ppimport_importer() - -def _get_frame_code(frame): - filename = frame.f_code.co_filename - lineno = frame.f_lineno - result = '%s in %s:\n' % (filename,frame.f_code.co_name) - if not os.path.isfile(filename): - return result - f = open(filename) - i = 1 - line = f.readline() - while line: - line = f.readline() - i = i + 1 - if (abs(i-lineno)<2): - result += '#%d: %s\n' % (i,line.rstrip()) - if i>lineno+3: - break - f.close() - return result - -def frame_traceback(frame): - if not frame: - return - blocks = [] - f = frame - while f: - blocks.insert(0,_get_frame_code(f)) - f = f.f_back - print '='*50 - print '\n'.join(blocks) - print '='*50 - -class _ModuleLoader(object): - # Don't use it directly. Use ppimport instead. - - def __init__(self,name,location,p_frame=None): - - # set attributes, avoid calling __setattr__ - self.__dict__['__name__'] = name - self.__dict__['__file__'] = location - self.__dict__['_ppimport_p_frame'] = p_frame - - if location != 'sys.path': - from numpy.testing import Tester - self.__dict__['test'] = Tester(os.path.dirname(location)).test - - # install loader - sys.modules[name] = self - - def _ppimport_importer(self): - name = self.__name__ - - try: - module = sys.modules[name] - except KeyError: - raise ImportError,self.__dict__.get('_ppimport_exc_info')[1] - if module is not self: - exc_info = self.__dict__.get('_ppimport_exc_info') - if exc_info is not None: - raise PPImportError,\ - ''.join(traceback.format_exception(*exc_info)) - else: - assert module is self,`(module, self)` - - # uninstall loader - del sys.modules[name] - - if DEBUG: - print 'Executing postponed import for %s' %(name) - try: - module = __import__(name,None,None,['*']) - except Exception,msg: # ImportError: - if DEBUG: - p_frame = self.__dict__.get('_ppimport_p_frame',None) - frame_traceback(p_frame) - self.__dict__['_ppimport_exc_info'] = sys.exc_info() - raise - - assert isinstance(module,types.ModuleType),`module` - - self.__dict__ = module.__dict__ - self.__dict__['_ppimport_module'] = module - - # XXX: Should we check the existence of module.test? Warn? - from numpy.testing import Tester - test = Tester(os.path.dirname(module)).test - return module - - def __setattr__(self, name, value): - try: - module = self.__dict__['_ppimport_module'] - except KeyError: - module = self._ppimport_importer() - return setattr(module, name, value) - - def __getattr__(self, name): - try: - module = self.__dict__['_ppimport_module'] - except KeyError: - module = self._ppimport_importer() - return getattr(module, name) - - def __repr__(self): - global _ppimport_is_enabled - if not _ppimport_is_enabled: - try: - module = self.__dict__['_ppimport_module'] - except KeyError: - module = self._ppimport_importer() - return module.__repr__() - if '_ppimport_module' in self.__dict__: - status = 'imported' - elif '_ppimport_exc_info' in self.__dict__: - status = 'import error' - else: - status = 'import postponed' - return '' \ - % (`self.__name__`,`self.__file__`, status) - - __str__ = __repr__ - -def ppresolve(a,ignore_failure=None): - """ Return resolved object a. - - a can be module name, postponed module, postponed modules - attribute, string representing module attribute, or any - Python object. - """ - global _ppimport_is_enabled - if _ppimport_is_enabled: - disable() - a = ppresolve(a,ignore_failure=ignore_failure) - enable() - return a - if type(a) is type(''): - ns = a.split('.') - if ignore_failure: - try: - a = ppimport(ns[0]) - except: - return a - else: - a = ppimport(ns[0]) - b = [ns[0]] - del ns[0] - while ns: - if hasattr(a,'_ppimport_importer') or \ - hasattr(a,'_ppimport_module'): - a = getattr(a,'_ppimport_module',a) - if hasattr(a,'_ppimport_attr'): - a = a._ppimport_attr - b.append(ns[0]) - del ns[0] - if ignore_failure and not hasattr(a, b[-1]): - a = '.'.join(ns+b) - b = '.'.join(b) - if b in sys.modules and sys.modules[b] is None: - del sys.modules[b] - return a - a = getattr(a,b[-1]) - if hasattr(a,'_ppimport_importer') or \ - hasattr(a,'_ppimport_module'): - a = getattr(a,'_ppimport_module',a) - if hasattr(a,'_ppimport_attr'): - a = a._ppimport_attr - return a - -def _ppresolve_ignore_failure(a): - return ppresolve(a,ignore_failure=1) - -try: - import pydoc as _pydoc -except ImportError: - _pydoc = None - -if _pydoc is not None: - # Redefine __call__ method of help.__class__ to - # support ppimport. - import new as _new - - _old_pydoc_help_call = _pydoc.help.__class__.__call__ - def _ppimport_pydoc_help_call(self,*args,**kwds): - return _old_pydoc_help_call(self, *map(_ppresolve_ignore_failure,args), - **kwds) - _ppimport_pydoc_help_call.__doc__ = _old_pydoc_help_call.__doc__ - _pydoc.help.__class__.__call__ = _new.instancemethod(_ppimport_pydoc_help_call, - None, - _pydoc.help.__class__) - - _old_pydoc_Doc_document = _pydoc.Doc.document - def _ppimport_pydoc_Doc_document(self,*args,**kwds): - args = (_ppresolve_ignore_failure(args[0]),) + args[1:] - return _old_pydoc_Doc_document(self,*args,**kwds) - _ppimport_pydoc_Doc_document.__doc__ = _old_pydoc_Doc_document.__doc__ - _pydoc.Doc.document = _new.instancemethod(_ppimport_pydoc_Doc_document, - None, - _pydoc.Doc) - - _old_pydoc_describe = _pydoc.describe - def _ppimport_pydoc_describe(object): - return _old_pydoc_describe(_ppresolve_ignore_failure(object)) - _ppimport_pydoc_describe.__doc__ = _old_pydoc_describe.__doc__ - _pydoc.describe = _ppimport_pydoc_describe - -import inspect as _inspect -_old_inspect_getfile = _inspect.getfile -def _ppimport_inspect_getfile(object): - if isinstance(object,_ModuleLoader): - return object.__dict__['__file__'] - return _old_inspect_getfile(_ppresolve_ignore_failure(object)) -_ppimport_inspect_getfile.__doc__ = _old_inspect_getfile.__doc__ -_inspect.getfile = _ppimport_inspect_getfile - -_old_inspect_getdoc = _inspect.getdoc -def _ppimport_inspect_getdoc(object): - return _old_inspect_getdoc(_ppresolve_ignore_failure(object)) -_ppimport_inspect_getdoc.__doc__ = _old_inspect_getdoc.__doc__ -_inspect.getdoc = _ppimport_inspect_getdoc - -_old_inspect_getsource = _inspect.getsource -def _ppimport_inspect_getsource(object): - return _old_inspect_getsource(_ppresolve_ignore_failure(object)) -_ppimport_inspect_getsource.__doc__ = _old_inspect_getsource.__doc__ -_inspect.getsource = _ppimport_inspect_getsource - -import __builtin__ as _builtin -_old_builtin_dir = _builtin.dir -def _ppimport_builtin_dir(*arg): - if not arg: - p_frame = _get_frame(1) - g = p_frame.f_globals - l = p_frame.f_locals - l['_ppimport_old_builtin_dir'] = _old_builtin_dir - r = eval('_ppimport_old_builtin_dir()',g,l) - del r[r.index('_ppimport_old_builtin_dir')] - return r - return _old_builtin_dir(*map(_ppresolve_ignore_failure,arg)) -_ppimport_builtin_dir.__doc__ = _old_builtin_dir.__doc__ -_builtin.dir = _ppimport_builtin_dir From scipy-svn at scipy.org Sun Nov 14 16:38:04 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 14 Nov 2010 15:38:04 -0600 (CST) Subject: [Scipy-svn] r6901 - trunk/doc/release Message-ID: <20101114213804.E20E137A196@scipy.org> Author: warren.weckesser Date: 2010-11-14 15:38:04 -0600 (Sun, 14 Nov 2010) New Revision: 6901 Modified: trunk/doc/release/0.9.0-notes.rst Log: DOC: add note to the release notes about the modules removed from scipy.misc. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-14 21:25:55 UTC (rev 6900) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-14 21:38:04 UTC (rev 6901) @@ -120,3 +120,6 @@ Removed features ================ + +The deprecated modules ``helpdmod``, ``pexec`` and ``ppimport`` were removed +from ``scipy.misc``. From scipy-svn at scipy.org Wed Nov 17 09:35:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 17 Nov 2010 08:35:26 -0600 (CST) Subject: [Scipy-svn] r6903 - in trunk/scipy/stats: . tests Message-ID: <20101117143526.9C87937B503@scipy.org> Author: rgommers Date: 2010-11-17 08:35:25 -0600 (Wed, 17 Nov 2010) New Revision: 6903 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: ENH: Add a Fisher exact test to stats. Closes #956. Thanks to: David Simcha, for original implementation. Josef, for code review and testing against R. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-16 21:18:37 UTC (rev 6902) +++ trunk/scipy/stats/stats.py 2010-11-17 14:35:25 UTC (rev 6903) @@ -86,6 +86,7 @@ CORRELATION FCNS: paired pearsonr + fisher_exact spearmanr pointbiserialr kendalltau @@ -219,8 +220,8 @@ 'obrientransform', 'samplevar', 'samplestd', 'signaltonoise', 'var', 'std', 'stderr', 'sem', 'z', 'zs', 'zmap', 'zscore', 'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean', - 'cov', 'corrcoef', 'f_oneway', 'pearsonr', 'spearmanr', - 'pointbiserialr', 'kendalltau', 'linregress', + 'cov', 'corrcoef', 'f_oneway', 'pearsonr', 'fisher_exact', + 'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress', 'ttest_1samp', 'ttest_ind', 'ttest_rel', 'kstest', 'chisquare', 'ks_2samp', 'mannwhitneyu', 'tiecorrect', 'ranksums', 'kruskal', 'friedmanchisquare', @@ -2373,6 +2374,127 @@ return r,prob +def fisher_exact(c) : + """Performs a Fisher exact test on a 2x2 contingency table. + + Parameters + ---------- + c : array_like of ints + A 2x2 contingency table. + + Returns + ------- + oddsratio : float + This is prior odds ratio and not a posterior estimate. + p_value : float + P-value for 2-sided hypothesis of independence. + + Notes + ----- + The calculated odds ratio is different from the one R uses. In R language, + this implementation returns the (more common) "unconditional Maximum + Likelihood Estimate", while R uses the "conditional Maximum Likelihood + Estimate". + + Examples + -------- + >>> fisher_exact([[100, 2], [1000, 5]]) + (0.25, 0.13007593634330314) + """ + hypergeom = distributions.hypergeom + c = np.asarray(c, dtype=np.int64) # int32 is not enough for the algorithm + + if c[1,0] > 0 and c[0,1] > 0: + odssratio = c[0,0] * c[1,1] / float(c[1,0] * c[0,1]) + else: + odssratio = np.inf + + n1 = c[0,0] + c[0,1] + n2 = c[1,0] + c[1,1] + n = c[0,0] + c[1,0] + + mode = int(float((n + 1) * (n1 + 1)) / (n1 + n2 + 2)) + pexact = hypergeom.pmf(c[0,0], n1 + n2, n1, n) + pmode = hypergeom.pmf(mode, n1 + n2, n1, n) + + epsilon = 1 - 1e-4 + if float(np.abs(pexact - pmode)) / np.abs(np.max(pexact, pmode)) <= 1 - epsilon: + return odssratio, 1 + + elif c[0,0] < mode: + plower = hypergeom.cdf(c[0,0], n1 + n2, n1, n) + + if hypergeom.pmf(n, n1 + n2, n1, n) > pexact / epsilon: + return odssratio, plower + + # Binary search for where to begin upper half. + minval = mode + maxval = n + guess = -1 + while maxval - minval > 1: + if maxval == minval + 1 and guess == minval: + guess = maxval + else: + guess = (maxval + minval) / 2 + + pguess = hypergeom.pmf(guess, n1 + n2, n1, n) + if pguess <= pexact and hypergeom.pmf(guess - 1, n1 + n2, n1, n) > pexact: + break + elif pguess < pexact: + maxval = guess + else: + minval = guess + + if guess == -1: + guess = minval + + while guess > 0 and hypergeom.pmf(guess, n1 + n2, n1, n) < pexact * epsilon: + guess -= 1 + + while hypergeom.pmf(guess, n1 + n2, n1, n) > pexact / epsilon: + guess += 1 + + p = plower + hypergeom.sf(guess - 1, n1 + n2, n1, n) + if p > 1.0: + p = 1.0 + return odssratio, p + else: + pupper = hypergeom.sf(c[0,0] - 1, n1 + n2, n1, n) + if hypergeom.pmf(0, n1 + n2, n1, n) > pexact / epsilon: + return odssratio, pupper + + # Binary search for where to begin lower half. + minval = 0 + maxval = mode + guess = -1 + while maxval - minval > 1: + if maxval == minval + 1 and guess == minval: + guess = maxval + else: + guess = (maxval + minval) / 2 + pguess = hypergeom.pmf(guess, n1 + n2, n1, n) + if pguess <= pexact and hypergeom.pmf(guess + 1, n1 + n2, n1, n) > pexact: + break + elif pguess <= pexact: + minval = guess + else: + maxval = guess + + if guess == -1: + guess = minval + + while hypergeom.pmf(guess, n1 + n2, n1, n) < pexact * epsilon: + guess += 1 + + while guess > 0 and hypergeom.pmf(guess, n1 + n2, n1, n) > pexact / epsilon: + guess -= 1 + + p = pupper + hypergeom.cdf(guess, n1 + n2, n1, n) + if p > 1.0: + p = 1.0 + return odssratio, p + + def spearmanr(a, b=None, axis=0): """ Calculates a Spearman rank-order correlation coefficient and the p-value Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-16 21:18:37 UTC (rev 6902) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-17 14:35:25 UTC (rev 6903) @@ -368,6 +368,90 @@ assert_approx_equal(r,1.0) +def test_fisher_exact(): + """Some tests to show that fisher_exact() works correctly. + + Testing the hypergeometric survival function against R's, showing that one + of them (probably Scipy's) is slightly defective (see the test with + significant=1). This is probably because, in distributions.py, Scipy + uses 1.0 - cdf as the sf instead of calculating the sf more directly + for improved numerical accuracy. + + Also note that R and Scipy have different argument formats for their + hypergeometric distrib functions. + + R: + > phyper(18999, 99000, 110000, 39000, lower.tail = FALSE) + [1] 1.701815e-09 + """ + fisher_exact = stats.fisher_exact + + res = fisher_exact([[18000, 80000], [20000, 90000]])[1] + assert_approx_equal(res, 0.2751, significant=4) + res = fisher_exact([[14500, 20000], [30000, 40000]])[1] + assert_approx_equal(res, 0.01106, significant=4) + res = fisher_exact([[100, 2], [1000, 5]])[1] + assert_approx_equal(res, 0.1301, significant=4) + res = fisher_exact([[2, 7], [8, 2]])[1] + assert_approx_equal(res, 0.0230141, significant=6) + res = fisher_exact([[5, 1], [10, 10]])[1] + assert_approx_equal(res, 0.1973244, significant=6) + res = fisher_exact([[5, 15], [20, 20]])[1] + assert_approx_equal(res, 0.0958044, significant=6) + res = fisher_exact([[5, 16], [20, 25]])[1] + assert_approx_equal(res, 0.1725862, significant=6) + res = fisher_exact([[10, 5], [10, 1]])[1] + assert_approx_equal(res, 0.1973244, significant=6) + res = fisher_exact([[5, 0], [1, 4]])[1] + assert_approx_equal(res, 0.04761904, significant=6) + res = fisher_exact([[0, 1], [3, 2]])[1] + assert_approx_equal(res, 1.0) + res = fisher_exact([[0, 2], [6, 4]])[1] + assert_approx_equal(res, 0.4545454545) + res = fisher_exact([[2, 7], [8, 2]]) + assert_approx_equal(res[1], 0.0230141, significant=6) + assert_approx_equal(res[0], 4.0 / 56) + + # High tolerance due to survival function inaccuracy. + res = fisher_exact([[19000, 80000], [20000, 90000]])[1] + assert_approx_equal(res, 3.319e-9, significant=1) + + tablelist = ( [[100, 2], [1000, 5]], + [[2, 7], [8, 2]], + [[5, 1], [10, 10]], + [[5, 15], [20, 20]], + [[5, 16], [20, 25]], + [[10, 5], [10, 1]], + [[10, 5], [10, 0]], + [[5,0], [1, 4]], + [[0,5], [1, 4]], + [[5,1], [0, 4]], + [[0, 1], [3, 2]] ) + for table in tablelist: + # results from R + # + # R defines oddsratio differently (see Notes section of fisher_exact + # docstring), so those will not match. We leave them in anyway, in + # case they will be useful later on. We test only the p-value. + tablist = [ + ([[100, 2], [1000, 5]], (2.505583993422285e-001, 1.300759363430016e-001)), + ([[2, 7], [8, 2]], (8.586235135736206e-002, 2.301413756522114e-002)), + ([[5, 1], [10, 10]], (4.725646047336584e+000, 1.973244147157190e-001)), + ([[5, 15], [20, 20]], (3.394396617440852e-001, 9.580440012477637e-002)), + ([[5, 16], [20, 25]], (3.960558326183334e-001, 1.725864953812994e-001)), + ([[10, 5], [10, 1]], (2.116112781158483e-001, 1.973244147157190e-001)), + ([[10, 5], [10, 0]], (0.000000000000000e+000, 6.126482213438734e-002)), + ([[5, 0], [1, 4]], (np.inf, 4.761904761904762e-002)), + ([[0, 5], [1, 4]], (0.000000000000000e+000, 1.000000000000000e+000)), + ([[5, 1], [0, 4]], (np.inf, 4.761904761904758e-002)), + ([[0, 1], [3, 2]], (0.000000000000000e+000, 1.000000000000000e+000)) + ] + for table, res_r in tablist: + res = fisher_exact(np.asarray(table)) + np.testing.assert_almost_equal(res[1], res_r[1], decimal=11, + verbose=True) + + class TestCorrSpearmanr(TestCase): """ W.II.D. Compute a correlation matrix on all the variables. From scipy-svn at scipy.org Wed Nov 17 15:48:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 17 Nov 2010 14:48:53 -0600 (CST) Subject: [Scipy-svn] r6904 - in trunk/scipy/interpolate: . tests Message-ID: <20101117204853.9F85036388@scipy.org> Author: ptvirtan Date: 2010-11-17 14:48:53 -0600 (Wed, 17 Nov 2010) New Revision: 6904 Modified: trunk/scipy/interpolate/ndgriddata.py trunk/scipy/interpolate/tests/test_ndgriddata.py Log: BUG: interpolate: make griddata work for 1-D data, and add tests for this case Modified: trunk/scipy/interpolate/ndgriddata.py =================================================================== --- trunk/scipy/interpolate/ndgriddata.py 2010-11-17 14:35:25 UTC (rev 6903) +++ trunk/scipy/interpolate/ndgriddata.py 2010-11-17 20:48:53 UTC (rev 6904) @@ -155,11 +155,18 @@ """ points = _ndim_coords_from_arrays(points) - xi = _ndim_coords_from_arrays(xi) - ndim = points.shape[-1] + if points.ndim < 2: + ndim = points.ndim + else: + ndim = points.shape[-1] if ndim == 1 and method in ('nearest', 'linear', 'cubic'): + from interpolate import interp1d + points = points.ravel() + if (isinstance(xi, tuple) or isinstance(xi, list)) \ + and xi and isinstance(xi[0], np.ndarray): + xi, = xi ip = interp1d(points, values, kind=method, axis=0, bounds_error=False, fill_value=fill_value) return ip(xi) Modified: trunk/scipy/interpolate/tests/test_ndgriddata.py =================================================================== --- trunk/scipy/interpolate/tests/test_ndgriddata.py 2010-11-17 14:35:25 UTC (rev 6903) +++ trunk/scipy/interpolate/tests/test_ndgriddata.py 2010-11-17 20:48:53 UTC (rev 6904) @@ -65,5 +65,17 @@ assert_allclose(yi, np.tile(y[:,None], (1, 3)), atol=1e-14, err_msg=method) + def test_1d(self): + x = np.array([1, 2.5, 3, 4.5, 5, 6]) + y = np.array([1, 2, 0, 3.9, 2, 1]) + + for method in ('nearest', 'linear', 'cubic'): + assert_allclose(griddata(x, y, x, method=method), y, + err_msg=method, atol=1e-14) + assert_allclose(griddata(x.reshape(6, 1), y, x, method=method), y, + err_msg=method, atol=1e-14) + assert_allclose(griddata((x,), y, (x,), method=method), y, + err_msg=method, atol=1e-14) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Wed Nov 17 15:49:13 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 17 Nov 2010 14:49:13 -0600 (CST) Subject: [Scipy-svn] r6905 - in trunk/scipy/interpolate: . tests Message-ID: <20101117204913.8BF6037D3AF@scipy.org> Author: ptvirtan Date: 2010-11-17 14:49:13 -0600 (Wed, 17 Nov 2010) New Revision: 6905 Modified: trunk/scipy/interpolate/interpnd.pyx trunk/scipy/interpolate/ndgriddata.py trunk/scipy/interpolate/tests/test_interpnd.py trunk/scipy/interpolate/tests/test_ndgriddata.py Log: ENH: interpolate: allow more natural __call__ usage in N-D interpolants Modified: trunk/scipy/interpolate/interpnd.pyx =================================================================== --- trunk/scipy/interpolate/interpnd.pyx 2010-11-17 20:48:53 UTC (rev 6904) +++ trunk/scipy/interpolate/interpnd.pyx 2010-11-17 20:49:13 UTC (rev 6905) @@ -109,7 +109,7 @@ raise ValueError("number of dimensions in xi does not match x") return xi - def __call__(self, xi): + def __call__(self, *args): """ interpolator(xi) @@ -121,7 +121,7 @@ Points where to interpolate data at. """ - xi = _ndim_coords_from_arrays(xi) + xi = _ndim_coords_from_arrays(args) xi = self._check_call_shape(xi) xi = np.ascontiguousarray(xi.astype(np.double)) shape = xi.shape @@ -139,8 +139,10 @@ Convert a tuple of coordinate arrays to a (..., ndim)-shaped array. """ - if (isinstance(points, tuple) or isinstance(points, list)) \ - and points and isinstance(points[0], np.ndarray): + if isinstance(points, tuple) and len(points) == 1: + # handle argument tuple + points = points[0] + if isinstance(points, tuple): p = np.broadcast_arrays(*points) for j in xrange(1, len(p)): if p[j].shape != p[0].shape: @@ -150,6 +152,8 @@ points[...,j] = item else: points = np.asanyarray(points) + if points.ndim == 1: + points = points.reshape(-1, 1) return points #------------------------------------------------------------------------------ @@ -189,7 +193,7 @@ def __init__(self, points, values, fill_value=np.nan): NDInterpolatorBase.__init__(self, points, values, fill_value=fill_value) - self.tri = qhull.Delaunay(points) + self.tri = qhull.Delaunay(self.points) % for DTYPE, CDTYPE in zip(["double", "complex"], ["double", "double complex"]): @cython.boundscheck(False) @@ -798,7 +802,7 @@ tol=1e-6, maxiter=400): NDInterpolatorBase.__init__(self, points, values, ndim=2, fill_value=fill_value) - self.tri = qhull.Delaunay(points) + self.tri = qhull.Delaunay(self.points) self.grad = estimate_gradients_2d_global(self.tri, self.values, tol=tol, maxiter=maxiter) Modified: trunk/scipy/interpolate/ndgriddata.py =================================================================== --- trunk/scipy/interpolate/ndgriddata.py 2010-11-17 20:48:53 UTC (rev 6904) +++ trunk/scipy/interpolate/ndgriddata.py 2010-11-17 20:49:13 UTC (rev 6905) @@ -45,7 +45,7 @@ self.points = x self.values = y - def __call__(self, xi): + def __call__(self, *args): """ Evaluate interpolator at given points. @@ -55,6 +55,7 @@ Points where to interpolate data at. """ + xi = _ndim_coords_from_arrays(args) xi = self._check_call_shape(xi) dist, i = self.tree.query(xi) return self.values[i] @@ -164,8 +165,9 @@ if ndim == 1 and method in ('nearest', 'linear', 'cubic'): from interpolate import interp1d points = points.ravel() - if (isinstance(xi, tuple) or isinstance(xi, list)) \ - and xi and isinstance(xi[0], np.ndarray): + if isinstance(xi, tuple): + if len(xi) != 1: + raise ValueError("invalid number of dimensions in xi") xi, = xi ip = interp1d(points, values, kind=method, axis=0, bounds_error=False, fill_value=fill_value) Modified: trunk/scipy/interpolate/tests/test_interpnd.py =================================================================== --- trunk/scipy/interpolate/tests/test_interpnd.py 2010-11-17 20:48:53 UTC (rev 6904) +++ trunk/scipy/interpolate/tests/test_interpnd.py 2010-11-17 20:49:13 UTC (rev 6905) @@ -15,6 +15,15 @@ yi = interpnd.LinearNDInterpolator(x, y)(x) assert_almost_equal(y, yi) + def test_smoketest_alternate(self): + # Test at single points, alternate calling convention + x = np.array([(0,0), (-0.5,-0.5), (-0.5,0.5), (0.5, 0.5), (0.25, 0.3)], + dtype=np.double) + y = np.arange(x.shape[0], dtype=np.double) + + yi = interpnd.LinearNDInterpolator((x[:,0], x[:,1]), y)(x[:,0], x[:,1]) + assert_almost_equal(y, yi) + def test_complex_smoketest(self): # Test at single points x = np.array([(0,0), (-0.5,-0.5), (-0.5,0.5), (0.5, 0.5), (0.25, 0.3)], @@ -95,7 +104,7 @@ class TestCloughTocher2DInterpolator(object): - def _check_accuracy(self, func, x=None, tol=1e-6, **kw): + def _check_accuracy(self, func, x=None, tol=1e-6, alternate=False, **kw): np.random.seed(1234) if x is None: x = np.array([(0, 0), (0, 1), @@ -103,11 +112,20 @@ (0.5, 0.2)], dtype=float) - ip = interpnd.CloughTocher2DInterpolator(x, func(x[:,0], x[:,1]), - tol=1e-6) + if not alternate: + ip = interpnd.CloughTocher2DInterpolator(x, func(x[:,0], x[:,1]), + tol=1e-6) + else: + ip = interpnd.CloughTocher2DInterpolator((x[:,0], x[:,1]), + func(x[:,0], x[:,1]), + tol=1e-6) + p = np.random.rand(50, 2) - a = ip(p) + if not alternate: + a = ip(p) + else: + a = ip(p[:,0], p[:,1]) b = func(p[:,0], p[:,1]) try: @@ -129,6 +147,9 @@ for j, func in enumerate(funcs): self._check_accuracy(func, tol=1e-13, atol=1e-7, rtol=1e-7, err_msg="Function %d" % j) + self._check_accuracy(func, tol=1e-13, atol=1e-7, rtol=1e-7, + alternate=True, + err_msg="Function (alternate) %d" % j) def test_quadratic_smoketest(self): # Should be reasonably accurate for quadratic functions Modified: trunk/scipy/interpolate/tests/test_ndgriddata.py =================================================================== --- trunk/scipy/interpolate/tests/test_ndgriddata.py 2010-11-17 20:48:53 UTC (rev 6904) +++ trunk/scipy/interpolate/tests/test_ndgriddata.py 2010-11-17 20:49:13 UTC (rev 6905) @@ -11,7 +11,7 @@ y = [1, 2, 3] yi = griddata(x, y, [(1,1), (1,2), (0,0)], fill_value=-1) - assert_array_equal(yi, [-1, -1, 1]) + assert_array_equal(yi, [-1., -1, 1]) yi = griddata(x, y, [(1,1), (1,2), (0,0)]) assert_array_equal(yi, [np.nan, np.nan, 1]) From scipy-svn at scipy.org Wed Nov 17 15:49:27 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 17 Nov 2010 14:49:27 -0600 (CST) Subject: [Scipy-svn] r6906 - trunk/scipy/interpolate Message-ID: <20101117204927.2067137D3BA@scipy.org> Author: ptvirtan Date: 2010-11-17 14:49:26 -0600 (Wed, 17 Nov 2010) New Revision: 6906 Modified: trunk/scipy/interpolate/interpnd.c Log: GEN: interpolate: regenerate interpnd.c Modified: trunk/scipy/interpolate/interpnd.c =================================================================== --- trunk/scipy/interpolate/interpnd.c 2010-11-17 20:49:13 UTC (rev 6905) +++ trunk/scipy/interpolate/interpnd.c 2010-11-17 20:49:26 UTC (rev 6906) @@ -1829,7 +1829,8 @@ static PyMethodDef __pyx_mdef_8interpnd_18NDInterpolatorBase___call__ = {__Pyx_NAMESTR("__call__"), (PyCFunction)__pyx_pf_8interpnd_18NDInterpolatorBase___call__, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_8interpnd_18NDInterpolatorBase___call__)}; static PyObject *__pyx_pf_8interpnd_18NDInterpolatorBase___call__(PyObject *__pyx_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_self = 0; - PyObject *__pyx_v_xi = 0; + PyObject *__pyx_v_args = 0; + PyObject *__pyx_v_xi; PyObject *__pyx_v_shape; PyObject *__pyx_v_r; PyObject *__pyx_r = NULL; @@ -1838,50 +1839,49 @@ PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,&__pyx_n_s__xi,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__self,0}; __Pyx_RefNannySetupContext("__call__"); __pyx_self = __pyx_self; + if (PyTuple_GET_SIZE(__pyx_args) > 1) { + __pyx_v_args = PyTuple_GetSlice(__pyx_args, 1, PyTuple_GET_SIZE(__pyx_args)); __Pyx_GOTREF(__pyx_v_args); + if (unlikely(!__pyx_v_args)) return NULL; + } else { + __pyx_v_args = __pyx_empty_tuple; __Pyx_INCREF(__pyx_empty_tuple); + } if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); - PyObject* values[2] = {0,0}; + PyObject* values[1] = {0}; switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); + default: case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); case 0: break; - default: goto __pyx_L5_argtuple_error; } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__self); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; - case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xi); - if (likely(values[1])) kw_args--; - else { - __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + const Py_ssize_t used_pos_args = (PyTuple_GET_SIZE(__pyx_args) < 1) ? PyTuple_GET_SIZE(__pyx_args) : 1; + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, used_pos_args, "__call__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; - __pyx_v_xi = values[1]; - } else if (PyTuple_GET_SIZE(__pyx_args) != 2) { + } else if (PyTuple_GET_SIZE(__pyx_args) < 1) { goto __pyx_L5_argtuple_error; } else { __pyx_v_self = PyTuple_GET_ITEM(__pyx_args, 0); - __pyx_v_xi = PyTuple_GET_ITEM(__pyx_args, 1); } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__call__", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__call__", 0, 1, 1, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; + __Pyx_DECREF(__pyx_v_args); __Pyx_AddTraceback("interpnd.NDInterpolatorBase.__call__"); __Pyx_RefNannyFinishContext(); return NULL; __pyx_L4_argument_unpacking_done:; - __Pyx_INCREF(__pyx_v_xi); + __pyx_v_xi = Py_None; __Pyx_INCREF(Py_None); __pyx_v_shape = Py_None; __Pyx_INCREF(Py_None); __pyx_v_r = Py_None; __Pyx_INCREF(Py_None); @@ -1890,9 +1890,9 @@ __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(__pyx_v_xi); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_xi); - __Pyx_GIVEREF(__pyx_v_xi); + __Pyx_INCREF(((PyObject *)__pyx_v_args)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_v_args)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_args)); __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 124; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2075,9 +2075,10 @@ __Pyx_AddTraceback("interpnd.NDInterpolatorBase.__call__"); __pyx_r = NULL; __pyx_L0:; + __Pyx_DECREF(__pyx_v_args); + __Pyx_DECREF(__pyx_v_xi); __Pyx_DECREF(__pyx_v_shape); __Pyx_DECREF(__pyx_v_r); - __Pyx_DECREF(__pyx_v_xi); __Pyx_XGIVEREF(__pyx_r); __Pyx_RefNannyFinishContext(); return __pyx_r; @@ -2093,15 +2094,14 @@ PyObject *__pyx_v_item; PyObject *__pyx_r = NULL; int __pyx_t_1; - int __pyx_t_2; + Py_ssize_t __pyx_t_2; int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - int __pyx_t_5; + int __pyx_t_4; + PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; PyObject *__pyx_t_7 = NULL; Py_ssize_t __pyx_t_8; - Py_ssize_t __pyx_t_9; - PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_9 = NULL; __Pyx_RefNannySetupContext("_ndim_coords_from_arrays"); __pyx_self = __pyx_self; __Pyx_INCREF(__pyx_v_points); @@ -2111,78 +2111,78 @@ __pyx_t_1 = PyTuple_Check(__pyx_v_points); - if (!__pyx_t_1) { - __pyx_t_2 = PyList_Check(__pyx_v_points); - __pyx_t_3 = __pyx_t_2; + if (__pyx_t_1) { + __pyx_t_2 = PyObject_Length(__pyx_v_points); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = (__pyx_t_2 == 1); + __pyx_t_4 = __pyx_t_3; } else { - __pyx_t_3 = __pyx_t_1; + __pyx_t_4 = __pyx_t_1; } - if (__pyx_t_3) { - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_v_points); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_t_1) { - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_points, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 142; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_TypeCheck(__pyx_t_4, ((PyTypeObject *)((PyObject*)__pyx_ptype_5numpy_ndarray))); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_5 = __pyx_t_2; - } else { - __pyx_t_5 = __pyx_t_1; - } - __pyx_t_1 = __pyx_t_5; - } else { - __pyx_t_1 = __pyx_t_3; + if (__pyx_t_4) { + + + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_points, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_v_points); + __pyx_v_points = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L5; } - if (__pyx_t_1) { + __pyx_L5:; + + __pyx_t_4 = PyTuple_Check(__pyx_v_points); + if (__pyx_t_4) { + - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__broadcast_arrays); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__broadcast_arrays); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PySequence_Tuple(__pyx_v_points); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PySequence_Tuple(__pyx_v_points); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_7 = PyObject_Call(__pyx_t_6, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_p); __pyx_v_p = __pyx_t_7; __pyx_t_7 = 0; - __pyx_t_9 = PyObject_Length(__pyx_v_p); if (unlikely(__pyx_t_9 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_9); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Length(__pyx_v_p); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_1); __Pyx_GIVEREF(__pyx_int_1); - PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_7); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_builtin_xrange, __pyx_t_4, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_builtin_xrange, __pyx_t_5, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (PyList_CheckExact(__pyx_t_7) || PyTuple_CheckExact(__pyx_t_7)) { - __pyx_t_8 = 0; __pyx_t_4 = __pyx_t_7; __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = 0; __pyx_t_5 = __pyx_t_7; __Pyx_INCREF(__pyx_t_5); } else { - __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_t_7); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); } __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_7 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_7); __pyx_t_8++; + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_7 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_7 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_7); __pyx_t_2++; } else { - __pyx_t_7 = PyIter_Next(__pyx_t_4); + __pyx_t_7 = PyIter_Next(__pyx_t_5); if (!__pyx_t_7) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_7); @@ -2192,78 +2192,78 @@ __pyx_t_7 = 0; - __pyx_t_7 = PyObject_GetItem(__pyx_v_p, __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetItem(__pyx_v_p, __pyx_v_j); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_10, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_t_9, Py_NE); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - if (__pyx_t_1) { + if (__pyx_t_4) { - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(((PyObject *)__pyx_kp_s_8)); PyTuple_SET_ITEM(__pyx_t_7, 0, ((PyObject *)__pyx_kp_s_8)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_8)); - __pyx_t_10 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); + __pyx_t_9 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_7, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __Pyx_Raise(__pyx_t_10, 0, 0); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L8; + __Pyx_Raise(__pyx_t_9, 0, 0); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L9; } - __pyx_L8:; + __pyx_L9:; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__empty); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_10); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetItemInt(__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__empty); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetItemInt(__pyx_v_p, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_8 = PyObject_Length(__pyx_v_points); if (unlikely(__pyx_t_8 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyInt_FromSsize_t(__pyx_t_8); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_2 = PyObject_Length(__pyx_v_points); if (unlikely(__pyx_t_2 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromSsize_t(__pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_7, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyDict_New(); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); - if (PyDict_SetItem(__pyx_t_4, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_10, __pyx_t_6, ((PyObject *)__pyx_t_4)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)((PyObject*)&PyFloat_Type))) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyEval_CallObjectWithKeywords(__pyx_t_9, __pyx_t_6, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_v_points); __pyx_v_points = __pyx_t_7; __pyx_t_7 = 0; @@ -2272,22 +2272,22 @@ __Pyx_INCREF(__pyx_int_0); __pyx_t_7 = __pyx_int_0; if (PyList_CheckExact(__pyx_v_p) || PyTuple_CheckExact(__pyx_v_p)) { - __pyx_t_8 = 0; __pyx_t_4 = __pyx_v_p; __Pyx_INCREF(__pyx_t_4); + __pyx_t_2 = 0; __pyx_t_5 = __pyx_v_p; __Pyx_INCREF(__pyx_t_5); } else { - __pyx_t_8 = -1; __pyx_t_4 = PyObject_GetIter(__pyx_v_p); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = -1; __pyx_t_5 = PyObject_GetIter(__pyx_v_p); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); } for (;;) { - if (likely(PyList_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_4)) break; - __pyx_t_6 = PyList_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; - } else if (likely(PyTuple_CheckExact(__pyx_t_4))) { - if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_4)) break; - __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_4, __pyx_t_8); __Pyx_INCREF(__pyx_t_6); __pyx_t_8++; + if (likely(PyList_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyList_GET_SIZE(__pyx_t_5)) break; + __pyx_t_6 = PyList_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; + } else if (likely(PyTuple_CheckExact(__pyx_t_5))) { + if (__pyx_t_2 >= PyTuple_GET_SIZE(__pyx_t_5)) break; + __pyx_t_6 = PyTuple_GET_ITEM(__pyx_t_5, __pyx_t_2); __Pyx_INCREF(__pyx_t_6); __pyx_t_2++; } else { - __pyx_t_6 = PyIter_Next(__pyx_t_4); + __pyx_t_6 = PyIter_Next(__pyx_t_5); if (!__pyx_t_6) { - if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} break; } __Pyx_GOTREF(__pyx_t_6); @@ -2298,14 +2298,14 @@ __Pyx_INCREF(__pyx_t_7); __Pyx_DECREF(__pyx_v_j); __pyx_v_j = __pyx_t_7; - __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Add(__pyx_t_7, __pyx_int_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = __pyx_t_6; __pyx_t_6 = 0; - __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); __Pyx_INCREF(Py_Ellipsis); PyTuple_SET_ITEM(__pyx_t_6, 0, Py_Ellipsis); @@ -2313,35 +2313,67 @@ __Pyx_INCREF(__pyx_v_j); PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_v_j); __Pyx_GIVEREF(__pyx_v_j); - if (PyObject_SetItem(__pyx_v_points, __pyx_t_6, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetItem(__pyx_v_points, __pyx_t_6, __pyx_v_item) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 152; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; } - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - goto __pyx_L5; + goto __pyx_L6; } { - __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_INCREF(__pyx_v_points); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_v_points); __Pyx_GIVEREF(__pyx_v_points); - __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyObject_Call(__pyx_t_5, __pyx_t_7, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_6); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(__pyx_v_points); __pyx_v_points = __pyx_t_6; __pyx_t_6 = 0; + + + __pyx_t_6 = PyObject_GetAttr(__pyx_v_points, __pyx_n_s__ndim); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_7 = PyObject_RichCompare(__pyx_t_6, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_7); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + if (__pyx_t_4) { + + + __pyx_t_7 = PyObject_GetAttr(__pyx_v_points, __pyx_n_s__reshape); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_7); + __pyx_t_6 = PyTuple_New(2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_6, 0, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_1); + PyTuple_SET_ITEM(__pyx_t_6, 1, __pyx_int_1); + __Pyx_GIVEREF(__pyx_int_1); + __pyx_t_5 = PyObject_Call(__pyx_t_7, __pyx_t_6, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 156; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_v_points); + __pyx_v_points = __pyx_t_5; + __pyx_t_5 = 0; + goto __pyx_L12; + } + __pyx_L12:; } - __pyx_L5:; + __pyx_L6:; __Pyx_XDECREF(__pyx_r); @@ -2352,10 +2384,10 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_XDECREF(__pyx_t_6); __Pyx_XDECREF(__pyx_t_7); - __Pyx_XDECREF(__pyx_t_10); + __Pyx_XDECREF(__pyx_t_9); __Pyx_AddTraceback("interpnd._ndim_coords_from_arrays"); __pyx_r = NULL; __pyx_L0:; @@ -2406,13 +2438,13 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__points); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { @@ -2421,7 +2453,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_points = values[1]; @@ -2442,7 +2474,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.LinearNDInterpolator.__init__"); __Pyx_RefNannyFinishContext(); @@ -2450,12 +2482,12 @@ __pyx_L4_argument_unpacking_done:; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); @@ -2466,10 +2498,10 @@ __Pyx_INCREF(__pyx_v_values); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_values); __Pyx_GIVEREF(__pyx_v_values); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__fill_value), __pyx_v_fill_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__fill_value), __pyx_v_fill_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -2477,22 +2509,24 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__qhull); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__qhull); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Delaunay); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Delaunay); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_points); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_points); - __Pyx_GIVEREF(__pyx_v_points); - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tri, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tri, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -2609,11 +2643,11 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xi); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_double") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_double") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_xi = ((PyArrayObject *)values[1]); @@ -2625,7 +2659,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.LinearNDInterpolator._evaluate_double"); __Pyx_RefNannyFinishContext(); @@ -2638,24 +2672,24 @@ __pyx_bstruct_points.buf = NULL; __pyx_bstruct_vertices.buf = NULL; __pyx_bstruct_xi.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_xi = __pyx_bstruct_xi.strides[0]; __pyx_bstride_1_xi = __pyx_bstruct_xi.strides[1]; __pyx_bshape_0_xi = __pyx_bstruct_xi.shape[0]; __pyx_bshape_1_xi = __pyx_bstruct_xi.shape[1]; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_values = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_values.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; __pyx_bstride_1_values = __pyx_bstruct_values.strides[1]; __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; __pyx_bshape_1_values = __pyx_bstruct_values.shape[1]; } @@ -2665,15 +2699,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_points.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 197; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 202; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; } @@ -2683,18 +2717,18 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vertices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn_npy_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_vertices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_vertices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 203; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_vertices = __pyx_bstruct_vertices.strides[0]; __pyx_bstride_1_vertices = __pyx_bstruct_vertices.strides[1]; __pyx_bshape_0_vertices = __pyx_bstruct_vertices.shape[0]; __pyx_bshape_1_vertices = __pyx_bstruct_vertices.shape[1]; } @@ -2710,35 +2744,35 @@ __pyx_v_start = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_4); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 211; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_fill_value = __pyx_t_6; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_info = __pyx_f_5scipy_7spatial_5qhull__get_delaunay_info(__pyx_t_4, 1, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -2746,26 +2780,26 @@ __Pyx_GIVEREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__double); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -2782,7 +2816,7 @@ } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 210; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_out)); @@ -2793,29 +2827,29 @@ __pyx_v_nvalues = (__pyx_v_out->dimensions[1]); - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 213; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_v_eps); @@ -2833,7 +2867,7 @@ __pyx_v_i = __pyx_t_11; - __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; __pyx_clineno = __LINE__; goto __pyx_L7;} + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L7;} __pyx_v_isimplex = __pyx_f_5scipy_7spatial_5qhull__find_simplex(__pyx_v_info, __pyx_v_c, (((double *)__pyx_v_xi->data) + (__pyx_v_i * __pyx_v_ndim)), (&__pyx_v_start), __pyx_t_6); @@ -3072,11 +3106,11 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xi); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_complex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_complex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_xi = ((PyArrayObject *)values[1]); @@ -3088,7 +3122,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.LinearNDInterpolator._evaluate_complex"); __Pyx_RefNannyFinishContext(); @@ -3101,24 +3135,24 @@ __pyx_bstruct_points.buf = NULL; __pyx_bstruct_vertices.buf = NULL; __pyx_bstruct_xi.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_xi = __pyx_bstruct_xi.strides[0]; __pyx_bstride_1_xi = __pyx_bstruct_xi.strides[1]; __pyx_bshape_0_xi = __pyx_bstruct_xi.shape[0]; __pyx_bshape_1_xi = __pyx_bstruct_xi.shape[1]; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[2]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_complex_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_values = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_values.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; __pyx_bstride_1_values = __pyx_bstruct_values.strides[1]; __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; __pyx_bshape_1_values = __pyx_bstruct_values.shape[1]; } @@ -3128,15 +3162,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_points.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 246; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; } @@ -3146,18 +3180,18 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_5 = ((PyArrayObject *)__pyx_t_4); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vertices, (PyObject*)__pyx_t_5, &__Pyx_TypeInfo_nn_npy_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_vertices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_vertices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_vertices = __pyx_bstruct_vertices.strides[0]; __pyx_bstride_1_vertices = __pyx_bstruct_vertices.strides[1]; __pyx_bshape_0_vertices = __pyx_bstruct_vertices.shape[0]; __pyx_bshape_1_vertices = __pyx_bstruct_vertices.shape[1]; } @@ -3173,35 +3207,35 @@ __pyx_v_start = 0; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_6 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_4); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 260; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_v_fill_value = __pyx_t_6; - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __pyx_v_info = __pyx_f_5scipy_7spatial_5qhull__get_delaunay_info(__pyx_t_4, 1, 0); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__shape); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_GetItemInt(__pyx_t_8, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(2); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); @@ -3209,26 +3243,26 @@ __Pyx_GIVEREF(__pyx_t_7); __pyx_t_4 = 0; __pyx_t_7 = 0; - __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyTuple_New(1); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); PyTuple_SET_ITEM(__pyx_t_7, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyDict_New(); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_8)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__complex); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__complex); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_8, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_7, ((PyObject *)__pyx_t_8)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_8)); __pyx_t_8 = 0; - if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_9) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_9, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_10 = ((PyArrayObject *)__pyx_t_9); { __Pyx_BufFmt_StackElem __pyx_stack[2]; @@ -3245,7 +3279,7 @@ } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 259; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_11 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 264; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_10 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_out)); @@ -3256,29 +3290,29 @@ __pyx_v_nvalues = (__pyx_v_out->dimensions[1]); - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__finfo); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); - __pyx_t_7 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_GetAttr(__pyx_t_9, __pyx_n_s__double); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_7); __Pyx_GIVEREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyObject_Call(__pyx_t_8, __pyx_t_9, NULL); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_7, __pyx_n_s__eps); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_7); __pyx_t_7 = 0; - __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 262; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = PyNumber_Multiply(__pyx_t_9, __pyx_int_100); if (unlikely(!__pyx_t_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 267; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_7); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_v_eps); @@ -3296,7 +3330,7 @@ __pyx_v_i = __pyx_t_11; - __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 271; __pyx_clineno = __LINE__; goto __pyx_L7;} + __pyx_t_16 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_16 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 276; __pyx_clineno = __LINE__; goto __pyx_L7;} __pyx_v_isimplex = __pyx_f_5scipy_7spatial_5qhull__find_simplex(__pyx_v_info, __pyx_v_c, (((double *)__pyx_v_xi->data) + (__pyx_v_i * __pyx_v_ndim)), (&__pyx_v_start), __pyx_t_16); @@ -3721,7 +3755,7 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__y); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("estimate_gradients_2d_global", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("estimate_gradients_2d_global", 0, 2, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { @@ -3735,7 +3769,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "estimate_gradients_2d_global") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "estimate_gradients_2d_global") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_tri = values[0]; __pyx_v_y = values[1]; @@ -3758,7 +3792,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("estimate_gradients_2d_global", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("estimate_gradients_2d_global", 0, 2, 4, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.estimate_gradients_2d_global"); __Pyx_RefNannyFinishContext(); @@ -3776,17 +3810,17 @@ __pyx_bstruct_grad.buf = NULL; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asanyarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 484; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -3795,51 +3829,51 @@ __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_tri, __pyx_n_s__npoints); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_tri, __pyx_n_s__npoints); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_RichCompare(__pyx_t_1, __pyx_t_3, Py_NE); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 486; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_4) { - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_s_11)); PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_11)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_11)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 487; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__issubdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__issubdtype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__dtype); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__complexfloating); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__complexfloating); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -3847,20 +3881,20 @@ __Pyx_GIVEREF(__pyx_t_5); __pyx_t_3 = 0; __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 489; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__real); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__real); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tri); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tri); @@ -3868,11 +3902,11 @@ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 490; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 495; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3882,11 +3916,11 @@ __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__imag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__imag); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_tri); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_tri); @@ -3894,11 +3928,11 @@ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 491; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_3, __pyx_t_2, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 496; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3908,22 +3942,22 @@ __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_rg, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_rg, __pyx_n_s__shape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject*)&PyComplex_Type)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 492; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), ((PyObject*)&PyComplex_Type)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -3933,10 +3967,10 @@ __pyx_t_3 = 0; - if (PyObject_SetAttr(__pyx_v_r, __pyx_n_s__real, __pyx_v_rg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 493; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_r, __pyx_n_s__real, __pyx_v_rg) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_v_r, __pyx_n_s__imag, __pyx_v_ig) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 494; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_v_r, __pyx_n_s__imag, __pyx_v_ig) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); @@ -3948,26 +3982,26 @@ __pyx_L7:; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 497; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_y_shape); __pyx_v_y_shape = __pyx_t_3; __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__ndim); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_1, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 499; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_4) { - __pyx_t_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -3975,7 +4009,7 @@ PyTuple_SET_ITEM(__pyx_t_3, 1, Py_None); __Pyx_GIVEREF(Py_None); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetItem(__pyx_v_y, __pyx_t_3); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 500; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetItem(__pyx_v_y, __pyx_t_3); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_y); @@ -3986,11 +4020,11 @@ __pyx_L8:; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_tri, __pyx_n_s__npoints); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_tri, __pyx_n_s__npoints); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); @@ -3998,11 +4032,11 @@ PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_int_neg_1); __Pyx_GIVEREF(__pyx_int_neg_1); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 502; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__T); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_y); @@ -4010,34 +4044,34 @@ __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_y); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_y); __Pyx_GIVEREF(__pyx_v_y); - __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 503; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 508; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -4046,22 +4080,22 @@ __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_3, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_y, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetItemInt(__pyx_t_3, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); @@ -4072,12 +4106,12 @@ __Pyx_GIVEREF(__pyx_int_2); __pyx_t_2 = 0; __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 504; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 509; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4086,7 +4120,7 @@ __pyx_t_3 = 0; - if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_y) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_y, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_v_y); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4103,7 +4137,7 @@ } __pyx_bstride_0_data = __pyx_bstruct_data.strides[0]; __pyx_bstride_1_data = __pyx_bstruct_data.strides[1]; __pyx_bshape_0_data = __pyx_bstruct_data.shape[0]; __pyx_bshape_1_data = __pyx_bstruct_data.shape[1]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 506; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_6 = 0; __Pyx_INCREF(__pyx_v_y); @@ -4111,7 +4145,7 @@ __pyx_v_data = ((PyArrayObject *)__pyx_v_y); - if (!(likely(((__pyx_v_yi) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_yi, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_yi) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_yi, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_v_yi); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -4128,7 +4162,7 @@ } __pyx_bstride_0_grad = __pyx_bstruct_grad.strides[0]; __pyx_bstride_1_grad = __pyx_bstruct_grad.strides[1]; __pyx_bstride_2_grad = __pyx_bstruct_grad.strides[2]; __pyx_bshape_0_grad = __pyx_bstruct_grad.shape[0]; __pyx_bshape_1_grad = __pyx_bstruct_grad.shape[1]; __pyx_bshape_2_grad = __pyx_bstruct_grad.shape[2]; - if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 507; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_7 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 512; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_11 = 0; __Pyx_INCREF(__pyx_v_yi); @@ -4152,10 +4186,10 @@ { - __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_maxiter); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L14;} + __pyx_t_13 = __Pyx_PyInt_AsInt(__pyx_v_maxiter); if (unlikely((__pyx_t_13 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L14;} - __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 518; __pyx_clineno = __LINE__; goto __pyx_L14;} + __pyx_t_14 = __pyx_PyFloat_AsDouble(__pyx_v_tol); if (unlikely((__pyx_t_14 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 523; __pyx_clineno = __LINE__; goto __pyx_L14;} __pyx_v_ret = __pyx_f_8interpnd__estimate_gradients_2d_global(__pyx_v_info, (((double *)__pyx_v_data->data) + (__pyx_v_info->npoints * __pyx_v_k)), __pyx_t_13, __pyx_t_14, (((double *)__pyx_v_grad->data) + ((2 * __pyx_v_info->npoints) * __pyx_v_k))); @@ -4179,16 +4213,16 @@ if (__pyx_t_4) { - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__warnings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__warn); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 524; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s_14); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 529; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_s_13)); PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_13)); @@ -4196,7 +4230,7 @@ PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 522; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; @@ -4211,9 +4245,9 @@ __Pyx_XDECREF(__pyx_r); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_yi, __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_yi, __pyx_n_s__transpose); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_int_1); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_int_1); @@ -4224,27 +4258,27 @@ __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__reshape); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_int_2); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_int_2); __Pyx_GIVEREF(__pyx_int_2); - __pyx_t_3 = PyNumber_Add(__pyx_v_y_shape, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Add(__pyx_v_y_shape, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 527; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 532; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -4920,13 +4954,13 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__points); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__values); if (likely(values[2])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { @@ -4945,7 +4979,7 @@ } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_points = values[1]; @@ -4974,7 +5008,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("__init__", 0, 3, 6, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.CloughTocher2DInterpolator.__init__"); __Pyx_RefNannyFinishContext(); @@ -4982,12 +5016,12 @@ __pyx_L4_argument_unpacking_done:; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_self); PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_self); @@ -4998,13 +5032,13 @@ __Pyx_INCREF(__pyx_v_values); PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_values); __Pyx_GIVEREF(__pyx_v_values); - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ndim), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__ndim), __pyx_int_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__fill_value), __pyx_v_fill_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1048; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__fill_value), __pyx_v_fill_value) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1053; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; @@ -5012,53 +5046,55 @@ __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__qhull); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__qhull); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Delaunay); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__Delaunay); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(__pyx_v_points); - PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_v_points); - __Pyx_GIVEREF(__pyx_v_points); - __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tri, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1055; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__tri, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1050; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s_12); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_4 = 0; + __pyx_t_1 = 0; __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__tol), __pyx_v_tol) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__maxiter), __pyx_v_maxiter) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_t_4, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__grad, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyObject_SetAttr(__pyx_v_self, __pyx_n_s__grad, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; @@ -5193,11 +5229,11 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xi); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_double") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_double") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_xi = ((PyArrayObject *)values[1]); @@ -5209,7 +5245,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_double", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.CloughTocher2DInterpolator._evaluate_double"); __Pyx_RefNannyFinishContext(); @@ -5223,24 +5259,24 @@ __pyx_bstruct_points.buf = NULL; __pyx_bstruct_vertices.buf = NULL; __pyx_bstruct_xi.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_xi = __pyx_bstruct_xi.strides[0]; __pyx_bstride_1_xi = __pyx_bstruct_xi.strides[1]; __pyx_bshape_0_xi = __pyx_bstruct_xi.shape[0]; __pyx_bshape_1_xi = __pyx_bstruct_xi.shape[1]; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_values = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_values.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1057; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1062; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; __pyx_bstride_1_values = __pyx_bstruct_values.strides[1]; __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; __pyx_bshape_1_values = __pyx_bstruct_values.shape[1]; } @@ -5250,15 +5286,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__grad); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__grad); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grad, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_grad = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_grad.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1058; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1063; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_grad = __pyx_bstruct_grad.strides[0]; __pyx_bstride_1_grad = __pyx_bstruct_grad.strides[1]; __pyx_bstride_2_grad = __pyx_bstruct_grad.strides[2]; __pyx_bshape_0_grad = __pyx_bstruct_grad.shape[0]; __pyx_bshape_1_grad = __pyx_bstruct_grad.shape[1]; __pyx_bshape_2_grad = __pyx_bstruct_grad.shape[2]; } @@ -5268,15 +5304,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_points.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1060; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1065; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; } @@ -5286,18 +5322,18 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vertices, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn_npy_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_vertices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_vertices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1066; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_vertices = __pyx_bstruct_vertices.strides[0]; __pyx_bstride_1_vertices = __pyx_bstruct_vertices.strides[1]; __pyx_bshape_0_vertices = __pyx_bstruct_vertices.shape[0]; __pyx_bshape_1_vertices = __pyx_bstruct_vertices.shape[1]; } @@ -5313,35 +5349,35 @@ __pyx_v_start = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1072; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_t_5); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1077; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_fill_value = __pyx_t_7; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1074; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_v_info = __pyx_f_5scipy_7spatial_5qhull__get_delaunay_info(__pyx_t_5, 1, 1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -5349,26 +5385,26 @@ __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__double); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_8, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_8, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[1]; @@ -5385,7 +5421,7 @@ } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1076; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1081; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_out)); @@ -5396,29 +5432,29 @@ __pyx_v_nvalues = (__pyx_v_out->dimensions[1]); - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_int_100); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1079; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_int_100); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1084; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_v_eps); @@ -5436,7 +5472,7 @@ __pyx_v_i = __pyx_t_12; - __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1087; __pyx_clineno = __LINE__; goto __pyx_L7;} + __pyx_t_7 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_7 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1092; __pyx_clineno = __LINE__; goto __pyx_L7;} __pyx_v_isimplex = __pyx_f_5scipy_7spatial_5qhull__find_simplex(__pyx_v_info, __pyx_v_c, (((double *)__pyx_v_xi->data) + (__pyx_v_i * __pyx_v_ndim)), (&__pyx_v_start), __pyx_t_7); @@ -5722,11 +5758,11 @@ values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__xi); if (likely(values[1])) kw_args--; else { - __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } } if (unlikely(kw_args > 0)) { - if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_complex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "_evaluate_complex") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_self = values[0]; __pyx_v_xi = ((PyArrayObject *)values[1]); @@ -5738,7 +5774,7 @@ } goto __pyx_L4_argument_unpacking_done; __pyx_L5_argtuple_error:; - __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __Pyx_RaiseArgtupleInvalid("_evaluate_complex", 1, 2, 2, PyTuple_GET_SIZE(__pyx_args)); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L3_error;} __pyx_L3_error:; __Pyx_AddTraceback("interpnd.CloughTocher2DInterpolator._evaluate_complex"); __Pyx_RefNannyFinishContext(); @@ -5752,24 +5788,24 @@ __pyx_bstruct_points.buf = NULL; __pyx_bstruct_vertices.buf = NULL; __pyx_bstruct_xi.buf = NULL; - if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_xi), __pyx_ptype_5numpy_ndarray, 1, "xi", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} { __Pyx_BufFmt_StackElem __pyx_stack[1]; - if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xi, (PyObject*)__pyx_v_xi, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_bstride_0_xi = __pyx_bstruct_xi.strides[0]; __pyx_bstride_1_xi = __pyx_bstruct_xi.strides[1]; __pyx_bshape_0_xi = __pyx_bstruct_xi.shape[0]; __pyx_bshape_1_xi = __pyx_bstruct_xi.shape[1]; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[2]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_values, (PyObject*)__pyx_t_2, &__Pyx_TypeInfo_nn___pyx_t_5numpy_complex_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_values = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_values.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1113; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_values = __pyx_bstruct_values.strides[0]; __pyx_bstride_1_values = __pyx_bstruct_values.strides[1]; __pyx_bshape_0_values = __pyx_bstruct_values.shape[0]; __pyx_bshape_1_values = __pyx_bstruct_values.shape[1]; } @@ -5779,15 +5815,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__grad); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__grad); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_3 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[2]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_grad, (PyObject*)__pyx_t_3, &__Pyx_TypeInfo_nn___pyx_t_5numpy_complex_t, PyBUF_FORMAT| PyBUF_STRIDES, 3, 0, __pyx_stack) == -1)) { __pyx_v_grad = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_grad.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1114; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_grad = __pyx_bstruct_grad.strides[0]; __pyx_bstride_1_grad = __pyx_bstruct_grad.strides[1]; __pyx_bstride_2_grad = __pyx_bstruct_grad.strides[2]; __pyx_bshape_0_grad = __pyx_bstruct_grad.shape[0]; __pyx_bshape_1_grad = __pyx_bstruct_grad.shape[1]; __pyx_bshape_2_grad = __pyx_bstruct_grad.shape[2]; } @@ -5797,15 +5833,15 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__points); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = ((PyArrayObject *)__pyx_t_1); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_points, (PyObject*)__pyx_t_4, &__Pyx_TypeInfo_nn___pyx_t_5numpy_double_t, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_points = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_points.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_points = __pyx_bstruct_points.strides[0]; __pyx_bstride_1_points = __pyx_bstruct_points.strides[1]; __pyx_bshape_0_points = __pyx_bstruct_points.shape[0]; __pyx_bshape_1_points = __pyx_bstruct_points.shape[1]; } @@ -5815,18 +5851,18 @@ __pyx_t_1 = 0; - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__vertices); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_6 = ((PyArrayObject *)__pyx_t_5); { __Pyx_BufFmt_StackElem __pyx_stack[1]; if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_vertices, (PyObject*)__pyx_t_6, &__Pyx_TypeInfo_nn_npy_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { __pyx_v_vertices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_vertices.buf = NULL; - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1122; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } else {__pyx_bstride_0_vertices = __pyx_bstruct_vertices.strides[0]; __pyx_bstride_1_vertices = __pyx_bstruct_vertices.strides[1]; __pyx_bshape_0_vertices = __pyx_bstruct_vertices.shape[0]; __pyx_bshape_1_vertices = __pyx_bstruct_vertices.shape[1]; } @@ -5842,35 +5878,35 @@ __pyx_v_start = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__fill_value); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_7 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1128; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = __Pyx_PyComplex_As___pyx_t_double_complex(__pyx_t_5); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1133; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_v_fill_value = __pyx_t_7; - __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__tri); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __pyx_v_info = __pyx_f_5scipy_7spatial_5qhull__get_delaunay_info(__pyx_t_5, 1, 1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__zeros); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_PyInt_to_py_Py_intptr_t((__pyx_v_xi->dimensions[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_v_self, __pyx_n_s__values); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__shape); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = __Pyx_GetItemInt(__pyx_t_9, 1, sizeof(long), PyInt_FromLong); if (!__pyx_t_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyTuple_New(2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); @@ -5878,26 +5914,26 @@ __Pyx_GIVEREF(__pyx_t_8); __pyx_t_5 = 0; __pyx_t_8 = 0; - __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyTuple_New(1); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); PyTuple_SET_ITEM(__pyx_t_8, 0, __pyx_t_9); __Pyx_GIVEREF(__pyx_t_9); __pyx_t_9 = 0; - __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyDict_New(); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_9)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__complex); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__complex); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_9, ((PyObject *)__pyx_n_s__dtype), __pyx_t_10) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_8, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_8, ((PyObject *)__pyx_t_9)); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_9)); __pyx_t_9 = 0; - if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); { __Pyx_BufFmt_StackElem __pyx_stack[2]; @@ -5914,7 +5950,7 @@ } __pyx_bstride_0_out = __pyx_bstruct_out.strides[0]; __pyx_bstride_1_out = __pyx_bstruct_out.strides[1]; __pyx_bshape_0_out = __pyx_bstruct_out.shape[0]; __pyx_bshape_1_out = __pyx_bstruct_out.shape[1]; - if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1137; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_t_11 = 0; __Pyx_DECREF(((PyObject *)__pyx_v_out)); @@ -5925,29 +5961,29 @@ __pyx_v_nvalues = (__pyx_v_out->dimensions[1]); - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__finfo); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_9); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); - __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_GetAttr(__pyx_t_10, __pyx_n_s__double); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyTuple_New(1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); PyTuple_SET_ITEM(__pyx_t_10, 0, __pyx_t_8); __Pyx_GIVEREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyObject_Call(__pyx_t_9, __pyx_t_10, NULL); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; - __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__eps); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_10); __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; - __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_int_100); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_8 = PyNumber_Multiply(__pyx_t_10, __pyx_int_100); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1140; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_8); __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; __Pyx_DECREF(__pyx_v_eps); @@ -5965,7 +6001,7 @@ __pyx_v_i = __pyx_t_12; - __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1143; __pyx_clineno = __LINE__; goto __pyx_L7;} + __pyx_t_17 = __pyx_PyFloat_AsDouble(__pyx_v_eps); if (unlikely((__pyx_t_17 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1148; __pyx_clineno = __LINE__; goto __pyx_L7;} __pyx_v_isimplex = __pyx_f_5scipy_7spatial_5qhull__find_simplex(__pyx_v_info, __pyx_v_c, (((double *)__pyx_v_xi->data) + (__pyx_v_i * __pyx_v_ndim)), (&__pyx_v_start), __pyx_t_17); @@ -7442,14 +7478,14 @@ }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_object = __Pyx_GetName(__pyx_b, __pyx_n_s__object); if (!__pyx_builtin_object) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 50; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_Warning = __Pyx_GetName(__pyx_b, __pyx_n_s__Warning); if (!__pyx_builtin_Warning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_Warning = __Pyx_GetName(__pyx_b, __pyx_n_s__Warning); if (!__pyx_builtin_Warning) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 97; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION >= 3 - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #else - __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_xrange = __Pyx_GetName(__pyx_b, __pyx_n_s__xrange); if (!__pyx_builtin_xrange) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #endif - __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_enumerate = __Pyx_GetName(__pyx_b, __pyx_n_s__enumerate); if (!__pyx_builtin_enumerate) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 787; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; @@ -7638,99 +7674,99 @@ __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); __Pyx_GIVEREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_27)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = __Pyx_CreateClass(__pyx_t_5, ((PyObject *)__pyx_t_3), __pyx_n_s_28, "interpnd"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_27)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_CreateClass(__pyx_t_5, ((PyObject *)__pyx_t_3), __pyx_n_s_28, "interpnd"); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __pyx_k_9 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyMethod_New(__pyx_t_2, 0, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyMethod_New(__pyx_t_2, 0, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s____init__, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s____init__, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator__evaluate_double, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator__evaluate_double, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_2 = PyMethod_New(__pyx_t_5, 0, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyMethod_New(__pyx_t_5, 0, __pyx_t_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s___evaluate_double, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s___evaluate_double, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator__evaluate_complex, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_20LinearNDInterpolator__evaluate_complex, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyMethod_New(__pyx_t_2, 0, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyMethod_New(__pyx_t_2, 0, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s___evaluate_complex, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 243; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_4, __pyx_n_s___evaluate_complex, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 248; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_28, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(__pyx_builtin_Warning); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_builtin_Warning); __Pyx_GIVEREF(__pyx_builtin_Warning); - __pyx_t_5 = __Pyx_CreateClass(__pyx_t_4, ((PyObject *)__pyx_t_3), __pyx_n_s_14, "interpnd"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_CreateClass(__pyx_t_4, ((PyObject *)__pyx_t_3), __pyx_n_s_14, "interpnd"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_14, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 300; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_14, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 305; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 478; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 483; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_k_10 = __pyx_t_3; __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__NDInterpolatorBase); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); __Pyx_GIVEREF(__pyx_t_5); __pyx_t_5 = 0; - if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_29)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = __Pyx_CreateClass(__pyx_t_4, ((PyObject *)__pyx_t_3), __pyx_n_s_30, "interpnd"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItemString(((PyObject *)__pyx_t_3), "__doc__", ((PyObject *)__pyx_kp_s_29)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = __Pyx_CreateClass(__pyx_t_4, ((PyObject *)__pyx_t_3), __pyx_n_s_30, "interpnd"); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__nan); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_k_15 = __pyx_t_2; @@ -7738,39 +7774,39 @@ __pyx_t_2 = 0; - __pyx_t_2 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1047; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(1e-6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1052; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_k_16 = __pyx_t_2; __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator___init__, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1046; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s____init__, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1051; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator__evaluate_double, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator__evaluate_double, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyMethod_New(__pyx_t_4, 0, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s___evaluate_double, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1056; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s___evaluate_double, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1061; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator__evaluate_complex, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyCFunction_New(&__pyx_mdef_8interpnd_26CloughTocher2DInterpolator__evaluate_complex, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyMethod_New(__pyx_t_2, 0, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s___evaluate_complex, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_t_5, __pyx_n_s___evaluate_complex, __pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (PyObject_SetAttr(__pyx_m, __pyx_n_s_30, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 986; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s_30, __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 991; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; From scipy-svn at scipy.org Thu Nov 18 06:40:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 18 Nov 2010 05:40:53 -0600 (CST) Subject: [Scipy-svn] r6907 - trunk/scipy/stats/tests Message-ID: <20101118114053.9C5D33233E@scipy.org> Author: rgommers Date: 2010-11-18 05:40:52 -0600 (Thu, 18 Nov 2010) New Revision: 6907 Modified: trunk/scipy/stats/tests/test_stats.py Log: TST: clean up fisher_exact test. An unused for-loop was left in. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-17 20:49:26 UTC (rev 6906) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-18 11:40:52 UTC (rev 6907) @@ -416,36 +416,24 @@ res = fisher_exact([[19000, 80000], [20000, 90000]])[1] assert_approx_equal(res, 3.319e-9, significant=1) - tablelist = ( [[100, 2], [1000, 5]], - [[2, 7], [8, 2]], - [[5, 1], [10, 10]], - [[5, 15], [20, 20]], - [[5, 16], [20, 25]], - [[10, 5], [10, 1]], - [[10, 5], [10, 0]], - [[5,0], [1, 4]], - [[0,5], [1, 4]], - [[5,1], [0, 4]], - [[0, 1], [3, 2]] ) - for table in tablelist: - # results from R - # - # R defines oddsratio differently (see Notes section of fisher_exact - # docstring), so those will not match. We leave them in anyway, in - # case they will be useful later on. We test only the p-value. - tablist = [ - ([[100, 2], [1000, 5]], (2.505583993422285e-001, 1.300759363430016e-001)), - ([[2, 7], [8, 2]], (8.586235135736206e-002, 2.301413756522114e-002)), - ([[5, 1], [10, 10]], (4.725646047336584e+000, 1.973244147157190e-001)), - ([[5, 15], [20, 20]], (3.394396617440852e-001, 9.580440012477637e-002)), - ([[5, 16], [20, 25]], (3.960558326183334e-001, 1.725864953812994e-001)), - ([[10, 5], [10, 1]], (2.116112781158483e-001, 1.973244147157190e-001)), - ([[10, 5], [10, 0]], (0.000000000000000e+000, 6.126482213438734e-002)), - ([[5, 0], [1, 4]], (np.inf, 4.761904761904762e-002)), - ([[0, 5], [1, 4]], (0.000000000000000e+000, 1.000000000000000e+000)), - ([[5, 1], [0, 4]], (np.inf, 4.761904761904758e-002)), - ([[0, 1], [3, 2]], (0.000000000000000e+000, 1.000000000000000e+000)) - ] + # results from R + # + # R defines oddsratio differently (see Notes section of fisher_exact + # docstring), so those will not match. We leave them in anyway, in + # case they will be useful later on. We test only the p-value. + tablist = [ + ([[100, 2], [1000, 5]], (2.505583993422285e-001, 1.300759363430016e-001)), + ([[2, 7], [8, 2]], (8.586235135736206e-002, 2.301413756522114e-002)), + ([[5, 1], [10, 10]], (4.725646047336584e+000, 1.973244147157190e-001)), + ([[5, 15], [20, 20]], (3.394396617440852e-001, 9.580440012477637e-002)), + ([[5, 16], [20, 25]], (3.960558326183334e-001, 1.725864953812994e-001)), + ([[10, 5], [10, 1]], (2.116112781158483e-001, 1.973244147157190e-001)), + ([[10, 5], [10, 0]], (0.000000000000000e+000, 6.126482213438734e-002)), + ([[5, 0], [1, 4]], (np.inf, 4.761904761904762e-002)), + ([[0, 5], [1, 4]], (0.000000000000000e+000, 1.000000000000000e+000)), + ([[5, 1], [0, 4]], (np.inf, 4.761904761904758e-002)), + ([[0, 1], [3, 2]], (0.000000000000000e+000, 1.000000000000000e+000)) + ] for table, res_r in tablist: res = fisher_exact(np.asarray(table)) np.testing.assert_almost_equal(res[1], res_r[1], decimal=11, From scipy-svn at scipy.org Fri Nov 19 23:36:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 19 Nov 2010 22:36:40 -0600 (CST) Subject: [Scipy-svn] r6908 - trunk/scipy/integrate Message-ID: <20101120043640.51B6037C3ED@scipy.org> Author: warren.weckesser Date: 2010-11-19 22:36:39 -0600 (Fri, 19 Nov 2010) New Revision: 6908 Modified: trunk/scipy/integrate/ode.py trunk/scipy/integrate/quadpack.py trunk/scipy/integrate/quadrature.py Log: ENH: integrate: update 'raise' statements. Modified: trunk/scipy/integrate/ode.py =================================================================== --- trunk/scipy/integrate/ode.py 2010-11-18 11:40:52 UTC (rev 6907) +++ trunk/scipy/integrate/ode.py 2010-11-20 04:36:39 UTC (rev 6908) @@ -444,18 +444,18 @@ Return 2-tuple (y1,t1) where y1 is the result and t=t1 defines the stoppage coordinate of the result. """ - raise NotImplementedError,\ - 'all integrators must define run(f,jac,t0,t1,y0,f_params,jac_params)' + raise NotImplementedError('all integrators must define ' + 'run(f,jac,t0,t1,y0,f_params,jac_params)') def step(self,f,jac,y0,t0,t1,f_params,jac_params): """Make one integration step and return (y1,t1).""" - raise NotImplementedError,'%s does not support step() method' %\ - (self.__class__.__name__) + raise NotImplementedError('%s does not support step() method' % + self.__class__.__name__) def run_relax(self,f,jac,y0,t0,t1,f_params,jac_params): """Integrate from t=t0 to t>=t1 and return (y1,t).""" - raise NotImplementedError,'%s does not support run_relax() method' %\ - (self.__class__.__name__) + raise NotImplementedError('%s does not support run_relax() method' % + self.__class__.__name__) #XXX: __str__ method for getting visual state of the integrator Modified: trunk/scipy/integrate/quadpack.py =================================================================== --- trunk/scipy/integrate/quadpack.py 2010-11-18 11:40:52 UTC (rev 6907) +++ trunk/scipy/integrate/quadpack.py 2010-11-20 04:36:39 UTC (rev 6908) @@ -285,7 +285,7 @@ print "Warning: " + msg return retval[:-1] else: - raise ValueError, msg + raise ValueError(msg) def _quad(func,a,b,args,full_output,epsabs,epsrel,limit,points): @@ -302,7 +302,7 @@ infbounds = -1 bound = b else: - raise RuntimeError, "Infinity comparisons don't work for you." + raise RuntimeError("Infinity comparisons don't work for you.") if points is None: if infbounds == 0: @@ -311,7 +311,7 @@ return _quadpack._qagie(func,bound,infbounds,args,full_output,epsabs,epsrel,limit) else: if infbounds !=0: - raise ValueError, "Infinity inputs cannot be used with break points." + raise ValueError("Infinity inputs cannot be used with break points.") else: nl = len(points) the_points = numpy.zeros((nl+2,), float) @@ -322,7 +322,7 @@ def _quad_weight(func,a,b,args,full_output,epsabs,epsrel,limlst,limit,maxp1,weight,wvar,wopts): if weight not in ['cos','sin','alg','alg-loga','alg-logb','alg-log','cauchy']: - raise ValueError, "%s not a recognized weighting function." % weight + raise ValueError("%s not a recognized weighting function." % weight) strdict = {'cos':1,'sin':2,'alg':1,'alg-loga':2,'alg-logb':3,'alg-log':4} @@ -354,10 +354,10 @@ args = (func,) + args return _quadpack._qawfe(thefunc,-b,wvar,integr,args,full_output,epsabs,limlst,limit,maxp1) else: - raise ValueError, "Cannot integrate with this weight from -Inf to +Inf." + raise ValueError("Cannot integrate with this weight from -Inf to +Inf.") else: if a in [-Inf,Inf] or b in [-Inf,Inf]: - raise ValueError, "Cannot integrate with this weight over an infinite interval." + raise ValueError("Cannot integrate with this weight over an infinite interval.") if weight[:3] == 'alg': integr = strdict[weight] Modified: trunk/scipy/integrate/quadrature.py =================================================================== --- trunk/scipy/integrate/quadrature.py 2010-11-18 11:40:52 UTC (rev 6907) +++ trunk/scipy/integrate/quadrature.py 2010-11-20 04:36:39 UTC (rev 6908) @@ -52,8 +52,8 @@ x = real(x) ainf, binf = map(isinf,(a,b)) if ainf or binf: - raise ValueError, "Gaussian quadrature is only available for " \ - "finite limits." + raise ValueError("Gaussian quadrature is only available for " + "finite limits.") y = (b-a)*(x+1)/2.0 + a return (b-a)/2.0*sum(w*func(y,*args),0), None @@ -317,19 +317,18 @@ returnshape = 1 x=x.reshape(tuple(shapex)) elif len(x.shape) != len(y.shape): - raise ValueError, "If given, shape of x must be 1-d or the " \ - "same as y." + raise ValueError("If given, shape of x must be 1-d or the " + "same as y.") if x.shape[axis] != N: - raise ValueError, "If given, length of x along axis must be the " \ - "same as y." + raise ValueError("If given, length of x along axis must be the " + "same as y.") if N % 2 == 0: val = 0.0 result = 0.0 slice1 = (slice(None),)*nd slice2 = (slice(None),)*nd if not even in ['avg', 'last', 'first']: - raise ValueError, \ - "Parameter 'even' must be 'avg', 'last', or 'first'." + raise ValueError("Parameter 'even' must be 'avg', 'last', or 'first'.") # Compute using Simpson's rule on first intervals if even in ['avg', 'first']: slice1 = tupleset(slice1, axis, -1) @@ -400,8 +399,8 @@ n <<= 1 k += 1 if n != Ninterv: - raise ValueError, \ - "Number of samples must be one plus a non-negative power of 2." + raise ValueError("Number of samples must be one plus a " + "non-negative power of 2.") R = {} all = (slice(None),) * nd @@ -737,8 +736,8 @@ return na*np.array(vi,float)/da, float(nb)/db if (rn[0] != 0) or (rn[-1] != N): - raise ValueError, "The sample positions must start at 0"\ - " and end at N" + raise ValueError("The sample positions must start at 0" + " and end at N") yi = rn / float(N) ti = 2.0*yi - 1 nvec = np.arange(0,N+1) From scipy-svn at scipy.org Fri Nov 19 23:44:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 19 Nov 2010 22:44:53 -0600 (CST) Subject: [Scipy-svn] r6909 - trunk/scipy/cluster Message-ID: <20101120044453.BA7C437C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-19 22:44:53 -0600 (Fri, 19 Nov 2010) New Revision: 6909 Modified: trunk/scipy/cluster/vq.py Log: ENH: cluster: update 'raise' statements Modified: trunk/scipy/cluster/vq.py =================================================================== --- trunk/scipy/cluster/vq.py 2010-11-20 04:36:39 UTC (rev 6908) +++ trunk/scipy/cluster/vq.py 2010-11-20 04:44:53 UTC (rev 6909) @@ -488,7 +488,7 @@ """ if int(iter) < 1: - raise ValueError, 'iter must be >= to 1.' + raise ValueError('iter must be at least 1.') if type(k_or_guess) == type(array([])): guess = k_or_guess if guess.size < 1: @@ -584,8 +584,8 @@ def _missing_raise(): """raise a ClusterError when called.""" - raise ClusterError, "One of the clusters is empty. "\ - "Re-run kmean with a different initialization." + raise ClusterError("One of the clusters is empty. " + "Re-run kmean with a different initialization.") _valid_miss_meth = {'warn': _missing_warn, 'raise': _missing_raise} From scipy-svn at scipy.org Fri Nov 19 23:49:44 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 19 Nov 2010 22:49:44 -0600 (CST) Subject: [Scipy-svn] r6910 - trunk/scipy/fftpack Message-ID: <20101120044944.C6C1437C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-19 22:49:44 -0600 (Fri, 19 Nov 2010) New Revision: 6910 Modified: trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/realtransforms.py Log: ENH: fftpack: update 'raise' statements (and remove unused imports) Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2010-11-20 04:44:53 UTC (rev 6909) +++ trunk/scipy/fftpack/basic.py 2010-11-20 04:49:44 UTC (rev 6910) @@ -6,7 +6,7 @@ __all__ = ['fft','ifft','fftn','ifftn','rfft','irfft', 'fft2','ifft2'] -from numpy import zeros, swapaxes, integer, array +from numpy import zeros, swapaxes import numpy import _fftpack @@ -316,7 +316,7 @@ tmp = _asfarray(x) if not numpy.isrealobj(tmp): - raise TypeError,"1st argument must be real sequence" + raise TypeError("1st argument must be real sequence") try: work_function = _DTYPE_TO_RFFT[tmp.dtype] @@ -349,7 +349,7 @@ """ tmp = _asfarray(x) if not numpy.isrealobj(tmp): - raise TypeError,"1st argument must be real sequence" + raise TypeError("1st argument must be real sequence") try: work_function = _DTYPE_TO_RFFT[tmp.dtype] Modified: trunk/scipy/fftpack/realtransforms.py =================================================================== --- trunk/scipy/fftpack/realtransforms.py 2010-11-20 04:44:53 UTC (rev 6909) +++ trunk/scipy/fftpack/realtransforms.py 2010-11-20 04:49:44 UTC (rev 6910) @@ -180,7 +180,7 @@ """ tmp = np.asarray(x) if not np.isrealobj(tmp): - raise TypeError,"1st argument must be real sequence" + raise TypeError("1st argument must be real sequence") if n is None: n = tmp.shape[axis] From scipy-svn at scipy.org Sat Nov 20 00:29:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 19 Nov 2010 23:29:02 -0600 (CST) Subject: [Scipy-svn] r6911 - trunk/scipy/interpolate Message-ID: <20101120052902.2A46237C3DD@scipy.org> Author: warren.weckesser Date: 2010-11-19 23:29:02 -0600 (Fri, 19 Nov 2010) New Revision: 6911 Modified: trunk/scipy/interpolate/fitpack.py trunk/scipy/interpolate/fitpack2.py trunk/scipy/interpolate/interpolate.py trunk/scipy/interpolate/interpolate_wrapper.py trunk/scipy/interpolate/rbf.py Log: ENH: interpolate: update 'raise' statements (plus a little clean up) Modified: trunk/scipy/interpolate/fitpack.py =================================================================== --- trunk/scipy/interpolate/fitpack.py 2010-11-20 04:49:44 UTC (rev 6910) +++ trunk/scipy/interpolate/fitpack.py 2010-11-20 05:29:02 UTC (rev 6911) @@ -60,7 +60,7 @@ 10:["""\ Error on input data""",ValueError], 'unknown':["""\ - An error occured""",TypeError]} + An error occurred""",TypeError]} _iermess2 = {0:["""\ The spline has a residual sum of squares fp such that abs(fp-s)/s<=0.001""",None], @@ -212,10 +212,13 @@ if x[i][0]!=x[i][-1]: if quiet<2:print 'Warning: Setting x[%d][%d]=x[%d][0]'%(i,m,i) x[i][-1]=x[i][0] - if not 0k must hold' + raise TypeError('There must be at least 2*k+2 knots for task=-1') + if m <= k: + raise TypeError('m > k must hold') if nest is None: nest=m+2*k if (task>=0 and s==0) or (nest<0): @@ -267,9 +274,9 @@ print "Warning: "+_iermess[ier][0] else: try: - raise _iermess[ier][1],_iermess[ier][0] + raise _iermess[ier][1](_iermess[ier][0]) except KeyError: - raise _iermess['unknown'][1],_iermess['unknown'][0] + raise _iermess['unknown'][1](_iermess['unknown'][0]) if full_output: try: return tcku,fp,ier,_iermess[ier][0] @@ -403,19 +410,23 @@ else: w=myasarray(w) if s is None: s = m-sqrt(2*m) - if not len(w) == m: raise TypeError,' len(w)=%d is not equal to m=%d'%(len(w),m) + if not len(w) == m: + raise TypeError('len(w)=%d is not equal to m=%d' % (len(w),m)) if (m != len(y)) or (m != len(w)): - raise TypeError, 'Lengths of the first three arguments (x,y,w) must be equal' - if not (1<=k<=5): - raise TypeError, 'Given degree of the spline (k=%d) is not supported. (1<=k<=5)'%(k) - if m<=k: raise TypeError, 'm>k must hold' + raise TypeError('Lengths of the first three arguments (x,y,w) must be equal') + if not (1 <= k <= 5): + raise TypeError('Given degree of the spline (k=%d) is not supported. (1<=k<=5)' % k) + if m <= k: + raise TypeError('m > k must hold') if xb is None: xb=x[0] if xe is None: xe=x[-1] - if not (-1<=task<=1): raise TypeError, 'task must be either -1,0, or 1' + if not (-1 <= task <= 1): + raise TypeError('task must be -1, 0 or 1') if t is not None: task = -1 if task == -1: - if t is None: raise TypeError, 'Knots must be given for task=-1' + if t is None: + raise TypeError('Knots must be given for task=-1') numknots = len(t) _curfit_cache['t'] = empty((numknots + 2*k+2,),float) _curfit_cache['t'][k+1:-k-1] = t @@ -436,8 +447,8 @@ wrk=_curfit_cache['wrk'] iwrk=_curfit_cache['iwrk'] except KeyError: - raise TypeError, "must call with task=1 only after"\ - " call with task=0,-1" + raise TypeError("must call with task=1 only after" + " call with task=0,-1") if not per: n,c,fp,ier = dfitpack.curfit(task, x, y, w, t, wrk, iwrk, xb, xe, k, s) else: @@ -451,9 +462,9 @@ print "Warning: "+_iermess[ier][0] else: try: - raise _iermess[ier][1],_iermess[ier][0] + raise _iermess[ier][1](_iermess[ier][0]) except KeyError: - raise _iermess['unknown'][1],_iermess['unknown'][0] + raise _iermess['unknown'][1](_iermess['unknown'][0]) if full_output: try: return tck,fp,ier,_iermess[ier][0] @@ -648,15 +659,15 @@ return _ntlist(map(lambda c,t=t,k=k,mest=mest:sproot([t,c,k],mest),c)) else: if len(t)<8: - raise TypeError,"The number of knots %d>=8"%(len(t)) + raise TypeError("The number of knots %d>=8" % len(t)) z,ier=_fitpack._sproot(t,c,k,mest) if ier==10: - raise TypeError,"Invalid input data. t1<=..<=t4=(kx+1)(ky+1) must hold' + raise TypeError('Given degree of the spline (kx,ky=%d,%d) is not supported. (1<=k<=5)' % (kx,ky)) + if m<(kx+1)*(ky+1): + raise TypeError('m >= (kx+1)(ky+1) must hold') if nxest is None: nxest=kx+sqrt(m/2) if nyest is None: nyest=ky+sqrt(m/2) nxest,nyest=max(nxest,2*kx+3),max(nyest,2*ky+3) @@ -872,9 +889,9 @@ len(ty),m,fp,s) else: try: - raise _iermess2[ierm][1],_iermess2[ierm][0] + raise _iermess2[ierm][1](_iermess2[ierm][0]) except KeyError: - raise _iermess2['unknown'][1],_iermess2['unknown'][0] + raise _iermess2['unknown'][1](_iermess2['unknown'][0]) if full_output: try: return tck,fp,ier,_iermess2[ierm][0] @@ -932,14 +949,18 @@ """ tx,ty,c,kx,ky=tck - if not (0<=dx1: return z if len(z[0])>1: return z[0] @@ -1026,8 +1047,10 @@ return (tt, cc, kk) else: tt, cc, ier = _fitpack._insert(per, t, c, k, x, m) - if ier==10: raise ValueError,"Invalid input data" - if ier: raise TypeError,"An error occurred" + if ier==10: + raise ValueError("Invalid input data") + if ier: + raise TypeError("An error occurred") return (tt, cc, k) if __name__ == "__main__": Modified: trunk/scipy/interpolate/fitpack2.py =================================================================== --- trunk/scipy/interpolate/fitpack2.py 2010-11-20 04:49:44 UTC (rev 6910) +++ trunk/scipy/interpolate/fitpack2.py 2010-11-20 05:29:02 UTC (rev 6911) @@ -266,8 +266,8 @@ z,m,ier = dfitpack.sproot(*self._eval_args[:2]) assert ier==0,`ier` return z[:m] - raise NotImplementedError,\ - 'finding roots unsupported for non-cubic splines' + raise NotImplementedError('finding roots unsupported for ' + 'non-cubic splines') class InterpolatedUnivariateSpline(UnivariateSpline): """ @@ -422,8 +422,8 @@ t = concatenate(([xb]*(k+1),t,[xe]*(k+1))) n = len(t) if not alltrue(t[k+1:n-k]-t[k:n-k-1] > 0,axis=0): - raise ValueError,\ - 'Interior knots t must satisfy Schoenberg-Whitney conditions' + raise ValueError('Interior knots t must satisfy ' + 'Schoenberg-Whitney conditions') data = dfitpack.fpcurfm1(x,y,k,t,w=w,xb=xb,xe=xe) self._data = data[:-3] + (None,None,data[-1]) self._reset_class() @@ -520,7 +520,7 @@ z,ier = dfitpack.bispev(tx,ty,c,kx,ky,x,y) assert ier==0,'Invalid input: ier='+`ier` return z - raise NotImplementedError + raise NotImplementedError('unknown method mth=%s' % mth) def ev(self, xi, yi): """ @@ -707,19 +707,19 @@ def __init__(self, x, y, z, bbox = [None]*4, kx=3, ky=3, s=0): x,y = ravel(x),ravel(y) if not all(diff(x) > 0.0): - raise TypeError,'x must be strictly increasing' + raise TypeError('x must be strictly increasing') if not all(diff(y) > 0.0): - raise TypeError,'y must be strictly increasing' + raise TypeError('y must be strictly increasing') if not ((x.min() == x[0]) and (x.max() == x[-1])): - raise TypeError, 'x must be strictly ascending' + raise TypeError('x must be strictly ascending') if not ((y.min() == y[0]) and (y.max() == y[-1])): - raise TypeError, 'y must be strictly ascending' + raise TypeError('y must be strictly ascending') if not x.size == z.shape[0]: - raise TypeError,\ - 'x dimension of z must have same number of elements as x' + raise TypeError('x dimension of z must have same number of ' + 'elements as x') if not y.size == z.shape[1]: - raise TypeError,\ - 'y dimension of z must have same number of elements as y' + raise TypeError('y dimension of z must have same number of ' + 'elements as y') z = ravel(z) xb,xe,yb,ye = bbox nx,tx,ny,ty,c,fp,ier = dfitpack.regrid_smth(x,y,z, Modified: trunk/scipy/interpolate/interpolate.py =================================================================== --- trunk/scipy/interpolate/interpolate.py 2010-11-20 04:49:44 UTC (rev 6910) +++ trunk/scipy/interpolate/interpolate.py 2010-11-20 05:29:02 UTC (rev 6911) @@ -6,7 +6,7 @@ __all__ = ['interp1d', 'interp2d', 'spline', 'spleval', 'splmake', 'spltopp', 'ppform', 'lagrange'] -from numpy import shape, sometrue, rank, array, transpose, searchsorted, \ +from numpy import shape, sometrue, array, transpose, searchsorted, \ ones, logical_or, atleast_1d, atleast_2d, meshgrid, ravel, \ dot, poly1d, asarray, intp import numpy as np @@ -679,7 +679,7 @@ b *= 6.0 return B, b, None, None else: - raise ValueError, "%s not supported" % kind + raise ValueError("%s not supported" % kind) # conds is a tuple of an array and a vector # giving the left-hand and the right-hand side Modified: trunk/scipy/interpolate/interpolate_wrapper.py =================================================================== --- trunk/scipy/interpolate/interpolate_wrapper.py 2010-11-20 04:49:44 UTC (rev 6910) +++ trunk/scipy/interpolate/interpolate_wrapper.py 2010-11-20 05:29:02 UTC (rev 6911) @@ -3,7 +3,6 @@ """ import numpy as np -import sys import _interpolate # C extension. Does all the real work. def atleast_1d_and_contiguous(ary, dtype = np.float64): @@ -114,7 +113,7 @@ msg = "block_average_above cannot extrapolate and new_x[%d]=%f "\ "is out of the x range (%f, %f)" % \ (bad_index, new_x[bad_index], x[0], x[-1]) - raise ValueError, msg + raise ValueError(msg) return new_y Modified: trunk/scipy/interpolate/rbf.py =================================================================== --- trunk/scipy/interpolate/rbf.py 2010-11-20 04:49:44 UTC (rev 6910) +++ trunk/scipy/interpolate/rbf.py 2010-11-20 05:29:02 UTC (rev 6911) @@ -138,8 +138,8 @@ self._function = getattr(self, func_name) else: functionlist = [x[3:] for x in dir(self) if x.startswith('_h_')] - raise ValueError, "function must be a callable or one of ", \ - ", ".join(functionlist) + raise ValueError("function must be a callable or one of " + + ", ".join(functionlist)) self._function = getattr(self, "_h_"+self.function) elif callable(self.function): allow_one = False @@ -152,8 +152,8 @@ elif hasattr(self.function, "__call__"): val = self.function.__call__.im_func else: - raise ValueError, "Cannot determine number of arguments to function" - + raise ValueError("Cannot determine number of arguments to function") + argcount = val.func_code.co_argcount if allow_one and argcount == 1: self._function = self.function @@ -165,11 +165,11 @@ self._function = new.instancemethod(self.function, self, Rbf) else: - raise ValueError, "Function argument must take 1 or 2 arguments." + raise ValueError("Function argument must take 1 or 2 arguments.") a0 = self._function(r) if a0.shape != r.shape: - raise ValueError, "Callable must take array and return array of the same shape" + raise ValueError("Callable must take array and return array of the same shape") return a0 def __init__(self, *args, **kwargs): From scipy-svn at scipy.org Sat Nov 20 00:57:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 19 Nov 2010 23:57:51 -0600 (CST) Subject: [Scipy-svn] r6912 - trunk/scipy/interpolate Message-ID: <20101120055751.D643237C3DD@scipy.org> Author: warren.weckesser Date: 2010-11-19 23:57:51 -0600 (Fri, 19 Nov 2010) New Revision: 6912 Modified: trunk/scipy/interpolate/interpolate.py Log: BUG: Add missing 'np.' prefix. Modified: trunk/scipy/interpolate/interpolate.py =================================================================== --- trunk/scipy/interpolate/interpolate.py 2010-11-20 05:29:02 UTC (rev 6911) +++ trunk/scipy/interpolate/interpolate.py 2010-11-20 05:57:51 UTC (rev 6912) @@ -687,8 +687,8 @@ def _find_user(xk, yk, order, conds, B): lh = conds[0] rh = conds[1] - B = concatenate((B,lh),axis=0) - w = concatenate((yk,rh),axis=0) + B = np.concatenate((B,lh),axis=0) + w = np.concatenate((yk,rh),axis=0) M,N = B.shape if (M>N): raise ValueError("over-specification of conditions") From scipy-svn at scipy.org Sat Nov 20 01:20:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 00:20:12 -0600 (CST) Subject: [Scipy-svn] r6913 - in trunk/scipy/io: . matlab Message-ID: <20101120062012.03DE537C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 00:20:11 -0600 (Sat, 20 Nov 2010) New Revision: 6913 Modified: trunk/scipy/io/dumbdbm_patched.py trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/mio4.py trunk/scipy/io/matlab/mio5.py trunk/scipy/io/mmio.py Log: ENH: io: update 'raise' statements Modified: trunk/scipy/io/dumbdbm_patched.py =================================================================== --- trunk/scipy/io/dumbdbm_patched.py 2010-11-20 05:57:51 UTC (rev 6912) +++ trunk/scipy/io/dumbdbm_patched.py 2010-11-20 06:20:11 UTC (rev 6913) @@ -110,7 +110,7 @@ def __setitem__(self, key, val): if not isinstance(key, str) or not isinstance(val, str): - raise TypeError, "keys and values must be strings" + raise TypeError("keys and values must be strings") if not self._index.has_key(key): (pos, siz) = self._addval(val) self._addkey(key, (pos, siz)) Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-20 05:57:51 UTC (rev 6912) +++ trunk/scipy/io/matlab/mio.py 2010-11-20 06:20:11 UTC (rev 6913) @@ -214,8 +214,8 @@ try: file_name.write(asbytes('')) except AttributeError: - raise IOError, 'Writer needs file name or writeable '\ - 'file-like object' + raise IOError('Writer needs file name or writeable ' + 'file-like object') file_stream = file_name if format == '4': Modified: trunk/scipy/io/matlab/mio4.py =================================================================== --- trunk/scipy/io/matlab/mio4.py 2010-11-20 05:57:51 UTC (rev 6912) +++ trunk/scipy/io/matlab/mio4.py 2010-11-20 06:20:11 UTC (rev 6913) @@ -105,7 +105,7 @@ P,rest = divmod(rest,10) T = rest if O != 0: - raise ValueError, 'O in MOPT integer should be 0, wrong format?' + raise ValueError('O in MOPT integer should be 0, wrong format?') dims = (data['mrows'], data['ncols']) is_complex = data['imagf'] == 1 dtype = self.dtypes[P] @@ -128,7 +128,7 @@ # no current processing (below) makes sense for sparse return self.read_sparse_array(hdr) else: - raise TypeError, 'No reader for class code %s' % mclass + raise TypeError('No reader for class code %s' % mclass) if process and self.squeeze_me: return squeeze_element(arr) return arr @@ -400,9 +400,9 @@ arr = arr.astype(dt.newbyteorder('=')) dtt = dt.type if dtt is np.object_: - raise TypeError, 'Cannot save object arrays in Mat4' + raise TypeError('Cannot save object arrays in Mat4') elif dtt is np.void: - raise TypeError, 'Cannot save void type arrays' + raise TypeError('Cannot save void type arrays') elif dtt in (np.unicode_, np.string_): self.write_char(arr, name) return Modified: trunk/scipy/io/matlab/mio5.py =================================================================== --- trunk/scipy/io/matlab/mio5.py 2010-11-20 05:57:51 UTC (rev 6912) +++ trunk/scipy/io/matlab/mio5.py 2010-11-20 06:20:11 UTC (rev 6913) @@ -229,8 +229,7 @@ else: self._matrix_reader.set_stream(self.mat_stream) if not mdtype == miMATRIX: - raise TypeError, \ - 'Expecting miMATRIX type here, got %d' % mdtype + raise TypeError('Expecting miMATRIX type here, got %d' % mdtype) header = self._matrix_reader.read_header() return header, next_pos Modified: trunk/scipy/io/mmio.py =================================================================== --- trunk/scipy/io/mmio.py 2010-11-20 05:57:51 UTC (rev 6912) +++ trunk/scipy/io/mmio.py 2010-11-20 06:20:11 UTC (rev 6913) @@ -127,8 +127,8 @@ @classmethod def _validate_format(self, format): if format not in self.FORMAT_VALUES: - raise ValueError,'unknown format type %s, must be one of %s'% \ - (`format`, `self.FORMAT_VALUES`) + raise ValueError('unknown format type %s, must be one of %s' % + (format, self.FORMAT_VALUES)) # field values FIELD_INTEGER = 'integer' @@ -140,8 +140,8 @@ @classmethod def _validate_field(self, field): if field not in self.FIELD_VALUES: - raise ValueError,'unknown field type %s, must be one of %s'% \ - (`field`, `self.FIELD_VALUES`) + raise ValueError('unknown field type %s, must be one of %s' % + (field, self.FIELD_VALUES)) # symmetry values SYMMETRY_GENERAL = 'general' @@ -154,8 +154,8 @@ @classmethod def _validate_symmetry(self, symmetry): if symmetry not in self.SYMMETRY_VALUES: - raise ValueError,'unknown symmetry type %s, must be one of %s'% \ - (`symmetry`, `self.SYMMETRY_VALUES`) + raise ValueError('unknown symmetry type %s, must be one of %s' % + (symmetry, self.SYMMETRY_VALUES)) DTYPES_BY_FIELD = { FIELD_INTEGER: 'i', @@ -183,7 +183,7 @@ mmid, matrix, format, field, symmetry = \ [asstr(part.strip().lower()) for part in line.split()] if not mmid.startswith('%%matrixmarket'): - raise ValueError,'source is not in Matrix Market format' + raise ValueError('source is not in Matrix Market format') assert matrix == 'matrix',`line` @@ -322,9 +322,8 @@ invalid_keys = set(kwargs.keys()) - set(public_attrs) if invalid_keys: - raise ValueError, \ - 'found %s invalid keyword arguments, please only use %s' % \ - (`tuple(invalid_keys)`, `public_attrs`) + raise ValueError('found %s invalid keyword arguments, please only use %s' % + (tuple(invalid_keys), public_attrs)) for attr in attrs: setattr(self, attr, kwargs.get(attr[1:], None)) @@ -465,7 +464,7 @@ a = coo_matrix((V, (I, J)), shape=(rows, cols), dtype=dtype) else: - raise NotImplementedError,`format` + raise NotImplementedError(format) return a @@ -476,7 +475,7 @@ rep = self.FORMAT_ARRAY a = asarray(a) if len(a.shape) != 2: - raise ValueError, 'expected matrix' + raise ValueError('expected matrix') rows,cols = a.shape entries = rows*cols @@ -494,7 +493,7 @@ else: from scipy.sparse import spmatrix if not isinstance(a,spmatrix): - raise ValueError,'unknown matrix type ' + `type(a)` + raise ValueError('unknown matrix type: %s' % type(a)) rep = 'coordinate' rows, cols = a.shape entries = a.getnnz() @@ -569,10 +568,10 @@ stream.write(asbytes(template % (real(aij),imag(aij)))) elif field == self.FIELD_PATTERN: - raise ValueError,'pattern type inconsisted with dense format' + raise ValueError('pattern type inconsisted with dense format') else: - raise TypeError,'Unknown field type %s'% `field` + raise TypeError('Unknown field type %s' % field) # write sparse format else: @@ -594,7 +593,7 @@ elif field == self.FIELD_COMPLEX: IJV = vstack((coo.row, coo.col, coo.data.real, coo.data.imag)).T else: - raise TypeError('Unknown field type %s' % `field`) + raise TypeError('Unknown field type %s' % field) IJV[:,:2] += 1 # change base 0 -> base 1 From scipy-svn at scipy.org Sat Nov 20 01:25:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 00:25:29 -0600 (CST) Subject: [Scipy-svn] r6914 - trunk/scipy/lib/lapack/tests Message-ID: <20101120062529.A28A237C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 00:25:29 -0600 (Sat, 20 Nov 2010) New Revision: 6914 Modified: trunk/scipy/lib/lapack/tests/test_gesv.py Log: ENH: lib: update 'raise' statements Modified: trunk/scipy/lib/lapack/tests/test_gesv.py =================================================================== --- trunk/scipy/lib/lapack/tests/test_gesv.py 2010-11-20 06:20:11 UTC (rev 6913) +++ trunk/scipy/lib/lapack/tests/test_gesv.py 2010-11-20 06:25:29 UTC (rev 6914) @@ -34,7 +34,7 @@ assert_array_almost_equal(np.dot(b,np.dot(a,v[:,i])), w[i]*v[:,i], decimal=PREC[tp] - 1) else: - raise ValueError, `itype` + raise ValueError(itype) @dec.skipif(FLAPACK_IS_EMPTY, "Flapack empty, skip flapack test") def test_ssygv_1(self): From scipy-svn at scipy.org Sat Nov 20 01:33:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 00:33:31 -0600 (CST) Subject: [Scipy-svn] r6915 - trunk/scipy/linalg Message-ID: <20101120063331.AF26037D3CA@scipy.org> Author: warren.weckesser Date: 2010-11-20 00:33:31 -0600 (Sat, 20 Nov 2010) New Revision: 6915 Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/decomp.py trunk/scipy/linalg/decomp_lu.py trunk/scipy/linalg/decomp_qr.py trunk/scipy/linalg/decomp_schur.py trunk/scipy/linalg/matfuncs.py trunk/scipy/linalg/setup.py trunk/scipy/linalg/setup_atlas_version.py Log: ENH: linalg: update 'raise' statements Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/basic.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -46,9 +46,9 @@ """ a1, b1 = map(asarray_chkfinite,(a,b)) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: - raise ValueError, 'expected square matrix' + raise ValueError('expected square matrix') if a1.shape[0] != b1.shape[0]: - raise ValueError, 'incompatible dimensions' + raise ValueError('incompatible dimensions') overwrite_a = overwrite_a or (a1 is not a and not hasattr(a,'__array__')) overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) if debug: @@ -114,9 +114,9 @@ a1, b1 = map(asarray_chkfinite,(a,b)) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: - raise ValueError, 'expected square matrix' + raise ValueError('expected square matrix') if a1.shape[0] != b1.shape[0]: - raise ValueError, 'incompatible dimensions' + raise ValueError('incompatible dimensions') overwrite_b = overwrite_b or (b1 is not b and not hasattr(b,'__array__')) if debug: print 'solve:overwrite_b=',overwrite_b @@ -408,7 +408,7 @@ """ a1, b1 = map(asarray_chkfinite, (a, b)) if len(a1.shape) != 2: - raise ValueError, 'expected matrix' + raise ValueError('expected matrix') m, n = a1.shape if len(b1.shape) == 2: nrhs = b1.shape[1] Modified: trunk/scipy/linalg/decomp.py =================================================================== --- trunk/scipy/linalg/decomp.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/decomp.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -492,7 +492,7 @@ select = 2 vl, vu, il, iu = 0.0, 0.0, min(select_range), max(select_range) if min(il, iu) < 0 or max(il, iu) >= a1.shape[1]: - raise ValueError, 'select_range out of bounds' + raise ValueError('select_range out of bounds') max_ev = iu - il + 1 else: # 1, 'v', 'value' select = 1 Modified: trunk/scipy/linalg/decomp_lu.py =================================================================== --- trunk/scipy/linalg/decomp_lu.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/decomp_lu.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -47,7 +47,7 @@ """ a1 = asarray(a) if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]): - raise ValueError, 'expected square matrix' + raise ValueError('expected square matrix') overwrite_a = overwrite_a or (_datanotshared(a1, a)) getrf, = get_lapack_funcs(('getrf',), (a1,)) lu, piv, info = getrf(a, overwrite_a=overwrite_a) Modified: trunk/scipy/linalg/decomp_qr.py =================================================================== --- trunk/scipy/linalg/decomp_qr.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/decomp_qr.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -159,7 +159,7 @@ """ a1 = asarray_chkfinite(a) if len(a1.shape) != 2: - raise ValueError, 'expected matrix' + raise ValueError('expected matrix') M,N = a1.shape overwrite_a = overwrite_a or (_datanotshared(a1, a)) geqrf, = get_lapack_funcs(('geqrf',), (a1,)) Modified: trunk/scipy/linalg/decomp_schur.py =================================================================== --- trunk/scipy/linalg/decomp_schur.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/decomp_schur.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -51,10 +51,10 @@ """ if not output in ['real','complex','r','c']: - raise ValueError, "argument must be 'real', or 'complex'" + raise ValueError("argument must be 'real', or 'complex'") a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or (a1.shape[0] != a1.shape[1]): - raise ValueError, 'expected square matrix' + raise ValueError('expected square matrix') typ = a1.dtype.char if output in ['complex','c'] and typ not in ['F','D']: if typ in _double_precision: Modified: trunk/scipy/linalg/matfuncs.py =================================================================== --- trunk/scipy/linalg/matfuncs.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/matfuncs.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -302,7 +302,7 @@ # Perform Shur decomposition (lapack ?gees) A = asarray(A) if len(A.shape)!=2: - raise ValueError, "Non-matrix input to matrix function." + raise ValueError("Non-matrix input to matrix function.") if A.dtype.char in ['F', 'D', 'G']: cmplx_type = 1 else: @@ -502,7 +502,7 @@ """ A = asarray(A) if len(A.shape)!=2: - raise ValueError, "Non-matrix input to matrix function." + raise ValueError("Non-matrix input to matrix function.") T, Z = schur(A) T, Z = rsf2csf(T,Z) n,n = T.shape Modified: trunk/scipy/linalg/setup.py =================================================================== --- trunk/scipy/linalg/setup.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/setup.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -49,7 +49,7 @@ lapack_opt = get_info('lapack_opt') if not lapack_opt: - raise NotFoundError,'no lapack/blas resources found' + raise NotFoundError('no lapack/blas resources found') atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \ if k=='ATLAS_INFO']+[None])[0] Modified: trunk/scipy/linalg/setup_atlas_version.py =================================================================== --- trunk/scipy/linalg/setup_atlas_version.py 2010-11-20 06:25:29 UTC (rev 6914) +++ trunk/scipy/linalg/setup_atlas_version.py 2010-11-20 06:33:31 UTC (rev 6915) @@ -14,7 +14,7 @@ if not atlas_info: atlas_info = get_info('atlas') if not atlas_info: - raise AtlasNotFoundError,AtlasNotFoundError.__doc__ + raise AtlasNotFoundError(AtlasNotFoundError.__doc__) ext = Extension('atlas_version', sources=[os.path.join(local_path,'atlas_version.c')], libraries=[atlas_info['libraries'][-1]], From scipy-svn at scipy.org Sat Nov 20 01:45:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 00:45:33 -0600 (CST) Subject: [Scipy-svn] r6916 - trunk/scipy/linalg Message-ID: <20101120064533.75D1637D3CA@scipy.org> Author: warren.weckesser Date: 2010-11-20 00:45:33 -0600 (Sat, 20 Nov 2010) New Revision: 6916 Modified: trunk/scipy/linalg/setup.py Log: Remove unused imports. Modified: trunk/scipy/linalg/setup.py =================================================================== --- trunk/scipy/linalg/setup.py 2010-11-20 06:33:31 UTC (rev 6915) +++ trunk/scipy/linalg/setup.py 2010-11-20 06:45:33 UTC (rev 6916) @@ -1,10 +1,6 @@ #!/usr/bin/env python -import os -import sys -import re from distutils.dep_util import newer_group, newer -from glob import glob from os.path import join #------------------- From scipy-svn at scipy.org Sat Nov 20 01:59:50 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 00:59:50 -0600 (CST) Subject: [Scipy-svn] r6917 - trunk/scipy/maxentropy Message-ID: <20101120065950.E8E5737C3DD@scipy.org> Author: warren.weckesser Date: 2010-11-20 00:59:50 -0600 (Sat, 20 Nov 2010) New Revision: 6917 Modified: trunk/scipy/maxentropy/maxentropy.py trunk/scipy/maxentropy/maxentutils.py Log: ENH: maxentropy: update 'raise' statements Modified: trunk/scipy/maxentropy/maxentropy.py =================================================================== --- trunk/scipy/maxentropy/maxentropy.py 2010-11-20 06:45:33 UTC (rev 6916) +++ trunk/scipy/maxentropy/maxentropy.py 2010-11-20 06:59:50 UTC (rev 6917) @@ -84,7 +84,7 @@ def __init__(self): self.format = self.__class__.__name__[:4] if self.format == 'base': - raise ValueError, "this class cannot be instantiated directly" + raise ValueError("this class cannot be instantiated directly") self.verbose = False self.maxgtol = 1e-5 @@ -185,13 +185,13 @@ if isinstance(self, bigmodel): # Ensure the sample matrix has been set if not hasattr(self, 'sampleF') and hasattr(self, 'samplelogprobs'): - raise AttributeError, "first specify a sample feature matrix" \ - " using sampleFgen()" + raise AttributeError("first specify a sample feature matrix" + " using sampleFgen()") else: # Ensure the feature matrix for the sample space has been set if not hasattr(self, 'F'): - raise AttributeError, "first specify a feature matrix" \ - " using setfeaturesandsamplespace()" + raise AttributeError("first specify a feature matrix" + " using setfeaturesandsamplespace()") # First convert K to a numpy array if necessary K = np.asarray(K, float) @@ -226,9 +226,9 @@ elif algorithm == 'LBFGSB': if callback is not None: - raise NotImplementedError, "L-BFGS-B optimization algorithm"\ - " does not yet support callback functions for"\ - " testing with an external sample" + raise NotImplementedError("L-BFGS-B optimization algorithm" + " does not yet support callback functions for" + " testing with an external sample") retval = optimize.fmin_l_bfgs_b(dual, oldparams, \ grad, args=(), bounds=self.bounds, pgtol=self.maxgtol, maxfun=self.maxfun) @@ -268,9 +268,9 @@ (newparams, fopt, numiter, func_calls, warnflag) = retval else: - raise AttributeError, "the specified algorithm '" + str(algorithm) \ - + "' is unsupported. Options are 'CG', 'LBFGSB', " \ - "'Nelder-Mead', 'Powell', and 'BFGS'" + raise AttributeError("the specified algorithm '" + str(algorithm) + + "' is unsupported. Options are 'CG', 'LBFGSB', " + "'Nelder-Mead', 'Powell', and 'BFGS'") if np.any(self.params != newparams): self.setparams(newparams) @@ -397,9 +397,9 @@ if not self.callingback and self.external is None: if self.mindual > -np.inf and self.dual() < self.mindual: - raise DivergenceError, "dual is below the threshold 'mindual'" \ - " and may be diverging to -inf. Fix the constraints" \ - " or lower the threshold!" + raise DivergenceError("dual is below the threshold 'mindual'" + " and may be diverging to -inf. Fix the constraints" + " or lower the threshold!") self.iters += 1 @@ -543,7 +543,7 @@ elif hasattr(self, 'K'): m = len(self.K) else: - raise ValueError, "specify the number of features / parameters" + raise ValueError("specify the number of features / parameters") # Set parameters, clearing cache variables self.setparams(np.zeros(m, float)) @@ -596,7 +596,7 @@ # Check whether the params are NaN if not np.all(self.params == self.params): - raise FloatingPointError, "some of the parameters are NaN" + raise FloatingPointError("some of the parameters are NaN") if self.verbose: print "Saving parameters ..." @@ -642,8 +642,8 @@ if f is not None and samplespace is not None: self.setfeaturesandsamplespace(f, samplespace) elif f is not None and samplespace is None: - raise ValueError, "not supported: specify both features and" \ - " sample space or neither" + raise ValueError("not supported: specify both features and" + " sample space or neither") def setfeaturesandsamplespace(self, f, samplespace): @@ -674,7 +674,7 @@ # Has F = {f_i(x_j)} been precomputed? if not hasattr(self, 'F'): - raise AttributeError, "first create a feature matrix F" + raise AttributeError("first create a feature matrix F") # Good, assume the feature matrix exists log_p_dot = innerprodtranspose(self.F, self.params) @@ -693,7 +693,7 @@ """ # For discrete models, use the representation E_p[f(X)] = p . F if not hasattr(self, 'F'): - raise AttributeError, "first set the feature matrix F" + raise AttributeError("first set the feature matrix F") # A pre-computed matrix of features exists p = self.pmf() @@ -707,7 +707,7 @@ """ # Have the features already been computed and stored? if not hasattr(self, 'F'): - raise AttributeError, "first set the feature matrix F" + raise AttributeError("first set the feature matrix F") # Yes: # p(x) = exp(params.f(x)) / sum_y[exp params.f(y)] @@ -763,8 +763,8 @@ try: f = self.f except AttributeError: - raise AttributeError, "either pass a list f of feature" \ - " functions or set this as a member variable self.f" + raise AttributeError("either pass a list f of feature" + " functions or set this as a member variable self.f") # Do we have a prior distribution p_0? priorlogpmf = None @@ -772,7 +772,7 @@ try: priorlogpmf = self.priorlogpmf except AttributeError: - raise AttributeError, "prior probability mass function not set" + raise AttributeError("prior probability mass function not set") def p(x): f_x = np.array([f[i](x) for i in range(len(f))], float) @@ -887,9 +887,9 @@ # Try converting to a row vector p_tilde = count.reshape((1, size)) except AttributeError: - raise ValueError, "the 'counts' object needs to be a"\ - " row vector (1 x n) rank-2 array/matrix) or have"\ - " a .reshape method to convert it into one" + raise ValueError("the 'counts' object needs to be a" + " row vector (1 x n) rank-2 array/matrix) or have" + " a .reshape method to convert it into one") else: p_tilde = counts # Make a copy -- don't modify 'counts' @@ -927,7 +927,7 @@ S = self.numsamplepoints # Has F = {f_i(x_j)} been precomputed? if not hasattr(self, 'F'): - raise AttributeError, "first create a feature matrix F" + raise AttributeError("first create a feature matrix F") # Good, assume F has been precomputed @@ -1030,7 +1030,7 @@ self.p_tilde_context[w]. """ if not hasattr(self, 'F'): - raise AttributeError, "need a pre-computed feature matrix F" + raise AttributeError("need a pre-computed feature matrix F") # A pre-computed matrix of features exists @@ -1060,7 +1060,7 @@ """ # Have the features already been computed and stored? if not hasattr(self, 'F'): - raise AttributeError, "first set the feature matrix F" + raise AttributeError("first set the feature matrix F") # p(x | c) = exp(theta.f(x, c)) / sum_c[exp theta.f(x, c)] # = exp[log p_dot(x) - logsumexp{log(p_dot(y))}] @@ -1167,7 +1167,7 @@ try: len(output) except TypeError: - raise ValueError, "output of sampleFgen.next() not recognized" + raise ValueError("output of sampleFgen.next() not recognized") if len(output) == 2: # Assume the format is (F, lp) (self.sampleF, self.samplelogprobs) = output @@ -1175,7 +1175,7 @@ # Assume the format is (F, lp, sample) (self.sampleF, self.samplelogprobs, self.sample) = output else: - raise ValueError, "output of sampleFgen.next() not recognized" + raise ValueError("output of sampleFgen.next() not recognized") # Check whether the number m of features is correct try: @@ -1188,8 +1188,8 @@ self.reset(m) else: if self.sampleF.shape[0] != m: - raise ValueError, "the sample feature generator returned" \ - " a feature matrix of incorrect dimensions" + raise ValueError("the sample feature generator returned" + " a feature matrix of incorrect dimensions") if self.verbose >= 3: print "(done)" @@ -1522,7 +1522,7 @@ try: a_k = self.a_0 except AttributeError: - raise AttributeError, "first define the initial step size a_0" + raise AttributeError("first define the initial step size a_0") avgparams = self.params if self.exacttest: Modified: trunk/scipy/maxentropy/maxentutils.py =================================================================== --- trunk/scipy/maxentropy/maxentutils.py 2010-11-20 06:45:33 UTC (rev 6916) +++ trunk/scipy/maxentropy/maxentutils.py 2010-11-20 06:59:50 UTC (rev 6917) @@ -261,7 +261,7 @@ elif format in ('dok_matrix', 'csc_matrix', 'csr_matrix'): sparseF = sparse.dok_matrix((m, n)) else: - raise ValueError, "sparse matrix format not recognized" + raise ValueError("sparse matrix format not recognized") for i in xrange(m): f_i = f[i] @@ -327,7 +327,7 @@ except ValueError: (p, q) = vshape if n != p: - raise TypeError, "matrix dimensions are incompatible" + raise TypeError("matrix dimensions are incompatible") if isinstance(v, ndarray): try: # See if A is sparse @@ -348,7 +348,7 @@ elif sparse.isspmatrix(v): return A * v else: - raise TypeError, "unsupported types for inner product" + raise TypeError("unsupported types for inner product") def innerprodtranspose(A,v): @@ -374,8 +374,8 @@ innerprod = numpy.empty(n, float) A.matvec_transp(v, innerprod) else: - raise TypeError, "innerprodtranspose(A,v) requires that v be " \ - "a vector (rank-1 dense array) if A is sparse." + raise TypeError("innerprodtranspose(A,v) requires that v be " + "a vector (rank-1 dense array) if A is sparse.") return innerprod elif sparse.isspmatrix(A): return A.rmatvec(v).transpose() @@ -396,7 +396,7 @@ x = numpy.dot(numpy.transpose(v), A) return numpy.transpose(x) else: - raise TypeError, "unsupported types for inner product" + raise TypeError("unsupported types for inner product") def rowmeans(A): @@ -421,8 +421,8 @@ try: n = A.shape[1] except AttributeError: - raise TypeError, \ - "rowmeans() only works with sparse and dense arrays" + raise TypeError("rowmeans() only works with sparse and dense " + "arrays") rowsum = innerprod(A, numpy.ones(n, float)) return rowsum / float(n) @@ -448,8 +448,8 @@ try: m = A.shape[0] except AttributeError: - raise TypeError, \ - "columnmeans() only works with sparse and dense arrays" + raise TypeError("columnmeans() only works with sparse and dense " + "arrays") columnsum = innerprodtranspose(A, numpy.ones(m, float)) return columnsum / float(m) @@ -475,8 +475,8 @@ try: m = A.shape[0] except AttributeError: - raise TypeError, \ - "columnvariances() only works with sparse and dense arrays" + raise TypeError("columnvariances() only works with sparse " + "and dense arrays") means = columnmeans(A) return columnmeans((A-means)**2) * (m/(m-1.0)) From scipy-svn at scipy.org Sat Nov 20 02:10:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 01:10:14 -0600 (CST) Subject: [Scipy-svn] r6918 - trunk/scipy/maxentropy Message-ID: <20101120071014.138FE37C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 01:10:13 -0600 (Sat, 20 Nov 2010) New Revision: 6918 Modified: trunk/scipy/maxentropy/maxentropy.py Log: maxentropy: don't use 'import *' Modified: trunk/scipy/maxentropy/maxentropy.py =================================================================== --- trunk/scipy/maxentropy/maxentropy.py 2010-11-20 06:59:50 UTC (rev 6917) +++ trunk/scipy/maxentropy/maxentropy.py 2010-11-20 07:10:13 UTC (rev 6918) @@ -71,9 +71,12 @@ import math, types, cPickle import numpy as np +from numpy import exp, asarray from scipy import optimize from scipy.linalg import norm -from scipy.maxentropy.maxentutils import * +from scipy.maxentropy.maxentutils import logsumexp, arrayexp, \ + innerprod, innerprodtranspose, columnmeans, columnvariances, \ + flatten, DivergenceError, sparsefeaturematrix class basemodel(object): From scipy-svn at scipy.org Sat Nov 20 02:21:44 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 01:21:44 -0600 (CST) Subject: [Scipy-svn] r6919 - trunk/scipy/maxentropy Message-ID: <20101120072144.898E137D3CA@scipy.org> Author: warren.weckesser Date: 2010-11-20 01:21:44 -0600 (Sat, 20 Nov 2010) New Revision: 6919 Modified: trunk/scipy/maxentropy/maxentropy.py Log: BUG: maxentropy: Fix a few glaring mistakes found by pyflakes; has no one every actually *run* this code?! Modified: trunk/scipy/maxentropy/maxentropy.py =================================================================== --- trunk/scipy/maxentropy/maxentropy.py 2010-11-20 07:10:13 UTC (rev 6918) +++ trunk/scipy/maxentropy/maxentropy.py 2010-11-20 07:21:44 UTC (rev 6919) @@ -489,8 +489,8 @@ return np.exp(self.lognormconst()) - def setsmooth(sigma): - """Speficies that the entropy dual and gradient should be + def setsmooth(self, sigma): + """Specifies that the entropy dual and gradient should be computed with a quadratic penalty term on magnitude of the parameters. This 'smooths' the model to account for noise in the target expectation values or to improve robustness when using @@ -888,7 +888,7 @@ if counts.shape[0] > 1: try: # Try converting to a row vector - p_tilde = count.reshape((1, size)) + p_tilde = counts.reshape((1, counts.size)) except AttributeError: raise ValueError("the 'counts' object needs to be a" " row vector (1 x n) rank-2 array/matrix) or have" From scipy-svn at scipy.org Sat Nov 20 02:28:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 01:28:02 -0600 (CST) Subject: [Scipy-svn] r6920 - trunk/scipy/maxentropy Message-ID: <20101120072802.96B4D37D3D0@scipy.org> Author: warren.weckesser Date: 2010-11-20 01:28:02 -0600 (Sat, 20 Nov 2010) New Revision: 6920 Modified: trunk/scipy/maxentropy/maxentutils.py Log: BUG: maxentropy: another bug found by pyflakes Modified: trunk/scipy/maxentropy/maxentutils.py =================================================================== --- trunk/scipy/maxentropy/maxentutils.py 2010-11-20 07:21:44 UTC (rev 6919) +++ trunk/scipy/maxentropy/maxentutils.py 2010-11-20 07:28:02 UTC (rev 6920) @@ -24,7 +24,7 @@ import math import cmath import numpy -from numpy import log, exp, asarray, ndarray +from numpy import log, exp, asarray, ndarray, empty from scipy import sparse def logsumexp(a): @@ -102,7 +102,7 @@ def _robustarraylog(x): """ An array version of robustlog. Operates on a real array x. """ - arraylog = emptyarray(len(x), numpy.Complex64) + arraylog = empty(len(x), numpy.complex64) for i in range(len(x)): xi = x[i] if xi > 0: From scipy-svn at scipy.org Sat Nov 20 02:33:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 01:33:29 -0600 (CST) Subject: [Scipy-svn] r6921 - trunk/scipy/misc Message-ID: <20101120073329.E895A37C3ED@scipy.org> Author: warren.weckesser Date: 2010-11-20 01:33:29 -0600 (Sat, 20 Nov 2010) New Revision: 6921 Modified: trunk/scipy/misc/common.py trunk/scipy/misc/pilutil.py Log: ENH: misc: update 'raise' statements Modified: trunk/scipy/misc/common.py =================================================================== --- trunk/scipy/misc/common.py 2010-11-20 07:28:02 UTC (rev 6920) +++ trunk/scipy/misc/common.py 2010-11-20 07:33:29 UTC (rev 6921) @@ -319,8 +319,7 @@ N = len(an) - 1 n = N-m if (n < 0): - raise ValueError, \ - "Order of q must be smaller than len(an)-1." + raise ValueError("Order of q must be smaller than len(an)-1.") Akj = eye(N+1,n+1) Bkj = zeros((N+1,m),'d') for row in range(1,m+1): Modified: trunk/scipy/misc/pilutil.py =================================================================== --- trunk/scipy/misc/pilutil.py 2010-11-20 07:28:02 UTC (rev 6920) +++ trunk/scipy/misc/pilutil.py 2010-11-20 07:33:29 UTC (rev 6921) @@ -167,7 +167,7 @@ """ data = asarray(arr) if iscomplexobj(data): - raise ValueError, "Cannot convert a complex-valued array." + raise ValueError("Cannot convert a complex-valued array.") shape = list(data.shape) valid = len(shape)==2 or ((len(shape)==3) and \ ((3 in shape) or (4 in shape))) @@ -202,7 +202,7 @@ data32 = data.astype(numpy.uint32) image = Image.fromstring(mode,shape,data32.tostring()) else: - raise ValueError, _errstr + raise ValueError(_errstr) return image # if here then 3-d array with a 3 or a 4 in the shape length. @@ -215,13 +215,13 @@ if len(ca): ca = ca[0] else: - raise ValueError, "Could not find channel dimension." + raise ValueError("Could not find channel dimension.") else: ca = channel_axis numch = shape[ca] if numch not in [3,4]: - raise ValueError, "Channel axis dimension is not valid." + raise ValueError("Channel axis dimension is not valid.") bytedata = bytescale(data,high=high,low=low,cmin=cmin,cmax=cmax) if ca == 2: @@ -239,7 +239,7 @@ if mode not in ['RGB','RGBA','YCbCr','CMYK']: - raise ValueError, _errstr + raise ValueError(_errstr) if mode in ['RGB', 'YCbCr']: assert numch == 3, "Invalid array shape for mode." @@ -405,7 +405,7 @@ im = toimage(arr) if ftype not in _tdict.keys(): - raise ValueError, "Unknown filter type." + raise ValueError("Unknown filter type.") return fromimage(im.filter(_tdict[ftype])) From scipy-svn at scipy.org Sat Nov 20 02:52:46 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 01:52:46 -0600 (CST) Subject: [Scipy-svn] r6922 - trunk/scipy/ndimage Message-ID: <20101120075246.8011137C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 01:52:46 -0600 (Sat, 20 Nov 2010) New Revision: 6922 Modified: trunk/scipy/ndimage/_ni_support.py trunk/scipy/ndimage/filters.py trunk/scipy/ndimage/fourier.py trunk/scipy/ndimage/interpolation.py trunk/scipy/ndimage/measurements.py trunk/scipy/ndimage/morphology.py Log: ENH: ndimage: update 'raise' statements Modified: trunk/scipy/ndimage/_ni_support.py =================================================================== --- trunk/scipy/ndimage/_ni_support.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/_ni_support.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -45,7 +45,7 @@ elif mode == 'constant': return 4 else: - raise RuntimeError, 'boundary mode not supported' + raise RuntimeError('boundary mode not supported') def _normalize_sequence(input, rank, array_type = None): """If input is a scalar, create a sequence of length equal to the @@ -59,7 +59,7 @@ normalized = list(input) if len(normalized) != rank: err = "sequence argument must have length equal to input rank" - raise RuntimeError, err + raise RuntimeError(err) return normalized import warnings @@ -67,13 +67,13 @@ if output_type is not None: msg = "'output_type' argument is deprecated." msg += " Assign type to 'output' instead." - raise RuntimeError, msg + raise RuntimeError(msg) warnings.warn(msg, DeprecationWarning) if output is None: output = output_type elif ((type(output) is not type(types.TypeType)) or output.dtype != output_type): - raise RuntimeError, "'output' type and 'output_type' not equal" + raise RuntimeError("'output' type and 'output_type' not equal") if shape is None: shape = input.shape if output is None: @@ -88,7 +88,7 @@ return_value = output else: if output.shape != shape: - raise RuntimeError, "output shape not correct" + raise RuntimeError("output shape not correct") return_value = None return output, return_value @@ -96,5 +96,5 @@ if axis < 0: axis += rank if axis < 0 or axis >= rank: - raise ValueError, 'invalid axis' + raise ValueError('invalid axis') return axis Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/filters.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -113,17 +113,17 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output, return_value = _ni_support._get_output(output, input) weights = numpy.asarray(weights, dtype=numpy.float64) if weights.ndim != 1 or weights.shape[0] < 1: - raise RuntimeError, 'no filter weights given' + raise RuntimeError('no filter weights given') if not weights.flags.contiguous: weights = weights.copy() axis = _ni_support._check_axis(axis, input.ndim) if ((len(weights) // 2 + origin < 0) or (len(weights) // 2 + origin > len(weights))): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') mode = _ni_support._extend_mode_to_code(mode) _nd_image.correlate1d(input, weights, axis, output, mode, cval, origin) @@ -473,12 +473,12 @@ convolution): input = numpy.asarray(input) if numpy.iscomplexobj(int): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') origins = _ni_support._normalize_sequence(origin, input.ndim) weights = numpy.asarray(weights, dtype=numpy.float64) wshape = [ii for ii in weights.shape if ii > 0] if len(wshape) != input.ndim: - raise RuntimeError, 'filter weights array has incorrect shape.' + raise RuntimeError('filter weights array has incorrect shape.') if convolution: weights = weights[tuple([slice(None, None, -1)] * weights.ndim)] for ii in range(len(origins)): @@ -487,7 +487,7 @@ origins[ii] -= 1 for origin, lenw in zip(origins, wshape): if (lenw // 2 + origin < 0) or (lenw // 2 + origin > lenw): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') if not weights.flags.contiguous: weights = weights.copy() output, return_value = _ni_support._get_output(output, input) @@ -667,13 +667,13 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') axis = _ni_support._check_axis(axis, input.ndim) if size < 1: - raise RuntimeError, 'incorrect filter size' + raise RuntimeError('incorrect filter size') output, return_value = _ni_support._get_output(output, input) if (size // 2 + origin < 0) or (size // 2 + origin > size): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') mode = _ni_support._extend_mode_to_code(mode) _nd_image.uniform_filter1d(input, size, axis, output, mode, cval, origin) @@ -743,13 +743,13 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') axis = _ni_support._check_axis(axis, input.ndim) if size < 1: - raise RuntimeError, 'incorrect filter size' + raise RuntimeError('incorrect filter size') output, return_value = _ni_support._get_output(output, input) if (size // 2 + origin < 0) or (size // 2 + origin > size): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') mode = _ni_support._extend_mode_to_code(mode) _nd_image.min_or_max_filter1d(input, size, axis, output, mode, cval, origin, 1) @@ -777,13 +777,13 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') axis = _ni_support._check_axis(axis, input.ndim) if size < 1: - raise RuntimeError, 'incorrect filter size' + raise RuntimeError('incorrect filter size') output, return_value = _ni_support._get_output(output, input) if (size // 2 + origin < 0) or (size // 2 + origin > size): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') mode = _ni_support._extend_mode_to_code(mode) _nd_image.min_or_max_filter1d(input, size, axis, output, mode, cval, origin, 0) @@ -795,7 +795,7 @@ if structure is None: if footprint is None: if size is None: - raise RuntimeError, "no footprint provided" + raise RuntimeError("no footprint provided") separable= True else: footprint = numpy.asarray(footprint) @@ -816,7 +816,7 @@ footprint = footprint.astype(bool) input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output, return_value = _ni_support._get_output(output, input) origins = _ni_support._normalize_sequence(origin, input.ndim) if separable: @@ -837,15 +837,15 @@ else: fshape = [ii for ii in footprint.shape if ii > 0] if len(fshape) != input.ndim: - raise RuntimeError, 'footprint array has incorrect shape.' + raise RuntimeError('footprint array has incorrect shape.') for origin, lenf in zip(origins, fshape): if (lenf // 2 + origin < 0) or (lenf // 2 + origin > lenf): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') if not footprint.flags.contiguous: footprint = footprint.copy() if structure is not None: if len(structure.shape) != input.ndim: - raise RuntimeError, 'structure array has incorrect shape' + raise RuntimeError('structure array has incorrect shape') if not structure.flags.contiguous: structure = structure.copy() mode = _ni_support._extend_mode_to_code(mode) @@ -895,21 +895,21 @@ mode = "reflect", cval = 0.0, origin = 0, operation = 'rank'): input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') origins = _ni_support._normalize_sequence(origin, input.ndim) if footprint is None: if size is None: - raise RuntimeError, "no footprint or filter size provided" + raise RuntimeError("no footprint or filter size provided") sizes = _ni_support._normalize_sequence(size, input.ndim) footprint = numpy.ones(sizes, dtype=bool) else: footprint = numpy.asarray(footprint, dtype=bool) fshape = [ii for ii in footprint.shape if ii > 0] if len(fshape) != input.ndim: - raise RuntimeError, 'filter footprint array has incorrect shape.' + raise RuntimeError('filter footprint array has incorrect shape.') for origin, lenf in zip(origins, fshape): if (lenf // 2 + origin < 0) or (lenf // 2 + origin > lenf): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') if not footprint.flags.contiguous: footprint = footprint.copy() filter_size = numpy.where(footprint, 1, 0).sum() @@ -920,7 +920,7 @@ if percentile < 0.0: percentile += 100.0 if percentile < 0 or percentile > 100: - raise RuntimeError, 'invalid percentile' + raise RuntimeError('invalid percentile') if percentile == 100.0: rank = filter_size - 1 else: @@ -928,7 +928,7 @@ if rank < 0: rank += filter_size if rank < 0 or rank >= filter_size: - raise RuntimeError, 'rank not within filter footprint size' + raise RuntimeError('rank not within filter footprint size') if rank == 0: return minimum_filter(input, None, footprint, output, mode, cval, origin) @@ -1059,14 +1059,14 @@ extra_keywords = {} input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output, return_value = _ni_support._get_output(output, input) if filter_size < 1: - raise RuntimeError, 'invalid filter size' + raise RuntimeError('invalid filter size') axis = _ni_support._check_axis(axis, input.ndim) if ((filter_size // 2 + origin < 0) or (filter_size // 2 + origin > filter_size)): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') mode = _ni_support._extend_mode_to_code(mode) _nd_image.generic_filter1d(input, function, filter_size, axis, output, mode, cval, origin, extra_arguments, extra_keywords) @@ -1100,11 +1100,11 @@ extra_keywords = {} input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') origins = _ni_support._normalize_sequence(origin, input.ndim) if footprint is None: if size is None: - raise RuntimeError, "no footprint or filter size provided" + raise RuntimeError("no footprint or filter size provided") sizes = _ni_support._normalize_sequence(size, input.ndim) footprint = numpy.ones(sizes, dtype=bool) else: @@ -1112,10 +1112,10 @@ footprint = footprint.astype(bool) fshape = [ii for ii in footprint.shape if ii > 0] if len(fshape) != input.ndim: - raise RuntimeError, 'filter footprint array has incorrect shape.' + raise RuntimeError('filter footprint array has incorrect shape.') for origin, lenf in zip(origins, fshape): if (lenf // 2 + origin < 0) or (lenf // 2 + origin > lenf): - raise ValueError, 'invalid origin' + raise ValueError('invalid origin') if not footprint.flags.contiguous: footprint = footprint.copy() output, return_value = _ni_support._get_output(output, input) Modified: trunk/scipy/ndimage/fourier.py =================================================================== --- trunk/scipy/ndimage/fourier.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/fourier.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -44,12 +44,12 @@ elif type(output) is types.TypeType: if output not in [numpy.complex64, numpy.complex128, numpy.float32, numpy.float64]: - raise RuntimeError, "output type not supported" + raise RuntimeError("output type not supported") output = numpy.zeros(input.shape, dtype = output) return_value = output else: if output.shape != input.shape: - raise RuntimeError, "output shape not correct" + raise RuntimeError("output shape not correct") return_value = None return output, return_value @@ -62,12 +62,12 @@ return_value = output elif type(output) is types.TypeType: if output not in [numpy.complex64, numpy.complex128]: - raise RuntimeError, "output type not supported" + raise RuntimeError("output type not supported") output = numpy.zeros(input.shape, dtype = output) return_value = output else: if output.shape != input.shape: - raise RuntimeError, "output shape not correct" + raise RuntimeError("output shape not correct") return_value = None return output, return_value Modified: trunk/scipy/ndimage/interpolation.py =================================================================== --- trunk/scipy/ndimage/interpolation.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/interpolation.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -68,10 +68,10 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output, return_value = _ni_support._get_output(output, input, output_type) if order in [0, 1]: @@ -103,10 +103,10 @@ """ if order < 2 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output, return_value = _ni_support._get_output(output, input, output_type) if order not in [0, 1] and input.ndim > 0: @@ -188,14 +188,14 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if output_shape is None: output_shape = input.shape if input.ndim < 1 or len(output_shape) < 1: - raise RuntimeError, 'input and output rank must be > 0' + raise RuntimeError('input and output rank must be > 0') mode = _extend_mode_to_code(mode) if prefilter and order > 1: filtered = spline_filter(input, order, output = numpy.float64) @@ -285,18 +285,18 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') coordinates = numpy.asarray(coordinates) if numpy.iscomplexobj(coordinates): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') output_shape = coordinates.shape[1:] if input.ndim < 1 or len(output_shape) < 1: - raise RuntimeError, 'input and output rank must be > 0' + raise RuntimeError('input and output rank must be > 0') if coordinates.shape[0] != input.ndim: - raise RuntimeError, 'invalid shape for coordinate array' + raise RuntimeError('invalid shape for coordinate array') mode = _extend_mode_to_code(mode) if prefilter and order > 1: filtered = spline_filter(input, order, output = numpy.float64) @@ -366,14 +366,14 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if output_shape is None: output_shape = input.shape if input.ndim < 1 or len(output_shape) < 1: - raise RuntimeError, 'input and output rank must be > 0' + raise RuntimeError('input and output rank must be > 0') mode = _extend_mode_to_code(mode) if prefilter and order > 1: filtered = spline_filter(input, order, output = numpy.float64) @@ -383,17 +383,17 @@ output_type, shape = output_shape) matrix = numpy.asarray(matrix, dtype = numpy.float64) if matrix.ndim not in [1, 2] or matrix.shape[0] < 1: - raise RuntimeError, 'no proper affine matrix provided' + raise RuntimeError('no proper affine matrix provided') if matrix.shape[0] != input.ndim: - raise RuntimeError, 'affine matrix has wrong number of rows' + raise RuntimeError('affine matrix has wrong number of rows') if matrix.ndim == 2 and matrix.shape[1] != output.ndim: - raise RuntimeError, 'affine matrix has wrong number of columns' + raise RuntimeError('affine matrix has wrong number of columns') if not matrix.flags.contiguous: matrix = matrix.copy() offset = _ni_support._normalize_sequence(offset, input.ndim) offset = numpy.asarray(offset, dtype = numpy.float64) if offset.ndim != 1 or offset.shape[0] < 1: - raise RuntimeError, 'no proper offset provided' + raise RuntimeError('no proper offset provided') if not offset.flags.contiguous: offset = offset.copy() if matrix.ndim == 1: @@ -450,12 +450,12 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if input.ndim < 1: - raise RuntimeError, 'input and output rank must be > 0' + raise RuntimeError('input and output rank must be > 0') mode = _extend_mode_to_code(mode) if prefilter and order > 1: filtered = spline_filter(input, order, output = numpy.float64) @@ -515,12 +515,12 @@ """ if order < 0 or order > 5: - raise RuntimeError, 'spline order not supported' + raise RuntimeError('spline order not supported') input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if input.ndim < 1: - raise RuntimeError, 'input and output rank must be > 0' + raise RuntimeError('input and output rank must be > 0') mode = _extend_mode_to_code(mode) if prefilter and order > 1: filtered = spline_filter(input, order, output = numpy.float64) @@ -604,7 +604,7 @@ if axes[1] < 0: axes[1] += rank if axes[0] < 0 or axes[1] < 0 or axes[0] > rank or axes[1] > rank: - raise RuntimeError, 'invalid rotation plane specified' + raise RuntimeError('invalid rotation plane specified') if axes[0] > axes[1]: axes = axes[1], axes[0] angle = numpy.pi / 180 * angle Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/measurements.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -141,20 +141,20 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if structure is None: structure = morphology.generate_binary_structure(input.ndim, 1) structure = numpy.asarray(structure, dtype = bool) if structure.ndim != input.ndim: - raise RuntimeError, 'structure and input must have equal rank' + raise RuntimeError('structure and input must have equal rank') for ii in structure.shape: if ii != 3: - raise RuntimeError, 'structure dimensions must be equal to 3' + raise RuntimeError('structure dimensions must be equal to 3') if not structure.flags.contiguous: structure = structure.copy() if isinstance(output, numpy.ndarray): if output.dtype.type != numpy.int32: - raise RuntimeError, 'output type must be int32' + raise RuntimeError('output type must be int32') else: output = numpy.int32 output, return_value = _ni_support._get_output(output, input) @@ -217,7 +217,7 @@ """ input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if max_label < 1: max_label = input.max() return _nd_image.find_objects(input, max_label) @@ -299,7 +299,7 @@ if labels is None: if index is not None: - raise ValueError, "index without defined labels" + raise ValueError("index without defined labels") if not pass_positions: return func(input.ravel()) else: @@ -308,7 +308,8 @@ try: input, labels = numpy.broadcast_arrays(input, labels) except ValueError: - raise ValueError, "input and labels must have the same shape (excepting dimensions with width 1)" + raise ValueError("input and labels must have the same shape " + "(excepting dimensions with width 1)") if index is None: if not pass_positions: @@ -318,7 +319,9 @@ index = numpy.atleast_1d(index) if np.any(index.astype(labels.dtype).astype(index.dtype) != index): - raise ValueError, "Cannot convert index values from <%s> to <%s> (labels' type) without loss of precision"%(index.dtype, labels.dtype) + raise ValueError("Cannot convert index values from <%s> to <%s> " + "(labels' type) without loss of precision" % + (index.dtype, labels.dtype)) index = index.astype(labels.dtype) # optimization: find min/max in index, and select those parts of labels, input, and positions @@ -1105,20 +1108,20 @@ """ input = numpy.asarray(input) if input.dtype.type not in [numpy.uint8, numpy.uint16]: - raise TypeError, 'only 8 and 16 unsigned inputs are supported' + raise TypeError('only 8 and 16 unsigned inputs are supported') if structure is None: structure = morphology.generate_binary_structure(input.ndim, 1) structure = numpy.asarray(structure, dtype = bool) if structure.ndim != input.ndim: - raise RuntimeError, 'structure and input must have equal rank' + raise RuntimeError('structure and input must have equal rank') for ii in structure.shape: if ii != 3: - raise RuntimeError, 'structure dimensions must be equal to 3' + raise RuntimeError('structure dimensions must be equal to 3') if not structure.flags.contiguous: structure = structure.copy() markers = numpy.asarray(markers) if input.shape != markers.shape: - raise RuntimeError, 'input and markers must have equal shape' + raise RuntimeError('input and markers must have equal shape') integral_types = [numpy.int0, numpy.int8, @@ -1130,10 +1133,10 @@ numpy.intp] if markers.dtype.type not in integral_types: - raise RuntimeError, 'marker should be of integer type' + raise RuntimeError('marker should be of integer type') if isinstance(output, numpy.ndarray): if output.dtype.type not in integral_types: - raise RuntimeError, 'output should be of integer type' + raise RuntimeError('output should be of integer type') else: output = markers.dtype output, return_value = _ni_support._get_output(output, input) Modified: trunk/scipy/ndimage/morphology.py =================================================================== --- trunk/scipy/ndimage/morphology.py 2010-11-20 07:33:29 UTC (rev 6921) +++ trunk/scipy/ndimage/morphology.py 2010-11-20 07:52:46 UTC (rev 6922) @@ -219,27 +219,27 @@ border_value, origin, invert, brute_force): input = numpy.asarray(input) if numpy.iscomplexobj(input): - raise TypeError, 'Complex type not supported' + raise TypeError('Complex type not supported') if structure is None: structure = generate_binary_structure(input.ndim, 1) else: structure = numpy.asarray(structure) structure = structure.astype(bool) if structure.ndim != input.ndim: - raise RuntimeError, 'structure rank must equal input rank' + raise RuntimeError('structure rank must equal input rank') if not structure.flags.contiguous: structure = structure.copy() if numpy.product(structure.shape,axis=0) < 1: - raise RuntimeError, 'structure must not be empty' + raise RuntimeError('structure must not be empty') if mask is not None: mask = numpy.asarray(mask) if mask.shape != input.shape: - raise RuntimeError, 'mask and input must have equal sizes' + raise RuntimeError('mask and input must have equal sizes') origin = _ni_support._normalize_sequence(origin, input.ndim) cit = _center_is_true(structure, origin) if isinstance(output, numpy.ndarray): if numpy.iscomplexobj(output): - raise TypeError, 'Complex output type not supported' + raise TypeError('Complex output type not supported') else: output = bool output, return_value = _ni_support._get_output(output, input) @@ -1864,7 +1864,7 @@ """ if (not return_distances) and (not return_indices): msg = 'at least one of distances/indices must be specified' - raise RuntimeError, msg + raise RuntimeError(msg) tmp1 = numpy.asarray(input) != 0 struct = generate_binary_structure(tmp1.ndim, tmp1.ndim) tmp2 = binary_dilation(tmp1, struct) @@ -1879,7 +1879,7 @@ elif metric == 'chessboard': metric = 3 else: - raise RuntimeError, 'distance metric not supported' + raise RuntimeError('distance metric not supported') if sampling is not None: sampling = _ni_support._normalize_sequence(sampling, tmp1.ndim) sampling = numpy.asarray(sampling, dtype = numpy.float64) @@ -1897,13 +1897,13 @@ dt = numpy.zeros(tmp1.shape, dtype = numpy.uint32) else: if distances.shape != tmp1.shape: - raise RuntimeError, 'distances array has wrong shape' + raise RuntimeError('distances array has wrong shape') if metric == 1: if distances.dtype.type != numpy.float64: - raise RuntimeError, 'distances array must be float64' + raise RuntimeError('distances array must be float64') else: if distances.dtype.type != numpy.uint32: - raise RuntimeError, 'distances array must be uint32' + raise RuntimeError('distances array must be uint32') dt = distances else: dt = None @@ -1911,9 +1911,9 @@ if return_indices: if isinstance(indices, numpy.ndarray): if indices.dtype.type != numpy.int32: - raise RuntimeError, 'indices must of int32 type' + raise RuntimeError('indices must of int32 type') if indices.shape != (tmp1.ndim,) + tmp1.shape: - raise RuntimeError, 'indices has wrong shape' + raise RuntimeError('indices has wrong shape') tmp2 = indices else: tmp2 = numpy.indices(tmp1.shape, dtype = numpy.int32) @@ -1963,7 +1963,7 @@ """ if (not return_distances) and (not return_indices): msg = 'at least one of distances/indices must be specified' - raise RuntimeError, msg + raise RuntimeError(msg) ft_inplace = isinstance(indices, numpy.ndarray) dt_inplace = isinstance(distances, numpy.ndarray) input = numpy.asarray(input) @@ -1977,17 +1977,17 @@ try: metric = numpy.asarray(metric) except: - raise RuntimeError, 'invalid metric provided' + raise RuntimeError('invalid metric provided') for s in metric.shape: if s != 3: - raise RuntimeError, 'metric sizes must be equal to 3' + raise RuntimeError('metric sizes must be equal to 3') if not metric.flags.contiguous: metric = metric.copy() if dt_inplace: if distances.dtype.type != numpy.int32: - raise RuntimeError, 'distances must be of int32 type' + raise RuntimeError('distances must be of int32 type') if distances.shape != input.shape: - raise RuntimeError, 'distances has wrong shape' + raise RuntimeError('distances has wrong shape') dt = distances dt[...] = numpy.where(input, -1, 0).astype(numpy.int32) else: @@ -2010,9 +2010,9 @@ ft = numpy.ravel(ft) if ft_inplace: if indices.dtype.type != numpy.int32: - raise RuntimeError, 'indices must of int32 type' + raise RuntimeError('indices must of int32 type') if indices.shape != (dt.ndim,) + dt.shape: - raise RuntimeError, 'indices has wrong shape' + raise RuntimeError('indices has wrong shape') tmp = indices else: tmp = numpy.indices(dt.shape, dtype = numpy.int32) @@ -2148,7 +2148,7 @@ """ if (not return_distances) and (not return_indices): msg = 'at least one of distances/indices must be specified' - raise RuntimeError, msg + raise RuntimeError(msg) ft_inplace = isinstance(indices, numpy.ndarray) dt_inplace = isinstance(distances, numpy.ndarray) # calculate the feature transform @@ -2161,9 +2161,9 @@ if ft_inplace: ft = indices if ft.shape != (input.ndim,) + input.shape: - raise RuntimeError, 'indices has wrong shape' + raise RuntimeError('indices has wrong shape') if ft.dtype.type != numpy.int32: - raise RuntimeError, 'indices must be of int32 type' + raise RuntimeError('indices must be of int32 type') else: ft = numpy.zeros((input.ndim,) + input.shape, dtype = numpy.int32) @@ -2179,9 +2179,9 @@ if dt_inplace: dt = numpy.add.reduce(dt, axis = 0) if distances.shape != dt.shape: - raise RuntimeError, 'indices has wrong shape' + raise RuntimeError('indices has wrong shape') if distances.dtype.type != numpy.float64: - raise RuntimeError, 'indices must be of float64 type' + raise RuntimeError('indices must be of float64 type') numpy.sqrt(dt, distances) del dt else: From scipy-svn at scipy.org Sat Nov 20 03:02:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 02:02:42 -0600 (CST) Subject: [Scipy-svn] r6923 - trunk/scipy/ndimage Message-ID: <20101120080242.4561937D3CB@scipy.org> Author: warren.weckesser Date: 2010-11-20 02:02:42 -0600 (Sat, 20 Nov 2010) New Revision: 6923 Modified: trunk/scipy/ndimage/filters.py Log: Use sd2 computed outside the loop instead of dividing by sd twice. Modified: trunk/scipy/ndimage/filters.py =================================================================== --- trunk/scipy/ndimage/filters.py 2010-11-20 07:52:46 UTC (rev 6922) +++ trunk/scipy/ndimage/filters.py 2010-11-20 08:02:42 UTC (rev 6923) @@ -214,7 +214,7 @@ sd2 = sd * sd for ii in range(1, lw + 1): x = float(ii) - tmp = (3.0 - x * x / sd) * x * weights[lw + ii] / sd / sd + tmp = (3.0 - x * x / sd) * x * weights[lw + ii] / sd2 weights[lw + ii] = -tmp weights[lw - ii] = tmp return correlate1d(input, weights, axis, output, mode, cval, 0) From scipy-svn at scipy.org Sat Nov 20 03:03:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 02:03:52 -0600 (CST) Subject: [Scipy-svn] r6924 - trunk/scipy/ndimage Message-ID: <20101120080352.B7B1D37D3D2@scipy.org> Author: warren.weckesser Date: 2010-11-20 02:03:52 -0600 (Sat, 20 Nov 2010) New Revision: 6924 Modified: trunk/scipy/ndimage/measurements.py Log: ndimage: remove unused imports Modified: trunk/scipy/ndimage/measurements.py =================================================================== --- trunk/scipy/ndimage/measurements.py 2010-11-20 08:02:42 UTC (rev 6923) +++ trunk/scipy/ndimage/measurements.py 2010-11-20 08:03:52 UTC (rev 6924) @@ -28,8 +28,6 @@ # NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -import types -import math import numpy import numpy as np import _ni_support From scipy-svn at scipy.org Sat Nov 20 03:12:18 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 02:12:18 -0600 (CST) Subject: [Scipy-svn] r6925 - trunk/scipy/odr Message-ID: <20101120081218.2550337D3D2@scipy.org> Author: warren.weckesser Date: 2010-11-20 02:12:18 -0600 (Sat, 20 Nov 2010) New Revision: 6925 Modified: trunk/scipy/odr/odrpack.py Log: ENH: odr: update 'raise' statements Modified: trunk/scipy/odr/odrpack.py =================================================================== --- trunk/scipy/odr/odrpack.py 2010-11-20 08:03:52 UTC (rev 6924) +++ trunk/scipy/odr/odrpack.py 2010-11-20 08:12:18 UTC (rev 6925) @@ -316,7 +316,7 @@ if attr in self.meta.keys(): return self.meta[attr] else: - raise AttributeError, "'%s' not in metadata" % attr + raise AttributeError("'%s' not in metadata" % attr) class RealData(Data): @@ -355,9 +355,9 @@ def __init__(self, x, y=None, sx=None, sy=None, covx=None, covy=None, fix=None, meta={}): if (sx is not None) and (covx is not None): - raise ValueError, "cannot set both sx and covx" + raise ValueError("cannot set both sx and covx") if (sy is not None) and (covy is not None): - raise ValueError, "cannot set both sy and covy" + raise ValueError("cannot set both sy and covy") # Set flags for __getattr__ self._ga_flags = {} @@ -414,7 +414,7 @@ if attr in self.meta.keys(): return self.meta[attr] else: - raise AttributeError, "'%s' not in metadata" % attr + raise AttributeError("'%s' not in metadata" % attr) else: func, arg = lookup_tbl[(attr, self._ga_flags[attr])] @@ -528,7 +528,7 @@ if attr in self.meta.keys(): return self.meta[attr] else: - raise AttributeError, "'%s' not in metadata" % attr + raise AttributeError("'%s' not in metadata" % attr) class Output(object): @@ -1101,7 +1101,7 @@ """ if self.output is None: - raise odr_error, "cannot restart: run() has not been called before" + raise odr_error("cannot restart: run() has not been called before") self.set_job(restart=1) self.work = self.output.work From scipy-svn at scipy.org Sat Nov 20 03:27:43 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 02:27:43 -0600 (CST) Subject: [Scipy-svn] r6926 - in trunk/scipy/optimize: . tests Message-ID: <20101120082743.E1B4237C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 02:27:43 -0600 (Sat, 20 Nov 2010) New Revision: 6926 Modified: trunk/scipy/optimize/nnls.py trunk/scipy/optimize/optimize.py trunk/scipy/optimize/slsqp.py trunk/scipy/optimize/tests/test_optimize.py Log: ENH: optimize: update 'raise' statements Modified: trunk/scipy/optimize/nnls.py =================================================================== --- trunk/scipy/optimize/nnls.py 2010-11-20 08:12:18 UTC (rev 6925) +++ trunk/scipy/optimize/nnls.py 2010-11-20 08:27:43 UTC (rev 6926) @@ -28,21 +28,22 @@ A,b = map(asarray_chkfinite, (A,b)) if len(A.shape)!=2: - raise ValueError, "expected matrix" + raise ValueError("expected matrix") if len(b.shape)!=1: - raise ValueError, "expected vector" + raise ValueError("expected vector") m,n = A.shape if m != b.shape[0]: - raise ValueError, "incompatible dimensions" + raise ValueError("incompatible dimensions") w = zeros((n,), dtype=double) zz = zeros((m,), dtype=double) index=zeros((n,), dtype=int) x,rnorm,mode = _nnls.nnls(A,m,n,b,w,zz,index) - if mode != 1: raise RuntimeError, "too many iterations" + if mode != 1: + raise RuntimeError("too many iterations") return x, rnorm Modified: trunk/scipy/optimize/optimize.py =================================================================== --- trunk/scipy/optimize/optimize.py 2010-11-20 08:12:18 UTC (rev 6925) +++ trunk/scipy/optimize/optimize.py 2010-11-20 08:27:43 UTC (rev 6926) @@ -237,7 +237,7 @@ N = len(x0) rank = len(x0.shape) if not -1 < rank < 2: - raise ValueError, "Initial guess must be a scalar or rank-1 sequence." + raise ValueError("Initial guess must be a scalar or rank-1 sequence.") if maxiter is None: maxiter = N * 200 if maxfun is None: @@ -1285,7 +1285,7 @@ assert ((fb maxiter: - raise RuntimeError, "Too many iterations." + raise RuntimeError("Too many iterations.") iter += 1 if (w-xc)*(xb-w) > 0.0: fw = func(*((w,)+args)) @@ -1493,7 +1493,7 @@ N = len(x) rank = len(x.shape) if not -1 < rank < 2: - raise ValueError, "Initial guess must be a scalar or rank-1 sequence." + raise ValueError("Initial guess must be a scalar or rank-1 sequence.") if maxiter is None: maxiter = N * 1000 if maxfun is None: @@ -1629,8 +1629,8 @@ """ N = len(ranges) if N > 40: - raise ValueError, "Brute Force not possible with more " \ - "than 40 variables." + raise ValueError("Brute Force not possible with more " \ + "than 40 variables.") lrange = list(ranges) for k in range(N): if type(lrange[k]) is not type(slice(None)): Modified: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2010-11-20 08:12:18 UTC (rev 6925) +++ trunk/scipy/optimize/slsqp.py 2010-11-20 08:27:43 UTC (rev 6926) @@ -256,13 +256,13 @@ if len(bounds) == 0: bounds = [(-1.0E12, 1.0E12) for i in range(n)] elif len(bounds) != n: - raise IndexError, \ - 'SLSQP Error: If bounds is specified, len(bounds) == len(x0)' + raise IndexError('SLSQP Error: If bounds is specified, ' + 'len(bounds) == len(x0)') else: for i in range(len(bounds)): if bounds[i][0] > bounds[i][1]: - raise ValueError, \ - 'SLSQP Error: lb > ub in bounds[' + str(i) +'] ' + str(bounds[4]) + raise ValueError('SLSQP Error: lb > ub in bounds[' + str(i) + + '] ' + str(bounds[4])) xl = array( [ b[0] for b in bounds ] ) xu = array( [ b[1] for b in bounds ] ) Modified: trunk/scipy/optimize/tests/test_optimize.py =================================================================== --- trunk/scipy/optimize/tests/test_optimize.py 2010-11-20 08:12:18 UTC (rev 6925) +++ trunk/scipy/optimize/tests/test_optimize.py 2010-11-20 08:27:43 UTC (rev 6926) @@ -39,7 +39,7 @@ def func(self, x): self.funccalls += 1 if self.funccalls > 6000: - raise RuntimeError, "too many iterations in optimization routine" + raise RuntimeError("too many iterations in optimization routine") log_pdot = dot(self.F, x) logZ = log(sum(exp(log_pdot))) f = logZ - dot(self.K, x) From scipy-svn at scipy.org Sat Nov 20 09:54:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 08:54:24 -0600 (CST) Subject: [Scipy-svn] r6927 - trunk/scipy/ndimage/tests Message-ID: <20101120145424.87C5337C3EC@scipy.org> Author: warren.weckesser Date: 2010-11-20 08:54:23 -0600 (Sat, 20 Nov 2010) New Revision: 6927 Modified: trunk/scipy/ndimage/tests/test_ndimage.py Log: TST: ndimage: update a test to take into account single precision accuracy Modified: trunk/scipy/ndimage/tests/test_ndimage.py =================================================================== --- trunk/scipy/ndimage/tests/test_ndimage.py 2010-11-20 08:27:43 UTC (rev 6926) +++ trunk/scipy/ndimage/tests/test_ndimage.py 2010-11-20 14:54:23 UTC (rev 6927) @@ -457,7 +457,7 @@ assert_equal(input.shape, output.shape) def test_gauss03(self): - "gaussian filter 3" + "gaussian filter 3 - single precision data" input = numpy.arange(100 * 100).astype(numpy.float32) input.shape = (100, 100) output = ndimage.gaussian_filter(input, [1.0, 1.0]) @@ -465,7 +465,9 @@ assert_equal(input.dtype, output.dtype) assert_equal(input.shape, output.shape) - assert_almost_equal(output.sum(), input.sum()) + # input.sum() is 49995000.0. With single precision floats, we can't + # expect more than 8 digits of accuracy, so use decimal=0 in this test. + assert_almost_equal(output.sum(dtype='d'), input.sum(dtype='d'), decimal=0) assert_(sumsq(input, output) > 1.0) def test_gauss04(self): From scipy-svn at scipy.org Sat Nov 20 11:00:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 10:00:23 -0600 (CST) Subject: [Scipy-svn] r6928 - in trunk/scipy/sparse: . linalg/dsolve/umfpack linalg/dsolve/umfpack/tests linalg/isolve Message-ID: <20101120160023.D82C537C040@scipy.org> Author: warren.weckesser Date: 2010-11-20 10:00:23 -0600 (Sat, 20 Nov 2010) New Revision: 6928 Modified: trunk/scipy/sparse/base.py trunk/scipy/sparse/bsr.py trunk/scipy/sparse/compressed.py trunk/scipy/sparse/csr.py trunk/scipy/sparse/dok.py trunk/scipy/sparse/linalg/dsolve/umfpack/tests/try_umfpack.py trunk/scipy/sparse/linalg/dsolve/umfpack/umfpack.py trunk/scipy/sparse/linalg/isolve/utils.py trunk/scipy/sparse/spfuncs.py trunk/scipy/sparse/sputils.py Log: ENH: sparse: update 'raise' statements Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/base.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -52,8 +52,8 @@ self.format = self.__class__.__name__[:3] self._shape = None if self.format == 'spm': - raise ValueError, "This class is not intended" \ - " to be instantiated directly." + raise ValueError("This class is not intended" + " to be instantiated directly.") self.maxprint = maxprint def set_shape(self,shape): @@ -101,8 +101,8 @@ if self.dtype <= np.dtype(fp_type): return self.astype(fp_type) - raise TypeError,'cannot upcast [%s] to a floating \ - point format' % self.dtype.name + raise TypeError('cannot upcast [%s] to a floating ' + 'point format' % self.dtype.name) def __iter__(self): for r in xrange(self.shape[0]): @@ -126,7 +126,7 @@ try: return self.nnz except AttributeError: - raise AttributeError, "nnz not defined" + raise AttributeError("nnz not defined") def getformat(self): try: @@ -187,8 +187,8 @@ # non-zeros is more important. For now, raise an exception! def __len__(self): # return self.getnnz() - raise TypeError, "sparse matrix length is ambiguous; use getnnz()" \ - " or shape[0]" + raise TypeError("sparse matrix length is ambiguous; use getnnz()" + " or shape[0]") def asformat(self, format): """Return this matrix in a given sparse format @@ -426,7 +426,7 @@ elif attr == 'size': return self.getnnz() else: - raise AttributeError, attr + " not found" + raise AttributeError(attr + " not found") def transpose(self): return self.tocsr().transpose() @@ -541,7 +541,7 @@ # sum over rows and columns return ( self * np.asmatrix(np.ones((n, 1), dtype=self.dtype)) ).sum() else: - raise ValueError, "axis out of bounds" + raise ValueError("axis out of bounds") def mean(self, axis=None): """Average the matrix over the given axis. If the axis is None, @@ -558,7 +558,7 @@ elif axis is None: return self.sum(None) * 1.0 / (self.shape[0]*self.shape[1]) else: - raise ValueError, "axis out of bounds" + raise ValueError("axis out of bounds") def diagonal(self): """Returns the main diagonal of the matrix @@ -577,7 +577,7 @@ """ M, N = self.shape if (k > 0 and k >= N) or (k < 0 and -k >= M): - raise ValueError, "k exceedes matrix dimensions" + raise ValueError("k exceedes matrix dimensions") if k < 0: max_index = min(M+k, N, len(values)) for i,v in enumerate(values[:max_index]): Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/bsr.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -119,7 +119,7 @@ R,C = blocksize if (M % R) != 0 or (N % C) != 0: - raise ValueError, 'shape must be multiple of blocksize' + raise ValueError('shape must be multiple of blocksize') self.indptr = np.zeros(M//R + 1, dtype=np.intc ) @@ -200,25 +200,23 @@ # check array shapes if np.rank(self.indices) != 1 or np.rank(self.indptr) != 1: - raise ValueError,"indices, and indptr should be rank 1" + raise ValueError("indices, and indptr should be rank 1") if np.rank(self.data) != 3: - raise ValueError,"data should be rank 3" + raise ValueError("data should be rank 3") # check index pointer if (len(self.indptr) != M//R + 1 ): - raise ValueError, \ - "index pointer size (%d) should be (%d)" % \ - (len(self.indptr), M//R + 1) + raise ValueError("index pointer size (%d) should be (%d)" % + (len(self.indptr), M//R + 1)) if (self.indptr[0] != 0): - raise ValueError,"index pointer should start with 0" + raise ValueError("index pointer should start with 0") # check index and data arrays if (len(self.indices) != len(self.data)): - raise ValueError,"indices and data should have the same size" + raise ValueError("indices and data should have the same size") if (self.indptr[-1] > len(self.indices)): - raise ValueError, \ - "Last value of index pointer should be less than "\ - "the size of index and data arrays" + raise ValueError("Last value of index pointer should be less than " + "the size of index and data arrays") self.prune() @@ -227,12 +225,12 @@ if self.nnz > 0: if self.indices.max() >= N//C: print "max index",self.indices.max() - raise ValueError, "column index values must be < %d" % (N//C) + raise ValueError("column index values must be < %d" % (N//C)) if self.indices.min() < 0: - raise ValueError, "column index values must be >= 0" + raise ValueError("column index values must be >= 0") if diff(self.indptr).min() < 0: - raise ValueError,'index pointer values must form a " \ - "non-decreasing sequence' + raise ValueError("index pointer values must form a " + "non-decreasing sequence") #if not self.has_sorted_indices(): # warn('Indices were not in sorted order. Sorting indices.') @@ -475,14 +473,14 @@ M,N = self.shape if len(self.indptr) != M//R + 1: - raise ValueError, "index pointer has invalid length" + raise ValueError("index pointer has invalid length") bnnz = self.indptr[-1] if len(self.indices) < bnnz: - raise ValueError, "indices array has too few elements" + raise ValueError("indices array has too few elements") if len(self.data) < bnnz: - raise ValueError, "data array has too few elements" + raise ValueError("data array has too few elements") self.data = self.data[:bnnz] self.indices = self.indices[:bnnz] Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/compressed.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -57,16 +57,16 @@ self.indptr = np.array(indptr, copy=copy) self.data = np.array(data, copy=copy, dtype=getdtype(dtype, data)) else: - raise ValueError, "unrecognized %s_matrix constructor usage" %\ - self.format + raise ValueError("unrecognized %s_matrix constructor usage" % + self.format) else: #must be dense try: arg1 = np.asarray(arg1) except: - raise ValueError, "unrecognized %s_matrix constructor usage" % \ - self.format + raise ValueError("unrecognized %s_matrix constructor usage" % + self.format) from coo import coo_matrix self._set_self( self.__class__(coo_matrix(arg1, dtype=dtype)) ) @@ -80,7 +80,7 @@ major_dim = len(self.indptr) - 1 minor_dim = self.indices.max() + 1 except: - raise ValueError,'unable to infer matrix dimensions' + raise ValueError('unable to infer matrix dimensions') else: self.shape = self._swap((major_dim,minor_dim)) @@ -139,19 +139,17 @@ # check index pointer if (len(self.indptr) != major_dim + 1 ): - raise ValueError, \ - "index pointer size (%d) should be (%d)" % \ - (len(self.indptr), major_dim + 1) + raise ValueError("index pointer size (%d) should be (%d)" % + (len(self.indptr), major_dim + 1)) if (self.indptr[0] != 0): - raise ValueError,"index pointer should start with 0" + raise ValueError("index pointer should start with 0") # check index and data arrays if (len(self.indices) != len(self.data)): - raise ValueError,"indices and data should have the same size" + raise ValueError("indices and data should have the same size") if (self.indptr[-1] > len(self.indices)): - raise ValueError, \ - "Last value of index pointer should be less than "\ - "the size of index and data arrays" + raise ValueError("Last value of index pointer should be less than " + "the size of index and data arrays") self.prune() @@ -159,14 +157,14 @@ #check format validity (more expensive) if self.nnz > 0: if self.indices.max() >= minor_dim: - raise ValueError, "%s index values must be < %d" % \ - (minor_name,minor_dim) + raise ValueError("%s index values must be < %d" % + (minor_name,minor_dim)) if self.indices.min() < 0: - raise ValueError, "%s index values must be >= 0" % \ - minor_name + raise ValueError("%s index values must be >= 0" % + minor_name) if np.diff(self.indptr).min() < 0: - raise ValueError,'index pointer values must form a " \ - "non-decreasing sequence' + raise ValueError("index pointer values must form a " + "non-decreasing sequence") #if not self.has_sorted_indices(): # warn('Indices were not in sorted order. Sorting indices.') @@ -179,11 +177,11 @@ # First check if argument is a scalar if isscalarlike(other): # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a CSC or CSR ' \ - 'matrix is not supported' + raise NotImplementedError('adding a scalar to a CSC or CSR ' + 'matrix is not supported') elif isspmatrix(other): if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" + raise ValueError("inconsistent shapes") return self._binopt(other,'_plus_') elif isdense(other): @@ -199,11 +197,11 @@ # First check if argument is a scalar if isscalarlike(other): # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a sparse ' \ - 'matrix is not supported' + raise NotImplementedError('adding a scalar to a sparse ' + 'matrix is not supported') elif isspmatrix(other): if (other.shape != self.shape): - raise ValueError, "inconsistent shapes" + raise ValueError("inconsistent shapes") return self._binopt(other,'_minus_') elif isdense(other): @@ -216,8 +214,8 @@ #note: this can't be replaced by other + (-self) for unsigned types if isscalarlike(other): # Now we would add this scalar to every element. - raise NotImplementedError, 'adding a scalar to a sparse ' \ - 'matrix is not supported' + raise NotImplementedError('adding a scalar to a sparse ' + 'matrix is not supported') elif isdense(other): # Convert this matrix to a dense matrix and subtract them return other - self.todense() @@ -330,7 +328,7 @@ return self.data.sum() else: return spmatrix.sum(self,axis) - raise ValueError, "axis out of bounds" + raise ValueError("axis out of bounds") ####################### # Getting and Setting # @@ -361,7 +359,7 @@ elif isintlike(key): return self[key, :] else: - raise IndexError, "invalid index" + raise IndexError("invalid index") def _get_single_element(self,row,col): @@ -395,9 +393,9 @@ [start:stop:string, i] for column-oriented matrices """ if stride != 1: - raise ValueError, "slicing with step != 1 not supported" + raise ValueError("slicing with step != 1 not supported") if stop <= start: - raise ValueError, "slice width must be >= 1" + raise ValueError("slice width must be >= 1") #TODO make [i,:] faster #TODO implement [i,x:y:z] @@ -445,9 +443,8 @@ def _in_bounds( i0, i1, num ): if not (0<=i0= 1" + raise ValueError("slice width must be >= 1") #TODO make [i,:] faster #TODO implement [i,x:y:z] Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/dok.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -174,8 +174,8 @@ ################################### # We should reshape the new matrix here! ################################### - raise NotImplementedError, "fancy indexing supported over" \ - " one axis only" + raise NotImplementedError("fancy indexing supported over" + " one axis only") return new # Below here, j is a sequence, but i is an integer @@ -186,14 +186,14 @@ seq = j else: # j is not an integer - raise TypeError, "index must be a pair of integers or slices" + raise TypeError("index must be a pair of integers or slices") # Create a new matrix of the correct dimensions first = seq[0] last = seq[-1] if first < 0 or first >= self.shape[1] or last < 0 \ or last >= self.shape[1]: - raise IndexError, "index out of bounds" + raise IndexError("index out of bounds") newshape = (1, last-first+1) new = dok_matrix(newshape) # ** This uses linear time in the size n of dimension 1: @@ -212,7 +212,7 @@ try: i, j = key except (ValueError, TypeError): - raise TypeError, "index must be a pair of integers or slices" + raise TypeError("index must be a pair of integers or slices") # First deal with the case where both i and j are integers if isintlike(i) and isintlike(j): @@ -222,7 +222,7 @@ j += self.shape[1] if i < 0 or i >= self.shape[0] or j < 0 or j >= self.shape[1]: - raise IndexError, "index out of bounds" + raise IndexError("index out of bounds") if np.isscalar(value): if value==0 and self.has_key((i,j)): @@ -243,7 +243,7 @@ else: # Make sure i is an integer. (But allow it to be a subclass of int). if not isintlike(i): - raise TypeError, "index must be a pair of integers or slices" + raise TypeError("index must be a pair of integers or slices") seq = None if seq is not None: # First see if 'value' is another dok_matrix of the appropriate @@ -253,8 +253,8 @@ for element in seq: self[element, j] = value[element, 0] else: - raise NotImplementedError, "setting a 2-d slice of" \ - " a dok_matrix is not yet supported" + raise NotImplementedError("setting a 2-d slice of" + " a dok_matrix is not yet supported") elif np.isscalar(value): for element in seq: self[element, j] = value @@ -262,12 +262,12 @@ # See if value is a sequence try: if len(seq) != len(value): - raise ValueError, "index and value ranges must" \ - " have the same length" + raise ValueError("index and value ranges must" + " have the same length") except TypeError: # Not a sequence - raise TypeError, "unsupported type for" \ - " dok_matrix.__setitem__" + raise TypeError("unsupported type for" + " dok_matrix.__setitem__") # Value is a sequence for element, val in izip(seq, value): @@ -283,7 +283,7 @@ seq = j else: # j is not an integer - raise TypeError, "index must be a pair of integers or slices" + raise TypeError("index must be a pair of integers or slices") # First see if 'value' is another dok_matrix of the appropriate # dimensions @@ -292,8 +292,8 @@ for element in seq: self[i, element] = value[0, element] else: - raise NotImplementedError, "setting a 2-d slice of" \ - " a dok_matrix is not yet supported" + raise NotImplementedError("setting a 2-d slice of" + " a dok_matrix is not yet supported") elif np.isscalar(value): for element in seq: self[i, element] = value @@ -301,11 +301,11 @@ # See if value is a sequence try: if len(seq) != len(value): - raise ValueError, "index and value ranges must have" \ - " the same length" + raise ValueError("index and value ranges must have" + " the same length") except TypeError: # Not a sequence - raise TypeError, "unsupported type for dok_matrix.__setitem__" + raise TypeError("unsupported type for dok_matrix.__setitem__") else: for element, val in izip(seq, value): self[i, element] = val @@ -325,7 +325,7 @@ #new.dtype.char = self.dtype.char elif isinstance(other, dok_matrix): if other.shape != self.shape: - raise ValueError, "matrix dimensions are not equal" + raise ValueError("matrix dimensions are not equal") # We could alternatively set the dimensions to the the largest of # the two matrices to be summed. Would this be a good idea? new = dok_matrix(self.shape, dtype=self.dtype) @@ -338,7 +338,7 @@ elif isdense(other): new = self.todense() + other else: - raise TypeError, "data type not understood" + raise TypeError("data type not understood") return new def __radd__(self, other): @@ -354,7 +354,7 @@ new[i, j] = aij elif isinstance(other, dok_matrix): if other.shape != self.shape: - raise ValueError, "matrix dimensions are not equal" + raise ValueError("matrix dimensions are not equal") new = dok_matrix(self.shape, dtype=self.dtype) new.update(self) for key in other: @@ -365,7 +365,7 @@ elif isdense(other): new = other + self.todense() else: - raise TypeError, "data type not understood" + raise TypeError("data type not understood") return new def __neg__(self): @@ -534,8 +534,8 @@ non-zero elements that lie outside. """ if not isshape(shape): - raise TypeError, "dimensions must be a 2-tuple of positive"\ - " integers" + raise TypeError("dimensions must be a 2-tuple of positive" + " integers") newM, newN = shape M, N = self.shape if newM < M or newN < N: Modified: trunk/scipy/sparse/linalg/dsolve/umfpack/tests/try_umfpack.py =================================================================== --- trunk/scipy/sparse/linalg/dsolve/umfpack/tests/try_umfpack.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/linalg/dsolve/umfpack/tests/try_umfpack.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -83,7 +83,7 @@ try: readMatrix = formatMap[options.format] except: - raise ValueError, 'unsupported format: %s' % options.format + raise ValueError('unsupported format: %s' % options.format) print 'format:', options.format @@ -180,7 +180,7 @@ try: import pylab except ImportError: - raise ImportError, "could not import pylab" + raise ImportError("could not import pylab") times = np.array( times ) print times pylab.plot( times[:,0], 'b-o' ) Modified: trunk/scipy/sparse/linalg/dsolve/umfpack/umfpack.py =================================================================== --- trunk/scipy/sparse/linalg/dsolve/umfpack/umfpack.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/linalg/dsolve/umfpack/umfpack.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -277,7 +277,7 @@ Struct.__init__( self, **kwargs ) if family not in umfFamilyTypes.keys(): - raise TypeError, 'wrong family: %s' % family + raise TypeError('wrong family: %s' % family) self.family = family self.control = np.zeros( (UMFPACK_CONTROL, ), dtype = np.double ) @@ -328,25 +328,25 @@ indx = mtx.indices self.isCSR = 1 else: - raise TypeError, 'must be a CSC/CSR matrix (is %s)' % mtx.__class__ + raise TypeError('must be a CSC/CSR matrix (is %s)' % mtx.__class__) ## # Should check types of indices to correspond to familyTypes. if self.family[1] == 'i': if (indx.dtype != np.dtype('i')) \ or mtx.indptr.dtype != np.dtype('i'): - raise ValueError, 'matrix must have int indices' + raise ValueError('matrix must have int indices') else: if (indx.dtype != np.dtype('l')) \ or mtx.indptr.dtype != np.dtype('l'): - raise ValueError, 'matrix must have long indices' + raise ValueError('matrix must have long indices') if self.isReal: if mtx.data.dtype != np.dtype('= 2: - raise RuntimeError, '%s failed with %s' % (self.funs.numeric, - umfStatus[status]) + raise RuntimeError('%s failed with %s' % (self.funs.numeric, + umfStatus[status])) ## # 14.12.2005, c @@ -507,7 +507,7 @@ assumes CSC internally """ if sys not in umfSys: - raise ValueError, 'sys must be in' % umfSys + raise ValueError('sys must be in' % umfSys) if autoTranspose and self.isCSR: ## @@ -517,13 +517,13 @@ if sys in umfSys_transposeMap[ii]: sys = umfSys_transposeMap[ii][sys] else: - raise RuntimeError, 'autoTranspose ambiguous, switch it off' + raise RuntimeError('autoTranspose ambiguous, switch it off') if self._numeric is not None: if self.mtx is not mtx: - raise ValueError, 'must be called with same matrix as numeric()' + raise ValueError('must be called with same matrix as numeric()') else: - raise RuntimeError, 'numeric() not called' + raise RuntimeError('numeric() not called') indx = self._getIndx( mtx ) @@ -551,8 +551,8 @@ print 'zeroing nan and inf entries...' sol[~np.isfinite( sol )] = 0.0 else: - raise RuntimeError, '%s failed with %s' % (self.funs.solve, - umfStatus[status]) + raise RuntimeError('%s failed with %s' % (self.funs.solve, + umfStatus[status])) econd = 1.0 / self.info[UMFPACK_RCOND] if econd > self.maxCond: print 'warning: (almost) singular matrix! '\ @@ -581,7 +581,7 @@ # print self.family if sys not in umfSys: - raise ValueError, 'sys must be in' % umfSys + raise ValueError('sys must be in' % umfSys) if self._numeric is None: self.numeric( mtx ) @@ -646,8 +646,8 @@ = self.funs.get_lunz( self._numeric ) if status != UMFPACK_OK: - raise RuntimeError, '%s failed with %s' % (self.funs.get_lunz, - umfStatus[status]) + raise RuntimeError('%s failed with %s' % (self.funs.get_lunz, + umfStatus[status])) #allocate storage for decomposition data i_type = mtx.indptr.dtype @@ -673,8 +673,8 @@ self._numeric ) if status != UMFPACK_OK: - raise RuntimeError, '%s failed with %s'\ - % (self.funs.get_numeric, umfStatus[status]) + raise RuntimeError('%s failed with %s' + % (self.funs.get_numeric, umfStatus[status])) L = sp.csr_matrix((Lx,Lj,Lp),(n_row,min(n_row,n_col))) U = sp.csc_matrix((Ux,Ui,Up),(min(n_row,n_col),n_col)) @@ -693,8 +693,8 @@ self._numeric) if status != UMFPACK_OK: - raise RuntimeError, '%s failed with %s'\ - % (self.funs.get_numeric, umfStatus[status]) + raise RuntimeError('%s failed with %s' + % (self.funs.get_numeric, umfStatus[status])) Lxz = np.zeros( (lnz,), dtype = np.complex128 ) Modified: trunk/scipy/sparse/linalg/isolve/utils.py =================================================================== --- trunk/scipy/sparse/linalg/isolve/utils.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/linalg/isolve/utils.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -93,7 +93,7 @@ xtype = b.dtype.char else: if xtype not in 'fdFD': - raise ValueError, "xtype must be 'f', 'd', 'F', or 'D'" + raise ValueError("xtype must be 'f', 'd', 'F', or 'D'") b = asarray(b,dtype=xtype) #make b the same type as x b = b.ravel() Modified: trunk/scipy/sparse/spfuncs.py =================================================================== --- trunk/scipy/sparse/spfuncs.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/spfuncs.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -41,7 +41,7 @@ return (1,1) if not 0 < efficiency < 1.0: - raise ValueError,'efficiency must satisfy 0.0 < efficiency < 1.0' + raise ValueError('efficiency must satisfy 0.0 < efficiency < 1.0') high_efficiency = (1.0 + efficiency) / 2.0 nnz = float(A.nnz) @@ -85,7 +85,7 @@ """ r,c = blocksize if r < 1 or c < 1: - raise ValueError,'r and c must be positive' + raise ValueError('r and c must be positive') if isspmatrix_csr(A): M,N = A.shape Modified: trunk/scipy/sparse/sputils.py =================================================================== --- trunk/scipy/sparse/sputils.py 2010-11-20 14:54:23 UTC (rev 6927) +++ trunk/scipy/sparse/sputils.py 2010-11-20 16:00:23 UTC (rev 6928) @@ -44,7 +44,7 @@ if np.can_cast(sample.dtype,t): return t - raise TypeError,'no supported conversion for types: %s' % args + raise TypeError('no supported conversion for types: %s' % args) def to_native(A): @@ -68,7 +68,7 @@ newdtype = np.dtype(default) canCast = False else: - raise TypeError, "could not interpret data type" + raise TypeError("could not interpret data type") else: newdtype = np.dtype(dtype) From scipy-svn at scipy.org Sat Nov 20 11:05:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 10:05:57 -0600 (CST) Subject: [Scipy-svn] r6929 - in trunk: doc/release scipy/sparse Message-ID: <20101120160557.AA2C137C043@scipy.org> Author: warren.weckesser Date: 2010-11-20 10:05:57 -0600 (Sat, 20 Nov 2010) New Revision: 6929 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/sparse/base.py Log: DEP: sparse: removed a deprecated method from the spmatrix class. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-20 16:00:23 UTC (rev 6928) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-20 16:05:57 UTC (rev 6929) @@ -123,3 +123,6 @@ The deprecated modules ``helpdmod``, ``pexec`` and ``ppimport`` were removed from ``scipy.misc``. + +The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has +been deprecated since version 0.7, was removed. Modified: trunk/scipy/sparse/base.py =================================================================== --- trunk/scipy/sparse/base.py 2010-11-20 16:00:23 UTC (rev 6928) +++ trunk/scipy/sparse/base.py 2010-11-20 16:05:57 UTC (rev 6929) @@ -587,26 +587,7 @@ for i,v in enumerate(values[:max_index]): self[i, i + k] = v - def save(self, file_name, format = '%d %d %f\n'): - #deprecated on Dec 14 2007 - #remove after 0.7 release - warn('save() is deprecated, consider using mmwrite() or savemat()' \ - ' provided by scipy.io instead', - DeprecationWarning) - try: - fd = open(file_name, 'w') - except Exception, e: - raise e, file_name - fd.write('%d %d\n' % self.shape) - fd.write('%d\n' % self.size) - for ii in xrange(self.size): - ir, ic = self.rowcol(ii) - data = self.getdata(ii) - fd.write(format % (ir, ic, data)) - fd.close() - - from sputils import _isinstance def isspmatrix(x): From scipy-svn at scipy.org Sat Nov 20 11:25:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 10:25:57 -0600 (CST) Subject: [Scipy-svn] r6930 - trunk/scipy/sparse Message-ID: <20101120162557.7B5EF37A197@scipy.org> Author: warren.weckesser Date: 2010-11-20 10:25:57 -0600 (Sat, 20 Nov 2010) New Revision: 6930 Modified: trunk/scipy/sparse/bsr.py trunk/scipy/sparse/coo.py trunk/scipy/sparse/dok.py Log: BUG: sparse: fix a few undefined names found by pyflakes (but there are more down in the subdirectories of linalg) Modified: trunk/scipy/sparse/bsr.py =================================================================== --- trunk/scipy/sparse/bsr.py 2010-11-20 16:05:57 UTC (rev 6929) +++ trunk/scipy/sparse/bsr.py 2010-11-20 16:25:57 UTC (rev 6930) @@ -228,7 +228,7 @@ raise ValueError("column index values must be < %d" % (N//C)) if self.indices.min() < 0: raise ValueError("column index values must be >= 0") - if diff(self.indptr).min() < 0: + if np.diff(self.indptr).min() < 0: raise ValueError("index pointer values must form a " "non-decreasing sequence") Modified: trunk/scipy/sparse/coo.py =================================================================== --- trunk/scipy/sparse/coo.py 2010-11-20 16:05:57 UTC (rev 6929) +++ trunk/scipy/sparse/coo.py 2010-11-20 16:25:57 UTC (rev 6930) @@ -11,7 +11,7 @@ from sparsetools import coo_tocsr, coo_todense, coo_matvec from base import isspmatrix from data import _data_matrix -from sputils import upcast, to_native, isshape, getdtype +from sputils import upcast, to_native, isshape, getdtype, isintlike class coo_matrix(_data_matrix): """ Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2010-11-20 16:05:57 UTC (rev 6929) +++ trunk/scipy/sparse/dok.py 2010-11-20 16:25:57 UTC (rev 6930) @@ -448,7 +448,7 @@ M, N = self.shape new = dok_matrix((N, M), dtype=self.dtype) for key, value in self.iteritems(): - new[key[1], key[0]] = conj(value) + new[key[1], key[0]] = np.conj(value) return new def copy(self): @@ -464,13 +464,13 @@ N = len(cols_or_rows) if indx: # columns for key in self.keys(): - num = searchsorted(cols_or_rows, key[1]) + num = np.searchsorted(cols_or_rows, key[1]) if num < N: newkey = (key[0], num) new[newkey] = self[key] else: for key in self.keys(): - num = searchsorted(cols_or_rows, key[0]) + num = np.searchsorted(cols_or_rows, key[0]) if num < N: newkey = (num, key[1]) new[newkey] = self[key] @@ -484,7 +484,7 @@ indx = int((columns == 1)) if indx: for key in self.keys(): - num = searchsorted(cols_or_rows, key[1]) + num = np.searchsorted(cols_or_rows, key[1]) if cols_or_rows[num] == key[1]: newkey = (key[0], num) ext[newkey] = self[key] @@ -493,7 +493,7 @@ base[newkey] = self[key] else: for key in self.keys(): - num = searchsorted(cols_or_rows, key[0]) + num = np.searchsorted(cols_or_rows, key[0]) if cols_or_rows[num] == key[0]: newkey = (num, key[1]) ext[newkey] = self[key] From scipy-svn at scipy.org Sat Nov 20 11:29:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 10:29:25 -0600 (CST) Subject: [Scipy-svn] r6931 - in trunk/scipy/special: amos utils Message-ID: <20101120162925.1DC6837D3B0@scipy.org> Author: warren.weckesser Date: 2010-11-20 10:29:24 -0600 (Sat, 20 Nov 2010) New Revision: 6931 Modified: trunk/scipy/special/amos/setup.py trunk/scipy/special/utils/makenpz.py Log: ENH: special: update 'raise' statements Modified: trunk/scipy/special/amos/setup.py =================================================================== --- trunk/scipy/special/amos/setup.py 2010-11-20 16:25:57 UTC (rev 6930) +++ trunk/scipy/special/amos/setup.py 2010-11-20 16:29:24 UTC (rev 6931) @@ -23,7 +23,7 @@ print cmd failure = os.system(cmd) if failure: - raise ValueError, 'failure during compile' + raise ValueError('failure during compile') def object_to_library(self,library_name,object_files): objects = " ".join(object_files) cmd = 'ar -cr lib%s.a %s' % (library_name,objects) Modified: trunk/scipy/special/utils/makenpz.py =================================================================== --- trunk/scipy/special/utils/makenpz.py 2010-11-20 16:25:57 UTC (rev 6930) +++ trunk/scipy/special/utils/makenpz.py 2010-11-20 16:29:24 UTC (rev 6931) @@ -52,7 +52,7 @@ for i, val in enumerate(args): key = 'arr_%d' % i if key in namedict.keys(): - raise ValueError, "Cannot use un-named variables and keyword %s" % key + raise ValueError("Cannot use un-named variables and keyword %s" % key) namedict[key] = val zip = zipfile.ZipFile(file, mode="w", compression=zipfile.ZIP_DEFLATED) From scipy-svn at scipy.org Sat Nov 20 11:49:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 10:49:57 -0600 (CST) Subject: [Scipy-svn] r6932 - trunk/scipy/special Message-ID: <20101120164957.B52FB37D3B0@scipy.org> Author: warren.weckesser Date: 2010-11-20 10:49:57 -0600 (Sat, 20 Nov 2010) New Revision: 6932 Modified: trunk/scipy/special/__init__.py trunk/scipy/special/basic.py Log: special: Don't use 'import *' in basic.py. The 'import *' from _cephes and numpy were moved up to __init__.py to maintain the same namespace in scipy.special. Modified: trunk/scipy/special/__init__.py =================================================================== --- trunk/scipy/special/__init__.py 2010-11-20 16:29:24 UTC (rev 6931) +++ trunk/scipy/special/__init__.py 2010-11-20 16:49:57 UTC (rev 6932) @@ -5,6 +5,8 @@ from info import __doc__, __docformat__ #from special_version import special_version as __version__ +from _cephes import * +from numpy import * from basic import * import specfun import orthogonal Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2010-11-20 16:29:24 UTC (rev 6931) +++ trunk/scipy/special/basic.py 2010-11-20 16:49:57 UTC (rev 6932) @@ -2,8 +2,11 @@ # Author: Travis Oliphant, 2002 # -from numpy import * -from _cephes import * +from numpy import pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, \ + where, mgrid, cos, sin, exp, place, seterr, issubdtype, extract, \ + complexfloating, less, vectorize, inexact, nan, zeros, sometrue +from _cephes import ellipk, mathieu_a, mathieu_b, iv, jv, gamma, psi, zeta, \ + hankel1, hankel2, yv, kv, gammaln, errprint, ndtri import types import specfun import orthogonal From scipy-svn at scipy.org Sat Nov 20 13:13:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 12:13:30 -0600 (CST) Subject: [Scipy-svn] r6933 - trunk/scipy/special Message-ID: <20101120181330.74A5432341@scipy.org> Author: warren.weckesser Date: 2010-11-20 12:13:28 -0600 (Sat, 20 Nov 2010) New Revision: 6933 Modified: trunk/scipy/special/__init__.py Log: BUG: special: reverse the order of the numpy and _cephes 'import *' statements so _cephes is second and the _cephes versions of duplicated functions take precedence. Modified: trunk/scipy/special/__init__.py =================================================================== --- trunk/scipy/special/__init__.py 2010-11-20 16:49:57 UTC (rev 6932) +++ trunk/scipy/special/__init__.py 2010-11-20 18:13:28 UTC (rev 6933) @@ -5,8 +5,9 @@ from info import __doc__, __docformat__ #from special_version import special_version as __version__ +from numpy import * from _cephes import * -from numpy import * + from basic import * import specfun import orthogonal From scipy-svn at scipy.org Sat Nov 20 13:19:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 12:19:29 -0600 (CST) Subject: [Scipy-svn] r6934 - in trunk/scipy/stats: . tests Message-ID: <20101120181929.6735B37A198@scipy.org> Author: warren.weckesser Date: 2010-11-20 12:19:28 -0600 (Sat, 20 Nov 2010) New Revision: 6934 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/morestats.py trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_fit.py Log: ENH: stats: update 'raise' statements Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-20 18:13:28 UTC (rev 6933) +++ trunk/scipy/stats/distributions.py 2010-11-20 18:19:28 UTC (rev 6934) @@ -566,7 +566,7 @@ args, loc, scale = self._fix_loc_scale(args, loc, scale) cond = logical_and(self._argcheck(*args),(scale >= 0)) if not all(cond): - raise ValueError, "Domain error in arguments." + raise ValueError("Domain error in arguments.") # self._size is total size of all output values self._size = product(size, axis=0) @@ -713,7 +713,7 @@ """ alpha = arr(alpha) if any((alpha > 1) | (alpha < 0)): - raise ValueError, "alpha must be between 0 and 1 inclusive" + raise ValueError("alpha must be between 0 and 1 inclusive") q1 = (1.0-alpha)/2 q2 = (1.0+alpha)/2 a = self.ppf(q1, *args, **kwds) @@ -1536,8 +1536,8 @@ """ if (floor(n) != n): - raise ValueError, "Moment must be an integer." - if (n < 0): raise ValueError, "Moment must be positive." + raise ValueError("Moment must be an integer.") + if (n < 0): raise ValueError("Moment must be positive.") if (n == 0): return 1.0 if (n > 0) and (n < 5): signature = inspect.getargspec(self._stats.im_func) @@ -1581,7 +1581,7 @@ scale = theta[-1] args = tuple(theta[:-2]) except IndexError: - raise ValueError, "Not enough input arguments." + raise ValueError("Not enough input arguments.") if not self._argcheck(*args) or scale <= 0: return inf x = arr((x-loc) / scale) @@ -1616,7 +1616,7 @@ restore = None else: if len(fixedn) == len(index): - raise ValueError, "All parameters fixed. There is nothing to optimize." + raise ValueError("All parameters fixed. There is nothing to optimize.") def restore(args, theta): # Replace with theta for all numbers not in fixedn # This allows the non-fixed values to vary, but @@ -1683,7 +1683,7 @@ """ Narg = len(args) if Narg > self.numargs: - raise ValueError, "Too many input arguments." + raise ValueError("Too many input arguments.") start = [None]*2 if (Narg < self.numargs) or not (kwds.has_key('loc') and kwds.has_key('scale')): @@ -1704,7 +1704,7 @@ try: optimizer = getattr(optimize, optimizer) except AttributeError: - raise ValueError, "%s is not a valid optimizer" % optimizer + raise ValueError("%s is not a valid optimizer" % optimizer) vals = optimizer(func,x0,args=(ravel(data),),disp=0) vals = tuple(vals) if restore is not None: @@ -4504,7 +4504,7 @@ else: qk = arr(qk) if len(qk) != len(pk): - raise ValueError, "qk and pk must have same length." + raise ValueError("qk and pk must have same length.") qk = 1.0*qk / sum(qk,axis=0) # If qk is zero anywhere, then unless pk is zero at those places # too, the relative entropy is infinite. @@ -5400,8 +5400,8 @@ """ if (floor(n) != n): - raise ValueError, "Moment must be an integer." - if (n < 0): raise ValueError, "Moment must be positive." + raise ValueError("Moment must be an integer.") + if (n < 0): raise ValueError("Moment must be positive.") if (n == 0): return 1.0 if (n > 0) and (n < 5): signature = inspect.getargspec(self._stats.im_func) Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-11-20 18:13:28 UTC (rev 6933) +++ trunk/scipy/stats/morestats.py 2010-11-20 18:19:28 UTC (rev 6934) @@ -298,11 +298,11 @@ res = inspect.getargspec(ppf_func) if not ('loc' == res[0][-2] and 'scale' == res[0][-1] and \ 0.0==res[-1][-2] and 1.0==res[-1][-1]): - raise ValueError, "Function has does not have default location", \ - "and scale parameters\n that are 0.0 and 1.0 respectively." + raise ValueError("Function has does not have default location " + "and scale parameters\n that are 0.0 and 1.0 respectively.") if (len(sparams) < len(res[0])-len(res[-1])-1) or \ (len(sparams) > len(res[0])-3): - raise ValueError, "Incorrect number of shape parameters." + raise ValueError("Incorrect number of shape parameters.") """ osm = ppf_func(Ui,*sparams) osr = sort(x) @@ -340,11 +340,11 @@ res = inspect.getargspec(ppf_func) if not ('loc' == res[0][-2] and 'scale' == res[0][-1] and \ 0.0==res[-1][-2] and 1.0==res[-1][-1]): - raise ValueError, "Function has does not have default location", \ - "and scale parameters\n that are 0.0 and 1.0 respectively." + raise ValueError("Function has does not have default location " + "and scale parameters\n that are 0.0 and 1.0 respectively.") if (1 < len(res[0])-len(res[-1])-1) or \ (1 > len(res[0])-3): - raise ValueError, "Must be a one-parameter family." + raise ValueError("Must be a one-parameter family.") """ N = len(x) # compute uniform median statistics Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-20 18:13:28 UTC (rev 6933) +++ trunk/scipy/stats/mstats_basic.py 2010-11-20 18:19:28 UTC (rev 6934) @@ -686,7 +686,7 @@ else: x = ma.asarray(x).flatten() if len(x) != n: - raise ValueError, "Incompatible lengths ! (%s<>%s)" % (n,len(x)) + raise ValueError("Incompatible lengths ! (%s<>%s)" % (n,len(x))) m = ma.mask_or(ma.getmask(x), ma.getmask(y)) y._mask = x._mask = m ny = y.count() @@ -760,7 +760,7 @@ def ttest_rel(a,b,axis=None): a, b, axis = _chk2_asarray(a, b, axis) if len(a)!=len(b): - raise ValueError, 'unequal length arrays' + raise ValueError('unequal length arrays') (x1, x2) = (a.mean(axis), b.mean(axis)) (v1, v2) = (a.var(axis=axis, ddof=1), b.var(axis=axis, ddof=1)) n = a.count(axis) @@ -840,7 +840,7 @@ ties = count_tied_groups(ranks) T = 1. - np.sum(v*(k**3-k) for (k,v) in ties.iteritems())/float(ntot**3-ntot) if T == 0: - raise ValueError, 'All numbers are identical in kruskal' + raise ValueError('All numbers are identical in kruskal') H /= T # df = len(output) - 1 Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-20 18:13:28 UTC (rev 6933) +++ trunk/scipy/stats/stats.py 2010-11-20 18:19:28 UTC (rev 6934) @@ -1491,7 +1491,7 @@ elif kind == 'mean': return (sum(a < score) + sum(a <= score)) * 50 / float(n) else: - raise ValueError, "kind can only be 'rank', 'strict', 'weak' or 'mean'" + raise ValueError("kind can only be 'rank', 'strict', 'weak' or 'mean'") def histogram2(a, bins): @@ -1668,7 +1668,7 @@ if v[j] - np.mean(nargs[j]) > TINY: check = 0 if check != 1: - raise ValueError, 'Lack of convergence in obrientransform.' + raise ValueError('Lack of convergence in obrientransform.') else: return array(nargs) @@ -2115,7 +2115,7 @@ lowercut = int(proportiontocut*len(a)) uppercut = len(a) - lowercut if (lowercut >= uppercut): - raise ValueError, "Proportion too big." + raise ValueError("Proportion too big.") return a[lowercut:uppercut] @@ -2218,7 +2218,7 @@ y = np.transpose(y) N = m.shape[0] if (y.shape[0] != N): - raise ValueError, "x and y must have the same number of observations." + raise ValueError("x and y must have the same number of observations.") m = m - np.mean(m,axis=0) y = y - np.mean(y,axis=0) if bias: @@ -3050,7 +3050,7 @@ """ a, b, axis = _chk2_asarray(a, b, axis) if a.shape[axis] != b.shape[axis]: - raise ValueError, 'unequal length arrays' + raise ValueError('unequal length arrays') n = a.shape[axis] df = float(n-1) @@ -3201,7 +3201,7 @@ cdf = getattr(distributions, rvs).cdf rvs = getattr(distributions, rvs).rvs else: - raise AttributeError, 'if rvs is string, cdf has to be the same distribution' + raise AttributeError('if rvs is string, cdf has to be the same distribution') if isinstance(cdf, basestring): @@ -3427,7 +3427,7 @@ #T = np.sqrt(tiecorrect(ranked)) # correction factor for tied scores T = tiecorrect(ranked) if T == 0: - raise ValueError, 'All numbers are identical in amannwhitneyu' + raise ValueError('All numbers are identical in amannwhitneyu') sd = np.sqrt(T*n1*n2*(n1+n2+1)/12.0) if use_continuity: @@ -3565,7 +3565,7 @@ h = 12.0 / (totaln*(totaln+1)) * ssbn - 3*(totaln+1) df = len(args) - 1 if T == 0: - raise ValueError, 'All numbers are identical in kruskal' + raise ValueError('All numbers are identical in kruskal') h = h / float(T) return h, chisqprob(h,df) @@ -3608,11 +3608,11 @@ """ k = len(args) if k < 3: - raise ValueError, '\nLess than 3 levels. Friedman test not appropriate.\n' + raise ValueError('\nLess than 3 levels. Friedman test not appropriate.\n') n = len(args[0]) for i in range(1,k): if len(args[i]) <> n: - raise ValueError, 'Unequal N in friedmanchisquare. Aborting.' + raise ValueError('Unequal N in friedmanchisquare. Aborting.') # Rank data data = apply(_support.abut,args) Modified: trunk/scipy/stats/tests/test_fit.py =================================================================== --- trunk/scipy/stats/tests/test_fit.py 2010-11-20 18:13:28 UTC (rev 6933) +++ trunk/scipy/stats/tests/test_fit.py 2010-11-20 18:19:28 UTC (rev 6934) @@ -47,7 +47,7 @@ diffthreshold[-2] = np.max([np.abs(rvs.mean())*thresh_percent,thresh_min]) if np.any(np.isnan(est)): - raise AssertionError, 'nan returned in fit' + raise AssertionError('nan returned in fit') else: if np.any((np.abs(diff) - diffthreshold) > 0.0): ## txt = 'WARNING - diff too large with small sample' @@ -60,7 +60,7 @@ txt = 'parameter: %s\n' % str(truearg) txt += 'estimated: %s\n' % str(est) txt += 'diff : %s\n' % str(diff) - raise AssertionError, 'fit not very good in %s\n' % distfn.name + txt + raise AssertionError('fit not very good in %s\n' % distfn.name + txt) From scipy-svn at scipy.org Sat Nov 20 13:42:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 12:42:42 -0600 (CST) Subject: [Scipy-svn] r6935 - in trunk/scipy/weave: . tests Message-ID: <20101120184242.8F4AF32341@scipy.org> Author: warren.weckesser Date: 2010-11-20 12:42:42 -0600 (Sat, 20 Nov 2010) New Revision: 6935 Modified: trunk/scipy/weave/accelerate_tools.py trunk/scipy/weave/base_spec.py trunk/scipy/weave/blitz_spec.py trunk/scipy/weave/build_tools.py trunk/scipy/weave/bytecodecompiler.py trunk/scipy/weave/catalog.py trunk/scipy/weave/ext_tools.py trunk/scipy/weave/inline_tools.py trunk/scipy/weave/platform_info.py trunk/scipy/weave/size_check.py trunk/scipy/weave/swig2_spec.py trunk/scipy/weave/tests/test_size_check.py trunk/scipy/weave/tests/weave_test_utils.py Log: ENH: weave: update 'raise' statements. Modified: trunk/scipy/weave/accelerate_tools.py =================================================================== --- trunk/scipy/weave/accelerate_tools.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/accelerate_tools.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -265,7 +265,7 @@ elif issubclass(T, InstanceType): return Instance(x) else: - raise NotImplementedError,T + raise NotImplementedError(T) ################################################################## # class ACCELERATE # @@ -332,7 +332,7 @@ weave.build_tools.build_extension(self.module.__name__+'_weave.cpp',verbose=2) if accelerated_module: - raise NotImplementedError,'Reload' + raise NotImplementedError('Reload') else: accelerated_module = __import__(self.module.__name__+'_weave') @@ -356,10 +356,10 @@ def code(self,*args): if len(args) != self.function.func_code.co_argcount: - raise TypeError,'%s() takes exactly %d arguments (%d given)'%( - self.function.__name__, - self.function.func_code.co_argcount, - len(args)) + raise TypeError('%s() takes exactly %d arguments (%d given)' % + (self.function.__name__, + self.function.func_code.co_argcount, + len(args))) signature = tuple( map(lookup_type,args) ) ident = self.function.__name__ return self.accelerate(signature,ident).function_code() Modified: trunk/scipy/weave/base_spec.py =================================================================== --- trunk/scipy/weave/base_spec.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/base_spec.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -30,7 +30,7 @@ def set_compiler(self,compiler): self.compiler = compiler def type_match(self,value): - raise NotImplementedError, "You must override method in derived class" + raise NotImplementedError("You must override method in derived class") def build_information(self): return self._build_information def type_spec(self,name,value): Modified: trunk/scipy/weave/blitz_spec.py =================================================================== --- trunk/scipy/weave/blitz_spec.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/blitz_spec.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -101,7 +101,7 @@ if new_spec.dims > 11: msg = "Error converting variable '" + name + "'. " \ "blitz only supports arrays up to 11 dimensions." - raise ValueError, msg + raise ValueError(msg) return new_spec def template_vars(self,inline=0): Modified: trunk/scipy/weave/build_tools.py =================================================================== --- trunk/scipy/weave/build_tools.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/build_tools.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -407,7 +407,7 @@ if not os.access(temp_dir,os.W_OK): msg = "Either the temp or build directory wasn't writable. Check" \ " these locations: '%s'" % temp_dir - raise ValueError, msg + raise ValueError(msg) return temp_dir def configure_build_dir(build_dir=None): @@ -434,7 +434,7 @@ if not os.access(build_dir,os.W_OK): msg = "The build directory wasn't writable. Check" \ " this location: '%s'" % build_dir - raise ValueError, msg + raise ValueError(msg) return os.path.abspath(build_dir) Modified: trunk/scipy/weave/bytecodecompiler.py =================================================================== --- trunk/scipy/weave/bytecodecompiler.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/bytecodecompiler.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -987,7 +987,7 @@ if module and id(module.__dict__) == myHash: break else: - raise ValueError,'Cannot locate module owning %s'%var_name + raise ValueError('Cannot locate module owning %s' % var_name) return module_name,var_name @@ -1157,7 +1157,7 @@ for VV,TT in map(None, self.stack, self.types): print VV,':',TT if t is None: - raise TypeError,'%s used before set?'%v + raise TypeError('%s used before set?' % v) print self.__body print 'PC',pc self.push(v,t) @@ -1288,7 +1288,7 @@ self.types[var_num] = t return - raise TypeError,(t,saveT) + raise TypeError((t,saveT)) ################################################################## # MEMBER STORE_GLOBAL # @@ -1364,7 +1364,7 @@ ) self.post(pc+delta,action) if not isinstance(t, int): - raise TypeError, 'Invalid comparison type %s'%t + raise TypeError('Invalid comparison type %s' % t) self.emit('if (%s) {\n'%v) @@ -1386,7 +1386,7 @@ if hasattr(self,'rtype'): if t is None: return # just the extra return - raise ValueError,'multiple returns: (v=%s, t=%s)' % (v, t) + raise ValueError('multiple returns: (v=%s, t=%s)' % (v, t)) self.rtype = t if t is None: self.emit('return;') Modified: trunk/scipy/weave/catalog.py =================================================================== --- trunk/scipy/weave/catalog.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/catalog.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -295,7 +295,7 @@ """ if mode not in ['c','r','w','n']: msg = " mode must be 'c', 'n', 'r', or 'w'. See anydbm for more info" - raise ValueError, msg + raise ValueError(msg) catalog_file = catalog_path(module_path) if (catalog_file is not None) \ and ((dumb and os.path.exists(catalog_file+'.dat')) \ @@ -680,7 +680,7 @@ os.remove(f) cat = get_catalog(cat_dir,mode) if cat is None: - raise ValueError, 'Failed to access a catalog for storing functions' + raise ValueError('Failed to access a catalog for storing functions') # Prabhu was getting some corrupt catalog errors. I'll put a try/except # to protect against this, but should really try and track down the issue. function_list = [function] Modified: trunk/scipy/weave/ext_tools.py =================================================================== --- trunk/scipy/weave/ext_tools.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/ext_tools.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -366,7 +366,7 @@ compiler_name = compiler, verbose = verbose, **kw) if not success: - raise SystemError, 'Compilation failed' + raise SystemError('Compilation failed') def generate_file_name(module_name,module_location): module_file = os.path.join(module_location,module_name) @@ -420,7 +420,7 @@ errors[var] = ("Unable to convert variable '"+ var + "' to a C++ type.") if errors: - raise TypeError, format_error_msg(errors) + raise TypeError(format_error_msg(errors)) if auto_downcast: variable_specs = downcast(variable_specs) Modified: trunk/scipy/weave/inline_tools.py =================================================================== --- trunk/scipy/weave/inline_tools.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/inline_tools.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -327,13 +327,13 @@ if msg[:16] == "Conversion Error": pass else: - raise TypeError, msg + raise TypeError(msg) except NameError, msg: msg = str(msg).strip() if msg[:16] == "Conversion Error": pass else: - raise NameError, msg + raise NameError(msg) except KeyError: pass # 2. try function catalog @@ -372,13 +372,13 @@ if msg[:16] == "Conversion Error": pass else: - raise TypeError, msg + raise TypeError(msg) except NameError, msg: msg = str(msg).strip() if msg[:16] == "Conversion Error": pass else: - raise NameError, msg + raise NameError(msg) except KeyError: pass # 2. try catalog cache. @@ -397,13 +397,13 @@ if msg[:16] == "Conversion Error": pass else: - raise TypeError, msg + raise TypeError(msg) except NameError, msg: msg = str(msg).strip() if msg[:16] == "Conversion Error": pass else: - raise NameError, msg + raise NameError(msg) # 3. try persistent catalog module_dir = global_dict.get('__file__',None) function_list = function_catalog.get_functions(code,module_dir) @@ -416,7 +416,7 @@ except: # should specify argument types here. pass # if we get here, the function wasn't found - raise ValueError, 'function with correct signature not found' + raise ValueError('function with correct signature not found') def inline_function_code(code,arg_names,local_dict=None, global_dict=None,auto_downcast = 1, Modified: trunk/scipy/weave/platform_info.py =================================================================== --- trunk/scipy/weave/platform_info.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/platform_info.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -113,7 +113,7 @@ exe_name = compiler_exe_name(compiler_obj) exe_path = compiler_exe_path(exe_name) if not exe_path: - raise ValueError, "The '%s' compiler was not found." % compiler_name + raise ValueError("The '%s' compiler was not found." % compiler_name) chk_sum = check_sum(exe_path) restore_sys_argv() Modified: trunk/scipy/weave/size_check.py =================================================================== --- trunk/scipy/weave/size_check.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/size_check.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -98,7 +98,7 @@ res[i] = x[i] else: # offer more information here about which variables. - raise ValueError, "frames are not aligned" + raise ValueError("frames are not aligned") return res class dummy_array(object): @@ -170,14 +170,14 @@ if not isinstance(indices, tuple): indices = (indices,) if Ellipsis in indices: - raise IndexError, "Ellipsis not currently supported" + raise IndexError("Ellipsis not currently supported") new_dims = [] dim = 0 for index in indices: try: dim_len = self.shape[dim] except IndexError: - raise IndexError, "To many indices specified" + raise IndexError("To many indices specified") #if (type(index) is SliceType and index.start == index.stop == index.step): if (index is empty_slice): @@ -237,11 +237,11 @@ #this reduces the array dimensions by one pass else: - raise IndexError, "Index out of range" + raise IndexError("Index out of range") dim += 1 new_dims.extend(self.shape[dim:]) if 0 in new_dims: - raise IndexError, "Zero length slices not currently supported" + raise IndexError("Zero length slices not currently supported") return dummy_array(new_dims,1) def __repr__(self): val = str((self.name, str(self.shape))) @@ -269,7 +269,7 @@ if axis < 0: axis += len(ary.shape) if axis < 0 or axis >= len(ary.shape): - raise ValueError, "Dimension not in array" + raise ValueError("Dimension not in array") new_dims = list(ary.shape[:axis]) + list(ary.shape[axis+1:]) return dummy_array(new_dims,1) Modified: trunk/scipy/weave/swig2_spec.py =================================================================== --- trunk/scipy/weave/swig2_spec.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/swig2_spec.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -266,7 +266,7 @@ elif rv == 3: self.support_code.append(swigptr2.swigptr2_code_v3) else: - raise AssertionError, "Unsupported version of the SWIG runtime:", rv + raise AssertionError("Unsupported version of the SWIG runtime: %s" % rv) self.support_code.append(swig2_common_code) @@ -339,7 +339,7 @@ elif swig_ob_type == 'pyswig': pycobj = 2 else: - raise AssertionError, "Does not look like a SWIG object: %s"%value + raise AssertionError("Does not look like a SWIG object: %s" % value) if pycobj: class_name = value.__class__.__name__ Modified: trunk/scipy/weave/tests/test_size_check.py =================================================================== --- trunk/scipy/weave/tests/test_size_check.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/tests/test_size_check.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -124,7 +124,7 @@ if 0 not in desired: msg = '%s raised IndexError in dummy_array, but forms\n' \ 'valid array shape -> %s' % (expr, str(desired)) - raise AttributeError, msg + raise AttributeError(msg) def generic_1d(self,expr): a = np.arange(10) self.generic_wrap(a,expr) Modified: trunk/scipy/weave/tests/weave_test_utils.py =================================================================== --- trunk/scipy/weave/tests/weave_test_utils.py 2010-11-20 18:19:28 UTC (rev 6934) +++ trunk/scipy/weave/tests/weave_test_utils.py 2010-11-20 18:42:42 UTC (rev 6935) @@ -108,20 +108,17 @@ return dst if not isfile(src): - raise DistutilsFileError, \ - "can't move '%s': not a regular file" % src + raise DistutilsFileError("can't move '%s': not a regular file" % src) if isdir(dst): dst = os.path.join(dst, basename(src)) elif exists(dst): - raise DistutilsFileError, \ - "can't move '%s': destination '%s' already exists" % \ - (src, dst) + raise DistutilsFileError("can't move '%s': destination '%s' already " + "exists" % (src, dst)) if not isdir(dirname(dst)): - raise DistutilsFileError, \ - "can't move '%s': destination '%s' not a valid path" % \ - (src, dst) + raise DistutilsFileError("can't move '%s': destination '%s' not a " + "valid path" % (src, dst)) copy_it = 0 try: @@ -130,8 +127,8 @@ if num == errno.EXDEV: copy_it = 1 else: - raise DistutilsFileError, \ - "couldn't move '%s' to '%s': %s" % (src, dst, msg) + raise DistutilsFileError("couldn't move '%s' to '%s': %s" % + (src, dst, msg)) if copy_it: distutils.file_util.copy_file(src, dst) @@ -142,9 +139,7 @@ os.unlink(dst) except os.error: pass - raise DistutilsFileError, \ - ("couldn't move '%s' to '%s' by copy/delete: " + - "delete '%s' failed: %s") % \ - (src, dst, src, msg) + raise DistutilsFileError("couldn't move '%s' to '%s' by copy/delete: " + "delete '%s' failed: %s" % (src, dst, src, msg)) return dst From scipy-svn at scipy.org Sat Nov 20 13:49:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Nov 2010 12:49:16 -0600 (CST) Subject: [Scipy-svn] r6936 - in trunk: scipy tools/osx Message-ID: <20101120184916.1F41B1B856D@scipy.org> Author: warren.weckesser Date: 2010-11-20 12:49:16 -0600 (Sat, 20 Nov 2010) New Revision: 6936 Modified: trunk/scipy/__init__.py trunk/tools/osx/install_and_test.py Log: ENH: a couple more updated 'raise' statements Modified: trunk/scipy/__init__.py =================================================================== --- trunk/scipy/__init__.py 2010-11-20 18:42:42 UTC (rev 6935) +++ trunk/scipy/__init__.py 2010-11-20 18:49:16 UTC (rev 6936) @@ -77,7 +77,7 @@ from numpy import show_config as show_numpy_config if show_numpy_config is None: - raise ImportError,"Cannot import scipy when running from numpy source directory." + raise ImportError("Cannot import scipy when running from numpy source directory.") from numpy import __version__ as __numpy_version__ # Import numpy symbols to scipy name space Modified: trunk/tools/osx/install_and_test.py =================================================================== --- trunk/tools/osx/install_and_test.py 2010-11-20 18:42:42 UTC (rev 6935) +++ trunk/tools/osx/install_and_test.py 2010-11-20 18:49:16 UTC (rev 6936) @@ -25,7 +25,7 @@ pkg = fn break if pkg is None: - raise IOError, 'Package is not found in directory %s' % distdir + raise IOError('Package is not found in directory %s' % distdir) pkgpath = os.path.abspath(os.path.join(SRC_DIR, DIST_DIR, pkg)) color_print('Installing package: %s' % pkgpath) From scipy-svn at scipy.org Sun Nov 21 04:57:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Nov 2010 03:57:23 -0600 (CST) Subject: [Scipy-svn] r6937 - in trunk/scipy/stats: . tests Message-ID: <20101121095723.E5EE137A197@scipy.org> Author: rgommers Date: 2010-11-21 03:57:22 -0600 (Sun, 21 Nov 2010) New Revision: 6937 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: BUG: fix nanmedian for scalar inputs. Closes #1098. Thanks to Keith Goodman. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-20 18:49:16 UTC (rev 6936) +++ trunk/scipy/stats/stats.py 2010-11-21 09:57:22 UTC (rev 6937) @@ -408,9 +408,14 @@ array([ 2. , 9. , 15. , 20.5, 26. ]) """ - x, axis = _chk_asarray(x,axis) + x, axis = _chk_asarray(x, axis) + if x.ndim == 0: + return float(x.item()) x = x.copy() - return np.apply_along_axis(_nanmedian,axis,x) + x = np.apply_along_axis(_nanmedian, axis, x) + if x.ndim == 0: + x = float(x.item()) + return x ##################################### Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-20 18:49:16 UTC (rev 6936) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-21 09:57:22 UTC (rev 6937) @@ -254,6 +254,14 @@ m = stats.nanmedian(self.Xall) assert_(np.isnan(m)) + def test_nanmedian_scalars(self): + """Check nanmedian for scalar inputs. See ticket #1098.""" + assert_equal(stats.nanmedian(1), np.median(1)) + assert_equal(stats.nanmedian(True), np.median(True)) + assert_equal(stats.nanmedian(np.array(1)), np.median(np.array(1))) + assert_equal(stats.nanmedian(np.nan), np.median(np.nan)) + + class TestCorrPearsonr(TestCase): """ W.II.D. Compute a correlation matrix on all the variables. From scipy-svn at scipy.org Sun Nov 21 19:39:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Nov 2010 18:39:26 -0600 (CST) Subject: [Scipy-svn] r6938 - trunk/scipy/signal Message-ID: <20101122003926.AADF737B09F@scipy.org> Author: warren.weckesser Date: 2010-11-21 18:39:25 -0600 (Sun, 21 Nov 2010) New Revision: 6938 Modified: trunk/scipy/signal/wavelets.py Log: signal: Don't use a plain assert for argument validation. Modified: trunk/scipy/signal/wavelets.py =================================================================== --- trunk/scipy/signal/wavelets.py 2010-11-21 09:57:22 UTC (rev 6937) +++ trunk/scipy/signal/wavelets.py 2010-11-22 00:39:25 UTC (rev 6938) @@ -19,7 +19,8 @@ """ sqrt = np.sqrt - assert(p>=1) + if p < 1: + raise ValueError("p must be at least 1.") if p==1: c = 1/sqrt(2) return np.array([c,c]) From scipy-svn at scipy.org Tue Nov 23 09:28:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 23 Nov 2010 08:28:53 -0600 (CST) Subject: [Scipy-svn] r6939 - in trunk/scipy/stats: . tests Message-ID: <20101123142853.2DF4237A18D@scipy.org> Author: rgommers Date: 2010-11-23 08:28:52 -0600 (Tue, 23 Nov 2010) New Revision: 6939 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: ENH: stats: check shape of inputs in fisher_exact. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-22 00:39:25 UTC (rev 6938) +++ trunk/scipy/stats/stats.py 2010-11-23 14:28:52 UTC (rev 6939) @@ -2379,12 +2379,12 @@ return r,prob -def fisher_exact(c) : +def fisher_exact(table) : """Performs a Fisher exact test on a 2x2 contingency table. Parameters ---------- - c : array_like of ints + table : array_like of ints A 2x2 contingency table. Returns @@ -2407,7 +2407,9 @@ (0.25, 0.13007593634330314) """ hypergeom = distributions.hypergeom - c = np.asarray(c, dtype=np.int64) # int32 is not enough for the algorithm + c = np.asarray(table, dtype=np.int64) # int32 is not enough for the algorithm + if not c.shape == (2, 2): + raise ValueError("The input `table` must be of shape (2, 2).") if c[1,0] > 0 and c[0,1] > 0: odssratio = c[0,0] * c[1,1] / float(c[1,0] * c[0,1]) Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-22 00:39:25 UTC (rev 6938) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-23 14:28:52 UTC (rev 6939) @@ -447,7 +447,10 @@ np.testing.assert_almost_equal(res[1], res_r[1], decimal=11, verbose=True) + # test we raise an error for wrong shape of input. + assert_raises(ValueError, fisher_exact, np.arange(6).reshape(2, 3)) + class TestCorrSpearmanr(TestCase): """ W.II.D. Compute a correlation matrix on all the variables. From scipy-svn at scipy.org Tue Nov 23 16:23:11 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 23 Nov 2010 15:23:11 -0600 (CST) Subject: [Scipy-svn] r6940 - trunk/scipy/special/specfun Message-ID: <20101123212311.5A57237D3B8@scipy.org> Author: ptvirtan Date: 2010-11-23 15:23:10 -0600 (Tue, 23 Nov 2010) New Revision: 6940 Modified: trunk/scipy/special/specfun/specfun.f Log: STY: special: strip trailing whitespace from specfun.f Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2010-11-23 14:28:52 UTC (rev 6939) +++ trunk/scipy/special/specfun/specfun.f 2010-11-23 21:23:10 UTC (rev 6940) @@ -1,15 +1,15 @@ C COMPUTATION OF SPECIAL FUNCTIONS -C +C C Shanjie Zhang and Jianming Jin C -C Copyrighted but permission granted to use code in programs. +C Copyrighted but permission granted to use code in programs. C Buy their book "Computation of Special Functions", 1996, John Wiley & Sons, Inc. C C C Compiled into a single source file and changed REAL To DBLE throughout. C C Changed according to ERRATA also. -C +C C Changed GAMMA to GAMMA2 and PSI to PSI_SPEC to avoid potential conflicts. C @@ -65,7 +65,7 @@ END - + C ********************************** SUBROUTINE CFS(Z,ZF,ZD) @@ -135,7 +135,7 @@ C ========================================================== C Purpose: Compute the associated Legendre functions of the C second kind, Qmn(x) and Qmn'(x) -C Input : x --- Argument of Qmn(x) +C Input : x --- Argument of Qmn(x) C m --- Order of Qmn(x) ( m = 0,1,2,? ) C n --- Degree of Qmn(x) ( n = 0,1,2,? ) C mm --- Physical dimension of QM and QD @@ -224,8 +224,8 @@ SUBROUTINE CLPMN(MM,M,N,X,Y,CPM,CPD) C C ========================================================= -C Purpose: Compute the associated Legendre functions Pmn(z) -C and their derivatives Pmn'(z) for a complex +C Purpose: Compute the associated Legendre functions Pmn(z) +C and their derivatives Pmn'(z) for a complex C argument C Input : x --- Real part of z C y --- Imaginary part of z @@ -336,7 +336,7 @@ END - + C ********************************** C SciPy: Changed P from a character array to an integer array. SUBROUTINE JDZO(NT,N,M,P,ZO) @@ -357,9 +357,9 @@ C P(L) --- 0 (TM) or 1 (TE), a code for designating the C zeros of Jn(x) or Jn'(x). C In the waveguide applications, the zeros -C of Jn(x) correspond to TM modes and +C of Jn(x) correspond to TM modes and C those of Jn'(x) correspond to TE modes -C Routine called: BJNDD for computing Jn(x), Jn'(x) and +C Routine called: BJNDD for computing Jn(x), Jn'(x) and C Jn''(x) C ============================================================= C @@ -449,7 +449,7 @@ END - + C ********************************** SUBROUTINE CBK(M,N,C,CV,QT,CK,BK) @@ -519,13 +519,13 @@ END - + C ********************************** SUBROUTINE CJY01(Z,CBJ0,CDJ0,CBJ1,CDJ1,CBY0,CDY0,CBY1,CDY1) C C ======================================================= -C Purpose: Compute Bessel functions J0(z), J1(z), Y0(z), +C Purpose: Compute Bessel functions J0(z), J1(z), Y0(z), C Y1(z), and their derivatives for a complex C argument C Input : z --- Complex argument @@ -670,9 +670,9 @@ C of the second kind with a small argument C Routines called: C (1) LPMNS for computing the associated Legendre -C functions of the first kind +C functions of the first kind C (2) LQMNS for computing the associated Legendre -C functions of the second kind +C functions of the second kind C (3) KMN for computing expansion coefficients C and joining factors C ====================================================== @@ -767,7 +767,7 @@ END - + C ********************************** SUBROUTINE BERNOB(N,BN) @@ -780,7 +780,7 @@ C IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION BN(0:N) - TPI=6.283185307179586D0 + TPI=6.283185307179586D0 BN(0)=1.0D0 BN(1)=-0.5D0 BN(2)=1.0D0/6.0D0 @@ -847,7 +847,7 @@ 10 SK=SK+CK(K+1)*CK(L-K+1) 15 S=S+SK*AP(I-L+1) 20 AP(I+1)=-R*S - QS0=AP(M+1) + QS0=AP(M+1) DO 30 L=1,M R=1.0D0 DO 25 K=1,L @@ -859,7 +859,7 @@ END - + C ********************************** SUBROUTINE CV0(KD,M,Q,A0) @@ -1026,7 +1026,7 @@ END - + C ********************************** SUBROUTINE CVQM(M,Q,A0) @@ -1083,7 +1083,7 @@ END - + C ********************************** SUBROUTINE CSPHJY(N,Z,NM,CSJ,CDJ,CSY,CDY) @@ -1169,12 +1169,12 @@ INTEGER FUNCTION MSTA1(X,MP) C C =================================================== -C Purpose: Determine the starting point for backward -C recurrence such that the magnitude of +C Purpose: Determine the starting point for backward +C recurrence such that the magnitude of C Jn(x) at that point is about 10^(-MP) C Input : x --- Argument of Jn(x) C MP --- Value of magnitude -C Output: MSTA1 --- Starting point +C Output: MSTA1 --- Starting point C =================================================== C IMPLICIT DOUBLE PRECISION (A-H,O-Z) @@ -1183,8 +1183,8 @@ F0=ENVJ(N0,A0)-MP N1=N0+5 F1=ENVJ(N1,A0)-MP - DO 10 IT=1,20 - NN=N1-(N1-N0)/(1.0D0-F0/F1) + DO 10 IT=1,20 + NN=N1-(N1-N0)/(1.0D0-F0/F1) F=ENVJ(NN,A0)-MP IF(ABS(NN-N1).LT.1) GO TO 20 N0=N1 @@ -1442,7 +1442,7 @@ END - + C ********************************** SUBROUTINE RMN2L(M,N,C,X,DF,KD,R2F,R2D,ID) @@ -1453,7 +1453,7 @@ C c and a large cx C Routine called: C SPHY for computing the spherical Bessel -C functions of the second kind +C functions of the second kind C ======================================================== C IMPLICIT DOUBLE PRECISION (A-H,O-Z) @@ -1471,7 +1471,7 @@ R0=REG DO 10 J=1,2*M+IP 10 R0=R0*J - R=R0 + R=R0 SUC=R*DF(1) SW=0.0D0 DO 15 K=2,NM @@ -1503,7 +1503,7 @@ ID=10 RETURN ENDIF - B0=KD*M/X**3.0D0/(1.0-KD/(X*X))*R2F + B0=KD*M/X**3.0D0/(1.0-KD/(X*X))*R2F SUD=0.0D0 EPS2=0.0D0 DO 60 K=1,NM @@ -1520,14 +1520,14 @@ EPS2=DABS(SUD-SW) IF (K.GT.NM1.AND.EPS2.LT.DABS(SUD)*EPS) GO TO 65 60 SW=SUD -65 R2D=B0+A0*C*SUD +65 R2D=B0+A0*C*SUD ID2=INT(LOG10(EPS2/DABS(SUD)+EPS)) ID=MAX(ID1,ID2) RETURN END - + C ********************************** SUBROUTINE PSI_SPEC(X,PS) @@ -1667,7 +1667,7 @@ END - + C ********************************** SUBROUTINE LPMNS(M,N,X,PM,PD) @@ -1719,7 +1719,7 @@ PM(K)=PM2 PMK=PM1 25 PM1=PM2 - PD(0)=((1.0D0-M)*PM(1)-X*PM(0))/(X*X-1.0) + PD(0)=((1.0D0-M)*PM(1)-X*PM(0))/(X*X-1.0) DO 30 K=1,N 30 PD(K)=(K*X*PM(K)-(K+M)*PM(K-1))/(X*X-1.0D0) DO 35 K=1,N @@ -1822,11 +1822,11 @@ C the second kind C Routines called: C (1) SDMN for computing expansion coefficients dk -C (2) RMN1 for computing prolate and oblate radial +C (2) RMN1 for computing prolate and oblate radial C functions of the first kind C (3) RMN2L for computing prolate and oblate radial C functions of the second kind for a large argument -C (4) RMN2SP for computing the prolate radial function +C (4) RMN2SP for computing the prolate radial function C of the second kind for a small argument C ============================================================== C @@ -1847,14 +1847,14 @@ END - + C ********************************** SUBROUTINE JYNDD(N,X,BJN,DJN,FJN,BYN,DYN,FYN) C C =========================================================== C Purpose: Compute Bessel functions Jn(x) and Yn(x), and -C their first and second derivatives +C their first and second derivatives C Input: x --- Argument of Jn(x) and Yn(x) ( x > 0 ) C n --- Order of Jn(x) and Yn(x) C Output: BJN --- Jn(x) @@ -2012,7 +2012,7 @@ END - + C ********************************** SUBROUTINE CISIA(X,CI,SI) @@ -2314,7 +2314,7 @@ C KF=1 for Ai(x) and Ai'(x) C KF=2 for Bi(x) and Bi'(x) C Output: XA(m) --- a, the m-th zero of Ai(x) or -C b, the m-th zero of Bi(x) +C b, the m-th zero of Bi(x) C XB(m) --- a', the m-th zero of Ai'(x) or C b', the m-th zero of Bi'(x) C XC(m) --- Ai(a') or Bi(b') @@ -2395,7 +2395,7 @@ END - + C ********************************** SUBROUTINE ERROR(X,ERR) @@ -2473,8 +2473,8 @@ IF (CDABS(CR/CS).LT.1.0D-15) GO TO 15 10 CONTINUE 15 CER=2.0D0*C0*CS/DSQRT(PI) - ELSE - CL=1.0D0/Z1 + ELSE + CL=1.0D0/Z1 CR=CL C C Asymptotic series; maximum K must be at most ~ R^2. @@ -2535,7 +2535,7 @@ C C ============================================================ C Purpose: Compute a sequence of characteristic values of -C Mathieu functions +C Mathieu functions C Input : M --- Maximum order of Mathieu functions C q --- Parameter of Mathieu functions C KD --- Case code @@ -2778,10 +2778,10 @@ C C ======================================================== C Purpose: Compute the expansion coefficients for the -C asymptotic expansion of Bessel functions +C asymptotic expansion of Bessel functions C with large orders C Input : Km --- Maximum k -C Output: A(L) --- Cj(k) where j and k are related to L +C Output: A(L) --- Cj(k) where j and k are related to L C by L=j+1+[k*(k+1)]/2; j,k=0,1,...,Km C ======================================================== C @@ -2887,12 +2887,12 @@ C Purpose: Compute lambda function with arbitrary order v, C and their derivative C Input : x --- Argument of lambda function -C v --- Order of lambda function +C v --- Order of lambda function C Output: VL(n) --- Lambda function of order n+v0 -C DL(n) --- Derivative of lambda function +C DL(n) --- Derivative of lambda function C VM --- Highest order computed C Routines called: -C (1) MSTA1 and MSTA2 for computing the starting +C (1) MSTA1 and MSTA2 for computing the starting C point for backward recurrence C (2) GAM0 for computing gamma function (|x| ? 1) C ========================================================= @@ -3014,7 +3014,7 @@ END - + C ********************************** SUBROUTINE CHGUIT(A,B,X,HU,ID) @@ -3116,7 +3116,7 @@ END - + C ********************************** SUBROUTINE KMN(M,N,C,CV,KD,DF,DN,CK1,CK2) @@ -3136,7 +3136,7 @@ IP=1 IF (N-M.EQ.2*INT((N-M)/2)) IP=0 K=0 - DO 10 I=1,NN+3 + DO 10 I=1,NN+3 IF (IP.EQ.0) K=-2*(I-1) IF (IP.EQ.1) K=-(2*I-3) GK0=2.0D0*M+K @@ -3204,7 +3204,7 @@ END - + C ********************************** SUBROUTINE LAGZO(N,X,W) @@ -3298,13 +3298,13 @@ END - + C ********************************** SUBROUTINE CJYVA(V,Z,VM,CBJ,CDJ,CBY,CDY) C C =========================================================== -C Purpose: Compute Bessel functions Jv(z), Yv(z) and their +C Purpose: Compute Bessel functions Jv(z), Yv(z) and their C derivatives for a complex argument C Input : z --- Complex argument C v --- Order of Jv(z) and Yv(z) @@ -3345,7 +3345,7 @@ ELSE CDJ(0)=(1.0D+300,0.0D0) ENDIF - VM=V + VM=V RETURN ENDIF LB0=0.0D0 @@ -3554,13 +3554,13 @@ END - + C ********************************** SUBROUTINE CJYVB(V,Z,VM,CBJ,CDJ,CBY,CDY) C C =========================================================== -C Purpose: Compute Bessel functions Jv(z), Yv(z) and their +C Purpose: Compute Bessel functions Jv(z), Yv(z) and their C derivatives for a complex argument C Input : z --- Complex argument C v --- Order of Jv(z) and Yv(z) @@ -3716,7 +3716,7 @@ END - + C ********************************** SUBROUTINE JY01A(X,BJ0,DJ0,BJ1,DJ1,BY0,DY0,BY1,DY1) @@ -3852,7 +3852,7 @@ C Purpose: Compute the incomplete gamma function C r(a,x), ?(a,x) and P(a,x) C Input : a --- Parameter ( a ? 170 ) -C x --- Argument +C x --- Argument C Output: GIN --- r(a,x) C GIM --- ?(a,x) C GIP --- P(a,x) @@ -3895,7 +3895,7 @@ END - + C ********************************** SUBROUTINE ITIKB(X,TI,TK) @@ -4075,7 +4075,7 @@ ELSE DJ(0)=1.0D+300 ENDIF - VM=V + VM=V RETURN ENDIF BJV0=0.0D0 @@ -4225,7 +4225,7 @@ END - + C ********************************** SUBROUTINE JYNB(N,X,NM,BJ,DJ,BY,DY) @@ -4253,7 +4253,7 @@ DJ(K) = 0.0D0 10 DY(K) = 1.0D+300 DJ(1)=0.5D0 - ELSE + ELSE DJ(0)=-BJ(1) DO 40 K=1,NM 40 DJ(K)=BJ(K-1)-K/X*BJ(K) @@ -4278,7 +4278,7 @@ C BY(n-NMIN) --- Yn(x) ; if indexing starts at 0 C NM --- Highest order computed C Routines called: -C MSTA1 and MSTA2 to calculate the starting +C MSTA1 and MSTA2 to calculate the starting C point for backward recurrence C ===================================================== C @@ -4544,7 +4544,7 @@ END - + C ********************************** SUBROUTINE JYNA(N,X,NM,BJ,DJ,BY,DY) @@ -4561,7 +4561,7 @@ C NM --- Highest order computed C Routines called: C (1) JY01B to calculate J0(x), J1(x), Y0(x) & Y1(x) -C (2) MSTA1 and MSTA2 to calculate the starting +C (2) MSTA1 and MSTA2 to calculate the starting C point for backward recurrence C ========================================================= C @@ -4632,7 +4632,7 @@ END - + C ********************************** SUBROUTINE PBDV(V,X,DV,DP,PDF,PDD) @@ -4644,7 +4644,7 @@ C v --- Order of Dv(x) C Output: DV(na) --- Dn+v0(x) C DP(na) --- Dn+v0'(x) -C ( na = |n|, v0 = v-n, |v0| < 1, +C ( na = |n|, v0 = v-n, |v0| < 1, C n = 0,?1,?2,? ) C PDF --- Dv(x) C PDD --- Dv'(x) @@ -4748,7 +4748,7 @@ END - + C ********************************** SUBROUTINE ITSH0(X,TH0) @@ -4763,7 +4763,7 @@ IMPLICIT DOUBLE PRECISION (A-H,O-Z) DIMENSION A(25) PI=3.141592653589793D0 - R=1.0D0 + R=1.0D0 IF (X.LE.30.0) THEN S=0.5D0 DO 10 K=1,100 @@ -4857,7 +4857,7 @@ END - + C ********************************** SUBROUTINE GAMMA2(X,GA) @@ -4992,7 +4992,7 @@ END - + C ********************************** SUBROUTINE LAMN(N,X,NM,BL,DL) @@ -5042,7 +5042,7 @@ 35 DL(N)=-0.5D0*X/(N+1.0D0)*UK RETURN ENDIF - IF (N.EQ.0) NM=1 + IF (N.EQ.0) NM=1 M=MSTA1(X,200) IF (M.LT.NM) THEN NM=M @@ -5150,7 +5150,7 @@ END - + C ********************************** SUBROUTINE CVF(KD,M,Q,A,MJ,F) @@ -5199,7 +5199,7 @@ END - + C ********************************** SUBROUTINE CLPN(N,X,Y,CPN,CPD) @@ -5412,7 +5412,7 @@ END - + C ********************************** SUBROUTINE ELIT(HK,PHI,FE,EE) @@ -5710,7 +5710,7 @@ END - + C ********************************** SUBROUTINE STVH0(X,SH0) @@ -5952,7 +5952,7 @@ END - + C ********************************** SUBROUTINE CCHG(A,B,Z,CHG) @@ -6069,13 +6069,13 @@ END - + C ********************************** SUBROUTINE HYGFZ(A,B,C,Z,ZHF) C C ====================================================== -C Purpose: Compute the hypergeometric function for a +C Purpose: Compute the hypergeometric function for a C complex argument, F(a,b,c,z) C Input : a --- Parameter C b --- Parameter @@ -6146,7 +6146,7 @@ ELSE IF (A0.LE.1.0D0) THEN IF (X.LT.0.0D0) THEN Z1=Z/(Z-1.0D0) - IF (C.GT.A.AND.B.LT.A.AND.B.GT.0.0) THEN + IF (C.GT.A.AND.B.LT.A.AND.B.GT.0.0) THEN A=BB B=AA ENDIF @@ -6360,7 +6360,7 @@ END - + C ********************************** SUBROUTINE ITAIRY(X,APT,BPT,ANT,BNT) @@ -6481,7 +6481,7 @@ C NM --- Highest order computed C Routines called: C (1) IK01A for computing I0(x),I1(x),K0(x) & K1(x) -C (2) MSTA1 and MSTA2 for computing the starting +C (2) MSTA1 and MSTA2 for computing the starting C point for backward recurrence C ======================================================== C @@ -6549,7 +6549,7 @@ END - + C ********************************** SUBROUTINE CJYNA(N,Z,NM,CBJ,CDJ,CBY,CDY) @@ -6566,7 +6566,7 @@ C NM --- Highest order computed C Rouitines called: C (1) CJY01 to calculate J0(z), J1(z), Y0(z), Y1(z) -C (2) MSTA1 and MSTA2 to calculate the starting +C (2) MSTA1 and MSTA2 to calculate the starting C point for backward recurrence C ======================================================= C @@ -6635,7 +6635,7 @@ CG1=CBY1 DO 90 K=2,NM CYK=2.0D0*(K-1.0D0)/Z*CG1-CG0 - IF (CDABS(CYK).GT.1.0D+290) GO TO 90 + IF (CDABS(CYK).GT.1.0D+290) GO TO 90 YAK=CDABS(CYK) YA1=CDABS(CG0) IF (YAK.LT.YA0.AND.YAK.LT.YA1) LB=K @@ -6696,7 +6696,7 @@ END - + C ********************************** SUBROUTINE CJYNB(N,Z,NM,CBJ,CDJ,CBY,CDY) @@ -6833,7 +6833,7 @@ END - + C ********************************** SUBROUTINE IKNB(N,X,NM,BI,DI,BK,DK) @@ -6849,7 +6849,7 @@ C DK(n) --- Kn'(x) C NM --- Highest order computed C Routines called: -C MSTA1 and MSTA2 for computing the starting point +C MSTA1 and MSTA2 for computing the starting point C for backward recurrence C =========================================================== C @@ -6931,7 +6931,7 @@ SUBROUTINE LPMN(MM,M,N,X,PM,PD) C C ===================================================== -C Purpose: Compute the associated Legendre functions +C Purpose: Compute the associated Legendre functions C Pmn(x) and their derivatives Pmn'(x) C Input : x --- Argument of Pmn(x) C m --- Order of Pmn(x), m = 0,1,2,...,n @@ -7056,7 +7056,7 @@ END - + C ********************************** SUBROUTINE CY01(KF,Z,ZF,ZD) @@ -7207,7 +7207,7 @@ SUBROUTINE FFK(KS,X,FR,FI,FM,FA,GR,GI,GM,GA) C C ======================================================= -C Purpose: Compute modified Fresnel integrals F?(x) +C Purpose: Compute modified Fresnel integrals F?(x) C and K?(x) C Input : x --- Argument of F?(x) and K?(x) C KS --- Sign code @@ -7378,7 +7378,7 @@ END - + C ********************************** SUBROUTINE AIRYB(X,AI,BI,AD,BD) @@ -7599,7 +7599,7 @@ END - + C ********************************** SUBROUTINE SCKB(M,N,C,DF,CK) @@ -7649,10 +7649,10 @@ 30 R1=R1*I 35 CK(K+1)=FAC*SUM/R1 RETURN - END + END - + C ********************************** SUBROUTINE CPDLA(N,Z,CDN) @@ -7680,7 +7680,7 @@ END - + C ********************************** SUBROUTINE FCSZO(KF,NT,ZO) @@ -7692,7 +7692,7 @@ C KF=1 for C(z) or KF=2 for S(z) C NT --- Total number of zeros C Output: ZO(L) --- L-th zero of C(z) or S(z) -C Routines called: +C Routines called: C (1) CFC for computing Fresnel integral C(z) C (2) CFS for computing Fresnel integral S(z) C ============================================================== @@ -7740,14 +7740,14 @@ END - + C ********************************** SUBROUTINE E1XA(X,E1) C C ============================================ C Purpose: Compute exponential integral E1(x) -C Input : x --- Argument of E1(x) +C Input : x --- Argument of E1(x) C Output: E1 --- E1(x) ( x > 0 ) C ============================================ C @@ -7773,7 +7773,7 @@ C C ======================================================= C Purpose: Compute the associated Legendre function -C Pmv(x) with an integer order and an arbitrary +C Pmv(x) with an integer order and an arbitrary C nonnegative degree v C Input : x --- Argument of Pm(x) ( -1 ? x ? 1 ) C m --- Order of Pmv(x) @@ -7865,7 +7865,7 @@ END - + C ********************************** SUBROUTINE CGAMA(X,Y,KF,GR,GI) @@ -7998,7 +7998,7 @@ END - + C ********************************** SUBROUTINE CHGUS(A,B,X,HU,ID) @@ -8047,7 +8047,7 @@ END - + C ********************************** SUBROUTINE ITTH0(X,TTH) @@ -8185,7 +8185,7 @@ C ==================================================== C IMPLICIT DOUBLE PRECISION (A-H,O-Z) - PI=3.141592653589793D0 + PI=3.141592653589793D0 EPS=1.0D-12 EP=DEXP(-.25*X*X) A0=DABS(X)**VA*EP @@ -8207,7 +8207,7 @@ END - + C ********************************** SUBROUTINE IK01A(X,BI0,DI0,BI1,DI1,BK0,DK0,BK1,DK1) @@ -8322,7 +8322,7 @@ SUBROUTINE CPBDN(N,Z,CPB,CPD) C C ================================================== -C Purpose: Compute the parabolic cylinder functions +C Purpose: Compute the parabolic cylinder functions C Dn(z) and Dn'(z) for a complex argument C Input: z --- Complex argument of Dn(z) C n --- Order of Dn(z) ( n=0,?1,?2,? ) @@ -8410,7 +8410,7 @@ END - + C ********************************** SUBROUTINE IK01B(X,BI0,DI0,BI1,DI1,BK0,DK0,BK1,DK1) @@ -8508,7 +8508,7 @@ END - + C ********************************** SUBROUTINE LPN(N,X,PN,PD) @@ -8730,13 +8730,13 @@ ENDIF 85 IF (FC(1).LT.0.0D0) THEN DO 90 J=1,KM -90 FC(J)=-FC(J) +90 FC(J)=-FC(J) ENDIF RETURN END - + C ********************************** SUBROUTINE SPHI(N,X,NM,SI,DI) @@ -8892,7 +8892,7 @@ END - + C ********************************** SUBROUTINE RMN1(M,N,C,X,DF,KD,R1F,R1D) @@ -8904,7 +8904,7 @@ C Routines called: C (1) SCKB for computing expansion coefficients c2k C (2) SPHJ for computing the spherical Bessel -C functions of the first kind +C functions of the first kind C ======================================================= C IMPLICIT DOUBLE PRECISION (A-H,O-Z) @@ -8919,7 +8919,7 @@ R0=REG DO 10 J=1,2*M+IP 10 R0=R0*J - R=R0 + R=R0 SUC=R*DF(1) SW=0.0D0 DO 15 K=2,NM @@ -8958,7 +8958,7 @@ CX=C*X NM2=2*NM+M CALL SPHJ(NM2,CX,NM2,SJ,DJ) - A0=(1.0D0-KD/(X*X))**(0.5D0*M)/SUC + A0=(1.0D0-KD/(X*X))**(0.5D0*M)/SUC R1F=0.0D0 SW=0.0D0 LG=0 @@ -8976,7 +8976,7 @@ IF (K.GT.NM1.AND.DABS(R1F-SW).LT.DABS(R1F)*EPS) GO TO 55 50 SW=R1F 55 R1F=R1F*A0 - B0=KD*M/X**3.0D0/(1.0-KD/(X*X))*R1F + B0=KD*M/X**3.0D0/(1.0-KD/(X*X))*R1F SUD=0.0D0 SW=0.0D0 DO 60 K=1,NM @@ -8997,7 +8997,7 @@ END - + C ********************************** SUBROUTINE DVSA(VA,X,PD) @@ -9049,7 +9049,7 @@ END - + C ********************************** SUBROUTINE E1Z(Z,CE1) @@ -9193,7 +9193,7 @@ END - + C ********************************** SUBROUTINE GMN(M,N,C,X,BK,GF,GD) @@ -9232,7 +9232,7 @@ END - + C ********************************** SUBROUTINE ITJYA(X,TJ,TY) @@ -9388,7 +9388,7 @@ END - + C ********************************** SUBROUTINE RCTY(N,X,NM,RY,DY) @@ -9751,14 +9751,14 @@ END - + C ********************************** SUBROUTINE CYZO(NT,KF,KC,ZO,ZV) C C =========================================================== C Purpose : Compute the complex zeros of Y0(z), Y1(z) and -C Y1'(z), and their associated values at the zeros +C Y1'(z), and their associated values at the zeros C using the modified Newton's iteration method C Input: NT --- Total number of zeros/roots C KF --- Function choice code @@ -9833,7 +9833,7 @@ END - + C ********************************** SUBROUTINE KLVNB(X,BER,BEI,GER,GEI,DER,DEI,HER,HEI) @@ -10009,7 +10009,7 @@ END - + C ********************************** SUBROUTINE CSPHIK(N,Z,NM,CSI,CDI,CSK,CDK) @@ -10033,7 +10033,7 @@ DOUBLE PRECISION A0,PI DIMENSION CSI(0:N),CDI(0:N),CSK(0:N),CDK(0:N) PI=3.141592653589793D0 - A0=CDABS(Z) + A0=CDABS(Z) NM=N IF (A0.LT.1.0D-60) THEN DO 10 K=0,N @@ -10199,7 +10199,7 @@ END - + C ********************************** SUBROUTINE OTHPL(KF,N,X,PL,DPL) @@ -10323,7 +10323,7 @@ END - + C ********************************** SUBROUTINE RSWFO(M,N,C,X,CV,KF,R1F,R1D,R2F,R2D) @@ -10376,7 +10376,7 @@ END - + C ********************************** SUBROUTINE CH12N(N,Z,NM,CHF1,CHD1,CHF2,CHD2) @@ -10441,7 +10441,7 @@ END - + C ********************************** SUBROUTINE JYZO(N,NT,RJ0,RJ1,RY0,RY1) @@ -10520,7 +10520,7 @@ X=1.19477+1.08933*N ELSE X=N+0.93158*N**0.33333+0.26035/N**0.33333 - ENDIF + ENDIF L=0 XGUESS=X 20 X0=X @@ -10544,7 +10544,7 @@ X=2.67257+1.16099*N ELSE X=N+1.8211*N**0.33333+0.94001/N**0.33333 - ENDIF + ENDIF L=0 XGUESS=X 25 X0=X @@ -10565,7 +10565,7 @@ END - + C ********************************** SUBROUTINE IKV(V,X,VM,BI,DI,BK,DK) @@ -10714,7 +10714,7 @@ END - + C ********************************** SUBROUTINE SDMN(M,N,C,CV,KD,DF) @@ -10742,7 +10742,7 @@ 5 DF(I)=0D0 DF((N-M)/2+1)=1.0D0 RETURN - ENDIF + ENDIF CS=C*C*KD IP=1 K=0 @@ -10776,7 +10776,7 @@ 12 DF(K1)=DF(K1)*1.0D-100 F1=F1*1.0D-100 F0=F0*1.0D-100 - ENDIF + ENDIF ELSE KB=K FL=DF(K+1) @@ -10788,7 +10788,7 @@ ELSE IF (KB.EQ.2) THEN DF(2)=F2 FS=-((D(2)-CV)*F2+G(2)*F1)/A(2) - ELSE + ELSE DF(2)=F2 DO 20 J=3,KB+1 F=-((D(J-1)-CV)*F2+G(J-1)*F1)/A(J-1) @@ -10798,7 +10798,7 @@ 15 DF(K1)=DF(K1)*1.0D-100 F=F*1.0D-100 F2=F2*1.0D-100 - ENDIF + ENDIF F1=F2 20 F2=F FS=F @@ -10837,7 +10837,7 @@ - + C ********************************** SUBROUTINE AJYIK(X,VJ1,VJ2,VY1,VY2,VI1,VI2,VK1,VK2) @@ -11168,7 +11168,7 @@ END - + C ********************************** SUBROUTINE CIKVA(V,Z,VM,CBI,CDI,CBK,CDK) @@ -11187,7 +11187,7 @@ C VM --- Highest order computed C Routines called: C (1) GAMMA2 for computing the gamma function -C (2) MSTA1 and MSTA2 for computing the starting +C (2) MSTA1 and MSTA2 for computing the starting C point for backward recurrence C ============================================================ C @@ -11336,7 +11336,7 @@ END - + C ********************************** SUBROUTINE CFC(Z,ZF,ZD) @@ -11399,7 +11399,7 @@ END - + C ********************************** SUBROUTINE FCS(X,C,S) @@ -11808,7 +11808,7 @@ END - + C ********************************** SUBROUTINE GAIH(X,GA) @@ -11958,7 +11958,7 @@ END - + C ********************************** SUBROUTINE CLQMN(MM,M,N,X,Y,CQM,CQD) @@ -12081,7 +12081,7 @@ DO 5 I=1,N-M+1 5 EG(I)=(I+M)*(I+M-1.0D0) GO TO 70 - ENDIF + ENDIF ICM=(N-M+2)/2 NM=10+INT(0.5*(N-M)+C) CS=C*C*KD @@ -12339,7 +12339,7 @@ END - + C ********************************** SUBROUTINE MTU12(KF,KC,M,Q,X,F1R,D1R,F2R,D2R) @@ -12385,7 +12385,7 @@ ELSE QM=17.0+3.1*SQRT(Q)-.126*Q+.0037*SQRT(Q)*Q ENDIF - KM=INT(QM+0.5*M) + KM=INT(QM+0.5*M) CALL FCOEF(KD,M,Q,A,FG) IC=INT(M/2)+1 IF (KD.EQ.4) IC=M/2 @@ -12465,14 +12465,14 @@ END - + C ********************************** SUBROUTINE CIK01(Z,CBI0,CDI0,CBI1,CDI1,CBK0,CDK0,CBK1,CDK1) C C ========================================================== -C Purpose: Compute modified Bessel functions I0(z), I1(z), -C K0(z), K1(z), and their derivatives for a +C Purpose: Compute modified Bessel functions I0(z), I1(z), +C K0(z), K1(z), and their derivatives for a C complex argument C Input : z --- Complex argument C Output: CBI0 --- I0(z) @@ -12682,7 +12682,7 @@ SY(0)=-DCOS(X)/X F0=SY(0) DY(0)=(DSIN(X)+DCOS(X)/X)/X - IF (N.LT.1) THEN + IF (N.LT.1) THEN RETURN ENDIF SY(1)=(SY(0)-DSIN(X))/X @@ -12690,7 +12690,7 @@ DO 15 K=2,N F=(2.0D0*K-1.0D0)*F1/X-F0 SY(K)=F - IF (DABS(F).GE.1.0D+300) GO TO 20 + IF (DABS(F).GE.1.0D+300) GO TO 20 F0=F1 15 F1=F 20 NM=K-1 @@ -12700,7 +12700,7 @@ END - + C ********************************** SUBROUTINE JELP(U,HK,ESN,ECN,EDN,EPH) @@ -12862,7 +12862,7 @@ BJ0=SR*(PU0*DCOS(T0)-QU0*DSIN(T0)) BJ1=SR*(PU1*DCOS(T1)-QU1*DSIN(T1)) C Forward recurrence for J_|v| (Abm & Stg 9.1.27) -C It's OK for the limited range -8.0 ? v ? 12.5, +C It's OK for the limited range -8.0 ? v ? 12.5, C since x >= 20 here; but would be unstable for v <~ -20 BF0=BJ0 BF1=BJ1 From scipy-svn at scipy.org Tue Nov 23 16:23:35 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 23 Nov 2010 15:23:35 -0600 (CST) Subject: [Scipy-svn] r6941 - in trunk/scipy/special: . specfun tests Message-ID: <20101123212335.755411B856D@scipy.org> Author: ptvirtan Date: 2010-11-23 15:23:35 -0600 (Tue, 23 Nov 2010) New Revision: 6941 Modified: trunk/scipy/special/basic.py trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_basic.py Log: BUG: special: initialize variables in specfun.f:JDZO and fix off-by-one error in jnjnp_zeros (#1330) Initializing the variables avoids garbage output from JDZO. Modified: trunk/scipy/special/basic.py =================================================================== --- trunk/scipy/special/basic.py 2010-11-23 21:23:10 UTC (rev 6940) +++ trunk/scipy/special/basic.py 2010-11-23 21:23:35 UTC (rev 6941) @@ -74,7 +74,7 @@ raise ValueError("Number must be integer <= 1200.") nt = int(nt) n,m,t,zo = specfun.jdzo(nt) - return zo[:nt],n[:nt],m[:nt],t[:nt] + return zo[1:nt+1],n[:nt],m[:nt],t[:nt] def jnyn_zeros(n,nt): """Compute nt zeros of the Bessel functions Jn(x), Jn'(x), Yn(x), and Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2010-11-23 21:23:10 UTC (rev 6940) +++ trunk/scipy/special/specfun/specfun.f 2010-11-23 21:23:35 UTC (rev 6941) @@ -367,6 +367,8 @@ INTEGER P(1400), P1(70) DIMENSION N(1400),M(1400),ZO(0:1400),N1(70),M1(70), & ZOC(0:70),BJ(101),DJ(101),FJ(101) + X = 0 + ZOC(0) = 0 IF (NT.LT.600) THEN XM=-1.0+2.248485*NT**0.5-.0159382*NT+3.208775E-4 & *NT**1.5 Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2010-11-23 21:23:10 UTC (rev 6940) +++ trunk/scipy/special/tests/test_basic.py 2010-11-23 21:23:35 UTC (rev 6941) @@ -8,7 +8,6 @@ #8 Means test runs forever ### test_besselpoly -### test_jnjnp_zeros ### test_mathieu_a ### test_mathieu_even_coef ### test_mathieu_odd_coef @@ -27,7 +26,7 @@ from numpy.testing import assert_equal, assert_almost_equal, assert_array_equal, \ assert_array_almost_equal, assert_approx_equal, assert_, \ - rand, dec, TestCase, run_module_suite + rand, dec, TestCase, run_module_suite, assert_allclose from scipy import special import scipy.special._cephes as cephes @@ -1347,11 +1346,18 @@ 3101.86438139042]), rtol=1e-8) def test_jnjnp_zeros(self): - pass - #jnjp = jnjnp(3) - #assert_array_almost_equal(jnjp,(array([ - #I don't think specfun jdzo is working properly the outputs do not seem to correlate - #to the inputs + jn = special.jn + def jnp(n, x): + return (jn(n-1,x) - jn(n+1,x))/2 + for nt in range(1, 30): + z, n, m, t = special.jnjnp_zeros(nt) + for zz, nn, tt in zip(z, n, t): + if tt == 0: + assert_allclose(jn(nn, zz), 0, atol=1e-6) + elif tt == 1: + assert_allclose(jnp(nn, zz), 0, atol=1e-6) + else: + raise AssertionError("Invalid t return for nt=%d" % nt) def test_jnp_zeros(self): jnp = special.jnp_zeros(1,5) From scipy-svn at scipy.org Thu Nov 25 03:31:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 25 Nov 2010 02:31:45 -0600 (CST) Subject: [Scipy-svn] r6942 - trunk/tools Message-ID: <20101125083145.430AE3235C@scipy.org> Author: ptvirtan Date: 2010-11-25 02:31:43 -0600 (Thu, 25 Nov 2010) New Revision: 6942 Modified: trunk/tools/py3tool.py Log: BUG: fix build on Python 3 Modified: trunk/tools/py3tool.py =================================================================== --- trunk/tools/py3tool.py 2010-11-23 21:23:35 UTC (rev 6941) +++ trunk/tools/py3tool.py 2010-11-25 08:31:43 UTC (rev 6942) @@ -178,6 +178,7 @@ os.path.join('signal', '__init__.py'), os.path.join('signal', 'bsplines.py'), os.path.join('signal', 'signaltools.py'), + os.path.join('signal', 'fir_filter_design.py'), os.path.join('special', '__init__.py'), os.path.join('special', 'basic.py'), os.path.join('special', 'orthogonal.py'), From scipy-svn at scipy.org Thu Nov 25 05:14:58 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 25 Nov 2010 04:14:58 -0600 (CST) Subject: [Scipy-svn] r6943 - trunk/scipy/stats Message-ID: <20101125101458.97A9537BA40@scipy.org> Author: ptvirtan Date: 2010-11-25 04:14:54 -0600 (Thu, 25 Nov 2010) New Revision: 6943 Modified: trunk/scipy/stats/stats.py Log: BUG: stats: fix integer division issues in fisher_exact Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-25 08:31:43 UTC (rev 6942) +++ trunk/scipy/stats/stats.py 2010-11-25 10:14:54 UTC (rev 6943) @@ -2442,7 +2442,7 @@ if maxval == minval + 1 and guess == minval: guess = maxval else: - guess = (maxval + minval) / 2 + guess = (maxval + minval) // 2 pguess = hypergeom.pmf(guess, n1 + n2, n1, n) if pguess <= pexact and hypergeom.pmf(guess - 1, n1 + n2, n1, n) > pexact: @@ -2478,7 +2478,7 @@ if maxval == minval + 1 and guess == minval: guess = maxval else: - guess = (maxval + minval) / 2 + guess = (maxval + minval) // 2 pguess = hypergeom.pmf(guess, n1 + n2, n1, n) if pguess <= pexact and hypergeom.pmf(guess + 1, n1 + n2, n1, n) > pexact: break From scipy-svn at scipy.org Fri Nov 26 18:41:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Nov 2010 17:41:54 -0600 (CST) Subject: [Scipy-svn] r6944 - in trunk/scipy/sparse: . tests Message-ID: <20101126234154.413E637A19A@scipy.org> Author: warren.weckesser Date: 2010-11-26 17:41:53 -0600 (Fri, 26 Nov 2010) New Revision: 6944 Modified: trunk/scipy/sparse/dok.py trunk/scipy/sparse/tests/test_base.py Log: BUG: Fix for ticket 1160 (thanks to derPhil and JustinPeel) Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2010-11-25 10:14:54 UTC (rev 6943) +++ trunk/scipy/sparse/dok.py 2010-11-26 23:41:53 UTC (rev 6944) @@ -225,8 +225,9 @@ raise IndexError("index out of bounds") if np.isscalar(value): - if value==0 and self.has_key((i,j)): - del self[(i,j)] + if value == 0: + if self.has_key((i,j)): + del self[(i,j)] else: dict.__setitem__(self, (i,j), self.dtype.type(value)) else: Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2010-11-25 10:14:54 UTC (rev 6943) +++ trunk/scipy/sparse/tests/test_base.py 2010-11-26 23:41:53 UTC (rev 6944) @@ -1298,8 +1298,21 @@ c = csr_matrix(b) assert_equal(A.todense(), c.todense()) + def test_ticket1160(self): + """Regression test for ticket #1160.""" + a = dok_matrix((3,3)) + a[0,0] = 0 + # This assert would fail, because the above assignment would + # incorrectly call __set_item__ even though the value was 0. + assert_((0,0) not in a.keys(), "Unexpected entry (0,0) in keys") + + # Slice assignments were also affected. + b = dok_matrix((3,3)) + b[:,0] = 0 + assert_(len(b.keys())==0, "Unexpected entries in keys") + class TestLIL( _TestCommon, _TestHorizSlicing, _TestVertSlicing, _TestBothSlicing, _TestGetSet, _TestSolve, _TestArithmetic, _TestInplaceArithmetic, _TestFancyIndexing, From scipy-svn at scipy.org Fri Nov 26 19:31:04 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Nov 2010 18:31:04 -0600 (CST) Subject: [Scipy-svn] r6945 - in trunk/scipy/spatial: . tests Message-ID: <20101127003104.B3ABC37A19A@scipy.org> Author: warren.weckesser Date: 2010-11-26 18:31:04 -0600 (Fri, 26 Nov 2010) New Revision: 6945 Modified: trunk/scipy/spatial/distance.py trunk/scipy/spatial/tests/test_distance.py Log: BUG: spatial: Raise a ValueError in sokalsneath if both vectors are entirely false (ticket #876). Also fixed the double appearance of the factor 2 in the docstrings for sokalsneath and sokalmichener. Modified: trunk/scipy/spatial/distance.py =================================================================== --- trunk/scipy/spatial/distance.py 2010-11-26 23:41:53 UTC (rev 6944) +++ trunk/scipy/spatial/distance.py 2010-11-27 00:31:04 UTC (rev 6945) @@ -739,8 +739,8 @@ .. math:: - \frac{2R} - {S + 2R} + \frac{R} + {S + R} where :math:`c_{ij}` is the number of occurrences of :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for @@ -775,8 +775,8 @@ .. math:: - \frac{2R} - {c_{TT} + 2R} + \frac{R} + {c_{TT} + R} where :math:`c_{ij}` is the number of occurrences of :math:`\mathtt{u[k]} = i` and :math:`\mathtt{v[k]} = j` for @@ -799,7 +799,11 @@ else: ntt = (u * v).sum() (nft, ntf) = _nbool_correspond_ft_tf(u, v) - return float(2.0 * (ntf + nft))/float(ntt + 2.0 * (ntf + nft)) + denom = ntt + 2.0 * (ntf + nft) + if denom == 0: + raise ValueError('Sokal-Sneath dissimilarity is not defined for ' + 'vectors that are entirely false.') + return float(2.0 * (ntf + nft)) / denom def pdist(X, metric='euclidean', p=2, V=None, VI=None): Modified: trunk/scipy/spatial/tests/test_distance.py =================================================================== --- trunk/scipy/spatial/tests/test_distance.py 2010-11-26 23:41:53 UTC (rev 6944) +++ trunk/scipy/spatial/tests/test_distance.py 2010-11-27 00:31:04 UTC (rev 6945) @@ -37,7 +37,8 @@ import os.path import numpy as np -from numpy.testing import verbose, TestCase, run_module_suite +from numpy.testing import verbose, TestCase, run_module_suite, \ + assert_raises from scipy.spatial.distance import squareform, pdist, cdist, matching, \ jaccard, dice, sokalsneath, rogerstanimoto, \ russellrao, yule, num_obs_y, num_obs_dm, \ @@ -1700,5 +1701,11 @@ y = np.random.rand(n*(n-1)/2) return y + +def test_sokalsneath_all_false(): + """Regression test for ticket #876""" + assert_raises(ValueError, sokalsneath, [False, False, False], [False, False, False]) + + if __name__=="__main__": run_module_suite() From scipy-svn at scipy.org Fri Nov 26 22:36:50 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Nov 2010 21:36:50 -0600 (CST) Subject: [Scipy-svn] r6946 - in trunk/scipy/sparse: . tests Message-ID: <20101127033650.BC31737B09F@scipy.org> Author: warren.weckesser Date: 2010-11-26 21:36:50 -0600 (Fri, 26 Nov 2010) New Revision: 6946 Modified: trunk/scipy/sparse/dok.py trunk/scipy/sparse/tests/test_base.py Log: BUG: sparse: fixed the resize() method of dok_matrix (ticket #997); thanks to jap for report and patch. Modified: trunk/scipy/sparse/dok.py =================================================================== --- trunk/scipy/sparse/dok.py 2010-11-27 00:31:04 UTC (rev 6945) +++ trunk/scipy/sparse/dok.py 2010-11-27 03:36:50 UTC (rev 6946) @@ -531,8 +531,9 @@ return self.tocoo().toarray() def resize(self, shape): - """ Resize the matrix to dimensions given by 'shape', removing any - non-zero elements that lie outside. + """ Resize the matrix in-place to dimensions given by 'shape'. + + Any non-zero elements that lie outside the new shape are removed. """ if not isshape(shape): raise TypeError("dimensions must be a 2-tuple of positive" @@ -544,7 +545,7 @@ for (i, j) in self.keys(): if i >= newM or j >= newN: del self[i, j] - self.shape = shape + self._shape = shape Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2010-11-27 00:31:04 UTC (rev 6945) +++ trunk/scipy/sparse/tests/test_base.py 2010-11-27 03:36:50 UTC (rev 6946) @@ -1298,6 +1298,21 @@ c = csr_matrix(b) assert_equal(A.todense(), c.todense()) + def test_resize(self): + """A couple basic tests of the resize() method. + + resize(shape) resizes the array in-place. + """ + a = dok_matrix((5,5)) + a[:,0] = 1 + a.resize((2,2)) + expected1 = array([[1,0],[1,0]]) + assert_array_equal(a.todense(), expected1) + a.resize((3,2)) + expected2 = array([[1,0],[1,0],[0,0]]) + assert_array_equal(a.todense(), expected2) + + def test_ticket1160(self): """Regression test for ticket #1160.""" a = dok_matrix((3,3)) From scipy-svn at scipy.org Sat Nov 27 02:14:48 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 01:14:48 -0600 (CST) Subject: [Scipy-svn] r6947 - in trunk/scipy/spatial: . tests Message-ID: <20101127071448.B15A037A198@scipy.org> Author: warren.weckesser Date: 2010-11-27 01:14:47 -0600 (Sat, 27 Nov 2010) New Revision: 6947 Modified: trunk/scipy/spatial/distance.py trunk/scipy/spatial/tests/test_distance.py Log: BUG: spatial: (ticket #1146) pdist didn't handle the weighted minkowski function correctly (the 'w' argument was not defined); also fixed and simplified other code. Thanks to Teemu Ikonen for some of the patches. Modified: trunk/scipy/spatial/distance.py =================================================================== --- trunk/scipy/spatial/distance.py 2010-11-27 03:36:50 UTC (rev 6946) +++ trunk/scipy/spatial/distance.py 2010-11-27 07:14:47 UTC (rev 6947) @@ -110,10 +110,12 @@ """ +import warnings import numpy as np + import _distance_wrap -import types + def _copy_array_if_base_present(a): """ Copies the array if its base points to a parent array. @@ -121,7 +123,7 @@ if a.base is not None: return a.copy() elif np.issubsctype(a, np.float32): - return array(a, dtype=np.double) + return np.array(a, dtype=np.double) else: return a @@ -201,6 +203,7 @@ """ u = np.asarray(u, order='c') v = np.asarray(v, order='c') + w = np.asarray(w) if p < 1: raise ValueError("p must be at least 1") return ((w * abs(u-v))**p).sum() ** (1.0 / p) @@ -570,10 +573,8 @@ if u.dtype == np.int or u.dtype == np.float_ or u.dtype == np.double: not_u = 1.0 - u not_v = 1.0 - v - nff = (not_u * not_v).sum() nft = (not_u * v).sum() ntf = (u * not_v).sum() - ntt = (u * v).sum() else: not_u = ~u not_v = ~v @@ -806,7 +807,7 @@ return float(2.0 * (ntf + nft)) / denom -def pdist(X, metric='euclidean', p=2, V=None, VI=None): +def pdist(X, metric='euclidean', p=2, w=None, V=None, VI=None): r""" Computes the pairwise distances between m original observations in n-dimensional space. Returns a condensed distance matrix Y. For @@ -1038,50 +1039,39 @@ X = np.asarray(X, order='c') - #if np.issubsctype(X, np.floating) and not np.issubsctype(X, np.double): - # raise TypeError('Floating point arrays must be 64-bit (got %r).' % - # (X.dtype.type,)) - # The C code doesn't do striding. [X] = _copy_arrays_if_base_present([_convert_to_double(X)]) s = X.shape - if len(s) != 2: raise ValueError('A 2-dimensional array must be passed.'); - m = s[0] - n = s[1] + m, n = s dm = np.zeros((m * (m - 1) / 2,), dtype=np.double) + wmink_names = ['wminkowski', 'wmi', 'wm', 'wpnorm'] + if w is None and (metric == wminkowski or metric in wmink_names): + raise ValueError('weighted minkowski requires a weight ' + 'vector `w` to be given.') + if callable(metric): - k = 0 if metric == minkowski: - for i in xrange(0, m - 1): - for j in xrange(i+1, m): - dm[k] = minkowski(X[i, :], X[j, :], p) - k = k + 1 + def dfun(u,v): return minkowski(u, v, p) elif metric == wminkowski: - for i in xrange(0, m - 1): - for j in xrange(i+1, m): - dm[k] = wminkowski(X[i, :], X[j, :], p, w) - k = k + 1 + def dfun(u,v): return wminkowski(u, v, p, w) elif metric == seuclidean: - for i in xrange(0, m - 1): - for j in xrange(i+1, m): - dm[k] = seuclidean(X[i, :], X[j, :], V) - k = k + 1 + def dfun(u,v): return seuclidean(u, v, V) elif metric == mahalanobis: - for i in xrange(0, m - 1): - for j in xrange(i+1, m): - dm[k] = mahalanobis(X[i, :], X[j, :], V) - k = k + 1 + def dfun(u,v): return mahalanobis(u, v, V) else: - for i in xrange(0, m - 1): - for j in xrange(i+1, m): - dm[k] = metric(X[i, :], X[j, :]) - k = k + 1 + dfun = metric + k = 0 + for i in xrange(0, m - 1): + for j in xrange(i+1, m): + dm[k] = dfun(X[i], X[j]) + k = k + 1 + elif isinstance(metric,basestring): mstr = metric.lower() @@ -1109,9 +1099,9 @@ _distance_wrap.pdist_chebyshev_wrap(_convert_to_double(X), dm) elif mstr in set(['minkowski', 'mi', 'm']): _distance_wrap.pdist_minkowski_wrap(_convert_to_double(X), dm, p) - elif mstr in set(['wminkowski', 'wmi', 'wm', 'wpnorm']): - _distance_wrap.cdist_weighted_minkowski_wrap(_convert_to_double(X), - dm, p, w) + elif mstr in wmink_names: + _distance_wrap.pdist_weighted_minkowski_wrap(_convert_to_double(X), + dm, p, np.asarray(w)) elif mstr in set(['seuclidean', 'se', 's']): if V is not None: V = np.asarray(V, order='c') @@ -1122,7 +1112,9 @@ if len(V.shape) != 1: raise ValueError('Variance vector V must be one-dimensional.') if V.shape[0] != n: - raise ValueError('Variance vector V must be of the same dimension as the vectors on which the distances are computed.') + raise ValueError('Variance vector V must be of the same ' + 'dimension as the vectors on which the distances ' + 'are computed.') # The C code doesn't do striding. [VV] = _copy_arrays_if_base_present([_convert_to_double(V)]) else: @@ -1432,7 +1424,7 @@ if throw: raise if warning: - _warning(str(e)) + warnings.warn(str(e)) valid = False return valid @@ -1492,7 +1484,7 @@ if throw: raise if warning: - _warning(str(e)) + warnings.warn(str(e)) valid = False return valid Modified: trunk/scipy/spatial/tests/test_distance.py =================================================================== --- trunk/scipy/spatial/tests/test_distance.py 2010-11-27 03:36:50 UTC (rev 6946) +++ trunk/scipy/spatial/tests/test_distance.py 2010-11-27 07:14:47 UTC (rev 6947) @@ -38,11 +38,11 @@ import numpy as np from numpy.testing import verbose, TestCase, run_module_suite, \ - assert_raises + assert_raises, assert_array_equal from scipy.spatial.distance import squareform, pdist, cdist, matching, \ jaccard, dice, sokalsneath, rogerstanimoto, \ russellrao, yule, num_obs_y, num_obs_dm, \ - is_valid_dm, is_valid_y + is_valid_dm, is_valid_y, wminkowski _filenames = ["iris.txt", "cdist-X1.txt", @@ -877,6 +877,32 @@ Y_test2 = pdist(X, 'test_minkowski', 5.8) self.assertTrue(within_tol(Y_test2, Y_right, eps)) + ################# wminkowski + + def test_pdist_wminkowski(self): + x = np.array([[0.0, 0.0, 0.0], + [1.0, 0.0, 0.0], + [0.0, 1.0, 0.0], + [1.0, 1.0, 1.0]]) + + p2_expected = [1.0, 1.0, np.sqrt(3), + np.sqrt(2), np.sqrt(2), + np.sqrt(2)] + p1_expected = [0.5, 1.0, 3.5, + 1.5, 3.0, + 2.5] + dist = pdist(x, metric=wminkowski, w=[1.0, 1.0, 1.0]) + assert_array_equal(dist, p2_expected) + + dist = pdist(x, metric=wminkowski, w=[0.5, 1.0, 2.0], p=1) + assert_array_equal(dist, p1_expected) + + dist = pdist(x, metric='wminkowski', w=[1.0, 1.0, 1.0]) + assert_array_equal(dist, p2_expected) + + dist = pdist(x, metric='wminkowski', w=[0.5, 1.0, 2.0], p=1) + assert_array_equal(dist, p1_expected) + ################### pdist: hamming def test_pdist_hamming_random(self): "Tests pdist(X, 'hamming') on random data." From scipy-svn at scipy.org Sat Nov 27 03:10:46 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 02:10:46 -0600 (CST) Subject: [Scipy-svn] r6948 - trunk/scipy/constants Message-ID: <20101127081046.9DD3137A194@scipy.org> Author: rgommers Date: 2010-11-27 02:10:46 -0600 (Sat, 27 Nov 2010) New Revision: 6948 Modified: trunk/scipy/constants/__init__.py trunk/scipy/constants/codata.py trunk/scipy/constants/constants.py Log: DOC: merge wiki edits for constants module, with some corrections. Modified: trunk/scipy/constants/__init__.py =================================================================== --- trunk/scipy/constants/__init__.py 2010-11-27 07:14:47 UTC (rev 6947) +++ trunk/scipy/constants/__init__.py 2010-11-27 08:10:46 UTC (rev 6948) @@ -1,4 +1,36 @@ +""" +Various useful constants and conversion formulae +Modules +------- + +.. autosummary:: + :toctree: generated/ + + codata - CODATA Recommended Values of Fundamental Physical Const (2006) + constants - Collection of physical constants and conversion factors + +Functions +--------- + +.. autosummary:: + :toctree: generated/ + + C2F - Convert Celsius to Fahrenheit + C2K - Convert Celsius to Kelvin + F2C - Convert Fahrenheit to Celsius + F2K - Convert Fahrenheit to Kelvin + K2C - Convert Kelvin to Celsius + K2F - Convert Kelvin to Fahrenheit + find - Find the codata.physical_constant keys containing a given string + lambda2nu - Convert wavelength to optical frequency + nu2lambda - Convert optical frequency to wavelength + precision - Relative precision in physical_constants indexed by key + unit - Unit in physical_constants indexed by key + value - Value in physical_constants indexed by key + +""" + # Modules contributed by BasSw (wegwerp at gmail.com) from codata import * from constants import * Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-11-27 07:14:47 UTC (rev 6947) +++ trunk/scipy/constants/codata.py 2010-11-27 08:10:46 UTC (rev 6948) @@ -4,24 +4,53 @@ """ Fundamental Physical Constants +------------------------------ +These constants are taken from CODATA Recommended Values of the Fundamental +Physical Constants 2006. -These constants are taken from CODATA Recommended Values of the -Fundamental Physical Constants. They may be found at +Object +------ +physical_constants : dict + A dictionary containing physical constants. Keys are the names + of physical constants, values are tuples (value, units, precision). +Functions +--------- +value(key): + Returns the value of the physical constant(key). +unit(key): + Returns the units of the physical constant(key). +precision(key): + Returns the relative precision of the physical constant(key). +find(sub): + Prints or returns list of keys containing the string sub, + default is all. + +Source +------ +CODATA internationally recommended values are recommended for international +use by CODATA and are the latest available. Termed the "2006 CODATA +recommended values," they are generally recognized worldwide for use in all +fields of science and technology. The values became available in March 2007 +and replaced the 2002 CODATA set. They are based on all of the data +available through 31 December 2006. The 2006 adjustment was carried out +under the auspices of the CODATA Task Group on Fundamental Constants. Also +available is an Introduction to the constants for non-experts. + +Website +------- http://physics.nist.gov/cuu/Constants/index.html -The values are stored in the dictionary physical_constants as a tuple -containing the value, the units, and the relative precision, in that -order. All constants are in SI units unless otherwise stated. +References +---------- +Theoretical and experimental publications relevant to the +fundamental constants and closely related precision measurements +published since the mid 1980s, but also including many older +papers of particular interest, some of which date back to the +1800s. To search bibliography visit -Several helper functions are provided: +http://physics.nist.gov/cuu/Constants/Citations/Search.html - value(key) : Returns the value of the physical constant. - unit(key) : Returns the units of the physical constant. - precision(key) : Returns the relative precision of the physical constant. - find(sub) : Prints a list of keys containing the string sub. - If sub is not specified, returns all keys. - """ from math import pi, sqrt @@ -400,11 +429,11 @@ codata : Contains the description of `physical_constants`, which, as a dictionary literal object, does not itself possess a docstring. - Examples + Examples -------- >>> from scipy.constants import codata >>> codata.value('elementary charge') - 1.60217653e-019 + 1.602176487e-019 """ return physical_constants[key][0] @@ -460,7 +489,7 @@ -------- >>> from scipy.constants import codata >>> codata.precision(u'proton mass') - 1.7338050694080732e-007 + 4.96226989798e-08 """ return physical_constants[key][2] / physical_constants[key][0] Modified: trunk/scipy/constants/constants.py =================================================================== --- trunk/scipy/constants/constants.py 2010-11-27 07:14:47 UTC (rev 6947) +++ trunk/scipy/constants/constants.py 2010-11-27 08:10:46 UTC (rev 6948) @@ -177,17 +177,17 @@ Parameters ---------- - C : float-like scalar or array-like - Celsius temperature(s) to be converted + C : array_like + Celsius temperature(s) to be converted. Returns ------- - K : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Kelvin temperature(s) + K : float or array of floats + Equivalent Kelvin temperature(s). Notes ----- - Computes `K = C +` `zero_Celsius` where `zero_Celsius` = 273.15, i.e., + Computes ``K = C + zero_Celsius`` where `zero_Celsius` = 273.15, i.e., (the absolute value of) temperature "absolute zero" as measured in Celsius. Examples @@ -205,17 +205,17 @@ Parameters ---------- - K : float-like scalar or array-like - Kelvin temperature(s) to be converted + K : array_like + Kelvin temperature(s) to be converted. Returns ------- - C : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Celsius temperature(s) + C : float or array of floats + Equivalent Celsius temperature(s). Notes ----- - Computes `C = K -` `zero_Celsius` where `zero_Celsius` = 273.15, i.e., + Computes ``C = K - zero_Celsius`` where `zero_Celsius` = 273.15, i.e., (the absolute value of) temperature "absolute zero" as measured in Celsius. Examples @@ -233,17 +233,17 @@ Parameters ---------- - F : float-like scalar or array-like - Fahrenheit temperature(s) to be converted + F : array_like + Fahrenheit temperature(s) to be converted. Returns ------- - C : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Celsius temperature(s) + C : float or array of floats + Equivalent Celsius temperature(s). Notes ----- - Computes `C = (F - 32) / 1.8` + Computes ``C = (F - 32) / 1.8``. Examples -------- @@ -260,17 +260,17 @@ Parameters ---------- - C : float-like scalar or array-like - Celsius temperature(s) to be converted + C : array_like + Celsius temperature(s) to be converted. Returns ------- - F : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Fahrenheit temperature(s) + F : float or array of floats + Equivalent Fahrenheit temperature(s). Notes ----- - Computes `F = 1.8 * C + 32` + Computes ``F = 1.8 * C + 32``. Examples -------- @@ -287,17 +287,17 @@ Parameters ---------- - F : float-like scalar or array-like - Fahrenheit temperature(s) to be converted + F : array_like + Fahrenheit temperature(s) to be converted. Returns ------- - K : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Kelvin temperature(s) + K : float or array of floats + Equivalent Kelvin temperature(s). Notes ----- - Computes `K = (F - 32)/1.8 +` `zero_Celsius` where `zero_Celsius` = + Computes ``K = (F - 32)/1.8 + zero_Celsius`` where `zero_Celsius` = 273.15, i.e., (the absolute value of) temperature "absolute zero" as measured in Celsius. @@ -316,17 +316,17 @@ Parameters ---------- - K : float-like scalar or array-like - Kelvin temperature(s) to be converted + K : array_like + Kelvin temperature(s) to be converted. Returns ------- - F : float or a numpy array of floats, corresponding to type of Parameters - Equivalent Fahrenheit temperature(s) + F : float or array of floats + Equivalent Fahrenheit temperature(s). Notes ----- - Computes `F = 1.8 * (K -` `zero_Celsius` `) + 32` where `zero_Celsius` = + Computes ``F = 1.8 * (K - zero_Celsius) + 32`` where `zero_Celsius` = 273.15, i.e., (the absolute value of) temperature "absolute zero" as measured in Celsius. @@ -347,17 +347,17 @@ Parameters ---------- - lambda : float-like scalar or array-like - Wavelength(s) to be converted + lambda : array_like + Wavelength(s) to be converted. Returns ------- - nu : float or a numpy array of floats, corresponding to type of Parameters - Equivalent optical frequency(ies) + nu : float or array of floats + Equivalent optical frequency. Notes ----- - Computes :math:`\\nu = c / \\lambda` where `c` = 299792458.0, i.e., the + Computes ``nu = c / lambda`` where c = 299792458.0, i.e., the (vacuum) speed of light in meters/second. Examples @@ -375,17 +375,17 @@ Parameters ---------- - nu : float-like scalar or array-like - Optical frequency(ies) to be converted + nu : array_like + Optical frequency to be converted. Returns ------- - lambda : float or a numpy array of floats, corresp. to type of Parameters - Equivalent wavelength(s) + lambda : float or array of floats + Equivalent wavelength(s). Notes ----- - Computes :math:`\\lambda = c / \\nu` where `c` = 299792458.0, i.e., the + Computes ``lambda = c / nu`` where c = 299792458.0, i.e., the (vacuum) speed of light in meters/second. Examples From scipy-svn at scipy.org Sat Nov 27 13:40:27 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 12:40:27 -0600 (CST) Subject: [Scipy-svn] r6949 - in trunk/scipy/special: cephes specfun tests Message-ID: <20101127184027.6B2D937A18B@scipy.org> Author: ptvirtan Date: 2010-11-27 12:40:26 -0600 (Sat, 27 Nov 2010) New Revision: 6949 Modified: trunk/scipy/special/cephes/hyp2f1.c trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_orthogonal_eval.py Log: BUG: special: avoid raising spurious div-by-zero flags in hyp2f1 and hyp1f1 (fixes #1334) Modified: trunk/scipy/special/cephes/hyp2f1.c =================================================================== --- trunk/scipy/special/cephes/hyp2f1.c 2010-11-27 08:10:46 UTC (rev 6948) +++ trunk/scipy/special/cephes/hyp2f1.c 2010-11-27 18:40:26 UTC (rev 6949) @@ -381,10 +381,14 @@ p *= s * (a + t + d1) / (t + 1.0); p *= (b + t + d1) / (t + 1.0 + e); t += 1.0; + if (t > 10000) { /* should never happen */ + mtherr("hyp2f1", TOOMANY); + *loss = 1.0; + return NPY_NAN; + } } - while (fabs(q / y) > EPS); + while (y == 0 || fabs(q / y) > EPS); - if (id == 0.0) { y *= gamma(c) / (gamma(a) * gamma(b)); goto psidon; @@ -498,7 +502,7 @@ return (s); } } - while (fabs(u / s) > MACHEP); + while (s == 0 || fabs(u / s) > MACHEP); /* return estimated relative error */ *loss = (MACHEP * umax) / fabs(s) + (MACHEP * i); Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2010-11-27 08:10:46 UTC (rev 6948) +++ trunk/scipy/special/specfun/specfun.f 2010-11-27 18:40:26 UTC (rev 6949) @@ -5675,7 +5675,7 @@ DO 15 J=1,500 RG=RG*(A+J-1.0D0)/(J*(B+J-1.0D0))*X HG=HG+RG - IF (DABS(RG/HG).LT.1.0D-15) GO TO 25 + IF (HG.NE.0D0.AND.DABS(RG/HG).LT.1.0D-15) GO TO 25 15 CONTINUE ELSE CALL GAMMA2(A,TA) Modified: trunk/scipy/special/tests/test_orthogonal_eval.py =================================================================== --- trunk/scipy/special/tests/test_orthogonal_eval.py 2010-11-27 08:10:46 UTC (rev 6948) +++ trunk/scipy/special/tests/test_orthogonal_eval.py 2010-11-27 18:40:26 UTC (rev 6949) @@ -1,5 +1,3 @@ -#from numpy.testing import - import numpy as np from numpy.testing import assert_ import scipy.special.orthogonal as orth @@ -15,6 +13,18 @@ assert_(np.allclose(v1, v2, rtol=1e-15)) +def test_warnings(): + # ticket 1334 + olderr = np.seterr(all='raise') + try: + # these should raise no fp warnings + orth.eval_legendre(1, 0) + orth.eval_laguerre(1, 1) + orth.eval_gegenbauer(1, 1, 0) + finally: + np.seterr(**olderr) + + class TestPolys(object): """ Check that the eval_* functions agree with the constructed polynomials @@ -47,9 +57,13 @@ p = (p[0].astype(int),) + p[1:] return func(*p) - ds = FuncData(polyfunc, dataset, range(len(param_ranges)+2), -1, - rtol=rtol) - ds.check() + olderr = np.seterr(all='raise') + try: + ds = FuncData(polyfunc, dataset, range(len(param_ranges)+2), -1, + rtol=rtol) + ds.check() + finally: + np.seterr(**olderr) def test_jacobi(self): self.check_poly(orth.eval_jacobi, orth.jacobi, From scipy-svn at scipy.org Sat Nov 27 23:01:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 22:01:40 -0600 (CST) Subject: [Scipy-svn] r6950 - trunk/scipy/stats Message-ID: <20101128040140.CD65A37A183@scipy.org> Author: rgommers Date: 2010-11-27 22:01:40 -0600 (Sat, 27 Nov 2010) New Revision: 6950 Modified: trunk/scipy/stats/distributions.py Log: BUG: handle missing extradoc in stats.rv_discrete. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-27 18:40:26 UTC (rev 6949) +++ trunk/scipy/stats/distributions.py 2010-11-28 04:01:40 UTC (rev 6950) @@ -956,8 +956,10 @@ # of _mom0_sc, vectorize cannot count the number of arguments correctly. if longname is None: - if name[0] in ['aeiouAEIOU']: hstr = "An " - else: hstr = "A " + if name[0] in ['aeiouAEIOU']: + hstr = "An " + else: + hstr = "A " longname = hstr + name # generate docstring for subclass instances @@ -4843,6 +4845,12 @@ self._cdfvec.nin = self.numargs + 1 # generate docstring for subclass instances + if longname is None: + if name[0] in ['aeiouAEIOU']: + hstr = "An " + else: + hstr = "A " + longname = hstr + name if self.__doc__ is None: self._construct_default_doc(longname=longname, extradoc=extradoc) else: @@ -4853,6 +4861,8 @@ def _construct_default_doc(self, longname=None, extradoc=None): """Construct instance docstring from the rv_discrete template.""" + if extradoc is None: + extradoc = '' if extradoc.startswith('\n\n'): extradoc = extradoc[2:] self.__doc__ = ''.join(['%s discrete random variable.'%longname, From scipy-svn at scipy.org Sat Nov 27 23:51:28 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 22:51:28 -0600 (CST) Subject: [Scipy-svn] r6951 - trunk/scipy/stats Message-ID: <20101128045128.E383F37A191@scipy.org> Author: rgommers Date: 2010-11-27 22:51:28 -0600 (Sat, 27 Nov 2010) New Revision: 6951 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/morestats.py Log: STY: remove whitespace in stats module. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-28 04:01:40 UTC (rev 6950) +++ trunk/scipy/stats/distributions.py 2010-11-28 04:51:28 UTC (rev 6951) @@ -1,7 +1,7 @@ # Functions to implement several important functions for # various Continous and Discrete Probability Distributions # -# Author: Travis Oliphant 2002-2010 with contributions from +# Author: Travis Oliphant 2002-2010 with contributions from # SciPy Developers 2004-2010 # @@ -418,7 +418,7 @@ ## pdf -- PDF ## logpdf -- log PDF (more numerically accurate if possible) ## cdf -- CDF -## logcdf -- log of CDF +## logcdf -- log of CDF ## sf -- Survival Function (1-CDF) ## logsf --- log of SF ## ppf -- Percent Point Function (Inverse of CDF) @@ -450,7 +450,7 @@ ## ## _cdf, _ppf, _rvs, _isf, _sf ## -## Rarely would you override _isf and _sf but you could for numerical precision. +## Rarely would you override _isf and _sf but you could for numerical precision. ## ## Statistics are computed using numerical integration by default. ## For speed you can redefine this using @@ -697,7 +697,7 @@ Parameters ---------- alpha : array-like float in [0,1] - Probability that an rv will be drawn from the returned range + Probability that an rv will be drawn from the returned range arg1, arg2, ... : array-like The shape parameter(s) for the distribution (see docstring of the instance object for more information) @@ -709,7 +709,7 @@ Returns ------- a, b: array-like (float) - end-points of range that contain alpha % of the rvs + end-points of range that contain alpha % of the rvs """ alpha = arr(alpha) if any((alpha > 1) | (alpha < 0)): @@ -1032,7 +1032,7 @@ def _pdf(self,x,*args): return derivative(self._cdf,x,dx=1e-5,args=args,order=5) - ## Could also define any of these + ## Could also define any of these def _logpdf(self, x, *args): return log(self._pdf(x, *args)) @@ -1116,9 +1116,9 @@ def logpdf(self, x, *args, **kwds): """ Log of the probability density function at x of the given RV. - - This uses more numerically accurate calculation if available. + This uses more numerically accurate calculation if available. + Parameters ---------- x : array-like @@ -1154,8 +1154,8 @@ if output.ndim == 0: return output[()] return output - + def cdf(self,x,*args,**kwds): """ Cumulative distribution function at x of the given RV. @@ -1636,7 +1636,7 @@ return x0, func, restore, args - + def fit(self, data, *args, **kwds): """ Return MLEs for shape, location, and scale parameters from data. @@ -1701,7 +1701,7 @@ if not callable(optimizer) and isinstance(optimizer, (str, unicode)): if not optimizer.startswith('fmin_'): optimizer = "fmin_"+optimizer - if optimizer == 'fmin_': + if optimizer == 'fmin_': optimizer = 'fmin' try: optimizer = getattr(optimize, optimizer) @@ -1727,7 +1727,7 @@ @np.deprecate def est_loc_scale(self, data, *args): """This function is deprecated, use self.fit_loc_scale(data) instead. """ - return self.fit_loc_scale(data, *args) + return self.fit_loc_scale(data, *args) def freeze(self,*args,**kwds): return rv_frozen(self,*args,**kwds) @@ -1785,8 +1785,8 @@ else: place(output,cond0,self.vecentropy(*goodargs)+log(scale)) return output - - def expect(self, func=None, args=(), loc=0, scale=1, lb=None, ub=None, + + def expect(self, func=None, args=(), loc=0, scale=1, lb=None, ub=None, conditional=False, **kwds): """calculate expected value of a function with respect to the distribution @@ -1810,11 +1810,11 @@ Returns ------- expected value : float - + Notes ----- This function has not been checked for it's behavior when the integral is - not finite. The integration behavior is inherited from integrate.quad. + not finite. The integration behavior is inherited from integrate.quad. """ if func is None: def fun(x, *args): @@ -1833,7 +1833,7 @@ kwds['args'] = args return integrate.quad(fun, lb, ub, **kwds)[0] / invfac - + _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) _ZETA3 = 1.202056903159594285399738161511449990765 # special.zeta(3,1) Apery's constant @@ -2019,7 +2019,7 @@ ku = a**3 - a**2*(2*b-1) + b**2*(b+1) - 2*a*b*(b+2) ku /= a*b*(a+b+2)*(a+b+3) ku *= 6 - return [sk-g1, ku-g2] + return [sk-g1, ku-g2] a, b = optimize.fsolve(func, (1.0, 1.0)) return super(beta_gen, self)._fitstart(data, args=(a,b)) def fit(self, data, *args, **kwds): @@ -2256,7 +2256,7 @@ return (df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2. ## Px = x**(df/2.0-1)*exp(-x/2.0) ## Px /= special.gamma(df/2.0)* 2**(df/2.0) -## return log(Px) +## return log(Px) def _cdf(self, x, df): return special.chdtr(df, x) def _sf(self, x, df): @@ -2763,7 +2763,7 @@ else: self.b = -1.0 / c return rv_continuous._entropy(self, c) - + genpareto = genpareto_gen(a=0.0,name='genpareto', longname="A generalized Pareto", shapes='c',extradoc=""" @@ -4267,7 +4267,7 @@ self._logdelta = log(self._delta) return (a != b) # All of these assume that _argcheck is called first - # and no other thread calls _pdf before. + # and no other thread calls _pdf before. def _pdf(self, x, a, b): return _norm_pdf(x) / self._delta def _logpdf(self, x, a, b): @@ -5563,7 +5563,7 @@ #handle cases with infinite support - while (pos <= ub) and (diff > self.moment_tol) and count <= maxcount: + while (pos <= ub) and (diff > self.moment_tol) and count <= maxcount: diff = fun(pos) tot += diff pos += self.inc @@ -5572,7 +5572,7 @@ if self.a < 0: #handle case when self.a = -inf diff = 1e100 pos = low - self.inc - while (pos >= lb) and (diff > self.moment_tol) and count <= maxcount: + while (pos >= lb) and (diff > self.moment_tol) and count <= maxcount: diff = fun(pos) tot += diff pos -= self.inc @@ -5581,8 +5581,8 @@ # fixme: replace with proper warning print 'sum did not converge' return tot/invfac - + # Binomial class binom_gen(rv_discrete): Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-11-28 04:01:40 UTC (rev 6950) +++ trunk/scipy/stats/morestats.py 2010-11-28 04:51:28 UTC (rev 6951) @@ -97,7 +97,7 @@ return _gauss_mvs(x, n, alpha) xbar = x.mean() C = x.var() - # mean + # mean fac = sqrt(C/(n-1)) tval = distributions.t.ppf((1+alpha)/2.0,n-1) delta = fac*tval @@ -135,11 +135,11 @@ def mvsdist(data): """Return 'frozen' distributions for mean, variance, and standard deviation of data. - + Parameters ---------- data : array-like (raveled to 1-d) - + Returns ------- mdist : "frozen" distribution object @@ -1101,7 +1101,7 @@ for i in range(k): allZij.extend(list(Zij[i])) g.append(len(allZij)) - + ranks = stats.rankdata(allZij) a = distributions.norm.ppf(ranks/(2*(Ntot+1.0)) + 0.5) @@ -1159,13 +1159,13 @@ mnM = n*(N*N-1.0)/12 varM = m*n*(N+1.0)*(N+2)*(N-2)/180 z = (M-mnM)/sqrt(varM) - + # Numerically better than p = norm.cdf(x); p = min(p, 1 - p) if z > 0: pval = distributions.norm.sf(z) else: pval = distributions.norm.cdf(z) - + # Account for two-sidedness pval *= 2. return z, pval From scipy-svn at scipy.org Sat Nov 27 23:52:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 27 Nov 2010 22:52:01 -0600 (CST) Subject: [Scipy-svn] r6952 - in trunk/scipy/stats: . tests Message-ID: <20101128045201.A5FA237A186@scipy.org> Author: rgommers Date: 2010-11-27 22:52:01 -0600 (Sat, 27 Nov 2010) New Revision: 6952 Modified: trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/tests/test_mstats_basic.py Log: BUG: fix mstats.plotting_positions for integer inputs, and improve docstring. Closes #1256. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-28 04:51:28 UTC (rev 6951) +++ trunk/scipy/stats/mstats_basic.py 2010-11-28 04:52:01 UTC (rev 6952) @@ -1787,45 +1787,52 @@ def plotting_positions(data, alpha=0.4, beta=0.4): - """Returns the plotting positions (or empirical percentile points) for the - data. - Plotting positions are defined as (i-alpha)/(n-alpha-beta), where: + """ + Returns plotting positions (or empirical percentile points) for the data. + + Plotting positions are defined as ``(i-alpha)/(n-alpha-beta)``, where: - i is the rank order statistics - n is the number of unmasked values along the given axis - alpha and beta are two parameters. Typical values for alpha and beta are: - - (0,1) : *p(k) = k/n* : linear interpolation of cdf (R, type 4) - - (.5,.5) : *p(k) = (k-1/2.)/n* : piecewise linear function (R, type 5) - - (0,0) : *p(k) = k/(n+1)* : Weibull (R type 6) - - (1,1) : *p(k) = (k-1)/(n-1)*. In this case, p(k) = mode[F(x[k])]. - That's R default (R type 7) - - (1/3,1/3): *p(k) = (k-1/3)/(n+1/3)*. Then p(k) ~ median[F(x[k])]. + - (0,1) : ``p(k) = k/n``, linear interpolation of cdf (R, type 4) + - (.5,.5) : ``p(k) = (k-1/2.)/n``, piecewise linear function + (R, type 5) + - (0,0) : ``p(k) = k/(n+1)``, Weibull (R type 6) + - (1,1) : ``p(k) = (k-1)/(n-1)``, in this case, + ``p(k) = mode[F(x[k])]``. That's R default (R type 7) + - (1/3,1/3): ``p(k) = (k-1/3)/(n+1/3)``, then + ``p(k) ~ median[F(x[k])]``. The resulting quantile estimates are approximately median-unbiased regardless of the distribution of x. (R type 8) - - (3/8,3/8): *p(k) = (k-3/8)/(n+1/4)*. Blom. + - (3/8,3/8): ``p(k) = (k-3/8)/(n+1/4)``, Blom. The resulting quantile estimates are approximately unbiased if x is normally distributed (R type 9) - (.4,.4) : approximately quantile unbiased (Cunnane) - (.35,.35): APL, used with PWM -Parameters ----------- - x : sequence + Parameters + ---------- + data : array_like Input data, as a sequence or array of dimension at most 2. - prob : sequence - List of quantiles to compute. - alpha : {0.4, float} optional - Plotting positions parameter. - beta : {0.4, float} optional - Plotting positions parameter. + alpha : float, optional + Plotting positions parameter. Default is 0.4. + beta : float, optional + Plotting positions parameter. Default is 0.4. + Returns + ------- + positions : MaskedArray + The calculated plotting positions. + """ data = ma.array(data, copy=False).reshape(1,-1) n = data.count() plpos = np.empty(data.size, dtype=float) plpos[n:] = 0 - plpos[data.argsort()[:n]] = (np.arange(1,n+1) - alpha)/(n+1-alpha-beta) + plpos[data.argsort()[:n]] = (np.arange(1, n+1) - alpha) / \ + (n + 1.0 - alpha - beta) return ma.array(plpos, mask=data._mask) meppf = plotting_positions Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 04:51:28 UTC (rev 6951) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 04:52:01 UTC (rev 6952) @@ -15,25 +15,25 @@ class TestMquantiles(TestCase): - """Regression tests for mstats module.""" - def test_mquantiles_limit_keyword(self): - """Ticket #867""" - data = np.array([[ 6., 7., 1.], - [ 47., 15., 2.], - [ 49., 36., 3.], - [ 15., 39., 4.], - [ 42., 40., -999.], - [ 41., 41., -999.], - [ 7., -999., -999.], - [ 39., -999., -999.], - [ 43., -999., -999.], - [ 40., -999., -999.], + """Regression tests for mstats module.""" + def test_mquantiles_limit_keyword(self): + """Ticket #867""" + data = np.array([[ 6., 7., 1.], + [ 47., 15., 2.], + [ 49., 36., 3.], + [ 15., 39., 4.], + [ 42., 40., -999.], + [ 41., 41., -999.], + [ 7., -999., -999.], + [ 39., -999., -999.], + [ 43., -999., -999.], + [ 40., -999., -999.], [ 36., -999., -999.]]) - desired = [[19.2, 14.6, 1.45], - [40.0, 37.5, 2.5 ], - [42.8, 40.05, 3.55]] - quants = mstats.mquantiles(data, axis=0, limit=(0, 50)) - assert_almost_equal(quants, desired) + desired = [[19.2, 14.6, 1.45], + [40.0, 37.5, 2.5 ], + [42.8, 40.05, 3.55]] + quants = mstats.mquantiles(data, axis=0, limit=(0, 50)) + assert_almost_equal(quants, desired) @@ -528,5 +528,11 @@ assert_almost_equal(result[1], 0.5692, 4) +def test_plotting_positions(): + """Regression test for #1256""" + pos = mstats.plotting_positions(np.arange(3), 0, 0) + assert_array_almost_equal(pos.data, np.array([0.25, 0.5, 0.75])) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sun Nov 28 03:56:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 02:56:36 -0600 (CST) Subject: [Scipy-svn] r6953 - in trunk/scipy/stats: . tests Message-ID: <20101128085636.941FD6F34B@scipy.org> Author: rgommers Date: 2010-11-28 02:56:36 -0600 (Sun, 28 Nov 2010) New Revision: 6953 Modified: trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/tests/test_mstats_basic.py Log: BUG: mstats.linregress was returning one value too many. Add basic test. Closes #1273. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-28 04:52:01 UTC (rev 6952) +++ trunk/scipy/stats/mstats_basic.py 2010-11-28 08:56:36 UTC (rev 6953) @@ -647,7 +647,7 @@ slope = Sxy / Sxx intercept = ymean - slope*xmean sterrest = ma.sqrt(1.-r*r) * y.std() - return slope, intercept, r, prob, sterrest, Syy/Sxx + return slope, intercept, r, prob, sterrest if stats.linregress.__doc__: linregress.__doc__ = stats.linregress.__doc__ + genmissingvaldoc Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 04:52:01 UTC (rev 6952) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 08:56:36 UTC (rev 6953) @@ -528,6 +528,17 @@ assert_almost_equal(result[1], 0.5692, 4) +def test_regress_simple(): + """Regress a line with sinusoidal noise. Test for #1273.""" + x = np.linspace(0, 100, 100) + y = 0.2 * np.linspace(0, 100, 100) + 10 + y += np.sin(np.linspace(0, 20, 100)) + + slope, intercept, r_value, p_value, sterr = mstats.linregress(x, y) + assert_almost_equal(slope, 0.19644990055858422) + assert_almost_equal(intercept, 10.211269918932341) + + def test_plotting_positions(): """Regression test for #1256""" pos = mstats.plotting_positions(np.arange(3), 0, 0) From scipy-svn at scipy.org Sun Nov 28 04:01:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 03:01:14 -0600 (CST) Subject: [Scipy-svn] r6954 - trunk/scipy/optimize Message-ID: <20101128090114.7C8A76F34B@scipy.org> Author: rgommers Date: 2010-11-28 03:01:14 -0600 (Sun, 28 Nov 2010) New Revision: 6954 Modified: trunk/scipy/optimize/optimize.py Log: BUG: allow 2-D initial guess, same as for other solvers. Closes #843. Modified: trunk/scipy/optimize/optimize.py =================================================================== --- trunk/scipy/optimize/optimize.py 2010-11-28 08:56:36 UTC (rev 6953) +++ trunk/scipy/optimize/optimize.py 2010-11-28 09:01:14 UTC (rev 6954) @@ -66,11 +66,11 @@ def rosen(x): """The Rosenbrock function. - + The function computed is sum(100.0*(x[1:] - x[:-1]**2.0)**2.0 + (1 - x[:-1])**2.0 - + Parameters ---------- x : array_like, 1D @@ -453,7 +453,7 @@ Optimization', 1999, pg. 198. """ - x0 = asarray(x0).squeeze() + x0 = asarray(x0).flatten() if x0.ndim == 0: x0.shape = (1,) if maxiter is None: From scipy-svn at scipy.org Sun Nov 28 08:31:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:31:22 -0600 (CST) Subject: [Scipy-svn] r6955 - trunk/scipy/stats Message-ID: <20101128133122.9AD2B32344@scipy.org> Author: rgommers Date: 2010-11-28 07:31:22 -0600 (Sun, 28 Nov 2010) New Revision: 6955 Modified: trunk/scipy/stats/stats.py Log: DOC: clean up old-style docstring. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 09:01:14 UTC (rev 6954) +++ trunk/scipy/stats/stats.py 2010-11-28 13:31:22 UTC (rev 6955) @@ -348,13 +348,16 @@ def _nanmedian(arr1d): # This only works on 1d arrays """Private function for rank a arrays. Compute the median ignoring Nan. - :Parameters: - arr1d : rank 1 ndarray - input array + Parameters + ---------- + arr1d : ndarray + Input array, of rank 1. - :Results: - m : float - the median.""" + Results + ------- + m : float + The median. + """ cond = 1-np.isnan(arr1d) x = np.sort(np.compress(cond,arr1d,axis=-1)) if x.size == 0: From scipy-svn at scipy.org Sun Nov 28 08:31:44 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:31:44 -0600 (CST) Subject: [Scipy-svn] r6956 - in trunk/scipy/stats: . tests Message-ID: <20101128133144.0934332348@scipy.org> Author: rgommers Date: 2010-11-28 07:31:43 -0600 (Sun, 28 Nov 2010) New Revision: 6956 Modified: trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: DEP: remove deprecated functions from stats: std/var/mean/median/cov/corrcoef. These have been deprecated for over two years. More recent deprecations are left in for now. Tests that only test numpy functions are removed as well. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-28 13:31:22 UTC (rev 6955) +++ trunk/scipy/stats/mstats_basic.py 2010-11-28 13:31:43 UTC (rev 6956) @@ -1921,11 +1921,11 @@ def var(a,axis=None): return ma.asarray(a).var(axis=axis,ddof=1) -var.__doc__ = stats.var.__doc__ +var.__doc__ = np.var.__doc__ def std(a,axis=None): return ma.asarray(a).std(axis=axis,ddof=1) -std.__doc__ = stats.std.__doc__ +std.__doc__ = np.std.__doc__ def stderr(a, axis=0): a, axis = _chk_asarray(a, axis) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:31:22 UTC (rev 6955) +++ trunk/scipy/stats/stats.py 2010-11-28 13:31:43 UTC (rev 6956) @@ -39,8 +39,6 @@ CENTRAL TENDENCY: gmean (geometric mean) hmean (harmonic mean) - mean - median medianscore mode @@ -72,8 +70,6 @@ samplevar samplestd signaltonoise (for arrays only) - var - std stderr sem z @@ -211,16 +207,16 @@ import _support from _support import _chk_asarray, _chk2_asarray -__all__ = ['gmean', 'hmean', 'mean', 'cmedian', 'median', 'mode', +__all__ = ['gmean', 'hmean', 'cmedian', 'mode', 'tmean', 'tvar', 'tmin', 'tmax', 'tstd', 'tsem', 'moment', 'variation', 'skew', 'kurtosis', 'describe', 'skewtest', 'kurtosistest', 'normaltest', 'itemfreq', 'scoreatpercentile', 'percentileofscore', 'histogram', 'histogram2', 'cumfreq', 'relfreq', 'obrientransform', 'samplevar', 'samplestd', 'signaltonoise', - 'var', 'std', 'stderr', 'sem', 'z', 'zs', 'zmap', 'zscore', + 'stderr', 'sem', 'z', 'zs', 'zmap', 'zscore', 'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean', - 'cov', 'corrcoef', 'f_oneway', 'pearsonr', 'fisher_exact', + 'f_oneway', 'pearsonr', 'fisher_exact', 'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress', 'ttest_1samp', 'ttest_ind', 'ttest_rel', 'kstest', 'chisquare', 'ks_2samp', 'mannwhitneyu', @@ -535,48 +531,6 @@ raise ValueError("Harmonic mean only defined if all elements greater than zero") - -def mean(a, axis=0): - """ - Returns the arithmetic mean of m along the given dimension. - - That is: (x1 + x2 + .. + xn) / n - - Parameters - ---------- - a : array - axis : int or None - - Returns - ------- - The arithmetic mean computed over a single dimension of the input array or - all values in the array if axis=None. The return value will have a floating - point dtype even if the input data are integers. - - - Notes - ----- - scipy.stats.mean is deprecated; please update your code to use numpy.mean. - - Please note that: - - numpy.mean axis argument defaults to None, not 0 - - numpy.mean has a ddof argument to replace bias in a more general - manner. - - scipy.stats.mean(a, bias=True) can be replaced by :: - - numpy.mean(x, axis=0, ddof=1) - - removed in scipy 0.8.0 - - """ - raise DeprecationWarning("""\ -scipy.stats.mean is deprecated; please update your code to use numpy.mean. -Please note that: - - numpy.mean axis argument defaults to None, not 0 - - numpy.mean has a ddof argument to replace bias in a more general manner. - scipy.stats.mean(a, bias=True) can be replaced by numpy.mean(x, -axis=0, ddof=1).""") - def cmedian(a, numbins=1000): # fixme: numpy.median() always seems to be a better choice. # A better version of this function would take already-histogrammed data @@ -632,32 +586,7 @@ median = LRL + ((n/2.0-cfbelow)/float(freq))*binsize # MEDIAN return median -def median(a, axis=0): - # fixme: This would be redundant with numpy.median() except that the latter - # does not deal with arbitrary axes. - """Returns the median of the passed array along the given axis. - If there is an even number of entries, the mean of the - 2 middle values is returned. - - Parameters - ---------- - a : array - axis=0 : int - - Returns - ------- - The median of each remaining axis, or of all of the values in the array - if axis is None. - """ - raise DeprecationWarning("""\ -scipy.stats.median is deprecated; please update your code to use numpy.median. -Please note that: - - numpy.median axis argument defaults to None, not 0 - - numpy.median has a ddof argument to replace bias in a more general manner. - scipy.stats.median(a, bias=True) can be replaced by numpy.median(x, -axis=0, ddof=1).""") - def mode(a, axis=0): """ Returns an array of the modal (most common) value in the passed array. @@ -1741,36 +1670,7 @@ sd = a.std(axis=axis, ddof=ddof) return np.where(sd == 0, 0, m/sd) -def var(a, axis=0, bias=False): - """ -Returns the estimated population variance of the values in the passed -array (i.e., N-1). Axis can equal None (ravel array first), or an -integer (the axis over which to operate). -""" - raise DeprecationWarning("""\ -scipy.stats.var is deprecated; please update your code to use numpy.var. -Please note that: - - numpy.var axis argument defaults to None, not 0 - - numpy.var has a ddof argument to replace bias in a more general manner. - scipy.stats.var(a, bias=True) can be replaced by numpy.var(x, - axis=0, ddof=0), scipy.stats.var(a, bias=False) by var(x, axis=0, - ddof=1).""") -def std(a, axis=0, bias=False): - """ -Returns the estimated population standard deviation of the values in -the passed array (i.e., N-1). Axis can equal None (ravel array -first), or an integer (the axis over which to operate). -""" - raise DeprecationWarning("""\ -scipy.stats.std is deprecated; please update your code to use numpy.std. -Please note that: - - numpy.std axis argument defaults to None, not 0 - - numpy.std has a ddof argument to replace bias in a more general manner. - scipy.stats.std(a, bias=True) can be replaced by numpy.std(x, - axis=0, ddof=0), scipy.stats.std(a, bias=False) by numpy.std(x, axis=0, - ddof=1).""") - @np.lib.deprecate(message=""" scipy.stats.stderr is deprecated; please update your code to use scipy.stats.sem. @@ -2186,81 +2086,6 @@ return np.mean(newa,axis=0) - -##################################### -##### CORRELATION FUNCTIONS ###### -##################################### - -# Cov is more flexible than the original -# covariance and computes an unbiased covariance matrix -# by default. -def cov(m, y=None, rowvar=False, bias=False): - """Estimate the covariance matrix. - - If m is a vector, return the variance. For matrices where each row - is an observation, and each column a variable, return the covariance - matrix. Note that in this case diag(cov(m)) is a vector of - variances for each column. - - cov(m) is the same as cov(m, m) - - Normalization is by (N-1) where N is the number of observations - (unbiased estimate). If bias is True then normalization is by N. - - If rowvar is False, then each row is a variable with - observations in the columns. - """ - warnings.warn("""\ -scipy.stats.cov is deprecated; please update your code to use numpy.cov. -Please note that: - - numpy.cov rowvar argument defaults to true, not false - - numpy.cov bias argument defaults to false, not true -""", DeprecationWarning) - m = asarray(m) - if y is None: - y = m - else: - y = asarray(y) - if rowvar: - m = np.transpose(m) - y = np.transpose(y) - N = m.shape[0] - if (y.shape[0] != N): - raise ValueError("x and y must have the same number of observations.") - m = m - np.mean(m,axis=0) - y = y - np.mean(y,axis=0) - if bias: - fact = N*1.0 - else: - fact = N-1.0 - val = np.squeeze(np.dot(np.transpose(m),np.conjugate(y))) / fact - return val - -def corrcoef(x, y=None, rowvar=False, bias=True): - """The correlation coefficients formed from 2-d array x, where the - rows are the observations, and the columns are variables. - - corrcoef(x,y) where x and y are 1d arrays is the same as - corrcoef(transpose([x,y])) - - If rowvar is True, then each row is a variables with - observations in the columns. - """ - warnings.warn("""\ -scipy.stats.corrcoef is deprecated; please update your code to use numpy.corrcoef. -Please note that: - - numpy.corrcoef rowvar argument defaults to true, not false - - numpy.corrcoef bias argument defaults to false, not true -""", DeprecationWarning) - if y is not None: - x = np.transpose([x,y]) - y = None - c = cov(x, y, rowvar=rowvar, bias=bias) - d = np.diag(c) - return c/np.sqrt(np.multiply.outer(d,d)) - - - def f_oneway(*args): """ Performs a 1-way ANOVA. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:31:22 UTC (rev 6955) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:31:43 UTC (rev 6956) @@ -114,14 +114,6 @@ II. C. Basic Statistics """ - def test_meanX(self): - y = np.mean(X) - assert_almost_equal(y, 5.0) - - def test_stdX(self): - y = np.std(X, ddof=1) - assert_almost_equal(y, 2.738612788) - def test_tmeanX(self): y = stats.tmean(X, (2, 8), (True, True)) assert_almost_equal(y, 5.0) @@ -134,14 +126,6 @@ y = stats.tstd(X, (2, 8), (True, True)) assert_almost_equal(y, 2.1602468994692865) - def test_meanZERO(self): - y = np.mean(ZERO) - assert_almost_equal(y, 0.0) - - def test_stdZERO(self): - y = np.std(ZERO, ddof=1) - assert_almost_equal(y, 0.0) - ## Really need to write these tests to handle missing values properly ## def test_meanMISS(self): ## y = np.mean(MISS) @@ -151,47 +135,7 @@ ## y = stats.stdev(MISS) ## assert_almost_equal(y, 0.0) - def test_meanBIG(self): - y = np.mean(BIG) - assert_almost_equal(y, 99999995.00) - - def test_stdBIG(self): - y = np.std(BIG, ddof=1) - assert_almost_equal(y, 2.738612788) - - def test_meanLITTLE(self): - y = np.mean(LITTLE) - assert_approx_equal(y, 0.999999950) - - def test_stdLITTLE(self): - y = np.std(LITTLE, ddof=1) - assert_approx_equal(y, 2.738612788e-8) - - def test_meanHUGE(self): - y = np.mean(HUGE) - assert_approx_equal(y, 5.00000e+12) - - def test_stdHUGE(self): - y = np.std(HUGE, ddof=1) - assert_approx_equal(y, 2.738612788e12) - - def test_meanTINY(self): - y = np.mean(TINY) - assert_almost_equal(y, 0.0) - - def test_stdTINY(self): - y = np.std(TINY, ddof=1) - assert_almost_equal(y, 0.0) - - def test_meanROUND(self): - y = np.mean(ROUND) - assert_approx_equal(y, 4.500000000) - - def test_stdROUND(self): - y = np.std(ROUND, ddof=1) - assert_approx_equal(y, 2.738612788) - class TestNanFunc(TestCase): def __init__(self, *args, **kw): TestCase.__init__(self, *args, **kw) @@ -924,55 +868,12 @@ assert_array_almost_equal(actual1, desired1, decimal=14) -class TestMean(TestCase): - def test_basic(self): - a = [3,4,5,10,-3,-5,6] - af = [3.,4,5,10,-3,-5,-6] - Na = len(a) - Naf = len(af) - mn1 = 0.0 - for el in a: - mn1 += el / float(Na) - assert_almost_equal(np.mean(a),mn1,11) - mn2 = 0.0 - for el in af: - mn2 += el / float(Naf) - assert_almost_equal(np.mean(af),mn2,11) - - def test_2d(self): - a = [[1.0, 2.0, 3.0], - [2.0, 4.0, 6.0], - [8.0, 12.0, 7.0]] - A = array(a) - N1, N2 = (3, 3) - mn1 = zeros(N2, dtype=float) - for k in range(N1): - mn1 += A[k,:] / N1 - assert_almost_equal(np.mean(a, axis=0), mn1, decimal=13) - mn2 = zeros(N1, dtype=float) - for k in range(N2): - mn2 += A[:,k] - mn2 /= N2 - assert_almost_equal(np.mean(a, axis=1), mn2, decimal=13) - - def test_ravel(self): - a = rand(5,3,5) - A = 0 - for val in ravel(a): - A += val - assert_almost_equal(np.mean(a,axis=None),A/(5*3.0*5)) - class TestPercentile(TestCase): def setUp(self): self.a1 = [3,4,5,10,-3,-5,6] self.a2 = [3,-6,-2,8,7,4,2,1] self.a3 = [3.,4,5,10,-3,-5,-6,7.0] - def test_median(self): - assert_equal(np.median(self.a1), 4) - assert_equal(np.median(self.a2), 2.5) - assert_equal(np.median(self.a3), 3.5) - def test_percentile(self): x = arange(8) * 0.5 assert_equal(stats.scoreatpercentile(x, 0), 0.) @@ -989,24 +890,6 @@ [1,1,1]) -class TestStd(TestCase): - def test_basic(self): - a = [3,4,5,10,-3,-5,6] - b = [3,4,5,10,-3,-5,-6] - assert_almost_equal(np.std(a, ddof=1),5.2098807225172772,11) - assert_almost_equal(np.std(b, ddof=1),5.9281411203561225,11) - - def test_2d(self): - a = [[1.0, 2.0, 3.0], - [2.0, 4.0, 6.0], - [8.0, 12.0, 7.0]] - b1 = array((3.7859388972001824, 5.2915026221291814, - 2.0816659994661335)) - b2 = array((1.0,2.0,2.64575131106)) - assert_array_almost_equal(np.std(a,ddof=1,axis=0),b1,11) - assert_array_almost_equal(np.std(a,ddof=1,axis=1),b2,11) - - class TestCMedian(TestCase): def test_basic(self): data = [1,2,3,1,5,3,6,4,3,2,4,3,5,2.0] @@ -1014,28 +897,7 @@ assert_almost_equal(stats.cmedian(data,3),3.083333333333333) assert_almost_equal(stats.cmedian(data),3.0020020020020022) -class TestMedian(TestCase): - def test_basic(self): - data1 = [1,3,5,2,3,1,19,-10,2,4.0] - data2 = [3,5,1,10,23,-10,3,-2,6,8,15] - assert_almost_equal(np.median(data1),2.5) - assert_almost_equal(np.median(data2),5) - def test_basic2(self): - a1 = [3,4,5,10,-3,-5,6] - a2 = [3,-6,-2,8,7,4,2,1] - a3 = [3.,4,5,10,-3,-5,-6,7.0] - assert_equal(np.median(a1),4) - assert_equal(np.median(a2),2.5) - assert_equal(np.median(a3),3.5) - - def test_axis(self): - """Regression test for #760.""" - a1 = np.array([[3,4,5], [10,-3,-5]]) - assert_equal(np.median(a1), 3.5) - assert_equal(np.median(a1, axis=0), np.array([6.5, 0.5, 0.])) - assert_equal(np.median(a1, axis=-1), np.array([4., -3])) - class TestMode(TestCase): def test_basic(self): data1 = [3,5,1,10,23,3,2,6,8,6,10,6] @@ -1049,20 +911,7 @@ note that length(testcase) = 4 """ testcase = [1,2,3,4] - def test_std(self): - y = np.std(self.testcase, ddof=1) - assert_approx_equal(y,1.290994449) - def test_var(self): - """ - var(testcase) = 1.666666667 """ - #y = stats.var(self.shoes[0]) - #assert_approx_equal(y,6.009) - y = np.var(self.testcase) - assert_approx_equal(y,1.25) - y = np.var(self.testcase, ddof=1) - assert_approx_equal(y,1.666666667) - def test_samplevar(self): """ R does not have 'samplevar' so the following was used From scipy-svn at scipy.org Sun Nov 28 08:33:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:33:06 -0600 (CST) Subject: [Scipy-svn] r6957 - in trunk/scipy/stats: . tests Message-ID: <20101128133306.6A2CF37C3F2@scipy.org> Author: rgommers Date: 2010-11-28 07:33:06 -0600 (Sun, 28 Nov 2010) New Revision: 6957 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: ENH: new faster implementation of stats.kendalltau. The new tests pass with both the old and new implementations. They do not agree with the version in mstats though - the tie handling there seems different. For (long) discussion on kendalltau, see scipy-dev around Mar 2009. Thanks to Enzo Michelangeli for original implementation, David Simcha and Sturla Molden for alternate implementations, and Josef for extensive testing. This closes tickets #999 and #893. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:31:43 UTC (rev 6956) +++ trunk/scipy/stats/stats.py 2010-11-28 13:33:06 UTC (rev 6957) @@ -2521,9 +2521,9 @@ return rpb, prob -def kendalltau(x, y): +def kendalltau(x, y, initial_lexsort=True): """ - Calculates Kendall's tau, a correlation measure for ordinal data + Calculates Kendall's tau, a correlation measure for ordinal data. Kendall's tau is a measure of the correspondence between two rankings. Values close to 1 indicate strong agreement, values close to -1 indicate @@ -2532,44 +2532,147 @@ Parameters ---------- - x : array_like - array of rankings - y : array_like - second array of rankings, must be the same length as x + x, y : array_like + Arrays of rankings, of the same shape. If arrays are not 1-D, they will + be flattened to 1-D. + initial_lexsort : bool, optional + Whether to use lexsort or quicksort as the sorting method for the + initial sort of the inputs. Default is lexsort (True), for which + `kendalltau` is of complexity O(n log(n)). If False, the complexity is + O(n^2), but with a smaller pre-factor (so quicksort may be faster for + small arrays). Returns ------- Kendall's tau : float - The tau statistic + The tau statistic. p-value : float The two-sided p-value for a hypothesis test whose null hypothesis is an absence of association, tau = 0. + References + ---------- + W.R. Knight, "A Computer Method for Calculating Kendall's Tau with + Ungrouped Data", Journal of the American Statistical Association, Vol. 61, + No. 314, Part 1, pp. 436-439, 1966. + + Notes + ----- + The definition of Kendall's tau that is used is:: + + tau = (P - Q) / sqrt((P + Q + T) * (P + Q + U)) + + where P is the number of concordant pairs, Q the number of discordant + pairs, T the number of ties only in `x`, and U the number of ties only in + `y`. If a tie occurs for the same pair in both `x` and `y`, it is not added + to either T or U. + + Examples + -------- + >>> x1 = [12, 2, 1, 12, 2] + >>> x2 = [1, 4, 7, 1, 0] + >>> tau, p_value = sp.stats.kendalltau(x1, x2) + >>> tau + -0.47140452079103173 + >>> p_value + 0.24821309157521476 + """ - n1 = 0 - n2 = 0 - iss = 0 - for j in range(len(x)-1): - for k in range(j+1,len(y)): - a1 = x[j] - x[k] - a2 = y[j] - y[k] - aa = a1 * a2 - if (aa): # neither array has a tie - n1 = n1 + 1 - n2 = n2 + 1 - if aa > 0: - iss = iss + 1 - else: - iss = iss -1 + + x = np.asarray(x).ravel() + y = np.asarray(y).ravel() + n = len(x) + temp = range(n) # support structure used by mergesort + # this closure recursively sorts sections of perm[] by comparing + # elements of y[perm[]] using temp[] as support + # returns the number of swaps required by an equivalent bubble sort + def mergesort(offs, length): + exchcnt = 0 + if length == 1: + return 0 + if length == 2: + if y[perm[offs]] <= y[perm[offs+1]]: + return 0 + t = perm[offs] + perm[offs] = perm[offs+1] + perm[offs+1] = t + return 1 + length0 = length / 2 + length1 = length - length0 + middle = offs + length0 + exchcnt += mergesort(offs, length0) + exchcnt += mergesort(middle, length1) + if y[perm[middle - 1]] < y[perm[middle]]: + return exchcnt + # merging + i = j = k = 0 + while j < length0 or k < length1: + if k >= length1 or (j < length0 and y[perm[offs + j]] <= + y[perm[middle + k]]): + temp[i] = perm[offs + j] + d = i - j + j += 1 else: - if a1: - n1 = n1 + 1 - if a2: - n2 = n2 + 1 - tau = iss / np.sqrt(float(n1*n2)) - svar = (4.0*len(x)+10.0) / (9.0*len(x)*(len(x)-1)) + temp[i] = perm[middle + k] + d = (offs + i) - (middle + k) + k += 1 + if d > 0: + exchcnt += d; + i += 1 + perm[offs:offs+length] = temp[0:length] + return exchcnt + + # initial sort on values of x and, if tied, on values of y + if initial_lexsort: + # sort implemented as mergesort, worst case: O(n log(n)) + perm = np.lexsort((y, x)) + else: + # sort implemented as quicksort, 30% faster but with worst case: O(n^2) + perm = range(n) + perm.sort(lambda a,b: cmp(x[a],x[b]) or cmp(y[a],y[b])) + + # compute joint ties + first = 0 + t = 0 + for i in xrange(1, n): + if x[perm[first]] != x[perm[i]] or y[perm[first]] != y[perm[i]]: + t += ((i - first) * (i - first - 1)) / 2 + first = i + t += ((n - first) * (n - first - 1)) / 2 + + # compute ties in x + first = 0 + u = 0 + for i in xrange(1,n): + if x[perm[first]] != x[perm[i]]: + u += ((i - first) * (i - first - 1)) / 2 + first = i + u += ((n - first) * (n - first - 1)) / 2 + + # count exchanges + exchanges = mergesort(0, n) + # compute ties in y after mergesort with counting + first = 0 + v = 0 + for i in xrange(1,n): + if y[perm[first]] != y[perm[i]]: + v += ((i - first) * (i - first - 1)) / 2 + first = i + v += ((n - first) * (n - first - 1)) / 2 + + tot = (n * (n - 1)) / 2 + if tot == u and tot == v: + return 1 # Special case for all ties in both ranks + + tau = ((tot - (v + u - t)) - 2.0 * exchanges) / \ + np.sqrt((tot - u) * (tot - v)) + + # what follows reproduces the ending of Gary Strangman's original + # stats.kendalltau() in SciPy + svar = (4.0 * n + 10.0) / (9.0 * n * (n - 1)) z = tau / np.sqrt(svar) - prob = special.erfc(abs(z)/1.4142136) + prob = special.erfc(np.abs(z) / 1.4142136) + return tau, prob Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:31:43 UTC (rev 6956) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:33:06 UTC (rev 6957) @@ -529,12 +529,43 @@ ## should appear on the diagonal and the total should be 899999955. ## If the table cannot hold these values, forget about working with ## census data. You can also tabulate HUGE against TINY. There is no -## reason a tabulation program should not be able to digtinguish +## reason a tabulation program should not be able to distinguish ## different values regardless of their magnitude. ### I need to figure out how to do this one. +def test_kendalltau(): + """Some tests for kendalltau.""" + + # with some ties + x1 = [12, 2, 1, 12, 2] + x2 = [1, 4, 7, 1, 0] + res = (-0.47140452079103173, 0.24821309157521476) + expected = stats.kendalltau(x1, x2) + assert_approx_equal(res[0], expected[0]) + assert_approx_equal(res[1], expected[1]) + + # check two different sort methods + assert_approx_equal(stats.kendalltau(x1, x2, initial_lexsort=False)[1], + stats.kendalltau(x1, x2, initial_lexsort=True)[1]) + + # and with larger arrays + np.random.seed(7546) + x = np.array([np.random.normal(loc=1, scale=1, size=500), + np.random.normal(loc=1, scale=1, size=500)]) + corr = [[1.0, 0.3], + [0.3, 1.0]] + x = np.dot(np.linalg.cholesky(corr), x) + expected = (0.19291382765531062, 1.1337108207276285e-10) + res = stats.kendalltau(x[0], x[1]) + assert_approx_equal(res[0], expected[0]) + assert_approx_equal(res[1], expected[1]) + + # and do we get a tau of 1 for identical inputs? + assert_approx_equal(stats.kendalltau([1,1,2], [1,1,2])[0], 1.0) + + class TestRegression(TestCase): def test_linregressBIGX(self): """ W.II.F. Regress BIG on X. From scipy-svn at scipy.org Sun Nov 28 08:34:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:34:42 -0600 (CST) Subject: [Scipy-svn] r6958 - trunk/doc/release Message-ID: <20101128133442.3ED1937D3AC@scipy.org> Author: rgommers Date: 2010-11-28 07:34:42 -0600 (Sun, 28 Nov 2010) New Revision: 6958 Modified: trunk/doc/release/0.9.0-notes.rst Log: DOC: update release notes with changes to stats/stats.py. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:33:06 UTC (rev 6957) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:34:42 UTC (rev 6958) @@ -118,6 +118,16 @@ were added. +Improved statistical tests (``scipy.stats``) +-------------------------------------------- + +A new function ``scipy.stats.fisher_exact`` was added, that provides Fisher's +exact test for 2x2 contingency tables. + +The function ``scipy.stats.kendalltau`` was rewritten to make it much faster +(O(n log(n)) vs O(n^2)). + + Removed features ================ @@ -126,3 +136,7 @@ The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has been deprecated since version 0.7, was removed. + +Several functions in ``scipy.stats`` that are available from numpy and have +been deprecated since version 0.7 have been removed: ``std``, ``var``, +``mean``, ``median``, ``cov`` and ``corrcoef``. From scipy-svn at scipy.org Sun Nov 28 08:35:38 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:35:38 -0600 (CST) Subject: [Scipy-svn] r6959 - in trunk/scipy: signal sparse/linalg/isolve stats Message-ID: <20101128133538.243D437D3AF@scipy.org> Author: rgommers Date: 2010-11-28 07:35:38 -0600 (Sun, 28 Nov 2010) New Revision: 6959 Modified: trunk/scipy/signal/filter_design.py trunk/scipy/signal/wavelets.py trunk/scipy/sparse/linalg/isolve/iterative.py trunk/scipy/stats/stats.py Log: DOC: merge some more doc wiki edits. Modified: trunk/scipy/signal/filter_design.py =================================================================== --- trunk/scipy/signal/filter_design.py 2010-11-28 13:34:42 UTC (rev 6958) +++ trunk/scipy/signal/filter_design.py 2010-11-28 13:35:38 UTC (rev 6959) @@ -34,14 +34,15 @@ return w def freqs(b, a, worN=None, plot=None): - """Compute frequency response of analog filter. + """ + Compute frequency response of analog filter. Given the numerator (b) and denominator (a) of a filter compute its - frequency response. + frequency response:: - b[0]*(jw)**(nb-1) + b[1]*(jw)**(nb-2) + ... + b[nb-1] - H(w) = -------------------------------------------------------- - a[0]*(jw)**(na-1) + a[1]*(jw)**(na-2) + ... + a[na-1] + b[0]*(jw)**(nb-1) + b[1]*(jw)**(nb-2) + ... + b[nb-1] + H(w) = ------------------------------------------------------- + a[0]*(jw)**(na-1) + a[1]*(jw)**(na-2) + ... + a[na-1] Parameters ---------- @@ -54,6 +55,10 @@ of the response curve (determined by pole-zero locations). If a single integer, the compute at that many frequencies. Otherwise, compute the response at frequencies given in worN. + plot : callable + A callable that takes two arguments. If given, the return parameters + `w` and `h` are passed to plot. Useful for plotting the frequency + response inside `freqz`. Returns ------- @@ -61,6 +66,17 @@ The frequencies at which h was computed. h : ndarray The frequency response. + + See Also + -------- + freqz : Compute the frequency response of a digital filter. + + Notes + ----- + Using Matplotlib's "plot" function as the callable for `plot` produces + unexpected results, this plots the real part of the complex transfer + function, not the magnitude. + """ if worN is None: w = findfreqs(b,a,200) Modified: trunk/scipy/signal/wavelets.py =================================================================== --- trunk/scipy/signal/wavelets.py 2010-11-28 13:34:42 UTC (rev 6958) +++ trunk/scipy/signal/wavelets.py 2010-11-28 13:35:38 UTC (rev 6959) @@ -78,7 +78,8 @@ return NotImplemented def cascade(hk, J=7): - """Return (x, phi, psi) at dyadic points K/2**J from filter coefficients. + """ + Return (x, phi, psi) at dyadic points K/2**J from filter coefficients. Parameters ---------- @@ -98,6 +99,7 @@ N phi(x) = sum hk * phi(2x-k) k=0 + psi : The wavelet function ``psi(x)`` at `x`: Modified: trunk/scipy/sparse/linalg/isolve/iterative.py =================================================================== --- trunk/scipy/sparse/linalg/isolve/iterative.py 2010-11-28 13:34:42 UTC (rev 6958) +++ trunk/scipy/sparse/linalg/isolve/iterative.py 2010-11-28 13:35:38 UTC (rev 6959) @@ -305,7 +305,8 @@ def gmres(A, b, x0=None, tol=1e-5, restart=None, maxiter=None, xtype=None, M=None, callback=None, restrt=None): - """Use Generalized Minimal RESidual iteration to solve A x = b + """ + Use Generalized Minimal RESidual iteration to solve A x = b. Parameters ---------- @@ -318,34 +319,54 @@ ------- x : {array, matrix} The converged solution. - info : integer + info : int Provides convergence information: - 0 : successful exit - >0 : convergence to tolerance not achieved, number of iterations - <0 : illegal input or breakdown + * 0 : successful exit + * >0 : convergence to tolerance not achieved, number of iterations + * <0 : illegal input or breakdown - Other Parameters + Other parameters ---------------- - x0 : {array, matrix} - Starting guess for the solution. + x0 : {array, matrix} + Starting guess for the solution (a vector of zeros by default). tol : float Tolerance to achieve. The algorithm terminates when either the relative or the absolute residual is below `tol`. - restart : integer + restart : int, optional Number of iterations between restarts. Larger values increase iteration cost, but may be necessary for convergence. - (Default: 20) - maxiter : integer, optional + Default is 20. + maxiter : int, optional Maximum number of iterations. Iteration will stop after maxiter steps even if the specified tolerance has not been achieved. M : {sparse matrix, dense matrix, LinearOperator} - Preconditioner for A. The preconditioner should approximate the - inverse of A. Effective preconditioning dramatically improves the - rate of convergence, which implies that fewer iterations are needed - to reach a given error tolerance. + Inverse of the preconditioner of A. M should approximate the + inverse of A and be easy to solve for (see Notes). Effective + preconditioning dramatically improves the rate of convergence, + which implies that fewer iterations are needed to reach a given + error tolerance. By default, no preconditioner is used. callback : function User-supplied function to call after each iteration. It is called as callback(rk), where rk is the current residual vector. + + See Also + -------- + LinearOperator + + Notes + ----- + A preconditioner, P, is chosen such that P is close to A but easy to solve for. + The preconditioner parameter required by this routine is ``M = P^-1``. + The inverse should preferably not be calculated explicitly. Rather, use the + following template to produce M:: + + # Construct a linear operator that computes P^-1 * x. + import scipy.sparse.linalg as spla + M_x = lambda x: spla.spsolve(P, x) + M = spla.LinearOperator((n, n), M_x) + + Deprecated Parameters + --------------------- xtype : {'f','d','F','D'} This parameter is DEPRECATED --- avoid using it. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:34:42 UTC (rev 6958) +++ trunk/scipy/stats/stats.py 2010-11-28 13:35:38 UTC (rev 6959) @@ -532,27 +532,27 @@ def cmedian(a, numbins=1000): - # fixme: numpy.median() always seems to be a better choice. - # A better version of this function would take already-histogrammed data - # and compute the median from that. - # fixme: the wording of the docstring is a bit wonky. - """Returns the computed median value of an array. + """ + Returns the computed median value of an array. All of the values in the input array are used. The input array is first - histogrammed using numbins bins. The bin containing the median is + histogrammed using `numbins` bins. The bin containing the median is selected by searching for the halfway point in the cumulative histogram. - The median value is then computed by linearly interpolating across that bin. + The median value is then computed by linearly interpolating across that + bin. Parameters ---------- - a : array + a : array_like + Input array. numbins : int The number of bins used to histogram the data. More bins give greater accuracy to the approximation of the median. Returns ------- - A floating point value approximating the median. + cmedian : float + An approximation of the median. References ---------- @@ -563,6 +563,9 @@ York. 2000. """ + # TODO: numpy.median() always seems to be a better choice. + # A better version of this function would take already-histogrammed data + # and compute the median from that. a = np.ravel(a) n = float(len(a)) @@ -965,7 +968,7 @@ For normally distributed data, the skewness should be about 0. A skewness value > 0 means that there is more weight in the left tail of the - distribution. The function skewtest() can be used to determine if the + distribution. The function `skewtest` can be used to determine if the skewness value is close enough to 0, statistically speaking. Parameters @@ -1020,7 +1023,7 @@ If bias is False then the kurtosis is calculated using k statistics to eliminate bias coming from biased moment estimators - Use kurtosistest() to see if result is close enough to normal. + Use `kurtosistest` to see if result is close enough to normal. Parameters ---------- @@ -1137,6 +1140,8 @@ Returns ------- + z-score : float + The computed z-score for this test. p-value : float a 2-sided p-value for the hypothesis test @@ -1170,7 +1175,7 @@ This function tests the null hypothesis that the kurtosis of the population from which the sample was drawn is that - of the normal distribution: kurtosis=3(n-1)/(n+1). + of the normal distribution: ``kurtosis = 3(n-1)/(n+1)``. Parameters ---------- @@ -1182,6 +1187,8 @@ Returns ------- + z-score : float + The computed z-score for this test. p-value : float The 2-sided p-value for the hypothesis test @@ -1260,22 +1267,51 @@ ##################################### def itemfreq(a): - # fixme: I'm not sure I understand what this does. The docstring is - # internally inconsistent. - # comment: fortunately, this function doesn't appear to be used elsewhere - """Returns a 2D array of item frequencies. + """ + Returns a 2D array of item frequencies. - Column 1 contains item values, column 2 contains their respective counts. - Assumes a 1D array is passed. - Parameters ---------- - a : array + a : array_like of rank 1 + Input array. Returns ------- - A 2D frequency table (col [0:n-1]=scores, col n=frequencies) + itemfreq : ndarray of rank 2 + A 2D frequency table (col [0:n-1]=scores, col n=frequencies). + Column 1 contains item values, column 2 contains their respective + counts. + + Notes + ----- + This uses a loop that is only reasonably fast if the number of unique + elements is not large. For integers, numpy.bincount is much faster. + This function currently does not support strings or multi-dimensional + scores. + + Examples + -------- + >>> a = np.array([1, 1, 5, 0, 1, 2, 2, 0, 1, 4]) + >>> stats.itemfreq(a) + array([[ 0., 2.], + [ 1., 4.], + [ 2., 2.], + [ 4., 1.], + [ 5., 1.]]) + >>> np.bincount(a) + array([2, 4, 2, 0, 1, 1]) + + >>> stats.itemfreq(a/10.) + array([[ 0. , 2. ], + [ 0.1, 4. ], + [ 0.2, 2. ], + [ 0.4, 1. ], + [ 0.5, 1. ]]) + """ + # TODO: I'm not sure I understand what this does. The docstring is + # internally inconsistent. + # comment: fortunately, this function doesn't appear to be used elsewhere scores = _support.unique(a) scores = np.sort(scores) freq = zeros(len(scores)) @@ -1432,29 +1468,31 @@ def histogram2(a, bins): - # comment: probably obsoleted by numpy.histogram() - """ histogram2(a,bins) -- Compute histogram of a using divisions in bins + """ + Compute histogram using divisions in bins. - Description: - Count the number of times values from array a fall into - numerical ranges defined by bins. Range x is given by - bins[x] <= range_x < bins[x+1] where x =0,N and N is the - length of the bins array. The last range is given by - bins[N] <= range_N < infinity. Values less than bins[0] are - not included in the histogram. - Arguments: - a -- 1D array. The array of values to be divied into bins - bins -- 1D array. Defines the ranges of values to use during - histogramming. - Returns: - 1D array. Each value represents the occurences for a given - bin (range) of values. + Count the number of times values from array `a` fall into + numerical ranges defined by `bins`. Range x is given by + bins[x] <= range_x < bins[x+1] where x =0,N and N is the + length of the `bins` array. The last range is given by + bins[N] <= range_N < infinity. Values less than bins[0] are + not included in the histogram. - Caveat: - This should probably have an axis argument that would histogram - along a specific axis (kinda like matlab) + Parameters + ---------- + a : array_like of rank 1 + The array of values to be assigned into bins + bins : array_like of rank 1 + Defines the ranges of values to use during histogramming. + Returns + ------- + histogram2 : ndarray of rank 1 + Each value represents the occurrences for a given bin (range) of + values. + """ + # comment: probably obsoleted by numpy.histogram() n = np.searchsorted(np.sort(a), bins) n = np.concatenate([ n, [len(a)]]) return n[ 1:]-n[:-1] @@ -1558,12 +1596,30 @@ def relfreq(a, numbins=10, defaultreallimits=None, weights=None): """ -Returns a relative frequency histogram, using the histogram function. -Defaultreallimits can be None (use all data), or a 2-sequence containing -lower and upper limits on values to include. + Returns a relative frequency histogram, using the histogram function. -Returns: array of cumfreq bin values, lowerreallimit, binsize, extrapoints -""" + Parameters + ---------- + a : ndarray + Input array. + numbins : int, optional + Number of bins. + defaultreallimits : 2-sequence or None, optional + None (use all data), or a 2-sequence containing lower and upper limits + on values to include. + + Returns + ------- + relfreq : ndarray + Binned values of relative frequency. + lowerreallimit : float + Lower real limit + binsize : float + Width of each bin. + extrapoints : int + Extra points. + + """ h,l,b,e = histogram(a,numbins,defaultreallimits, weights=weights) h = array(h/float(a.shape[0])) return h,l,b,e @@ -3718,13 +3774,28 @@ def f_value_multivariate(ER, EF, dfnum, dfden): - """Returns an F-statistic given the following: - ER = error associated with the null hypothesis (the Restricted model) - EF = error associated with the alternate hypothesis (the Full model) - dfR = degrees of freedom the Restricted model - dfF = degrees of freedom associated with the Restricted model - where ER and EF are matrices from a multivariate F calculation. """ + Returns a multivariate F-statistic. + + Parameters + ---------- + ER : ndarray + Error associated with the null hypothesis (the Restricted model). + From a multivariate F calculation. + EF : ndarray + Error associated with the alternate hypothesis (the Full model) + From a multivariate F calculation. + dfnum : int + Degrees of freedom the Restricted model. + dfden : int + Degrees of freedom associated with the Restricted model. + + Returns + ------- + fstat : float + The computed F-statistic. + + """ if isinstance(ER, (int, float)): ER = array([[ER]]) if isinstance(EF, (int, float)): @@ -3817,19 +3888,21 @@ def fastsort(a): - # fixme: the wording in the docstring is nonsense. - """Sort an array and provide the argsort. + """ + Sort an array and provide the argsort. Parameters ---------- - a : array + a : array_like + Input array. Returns ------- - (sorted array, - indices into the original array, - ) + fastsort : ndarray of type int + sorted indices into the original array + """ + # TODO: the wording in the docstring is nonsense. it = np.argsort(a) as_ = a[it] return as_, it From scipy-svn at scipy.org Sun Nov 28 08:36:17 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:36:17 -0600 (CST) Subject: [Scipy-svn] r6960 - in trunk/scipy/stats: . tests Message-ID: <20101128133617.EDD9E37D3B4@scipy.org> Author: rgommers Date: 2010-11-28 07:36:17 -0600 (Sun, 28 Nov 2010) New Revision: 6960 Modified: trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: TST: add tests for stats.relfreq/cumfreq. Also improve docs and clean up code. Clean up includes having relfreq accept array_like input, this closes #1227. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:35:38 UTC (rev 6959) +++ trunk/scipy/stats/stats.py 2010-11-28 13:36:17 UTC (rev 6960) @@ -1506,32 +1506,32 @@ Parameters ---------- - a: array like + a: array_like Array of scores which will be put into bins. - numbins: integer, optional + numbins: int, optional The number of bins to use for the histogram. Default is 10. defaultlimits: tuple (lower, upper), optional The lower and upper values for the range of the histogram. If no value is given, a range slightly larger then the range of the - values in a is used. Specifically (a.min() - s, a.max() + s), - where s is (1/2)(a.max() - a.min()) / (numbins - 1) - weights: array like, same length as a, optional - The weights for each value in a. Default is None, which gives each + values in a is used. Specifically ``(a.min() - s, a.max() + s)``, + where ``s = (1/2)(a.max() - a.min()) / (numbins - 1)``. + weights: array_like, optional + The weights for each value in `a`. Default is None, which gives each value a weight of 1.0 - printextras: boolean, optional + printextras: bool, optional If True, the number of extra points is printed to standard output. - Default is False + Default is False. Returns ------- - histogram: array - Number of points (or sum of weights) in each bin + histogram: ndarray + Number of points (or sum of weights) in each bin. low_range: float Lowest value of histogram, the lower limit of the first bin. binsize: float The size of the bins (all bins have the same size). - extrapoints: integer - The number of points outside the range of the histogram + extrapoints: int + The number of points outside the range of the histogram. See Also -------- @@ -1558,8 +1558,8 @@ extrapoints = len([v for v in a if defaultlimits[0] > v or v > defaultlimits[1]]) if extrapoints > 0 and printextras: - # fixme: warnings.warn() - print '\nPoints outside given histogram range =',extrapoints + warnings.warn("Points outside given histogram range = %s" \ + %extrapoints) return (hist, defaultlimits[0], binsize, extrapoints) @@ -1571,11 +1571,16 @@ ---------- a : array_like Input array. - numbins : int, optional - Number of bins. - defaultreallimits : 2-sequence or None, optional - None (use all data), or a 2-sequence containing lower and upper limits - on values to include. + numbins: int, optional + The number of bins to use for the histogram. Default is 10. + defaultlimits: tuple (lower, upper), optional + The lower and upper values for the range of the histogram. + If no value is given, a range slightly larger then the range of the + values in a is used. Specifically ``(a.min() - s, a.max() + s)``, + where ``s = (1/2)(a.max() - a.min()) / (numbins - 1)``. + weights: array_like, optional + The weights for each value in `a`. Default is None, which gives each + value a weight of 1.0 Returns ------- @@ -1588,6 +1593,19 @@ extrapoints : int Extra points. + Examples + -------- + >>> x = [1, 4, 2, 1, 3, 1] + >>> cumfreqs, lowlim, binsize, extrapoints = sp.stats.cumfreq(x, numbins=4) + >>> cumfreqs + array([ 3., 4., 5., 6.]) + >>> cumfreqs, lowlim, binsize, extrapoints = \ + ... sp.stats.cumfreq(x, numbins=4, defaultreallimits=(1.5, 5)) + >>> cumfreqs + array([ 1., 2., 3., 3.]) + >>> extrapoints + 3 + """ h,l,b,e = histogram(a, numbins, defaultreallimits, weights=weights) cumhist = np.cumsum(h*1, axis=0) @@ -1600,13 +1618,18 @@ Parameters ---------- - a : ndarray + a : array_like Input array. - numbins : int, optional - Number of bins. - defaultreallimits : 2-sequence or None, optional - None (use all data), or a 2-sequence containing lower and upper limits - on values to include. + numbins: int, optional + The number of bins to use for the histogram. Default is 10. + defaultlimits: tuple (lower, upper), optional + The lower and upper values for the range of the histogram. + If no value is given, a range slightly larger then the range of the + values in a is used. Specifically ``(a.min() - s, a.max() + s)``, + where ``s = (1/2)(a.max() - a.min()) / (numbins - 1)``. + weights: array_like, optional + The weights for each value in `a`. Default is None, which gives each + value a weight of 1.0 Returns ------- @@ -1619,10 +1642,19 @@ extrapoints : int Extra points. + Examples + -------- + >>> a = np.array([1, 4, 2, 1, 3, 1]) + >>> relfreqs, lowlim, binsize, extrapoints = sp.stats.relfreq(a, numbins=4) + >>> relfreqs + array([ 0.5 , 0.16666667, 0.16666667, 0.16666667]) + >>> np.sum(relfreqs) # relative frequencies should add up to 1 + 0.99999999999999989 + """ - h,l,b,e = histogram(a,numbins,defaultreallimits, weights=weights) - h = array(h/float(a.shape[0])) - return h,l,b,e + h, l, b, e = histogram(a, numbins, defaultreallimits, weights=weights) + h = np.array(h / float(np.array(a).shape[0])) + return h, l, b, e ##################################### Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:35:38 UTC (rev 6959) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:36:17 UTC (rev 6960) @@ -804,6 +804,25 @@ decimal=2) +def test_cumfreq(): + x = [1, 4, 2, 1, 3, 1] + cumfreqs, lowlim, binsize, extrapoints = stats.cumfreq(x, numbins=4) + assert_array_almost_equal(cumfreqs, np.array([ 3., 4., 5., 6.])) + cumfreqs, lowlim, binsize, extrapoints = stats.cumfreq(x, numbins=4, + defaultreallimits=(1.5, 5)) + assert_(extrapoints==3) + + +def test_relfreq(): + a = np.array([1, 4, 2, 1, 3, 1]) + relfreqs, lowlim, binsize, extrapoints = stats.relfreq(a, numbins=4) + assert_array_almost_equal(relfreqs, array([0.5, 0.16666667, 0.16666667, 0.16666667])) + + # check array_like input is accepted + relfreqs2, lowlim, binsize, extrapoints = stats.relfreq([1, 4, 2, 1, 3, 1], numbins=4) + assert_array_almost_equal(relfreqs, relfreqs2) + + # Utility def compare_results(res,desired): From scipy-svn at scipy.org Sun Nov 28 08:36:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:36:47 -0600 (CST) Subject: [Scipy-svn] r6961 - trunk/scipy/stats Message-ID: <20101128133647.B7AC637D3B7@scipy.org> Author: rgommers Date: 2010-11-28 07:36:47 -0600 (Sun, 28 Nov 2010) New Revision: 6961 Modified: trunk/scipy/stats/_support.py Log: Clean up upused functions in stats._support. Closes #1219. Modified: trunk/scipy/stats/_support.py =================================================================== --- trunk/scipy/stats/_support.py 2010-11-28 13:36:17 UTC (rev 6960) +++ trunk/scipy/stats/_support.py 2010-11-28 13:36:47 UTC (rev 6961) @@ -89,47 +89,6 @@ cols = np.take(a,indices,axis) return cols -def printcc(lst, extra=2): - """\nPrints a list of lists in columns, customized by the max size of items -within the columns (max size of items in col, plus 'extra' number of spaces). -Use 'dashes' or '\n' in the list(oflists) to print dashes or blank lines, -respectively. - -Format: printcc (lst,extra=2) -Returns: None\n""" - - def makestr (x): - if type(x) != StringType: - x = str(x) - return x - - if type(lst[0]) not in [ListType,TupleType]: - lst = [lst] - rowstokill = [] - list2print = copy.deepcopy(lst) - for i in range(len(lst)): - if lst[i] == ['\n'] or lst[i]=='\n' or lst[i]=='dashes': - rowstokill = rowstokill + [i] - rowstokill.reverse() # delete blank rows from the end - for row in rowstokill: - del list2print[row] - maxsize = [0]*len(list2print[0]) - for col in range(len(list2print[0])): - items = colex(list2print,col) - items = map(makestr,items) - maxsize[col] = max(map(len,items)) + extra - for row in lst: - if row == ['\n'] or row == '\n': - print - elif row == ['dashes'] or row == 'dashes': - dashes = [0]*len(maxsize) - for j in range(len(maxsize)): - dashes[j] = '-'*(maxsize[j]-2) - print lineincustcols(dashes,maxsize) - else: - print lineincustcols(row,maxsize) - return None - def adm(a, criterion): """\nReturns rows from the passed list of lists that meet the criteria in the passed criterion expression (a string). @@ -274,42 +233,3 @@ a, axis = _chk_asarray(a, axis) return np.std(a,axis,ddof=1) / float(np.sqrt(a.shape[axis])) -def makestr(item): - if type(item) != StringType: - item = str(item) - return item - -def lineincustcols(inlist, colsizes): - """\nReturns a string composed of elements in inlist, with each element -right-aligned in a column of width specified by a sequence colsizes. The -length of colsizes must be greater than or equal to the number of columns in -inlist. - -Format: lineincustcols (inlist,colsizes) -Returns: formatted string created from inlist\n""" - - outstr = '' - for i in range(len(inlist)): - if type(inlist[i]) != StringType: - item = str(inlist[i]) - else: - item = inlist[i] - size = len(item) - if size <= colsizes[i]: - for j in range(colsizes[i]-size): - outstr = outstr + ' ' - outstr = outstr + item - else: - outstr = outstr + item[0:colsizes[i]+1] - return outstr - - -def list2string(inlist): - """\nConverts a 1D list to a single long string for file output, using -the string.join function. - -Format: list2string (inlist) -Returns: the string created from inlist\n""" - - stringlist = map(makestr,inlist) - return "".join(stringlist) From scipy-svn at scipy.org Sun Nov 28 08:37:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:37:08 -0600 (CST) Subject: [Scipy-svn] r6962 - in trunk/scipy/stats: . tests Message-ID: <20101128133708.5A15337D3B8@scipy.org> Author: rgommers Date: 2010-11-28 07:37:08 -0600 (Sun, 28 Nov 2010) New Revision: 6962 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: BUG: fix std() method of distributions for array_like args. Closes #1191. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-28 13:36:47 UTC (rev 6961) +++ trunk/scipy/stats/distributions.py 2010-11-28 13:37:08 UTC (rev 6962) @@ -688,7 +688,7 @@ """ kwds['moments'] = 'v' - res = math.sqrt(self.stats(*args, **kwds)) + res = sqrt(self.stats(*args, **kwds)) return res def interval(self, alpha, *args, **kwds): Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2010-11-28 13:36:47 UTC (rev 6961) +++ trunk/scipy/stats/tests/test_distributions.py 2010-11-28 13:37:08 UTC (rev 6962) @@ -242,6 +242,10 @@ assert_(isinstance(val, numpy.ndarray)) assert_(val.dtype.char in typecodes['AllInteger']) +def test_rvgeneric_std(): + """Regression test for #1191""" + assert_array_almost_equal(stats.t.std([5, 6]), [1.29099445, 1.22474487]) + class TestRvDiscrete(TestCase): def test_rvs(self): states = [-1,0,1,2,3,4] @@ -260,7 +264,7 @@ class TestExpon(TestCase): def test_zero(self): assert_equal(stats.expon.pdf(0),1) - + def test_tail(self): # Regression test for ticket 807 assert_equal(stats.expon.cdf(1e-18), 1e-18) assert_equal(stats.expon.isf(stats.expon.sf(40)), 40) @@ -277,7 +281,7 @@ # CDF should always be positive cdf = stats.genexpon.cdf(numpy.arange(0, 10, 0.01), 0.5, 0.5, 2.0) assert_(numpy.all((0 <= cdf) & (cdf <= 1))) - + class TestExponpow(TestCase): def test_tail(self): assert_almost_equal(stats.exponpow.cdf(1e-10, 2.), 1e-20) @@ -303,9 +307,9 @@ 4.3268692953013159e-002, 3.0248159818374226e-002, 1.9991434305603021e-002, 1.2516877303301180e-002, 7.4389876226229707e-003]) - + assert_almost_equal(stats.skellam.pmf(k, mu1, mu2), skpmfR, decimal=15) - + def test_cdf(self): #comparison to R, only 5 decimals k = numpy.arange(-10, 15) @@ -407,7 +411,7 @@ else: assert_(len(vals) == 2+len(args)) assert_(len(vals2)==2+len(args)) - + @dec.slow def test_fix_fit(self): for func, dist, args, alpha in test_all_distributions(): @@ -425,15 +429,15 @@ assert_(len(vals2) == 2+len(args)) if len(args) > 0: vals3 = distfunc.fit(res, f0=args[0]) - assert_(len(vals3) == 2+len(args)) + assert_(len(vals3) == 2+len(args)) assert_(vals3[0] == args[0]) if len(args) > 1: vals4 = distfunc.fit(res, f1=args[1]) - assert_(len(vals4) == 2+len(args)) + assert_(len(vals4) == 2+len(args)) assert_(vals4[1] == args[1]) if len(args) > 2: vals5 = distfunc.fit(res, f2=args[2]) - assert_(len(vals5) == 2+len(args)) + assert_(len(vals5) == 2+len(args)) assert_(vals5[2] == args[2]) class TestFrozen(TestCase): From scipy-svn at scipy.org Sun Nov 28 08:37:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:37:29 -0600 (CST) Subject: [Scipy-svn] r6963 - in trunk/scipy/stats: . tests Message-ID: <20101128133729.DB1EC37D3B9@scipy.org> Author: rgommers Date: 2010-11-28 07:37:29 -0600 (Sun, 28 Nov 2010) New Revision: 6963 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/info.py trunk/scipy/stats/tests/test_continuous_basic.py Log: DEP: deprecate stats.invnorm, add a copy as invgauss. See #1172. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-11-28 13:37:08 UTC (rev 6962) +++ trunk/scipy/stats/distributions.py 2010-11-28 13:37:29 UTC (rev 6963) @@ -6,6 +6,7 @@ # import math +import warnings from copy import copy from scipy.misc import comb, derivative @@ -57,10 +58,10 @@ 'weibull_max', 'genlogistic', 'genpareto', 'genexpon', 'genextreme', 'gamma', 'gengamma', 'genhalflogistic', 'gompertz', 'gumbel_r', 'gumbel_l', 'halfcauchy', 'halflogistic', 'halfnorm', 'hypsecant', - 'gausshyper', 'invgamma', 'invnorm', 'invweibull', 'johnsonsb', - 'johnsonsu', 'laplace', 'levy', 'levy_l', 'levy_stable', - 'logistic', 'loggamma', 'loglaplace', 'lognorm', 'gilbrat', - 'maxwell', 'mielke', 'nakagami', 'ncx2', 'ncf', 't', + 'gausshyper', 'invgamma', 'invnorm', 'invgauss', 'invweibull', + 'johnsonsb', 'johnsonsu', 'laplace', 'levy', 'levy_l', + 'levy_stable', 'logistic', 'loggamma', 'loglaplace', 'lognorm', + 'gilbrat', 'maxwell', 'mielke', 'nakagami', 'ncx2', 'ncf', 't', 'nct', 'pareto', 'lomax', 'powerlaw', 'powerlognorm', 'powernorm', 'rdist', 'rayleigh', 'reciprocal', 'rice', 'recipinvgauss', 'semicircular', 'triang', 'truncexpon', 'truncnorm', @@ -3247,30 +3248,67 @@ ## Inverse Normal Distribution # scale is gamma from DATAPLOT and B from Regress +_invnorm_msg = \ +"""The `invnorm` distribution will be renamed to `invgauss` after scipy 0.9""" class invnorm_gen(rv_continuous): def _rvs(self, mu): + warnings.warn(_invnorm_msg, DeprecationWarning) return mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): + warnings.warn(_invnorm_msg, DeprecationWarning) return 1.0/sqrt(2*pi*x**3.0)*exp(-1.0/(2*x)*((x-mu)/mu)**2) def _logpdf(self, x, mu): + warnings.warn(_invnorm_msg, DeprecationWarning) return -0.5*log(2*pi) - 1.5*log(x) - ((x-mu)/mu)**2/(2*x) def _cdf(self, x, mu): + warnings.warn(_invnorm_msg, DeprecationWarning) fac = sqrt(1.0/x) C1 = norm.cdf(fac*(x-mu)/mu) C1 += exp(2.0/mu)*norm.cdf(-fac*(x+mu)/mu) return C1 def _stats(self, mu): + warnings.warn(_invnorm_msg, DeprecationWarning) return mu, mu**3.0, 3*sqrt(mu), 15*mu invnorm = invnorm_gen(a=0.0, name='invnorm', longname="An inverse normal", shapes="mu",extradoc=""" Inverse normal distribution +NOTE: `invnorm` will be renamed to `invgauss` after scipy 0.9 + invnorm.pdf(x,mu) = 1/sqrt(2*pi*x**3) * exp(-(x-mu)**2/(2*x*mu**2)) for x > 0. """ ) +## Inverse Gaussian Distribution (used to be called 'invnorm' +# scale is gamma from DATAPLOT and B from Regress + +class invgauss_gen(rv_continuous): + def _rvs(self, mu): + return mtrand.wald(mu, 1.0, size=self._size) + def _pdf(self, x, mu): + return 1.0/sqrt(2*pi*x**3.0)*exp(-1.0/(2*x)*((x-mu)/mu)**2) + def _logpdf(self, x, mu): + return -0.5*log(2*pi) - 1.5*log(x) - ((x-mu)/mu)**2/(2*x) + def _cdf(self, x, mu): + fac = sqrt(1.0/x) + C1 = norm.cdf(fac*(x-mu)/mu) + C1 += exp(2.0/mu)*norm.cdf(-fac*(x+mu)/mu) + return C1 + def _stats(self, mu): + return mu, mu**3.0, 3*sqrt(mu), 15*mu +invgauss = invgauss_gen(a=0.0, name='invgauss', longname="An inverse Gaussian", + shapes="mu",extradoc=""" + +Inverse Gaussian distribution + +invgauss.pdf(x,mu) = 1/sqrt(2*pi*x**3) * exp(-(x-mu)**2/(2*x*mu**2)) +for x > 0. +""" + ) + + ## Inverted Weibull class invweibull_gen(rv_continuous): @@ -4136,7 +4174,7 @@ # FIXME: PPF does not work. class recipinvgauss_gen(rv_continuous): - def _rvs(self, mu): #added, taken from invnorm + def _rvs(self, mu): #added, taken from invgauss return 1.0/mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): return 1.0/sqrt(2*pi*x)*exp(-(1-mu*x)**2.0 / (2*x*mu**2.0)) @@ -4403,7 +4441,7 @@ ## Wald distribution (Inverse Normal with shape parameter mu=1.0) -class wald_gen(invnorm_gen): +class wald_gen(invgauss_gen): """A Wald continuous random variable. %(before_notes)s @@ -4418,11 +4456,11 @@ def _rvs(self): return mtrand.wald(1.0, 1.0, size=self._size) def _pdf(self, x): - return invnorm._pdf(x, 1.0) + return invgauss._pdf(x, 1.0) def _logpdf(self, x): - return invnorm._logpdf(x, 1.0) + return invgauss._logpdf(x, 1.0) def _cdf(self, x): - return invnorm._cdf(x, 1.0) + return invgauss._cdf(x, 1.0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 wald = wald_gen(a=0.0, name="wald", extradoc=""" Modified: trunk/scipy/stats/info.py =================================================================== --- trunk/scipy/stats/info.py 2010-11-28 13:37:08 UTC (rev 6962) +++ trunk/scipy/stats/info.py 2010-11-28 13:37:29 UTC (rev 6963) @@ -81,6 +81,7 @@ hypsecant Hyperbolic Secant invgamma Inverse Gamma invnorm Inverse Normal + invgauss Inverse Gaussian invweibull Inverse Weibull johnsonsb Johnson SB johnsonsu Johnson SU Modified: trunk/scipy/stats/tests/test_continuous_basic.py =================================================================== --- trunk/scipy/stats/tests/test_continuous_basic.py 2010-11-28 13:37:08 UTC (rev 6962) +++ trunk/scipy/stats/tests/test_continuous_basic.py 2010-11-28 13:37:29 UTC (rev 6963) @@ -1,3 +1,5 @@ +import warnings + import numpy.testing as npt import numpy as np import nose @@ -15,7 +17,7 @@ not for numerically exact results. -TODO: +TODO: * make functioning test for skew and kurtosis still known failures - skip for now @@ -70,6 +72,7 @@ ['hypsecant', ()], ['invgamma', (2.0668996136993067,)], ['invnorm', (0.14546264555347513,)], + ['invgauss', (0.14546264555347513,)], ['invweibull', (10.58,)], # sample mean test fails at(0.58847112119264788,)] ['johnsonsb', (4.3172675099141058, 3.1837781130785063)], ['johnsonsu', (2.554395574161155, 2.2482281679651965)], @@ -144,7 +147,7 @@ 'loglaplace', 'rdist', 'semicircular', 'invweibull', 'ksone', 'cosine', 'kstwobign', 'truncnorm', 'mielke', 'recipinvgauss', 'levy', 'johnsonsu', 'levy_l', 'powernorm', 'wrapcauchy', - 'johnsonsb', 'truncexpon', 'rice', 'invnorm', 'invgamma', + 'johnsonsb', 'truncexpon', 'rice', 'invnorm', 'invgauss', 'invgamma', 'powerlognorm'] distmiss = [[dist,args] for dist,args in distcont if dist in distmissing] @@ -166,7 +169,7 @@ skurt = stats.kurtosis(rvs) sskew = stats.skew(rvs) m,v = distfn.stats(*arg) - + yield check_sample_meanvar_, distfn, arg, m, v, sm, sv, sn, distname + \ 'sample mean test' # the sample skew kurtosis test has known failures, not very good distance measure @@ -219,14 +222,14 @@ if not np.isinf(m): npt.assert_almost_equal(m1, m, decimal=10, err_msg= msg + \ ' - 1st moment') - else: # or np.isnan(m1), - npt.assert_(np.isinf(m1), + else: # or np.isnan(m1), + npt.assert_(np.isinf(m1), msg + ' - 1st moment -infinite, m1=%s' % str(m1)) #np.isnan(m1) temporary special treatment for loggamma if not np.isinf(v): npt.assert_almost_equal(m2-m1*m1, v, decimal=10, err_msg= msg + \ ' - 2ndt moment') - else: #or np.isnan(m2), + else: #or np.isnan(m2), npt.assert_(np.isinf(m2), msg + ' - 2nd moment -infinite, m2=%s' % str(m2)) #np.isnan(m2) temporary special treatment for loggamma @@ -356,6 +359,10 @@ npt.assert_(pval > alpha, "D = " + str(D) + "; pval = " + str(pval) + "; alpha = " + str(alpha) + "\nargs = " + str(args)) + +warnings.filterwarnings('ignore', message="The `invnorm` distribution") + + if __name__ == "__main__": #nose.run(argv=['', __file__]) nose.runmodule(argv=[__file__,'-s'], exit=False) From scipy-svn at scipy.org Sun Nov 28 08:37:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:37:52 -0600 (CST) Subject: [Scipy-svn] r6964 - in trunk/scipy/stats: . tests Message-ID: <20101128133752.CB85437D3BA@scipy.org> Author: rgommers Date: 2010-11-28 07:37:52 -0600 (Sun, 28 Nov 2010) New Revision: 6964 Modified: trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_stats.py Log: DEP: remove z and zs from the stats module. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-28 13:37:29 UTC (rev 6963) +++ trunk/scipy/stats/mstats_basic.py 2010-11-28 13:37:52 UTC (rev 6964) @@ -1943,14 +1943,15 @@ a = ma.asarray(a) z = (score-a.mean(None)) / a.std(axis=None, ddof=1) return z -z.__doc__ = stats.z.__doc__ +# where do we get the doc from? stats.z has been removed +# z.__doc__ = stats.zscore_compare.__doc__ def zs(a): a = ma.asarray(a) mu = a.mean(axis=0) sigma = a.std(axis=0,ddof=0) return (a-mu)/sigma -zs.__doc__ = stats.zs.__doc__ +zs.__doc__ = stats.zscore.__doc__ def zmap(scores, compare, axis=0): (scores, compare) = (ma.asarray(scores), ma.asarray(compare)) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:37:29 UTC (rev 6963) +++ trunk/scipy/stats/stats.py 2010-11-28 13:37:52 UTC (rev 6964) @@ -72,8 +72,6 @@ signaltonoise (for arrays only) stderr sem - z - zs TRIMMING FCNS: threshold (for arrays only) trimboth @@ -214,7 +212,7 @@ 'itemfreq', 'scoreatpercentile', 'percentileofscore', 'histogram', 'histogram2', 'cumfreq', 'relfreq', 'obrientransform', 'samplevar', 'samplestd', 'signaltonoise', - 'stderr', 'sem', 'z', 'zs', 'zmap', 'zscore', + 'stderr', 'sem', 'zmap', 'zscore', 'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean', 'f_oneway', 'pearsonr', 'fisher_exact', 'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress', @@ -1821,35 +1819,7 @@ s = np.std(a,axis=axis, ddof=ddof) / np.sqrt(n) #JP check normalization return s - at np.lib.deprecate(message=""" -scipy.stats.z is deprecated; please update your code to use -scipy.stats.zscore_compare. -""") -def z(a, score): - """ -Returns the z-score of a given input score, given thearray from which -that score came. Not appropriate for population calculations, nor for -arrays > 1D. -""" - z = (score-np.mean(a,None)) / samplestd(a) - return z - - at np.lib.deprecate(message=""" -scipy.stats.zs is deprecated; please update your code to use -scipy.stats.zscore. -""") -def zs(a): - """ -Returns a 1D array of z-scores, one for each score in the passed array, -computed relative to the passed array. - -""" - mu = np.mean(a,None) - sigma = samplestd(a) - return (array(a)-mu)/sigma - - def zscore(a, axis=0, ddof=0): """ Calculates the z score of each value in the sample, relative to the sample @@ -1913,7 +1883,6 @@ return (a - mns) / sstd - def zmap(scores, compare, axis=0, ddof=0): """ Calculates the relative z-scores. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:37:29 UTC (rev 6963) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:37:52 UTC (rev 6964) @@ -1006,28 +1006,10 @@ y = stats.sem(self.testcase) assert_approx_equal(y,0.6454972244) - def test_z(self): - """ - not in R, so used - (10-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) - """ - y = stats.z(self.testcase,np.mean(self.testcase, axis=0)) - assert_almost_equal(y,0.0) - - def test_zs(self): - """ - not in R, so tested by using - (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) - """ - y = stats.zs(self.testcase) - desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999]) - assert_array_almost_equal(desired,y,decimal=12) - def test_zmap(self): """ not in R, so tested by using (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) - copied from test_zs """ y = stats.zmap(self.testcase,self.testcase) desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999]) @@ -1037,7 +1019,6 @@ """ not in R, so tested by using (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) - copied from test_zs as regression test for new function """ y = stats.zscore(self.testcase) desired = ([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999]) From scipy-svn at scipy.org Sun Nov 28 08:38:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:38:21 -0600 (CST) Subject: [Scipy-svn] r6965 - in trunk: doc/release scipy/stats scipy/stats/tests Message-ID: <20101128133821.DAD1A37D3BC@scipy.org> Author: rgommers Date: 2010-11-28 07:38:21 -0600 (Sun, 28 Nov 2010) New Revision: 6965 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/stats.py trunk/scipy/stats/tests/test_mstats_basic.py trunk/scipy/stats/tests/test_stats.py Log: DEP: remove deprecated functions from stats module. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:37:52 UTC (rev 6964) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:38:21 UTC (rev 6965) @@ -137,6 +137,11 @@ The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has been deprecated since version 0.7, was removed. -Several functions in ``scipy.stats`` that are available from numpy and have -been deprecated since version 0.7 have been removed: ``std``, ``var``, -``mean``, ``median``, ``cov`` and ``corrcoef``. + +``scipy.stats`` +--------------- + +Many functions in ``scipy.stats`` that are either available from numpy or have +been superseded, and have been deprecated since version 0.7, have been removed: +`std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`, +`samplestd`, `samplevar` and `erfc`. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-28 13:37:52 UTC (rev 6964) +++ trunk/scipy/stats/mstats_basic.py 2010-11-28 13:38:21 UTC (rev 6965) @@ -29,7 +29,6 @@ 'rankdata', 'samplestd','samplevar','scoreatpercentile','sem','std', 'sen_seasonal_slopes','signaltonoise','skew','skewtest','spearmanr', - 'stderr', 'theilslopes','threshold','tmax','tmean','tmin','trim','trimboth', 'trimtail','trima','trimr','trimmed_mean','trimmed_std', 'trimmed_stde','trimmed_var','tsem','ttest_1samp','ttest_onesamp', @@ -1927,11 +1926,6 @@ return ma.asarray(a).std(axis=axis,ddof=1) std.__doc__ = np.std.__doc__ -def stderr(a, axis=0): - a, axis = _chk_asarray(a, axis) - return a.std(axis=axis, ddof=1) / ma.sqrt(a.count(axis=axis)) -stderr.__doc__ = stats.stderr.__doc__ - def sem(a, axis=0): a, axis = _chk_asarray(a, axis) n = a.count(axis=axis) Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-11-28 13:37:52 UTC (rev 6964) +++ trunk/scipy/stats/stats.py 2010-11-28 13:38:21 UTC (rev 6965) @@ -67,10 +67,7 @@ relfreq VARIABILITY: obrientransform - samplevar - samplestd signaltonoise (for arrays only) - stderr sem TRIMMING FCNS: threshold (for arrays only) @@ -98,7 +95,6 @@ friedmanchisquare PROBABILITY CALCS: chisqprob - erfcc zprob fprob betai @@ -211,15 +207,14 @@ 'skewtest', 'kurtosistest', 'normaltest', 'itemfreq', 'scoreatpercentile', 'percentileofscore', 'histogram', 'histogram2', 'cumfreq', 'relfreq', - 'obrientransform', 'samplevar', 'samplestd', 'signaltonoise', - 'stderr', 'sem', 'zmap', 'zscore', + 'obrientransform', 'signaltonoise', 'sem', 'zmap', 'zscore', 'threshold', 'sigmaclip', 'trimboth', 'trim1', 'trim_mean', 'f_oneway', 'pearsonr', 'fisher_exact', 'spearmanr', 'pointbiserialr', 'kendalltau', 'linregress', 'ttest_1samp', 'ttest_ind', 'ttest_rel', 'kstest', 'chisquare', 'ks_2samp', 'mannwhitneyu', 'tiecorrect', 'ranksums', 'kruskal', 'friedmanchisquare', - 'zprob', 'erfc', 'chisqprob', 'ksprob', 'fprob', 'betai', + 'zprob', 'chisqprob', 'ksprob', 'fprob', 'betai', 'glm', 'f_value_wilks_lambda', 'f_value', 'f_value_multivariate', 'ss', 'square_of_sums', @@ -1696,39 +1691,6 @@ return array(nargs) - at np.lib.deprecate(message=""" -scipy.stats.samplevar is deprecated; please update your code to use -numpy.var. - -Please note that `numpy.var` axis argument defaults to None, not 0. -""") -def samplevar(a, axis=0): - """ - Returns the sample standard deviation of the values in the passed - array (i.e., using N). Axis can equal None (ravel array first), - an integer (the axis over which to operate) - """ - a, axis = _chk_asarray(a, axis) - mn = np.expand_dims(np.mean(a, axis), axis) - deviations = a - mn - n = a.shape[axis] - svar = ss(deviations,axis) / float(n) - return svar - - at np.lib.deprecate(message=""" -scipy.stats.samplestd is deprecated; please update your code to use -numpy.std. - -Please note that `numpy.std` axis argument defaults to None, not 0. -""") -def samplestd(a, axis=0): - """Returns the sample standard deviation of the values in the passed -array (i.e., using N). Axis can equal None (ravel array first), -an integer (the axis over which to operate). -""" - return np.sqrt(samplevar(a,axis)) - - def signaltonoise(a, axis=0, ddof=0): """ Calculates the signal-to-noise ratio, defined as the ratio between the mean @@ -1757,19 +1719,6 @@ return np.where(sd == 0, 0, m/sd) - at np.lib.deprecate(message=""" -scipy.stats.stderr is deprecated; please update your code to use -scipy.stats.sem. -""") -def stderr(a, axis=0, ddof=1): - """ -Returns the estimated population standard error of the values in the -passed array (i.e., N-1). Axis can equal None (ravel array -first), or an integer (the axis over which to operate). -""" - a, axis = _chk_asarray(a, axis) - return np.std(a,axis,ddof=1) / float(np.sqrt(a.shape[axis])) - def sem(a, axis=0, ddof=1): """ Calculates the standard error of the mean (or standard error of @@ -1815,7 +1764,6 @@ """ a, axis = _chk_asarray(a, axis) n = a.shape[axis] - #s = samplestd(a,axis) / np.sqrt(n-1) s = np.std(a,axis=axis, ddof=ddof) / np.sqrt(n) #JP check normalization return s @@ -3633,8 +3581,6 @@ ##################################### zprob = special.ndtr -erfc = np.lib.deprecate(special.erfc, old_name="scipy.stats.erfc", - new_name="scipy.special.erfc") def chisqprob(chisq, df): """ Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 13:37:52 UTC (rev 6964) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-28 13:38:21 UTC (rev 6965) @@ -441,16 +441,6 @@ y = mstats.signaltonoise(self.testcase) assert_almost_equal(y,2.236067977) - def test_stderr(self): - """ - this is not in R, so used - sqrt(var(testcase))/sqrt(4) - """ -## y = stats.stderr(self.shoes[0]) -## assert_approx_equal(y,0.775177399) - y = mstats.stderr(self.testcase) - assert_almost_equal(y,0.6454972244) - def test_sem(self): """ this is not in R, so used Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:37:52 UTC (rev 6964) +++ trunk/scipy/stats/tests/test_stats.py 2010-11-28 13:38:21 UTC (rev 6965) @@ -962,22 +962,6 @@ """ testcase = [1,2,3,4] - def test_samplevar(self): - """ - R does not have 'samplevar' so the following was used - var(testcase)*(4-1)/4 where 4 = length(testcase) - """ - #y = stats.samplevar(self.shoes[0]) - #assert_approx_equal(y,5.4081) - y = stats.samplevar(self.testcase) - assert_approx_equal(y,1.25) - - def test_samplestd(self): - #y = stats.samplestd(self.shoes[0]) - #assert_approx_equal(y,2.325532197) - y = stats.samplestd(self.testcase) - assert_approx_equal(y,1.118033989) - def test_signaltonoise(self): """ this is not in R, so used @@ -987,15 +971,6 @@ y = stats.signaltonoise(self.testcase) assert_approx_equal(y,2.236067977) - def test_stderr(self): - """ - this is not in R, so used - sqrt(var(testcase))/sqrt(4) - """ -## y = stats.stderr(self.shoes[0]) -## assert_approx_equal(y,0.775177399) - y = stats.stderr(self.testcase) - assert_approx_equal(y,0.6454972244) def test_sem(self): """ this is not in R, so used From scipy-svn at scipy.org Sun Nov 28 08:38:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 07:38:47 -0600 (CST) Subject: [Scipy-svn] r6966 - in trunk: doc/release scipy/stats Message-ID: <20101128133847.3C41C37D3BD@scipy.org> Author: rgommers Date: 2010-11-28 07:38:47 -0600 (Sun, 28 Nov 2010) New Revision: 6966 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/stats/morestats.py Log: DEP: remove deprecated functions from stats.morestats Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:38:21 UTC (rev 6965) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-28 13:38:47 UTC (rev 6966) @@ -144,4 +144,4 @@ Many functions in ``scipy.stats`` that are either available from numpy or have been superseded, and have been deprecated since version 0.7, have been removed: `std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`, -`samplestd`, `samplevar` and `erfc`. +`samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-11-28 13:38:21 UTC (rev 6965) +++ trunk/scipy/stats/morestats.py 2010-11-28 13:38:47 UTC (rev 6966) @@ -26,8 +26,7 @@ 'boxcox_llf', 'boxcox', 'boxcox_normmax', 'boxcox_normplot', 'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_test', 'fligner', 'mood', 'oneway', 'wilcoxon', - 'pdf_moments', 'pdf_fromgamma', 'pdfapprox', - 'circmean', 'circvar', 'circstd', + 'pdf_fromgamma', 'circmean', 'circvar', 'circstd', ] @@ -1287,42 +1286,6 @@ plist[n] = plist[n-1].deriv() - poly1d([1,0])*plist[n-1] return plist - at np.lib.deprecate(message=""" -scipy.stats.pdf_moments is broken. It will be removed from scipy in 0.9 -unless it is fixed. -""") -def pdf_moments(cnt): - """Return the Gaussian expanded pdf function given the list of central - moments (first one is mean). - """ - N = len(cnt) - if N < 2: - raise ValueError("At least two moments must be given to " + - "approximate the pdf.") - totp = poly1d(1) - sig = sqrt(cnt[1]) - mu = cnt[0] - if N > 2: - Dvals = _hermnorm(N+1) - for k in range(3,N+1): - # Find Ck - Ck = 0.0 - for n in range((k-3)/2): - m = k-2*n - if m % 2: # m is odd - momdiff = cnt[m-1] - else: - momdiff = cnt[m-1] - sig*sig*scipy.factorial2(m-1) - Ck += Dvals[k][m] / sig**m * momdiff - # Add to totp - totp = totp + Ck*Dvals[k] - - def thisfunc(x): - xn = (x-mu)/sig - return totp(xn)*exp(-xn*xn/2.0)/sqrt(2*pi)/sig - return thisfunc - - def pdf_fromgamma(g1,g2,g3=0.0,g4=None): if g4 is None: g4 = 3*g2*g2 @@ -1346,30 +1309,6 @@ return totp(xn)*exp(-xn*xn/2.0) return thefunc - at np.lib.deprecate(message=""" -scipy.stats.pdfapprox is broken. It will be removed from scipy in 0.9 -unless it is fixed. -""") -def pdfapprox(samples): - """Return a function that approximates the pdf of a set of samples - using a Gaussian expansion computed from the mean, variance, skewness - and Fisher's kurtosis. - """ - # Estimate mean, variance, skewness and kurtosis - mu,sig,sk,kur = stats.describe(samples)[2:] - # Get central moments - cnt = [None]*4 - cnt[0] = mu - cnt[1] = sig*sig - cnt[2] = sk * sig**1.5 - cnt[3] = (kur+3.0) * sig**2.0 - return pdf_moments(cnt) - #g2 = (1.0/sig)**2.0 - #g1 = mu / sig**3.0 - #g3 = sk / sig**3.5 - #g4 = (kur+3.0) / sig**4.0 - #return pdf_fromgamma(g1, g2, g3, g4) - def circmean(samples, high=2*pi, low=0): """ Compute the circular mean for samples assumed to be in the range From scipy-svn at scipy.org Sun Nov 28 10:28:17 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 09:28:17 -0600 (CST) Subject: [Scipy-svn] r6967 - in trunk/scipy/sparse/linalg/dsolve/SuperLU: . SRC Message-ID: <20101128152817.9E18F37D3AC@scipy.org> Author: ptvirtan Date: 2010-11-28 09:28:17 -0600 (Sun, 28 Nov 2010) New Revision: 6967 Modified: trunk/scipy/sparse/linalg/dsolve/SuperLU/SRC/dGetDiagU.c trunk/scipy/sparse/linalg/dsolve/SuperLU/scipychanges.txt Log: BUG: sparse/superlu: fix build on msvc (closes #1176) Modified: trunk/scipy/sparse/linalg/dsolve/SuperLU/SRC/dGetDiagU.c =================================================================== --- trunk/scipy/sparse/linalg/dsolve/SuperLU/SRC/dGetDiagU.c 2010-11-28 13:38:47 UTC (rev 6966) +++ trunk/scipy/sparse/linalg/dsolve/SuperLU/SRC/dGetDiagU.c 2010-11-28 15:28:17 UTC (rev 6967) @@ -29,7 +29,7 @@ * data structures. * */ -#include +#include "slu_ddefs.h" void dGetDiagU(SuperMatrix *L, double *diagU) { Modified: trunk/scipy/sparse/linalg/dsolve/SuperLU/scipychanges.txt =================================================================== --- trunk/scipy/sparse/linalg/dsolve/SuperLU/scipychanges.txt 2010-11-28 13:38:47 UTC (rev 6966) +++ trunk/scipy/sparse/linalg/dsolve/SuperLU/scipychanges.txt 2010-11-28 15:28:17 UTC (rev 6967) @@ -19,3 +19,5 @@ 4) BUG: sparse.linalg.dsolve/SuperLU: patch SuperLU sources to eliminate a crash for singular matrices for which pivoting fails 5) BUG: parse.linalg.dsolve/SuperLU: patch SuperLU sources to not exit(1) when ILU decomposition encounters singularity; instead, raise a Python exception + +6) BUG: sparse/superlu: fix build on msvc (closes #1176) From scipy-svn at scipy.org Sun Nov 28 10:44:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 09:44:33 -0600 (CST) Subject: [Scipy-svn] r6968 - in trunk/scipy/io/matlab: . tests Message-ID: <20101128154433.9ADEB32342@scipy.org> Author: ptvirtan Date: 2010-11-28 09:44:33 -0600 (Sun, 28 Nov 2010) New Revision: 6968 Modified: trunk/scipy/io/matlab/mio.py trunk/scipy/io/matlab/tests/test_mio.py Log: BUG: io/matlab: close opened stream after reading in loadmat() (fixes #1039) Modified: trunk/scipy/io/matlab/mio.py =================================================================== --- trunk/scipy/io/matlab/mio.py 2010-11-28 15:28:17 UTC (rev 6967) +++ trunk/scipy/io/matlab/mio.py 2010-11-28 15:44:33 UTC (rev 6968) @@ -154,6 +154,8 @@ mdict.update(matfile_dict) else: mdict = matfile_dict + if isinstance(file_name, basestring): + MR.mat_stream.close() return mdict @docfiller Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-11-28 15:28:17 UTC (rev 6967) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-11-28 15:44:33 UTC (rev 6968) @@ -5,6 +5,7 @@ ''' import sys +import os from os.path import join as pjoin, dirname from glob import glob if sys.version_info[0] >= 3: @@ -348,7 +349,35 @@ expected['x'].todense(), err_msg=repr(actual)) +def test_multiple_open(): + # Ticket #1039, on Windows: check that files are not left open + tmpdir = mkdtemp() + try: + x = dict(x=np.zeros((2, 2))) + fname = pjoin(tmpdir, "a.mat") + + # Check that file is not left open + savemat(fname, x) + os.unlink(fname) + savemat(fname, x) + + loadmat(fname) + os.unlink(fname) + + # Check that stream is left open + f = open(fname, 'wb') + savemat(f, x) + f.seek(0) + f.close() + + f = open(fname, 'rb') + loadmat(f) + f.seek(0) + f.close() + finally: + shutil.rmtree(tmpdir) + def test_mat73(): # Check any hdf5 files raise an error filenames = glob( From scipy-svn at scipy.org Sun Nov 28 12:46:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 11:46:31 -0600 (CST) Subject: [Scipy-svn] r6969 - in trunk/scipy/special: cephes tests Message-ID: <20101128174631.D718937A186@scipy.org> Author: ptvirtan Date: 2010-11-28 11:46:31 -0600 (Sun, 28 Nov 2010) New Revision: 6969 Modified: trunk/scipy/special/cephes/hyp2f1.c trunk/scipy/special/tests/test_mpmath.py trunk/scipy/special/tests/test_orthogonal_eval.py Log: BUG: special: fix mistaken divergence test in hyp2f1 for cases where the series terminates (fixes #1298) Modified: trunk/scipy/special/cephes/hyp2f1.c =================================================================== --- trunk/scipy/special/cephes/hyp2f1.c 2010-11-28 15:44:33 UTC (rev 6968) +++ trunk/scipy/special/cephes/hyp2f1.c 2010-11-28 17:46:31 UTC (rev 6969) @@ -137,7 +137,7 @@ if (d <= -1 && !(fabs(d-id) > EPS && s < 0) && !(neg_int_a || neg_int_b)) { return pow(s, d) * hyp2f1(c - a, c - b, c, x); } - if (d <= 0 && x == 1) + if (d <= 0 && x == 1 && !(neg_int_a || neg_int_b)) goto hypdiv; if (ax < 1.0 || x == -1.0) { Modified: trunk/scipy/special/tests/test_mpmath.py =================================================================== --- trunk/scipy/special/tests/test_mpmath.py 2010-11-28 15:44:33 UTC (rev 6968) +++ trunk/scipy/special/tests/test_mpmath.py 2010-11-28 17:46:31 UTC (rev 6969) @@ -83,6 +83,10 @@ (-8, 18.016500331508873, 10.805295997850628, 0.90875647507000001), (-10,900,-10.5,0.99), (-10,900,10.5,0.99), + (-1,2,1,1.0), + (-1,2,1,-1.0), + (-3,13,5,1.0), + (-3,13,5,-1.0), ] dataset = [p + (float(mpmath.hyp2f1(*p)),) for p in pts] dataset = np.array(dataset, dtype=np.float_) Modified: trunk/scipy/special/tests/test_orthogonal_eval.py =================================================================== --- trunk/scipy/special/tests/test_orthogonal_eval.py 2010-11-28 15:44:33 UTC (rev 6968) +++ trunk/scipy/special/tests/test_orthogonal_eval.py 2010-11-28 17:46:31 UTC (rev 6969) @@ -47,6 +47,8 @@ else: p = (n,) x = x_range[0] + (x_range[1] - x_range[0])*np.random.rand(nx) + x[0] = x_range[0] # always include domain start point + x[1] = x_range[1] # always include domain end point poly = np.poly1d(cls(*p)) z = np.c_[np.tile(p, (nx,1)), x, poly(x)] dataset.append(z) From scipy-svn at scipy.org Sun Nov 28 17:55:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 16:55:42 -0600 (CST) Subject: [Scipy-svn] r6970 - in trunk/scipy/special: . specfun tests Message-ID: <20101128225542.A8B9532342@scipy.org> Author: ptvirtan Date: 2010-11-28 16:55:42 -0600 (Sun, 28 Nov 2010) New Revision: 6970 Modified: trunk/scipy/special/cephes_doc.h trunk/scipy/special/specfun/specfun.f trunk/scipy/special/specfun_wrappers.c trunk/scipy/special/tests/test_basic.py trunk/scipy/special/tests/test_data.py trunk/scipy/special/tests/test_mpmath.py Log: ENH: special/lpmv: implement degree down-recursion in associated legendre polynomial (fixes #1296) Also implement support for negative orders and degrees, except in the cases V+M+1 <= 0, M < 0. Modified: trunk/scipy/special/cephes_doc.h =================================================================== --- trunk/scipy/special/cephes_doc.h 2010-11-28 17:46:31 UTC (rev 6969) +++ trunk/scipy/special/cephes_doc.h 2010-11-28 22:55:42 UTC (rev 6970) @@ -104,7 +104,7 @@ #define kv_doc "y=kv(v,z) returns the modified Bessel function of the second kind (sometimes called the third kind) for\nreal order v at complex z." #define kve_doc "y=kve(v,z) returns the exponentially scaled, modified Bessel function\nof the second kind (sometimes called the third kind) for real order v at complex z: kve(v,z) = kv(v,z) * exp(z)" #define log1p_doc "y=log1p(x) calculates log(1+x) for use when x is near zero." -#define lpmv_doc "y=lpmv(m,v,x) returns the associated legendre function of integer order\nm and nonnegative degree v: |x|<=1." +#define lpmv_doc "y=lpmv(m,v,x) returns the associated legendre function of integer order\nm and real degree v (s.t. v>-m-1 or v Author: ptvirtan Date: 2010-11-28 17:08:19 -0600 (Sun, 28 Nov 2010) New Revision: 6971 Modified: trunk/scipy/special/specfun/specfun.f trunk/scipy/special/tests/test_basic.py Log: BUG: special: fix < vs <= error in lpmv Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2010-11-28 22:55:42 UTC (rev 6970) +++ trunk/scipy/special/specfun/specfun.f 2010-11-28 23:08:19 UTC (rev 6971) @@ -7893,7 +7893,7 @@ VX=-VX-1 ENDIF NEG_M=0 - IF (M.LT.0.AND.(VX+M+1).GE.0D0) THEN + IF (M.LT.0.AND.(VX+M+1).GT.0D0) THEN C XXX: does not handle the cases where AMS 8.2.5 C does not help NEG_M=1 Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2010-11-28 22:55:42 UTC (rev 6970) +++ trunk/scipy/special/tests/test_basic.py 2010-11-28 23:08:19 UTC (rev 6971) @@ -1888,6 +1888,11 @@ lp = special.lpmv(0,40,.001) assert_almost_equal(lp,0.1252678976534484,7) + # XXX: this is outside the domain of the current implementation, + # so ensure it returns a NaN rather than a wrong answer. + lp = special.lpmv(-1,-1,.001) + assert_(lp != 0 or np.isnan(lp)) + def test_lqmn(self): lqmnf = special.lqmn(0,2,.5) lqmnf = special.lqmn(0,2,.5) From scipy-svn at scipy.org Sun Nov 28 18:26:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 17:26:29 -0600 (CST) Subject: [Scipy-svn] r6972 - trunk/scipy/interpolate Message-ID: <20101128232629.6D9153234B@scipy.org> Author: ptvirtan Date: 2010-11-28 17:26:29 -0600 (Sun, 28 Nov 2010) New Revision: 6972 Modified: trunk/scipy/interpolate/fitpack.py Log: BUG: interpolate: fix an implicit cast to integers in bisplrep causing a warning Modified: trunk/scipy/interpolate/fitpack.py =================================================================== --- trunk/scipy/interpolate/fitpack.py 2010-11-28 23:08:19 UTC (rev 6971) +++ trunk/scipy/interpolate/fitpack.py 2010-11-28 23:26:29 UTC (rev 6972) @@ -848,8 +848,8 @@ raise TypeError('Given degree of the spline (kx,ky=%d,%d) is not supported. (1<=k<=5)' % (kx,ky)) if m<(kx+1)*(ky+1): raise TypeError('m >= (kx+1)(ky+1) must hold') - if nxest is None: nxest=kx+sqrt(m/2) - if nyest is None: nyest=ky+sqrt(m/2) + if nxest is None: nxest=int(kx+sqrt(m/2)) + if nyest is None: nyest=int(ky+sqrt(m/2)) nxest,nyest=max(nxest,2*kx+3),max(nyest,2*ky+3) if task>=0 and s==0: nxest=int(kx+sqrt(3*m)) From scipy-svn at scipy.org Sun Nov 28 18:26:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 17:26:36 -0600 (CST) Subject: [Scipy-svn] r6973 - in trunk: doc/release doc/source scipy/signal scipy/signal/tests Message-ID: <20101128232636.C7FC73234E@scipy.org> Author: warren.weckesser Date: 2010-11-28 17:26:36 -0600 (Sun, 28 Nov 2010) New Revision: 6973 Modified: trunk/doc/release/0.9.0-notes.rst trunk/doc/source/signal.rst trunk/scipy/signal/fir_filter_design.py trunk/scipy/signal/info.py trunk/scipy/signal/tests/test_fir_filter_design.py Log: ENH: signal: added the function firwin2 for constructing FIR filters with arbitrary frequency response. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-28 23:26:29 UTC (rev 6972) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-28 23:26:36 UTC (rev 6973) @@ -114,6 +114,10 @@ The function ``scipy.signal.firwin`` was enhanced to allow the design of highpass, bandpass, bandstop and multi-band FIR filters. +The function ``scipy.signal.firwin2`` was added. This function +uses the window method to create a linear phase FIR filter with +an arbitrary frequency response. + The functions ``scipy.signal.kaiser_atten`` and ``scipy.signal.kaiser_beta`` were added. @@ -131,7 +135,7 @@ Removed features ================ -The deprecated modules ``helpdmod``, ``pexec`` and ``ppimport`` were removed +The deprecated modules ``helpmod``, ``pexec`` and ``ppimport`` were removed from ``scipy.misc``. The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has Modified: trunk/doc/source/signal.rst =================================================================== --- trunk/doc/source/signal.rst 2010-11-28 23:26:29 UTC (rev 6972) +++ trunk/doc/source/signal.rst 2010-11-28 23:26:36 UTC (rev 6973) @@ -64,6 +64,7 @@ bilinear firwin + firwin2 freqs freqz iirdesign Modified: trunk/scipy/signal/fir_filter_design.py =================================================================== --- trunk/scipy/signal/fir_filter_design.py 2010-11-28 23:26:29 UTC (rev 6972) +++ trunk/scipy/signal/fir_filter_design.py 2010-11-28 23:26:36 UTC (rev 6973) @@ -1,7 +1,8 @@ """Functions for FIR filter design.""" -import numpy -from numpy import pi, ceil, cos, asarray +from math import ceil, log +import numpy as np +from numpy.fft import irfft from scipy.special import sinc import sigtools @@ -47,7 +48,7 @@ return beta -def kaiser_atten(N, width): +def kaiser_atten(numtaps, width): """Compute the attenuation of a Kaiser FIR filter. Given the number of taps `N` and the transition width `width`, compute the @@ -72,7 +73,7 @@ -------- kaiserord, kaiser_beta """ - a = 2.285 * (N - 1) * pi * width + 7.95 + a = 2.285 * (numtaps - 1) * np.pi * width + 7.95 return a @@ -90,7 +91,7 @@ Returns ------- - N : int + numtaps : int The length of the kaiser window. beta : The beta parameter for the kaiser window. @@ -99,9 +100,9 @@ ----- There are several ways to obtain the Kaiser window: - signal.kaiser(N, beta, sym=0) - signal.get_window(beta, N) - signal.get_window(('kaiser', beta), N) + signal.kaiser(numtaps, beta, sym=0) + signal.get_window(beta, numtaps) + signal.get_window(('kaiser', beta), numtaps) The empirical equations discovered by Kaiser are used. @@ -123,28 +124,28 @@ # Kaiser's formula (as given in Oppenheim and Schafer) is for the filter # order, so we have to add 1 to get the number of taps. - N = (A - 7.95) / 2.285 / (pi * width) + 1 + numtaps = (A - 7.95) / 2.285 / (np.pi * width) + 1 - return int(ceil(N)), beta + return int(ceil(numtaps)), beta -def firwin(N, cutoff, width=None, window='hamming', pass_zero=True, scale=True): +def firwin(numtaps, cutoff, width=None, window='hamming', pass_zero=True, scale=True): """ FIR filter design using the window method. This function computes the coefficients of a finite impulse response filter. - The filter will have linear phase; it will be Type I if `N` is odd and - Type II if `N` is even. + The filter will have linear phase; it will be Type I if `numtaps` is odd and + Type II if `numtaps` is even. Type II filters always have zero response at the Nyquist rate, so a - ValueError exception is raised if firwin is called with `N` even and + ValueError exception is raised if firwin is called with `numtaps` even and having a passband whose right end is at the Nyquist rate. Parameters ---------- - N : int + numtaps : int Length of the filter (number of coefficients, i.e. the filter - order + 1). `N` must be even if a passband includes the Nyquist + order + 1). `numtaps` must be even if a passband includes the Nyquist frequency. cutoff : float or 1D array_like @@ -181,14 +182,14 @@ Returns ------- h : 1D ndarray - Coefficients of length N FIR filter. + Coefficients of length `numtaps` FIR filter. Raises ------ ValueError If any value in cutoff is less than or equal to 0 or greater than or equal to 1, if the values in cutoff are not strictly - monotonically increasing, or if `N` is even but a passband + monotonically increasing, or if `numtaps` is even but a passband includes the Nyquist frequency. Examples @@ -196,38 +197,42 @@ Low-pass from 0 to f:: - >>> firwin(N, f) + >>> firwin(numtaps, f) Use a specific window function:: - >>> firwin(N, f, window='nuttall') + >>> firwin(numtaps, f, window='nuttall') High-pass ('stop' from 0 to f):: - >>> firwin(N, f, pass_zero=False) + >>> firwin(numtaps, f, pass_zero=False) Band-pass:: - >>> firwin(N, [f1, f2], pass_zero=False) + >>> firwin(numtaps, [f1, f2], pass_zero=False) Band-stop:: - >>> firwin(N, [f1, f2]) + >>> firwin(numtaps, [f1, f2]) Multi-band (passbands are [0, f1], [f2, f3] and [f4, 1]):: - >>>firwin(N, [f1, f2, f3, f4]) + >>>firwin(numtaps, [f1, f2, f3, f4]) Multi-band (passbands are [f1, f2] and [f3,f4]):: - >>> firwin(N, [f1, f2, f3, f4], pass_zero=False) + >>> firwin(numtaps, [f1, f2, f3, f4], pass_zero=False) + See also + -------- + scipy.signal.firwin2 + """ # The major enhancements to this function added in November 2010 were # developed by Tom Krauss (see ticket #902). - cutoff = numpy.atleast_1d(cutoff) + cutoff = np.atleast_1d(cutoff) # Check for invalid input. if cutoff.ndim > 1: @@ -236,7 +241,7 @@ raise ValueError("At least one cutoff frequency must be given.") if cutoff.min() <= 0 or cutoff.max() >= 1: raise ValueError("Invalid cutoff frequency: frequencies must be greater than 0 and less than 1.") - if numpy.any(numpy.diff(cutoff) <= 0): + if np.any(np.diff(cutoff) <= 0): raise ValueError("Invalid cutoff frequencies: the frequencies must be strictly increasing.") if width is not None: @@ -244,27 +249,27 @@ # of the Kaiser window, and set `window`. This overrides the value of # `window` passed in. if isinstance(width, float): - atten = kaiser_atten(N, width) + atten = kaiser_atten(numtaps, width) beta = kaiser_beta(atten) window = ('kaiser', beta) else: raise ValueError("Invalid value for width: %s", width) pass_nyquist = bool(cutoff.size & 1) ^ pass_zero - if pass_nyquist and N % 2 == 0: + if pass_nyquist and numtaps % 2 == 0: raise ValueError("A filter with an even number of coefficients must " "have zero response at the Nyquist rate.") # Insert 0 and/or 1 at the ends of cutoff so that the length of cutoff is even, # and each pair in cutoff corresponds to passband. - cutoff = numpy.hstack(([0.0]*pass_zero, cutoff, [1.0]*pass_nyquist)) + cutoff = np.hstack(([0.0]*pass_zero, cutoff, [1.0]*pass_nyquist)) # `bands` is a 2D array; each row gives the left and right edges of a passband. bands = cutoff.reshape(-1,2) # Build up the coefficients. - alpha = 0.5 * (N-1) - m = numpy.arange(0, N) - alpha + alpha = 0.5 * (numtaps-1) + m = np.arange(0, numtaps) - alpha h = 0 for left, right in bands: h += right * sinc(right * m) @@ -272,7 +277,7 @@ # Get and apply the window function. from signaltools import get_window - win = get_window(window, N, fftbins=False) + win = get_window(window, numtaps, fftbins=False) h *= win # Now handle scaling if desired. @@ -285,13 +290,160 @@ scale_frequency = 1.0 else: scale_frequency = 0.5 * (left + right) - c = cos(pi * m * scale_frequency) - s = numpy.sum(h * c) + c = np.cos(np.pi * m * scale_frequency) + s = np.sum(h * c) h /= s return h +# Original version of firwin2 from scipy ticket #457, submitted by "tash". +# +# Rewritten by Warren Weckesser, 2010. + +def firwin2(numtaps, freq, gain, nfreqs=None, window='hamming', nyq=1.0): + """FIR filter design using the window method. + + From the given frequencies `freq` and corresponding gains `gain`, + this function constructs an FIR filter with linear phase and + (approximately) the given frequency response. + + Parameters + ---------- + numtaps : int + The number of taps in the FIR filter. `numtaps` must be less than + `nfreqs`. If the gain at the Nyquist rate, `gain[-1]`, is not 0, + then `numtaps` must be odd. + + freq : array-like, 1D + The frequency sampling points. Typically 0.0 to 1.0 with 1.0 being + Nyquist. The Nyquist frequency can be redefined with the argument + `nyq`. + + The values in `freq` must be nondecreasing. A value can be repeated + once to implement a discontinuity. The first value in `freq` must + be 0, and the last value must be `nyq`. + + gain : array-like + The filter gains at the frequency sampling points. + + nfreqs : int, optional + The size of the interpolation mesh used to construct the filter. + For most efficient behavior, this should be a power of 2 plus 1 + (e.g, 129, 257, etc). The default is one more than the smallest + power of 2 that is not less than `numtaps`. `nfreqs` must be greater + than `numtaps`. + + window : string or (string, float) or float, or None, optional + Window function to use. Default is "hamming". See + `scipy.signal.get_window` for the complete list of possible values. + If None, no window function is applied. + + nyq : float + Nyquist frequency. Each frequency in `freq` must be between 0 and + `nyq` (inclusive). + + Returns + ------- + taps : numpy 1D array of length `numtaps` + The filter coefficients of the FIR filter. + + Example + ------- + A lowpass FIR filter with a response that is 1 on [0.0, 0.5], and + that decreases linearly on [0.5, 1.0] from 1 to 0: + + >>> taps = firwin2(150, [0.0, 0.5, 1.0], [1.0, 1.0, 0.0]) + >>> print(taps[72:78]) + [-0.02286961 -0.06362756 0.57310236 0.57310236 -0.06362756 -0.02286961] + + See also + -------- + scipy.signal.firwin + + Notes + ----- + + From the given set of frequencies and gains, the desired response is + constructed in the frequency domain. The inverse FFT is applied to the + desired response to create the associated convolution kernel, and the + first `numtaps` coefficients of this kernel, scaled by `window`, are + returned. + + The FIR filter will have linear phase. The filter is Type I if `numtaps` + is odd and Type II if `numtaps` is even. Because Type II filters always + have a zero at the Nyquist frequency, `numtaps` must be odd if `gain[-1]` + is not zero. + + .. versionadded:: 0.9.0 + + References + ---------- + .. [1] Oppenheim, A. V. and Schafer, R. W., "Discrete-Time Signal + Processing", Prentice-Hall, Englewood Cliffs, New Jersey (1989). + (See, for example, Section 7.4.) + + .. [2] Smith, Steven W., "The Scientist and Engineer's Guide to Digital + Signal Processing", Ch. 17. http://www.dspguide.com/ch17/1.htm + + """ + + if len(freq) != len(gain): + raise ValueError('freq and gain must be of same length.') + + if nfreqs is not None and numtaps >= nfreqs: + raise ValueError('ntaps must be less than nfreqs, but firwin2 was ' + 'called with ntaps=%d and nfreqs=%s' % (numtaps, nfreqs)) + + if freq[0] != 0 or freq[-1] != nyq: + raise ValueError('freq must start with 0 and end with `nyq`.') + d = np.diff(freq) + if (d < 0).any(): + raise ValueError('The values in freq must be nondecreasing.') + d2 = d[:-1] + d[1:] + if (d2 == 0).any(): + raise ValueError('A value in freq must not occur more than twice.') + + if numtaps % 2 == 0 and gain[-1] != 0.0: + raise ValueError("A filter with an even number of coefficients must " + "have zero gain at the Nyquist rate.") + + if nfreqs is None: + nfreqs = 1 + 2 ** int(ceil(log(numtaps,2))) + + # Tweak any repeated values in freq so that interp works. + eps = np.finfo(float).eps + for k in range(len(freq)): + if k < len(freq)-1 and freq[k] == freq[k+1]: + freq[k] = freq[k] - eps + freq[k+1] = freq[k+1] + eps + + # Linearly interpolate the desired response on a uniform mesh `x`. + x = np.linspace(0.0, nyq, nfreqs) + fx = np.interp(x, freq, gain) + + # Adjust the phases of the coefficients so that the first `ntaps` of the + # inverse FFT are the desired filter coefficients. + shift = np.exp(-(numtaps-1)/2. * 1.j * np.pi * x / nyq) + fx2 = fx * shift + + # Use irfft to compute the inverse FFT. + out_full = irfft(fx2) + + if window is not None: + # Create the window to apply to the filter coefficients. + from signaltools import get_window + wind = get_window(window, numtaps, fftbins=False) + else: + wind = 1 + + # Keep only the first `numtaps` coefficients in `out`, and multiply by + # the window. + out = out_full[:numtaps] * wind + + return out + + def remez(numtaps, bands, desired, weight=None, Hz=1, type='bandpass', maxiter=25, grid_density=16): """ @@ -385,6 +537,6 @@ if weight is None: weight = [1] * len(desired) - bands = asarray(bands).copy() + bands = np.asarray(bands).copy() return sigtools._remez(numtaps, bands, desired, weight, tnum, Hz, maxiter, grid_density) Modified: trunk/scipy/signal/info.py =================================================================== --- trunk/scipy/signal/info.py 2010-11-28 23:26:29 UTC (rev 6972) +++ trunk/scipy/signal/info.py 2010-11-28 23:26:36 UTC (rev 6973) @@ -71,7 +71,9 @@ bilinear: Return a digital filter from an analog filter using the bilinear transform. firwin: - Windowed FIR filter design. + Windowed FIR filter design, with frequency response defined as pass and stop bands. + firwin2: + Windowed FIR filter design, with arbitrary frequency response. freqs: Analog filter frequency response. freqz: Modified: trunk/scipy/signal/tests/test_fir_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-28 23:26:29 UTC (rev 6972) +++ trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-28 23:26:36 UTC (rev 6973) @@ -3,7 +3,7 @@ from numpy.testing import TestCase, run_module_suite, assert_raises, \ assert_array_almost_equal, assert_ -from scipy.signal import firwin, kaiserord, freqz, remez +from scipy.signal import firwin, firwin2, kaiserord, freqz, remez class TestFirwin(TestCase): @@ -189,6 +189,71 @@ assert_raises(ValueError, firwin, 40, [.25, 0.5]) + +class TestFirwin2(TestCase): + + def test_invalid_args(self): + # `freq` and `gain` have different lengths. + assert_raises(ValueError, firwin2, 50, [0, 0.5, 1], [0.0, 1.0]) + # `nfreqs` is less than `ntaps`. + assert_raises(ValueError, firwin2, 50, [0, 0.5, 1], [0.0, 1.0, 1.0], nfreqs=33) + # Decreasing value in `freq` + assert_raises(ValueError, firwin2, 50, [0, 0.5, 0.4, 1.0], [0, .25, .5, 1.0]) + # Value in `freq` repeated more than once. + assert_raises(ValueError, firwin2, 50, [ 0, .1, .1, .1, 1.0], + [0.0, 0.5, 0.75, 1.0, 1.0]) + # `freq` does not start at 0.0. + assert_raises(ValueError, firwin2, 50, [0.5, 1.0], [0.0, 1.0]) + + def test01(self): + width = 0.04 + beta = 12.0 + ntaps = 400 + # Filter is 1 from w=0 to w=0.5, then decreases linearly from 1 to 0 as w + # increases from w=0.5 to w=1 (w=1 is the Nyquist frequency). + freq = [0.0, 0.5, 1.0] + gain = [1.0, 1.0, 0.0] + taps = firwin2(ntaps, freq, gain, window=('kaiser', beta)) + freq_samples = np.array([0.0, 0.25, 0.5-width/2, 0.5+width/2, + 0.75, 1.0-width/2]) + freqs, response = freqz(taps, worN=np.pi*freq_samples) + assert_array_almost_equal(np.abs(response), + [1.0, 1.0, 1.0, 1.0-width, 0.5, width], decimal=5) + + def test02(self): + width = 0.04 + beta = 12.0 + # ntaps must be odd for positive gain at Nyquist. + ntaps = 401 + # An ideal highpass filter. + freq = [0.0, 0.5, 0.5, 1.0] + gain = [0.0, 0.0, 1.0, 1.0] + taps = firwin2(ntaps, freq, gain, window=('kaiser', beta)) + freq_samples = np.array([0.0, 0.25, 0.5-width, 0.5+width, 0.75, 1.0]) + freqs, response = freqz(taps, worN=np.pi*freq_samples) + assert_array_almost_equal(np.abs(response), + [0.0, 0.0, 0.0, 1.0, 1.0, 1.0], decimal=5) + + def test03(self): + width = 0.02 + ntaps, beta = kaiserord(120, width) + # ntaps must be odd for positive gain at Nyquist. + ntaps = int(ntaps) | 1 + freq = [0.0, 0.4, 0.4, 0.5, 0.5, 1.0] + gain = [1.0, 1.0, 0.0, 0.0, 1.0, 1.0] + taps = firwin2(ntaps, freq, gain, window=('kaiser', beta)) + freq_samples = np.array([0.0, 0.4-width, 0.4+width, 0.45, + 0.5-width, 0.5+width, 0.75, 1.0]) + freqs, response = freqz(taps, worN=np.pi*freq_samples) + assert_array_almost_equal(np.abs(response), + [1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0], decimal=5) + + def test_nyq(self): + taps1 = firwin2(80, [0.0, 0.5, 1.0], [1.0, 1.0, 0.0]) + taps2 = firwin2(80, [0.0, 30.0, 60.0], [1.0, 1.0, 0.0], nyq=60.0) + assert_array_almost_equal(taps1, taps2) + + class TestRemez(TestCase): def test_hilbert(self): From scipy-svn at scipy.org Sun Nov 28 18:43:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 28 Nov 2010 17:43:21 -0600 (CST) Subject: [Scipy-svn] r6974 - trunk/scipy/io Message-ID: <20101128234321.1F3C332348@scipy.org> Author: ptvirtan Date: 2010-11-28 17:43:20 -0600 (Sun, 28 Nov 2010) New Revision: 6974 Modified: trunk/scipy/io/wavfile.py Log: BUG: io/wavfile: use fixed endianness also in read() Modified: trunk/scipy/io/wavfile.py =================================================================== --- trunk/scipy/io/wavfile.py 2010-11-28 23:26:36 UTC (rev 6973) +++ trunk/scipy/io/wavfile.py 2010-11-28 23:43:20 UTC (rev 6974) @@ -120,7 +120,11 @@ else: warnings.warn("chunk not understood", WavFileWarning) data = fid.read(4) - size = struct.unpack('I',data)[0] + if _big_endian: + fmt = '>i' + else: + fmt = ' Author: warren.weckesser Date: 2010-11-28 18:40:49 -0600 (Sun, 28 Nov 2010) New Revision: 6975 Modified: trunk/scipy/signal/fir_filter_design.py trunk/scipy/signal/tests/test_fir_filter_design.py Log: ENH: signal: add the 'nyq' keyword argument to firwin(), to be consistent with the API of firwin2(). Modified: trunk/scipy/signal/fir_filter_design.py =================================================================== --- trunk/scipy/signal/fir_filter_design.py 2010-11-28 23:43:20 UTC (rev 6974) +++ trunk/scipy/signal/fir_filter_design.py 2010-11-29 00:40:49 UTC (rev 6975) @@ -129,7 +129,8 @@ return int(ceil(numtaps)), beta -def firwin(numtaps, cutoff, width=None, window='hamming', pass_zero=True, scale=True): +def firwin(numtaps, cutoff, width=None, window='hamming', pass_zero=True, + scale=True, nyq=1.0): """ FIR filter design using the window method. @@ -145,25 +146,25 @@ ---------- numtaps : int Length of the filter (number of coefficients, i.e. the filter - order + 1). `numtaps` must be even if a passband includes the Nyquist - frequency. + order + 1). `numtaps` must be even if a passband includes the + Nyquist frequency. cutoff : float or 1D array_like - Cutoff frequency of filter (normalized so that 1 corresponds to - Nyquist or pi radians / sample) OR an array of cutoff frequencies - (that is, band edges). In the latter case, the frequencies in - `cutoff` should be positive and monotonically increasing between - 0 and 1. The values 0 and 1 must not be included in `cutoff`. + Cutoff frequency of filter (expressed in the same units as `nyq`) + OR an array of cutoff frequencies (that is, band edges). In the + latter case, the frequencies in `cutoff` should be positive and + monotonically increasing between 0 and `nyq`. The values 0 and + `nyq` must not be included in `cutoff`. width : float or None - If `width` is not None, then assume it is the approximate width of - the transition region (normalized so that 1 corresponds to pi) + If `width` is not None, then assume it is the approximate width + of the transition region (expressed in the same units as `nyq`) for use in Kaiser FIR filter design. In this case, the `window` argument is ignored. window : string or tuple of string and parameter values - Desired window to use. See `scipy.signal.get_window` for a list of - windows and required parameters. + Desired window to use. See `scipy.signal.get_window` for a list + of windows and required parameters. pass_zero : bool If True, the gain at the frequency 0 (i.e. the "DC gain") is 1. @@ -175,10 +176,14 @@ That frequency is either: 0 (DC) if the first passband starts at 0 (i.e. pass_zero is True); - 1 (Nyquist) if the first passband ends at 1 (i.e the - filter is a single band highpass filter); + `nyq` (the Nyquist rate) if the first passband ends at + `nyq` (i.e the filter is a single band highpass filter); center of first passband otherwise. + nyq : float + Nyquist frequency. Each frequency in `cutoff` must be between 0 + and `nyq`. + Returns ------- h : 1D ndarray @@ -187,8 +192,8 @@ Raises ------ ValueError - If any value in cutoff is less than or equal to 0 or greater - than or equal to 1, if the values in cutoff are not strictly + If any value in `cutoff` is less than or equal to 0 or greater + than or equal to `nyq`, if the values in `cutoff` are not strictly monotonically increasing, or if `numtaps` is even but a passband includes the Nyquist frequency. @@ -232,28 +237,24 @@ # The major enhancements to this function added in November 2010 were # developed by Tom Krauss (see ticket #902). - cutoff = np.atleast_1d(cutoff) - + cutoff = np.atleast_1d(cutoff) / float(nyq) + # Check for invalid input. if cutoff.ndim > 1: raise ValueError("The cutoff argument must be at most one-dimensional.") if cutoff.size == 0: raise ValueError("At least one cutoff frequency must be given.") if cutoff.min() <= 0 or cutoff.max() >= 1: - raise ValueError("Invalid cutoff frequency: frequencies must be greater than 0 and less than 1.") + raise ValueError("Invalid cutoff frequency: frequencies must be greater than 0 and less than nyq.") if np.any(np.diff(cutoff) <= 0): raise ValueError("Invalid cutoff frequencies: the frequencies must be strictly increasing.") if width is not None: - # A width was given. Verify that it is a float, find the beta parameter - # of the Kaiser window, and set `window`. This overrides the value of - # `window` passed in. - if isinstance(width, float): - atten = kaiser_atten(numtaps, width) - beta = kaiser_beta(atten) - window = ('kaiser', beta) - else: - raise ValueError("Invalid value for width: %s", width) + # A width was given. Find the beta parameter of the Kaiser window + # and set `window`. This overrides the value of `window` passed in. + atten = kaiser_atten(numtaps, float(width)/nyq) + beta = kaiser_beta(atten) + window = ('kaiser', beta) pass_nyquist = bool(cutoff.size & 1) ^ pass_zero if pass_nyquist and numtaps % 2 == 0: Modified: trunk/scipy/signal/tests/test_fir_filter_design.py =================================================================== --- trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-28 23:43:20 UTC (rev 6974) +++ trunk/scipy/signal/tests/test_fir_filter_design.py 2010-11-29 00:40:49 UTC (rev 6975) @@ -165,6 +165,25 @@ [1.0, 1.0, 1.0, 0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0], decimal=5) + def test_nyq(self): + """Test the nyq keyword.""" + nyquist = 1000 + width = 40.0 + relative_width = width/nyquist + ntaps, beta = kaiserord(120, relative_width) + taps = firwin(ntaps, cutoff=[300, 700], window=('kaiser', beta), + pass_zero=False, scale=False, nyq=nyquist) + + # Check the symmetry of taps. + assert_array_almost_equal(taps[:ntaps/2], taps[ntaps:ntaps-ntaps/2-1:-1]) + + # Check the gain at a few samples where we know it should be approximately 0 or 1. + freq_samples = np.array([0.0, 200, 300-width/2, 300+width/2, 500, + 700-width/2, 700+width/2, 800, 1000]) + freqs, response = freqz(taps, worN=np.pi*freq_samples/nyquist) + assert_array_almost_equal(np.abs(response), + [0.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 0.0], decimal=5) + def test_bad_cutoff(self): """Test that invalid cutoff argument raises ValueError.""" # cutoff values must be greater than 0 and less than 1. @@ -180,8 +199,10 @@ assert_raises(ValueError, firwin, 99, []) # 2D array not allowed. assert_raises(ValueError, firwin, 99, [[0.1, 0.2],[0.3, 0.4]]) + # cutoff values must be less than nyq. + assert_raises(ValueError, firwin, 99, 50.0, nyq=40) + assert_raises(ValueError, firwin, 99, [10, 20, 30], nyq=25) - def test_even_highpass_raises_value_error(self): """Test that attempt to create a highpass filter with an even number of taps raises a ValueError exception.""" @@ -190,6 +211,7 @@ + class TestFirwin2(TestCase): def test_invalid_args(self): From scipy-svn at scipy.org Mon Nov 29 09:46:01 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:46:01 -0600 (CST) Subject: [Scipy-svn] r6976 - in trunk/scipy/stats: . tests Message-ID: <20101129144601.775CD37D3B6@scipy.org> Author: rgommers Date: 2010-11-29 08:46:00 -0600 (Mon, 29 Nov 2010) New Revision: 6976 Modified: trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/tests/test_mstats_basic.py Log: ENH: update mstats to use new zmap/zscore, remove z/zs. Closes #1195. The plain stats functions zmap and zscore now also handle masked arrays, and they support more functionality that the versions that were removed. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-29 00:40:49 UTC (rev 6975) +++ trunk/scipy/stats/mstats_basic.py 2010-11-29 14:46:00 UTC (rev 6976) @@ -35,7 +35,7 @@ 'ttest_ind','ttest_rel','tvar', 'var','variation', 'winsorize', - 'z','zmap','zs' + 'zmap', 'zscore' ] import numpy as np @@ -1933,28 +1933,10 @@ return s sem.__doc__ = stats.sem.__doc__ -def z(a, score): - a = ma.asarray(a) - z = (score-a.mean(None)) / a.std(axis=None, ddof=1) - return z -# where do we get the doc from? stats.z has been removed -# z.__doc__ = stats.zscore_compare.__doc__ +zmap = stats.zmap +zscore = stats.zscore -def zs(a): - a = ma.asarray(a) - mu = a.mean(axis=0) - sigma = a.std(axis=0,ddof=0) - return (a-mu)/sigma -zs.__doc__ = stats.zscore.__doc__ -def zmap(scores, compare, axis=0): - (scores, compare) = (ma.asarray(scores), ma.asarray(compare)) - mns = compare.mean(axis=axis) - sstd = compare.std(axis=0, ddof=0) - return (scores - mns) / sstd -zmap.__doc__ = stats.zmap.__doc__ - - #####-------------------------------------------------------------------------- #---- --- ANOVA --- #####-------------------------------------------------------------------------- Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-29 00:40:49 UTC (rev 6975) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-29 14:46:00 UTC (rev 6976) @@ -451,26 +451,28 @@ y = mstats.sem(self.testcase) assert_almost_equal(y,0.6454972244) - def test_z(self): + def test_zmap(self): """ - not in R, so used - (10-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) + not in R, so tested by using + (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) """ - y = mstats.z(self.testcase, ma.array(self.testcase).mean()) - assert_almost_equal(y,0.0) + y = mstats.zmap(self.testcase, self.testcase) + desired_unmaskedvals = ([-1.3416407864999, -0.44721359549996 , + 0.44721359549996 , 1.3416407864999]) + assert_array_almost_equal(desired_unmaskedvals, + y.data[y.mask==False], decimal=12) - def test_zs(self): + def test_zscore(self): """ not in R, so tested by using (testcase[i]-mean(testcase,axis=0))/sqrt(var(testcase)*3/4) """ - y = mstats.zs(self.testcase) + y = mstats.zscore(self.testcase) desired = ma.fix_invalid([-1.3416407864999, -0.44721359549996 , 0.44721359549996 , 1.3416407864999, np.nan]) - assert_almost_equal(desired,y,decimal=12) + assert_almost_equal(desired, y, decimal=12) - class TestMisc(TestCase): # def test_obrientransform(self): From scipy-svn at scipy.org Mon Nov 29 09:46:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:46:33 -0600 (CST) Subject: [Scipy-svn] r6977 - in trunk: doc/release scipy/stats scipy/stats/tests Message-ID: <20101129144633.ACE8F37D3B9@scipy.org> Author: rgommers Date: 2010-11-29 08:46:33 -0600 (Mon, 29 Nov 2010) New Revision: 6977 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/stats/mstats_basic.py trunk/scipy/stats/tests/test_mstats_basic.py Log: DEP: remove deprecated functions from mstats, in line with changes to stats. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:46:00 UTC (rev 6976) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:46:33 UTC (rev 6977) @@ -148,4 +148,5 @@ Many functions in ``scipy.stats`` that are either available from numpy or have been superseded, and have been deprecated since version 0.7, have been removed: `std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`, -`samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`. +`samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`. These changes +are mirrored in ``scipy.stats.mstats``. Modified: trunk/scipy/stats/mstats_basic.py =================================================================== --- trunk/scipy/stats/mstats_basic.py 2010-11-29 14:46:00 UTC (rev 6976) +++ trunk/scipy/stats/mstats_basic.py 2010-11-29 14:46:33 UTC (rev 6977) @@ -13,7 +13,6 @@ __all__ = ['argstoarray', 'betai', - 'cov', # from np.ma 'chisquare','count_tied_groups', 'describe', 'f_oneway','f_value_wilks_lambda','find_repeats','friedmanchisquare', @@ -27,13 +26,13 @@ 'obrientransform', 'pearsonr','plotting_positions','pointbiserialr', 'rankdata', - 'samplestd','samplevar','scoreatpercentile','sem','std', + 'scoreatpercentile','sem', 'sen_seasonal_slopes','signaltonoise','skew','skewtest','spearmanr', 'theilslopes','threshold','tmax','tmean','tmin','trim','trimboth', 'trimtail','trima','trimr','trimmed_mean','trimmed_std', 'trimmed_stde','trimmed_var','tsem','ttest_1samp','ttest_onesamp', 'ttest_ind','ttest_rel','tvar', - 'var','variation', + 'variation', 'winsorize', 'zmap', 'zscore' ] @@ -301,11 +300,8 @@ """Returns the sign of x, or 0 if x is masked.""" return ma.filled(np.sign(x), 0) -cov = ma.cov -corrcoef = ma.corrcoef - def pearsonr(x,y): """Calculates a Pearson correlation coefficient and the p-value for testing non-correlation. @@ -1883,49 +1879,6 @@ return m/sd -def samplevar(data, axis=0): - """Returns a biased estimate of the variance of the data, as the average - of the squared deviations from the mean. - - Parameters - ---------- - data : sequence - Input data - axis : {0, int} optional - Axis along which to compute. If None, the computation is performed - on a flat version of the array. - """ - return ma.asarray(data).var(axis=axis,ddof=0) - - -def samplestd(data, axis=0): - """Returns a biased estimate of the standard deviation of the data, as the - square root of the average squared deviations from the mean. - - Parameters - ---------- - data : sequence - Input data - axis : {0,int} optional - Axis along which to compute. If None, the computation is performed - on a flat version of the array. - - Notes - ----- - samplestd(a) is equivalent to a.std(ddof=0) - - """ - return ma.asarray(data).std(axis=axis,ddof=0) - - -def var(a,axis=None): - return ma.asarray(a).var(axis=axis,ddof=1) -var.__doc__ = np.var.__doc__ - -def std(a,axis=None): - return ma.asarray(a).std(axis=axis,ddof=1) -std.__doc__ = np.std.__doc__ - def sem(a, axis=0): a, axis = _chk_asarray(a, axis) n = a.count(axis=axis) Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-29 14:46:00 UTC (rev 6976) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-11-29 14:46:33 UTC (rev 6977) @@ -193,34 +193,6 @@ 2.8,2.8,2.5,2.4,2.3,2.1,1.7,1.7,1.5,1.3,1.3,1.2,1.2,1.1, 0.8,0.7,0.6,0.5,0.2,0.2,0.1,np.nan] assert_almost_equal(mstats.pointbiserialr(x, y)[0], 0.36149, 5) - # - def test_cov(self): - "Tests the cov function." - x = ma.array([[1,2,3],[4,5,6]], mask=[[1,0,0],[0,0,0]]) - c = mstats.cov(x[0]) - assert_equal(c, x[0].var(ddof=1)) - c = mstats.cov(x[1]) - assert_equal(c, x[1].var(ddof=1)) - c = mstats.cov(x) - assert_equal(c[1,0], (x[0].anom()*x[1].anom()).sum()) - # - x = [[nan,nan, 4, 2, 16, 26, 5, 1, 5, 1, 2, 3, 1], - [ 4, 3, 5, 3, 2, 7, 3, 1, 1, 2, 3, 5, 3], - [ 3, 2, 5, 6, 18, 4, 9, 1, 1,nan, 1, 1,nan], - [nan, 6, 11, 4, 17,nan, 6, 1, 1, 2, 5, 1, 1]] - x = ma.fix_invalid(x).T - (winter,spring,summer,fall) = x.T - # - assert_almost_equal(mstats.cov(winter,winter,bias=True), - winter.var(ddof=0)) - assert_almost_equal(mstats.cov(winter,winter,bias=False), - winter.var(ddof=1)) - assert_almost_equal(mstats.cov(winter,spring)[0,1], 7.7) - assert_almost_equal(mstats.cov(winter,spring)[1,0], 7.7) - assert_almost_equal(mstats.cov(winter,summer)[0,1], 19.1111111, 7) - assert_almost_equal(mstats.cov(winter,summer)[1,0], 19.1111111, 7) - assert_almost_equal(mstats.cov(winter,fall)[0,1], 20) - assert_almost_equal(mstats.cov(winter,fall)[1,0], 20) class TestTrimming(TestCase): @@ -403,35 +375,7 @@ note that length(testcase) = 4 """ testcase = ma.fix_invalid([1,2,3,4,np.nan]) - # - def test_std(self): - y = mstats.std(self.testcase) - assert_almost_equal(y,1.290994449) - def test_var(self): - """ - var(testcase) = 1.666666667 """ - #y = stats.var(self.shoes[0]) - #assert_approx_equal(y,6.009) - y = mstats.var(self.testcase) - assert_almost_equal(y,1.666666667) - - def test_samplevar(self): - """ - R does not have 'samplevar' so the following was used - var(testcase)*(4-1)/4 where 4 = length(testcase) - """ - #y = stats.samplevar(self.shoes[0]) - #assert_approx_equal(y,5.4081) - y = mstats.samplevar(self.testcase) - assert_almost_equal(y,1.25) - - def test_samplestd(self): - #y = stats.samplestd(self.shoes[0]) - #assert_approx_equal(y,2.325532197) - y = mstats.samplestd(self.testcase) - assert_almost_equal(y,1.118033989) - def test_signaltonoise(self): """ this is not in R, so used From scipy-svn at scipy.org Mon Nov 29 09:46:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:46:54 -0600 (CST) Subject: [Scipy-svn] r6978 - trunk/scipy/stats Message-ID: <20101129144654.752EC37D3BC@scipy.org> Author: rgommers Date: 2010-11-29 08:46:54 -0600 (Mon, 29 Nov 2010) New Revision: 6978 Modified: trunk/scipy/stats/morestats.py Log: Clean up some more upused code in morestats.py. Modified: trunk/scipy/stats/morestats.py =================================================================== --- trunk/scipy/stats/morestats.py 2010-11-29 14:46:33 UTC (rev 6977) +++ trunk/scipy/stats/morestats.py 2010-11-29 14:46:54 UTC (rev 6978) @@ -677,34 +677,6 @@ return A2, critical, sig -def _find_repeats(arr): - """Find repeats in the array and return (repeats, repeat_count) - """ - arr = sort(arr) - lastval = arr[0] - howmany = 0 - ind = 1 - N = len(arr) - repeat = 0 - replist = [] - repnum = [] - while ind < N: - if arr[ind] != lastval: - if repeat: - repnum.append(howmany+1) - repeat = 0 - howmany = 0 - else: - howmany += 1 - repeat = 1 - if (howmany == 1): - replist.append(arr[ind]) - lastval = arr[ind] - ind += 1 - if repeat: - repnum.append(howmany+1) - return replist, repnum - def ansari(x,y): """ Perform the Ansari-Bradley test for equal scale parameters From scipy-svn at scipy.org Mon Nov 29 09:56:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:56:59 -0600 (CST) Subject: [Scipy-svn] r6979 - in trunk: doc/release scipy/ndimage Message-ID: <20101129145659.925E337D3C0@scipy.org> Author: rgommers Date: 2010-11-29 08:56:59 -0600 (Mon, 29 Nov 2010) New Revision: 6979 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/ndimage/_ni_support.py trunk/scipy/ndimage/interpolation.py Log: DEP: remove deprecated output_type keyword in ndimage/interpolation.py Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:46:54 UTC (rev 6978) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:56:59 UTC (rev 6979) @@ -141,7 +141,10 @@ The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has been deprecated since version 0.7, was removed. +The ``output_type`` keyword in many ``scipy.ndimage`` interpolation functions +has been removed. + ``scipy.stats`` --------------- Modified: trunk/scipy/ndimage/_ni_support.py =================================================================== --- trunk/scipy/ndimage/_ni_support.py 2010-11-29 14:46:54 UTC (rev 6978) +++ trunk/scipy/ndimage/_ni_support.py 2010-11-29 14:56:59 UTC (rev 6979) @@ -47,7 +47,7 @@ else: raise RuntimeError('boundary mode not supported') -def _normalize_sequence(input, rank, array_type = None): +def _normalize_sequence(input, rank, array_type=None): """If input is a scalar, create a sequence of length equal to the rank by duplicating the input. If input is a sequence, check if its length is equal to the length of array. @@ -62,18 +62,7 @@ raise RuntimeError(err) return normalized -import warnings -def _get_output(output, input, output_type = None, shape = None): - if output_type is not None: - msg = "'output_type' argument is deprecated." - msg += " Assign type to 'output' instead." - raise RuntimeError(msg) - warnings.warn(msg, DeprecationWarning) - if output is None: - output = output_type - elif ((type(output) is not type(types.TypeType)) or - output.dtype != output_type): - raise RuntimeError("'output' type and 'output_type' not equal") +def _get_output(output, input, shape=None): if shape is None: shape = input.shape if output is None: Modified: trunk/scipy/ndimage/interpolation.py =================================================================== --- trunk/scipy/ndimage/interpolation.py 2010-11-29 14:46:54 UTC (rev 6978) +++ trunk/scipy/ndimage/interpolation.py 2010-11-29 14:56:59 UTC (rev 6979) @@ -37,8 +37,7 @@ mode = _ni_support._extend_mode_to_code(mode) return mode -def spline_filter1d(input, order = 3, axis = -1, output = numpy.float64, - output_type = None): +def spline_filter1d(input, order=3, axis=-1, output=numpy.float64): """ Calculates a one-dimensional spline filter along the given axis. @@ -57,8 +56,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. Default is `numpy.float64`. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. Returns ------- @@ -72,8 +69,7 @@ input = numpy.asarray(input) if numpy.iscomplexobj(input): raise TypeError('Complex type not supported') - output, return_value = _ni_support._get_output(output, input, - output_type) + output, return_value = _ni_support._get_output(output, input) if order in [0, 1]: output[...] = numpy.array(input) else: @@ -82,8 +78,7 @@ return return_value -def spline_filter(input, order = 3, output = numpy.float64, - output_type = None): +def spline_filter(input, order=3, output = numpy.float64): """ Multi-dimensional spline filter. @@ -107,8 +102,7 @@ input = numpy.asarray(input) if numpy.iscomplexobj(input): raise TypeError('Complex type not supported') - output, return_value = _ni_support._get_output(output, input, - output_type) + output, return_value = _ni_support._get_output(output, input) if order not in [0, 1] and input.ndim > 0: for axis in range(input.ndim): spline_filter1d(input, order, axis, output = output) @@ -117,10 +111,10 @@ output[...] = input[...] return return_value -def geometric_transform(input, mapping, output_shape = None, - output_type = None, output = None, order = 3, - mode = 'constant', cval = 0.0, prefilter = True, - extra_arguments = (), extra_keywords = {}): +def geometric_transform(input, mapping, output_shape=None, + output=None, order=3, + mode='constant', cval=0.0, prefilter=True, + extra_arguments=(), extra_keywords={}): """ Apply an arbritrary geometric transform. @@ -142,8 +136,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -202,14 +194,14 @@ else: filtered = input output, return_value = _ni_support._get_output(output, input, - output_type, shape = output_shape) + shape=output_shape) _nd_image.geometric_transform(filtered, mapping, None, None, None, output, order, mode, cval, extra_arguments, extra_keywords) return return_value -def map_coordinates(input, coordinates, output_type = None, output = None, - order = 3, mode = 'constant', cval = 0.0, prefilter = True): +def map_coordinates(input, coordinates, output=None, order=3, + mode='constant', cval=0.0, prefilter=True): """ Map the input array to new coordinates by interpolation. @@ -232,8 +224,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -303,15 +293,15 @@ else: filtered = input output, return_value = _ni_support._get_output(output, input, - output_type, shape = output_shape) + shape=output_shape) _nd_image.geometric_transform(filtered, None, coordinates, None, None, output, order, mode, cval, None, None) return return_value -def affine_transform(input, matrix, offset = 0.0, output_shape = None, - output_type = None, output = None, order = 3, - mode = 'constant', cval = 0.0, prefilter = True): +def affine_transform(input, matrix, offset=0.0, output_shape=None, + output=None, order=3, + mode='constant', cval=0.0, prefilter=True): """ Apply an affine transformation. @@ -340,8 +330,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -380,7 +368,7 @@ else: filtered = input output, return_value = _ni_support._get_output(output, input, - output_type, shape = output_shape) + shape=output_shape) matrix = numpy.asarray(matrix, dtype = numpy.float64) if matrix.ndim not in [1, 2] or matrix.shape[0] < 1: raise RuntimeError('no proper affine matrix provided') @@ -405,8 +393,8 @@ return return_value -def shift(input, shift, output_type = None, output = None, order = 3, - mode = 'constant', cval = 0.0, prefilter = True): +def shift(input, shift, output=None, order=3, mode='constant', cval=0.0, + prefilter=True): """ Shift an array. @@ -424,8 +412,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -461,8 +447,7 @@ filtered = spline_filter(input, order, output = numpy.float64) else: filtered = input - output, return_value = _ni_support._get_output(output, input, - output_type) + output, return_value = _ni_support._get_output(output, input) shift = _ni_support._normalize_sequence(shift, input.ndim) shift = [-ii for ii in shift] shift = numpy.asarray(shift, dtype = numpy.float64) @@ -472,8 +457,8 @@ return return_value -def zoom(input, zoom, output_type = None, output = None, order = 3, - mode = 'constant', cval = 0.0, prefilter = True): +def zoom(input, zoom, output=None, order=3, mode='constant', cval=0.0, + prefilter=True): """ Zoom an array. @@ -489,8 +474,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -530,7 +513,7 @@ output_shape = tuple([int(ii * jj) for ii, jj in zip(input.shape, zoom)]) zoom = (numpy.array(input.shape)-1)/(numpy.array(output_shape,float)-1) output, return_value = _ni_support._get_output(output, input, - output_type, shape = output_shape) + shape=output_shape) zoom = numpy.asarray(zoom, dtype = numpy.float64) zoom = numpy.ascontiguousarray(zoom) _nd_image.zoom_shift(filtered, zoom, None, output, order, mode, cval) @@ -547,9 +530,9 @@ maxc[1] = coor[1] return minc, maxc -def rotate(input, angle, axes = (1, 0), reshape = True, - output_type = None, output = None, order = 3, - mode = 'constant', cval = 0.0, prefilter = True): +def rotate(input, angle, axes=(1, 0), reshape=True, + output=None, order=3, + mode='constant', cval=0.0, prefilter=True): """ Rotate an array. @@ -571,8 +554,6 @@ output : ndarray or dtype, optional The array in which to place the output, or the dtype of the returned array. - output_type : dtype, optional - DEPRECATED, DO NOT USE. If used, a RuntimeError is raised. order : int, optional The order of the spline interpolation, default is 3. The order has to be in the range 0-5. @@ -645,9 +626,9 @@ output_shape[axes[1]] = ox output_shape = tuple(output_shape) output, return_value = _ni_support._get_output(output, input, - output_type, shape = output_shape) + shape=output_shape) if input.ndim <= 2: - affine_transform(input, matrix, offset, output_shape, None, output, + affine_transform(input, matrix, offset, output_shape, output, order, mode, cval, prefilter) else: coordinates = [] @@ -667,7 +648,7 @@ for ii in range(size): ia = input[tuple(coordinates)] oa = output[tuple(coordinates)] - affine_transform(ia, matrix, offset, os, None, oa, order, mode, + affine_transform(ia, matrix, offset, os, oa, order, mode, cval, prefilter) for jj in iter_axes: if coordinates[jj] < input.shape[jj] - 1: From scipy-svn at scipy.org Mon Nov 29 09:57:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:57:24 -0600 (CST) Subject: [Scipy-svn] r6980 - in trunk: doc/release scipy/linalg scipy/linalg/tests Message-ID: <20101129145724.9BC9E37D3C1@scipy.org> Author: rgommers Date: 2010-11-29 08:57:24 -0600 (Mon, 29 Nov 2010) New Revision: 6980 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/linalg/decomp_qr.py trunk/scipy/linalg/tests/test_decomp.py Log: DEP: remove deprecated econ kw from linalg.qr. The mode keyword is now the same as that for numpy's qr. Closes #243. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:56:59 UTC (rev 6979) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:57:24 UTC (rev 6980) @@ -144,7 +144,10 @@ The ``output_type`` keyword in many ``scipy.ndimage`` interpolation functions has been removed. +The ``econ`` keyword in ``scipy.linalg.qr`` has been removed. The same +functionality is still available by specifying ``mode='economic'``. + ``scipy.stats`` --------------- Modified: trunk/scipy/linalg/decomp_qr.py =================================================================== --- trunk/scipy/linalg/decomp_qr.py 2010-11-29 14:56:59 UTC (rev 6979) +++ trunk/scipy/linalg/decomp_qr.py 2010-11-29 14:57:24 UTC (rev 6980) @@ -12,7 +12,7 @@ from misc import _datanotshared -def qr(a, overwrite_a=False, lwork=None, econ=None, mode='qr'): +def qr(a, overwrite_a=False, lwork=None, mode='full'): """Compute QR decomposition of a matrix. Calculate the decomposition :lm:`A = Q R` where Q is unitary/orthogonal @@ -22,28 +22,24 @@ ---------- a : array, shape (M, N) Matrix to be decomposed - overwrite_a : boolean + overwrite_a : bool, optional Whether data in a is overwritten (may improve performance) - lwork : integer + lwork : int, optional Work array size, lwork >= a.shape[1]. If None or -1, an optimal size is computed. - econ : boolean - Whether to compute the economy-size QR decomposition, making shapes - of Q and R (M, K) and (K, N) instead of (M,M) and (M,N). K=min(M,N). - Default is False. - mode : {'qr', 'r'} + mode : {'full', 'r', 'economic'} Determines what information is to be returned: either both Q and R - or only R. + ('full', default), only R ('r') or both Q and R but computed in + economy-size ('economic', see Notes). Returns ------- - (if mode == 'qr') - Q : double or complex array, shape (M, M) or (M, K) for econ==True + Q : double or complex ndarray + Of shape (M, M), or (M, K) for ``mode='economic'``. Not returned if + ``mode='r'``. + R : double or complex ndarray + Of shape (M, N), or (K, N) for ``mode='economic'``. ``K = min(M, N)``. - (for any mode) - R : double or complex array, shape (M, N) or (K, N) for econ==True - Size K = min(M, N) - Raises LinAlgError if decomposition fails Notes @@ -51,6 +47,9 @@ This is an interface to the LAPACK routines dgeqrf, zgeqrf, dorgqr, and zungqr. + If ``mode=economic``, the shapes of Q and R are (M, K) and (K, N) instead + of (M,M) and (M,N), with ``K=min(M,N)``. + Examples -------- >>> from scipy import random, linalg, dot @@ -64,17 +63,18 @@ >>> r2 = linalg.qr(a, mode='r') >>> allclose(r, r2) - >>> q3, r3 = linalg.qr(a, econ=True) + >>> q3, r3 = linalg.qr(a, mode='economic') >>> q3.shape, r3.shape ((9, 6), (6, 6)) """ - if econ is None: - econ = False - else: - warn("qr econ argument will be removed after scipy 0.7. " - "The economy transform will then be available through " - "the mode='economic' argument.", DeprecationWarning) + if mode == 'qr': + # 'qr' was the old default, equivalent to 'full'. Neither 'full' nor + # 'qr' are used below, but set to 'full' anyway to be sure + mode = 'full' + if not mode in ['full', 'qr', 'r', 'economic']: + raise ValueError(\ + "Mode argument should be one of ['full', 'r', 'economic']") a1 = asarray_chkfinite(a) if len(a1.shape) != 2: @@ -92,7 +92,7 @@ if info < 0: raise ValueError("illegal value in %d-th argument of internal geqrf" % -info) - if not econ or M < N: + if not mode == 'economic' or M < N: R = special_matrices.triu(qr) else: R = special_matrices.triu(qr[0:N, 0:N]) @@ -111,7 +111,7 @@ Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=-1, overwrite_a=1) lwork = work[0] Q, work, info = gor_un_gqr(qr[:,0:M], tau, lwork=lwork, overwrite_a=1) - elif econ: + elif mode == 'economic': # get optimal work array Q, work, info = gor_un_gqr(qr, tau, lwork=-1, overwrite_a=1) lwork = work[0] @@ -201,13 +201,11 @@ lwork : integer Work array size, lwork >= a.shape[1]. If None or -1, an optimal size is computed. - econ : boolean Returns ------- - R : double array, shape (M, N) or (K, N) for econ==True - Size K = min(M, N) - Q : double or complex array, shape (M, M) or (M, K) for econ==True + R : double array, shape (M, N) + Q : double or complex array, shape (M, M) Raises LinAlgError if decomposition fails Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2010-11-29 14:56:59 UTC (rev 6979) +++ trunk/scipy/linalg/tests/test_decomp.py 2010-11-29 14:57:24 UTC (rev 6980) @@ -816,7 +816,7 @@ def test_simple_tall_e(self): # economy version a = [[8,2],[2,9],[5,3]] - q,r = qr(a,econ=True) + q,r = qr(a, mode='economic') assert_array_almost_equal(dot(transpose(q),q),identity(2)) assert_array_almost_equal(dot(q,r),a) assert_equal(q.shape, (3,2)) @@ -852,7 +852,7 @@ n = 100 for k in range(2): a = random([m,n]) - q,r = qr(a,econ=True) + q,r = qr(a, mode='economic') assert_array_almost_equal(dot(transpose(q),q),identity(n)) assert_array_almost_equal(dot(q,r),a) assert_equal(q.shape, (m,n)) From scipy-svn at scipy.org Mon Nov 29 09:57:55 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 08:57:55 -0600 (CST) Subject: [Scipy-svn] r6981 - in trunk: doc/release scipy/sparse scipy/sparse/tests Message-ID: <20101129145755.B7AD537D3C2@scipy.org> Author: rgommers Date: 2010-11-29 08:57:55 -0600 (Mon, 29 Nov 2010) New Revision: 6981 Modified: trunk/doc/release/0.9.0-notes.rst trunk/scipy/sparse/compressed.py trunk/scipy/sparse/construct.py trunk/scipy/sparse/tests/test_construct.py Log: DEP: remove deprecated functions and keywords from sparse module. Modified: trunk/doc/release/0.9.0-notes.rst =================================================================== --- trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:57:24 UTC (rev 6980) +++ trunk/doc/release/0.9.0-notes.rst 2010-11-29 14:57:55 UTC (rev 6981) @@ -138,9 +138,6 @@ The deprecated modules ``helpmod``, ``pexec`` and ``ppimport`` were removed from ``scipy.misc``. -The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has -been deprecated since version 0.7, was removed. - The ``output_type`` keyword in many ``scipy.ndimage`` interpolation functions has been removed. @@ -156,3 +153,18 @@ `std`, `var`, `mean`, `median`, `cov`, `corrcoef`, `z`, `zs`, `stderr`, `samplestd`, `samplevar`, `pdfapprox`, `pdf_moments` and `erfc`. These changes are mirrored in ``scipy.stats.mstats``. + + +``scipy.sparse`` +---------------- + +The ``save`` method of the ``spmatrix`` class in ``scipy.sparse``, which has +been deprecated since version 0.7, was removed. + +The functions ``spkron``, ``speye``, ``spidentity``, ``lil_eye`` and +``lil_diags`` were removed from ``scipy.sparse``. The first three functions +are still available as ``scipy.sparse.kron``, ``scipy.sparse.eye`` and +``scipy.sparse.identity``. + +The `dims` and `nzmax` keywords were removed from the sparse matrix +constructor. Modified: trunk/scipy/sparse/compressed.py =================================================================== --- trunk/scipy/sparse/compressed.py 2010-11-29 14:57:24 UTC (rev 6980) +++ trunk/scipy/sparse/compressed.py 2010-11-29 14:57:55 UTC (rev 6981) @@ -17,17 +17,10 @@ class _cs_matrix(_data_matrix): """base matrix class for compressed row and column oriented matrices""" - def __init__(self, arg1, shape=None, dtype=None, copy=False, dims=None, nzmax=None): + def __init__(self, arg1, shape=None, dtype=None, copy=False): _data_matrix.__init__(self) - if dims is not None: - warn("dims= is deprecated, use shape= instead", DeprecationWarning) - shape=dims - if nzmax is not None: - warn("nzmax= is deprecated", DeprecationWarning) - - if isspmatrix(arg1): if arg1.format == self.format and copy: arg1 = arg1.copy() @@ -483,12 +476,12 @@ indxs = np.where(minor_index == self.indices[start:end])[0] num_matches = len(indxs) - - + + if not np.isscalar(val): raise ValueError('setting an array element with a sequence') - val = self.dtype.type(val) + val = self.dtype.type(val) if num_matches == 0: #entry not already present Modified: trunk/scipy/sparse/construct.py =================================================================== --- trunk/scipy/sparse/construct.py 2010-11-29 14:57:24 UTC (rev 6980) +++ trunk/scipy/sparse/construct.py 2010-11-29 14:57:55 UTC (rev 6981) @@ -449,86 +449,3 @@ vals = np.random.rand(k).astype(dtype) return coo_matrix((vals, (i, j)), shape=(m, n)).asformat(format) -################################# -# Deprecated functions -################################ - -__all__ += [ 'speye','spidentity', 'spkron', 'lil_eye', 'lil_diags' ] - -spkron = np.deprecate(kron, old_name='spkron', new_name='scipy.sparse.kron') -speye = np.deprecate(eye, old_name='speye', new_name='scipy.sparse.eye') -spidentity = np.deprecate(identity, old_name='spidentity', - new_name='scipy.sparse.identity') - - -def lil_eye((r,c), k=0, dtype='d'): - """Generate a lil_matrix of dimensions (r,c) with the k-th - diagonal set to 1. - - Parameters - ---------- - - r,c : int - row and column-dimensions of the output. - k : int - - diagonal offset. In the output matrix, - - out[m,m+k] == 1 for all m. - dtype : dtype - data-type of the output array. - - """ - warn("lil_eye is deprecated." \ - "use scipy.sparse.eye(r, c, k, format='lil') instead", \ - DeprecationWarning) - return eye(r, c, k, dtype=dtype, format='lil') - - -#TODO remove this function -def lil_diags(diags, offsets, (m,n), dtype='d'): - """ - Generate a lil_matrix with the given diagonals. - - Parameters - ---------- - diags : list of list of values e.g. [[1,2,3],[4,5]] - values to be placed on each indicated diagonal. - offsets : list of ints - diagonal offsets. This indicates the diagonal on which - the given values should be placed. - (r,c) : tuple of ints - row and column dimensions of the output. - dtype : dtype - output data-type. - - Examples - -------- - - >>> lil_diags([[1,2,3],[4,5],[6]],[0,1,2],(3,3)).todense() - matrix([[ 1., 4., 6.], - [ 0., 2., 5.], - [ 0., 0., 3.]]) - - """ - offsets_unsorted = list(offsets) - diags_unsorted = list(diags) - if len(diags) != len(offsets): - raise ValueError("Number of diagonals provided should " - "agree with offsets.") - - sort_indices = np.argsort(offsets_unsorted) - diags = [diags_unsorted[k] for k in sort_indices] - offsets = [offsets_unsorted[k] for k in sort_indices] - - for i,k in enumerate(offsets): - if len(diags[i]) < m-abs(k): - raise ValueError("Not enough values specified to fill " - "diagonal %s." % k) - - out = lil_matrix((m,n),dtype=dtype) - - from itertools import izip - for k,diag in izip(offsets,diags): - for ix,c in enumerate(xrange(np.clip(k,0,n),np.clip(m+k,0,n))): - out.rows[c-k].append(c) - out.data[c-k].append(diag[ix]) - return out Modified: trunk/scipy/sparse/tests/test_construct.py =================================================================== --- trunk/scipy/sparse/tests/test_construct.py 2010-11-29 14:57:24 UTC (rev 6980) +++ trunk/scipy/sparse/tests/test_construct.py 2010-11-29 14:57:55 UTC (rev 6981) @@ -175,37 +175,6 @@ #TODO test failure cases - def test_lil_diags(self): - assert_array_equal(construct.lil_diags([[1,2,3],[4,5],[6]], - [0,1,2],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - - assert_array_equal(construct.lil_diags([[6],[4,5],[1,2,3]], - [2,1,0],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - - assert_array_equal(construct.lil_diags([[6,7,8],[4,5],[1,2,3]], - [2,1,0],(3,3)).todense(), - [[1,4,6], - [0,2,5], - [0,0,3]]) - - assert_array_equal(construct.lil_diags([[1,2,3],[4,5],[6]], - [0,-1,-2],(3,3)).todense(), - [[1,0,0], - [4,2,0], - [6,5,3]]) - - assert_array_equal(construct.lil_diags([[6,7,8],[4,5]], - [-2,-1],(3,3)).todense(), - [[0,0,0], - [4,0,0], - [6,5,0]]) - def test_rand(self): # Simple sanity checks for sparse.rand for t in [np.float32, np.float64, np.longdouble]: @@ -224,5 +193,6 @@ assert_raises(ValueError, lambda: sprand(5, 10, 1.1)) assert_raises(ValueError, lambda: sprand(5, 10, -0.1)) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Mon Nov 29 18:41:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Nov 2010 17:41:08 -0600 (CST) Subject: [Scipy-svn] r6982 - trunk/scipy/signal/tests Message-ID: <20101129234108.9DD8A3234B@scipy.org> Author: warren.weckesser Date: 2010-11-29 17:41:08 -0600 (Mon, 29 Nov 2010) New Revision: 6982 Modified: trunk/scipy/signal/tests/test_signaltools.py Log: TST: signal: make the decimal precision of the complex tests of the correlate function depend on the data dtype. Modified: trunk/scipy/signal/tests/test_signaltools.py =================================================================== --- trunk/scipy/signal/tests/test_signaltools.py 2010-11-29 14:57:55 UTC (rev 6981) +++ trunk/scipy/signal/tests/test_signaltools.py 2010-11-29 23:41:08 UTC (rev 6982) @@ -1,4 +1,4 @@ -#this program corresponds to special.py + from decimal import Decimal from numpy.testing import TestCase, run_module_suite, assert_equal, \ @@ -12,6 +12,7 @@ from numpy import array, arange import numpy as np + class _TestConvolve(TestCase): def test_basic(self): a = [3,4,5,6,5,4] @@ -293,7 +294,10 @@ class TestWiener(TestCase): def test_basic(self): g = array([[5,6,4,3],[3,5,6,2],[2,3,5,6],[1,6,9,7]],'d') - correct = array([[2.16374269,3.2222222222, 2.8888888889, 1.6666666667],[2.666666667, 4.33333333333, 4.44444444444, 2.8888888888],[2.222222222, 4.4444444444, 5.4444444444, 4.801066874837],[1.33333333333, 3.92735042735, 6.0712560386, 5.0404040404]]) + correct = array([[2.16374269,3.2222222222, 2.8888888889, 1.6666666667], + [2.666666667, 4.33333333333, 4.44444444444, 2.8888888888], + [2.222222222, 4.4444444444, 5.4444444444, 4.801066874837], + [1.33333333333, 3.92735042735, 6.0712560386, 5.0404040404]]) h = signal.wiener(g) assert_array_almost_equal(h,correct,decimal=6) @@ -449,8 +453,11 @@ class TestLinearFilterDecimal(_TestLinearFilter): dt = np.dtype(Decimal) + class _TestCorrelateReal(TestCase): + dt = None + def _setup_rank1(self): # a.size should be greated than b.size for the tests a = np.linspace(0, 3, 4).astype(self.dt) @@ -568,6 +575,7 @@ assert_array_almost_equal(y, y_r) self.assertTrue(y.dtype == self.dt) + def _get_testcorrelate_class(i, base): class TestCorrelateX(base): dt = i @@ -580,9 +588,19 @@ cls = _get_testcorrelate_class(i, _TestCorrelateReal) globals()[cls.__name__] = cls + class _TestCorrelateComplex(TestCase): + + # The numpy data type to use. dt = None + + # The decimal precision to be used for comparing results. + # This value will be passed as the 'decimal' keyword argument of + # assert_array_almost_equal(). + decimal = None + def _setup_rank1(self, mode): + np.random.seed(9) a = np.random.randn(10).astype(self.dt) a += 1j * np.random.randn(10).astype(self.dt) b = np.random.randn(8).astype(self.dt) @@ -597,19 +615,19 @@ def test_rank1_valid(self): a, b, y_r = self._setup_rank1('valid') y = correlate(a, b, 'valid', old_behavior=False) - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_same(self): a, b, y_r = self._setup_rank1('same') y = correlate(a, b, 'same', old_behavior=False) - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank1_full(self): a, b, y_r = self._setup_rank1('full') y = correlate(a, b, 'full', old_behavior=False) - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) def test_rank3(self): @@ -624,28 +642,28 @@ correlate(a.imag, b.real, old_behavior=False)) y = correlate(a, b, 'full', old_behavior=False) - assert_array_almost_equal(y, y_r, decimal=4) + assert_array_almost_equal(y, y_r, decimal=self.decimal-1) self.assertTrue(y.dtype == self.dt) @dec.deprecated() def test_rank1_valid_old(self): a, b, y_r = self._setup_rank1('valid') y = correlate(b, a.conj(), 'valid') - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) @dec.deprecated() def test_rank1_same_old(self): a, b, y_r = self._setup_rank1('same') y = correlate(b, a.conj(), 'same') - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) @dec.deprecated() def test_rank1_full_old(self): a, b, y_r = self._setup_rank1('full') y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r) + assert_array_almost_equal(y, y_r, decimal=self.decimal) self.assertTrue(y.dtype == self.dt) @dec.deprecated() @@ -661,13 +679,20 @@ correlate(a.imag, b.real, old_behavior=False)) y = correlate(b, a.conj(), 'full') - assert_array_almost_equal(y, y_r, decimal=4) + assert_array_almost_equal(y, y_r, decimal=self.decimal-1) self.assertTrue(y.dtype == self.dt) -for i in [np.csingle, np.cdouble, np.clongdouble]: + +# Create three classes, one for each complex data type: TestCorrelateComplex64, +# TestCorrelateComplex128 and TestCorrelateComplex256. +# The second number in the pairs is used in the 'decimal' keyword argument of +# the array comparisons in the tests. +for i, decimal in [(np.csingle, 5), (np.cdouble, 10), (np.clongdouble, 15)]: cls = _get_testcorrelate_class(i, _TestCorrelateComplex) + cls.decimal = decimal globals()[cls.__name__] = cls + class TestFiltFilt: def test_basic(self): out = signal.filtfilt([1,2,3], [1,2,3], np.arange(12)) From scipy-svn at scipy.org Tue Nov 16 16:18:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 16 Nov 2010 21:18:39 -0000 Subject: [Scipy-svn] r6902 - in trunk/scipy/spatial: . qhull qhull/src Message-ID: <20101116211838.EF95C37A18D@scipy.org> Author: ptvirtan Date: 2010-11-16 15:18:37 -0600 (Tue, 16 Nov 2010) New Revision: 6902 Added: trunk/scipy/spatial/qhull/src/libqhull.c trunk/scipy/spatial/qhull/src/libqhull.h trunk/scipy/spatial/qhull/src/random.c trunk/scipy/spatial/qhull/src/random.h trunk/scipy/spatial/qhull/src/rboxlib.c trunk/scipy/spatial/qhull/src/usermem.c trunk/scipy/spatial/qhull/src/userprintf.c Removed: trunk/scipy/spatial/qhull/REGISTER.txt trunk/scipy/spatial/qhull/index.htm trunk/scipy/spatial/qhull/src/qconvex.c trunk/scipy/spatial/qhull/src/qdelaun.c trunk/scipy/spatial/qhull/src/qhalf.c trunk/scipy/spatial/qhull/src/qhull.c trunk/scipy/spatial/qhull/src/qhull_interface.cpp trunk/scipy/spatial/qhull/src/qvoronoi.c trunk/scipy/spatial/qhull/src/rbox.c trunk/scipy/spatial/qhull/src/unix.c trunk/scipy/spatial/qhull/src/user_eg.c trunk/scipy/spatial/qhull/src/user_eg2.c Modified: trunk/scipy/spatial/SConscript trunk/scipy/spatial/qhull/Announce.txt trunk/scipy/spatial/qhull/COPYING.txt trunk/scipy/spatial/qhull/README.txt trunk/scipy/spatial/qhull/src/Changes.txt trunk/scipy/spatial/qhull/src/geom.c trunk/scipy/spatial/qhull/src/geom.h trunk/scipy/spatial/qhull/src/geom2.c trunk/scipy/spatial/qhull/src/global.c trunk/scipy/spatial/qhull/src/io.c trunk/scipy/spatial/qhull/src/io.h trunk/scipy/spatial/qhull/src/mem.c trunk/scipy/spatial/qhull/src/mem.h trunk/scipy/spatial/qhull/src/merge.c trunk/scipy/spatial/qhull/src/merge.h trunk/scipy/spatial/qhull/src/poly.c trunk/scipy/spatial/qhull/src/poly.h trunk/scipy/spatial/qhull/src/poly2.c trunk/scipy/spatial/qhull/src/qhull.h trunk/scipy/spatial/qhull/src/qhull_a.h trunk/scipy/spatial/qhull/src/qset.c trunk/scipy/spatial/qhull/src/qset.h trunk/scipy/spatial/qhull/src/stat.c trunk/scipy/spatial/qhull/src/stat.h trunk/scipy/spatial/qhull/src/user.c trunk/scipy/spatial/qhull/src/user.h trunk/scipy/spatial/setup.py Log: ENH: spatial: upgrade bundled Qhull to version 2010.1 Modified: trunk/scipy/spatial/SConscript =================================================================== --- trunk/scipy/spatial/SConscript 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/SConscript 2010-11-16 21:18:37 UTC (rev 6902) @@ -36,8 +36,9 @@ # Build qhull src = [join('qhull', 'src', s) for s in [ - 'geom.c', 'geom2.c', 'global.c', 'io.c', 'mem.c', - 'merge.c', 'poly.c', 'poly2.c', 'qset.c', 'user.c', - 'stat.c', 'qhull.c']] + 'geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', + 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', + 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c', + 'userprintf.c']] env.NumpyPythonExtension('qhull', source = ['qhull.c'] + src) Modified: trunk/scipy/spatial/qhull/Announce.txt =================================================================== --- trunk/scipy/spatial/qhull/Announce.txt 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/Announce.txt 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,16 +1,17 @@ - Qhull 2003.1 2003/12/30 + Qhull 2010.1 2010/01/14 http://www.qhull.org - http://savannah.nongnu.org/projects/qhull/ + git at gitorious.org:qhull/qhull.git + http://packages.debian.org/sid/libqhull5 http://www6.uniovi.es/ftp/pub/mirrors/geom.umn.edu/software/ghindex.html http://www.geomview.org http://www.geom.uiuc.edu -Qhull computes convex hulls, Delaunay triangulations, Voronoi diagrams, -furthest-site Voronoi diagrams, and halfspace intersections about a point. -It runs in 2-d, 3-d, 4-d, or higher. It implements the Quickhull algorithm -for computing convex hulls. Qhull handles round-off errors from floating +Qhull computes convex hulls, Delaunay triangulations, Voronoi diagrams, +furthest-site Voronoi diagrams, and halfspace intersections about a point. +It runs in 2-d, 3-d, 4-d, or higher. It implements the Quickhull algorithm +for computing convex hulls. Qhull handles round-off errors from floating point arithmetic. It can approximate a convex hull. The program includes options for hull volume, facet area, partial hulls, @@ -20,7 +21,8 @@ To download Qhull: http://www.qhull.org/download - http://savannah.nongnu.org/files/?group=qhull + git at gitorious.org:qhull/qhull.git + http://packages.debian.org/sid/libqhull5 Download qhull-96.ps for: @@ -28,7 +30,7 @@ Quickhull Algorithm for Convex Hulls," ACM Trans. on Mathematical Software, 22(4):469-483, Dec. 1996. http://www.acm.org/pubs/citations/journals/toms/1996-22-4/p469-barber/ - http://citeseer.nj.nec.com/83502.html + http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.117.405 Abstract: @@ -38,7 +40,7 @@ Beneath-Beyond Algorithm. It is similar to the randomized, incremental algorithms for convex hull and Delaunay triangulation. We provide empirical evidence that the algorithm runs faster when the input contains non-extreme -points, and that it uses less memory. +points, and that it uses less memory. Computational geometry algorithms have traditionally assumed that input sets are well behaved. When an algorithm is implemented with floating point @@ -46,5 +48,5 @@ a solution to this problem when computing the convex hull in two, three, or four dimensions. The output is a set of "thick" facets that contain all possible exact convex hulls of the input. A variation is effective in five -or more dimensions. +or more dimensions. Modified: trunk/scipy/spatial/qhull/COPYING.txt =================================================================== --- trunk/scipy/spatial/qhull/COPYING.txt 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/COPYING.txt 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,4 +1,9 @@ - Qhull, Copyright (c) 1993-2003 + Qhull, Copyright (c) 1993-2010 + + C.B. Barber + Arlington, MA + + and The National Science and Technology Research Center for Computation and Visualization of Geometric Structures @@ -7,9 +12,9 @@ email: qhull at qhull.org -This software includes Qhull from The Geometry Center. Qhull is -copyrighted as noted above. Qhull is free software and may be obtained -via http from www.qhull.org. It may be freely copied, modified, +This software includes Qhull from C.B. Barber and The Geometry Center. +Qhull is copyrighted as noted above. Qhull is free software and may +be obtained via http from www.qhull.org. It may be freely copied, modified, and redistributed under the following conditions: 1. All copyright notices must remain intact in all files. @@ -31,4 +36,3 @@ provided solely "as is". Bug reports or fixes may be sent to qhull_bug at qhull.org; the authors may or may not act on them as they desire. - Modified: trunk/scipy/spatial/qhull/README.txt =================================================================== --- trunk/scipy/spatial/qhull/README.txt 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/README.txt 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,23 +1,25 @@ Name - qhull, rbox 2003.1 2003/12/30 + qhull, rbox 2010.1 2010/01/14 Convex hull, Delaunay triangulation, Voronoi diagrams, Halfspace intersection Documentation: html/index.htm + http://www.qhull.org/html Available from: - + + + News and a paper: + + + Version 1 (simplicial only): - - News and a paper: - - Purpose @@ -34,13 +36,16 @@ Qhull produces graphical output for Geomview. This helps with understanding the output. - Environment requirements Qhull and rbox should run on all 32-bit and 64-bit computers. Use an ANSI C or C++ compiler to compile the program. The software is - self-contained. + self-contained. It comes with examples and test scripts. + Qhull's C++ interface uses the STL. The C++ test program uses QTestLib + from Nokia's Qt Framework. For 2010, Qhull's C++ interface + may change without notice. + Qhull is copyrighted software. Please read COPYING.txt and REGISTER.txt before using or distributing Qhull. @@ -52,49 +57,95 @@ To contribute to Qhull - Qhull is on Savannah at http://savannah.nongnu.org/projects/qhull/ + Qhull is on Gitorious (http://gitorious.org:qhull, git at gitorious.org:qhull/qhull.git) + + For internal documentation, see html/qh-code.htm -Qhull on Windows 95, 98, ME, NT, 2000, XP +----------------- +Installing Qhull on Windows The zip file contains rbox.exe, qhull.exe, qconvex.exe, qdelaunay.exe, - qhalf.exe, qvoronoi.exe, documentation files, and source files. + qhalf.exe, qvoronoi.exe, user_eg3.exe, documentation files, and source files. To install Qhull: - Unzip the files into a directory. You may use WinZip32 - Click on QHULL-GO + - If you use qhull a lot, consider using + Road Bash (www.qhull.org/bash) or Cygwin (www.cygwin.com), - In Windows 95, the DOS window needs improvement. - Increase the size of the screen font to 8x12. - If the text is too dim, fix the screen colors with shareware (e.g., crt.exe) - - If you use qhull a lot, consider using the Cygwin Unix shell (www.cygwin.com), To learn about Qhull: - Execute 'qconvex' for a synopsis and examples. - Execute 'rbox 10 | qconvex' to compute the convex hull of 10 random points. - Execute 'rbox 10 | qconvex i TO file' to write results to 'file'. - - If an error occurs, Windows 95 sends the error to stdout instead of stderr - - use 'TO xxx' to send normal output to xxx and error output to stdout - Browse the documentation: qhull\html\index.htm + - If an error occurs, Windows sends the error to stdout instead of stderr. + Use 'TO xxx' to send normal output to xxx and error output to stdout -Compiling with cygwin on Windows NT, 2000, XP - - install cygwin [www.cygwin.com] with gcc, make, ar, and ln +----------------- +Installing Qhull on Unix with gcc + + The tgz tarball contains documentation and source files. + + To install Qhull + - Extract the files - cd qhull/src - - make -f Makefile.txt + - make + - or, make -f Makefile.txt -Qhull on Unix (Debian) +----------------- +Installing Qhull with Autoconf - The gzip file, qhull.tar.gz, contains documentation and source files for - qhull and rbox. It should compile on all Unix systems, including Debian. - You may also use the source instructions below. + The tar.gz tarball contains documentation, source files, + and a config directory [R. Laboissiere]. - To unpack the gzip file - - tar zxf qhull.tar.gz - - cd qhull - - Compile with the configure Makefile [R. Laboissiere]: + To install Qhull + - Extract the files - ./configure - make + - make install +----------------- +Compiling Qhull with Qt + + Qt is a C++ framework for Windows, Linux, and Macintosh + + Qhull includes a C++ test using Qt's QTestLib + + To compile Qhull + - Download the Qt SDK from Nokia (http://qt.nokia.com/downloads) + - Start Qt Creator + - Load project/qhull-all.pro + - Build all + +----------------- +Compiling Qhull on Windows. + + To compile Qhull with Visual C++ + - Load solution project/qhull.sln + - For project qhulltest, + install Qt for DevStudio (http://qt.nokia.com/downloads) + - Build->Build all + + To compile Qhull with MINGW + - Install Road Bash (http://www.qhull.org/bash) + - or install MSYS (http://www.mingw.org/wiki/msys) + - Install MINGW (http://www.mingw.org/) + - cd src + - make + - or, make -f Makefile.txt + + To compile Qhull with cygwin + - Install cygwin (http://www.cygwin.com) + - Include packages for gcc, make, ar, and ln + - cd src + - make + - or, make -f Makefile.txt + +----------------- Compiling the source distribution The gzip file, qhull-src.tgz, contains documentation and source files for @@ -104,7 +155,7 @@ - tar zxf qhull-src.tgz - cd qhull - Compiling with Makefile (i.e., Makefile.txt) + Compiling qhull and rbox with Makefile (i.e., Makefile.txt) - cd src - in Makefile, check the CC, CCOPTS1, PRINTMAN, and PRINTC defines - the defaults are gcc and enscript @@ -122,8 +173,10 @@ - this is ok, your compiler should have these in stdio.h - if your compiler warns about missing prototypes for memset() etc. - include memory.h in qhull_a.h - - if your compiler is gcc-2.95.1, you need to set flag -fno-strict-aliasing. - - This flag is set by default for other versions [Karas, Krishnaswami] + - if your compiler is gcc-4.3, 4.2, 4.1 or 2.95.1, set flag -fno-strict-aliasing. + - This flag is set by default for other versions up to 4.0 [Karas, Krishnaswami] + - strict-aliasing appears to work ok for gcc-4.4 + - See news/qhull-news.html#bugs for details - if your compiler reports "global.c: storage size of 'qh_qh' isn't known" - delete the initializer "={0}" in global.c, stat.c and mem.c - if your compiler warns about "stat.c: improper initializer" @@ -133,7 +186,7 @@ - if the code compiles, the qhull test case will automatically execute - if an error occurs, there's an incompatibility between machines - For gcc-2.95.1, you need to set flag -fno-strict-aliasing. - It is set by default for other versions of gcc [Karas, Krishnaswami] + It is set by default for other versions of gcc [Karas, Krishnaswami] - If you can, try a different compiler - You can turn off the Qhull memory manager with qh_NOmem in mem.h - You can turn off compiler optimization (-O2 in Makefile) @@ -145,52 +198,86 @@ - define MANDIR and BINDIR - type 'make install' -Compiling on Windows 95, 98, NT, 2000, XP +If you need to create a custom build, create projects as follows. +These instructions assume Visual C++, but similar ones apply to other +build systems. - Qhull compiles as a console application in Visual C++ 5.0 at warning - level 3. + For qhull.exe and rbox.exe only: + - create a "console application" called "qhull" + - add the following files: + geom.c geom2.c global.c io.c libqhull.c mem.c merge.c + poly.c poly2.c qset.c random.c stat.c unix.c + user.c usermem.c userprintf.c + - create a "console application" called "rbox" + - add rbox.c rboxlib.c - Visual C++ quickstart for qhull.exe only: - - create a "Win32 console application" called "qhull" - - add the following files: - geom.c geom2.c global.c io.c mem.c merge.c poly.c poly2.c qhull.c - qset.c stat.c unix.c user.c - - create a "Win32 console application" called "rbox" - - add rbox.c - - Visual C++ quickstart for qhull library, qhull.exe, qconvex.exe, etc. + For all projects - To simplify setting up lots of projects, - - create a temporary "Win32 console application" called "source" - - add all .c files from .../src/... - - In Tools::Options::Tab - Set tab size to 8 and indent size to 2 + - create a temporary "Win32 console application" called "source" + - add all .c files from .../src/... + - add all .cpp files from .../cpp/... + - In Tools::Options::Tab + Set tab size to 8 and indent size to 2 - create a "Win32 console application" called "rbox" - - move rbox.c from "qhull source" - - for Project:Settings..., Link - you only need the default libraries - - build the project + - move rbox.c rboxlib.c from "qhull source" + - for Project:Settings..., Link + you only need the default libraries + - build the project - - create a "Win32 static library" called "library" - - move these files from "qhull source" - geom.c geom2.c global.c io.c mem.c merge.c poly.c poly2.c qhull.c - qset.c stat.c user.c - - set the library file (use the same for debug and release) - - build the project + - create a "Win32 static library" called "libqhull" + - move these files from "qhull source" + geom.c geom2.c global.c io.c mem.c merge.c poly.c poly2.c libqhull.c + qset.c random.c rboxlib.c stat.c user.c usermem.c userprintf.c + - set the library file (use the same for debug and release) + - build the project - - create a "Win32 console application" called "qhull" - - Move unix.c from "qhull source" - - Add the library file created by "library" - - Qhull does not use other libraries + - create a "Win32 static library" called "libqhullp" + - move these files from "qhull source" + geom.c geom2.c global.c io.c mem.c merge.c poly.c poly2.c libqhull.c + qset.c random.c rboxlib.c stat.c user.c usermem.c userprintf.c + - define qh_QHpointer=1 + - set the library file (use the same for debug and release) + - build the project - - create a "Win32 console application" called "qconvex" - - Move qconvex.c from "qhull source" - - Copy the library file from "qhull" + - create a "Win32 console application, empty project" called "qhull" + - Move unix.c from "qhull source" + - Project Dependency on libqhull (or copy the library file) + - Linker->Input->Ignore LIBCMT + - Qhull does not use other libraries + - create a "Win32 console application, empty project" called "qconvex" + - Move qconvex.c from "qhull source" + - Project Dependency on libqhull (or copy the library file) + - Linker->Input->Ignore LIBCMT + - build the project + - do the same for qdelaun.c, qhalf, qvoronoi.c, user_eg.c, user_eg2.c - - delete "qhull sources" since it is no longer needed - - use Project:Settings to make any changes - - use batch build to rebuild everything + + - create a "Win32 dynamic library" called "libqhullcpp" + - Move cpp sources in cpp/*.cpp from "qhull source" + Do not move cpp/qhulltest, road/RoadTest.cpp, or user_eg3.cpp + - define qh_QHpointer=1 + - Add the library file created by "libqhullp" + - build the project + + - create a "Win32 console application" called "user_eg3" + - Move user_eg3 from "qhull source" + - define qh_QHpointer=1 + - Add the library file created by "libqhullcpp" + - build the project + + - create a "Win32 console application" called "qhulltest" + - Install Qt for DevStudio (http://qt.nokia.com/downloads) + - Add everything in cpp/qhulltest + - Add road/RoadTest.cpp + - define qh_QHpointer=1 + - Add the library file created by "libqhullcpp" + - build the project + + - use Project:Settings to make any changes + - use batch build to rebuild everything + - delete "qhull sources" since it is no longer needed Qhull compiles with Borland C++ 5.0 bcc32. A Makefile is included. Execute 'make -f Mborland'. If you use the Borland IDE, set the ANSI @@ -216,11 +303,6 @@ Windows 95'. Instead of using SIOUX, Qhull may be embedded within an application. - Version 1 is available for Macintosh computers by download of qhull.sit.hqx - It reads point coordinates from a standard file and returns output - to a standard file. There is no graphical output. - - Compiling on other machines Some users have reported problems with compiling Qhull under Irix 5.1. It @@ -232,23 +314,35 @@ You may compile Qhull with a C++ compiler. +----------------- Distributed files README.txt // instructions for installing Qhull REGISTER.txt // Qhull registration COPYING.txt // copyright notice - QHULL-GO.pif // Windows icon for qhull-go.bat + QHULL-GO.pif // Windows icon for qhull-go.bat Announce.txt // announcement - Changes.txt // change history for Qhull and rbox - File_id.diz // package descriptor + CMakeLists.txt // CMake file + File_id.diz // package descriptor index.htm // Home page + qhull*.md5sum // md5sum for all files html/qh-faq.htm // Frequently asked questions html/qh-get.htm // Download page html/index.htm // Manual + src/Changes.txt // change history for Qhull and rbox + src/CMakeLists.txt // CMake file src/Makefile.txt // Makefile for Unix or cygwin 'make' src/Mborland // Makefile for Borland C++/Win32 src/Make-config.sh // Create Debian configure and automake - + project/qhull-all.pro // Qt project with Visual C++ vcproj files + +eg/ + q_eg // shell script for Geomview examples + q_egtest // shell script for Geomview test examples + q_test // shell script to test qhull + q_test-ok.txt // output from q_test + qhulltest-ok.txt // output from qhulltest (Qt only) + src/ rbox consists of: rbox.exe // Win32 executable (.zip only) @@ -256,6 +350,7 @@ rbox.man // Unix man page rbox.txt rbox.c // source program + rboxlib.c qhull consists of: qhull.exe // Win32 executables (.zip only) @@ -263,7 +358,7 @@ qdelaunay.exe qhalf.exe qvoronoi.exe - qhull-go.bat // DOS window + eg/qhull-go.bat // DOS window qconvex.htm // html manuals qdelaun.htm qdelau_f.htm @@ -271,35 +366,37 @@ qvoronoi.htm qvoron_f.htm qh-eg.htm + qh-code.htm qh-impre.htm - qh-in.htm index.htm qh-opt*.htm qh-quick.htm qh--4d.gif,etc. // images for manual qhull.man // Unix man page qhull.txt - q_eg // shell script for Geomview examples - q_egtest // shell script for Geomview test examples - q_test // shell script to test qhull top-level source files: src/index.htm // index to source files qh-...htm // specific files user.h // header file of user definable constants - qhull.h // header file for qhull + libqhull.h // header file for qhull unix.c // Unix front end to qhull - qhull.c // Quickhull algorithm with partitioning + qconvex.c + qhalf.c + qdelaunay.c + qvoronoi.c + libqhull.c // Quickhull algorithm with partitioning user.c // user re-definable functions + usermem.c + userprintf.c user_eg.c // example of incorporating qhull into a user program user_eg2.c // more complex example - qhull_interface.cpp // call Qhull from C++ other source files: qhull_a.h // include file for *.c geom.c // geometric routines geom2.c - geom.h + geom.h global.c // global variables io.c // input-output routines io.h @@ -315,14 +412,105 @@ stat.c // statistics stat.h +project/ + projects for building Qhull + qhull.sln // Solution for Visual C++ 2005 and higher + qhull-all.pro // Project for Qt + */*.pro // Qt projects for each component + *.vcproj // Visual C++ projects + +cpp/ + cpp interface to Qhull + Qhull.cpp // calls libqhull.c + Qhull.h + user_eg3.cpp // sample program + + input classes + Coordinates.cpp + Coordinates.h + PointCoordinates.cpp + PointCoordinates.h + PointIterator.h + RboxPoints.cpp // calls rboxlib.c + RboxPoints.h + + data structure classes + QhullFacet.cpp + QhullFacet.h + QhullHyperplane.cpp + QhullHyperplane.h + QhullPoint.cpp + QhullPoint.h + QhullQh.cpp + QhullQh.h + QhullStat.cpp + QhullStat.h + + collection classes + QhullFacetList.cpp + QhullFacetList.h + QhullFacetSet.cpp + QhullFacetSet.h + QhullIterator.h + QhullLinkedList.h + QhullPoints.cpp + QhullPoints.h + QhullPointSet.cpp + QhullPointSet.h + QhullRidge.cpp + QhullRidge.h + QhullSet.cpp + QhullSet.h + QhullSets.h + + supporting classes + functionObjects.h + QhullError.cpp + QhullError.h + QhullEvent.cpp + QhullEvent.h + QhullLog.cpp + QhullLog.h + UsingLibQhull.cpp + UsingLibQhull.h + +cpp/qhulltest/ + Tests for each class + Coordinates_test.cpp + PointCoordinates_test.cpp + Point_test.cpp + QhullFacetList_test.cpp + QhullFacetSet_test.cpp + QhullFacet_test.cpp + QhullHyperplane_test.cpp + QhullLinkedList_test.cpp + QhullPointSet_test.cpp + QhullPoints_test.cpp + QhullPoint_test.cpp + QhullRidge_test.cpp + QhullSet_test.cpp + qhulltest.cpp + QhullVertexSet_test.cpp + QhullVertex_test.cpp + Qhull_test.cpp + RboxPoints_test.cpp + UsingLibQhull_test.cpp + +cpp/road/ + Supporting base classes + RoadError.cpp + RoadError.h + RoadLogEvent.cpp + RoadLogEvent.h + RoadTest.cpp + RoadTest.h + +----------------- Authors: C. Bradford Barber Hannu Huhdanpaa - bradb at qhull.org hannu at qhull.org + bradb at shore.net hannu at qhull.org - The Geometry Center - University of Minnesota - Qhull 1.0 and 2.0 were developed under NSF grants NSF/DMS-8920161 and NSF-CCR-91-15793 750-7504 at the Geometry Center and Harvard University. If you find Qhull useful, please let us know. Deleted: trunk/scipy/spatial/qhull/REGISTER.txt =================================================================== --- trunk/scipy/spatial/qhull/REGISTER.txt 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/REGISTER.txt 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,37 +0,0 @@ -Dear User of Geometry Center Software: - -We would like to find out how you are using our software. Think of -Geometry Center software as a new kind of shareware: you share your -science and successes with us, and we share our software and support -with you. - -If you use Geometry Center software, please send us a note telling -us what you are doing with it. - -We need to know: - - (1) What you are working on - an abstract of your work would be - fine. - - (2) What Geometry Center software you use. - - (3) How that software has helped you, for example, by increasing - your productivity or allowing you to do things you could not do - before. In particular, if you feel that Geometry Center - software has had a direct bearing on your work, please tell us - about this. - -We encourage you to cite the use of any Geometry Center software you -have used in your publications. - -To cite Qhull, please use - - Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., "The Quickhull - algorithm for convex hulls," ACM Trans. on Mathematical Software, - 22(4):469-483, Dec 1996, http://www.qhull.org. - -Please send e-mail to - - qhull at qhull.org - -Thank you! Deleted: trunk/scipy/spatial/qhull/index.htm =================================================================== --- trunk/scipy/spatial/qhull/index.htm 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/index.htm 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,252 +0,0 @@ - - - - -Qhull for Convex Hull, Delaunay Triangulation, Voronoi Diagram, and Halfspace Intersection about a Point - - - - -URL: http://www.qhull.org -
To: -News -• Download -• CiteSeer -• Images -• Manual -• FAQ -• Programs -• Options -

- -
- - -
-

Qhull

- [CONE] -
-Qhull computes convex hulls, Delaunay triangulations, -halfspace intersections about a point, Voronoi diagrams, furthest-site Delaunay -triangulations, and furthest-site Voronoi diagrams. It runs in -2-d, 3-d, 4-d, and higher dimensions. It implements the Quickhull -algorithm for computing the convex hull. Qhull handles roundoff -errors from floating point arithmetic. It computes volumes, -surface areas, and approximations to the convex hull.

- - -

Qhull does not support constrained Delaunay -triangulations, triangulation of non-convex surfaces, mesh -generation of non-convex objects, or medium-sized inputs in 9-D -and higher.

-
- -
-
- - - -
- -

Introduction -

- -

Qhull Documentation and Support -

- -

Related URLs -

- -

FAQs and Newsgroups -

- -
- -

The program includes options for input transformations, -randomization, tracing, multiple output formats, and execution -statistics. The program can be called from within your -application.

- -

You can view the results in 2-d, 3-d and 4-d with Geomview. An alternative -is VTK.

- -

For an article about Qhull, download from CiteSeer or www.acm.org: -

- -
-

Barber, C.B., Dobkin, D.P., and Huhdanpaa, H.T., "The - Quickhull algorithm for convex hulls," ACM Trans. on - Mathematical Software, 22(4):469-483, Dec 1996, http://www.qhull.org.

-
- -

Abstract:

- -
-

The convex hull of a set of points is the smallest convex - set that contains the points. This article presents a - practical convex hull algorithm that combines the - two-dimensional Quickhull Algorithm with the general - dimension Beneath-Beyond Algorithm. It is similar to the - randomized, incremental algorithms for convex hull and - Delaunay triangulation. We provide empirical evidence that - the algorithm runs faster when the input contains non-extreme - points, and that it uses less memory.

-

Computational geometry algorithms have traditionally - assumed that input sets are well behaved. When an algorithm - is implemented with floating point arithmetic, this - assumption can lead to serious errors. We briefly describe a - solution to this problem when computing the convex hull in - two, three, or four dimensions. The output is a set of - "thick" facets that contain all possible exact convex hulls - of the input. A variation is effective in five or more - dimensions.

-
- -
- -

Up: Past Software -Projects of the Geometry Center
-URL: http://www.qhull.org -
To: -News -• Download -• CiteSeer -• Images -• Manual -• FAQ -• Programs -• Options -

- -
- -

[HOME] The Geometry Center Home Page

- -

Comments to: qhull at qhull.org -
-Created: May 17 1995 --- - - Modified: trunk/scipy/spatial/qhull/src/Changes.txt =================================================================== --- trunk/scipy/spatial/qhull/src/Changes.txt 2010-11-14 21:38:04 UTC (rev 6901) +++ trunk/scipy/spatial/qhull/src/Changes.txt 2010-11-16 21:18:37 UTC (rev 6902) @@ -1,24 +1,278 @@ .............This file lists all changes to qhull and rbox..................... +------------ +Need help + - The C++ interface needs work. Give it a try and make it better. + http://gitorious.org/qhull/ + - Produce conformant triangulations for merged facets using option 'Qt' + - Add CMakeLists.txt for qhullcpp, user_eg3, cpp/, and cpp/road + If practical, please move to project/ + - Verify -fno-strict-aliasing needed for gcc 4.1, 4.2, and 4.3 (qset segfault) + - Set up debian build [Pkg-octave-devel] + Please keep debian files in config/ and project/debian/ + Branch 'debian' is from http://savannah.nongnu.org/cvs/?group=qhull + project/debian needs updating for its new location. It was at qhull's level. + +To do + - Review email for doc changes + - RMP build of Qhull + +------------ +qhull 2010.1 2010/01/14 +- Fixed quote for #include in qhull.h [U.Hergenhahn, K.Roland] +- Add qt-qhull.cpp with Qt conditional code +- Add libqhullp.proj +- Add libqhull5 to Readme, Announce, download +- Reviewed #pragma +- Reviewed FIXUP and assigned QH tags +- All projects compile with warnings enabled +- Replaced 'up' glyphs with » +- Moved cpp questions to qh-code.htm#questions-cpp +- Moved suggestions to qh-code.htm#enhance +- Moved documentation requests to qh-code.htm#enhance +- Add md5sum file to distributions +- Switched to DevStudio builds to avoid dependent libraries, 10% slower + Removed user_eg3.exe and qhullcpp.dll from Windows build + Fix qhull.sln and project files for qh_QHpointer +- Add eg/qhull-zip.sh to build qhull distribution files + +------------ +qhull 2010.1 2010/01/10 +- Test for NULL fp in qh_eachvoronoi [D. Szczerba] + +qhull 2010.1 2010/01/09 + +Changes to build and distribution +- Use qh_QHpointer=0 for libqhull.a, qhull, rbox, etc. + Use -Dqh_QHpointer for libqhullp.a, qhullcpp.dll, etc. + qh_QHpointer costs: [2010, gcc] 4% time 4% space, [2003, msvc] 8% time 2% space +- Add config/ and project/debian/ for Autoconf build [R. Laboissiere] + from debian branch in git and http://savannah.nongnu.org/cvs/?group=qhull +- Add CMakeLists.txt [kwilliams] +- Fix tabs in Makefile.txt [mschamschula] +- Add -fno-strict-aliasing to Makefile for gcc 4.1, 4.2, and 4.3 qset segfault +- Remove user_eg.exe and user_eg2.exe from Windows distribution +- Order object files by frequency of execution for better locality. + +Changes to source +- Remove ptr_intT from qh_matchvertices. It was int since the beginning. +- user.h requires for CLOCKS_PER_SEC +- Move ostream<

  ---------------------------------
 
-   geom.c 
+   geom.c
    geometric routines of qhull
 
    see qh-geom.htm and geom.h
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/geom.c#29 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 
    infrequent code goes into geom2.c
 */
-   
+
 #include "qhull_a.h"
-   
+
 /*---------------------------------
-  
+
   qh_distplane( point, facet, dist )
     return distance from point to facet
 
   returns:
     dist
     if qh.RANDOMdist, joggles result
-  
-  notes:  
+
+  notes:
     dist > 0 if point is above facet (i.e., outside)
-    does not error (for sortfacets)
-    
+    does not error (for qh_sortfacets, qh_outerinner)
+
   see:
     qh_distnorm in geom2.c
+    qh_distplane [geom.c], QhullFacet::distance, and QhullHyperplane::distance are copies
 */
-void qh_distplane (pointT *point, facetT *facet, realT *dist) {
+void qh_distplane(pointT *point, facetT *facet, realT *dist) {
   coordT *normal= facet->normal, *coordp, randr;
   int k;
-  
-  switch(qh hull_dim){
+
+  switch (qh hull_dim){
   case 2:
     *dist= facet->offset + point[0] * normal[0] + point[1] * normal[1];
     break;
@@ -50,7 +53,7 @@
   case 6:
     *dist= facet->offset+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4]+point[5]*normal[5];
     break;
-  case 7:  
+  case 7:
     *dist= facet->offset+point[0]*normal[0]+point[1]*normal[1]+point[2]*normal[2]+point[3]*normal[3]+point[4]*normal[4]+point[5]*normal[5]+point[6]*normal[6];
     break;
   case 8:
@@ -59,7 +62,7 @@
   default:
     *dist= facet->offset;
     coordp= point;
-    for (k= qh hull_dim; k--; )
+    for (k=qh hull_dim; k--; )
       *dist += *coordp++ * *normal++;
     break;
   }
@@ -72,9 +75,9 @@
       qh RANDOMfactor * qh MAXabs_coord;
   }
   if (qh IStracing >= 4) {
-    fprintf (qh ferr, "qh_distplane: ");
-    fprintf (qh ferr, qh_REAL_1, *dist);
-    fprintf (qh ferr, "from p%d to f%d\n", qh_pointid(point), facet->id);
+    qh_fprintf(qh ferr, 8001, "qh_distplane: ");
+    qh_fprintf(qh ferr, 8002, qh_REAL_1, *dist);
+    qh_fprintf(qh ferr, 8003, "from p%d to f%d\n", qh_pointid(point), facet->id);
   }
   return;
 } /* distplane */
@@ -82,15 +85,15 @@
 
 /*---------------------------------
-  
+
   qh_findbest( point, startfacet, bestoutside, qh_ISnewfacets, qh_NOupper, dist, isoutside, numpart )
-    find facet that is furthest below a point 
+    find facet that is furthest below a point
     for upperDelaunay facets
       returns facet only if !qh_NOupper and clearly above
 
   input:
     starts search at 'startfacet' (can not be flipped)
-    if !bestoutside (qh_ALL), stops at qh.MINoutside
+    if !bestoutside(qh_ALL), stops at qh.MINoutside
 
   returns:
     best facet (reports error if NULL)
@@ -101,7 +104,7 @@
 
   see also:
     qh_findbestnew()
-    
+
   notes:
     If merging (testhorizon), searches horizon facets of coplanar best facets because
     after qh_distplane, this and qh_partitionpoint are the most expensive in 3-d
@@ -116,11 +119,11 @@
     qh_findbestnew set if qh_sharpnewfacets returns True (to use qh_findbestnew)
     qh.bestfacet_notsharp set if qh_sharpnewfacets returns False
 
-  when called by qh_findfacet(), qh_partitionpoint(), qh_partitioncoplanar(), 
+  when called by qh_findfacet(), qh_partitionpoint(), qh_partitioncoplanar(),
                  qh_check_bestdist(), qh_addpoint()
     indicated by !qh_ISnewfacets
     returns best facet in neighborhood of given facet
-      this is best facet overall if dist > -   qh.MAXcoplanar 
+      this is best facet overall if dist > -   qh.MAXcoplanar
         or hull has at least a "spherical" curvature
 
   design:
@@ -128,15 +131,15 @@
     repeat while there are better facets
       for each neighbor of facet
         exit if outside facet found
-	test for better facet
+        test for better facet
     if point is inside and partitioning
       test for new facets with a "sharp" intersection
       if so, future calls go to qh_findbestnew()
     test horizon facets
 */
-facetT *qh_findbest (pointT *point, facetT *startfacet, 
-		     boolT bestoutside, boolT isnewfacets, boolT noupper,
-		     realT *dist, boolT *isoutside, int *numpart) {
+facetT *qh_findbest(pointT *point, facetT *startfacet,
+                     boolT bestoutside, boolT isnewfacets, boolT noupper,
+                     realT *dist, boolT *isoutside, int *numpart) {
   realT bestdist= -REALmax/2 /* avoid underflow */;
   facetT *facet, *neighbor, **neighborp;
   facetT *bestfacet= NULL, *lastfacet= NULL;
@@ -146,21 +149,21 @@
   boolT testhorizon = True; /* needed if precise, e.g., rbox c D6 | qhull Q0 Tv */
 
   zinc_(Zfindbest);
-  if (qh IStracing >= 3 || (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid (point))) {
+  if (qh IStracing >= 3 || (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid(point))) {
     if (qh TRACElevel > qh IStracing)
       qh IStracing= qh TRACElevel;
-    fprintf (qh ferr, "qh_findbest: point p%d starting at f%d isnewfacets? %d, unless %d exit if > %2.2g\n",
-	     qh_pointid(point), startfacet->id, isnewfacets, bestoutside, qh MINoutside);
-    fprintf(qh ferr, "  testhorizon? %d noupper? %d", testhorizon, noupper);
-    fprintf (qh ferr, "  Last point added was p%d.", qh furthest_id);
-    fprintf(qh ferr, "  Last merge was #%d.  max_outside %2.2g\n", zzval_(Ztotmerge), qh max_outside);
+    qh_fprintf(qh ferr, 8004, "qh_findbest: point p%d starting at f%d isnewfacets? %d, unless %d exit if > %2.2g\n",
+             qh_pointid(point), startfacet->id, isnewfacets, bestoutside, qh MINoutside);
+    qh_fprintf(qh ferr, 8005, "  testhorizon? %d noupper? %d", testhorizon, noupper);
+    qh_fprintf(qh ferr, 8006, "  Last point added was p%d.", qh furthest_id);
+    qh_fprintf(qh ferr, 8007, "  Last merge was #%d.  max_outside %2.2g\n", zzval_(Ztotmerge), qh max_outside);
   }
   if (isoutside)
     *isoutside= True;
   if (!startfacet->flipped) {  /* test startfacet */
     *numpart= 1;
-    qh_distplane (point, startfacet, dist);  /* this code is duplicated below */
-    if (!bestoutside && *dist >= qh MINoutside 
+    qh_distplane(point, startfacet, dist);  /* this code is duplicated below */
+    if (!bestoutside && *dist >= qh MINoutside
     && (!startfacet->upperdelaunay || !noupper)) {
       bestfacet= startfacet;
       goto LABELreturn_best;
@@ -168,63 +171,63 @@
     bestdist= *dist;
     if (!startfacet->upperdelaunay) {
       bestfacet= startfacet;
-    } 
-  }else 
+    }
+  }else
     *numpart= 0;
   startfacet->visitid= visitid;
   facet= startfacet;
   while (facet) {
-    trace4((qh ferr, "qh_findbest: neighbors of f%d, bestdist %2.2g f%d\n", 
+    trace4((qh ferr, 4001, "qh_findbest: neighbors of f%d, bestdist %2.2g f%d\n",
                 facet->id, bestdist, getid_(bestfacet)));
     lastfacet= facet;
     FOREACHneighbor_(facet) {
       if (!neighbor->newfacet && isnewfacets)
         continue;
       if (neighbor->visitid == visitid)
-	continue;
+        continue;
       neighbor->visitid= visitid;
       if (!neighbor->flipped) {  /* code duplicated above */
-	(*numpart)++;
-	qh_distplane (point, neighbor, dist);
-	if (*dist > bestdist) {
-	  if (!bestoutside && *dist >= qh MINoutside 
-	  && (!neighbor->upperdelaunay || !noupper)) {
-	    bestfacet= neighbor;
-	    goto LABELreturn_best;
-	  }
-	  if (!neighbor->upperdelaunay) {
-	    bestfacet= neighbor;
-	    bestdist= *dist;
-	    break; /* switch to neighbor */
-	  }else if (!bestfacet) { 
-	    bestdist= *dist;
-	    break; /* switch to neighbor */
-	  }
-	} /* end of *dist>bestdist */
+        (*numpart)++;
+        qh_distplane(point, neighbor, dist);
+        if (*dist > bestdist) {
+          if (!bestoutside && *dist >= qh MINoutside
+          && (!neighbor->upperdelaunay || !noupper)) {
+            bestfacet= neighbor;
+            goto LABELreturn_best;
+          }
+          if (!neighbor->upperdelaunay) {
+            bestfacet= neighbor;
+            bestdist= *dist;
+            break; /* switch to neighbor */
+          }else if (!bestfacet) {
+            bestdist= *dist;
+            break; /* switch to neighbor */
+          }
+        } /* end of *dist>bestdist */
       } /* end of !flipped */
     } /* end of FOREACHneighbor */
     facet= neighbor;  /* non-NULL only if *dist>bestdist */
   } /* end of while facet (directed search) */
-  if (isnewfacets) { 
+  if (isnewfacets) {
     if (!bestfacet) {
-      bestdist= -REALmax/2; 
-      bestfacet= qh_findbestnew (point, startfacet->next, &bestdist, bestoutside, isoutside, &numpartnew);
+      bestdist= -REALmax/2;
+      bestfacet= qh_findbestnew(point, startfacet->next, &bestdist, bestoutside, isoutside, &numpartnew);
       testhorizon= False; /* qh_findbestnew calls qh_findbesthorizon */
     }else if (!qh findbest_notsharp && bestdist < - qh DISTround) {
-      if (qh_sharpnewfacets()) { 
-	/* seldom used, qh_findbestnew will retest all facets */
-	zinc_(Zfindnewsharp);
-	bestfacet= qh_findbestnew (point, bestfacet, &bestdist, bestoutside, isoutside, &numpartnew);
-	testhorizon= False; /* qh_findbestnew calls qh_findbesthorizon */
-	qh findbestnew= True;
+      if (qh_sharpnewfacets()) {
+        /* seldom used, qh_findbestnew will retest all facets */
+        zinc_(Zfindnewsharp);
+        bestfacet= qh_findbestnew(point, bestfacet, &bestdist, bestoutside, isoutside, &numpartnew);
+        testhorizon= False; /* qh_findbestnew calls qh_findbesthorizon */
+        qh findbestnew= True;
       }else
-	qh findbest_notsharp= True;
+        qh findbest_notsharp= True;
     }
   }
-  if (!bestfacet) 
-    bestfacet= qh_findbestlower (lastfacet, point, &bestdist, numpart);
-  if (testhorizon) 
-    bestfacet= qh_findbesthorizon (!qh_IScheckmax, point, bestfacet, noupper, &bestdist, &numpartnew);
+  if (!bestfacet)
+    bestfacet= qh_findbestlower(lastfacet, point, &bestdist, numpart);
+  if (testhorizon)
+    bestfacet= qh_findbesthorizon(!qh_IScheckmax, point, bestfacet, noupper, &bestdist, &numpartnew);
   *dist= bestdist;
   if (isoutside && bestdist < qh MINoutside)
     *isoutside= False;
@@ -239,14 +242,14 @@
 
 /*---------------------------------
-  
+
   qh_findbesthorizon( qh_IScheckmax, point, startfacet, qh_NOupper, &bestdist, &numpart )
     search coplanar and better horizon facets from startfacet/bestdist
     ischeckmax turns off statistics and minsearch update
     all arguments must be initialized
-  returns (ischeckmax):
+  returns(ischeckmax):
     best facet
-  returns (!ischeckmax):
+  returns(!ischeckmax):
     best facet that is not upperdelaunay
     allows upperdelaunay that is clearly outside
   returns:
@@ -266,7 +269,7 @@
 
     searchdist is qh.max_outside + 2 * DISTround
       + max( MINvisible('Vn'), MAXcoplanar('Un'));
-    This setting is a guess.  It must be at least max_outside + 2*DISTround 
+    This setting is a guess.  It must be at least max_outside + 2*DISTround
     because a facet may have a geometric neighbor across a vertex
 
   design:
@@ -275,12 +278,12 @@
       unless upperdelaunay or clearly outside
          update best facet
 */
-facetT *qh_findbesthorizon (boolT ischeckmax, pointT* point, facetT *startfacet, boolT noupper, realT *bestdist, int *numpart) {
+facetT *qh_findbesthorizon(boolT ischeckmax, pointT* point, facetT *startfacet, boolT noupper, realT *bestdist, int *numpart) {
   facetT *bestfacet= startfacet;
   realT dist;
   facetT *neighbor, **neighborp, *facet;
-  facetT *nextfacet= NULL; /* optimize last facet of coplanarset */
-  int numpartinit= *numpart, coplanarset_size;
+  facetT *nextfacet= NULL; /* optimize last facet of coplanarfacetset */
+  int numpartinit= *numpart, coplanarfacetset_size;
   unsigned int visitid= ++qh visit_id;
   boolT newbest= False; /* for tracing */
   realT minsearch, searchdist;  /* skip facets that are too far from point */
@@ -299,73 +302,73 @@
     /* Always check coplanar facets.  Needed for RBOX 1000 s Z1 G1e-13 t996564279 | QHULL Tv */
     minimize_(minsearch, -searchdist);
   }
-  coplanarset_size= 0;
+  coplanarfacetset_size= 0;
   facet= startfacet;
   while (True) {
-    trace4((qh ferr, "qh_findbesthorizon: neighbors of f%d bestdist %2.2g f%d ischeckmax? %d noupper? %d minsearch %2.2g searchdist %2.2g\n", 
-		facet->id, *bestdist, getid_(bestfacet), ischeckmax, noupper,
-		minsearch, searchdist));
+    trace4((qh ferr, 4002, "qh_findbesthorizon: neighbors of f%d bestdist %2.2g f%d ischeckmax? %d noupper? %d minsearch %2.2g searchdist %2.2g\n",
+                facet->id, *bestdist, getid_(bestfacet), ischeckmax, noupper,
+                minsearch, searchdist));
     FOREACHneighbor_(facet) {
-      if (neighbor->visitid == visitid) 
-	continue;
+      if (neighbor->visitid == visitid)
+        continue;
       neighbor->visitid= visitid;
-      if (!neighbor->flipped) { 
-	qh_distplane (point, neighbor, &dist);
-	(*numpart)++;
-	if (dist > *bestdist) {
-	  if (!neighbor->upperdelaunay || ischeckmax || (!noupper && dist >= qh MINoutside)) {
-	    bestfacet= neighbor;
-	    *bestdist= dist;
-	    newbest= True;
-	    if (!ischeckmax) {
-	      minsearch= dist - searchdist;
-	      if (dist > *bestdist + searchdist) {
-		zinc_(Zfindjump);  /* everything in qh.coplanarset at least searchdist below */
-		coplanarset_size= 0;
-	      }
-	    }
-	  }
-	}else if (dist < minsearch) 
-	  continue;  /* if ischeckmax, dist can't be positive */
+      if (!neighbor->flipped) {
+        qh_distplane(point, neighbor, &dist);
+        (*numpart)++;
+        if (dist > *bestdist) {
+          if (!neighbor->upperdelaunay || ischeckmax || (!noupper && dist >= qh MINoutside)) {
+            bestfacet= neighbor;
+            *bestdist= dist;
+            newbest= True;
+            if (!ischeckmax) {
+              minsearch= dist - searchdist;
+              if (dist > *bestdist + searchdist) {
+                zinc_(Zfindjump);  /* everything in qh.coplanarfacetset at least searchdist below */
+                coplanarfacetset_size= 0;
+              }
+            }
+          }
+        }else if (dist < minsearch)
+          continue;  /* if ischeckmax, dist can't be positive */
 #if qh_MAXoutside
-	if (ischeckmax && dist > neighbor->maxoutside)
-	  neighbor->maxoutside= dist;
-#endif      
+        if (ischeckmax && dist > neighbor->maxoutside)
+          neighbor->maxoutside= dist;
+#endif
       } /* end of !flipped */
       if (nextfacet) {
-	if (!coplanarset_size++) {
-	  SETfirst_(qh coplanarset)= nextfacet;
-	  SETtruncate_(qh coplanarset, 1);
-	}else
-  	  qh_setappend (&qh coplanarset, nextfacet); /* Was needed for RBOX 1000 s W1e-13 P0 t996547055 | QHULL d Qbb Qc Tv
-						 and RBOX 1000 s Z1 G1e-13 t996564279 | qhull Tv  */
+        if (!coplanarfacetset_size++) {
+          SETfirst_(qh coplanarfacetset)= nextfacet;
+          SETtruncate_(qh coplanarfacetset, 1);
+        }else
+          qh_setappend(&qh coplanarfacetset, nextfacet); /* Was needed for RBOX 1000 s W1e-13 P0 t996547055 | QHULL d Qbb Qc Tv
+                                                 and RBOX 1000 s Z1 G1e-13 t996564279 | qhull Tv  */
       }
       nextfacet= neighbor;
     } /* end of EACHneighbor */
     facet= nextfacet;
-    if (facet) 
+    if (facet)
       nextfacet= NULL;
-    else if (!coplanarset_size)
-      break; 
-    else if (!--coplanarset_size) {
-      facet= SETfirst_(qh coplanarset);
-      SETtruncate_(qh coplanarset, 0);
+    else if (!coplanarfacetset_size)
+      break;
+    else if (!--coplanarfacetset_size) {
+      facet= SETfirstt_(qh coplanarfacetset, facetT);
+      SETtruncate_(qh coplanarfacetset, 0);
     }else
-      facet= (facetT*)qh_setdellast (qh coplanarset);
-  } /* while True, for each facet in qh.coplanarset */
+      facet= (facetT*)qh_setdellast(qh coplanarfacetset);
+  } /* while True, for each facet in qh.coplanarfacetset */
   if (!ischeckmax) {
     zadd_(Zfindhorizontot, *numpart - numpartinit);
     zmax_(Zfindhorizonmax, *numpart - numpartinit);
     if (newbest)
       zinc_(Zparthorizon);
   }
-  trace4((qh ferr, "qh_findbesthorizon: newbest? %d bestfacet f%d bestdist %2.2g\n", newbest, getid_(bestfacet), *bestdist));
+  trace4((qh ferr, 4003, "qh_findbesthorizon: newbest? %d bestfacet f%d bestdist %2.2g\n", newbest, getid_(bestfacet), *bestdist));
   return bestfacet;
 }  /* findbesthorizon */
 
 /*---------------------------------
-  
+
   qh_findbestnew( point, startfacet, dist, isoutside, numpart )
     find best newfacet for point
     searches all of qh.newfacet_list starting at startfacet
@@ -382,8 +385,8 @@
     Always used for merged new facets (see qh_USEfindbestnew)
     Avoids upperdelaunay facet unless (isoutside and outside)
 
-    Uses qh.visit_id, qh.coplanarset.  
-    If share visit_id with qh_findbest, coplanarset is incorrect.
+    Uses qh.visit_id, qh.coplanarfacetset.
+    If share visit_id with qh_findbest, coplanarfacetset is incorrect.
 
     If merging (testhorizon), searches horizon facets of coplanar best facets because
     a point maybe coplanar to the bestfacet, below its horizon facet,
@@ -406,8 +409,8 @@
          update best facet
     test horizon facets
 */
-facetT *qh_findbestnew (pointT *point, facetT *startfacet,
-	   realT *dist, boolT bestoutside, boolT *isoutside, int *numpart) {
+facetT *qh_findbestnew(pointT *point, facetT *startfacet,
+           realT *dist, boolT bestoutside, boolT *isoutside, int *numpart) {
   realT bestdist= -REALmax/2;
   facetT *bestfacet= NULL, *facet;
   int oldtrace= qh IStracing, i;
@@ -418,11 +421,11 @@
 
   if (!startfacet) {
     if (qh MERGING)
-      fprintf(qh ferr, "qhull precision error (qh_findbestnew): merging has formed and deleted a cone of new facets.  Can not continue.\n");
+      qh_fprintf(qh ferr, 6001, "qhull precision error (qh_findbestnew): merging has formed and deleted a cone of new facets.  Can not continue.\n");
     else
-      fprintf(qh ferr, "qhull internal error (qh_findbestnew): no new facets for point p%d\n",
-      	      qh furthest_id);      
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+      qh_fprintf(qh ferr, 6002, "qhull internal error (qh_findbestnew): no new facets for point p%d\n",
+              qh furthest_id);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   zinc_(Zfindnew);
   if (qh BESToutside || bestoutside)
@@ -434,44 +437,44 @@
   if (isoutside)
     *isoutside= True;
   *numpart= 0;
-  if (qh IStracing >= 3 || (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid (point))) {
+  if (qh IStracing >= 3 || (qh TRACElevel && qh TRACEpoint >= 0 && qh TRACEpoint == qh_pointid(point))) {
     if (qh TRACElevel > qh IStracing)
       qh IStracing= qh TRACElevel;
-    fprintf(qh ferr, "qh_findbestnew: point p%d facet f%d. Stop? %d if dist > %2.2g\n",
-	     qh_pointid(point), startfacet->id, isdistoutside, distoutside);
-    fprintf(qh ferr, "  Last point added p%d visitid %d.",  qh furthest_id, visitid);
-    fprintf(qh ferr, "  Last merge was #%d.\n", zzval_(Ztotmerge));
+    qh_fprintf(qh ferr, 8008, "qh_findbestnew: point p%d facet f%d. Stop? %d if dist > %2.2g\n",
+             qh_pointid(point), startfacet->id, isdistoutside, distoutside);
+    qh_fprintf(qh ferr, 8009, "  Last point added p%d visitid %d.",  qh furthest_id, visitid);
+    qh_fprintf(qh ferr, 8010, "  Last merge was #%d.\n", zzval_(Ztotmerge));
   }
   /* visit all new facets starting with startfacet, maybe qh facet_list */
-  for (i= 0, facet= startfacet; i < 2; i++, facet= qh newfacet_list) {
+  for (i=0, facet=startfacet; i < 2; i++, facet= qh newfacet_list) {
     FORALLfacet_(facet) {
       if (facet == startfacet && i)
-	break;
+        break;
       facet->visitid= visitid;
       if (!facet->flipped) {
-	qh_distplane (point, facet, dist);
-	(*numpart)++;
-	if (*dist > bestdist) {
-	  if (!facet->upperdelaunay || *dist >= qh MINoutside) {
-	    bestfacet= facet;
-	    if (isdistoutside && *dist >= distoutside)
-	      goto LABELreturn_bestnew;
-	    bestdist= *dist;
-  	  }
-	}
+        qh_distplane(point, facet, dist);
+        (*numpart)++;
+        if (*dist > bestdist) {
+          if (!facet->upperdelaunay || *dist >= qh MINoutside) {
+            bestfacet= facet;
+            if (isdistoutside && *dist >= distoutside)
+              goto LABELreturn_bestnew;
+            bestdist= *dist;
+          }
+        }
       } /* end of !flipped */
     } /* FORALLfacet from startfacet or qh newfacet_list */
   }
   if (testhorizon || !bestfacet)
-    bestfacet= qh_findbesthorizon (!qh_IScheckmax, point, bestfacet ? bestfacet : startfacet, 
-	                                !qh_NOupper, &bestdist, numpart);  
+    bestfacet= qh_findbesthorizon(!qh_IScheckmax, point, bestfacet ? bestfacet : startfacet,
+                                        !qh_NOupper, &bestdist, numpart);
   *dist= bestdist;
   if (isoutside && *dist < qh MINoutside)
     *isoutside= False;
 LABELreturn_bestnew:
   zadd_(Zfindnewtot, *numpart);
   zmax_(Zfindnewmax, *numpart);
-  trace4((qh ferr, "qh_findbestnew: bestfacet f%d bestdist %2.2g\n", getid_(bestfacet), *dist));
+  trace4((qh ferr, 4004, "qh_findbestnew: bestfacet f%d bestdist %2.2g\n", getid_(bestfacet), *dist));
   qh IStracing= oldtrace;
   return bestfacet;
 }  /* findbestnew */
@@ -480,15 +483,15 @@
 
 /*---------------------------------
-  
+
   qh_backnormal( rows, numrow, numcol, sign, normal, nearzero )
     given an upper-triangular rows array and a sign,
     solve for normal equation x using back substitution over rows U
 
   returns:
      normal= x
-      
-     if will not be able to divzero() when normalized (qh.MINdenom_2 and qh.MINdenom_1_2),
+
+     if will not be able to divzero() when normalized(qh.MINdenom_2 and qh.MINdenom_1_2),
        if fails on last row
          this means that the hyperplane intersects [0,..,1]
          sets last coordinate of normal to sign
@@ -506,7 +509,7 @@
      last row of A= [0,...,0,1]
 
      1) Ly=Pb == y=b since P only permutes the 0's of   b
-     
+
   design:
     for each row from end
       perform back substitution
@@ -515,48 +518,48 @@
         if zero divide and not last row
           set tail of normal to 0
 */
-void qh_backnormal (realT **rows, int numrow, int numcol, boolT sign,
-  	coordT *normal, boolT *nearzero) {
+void qh_backnormal(realT **rows, int numrow, int numcol, boolT sign,
+        coordT *normal, boolT *nearzero) {
   int i, j;
   coordT *normalp, *normal_tail, *ai, *ak;
   realT diagonal;
   boolT waszero;
   int zerocol= -1;
-  
+
   normalp= normal + numcol - 1;
   *normalp--= (sign ? -1.0 : 1.0);
-  for(i= numrow; i--; ) {
+  for (i=numrow; i--; ) {
     *normalp= 0.0;
     ai= rows[i] + i + 1;
     ak= normalp+1;
-    for(j= i+1; j < numcol; j++)
+    for (j=i+1; j < numcol; j++)
       *normalp -= *ai++ * *ak++;
     diagonal= (rows[i])[i];
     if (fabs_(diagonal) > qh MINdenom_2)
       *(normalp--) /= diagonal;
     else {
       waszero= False;
-      *normalp= qh_divzero (*normalp, diagonal, qh MINdenom_1_2, &waszero);
+      *normalp= qh_divzero(*normalp, diagonal, qh MINdenom_1_2, &waszero);
       if (waszero) {
         zerocol= i;
-	*(normalp--)= (sign ? -1.0 : 1.0);
-	for (normal_tail= normalp+2; normal_tail < normal + numcol; normal_tail++)
-	  *normal_tail= 0.0;
+        *(normalp--)= (sign ? -1.0 : 1.0);
+        for (normal_tail= normalp+2; normal_tail < normal + numcol; normal_tail++)
+          *normal_tail= 0.0;
       }else
-	normalp--;
+        normalp--;
     }
   }
   if (zerocol != -1) {
     zzinc_(Zback0);
     *nearzero= True;
-    trace4((qh ferr, "qh_backnormal: zero diagonal at column %d.\n", i));
-    qh_precision ("zero diagonal on back substitution");
+    trace4((qh ferr, 4005, "qh_backnormal: zero diagonal at column %d.\n", i));
+    qh_precision("zero diagonal on back substitution");
   }
 } /* backnormal */
 
 /*---------------------------------
-  
+
   qh_gausselim( rows, numrow, numcol, sign )
     Gaussian elimination with partial pivoting
 
@@ -579,57 +582,57 @@
   realT *ai, *ak, *rowp, *pivotrow;
   realT n, pivot, pivot_abs= 0.0, temp;
   int i, j, k, pivoti, flip=0;
-  
+
   *nearzero= False;
-  for(k= 0; k < numrow; k++) {
+  for (k=0; k < numrow; k++) {
     pivot_abs= fabs_((rows[k])[k]);
     pivoti= k;
-    for(i= k+1; i < numrow; i++) {
+    for (i=k+1; i < numrow; i++) {
       if ((temp= fabs_((rows[i])[k])) > pivot_abs) {
-	pivot_abs= temp;
-	pivoti= i;
+        pivot_abs= temp;
+        pivoti= i;
       }
     }
     if (pivoti != k) {
-      rowp= rows[pivoti]; 
-      rows[pivoti]= rows[k]; 
-      rows[k]= rowp; 
+      rowp= rows[pivoti];
+      rows[pivoti]= rows[k];
+      rows[k]= rowp;
       *sign ^= 1;
       flip ^= 1;
     }
     if (pivot_abs <= qh NEARzero[k]) {
       *nearzero= True;
       if (pivot_abs == 0.0) {   /* remainder of column == 0 */
-	if (qh IStracing >= 4) {
-	  fprintf (qh ferr, "qh_gausselim: 0 pivot at column %d. (%2.2g < %2.2g)\n", k, pivot_abs, qh DISTround);
-	  qh_printmatrix (qh ferr, "Matrix:", rows, numrow, numcol);
-	}
-	zzinc_(Zgauss0);
-        qh_precision ("zero pivot for Gaussian elimination");
-	goto LABELnextcol;
+        if (qh IStracing >= 4) {
+          qh_fprintf(qh ferr, 8011, "qh_gausselim: 0 pivot at column %d. (%2.2g < %2.2g)\n", k, pivot_abs, qh DISTround);
+          qh_printmatrix(qh ferr, "Matrix:", rows, numrow, numcol);
+        }
+        zzinc_(Zgauss0);
+        qh_precision("zero pivot for Gaussian elimination");
+        goto LABELnextcol;
       }
     }
     pivotrow= rows[k] + k;
     pivot= *pivotrow++;  /* signed value of pivot, and remainder of row */
-    for(i= k+1; i < numrow; i++) {
+    for (i=k+1; i < numrow; i++) {
       ai= rows[i] + k;
       ak= pivotrow;
       n= (*ai++)/pivot;   /* divzero() not needed since |pivot| >= |*ai| */
-      for(j= numcol - (k+1); j--; )
-	*ai++ -= n * *ak++;
+      for (j= numcol - (k+1); j--; )
+        *ai++ -= n * *ak++;
     }
   LABELnextcol:
     ;
   }
   wmin_(Wmindenom, pivot_abs);  /* last pivot element */
   if (qh IStracing >= 5)
-    qh_printmatrix (qh ferr, "qh_gausselem: result", rows, numrow, numcol);
+    qh_printmatrix(qh ferr, "qh_gausselem: result", rows, numrow, numcol);
 } /* gausselim */
 
 
 /*---------------------------------
-  
+
   qh_getangle( vect1, vect2 )
     returns the dot product of two vectors
     if qh.RANDOMdist, joggles result
@@ -642,21 +645,21 @@
   realT angle= 0, randr;
   int k;
 
-  for(k= qh hull_dim; k--; )
+  for (k=qh hull_dim; k--; )
     angle += *vect1++ * *vect2++;
   if (qh RANDOMdist) {
     randr= qh_RANDOMint;
     angle += (2.0 * randr / qh_RANDOMmax - 1.0) *
       qh RANDOMfactor;
   }
-  trace4((qh ferr, "qh_getangle: %2.2g\n", angle));
+  trace4((qh ferr, 4006, "qh_getangle: %2.2g\n", angle));
   return(angle);
 } /* getangle */
 
 
 /*---------------------------------
-  
+
   qh_getcenter( vertices )
     returns arithmetic center of a set of vertices as a new point
 
@@ -670,8 +673,8 @@
   int count= qh_setsize(vertices);
 
   if (count < 2) {
-    fprintf (qh ferr, "qhull internal error (qh_getcenter): not defined for %d points\n", count);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6003, "qhull internal error (qh_getcenter): not defined for %d points\n", count);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   center= (pointT *)qh_memalloc(qh normal_size);
   for (k=0; k < qh hull_dim; k++) {
@@ -687,7 +690,7 @@
 
 /*---------------------------------
-  
+
   qh_getcentrum( facet )
     returns the centrum for a facet as a new point
 
@@ -700,18 +703,18 @@
 
   point= qh_getcenter(facet->vertices);
   zzinc_(Zcentrumtests);
-  qh_distplane (point, facet, &dist);
+  qh_distplane(point, facet, &dist);
   centrum= qh_projectpoint(point, facet, dist);
   qh_memfree(point, qh normal_size);
-  trace4((qh ferr, "qh_getcentrum: for f%d, %d vertices dist= %2.2g\n",
-	  facet->id, qh_setsize(facet->vertices), dist));
+  trace4((qh ferr, 4007, "qh_getcentrum: for f%d, %d vertices dist= %2.2g\n",
+          facet->id, qh_setsize(facet->vertices), dist));
   return centrum;
 } /* getcentrum */
 
 
 /*---------------------------------
-  
+
   qh_getdistance( facet, neighbor, mindist, maxdist )
     returns the maxdist and mindist distance of any vertex from neighbor
 
@@ -725,7 +728,7 @@
 realT qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist) {
   vertexT *vertex, **vertexp;
   realT dist, maxd, mind;
-  
+
   FOREACHvertex_(facet->vertices)
     vertex->seen= False;
   FOREACHvertex_(neighbor->vertices)
@@ -737,9 +740,9 @@
       zzinc_(Zbestdist);
       qh_distplane(vertex->point, neighbor, &dist);
       if (dist < mind)
-	mind= dist;
+        mind= dist;
       else if (dist > maxd)
-	maxd= dist;
+        maxd= dist;
     }
   }
   *mindist= mind;
@@ -758,17 +761,17 @@
   qh_normalize( normal, dim, toporient )
     normalize a vector and report if too small
     does not use min norm
-  
+
   see:
     qh_normalize2
 */
-void qh_normalize (coordT *normal, int dim, boolT toporient) {
+void qh_normalize(coordT *normal, int dim, boolT toporient) {
   qh_normalize2( normal, dim, toporient, NULL, NULL);
 } /* normalize */
 
 /*---------------------------------
-  
+
   qh_normalize2( normal, dim, toporient, minnorm, ismin )
     normalize a vector and report if too small
     qh.MINdenom/MINdenom1 are the upper limits for divide overflow
@@ -776,16 +779,16 @@
   returns:
     normalized vector
     flips sign if !toporient
-    if minnorm non-NULL, 
+    if minnorm non-NULL,
       sets ismin if normal < minnorm
 
   notes:
     if zero norm
        sets all elements to sqrt(1.0/dim)
-    if divide by zero (divzero ())
+    if divide by zero (divzero())
        sets largest element to   +/-1
        bumps Znearlysingular
-      
+
   design:
     computes norm
     test for minnorm
@@ -798,7 +801,7 @@
       if nearzero
         sets norm to direction of maximum value
 */
-void qh_normalize2 (coordT *normal, int dim, boolT toporient, 
+void qh_normalize2 (coordT *normal, int dim, boolT toporient,
             realT *minnorm, boolT *ismin) {
   int k;
   realT *colp, *maxp, norm= 0, temp, *norm1, *norm2, *norm3;
@@ -812,17 +815,17 @@
   else if (dim == 3)
     norm= sqrt((*normal)*(*normal) + (*norm1)*(*norm1) + (*norm2)*(*norm2));
   else if (dim == 4) {
-    norm= sqrt((*normal)*(*normal) + (*norm1)*(*norm1) + (*norm2)*(*norm2) 
+    norm= sqrt((*normal)*(*normal) + (*norm1)*(*norm1) + (*norm2)*(*norm2)
                + (*norm3)*(*norm3));
   }else if (dim > 4) {
-    norm= (*normal)*(*normal) + (*norm1)*(*norm1) + (*norm2)*(*norm2) 
+    norm= (*normal)*(*normal) + (*norm1)*(*norm1) + (*norm2)*(*norm2)
                + (*norm3)*(*norm3);
-    for (k= dim-4, colp= normal+4; k--; colp++)
+    for (k=dim-4, colp=normal+4; k--; colp++)
       norm += (*colp) * (*colp);
     norm= sqrt(norm);
   }
   if (minnorm) {
-    if (norm < *minnorm) 
+    if (norm < *minnorm)
       *ismin= True;
     else
       *ismin= False;
@@ -843,30 +846,30 @@
     }else if (dim >4) {
       *norm2 /= norm;
       *norm3 /= norm;
-      for (k= dim-4, colp= normal+4; k--; )
+      for (k=dim-4, colp=normal+4; k--; )
         *colp++ /= norm;
     }
   }else if (norm == 0.0) {
-    temp= sqrt (1.0/dim);
-    for (k= dim, colp= normal; k--; )
+    temp= sqrt(1.0/dim);
+    for (k=dim, colp=normal; k--; )
       *colp++ = temp;
   }else {
     if (!toporient)
       norm= -norm;
-    for (k= dim, colp= normal; k--; colp++) { /* k used below */
-      temp= qh_divzero (*colp, norm, qh MINdenom_1, &zerodiv);
+    for (k=dim, colp=normal; k--; colp++) { /* k used below */
+      temp= qh_divzero(*colp, norm, qh MINdenom_1, &zerodiv);
       if (!zerodiv)
-	*colp= temp;
+        *colp= temp;
       else {
-	maxp= qh_maxabsval(normal, dim);
-	temp= ((*maxp * norm >= 0.0) ? 1.0 : -1.0);
-	for (k= dim, colp= normal; k--; colp++)
-	  *colp= 0.0;
-	*maxp= temp;
-	zzinc_(Znearlysingular);
-	trace0((qh ferr, "qh_normalize: norm=%2.2g too small during p%d\n", 
-	       norm, qh furthest_id));
-	return;
+        maxp= qh_maxabsval(normal, dim);
+        temp= ((*maxp * norm >= 0.0) ? 1.0 : -1.0);
+        for (k=dim, colp=normal; k--; colp++)
+          *colp= 0.0;
+        *maxp= temp;
+        zzinc_(Znearlysingular);
+        trace0((qh ferr, 1, "qh_normalize: norm=%2.2g too small during p%d\n",
+               norm, qh furthest_id));
+        return;
       }
     }
   }
@@ -875,13 +878,13 @@
 
 /*---------------------------------
-  
+
   qh_projectpoint( point, facet, dist )
     project point onto a facet by dist
 
   returns:
     returns a new point
-    
+
   notes:
     if dist= distplane(point,facet)
       this projects point to hyperplane
@@ -889,21 +892,22 @@
 */
 pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist) {
   pointT *newpoint, *np, *normal;
-  int normsize= qh normal_size,k;
+  int normsize= qh normal_size;
+  int k;
   void **freelistp; /* used !qh_NOmem */
-  
+
   qh_memalloc_(normsize, freelistp, newpoint, pointT);
   np= newpoint;
   normal= facet->normal;
-  for(k= qh hull_dim; k--; )
+  for (k=qh hull_dim; k--; )
     *(np++)= *point++ - dist * *normal++;
   return(newpoint);
 } /* projectpoint */
 
-  
+
 /*---------------------------------
-  
+
   qh_setfacetplane( facet )
     sets the hyperplane for a facet
     if qh.RANDOMdist, joggles hyperplane
@@ -925,7 +929,8 @@
 void qh_setfacetplane(facetT *facet) {
   pointT *point;
   vertexT *vertex, **vertexp;
-  int k,i, normsize= qh normal_size, oldtrace= 0;
+  int normsize= qh normal_size;
+  int k,i, oldtrace= 0;
   realT dist;
   void **freelistp; /* used !qh_NOmem */
   coordT *coord, *gmcoord;
@@ -938,12 +943,12 @@
   if (facet == qh tracefacet) {
     oldtrace= qh IStracing;
     qh IStracing= 5;
-    fprintf (qh ferr, "qh_setfacetplane: facet f%d created.\n", facet->id);
-    fprintf (qh ferr, "  Last point added to hull was p%d.", qh furthest_id);
+    qh_fprintf(qh ferr, 8012, "qh_setfacetplane: facet f%d created.\n", facet->id);
+    qh_fprintf(qh ferr, 8013, "  Last point added to hull was p%d.", qh furthest_id);
     if (zzval_(Ztotmerge))
-      fprintf(qh ferr, "  Last merge was #%d.", zzval_(Ztotmerge));
-    fprintf (qh ferr, "\n\nCurrent summary is:\n");
-      qh_printsummary (qh ferr);
+      qh_fprintf(qh ferr, 8014, "  Last merge was #%d.", zzval_(Ztotmerge));
+    qh_fprintf(qh ferr, 8015, "\n\nCurrent summary is:\n");
+      qh_printsummary(qh ferr);
   }
   if (qh hull_dim <= 4) {
     i= 0;
@@ -951,10 +956,10 @@
       gmcoord= qh gm_matrix;
       FOREACHvertex_(facet->vertices) {
         qh gm_row[i++]= gmcoord;
-	coord= vertex->point;
-	for (k= qh hull_dim; k--; )
-	  *(gmcoord++)= *coord++ * qh_randomfactor();
-      }	  
+        coord= vertex->point;
+        for (k=qh hull_dim; k--; )
+          *(gmcoord++)= *coord++ * qh_randomfactor(qh RANDOMa, qh RANDOMb);
+      }
     }else {
       FOREACHvertex_(facet->vertices)
        qh gm_row[i++]= vertex->point;
@@ -967,36 +972,36 @@
     gmcoord= qh gm_matrix;
     FOREACHvertex_(facet->vertices) {
       if (vertex->point != point0) {
-	qh gm_row[i++]= gmcoord;
-	coord= vertex->point;
-	point= point0;
-	for(k= qh hull_dim; k--; )
-	  *(gmcoord++)= *coord++ - *point++;
+        qh gm_row[i++]= gmcoord;
+        coord= vertex->point;
+        point= point0;
+        for (k=qh hull_dim; k--; )
+          *(gmcoord++)= *coord++ - *point++;
       }
     }
     qh gm_row[i]= gmcoord;  /* for areasimplex */
     if (qh RANDOMdist) {
       gmcoord= qh gm_matrix;
-      for (i= qh hull_dim-1; i--; ) {
-	for (k= qh hull_dim; k--; )
-	  *(gmcoord++) *= qh_randomfactor();
+      for (i=qh hull_dim-1; i--; ) {
+        for (k=qh hull_dim; k--; )
+          *(gmcoord++) *= qh_randomfactor(qh RANDOMa, qh RANDOMb);
       }
     }
     qh_sethyperplane_gauss(qh hull_dim, qh gm_row, point0, facet->toporient,
-           	facet->normal, &facet->offset, &nearzero);
-    if (nearzero) { 
-      if (qh_orientoutside (facet)) {
-	trace0((qh ferr, "qh_setfacetplane: flipped orientation after testing interior_point during p%d\n", qh furthest_id));
+                facet->normal, &facet->offset, &nearzero);
+    if (nearzero) {
+      if (qh_orientoutside(facet)) {
+        trace0((qh ferr, 2, "qh_setfacetplane: flipped orientation after testing interior_point during p%d\n", qh furthest_id));
       /* this is part of using Gaussian Elimination.  For example in 5-d
-	   1 1 1 1 0
-	   1 1 1 1 1
-	   0 0 0 1 0
-	   0 1 0 0 0
-	   1 0 0 0 0
-	   norm= 0.38 0.38 -0.76 0.38 0
-	 has a determinate of 1, but g.e. after subtracting pt. 0 has
-	 0's in the diagonal, even with full pivoting.  It does work
-	 if you subtract pt. 4 instead. */
+           1 1 1 1 0
+           1 1 1 1 1
+           0 0 0 1 0
+           0 1 0 0 0
+           1 0 0 0 0
+           norm= 0.38 0.38 -0.76 0.38 0
+         has a determinate of 1, but g.e. after subtracting pt. 0 has
+         0's in the diagonal, even with full pivoting.  It does work
+         if you subtract pt. 4 instead. */
       }
     }
   }
@@ -1015,36 +1020,36 @@
     qh RANDOMdist= False;
     FOREACHvertex_(facet->vertices) {
       if (vertex->point != point0) {
-	boolT istrace= False;
-	zinc_(Zdiststat);
+        boolT istrace= False;
+        zinc_(Zdiststat);
         qh_distplane(vertex->point, facet, &dist);
         dist= fabs_(dist);
         zinc_(Znewvertex);
         wadd_(Wnewvertex, dist);
         if (dist > wwval_(Wnewvertexmax)) {
           wwval_(Wnewvertexmax)= dist;
-	  if (dist > qh max_outside) {
-	    qh max_outside= dist;  /* used by qh_maxouter() */
-	    if (dist > qh TRACEdist) 
-	      istrace= True;
-	  }
-	}else if (-dist > qh TRACEdist)
-	  istrace= True;
-	if (istrace) {
-	  fprintf (qh ferr, "qh_setfacetplane: ====== vertex p%d (v%d) increases max_outside to %2.2g for new facet f%d last p%d\n",
-	        qh_pointid(vertex->point), vertex->id, dist, facet->id, qh furthest_id);
-	  qh_errprint ("DISTANT", facet, NULL, NULL, NULL);
-	}
+          if (dist > qh max_outside) {
+            qh max_outside= dist;  /* used by qh_maxouter() */
+            if (dist > qh TRACEdist)
+              istrace= True;
+          }
+        }else if (-dist > qh TRACEdist)
+          istrace= True;
+        if (istrace) {
+          qh_fprintf(qh ferr, 8016, "qh_setfacetplane: ====== vertex p%d(v%d) increases max_outside to %2.2g for new facet f%d last p%d\n",
+                qh_pointid(vertex->point), vertex->id, dist, facet->id, qh furthest_id);
+          qh_errprint("DISTANT", facet, NULL, NULL, NULL);
+        }
       }
     }
     qh RANDOMdist= qh old_randomdist;
   }
   if (qh IStracing >= 3) {
-    fprintf (qh ferr, "qh_setfacetplane: f%d offset %2.2g normal: ",
-	     facet->id, facet->offset);
+    qh_fprintf(qh ferr, 8017, "qh_setfacetplane: f%d offset %2.2g normal: ",
+             facet->id, facet->offset);
     for (k=0; k < qh hull_dim; k++)
-      fprintf (qh ferr, "%2.2g ", facet->normal[k]);
-    fprintf (qh ferr, "\n");
+      qh_fprintf(qh ferr, 8018, "%2.2g ", facet->normal[k]);
+    qh_fprintf(qh ferr, 8019, "\n");
   }
   if (facet == qh tracefacet)
     qh IStracing= oldtrace;
@@ -1053,10 +1058,10 @@
 
 /*---------------------------------
-  
+
   qh_sethyperplane_det( dim, rows, point0, toporient, normal, offset, nearzero )
-    given dim X dim array indexed by rows[], one row per point, 
-        toporient (flips all signs),
+    given dim X dim array indexed by rows[], one row per point,
+        toporient(flips all signs),
         and point0 (any row)
     set normalized hyperplane equation from oriented simplex
 
@@ -1076,7 +1081,7 @@
     Plan: exactly translate the facet so that V_0 is the origin
           exactly rotate the facet so that V_1 is on the x-axis and y_2=0.
           exactly rotate the effective perturbation to only effect n_0
-	     this introduces a factor of sqrt(3)
+             this introduces a factor of sqrt(3)
     n_0 = ((y_2-y_0)*(z_1-z_0) - (z_2-z_0)*(y_1-y_0)) / norm
     Let M_d be the max coordinate difference
     Let M_a be the greater of M_d and the max abs. coordinate
@@ -1095,7 +1100,7 @@
     Then minnorm = 2 u M_a M_d M_d M_d / qh.ONEmerge
     Note that qh.one_merge is approx. 82 u M_a and norm is usually about M_d M_d M_d
 */
-void qh_sethyperplane_det (int dim, coordT **rows, coordT *point0, 
+void qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
           boolT toporient, coordT *normal, realT *offset, boolT *nearzero) {
   realT maxround, dist;
   int i;
@@ -1110,58 +1115,58 @@
     *nearzero= False;  /* since nearzero norm => incident points */
   }else if (dim == 3) {
     normal[0]= det2_(dY(2,0), dZ(2,0),
-		     dY(1,0), dZ(1,0));
+                     dY(1,0), dZ(1,0));
     normal[1]= det2_(dX(1,0), dZ(1,0),
-		     dX(2,0), dZ(2,0));
+                     dX(2,0), dZ(2,0));
     normal[2]= det2_(dX(2,0), dY(2,0),
-		     dX(1,0), dY(1,0));
+                     dX(1,0), dY(1,0));
     qh_normalize2 (normal, dim, toporient, NULL, NULL);
     *offset= -(point0[0]*normal[0] + point0[1]*normal[1]
-	       + point0[2]*normal[2]);
+               + point0[2]*normal[2]);
     maxround= qh DISTround;
     for (i=dim; i--; ) {
       point= rows[i];
       if (point != point0) {
         dist= *offset + (point[0]*normal[0] + point[1]*normal[1]
-	       + point[2]*normal[2]);
+               + point[2]*normal[2]);
         if (dist > maxround || dist < -maxround) {
-  	  *nearzero= True;
-	  break;
-	}
+          *nearzero= True;
+          break;
+        }
       }
     }
   }else if (dim == 4) {
     normal[0]= - det3_(dY(2,0), dZ(2,0), dW(2,0),
-			dY(1,0), dZ(1,0), dW(1,0),
-			dY(3,0), dZ(3,0), dW(3,0));
+                        dY(1,0), dZ(1,0), dW(1,0),
+                        dY(3,0), dZ(3,0), dW(3,0));
     normal[1]=   det3_(dX(2,0), dZ(2,0), dW(2,0),
-		        dX(1,0), dZ(1,0), dW(1,0),
-		        dX(3,0), dZ(3,0), dW(3,0));
+                        dX(1,0), dZ(1,0), dW(1,0),
+                        dX(3,0), dZ(3,0), dW(3,0));
     normal[2]= - det3_(dX(2,0), dY(2,0), dW(2,0),
-			dX(1,0), dY(1,0), dW(1,0),
-			dX(3,0), dY(3,0), dW(3,0));
+                        dX(1,0), dY(1,0), dW(1,0),
+                        dX(3,0), dY(3,0), dW(3,0));
     normal[3]=   det3_(dX(2,0), dY(2,0), dZ(2,0),
-		        dX(1,0), dY(1,0), dZ(1,0),
-		        dX(3,0), dY(3,0), dZ(3,0));
+                        dX(1,0), dY(1,0), dZ(1,0),
+                        dX(3,0), dY(3,0), dZ(3,0));
     qh_normalize2 (normal, dim, toporient, NULL, NULL);
     *offset= -(point0[0]*normal[0] + point0[1]*normal[1]
-	       + point0[2]*normal[2] + point0[3]*normal[3]);
+               + point0[2]*normal[2] + point0[3]*normal[3]);
     maxround= qh DISTround;
     for (i=dim; i--; ) {
       point= rows[i];
       if (point != point0) {
         dist= *offset + (point[0]*normal[0] + point[1]*normal[1]
-	       + point[2]*normal[2] + point[3]*normal[3]);
+               + point[2]*normal[2] + point[3]*normal[3]);
         if (dist > maxround || dist < -maxround) {
-  	  *nearzero= True;
-	  break;
-	}
+          *nearzero= True;
+          break;
+        }
       }
     }
   }
   if (*nearzero) {
     zzinc_(Zminnorm);
-    trace0((qh ferr, "qh_sethyperplane_det: degenerate norm during p%d.\n", qh furthest_id));
+    trace0((qh ferr, 3, "qh_sethyperplane_det: degenerate norm during p%d.\n", qh furthest_id));
     zzinc_(Znearlysingular);
   }
 } /* sethyperplane_det */
@@ -1169,9 +1174,9 @@
 
 /*---------------------------------
-  
+
   qh_sethyperplane_gauss( dim, rows, point0, toporient, normal, offset, nearzero )
-    given (dim-1) X dim array of rows[i]= V_{i+1} - V_0 (point0)
+    given(dim-1) X dim array of rows[i]= V_{i+1} - V_0 (point0)
     set normalized hyperplane equation from oriented simplex
 
   returns:
@@ -1181,38 +1186,38 @@
   notes:
     if nearzero
       orientation may be incorrect because of incorrect sign flips in gausselim
-    solves [V_n-V_0,...,V_1-V_0, 0 .. 0 1] * N == [0 .. 0 1] 
-        or [V_n-V_0,...,V_1-V_0, 0 .. 0 1] * N == [0] 
+    solves [V_n-V_0,...,V_1-V_0, 0 .. 0 1] * N == [0 .. 0 1]
+        or [V_n-V_0,...,V_1-V_0, 0 .. 0 1] * N == [0]
     i.e., N is normal to the hyperplane, and the unnormalized
         distance to [0 .. 1] is either 1 or   0
 
   design:
     perform gaussian elimination
     flip sign for negative values
-    perform back substitution 
+    perform back substitution
     normalize result
     compute offset
 */
-void qh_sethyperplane_gauss (int dim, coordT **rows, pointT *point0, 
-		boolT toporient, coordT *normal, coordT *offset, boolT *nearzero) {
+void qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
+                boolT toporient, coordT *normal, coordT *offset, boolT *nearzero) {
   coordT *pointcoord, *normalcoef;
   int k;
   boolT sign= toporient, nearzero2= False;
-  
+
   qh_gausselim(rows, dim-1, dim, &sign, nearzero);
-  for(k= dim-1; k--; ) {
+  for (k=dim-1; k--; ) {
     if ((rows[k])[k] < 0)
       sign ^= 1;
   }
   if (*nearzero) {
     zzinc_(Znearlysingular);
-    trace0((qh ferr, "qh_sethyperplane_gauss: nearly singular or axis parallel hyperplane during p%d.\n", qh furthest_id));
+    trace0((qh ferr, 4, "qh_sethyperplane_gauss: nearly singular or axis parallel hyperplane during p%d.\n", qh furthest_id));
     qh_backnormal(rows, dim-1, dim, sign, normal, &nearzero2);
   }else {
     qh_backnormal(rows, dim-1, dim, sign, normal, &nearzero2);
     if (nearzero2) {
       zzinc_(Znearlysingular);
-      trace0((qh ferr, "qh_sethyperplane_gauss: singular or axis parallel hyperplane at normalization during p%d.\n", qh furthest_id));
+      trace0((qh ferr, 5, "qh_sethyperplane_gauss: singular or axis parallel hyperplane at normalization during p%d.\n", qh furthest_id));
     }
   }
   if (nearzero2)
@@ -1221,9 +1226,9 @@
   pointcoord= point0;
   normalcoef= normal;
   *offset= -(*pointcoord++ * *normalcoef++);
-  for(k= dim-1; k--; )
+  for (k=dim-1; k--; )
     *offset -= *pointcoord++ * *normalcoef++;
 } /* sethyperplane_gauss */
 
-  
 
+

Modified: trunk/scipy/spatial/qhull/src/geom.h
===================================================================
--- trunk/scipy/spatial/qhull/src/geom.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/geom.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,30 +1,34 @@
 /*
  ---------------------------------
 
-  geom.h 
+  geom.h
     header file for geometric routines
 
    see qh-geom.htm and geom.c
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/geom.h#18 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFgeom
 #define qhDEFgeom 1
 
+#include "libqhull.h"
+
 /* ============ -macros- ======================== */
 
 /*----------------------------------
-   
+
   fabs_(a)
     returns the absolute value of a
 */
 #define fabs_( a ) ((( a ) < 0 ) ? -( a ):( a ))
-               
+
 /*----------------------------------
-  
+
   fmax_(a,b)
     returns the maximum value of a and b
 */
@@ -44,7 +48,7 @@
   maximize_(maxval, val)
     set maxval to val if val is greater than maxval
 */
-#define maximize_( maxval, val ) {if (( maxval ) < ( val )) ( maxval )= ( val );}
+#define maximize_( maxval, val ) { if (( maxval ) < ( val )) ( maxval )= ( val ); }
 
 /*----------------------------------
@@ -52,25 +56,25 @@
   minimize_(minval, val)
     set minval to val if val is less than minval
 */
-#define minimize_( minval, val ) {if (( minval ) > ( val )) ( minval )= ( val );}
+#define minimize_( minval, val ) { if (( minval ) > ( val )) ( minval )= ( val ); }
 
 /*----------------------------------
 
-  det2_(a1, a2,     
+  det2_(a1, a2,
         b1, b2)
-  
+
     compute a 2-d determinate
 */
 #define det2_( a1,a2,b1,b2 ) (( a1 )*( b2 ) - ( a2 )*( b1 ))
 
 /*----------------------------------
-  
-  det3_(a1, a2, a3,    
+
+  det3_(a1, a2, a3,
        b1, b2, b3,
        c1, c2, c3)
-  
+
     compute a 3-d determinate
 */
 #define det3_( a1,a2,a3,b1,b2,b3,c1,c2,c3 ) ( ( a1 )*det2_( b2,b3,c2,c3 ) \
@@ -78,11 +82,11 @@
 
 /*----------------------------------
-  
+
   dX( p1, p2 )
   dY( p1, p2 )
   dZ( p1, p2 )
-  
+
     given two indices into rows[],
 
     compute the difference between X, Y, or Z coordinates
@@ -94,82 +98,77 @@
 
 /*============= prototypes in alphabetical order, infrequent at end ======= */
 
-void    qh_backnormal (realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
-void	qh_distplane (pointT *point, facetT *facet, realT *dist);
-facetT *qh_findbest (pointT *point, facetT *startfacet,
-		     boolT bestoutside, boolT isnewfacets, boolT noupper,
-		     realT *dist, boolT *isoutside, int *numpart);
-facetT *qh_findbesthorizon (boolT ischeckmax, pointT *point, 
-	             facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
-facetT *qh_findbestnew (pointT *point, facetT *startfacet, realT *dist, 
-		     boolT bestoutside, boolT *isoutside, int *numpart);
-void 	qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
+void    qh_backnormal(realT **rows, int numrow, int numcol, boolT sign, coordT *normal, boolT *nearzero);
+void    qh_distplane(pointT *point, facetT *facet, realT *dist);
+facetT *qh_findbest(pointT *point, facetT *startfacet,
+                     boolT bestoutside, boolT isnewfacets, boolT noupper,
+                     realT *dist, boolT *isoutside, int *numpart);
+facetT *qh_findbesthorizon(boolT ischeckmax, pointT *point,
+                     facetT *startfacet, boolT noupper, realT *bestdist, int *numpart);
+facetT *qh_findbestnew(pointT *point, facetT *startfacet, realT *dist,
+                     boolT bestoutside, boolT *isoutside, int *numpart);
+void    qh_gausselim(realT **rows, int numrow, int numcol, boolT *sign, boolT *nearzero);
 realT   qh_getangle(pointT *vect1, pointT *vect2);
 pointT *qh_getcenter(setT *vertices);
 pointT *qh_getcentrum(facetT *facet);
 realT   qh_getdistance(facetT *facet, facetT *neighbor, realT *mindist, realT *maxdist);
-void    qh_normalize (coordT *normal, int dim, boolT toporient);
-void    qh_normalize2 (coordT *normal, int dim, boolT toporient, 
+void    qh_normalize(coordT *normal, int dim, boolT toporient);
+void    qh_normalize2 (coordT *normal, int dim, boolT toporient,
             realT *minnorm, boolT *ismin);
 pointT *qh_projectpoint(pointT *point, facetT *facet, realT dist);
 
 void    qh_setfacetplane(facetT *newfacets);
-void 	qh_sethyperplane_det (int dim, coordT **rows, coordT *point0, 
+void    qh_sethyperplane_det(int dim, coordT **rows, coordT *point0,
               boolT toporient, coordT *normal, realT *offset, boolT *nearzero);
-void 	qh_sethyperplane_gauss (int dim, coordT **rows, pointT *point0, 
-	     boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
-boolT   qh_sharpnewfacets (void);
+void    qh_sethyperplane_gauss(int dim, coordT **rows, pointT *point0,
+             boolT toporient, coordT *normal, coordT *offset, boolT *nearzero);
+boolT   qh_sharpnewfacets(void);
 
 /*========= infrequently used code in geom2.c =============*/
 
-
-coordT *qh_copypoints (coordT *points, int numpoints, int dimension);
-void    qh_crossproduct (int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
-realT 	qh_determinant (realT **rows, int dim, boolT *nearzero);
-realT   qh_detjoggle (pointT *points, int numpoints, int dimension);
-void    qh_detroundoff (void);
+coordT *qh_copypoints(coordT *points, int numpoints, int dimension);
+void    qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]);
+realT   qh_determinant(realT **rows, int dim, boolT *nearzero);
+realT   qh_detjoggle(pointT *points, int numpoints, int dimension);
+void    qh_detroundoff(void);
 realT   qh_detsimplex(pointT *apex, setT *points, int dim, boolT *nearzero);
-realT   qh_distnorm (int dim, pointT *point, pointT *normal, realT *offsetp);
-realT   qh_distround (int dimension, realT maxabs, realT maxsumabs);
+realT   qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp);
+realT   qh_distround(int dimension, realT maxabs, realT maxsumabs);
 realT   qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv);
-realT   qh_facetarea (facetT *facet);
-realT   qh_facetarea_simplex (int dim, coordT *apex, setT *vertices, 
+realT   qh_facetarea(facetT *facet);
+realT   qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
           vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset);
-pointT *qh_facetcenter (setT *vertices);
-facetT *qh_findgooddist (pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
-void    qh_getarea (facetT *facetlist);
+pointT *qh_facetcenter(setT *vertices);
+facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp, facetT **facetlist);
+void    qh_getarea(facetT *facetlist);
 boolT   qh_gram_schmidt(int dim, realT **rows);
-boolT   qh_inthresholds (coordT *normal, realT *angle);
-void    qh_joggleinput (void);
-realT  *qh_maxabsval (realT *normal, int dim);
+boolT   qh_inthresholds(coordT *normal, realT *angle);
+void    qh_joggleinput(void);
+realT  *qh_maxabsval(realT *normal, int dim);
 setT   *qh_maxmin(pointT *points, int numpoints, int dimension);
-realT   qh_maxouter (void);
-void    qh_maxsimplex (int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
-realT   qh_minabsval (realT *normal, int dim);
-int     qh_mindiff (realT *vecA, realT *vecB, int dim);
-boolT   qh_orientoutside (facetT *facet);
-void    qh_outerinner (facetT *facet, realT *outerplane, realT *innerplane);
+realT   qh_maxouter(void);
+void    qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex);
+realT   qh_minabsval(realT *normal, int dim);
+int     qh_mindiff(realT *vecA, realT *vecB, int dim);
+boolT   qh_orientoutside(facetT *facet);
+void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
 coordT  qh_pointdist(pointT *point1, pointT *point2, int dim);
-void    qh_printmatrix (FILE *fp, char *string, realT **rows, int numrow, int numcol);
-void    qh_printpoints (FILE *fp, char *string, setT *points);
-void    qh_projectinput (void);
-void 	qh_projectpoints (signed char *project, int n, realT *points, 
+void    qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol);
+void    qh_printpoints(FILE *fp, const char *string, setT *points);
+void    qh_projectinput(void);
+void    qh_projectpoints(signed char *project, int n, realT *points,
              int numpoints, int dim, realT *newpoints, int newdim);
-int     qh_rand( void);
-void    qh_srand( int seed);
-realT   qh_randomfactor (void);
-void    qh_randommatrix (realT *buffer, int dim, realT **row);
-void    qh_rotateinput (realT **rows);
-void    qh_rotatepoints (realT *points, int numpoints, int dim, realT **rows);
-void    qh_scaleinput (void);
-void    qh_scalelast (coordT *points, int numpoints, int dim, coordT low,
-		   coordT high, coordT newhigh);
-void 	qh_scalepoints (pointT *points, int numpoints, int dim,
-  		realT *newlows, realT *newhighs);
-boolT   qh_sethalfspace (int dim, coordT *coords, coordT **nextp, 
+void    qh_rotateinput(realT **rows);
+void    qh_rotatepoints(realT *points, int numpoints, int dim, realT **rows);
+void    qh_scaleinput(void);
+void    qh_scalelast(coordT *points, int numpoints, int dim, coordT low,
+                   coordT high, coordT newhigh);
+void    qh_scalepoints(pointT *points, int numpoints, int dim,
+                realT *newlows, realT *newhighs);
+boolT   qh_sethalfspace(int dim, coordT *coords, coordT **nextp,
               coordT *normal, coordT *offset, coordT *feasible);
-coordT *qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible);
-pointT *qh_voronoi_center (int dim, setT *points);
+coordT *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
+pointT *qh_voronoi_center(int dim, setT *points);
 
 #endif /* qhDEFgeom */
 

Modified: trunk/scipy/spatial/qhull/src/geom2.c
===================================================================
--- trunk/scipy/spatial/qhull/src/geom2.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/geom2.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -2,66 +2,68 @@
   >--------------------------------
 
 
-   geom2.c 
+   geom2.c
    infrequently used geometric routines of qhull
 
    see qh-geom.htm and geom.h
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/geom2.c#29 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 
    frequently used code goes into geom.c
 */
-   
+
 #include "qhull_a.h"
-   
+
 /*================== functions in alphabetic order ============*/
 
 /*---------------------------------
 
   qh_copypoints( points, numpoints, dimension)
-    return malloc'd copy of points
+    return qh_malloc'd copy of points
 */
-coordT *qh_copypoints (coordT *points, int numpoints, int dimension) {
+coordT *qh_copypoints(coordT *points, int numpoints, int dimension) {
   int size;
   coordT *newpoints;
 
-  size= numpoints * dimension * sizeof(coordT);
-  if (!(newpoints=(coordT*)malloc(size))) {
-    fprintf(qh ferr, "qhull error: insufficient memory to copy %d points\n",
+  size= numpoints * dimension * (int)sizeof(coordT);
+  if (!(newpoints=(coordT*)qh_malloc((size_t)size))) {
+    qh_fprintf(qh ferr, 6004, "qhull error: insufficient memory to copy %d points\n",
         numpoints);
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
-  memcpy ((char *)newpoints, (char *)points, size);
+  memcpy((char *)newpoints, (char *)points, (size_t)size);
   return newpoints;
 } /* copypoints */
 
 /*---------------------------------
-  
+
   qh_crossproduct( dim, vecA, vecB, vecC )
     crossproduct of 2 dim vectors
     C= A x B
-  
+
   notes:
     from Glasner, Graphics Gems I, p. 639
     only defined for dim==3
 */
-void qh_crossproduct (int dim, realT vecA[3], realT vecB[3], realT vecC[3]){
+void qh_crossproduct(int dim, realT vecA[3], realT vecB[3], realT vecC[3]){
 
   if (dim == 3) {
     vecC[0]=   det2_(vecA[1], vecA[2],
-		     vecB[1], vecB[2]);
+                     vecB[1], vecB[2]);
     vecC[1]= - det2_(vecA[0], vecA[2],
-		     vecB[0], vecB[2]);
+                     vecB[0], vecB[2]);
     vecC[2]=   det2_(vecA[0], vecA[1],
-		     vecB[0], vecB[1]);
+                     vecB[0], vecB[1]);
   }
 } /* vcross */
 
 /*---------------------------------
-  
+
   qh_determinant( rows, dim, nearzero )
     compute signed determinant of a square matrix
     uses qh.NEARzero to test for degenerate matrices
@@ -71,34 +73,34 @@
     overwrites rows and the matrix
     if dim == 2 or 3
       nearzero iff determinant < qh NEARzero[dim-1]
-      (not quite correct, not critical)
+      (!quite correct, not critical)
     if dim >= 4
       nearzero iff diagonal[k] < qh NEARzero[k]
 */
-realT qh_determinant (realT **rows, int dim, boolT *nearzero) {
+realT qh_determinant(realT **rows, int dim, boolT *nearzero) {
   realT det=0;
   int i;
   boolT sign= False;
 
   *nearzero= False;
   if (dim < 2) {
-    fprintf (qh ferr, "qhull internal error (qh_determinate): only implemented for dimension >= 2\n");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6005, "qhull internal error (qh_determinate): only implemented for dimension >= 2\n");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }else if (dim == 2) {
     det= det2_(rows[0][0], rows[0][1],
-		 rows[1][0], rows[1][1]);
+                 rows[1][0], rows[1][1]);
     if (fabs_(det) < qh NEARzero[1])  /* not really correct, what should this be? */
       *nearzero= True;
   }else if (dim == 3) {
     det= det3_(rows[0][0], rows[0][1], rows[0][2],
-		 rows[1][0], rows[1][1], rows[1][2],
-		 rows[2][0], rows[2][1], rows[2][2]);
+                 rows[1][0], rows[1][1], rows[1][2],
+                 rows[2][0], rows[2][1], rows[2][2]);
     if (fabs_(det) < qh NEARzero[2])  /* not really correct, what should this be? */
       *nearzero= True;
-  }else {	
+  }else {
     qh_gausselim(rows, dim, dim, &sign, nearzero);  /* if nearzero, diagonal still ok*/
     det= 1.0;
-    for (i= dim; i--; )
+    for (i=dim; i--; )
       det *= (rows[i])[i];
     if (sign)
       det= -det;
@@ -108,7 +110,7 @@
 
 /*---------------------------------
-  
+
   qh_detjoggle( points, numpoints, dimension )
     determine default max joggle for point array
       as qh_distround * qh_JOGGLEdefault
@@ -122,7 +124,7 @@
 
     loop duplicated from qh_maxmin
 */
-realT qh_detjoggle (pointT *points, int numpoints, int dimension) {
+realT qh_detjoggle(pointT *points, int numpoints, int dimension) {
   realT abscoord, distround, joggle, maxcoord, mincoord;
   pointT *point, *pointtemp;
   realT maxabs= -REALmax;
@@ -130,7 +132,7 @@
   realT maxwidth= 0;
   int k;
 
-  for (k= 0; k < dimension; k++) {
+  for (k=0; k < dimension; k++) {
     if (qh SCALElast && k == dimension-1)
       abscoord= maxwidth;
     else if (qh DELAUNAY && k == dimension-1) /* will qh_setdelaunay() */
@@ -139,7 +141,7 @@
       maxcoord= -REALmax;
       mincoord= REALmax;
       FORALLpoint_(points, numpoints) {
-	maximize_(maxcoord, point[k]);
+        maximize_(maxcoord, point[k]);
         minimize_(mincoord, point[k]);
       }
       maximize_(maxwidth, maxcoord-mincoord);
@@ -148,19 +150,19 @@
     sumabs += abscoord;
     maximize_(maxabs, abscoord);
   } /* for k */
-  distround= qh_distround (qh hull_dim, maxabs, sumabs);
+  distround= qh_distround(qh hull_dim, maxabs, sumabs);
   joggle= distround * qh_JOGGLEdefault;
   maximize_(joggle, REALepsilon * qh_JOGGLEdefault);
-  trace2((qh ferr, "qh_detjoggle: joggle=%2.2g maxwidth=%2.2g\n", joggle, maxwidth));
+  trace2((qh ferr, 2001, "qh_detjoggle: joggle=%2.2g maxwidth=%2.2g\n", joggle, maxwidth));
   return joggle;
 } /* detjoggle */
 
 /*---------------------------------
-  
+
   qh_detroundoff()
     determine maximum roundoff errors from
-      REALepsilon, REALmax, REALmin, qh.hull_dim, qh.MAXabs_coord, 
+      REALepsilon, REALmax, REALmin, qh.hull_dim, qh.MAXabs_coord,
       qh.MAXsumcoord, qh.MAXwidth, qh.MINdenom_1
 
     accounts for qh.SETroundoff, qh.RANDOMdist, qh MERGEexact
@@ -185,17 +187,17 @@
       qh.MINoutside, qh.WIDEfacet
     initialize qh.max_vertex and qh.minvertex
 */
-void qh_detroundoff (void) {
+void qh_detroundoff(void) {
 
-  qh_option ("_max-width", NULL, &qh MAXwidth);
+  qh_option("_max-width", NULL, &qh MAXwidth);
   if (!qh SETroundoff) {
-    qh DISTround= qh_distround (qh hull_dim, qh MAXabs_coord, qh MAXsumcoord);
+    qh DISTround= qh_distround(qh hull_dim, qh MAXabs_coord, qh MAXsumcoord);
     if (qh RANDOMdist)
       qh DISTround += qh RANDOMfactor * qh MAXabs_coord;
-    qh_option ("Error-roundoff", NULL, &qh DISTround);
+    qh_option("Error-roundoff", NULL, &qh DISTround);
   }
   qh MINdenom= qh MINdenom_1 * qh MAXabs_coord;
-  qh MINdenom_1_2= sqrt (qh MINdenom_1 * qh hull_dim) ;  /* if will be normalized */
+  qh MINdenom_1_2= sqrt(qh MINdenom_1 * qh hull_dim) ;  /* if will be normalized */
   qh MINdenom_2= qh MINdenom_1_2 * qh MAXabs_coord;
                                               /* for inner product */
   qh ANGLEround= 1.01 * qh hull_dim * REALepsilon;
@@ -203,49 +205,49 @@
     qh ANGLEround += qh RANDOMfactor;
   if (qh premerge_cos < REALmax/2) {
     qh premerge_cos -= qh ANGLEround;
-    if (qh RANDOMdist) 
-      qh_option ("Angle-premerge-with-random", NULL, &qh premerge_cos);
+    if (qh RANDOMdist)
+      qh_option("Angle-premerge-with-random", NULL, &qh premerge_cos);
   }
   if (qh postmerge_cos < REALmax/2) {
     qh postmerge_cos -= qh ANGLEround;
     if (qh RANDOMdist)
-      qh_option ("Angle-postmerge-with-random", NULL, &qh postmerge_cos);
+      qh_option("Angle-postmerge-with-random", NULL, &qh postmerge_cos);
   }
   qh premerge_centrum += 2 * qh DISTround;    /*2 for centrum and distplane()*/
   qh postmerge_centrum += 2 * qh DISTround;
   if (qh RANDOMdist && (qh MERGEexact || qh PREmerge))
-    qh_option ("Centrum-premerge-with-random", NULL, &qh premerge_centrum);
+    qh_option("Centrum-premerge-with-random", NULL, &qh premerge_centrum);
   if (qh RANDOMdist && qh POSTmerge)
-    qh_option ("Centrum-postmerge-with-random", NULL, &qh postmerge_centrum);
+    qh_option("Centrum-postmerge-with-random", NULL, &qh postmerge_centrum);
   { /* compute ONEmerge, max vertex offset for merging simplicial facets */
     realT maxangle= 1.0, maxrho;
-    
+
     minimize_(maxangle, qh premerge_cos);
     minimize_(maxangle, qh postmerge_cos);
     /* max diameter * sin theta + DISTround for vertex to its hyperplane */
-    qh ONEmerge= sqrt (qh hull_dim) * qh MAXwidth *
-      sqrt (1.0 - maxangle * maxangle) + qh DISTround;  
+    qh ONEmerge= sqrt((realT)qh hull_dim) * qh MAXwidth *
+      sqrt(1.0 - maxangle * maxangle) + qh DISTround;
     maxrho= qh hull_dim * qh premerge_centrum + qh DISTround;
     maximize_(qh ONEmerge, maxrho);
     maxrho= qh hull_dim * qh postmerge_centrum + qh DISTround;
     maximize_(qh ONEmerge, maxrho);
     if (qh MERGING)
-      qh_option ("_one-merge", NULL, &qh ONEmerge);
+      qh_option("_one-merge", NULL, &qh ONEmerge);
   }
   qh NEARinside= qh ONEmerge * qh_RATIOnearinside; /* only used if qh KEEPnearinside */
   if (qh JOGGLEmax < REALmax/2 && (qh KEEPcoplanar || qh KEEPinside)) {
-    realT maxdist;	       /* adjust qh.NEARinside for joggle */
-    qh KEEPnearinside= True;   
-    maxdist= sqrt (qh hull_dim) * qh JOGGLEmax + qh DISTround;
+    realT maxdist;             /* adjust qh.NEARinside for joggle */
+    qh KEEPnearinside= True;
+    maxdist= sqrt((realT)qh hull_dim) * qh JOGGLEmax + qh DISTround;
     maxdist= 2*maxdist;        /* vertex and coplanar point can joggle in opposite directions */
     maximize_(qh NEARinside, maxdist);  /* must agree with qh_nearcoplanar() */
   }
   if (qh KEEPnearinside)
-    qh_option ("_near-inside", NULL, &qh NEARinside);
+    qh_option("_near-inside", NULL, &qh NEARinside);
   if (qh JOGGLEmax < qh DISTround) {
-    fprintf (qh ferr, "qhull error: the joggle for 'QJn', %.2g, is below roundoff for distance computations, %.2g\n",
+    qh_fprintf(qh ferr, 6006, "qhull error: the joggle for 'QJn', %.2g, is below roundoff for distance computations, %.2g\n",
          qh JOGGLEmax, qh DISTround);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (qh MINvisible > REALmax/2) {
     if (!qh MERGING)
@@ -256,26 +258,26 @@
       qh MINvisible= qh_COPLANARratio * qh premerge_centrum;
     if (qh APPROXhull && qh MINvisible > qh MINoutside)
       qh MINvisible= qh MINoutside;
-    qh_option ("Visible-distance", NULL, &qh MINvisible);
+    qh_option("Visible-distance", NULL, &qh MINvisible);
   }
   if (qh MAXcoplanar > REALmax/2) {
     qh MAXcoplanar= qh MINvisible;
-    qh_option ("U-coplanar-distance", NULL, &qh MAXcoplanar);
+    qh_option("U-coplanar-distance", NULL, &qh MAXcoplanar);
   }
   if (!qh APPROXhull) {             /* user may specify qh MINoutside */
     qh MINoutside= 2 * qh MINvisible;
-    if (qh premerge_cos < REALmax/2) 
+    if (qh premerge_cos < REALmax/2)
       maximize_(qh MINoutside, (1- qh premerge_cos) * qh MAXabs_coord);
-    qh_option ("Width-outside", NULL, &qh MINoutside);
+    qh_option("Width-outside", NULL, &qh MINoutside);
   }
   qh WIDEfacet= qh MINoutside;
-  maximize_(qh WIDEfacet, qh_WIDEcoplanar * qh MAXcoplanar); 
-  maximize_(qh WIDEfacet, qh_WIDEcoplanar * qh MINvisible); 
-  qh_option ("_wide-facet", NULL, &qh WIDEfacet);
-  if (qh MINvisible > qh MINoutside + 3 * REALepsilon 
+  maximize_(qh WIDEfacet, qh_WIDEcoplanar * qh MAXcoplanar);
+  maximize_(qh WIDEfacet, qh_WIDEcoplanar * qh MINvisible);
+  qh_option("_wide-facet", NULL, &qh WIDEfacet);
+  if (qh MINvisible > qh MINoutside + 3 * REALepsilon
   && !qh BESToutside && !qh FORCEoutput)
-    fprintf (qh ferr, "qhull input warning: minimum visibility V%.2g is greater than \nminimum outside W%.2g.  Flipped facets are likely.\n",
-	     qh MINvisible, qh MINoutside);
+    qh_fprintf(qh ferr, 7001, "qhull input warning: minimum visibility V%.2g is greater than \nminimum outside W%.2g.  Flipped facets are likely.\n",
+             qh MINvisible, qh MINoutside);
   qh max_vertex= qh DISTround;
   qh min_vertex= -qh DISTround;
   /* numeric constants reported in printsummary */
@@ -283,7 +285,7 @@
 
 /*---------------------------------
-  
+
   qh_detsimplex( apex, points, dim, nearzero )
     compute determinant of a simplex with point apex and base points
 
@@ -312,42 +314,42 @@
     rows[i++]= gmcoord;
     coordp= point;
     coorda= apex;
-    for (k= dim; k--; )
+    for (k=dim; k--; )
       *(gmcoord++)= *coordp++ - *coorda++;
   }
   if (i < dim) {
-    fprintf (qh ferr, "qhull internal error (qh_detsimplex): #points %d < dimension %d\n", 
+    qh_fprintf(qh ferr, 6007, "qhull internal error (qh_detsimplex): #points %d < dimension %d\n",
                i, dim);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
-  det= qh_determinant (rows, dim, nearzero);
-  trace2((qh ferr, "qh_detsimplex: det=%2.2g for point p%d, dim %d, nearzero? %d\n",
-	  det, qh_pointid(apex), dim, *nearzero)); 
+  det= qh_determinant(rows, dim, nearzero);
+  trace2((qh ferr, 2002, "qh_detsimplex: det=%2.2g for point p%d, dim %d, nearzero? %d\n",
+          det, qh_pointid(apex), dim, *nearzero));
   return det;
 } /* detsimplex */
 
 /*---------------------------------
-  
+
   qh_distnorm( dim, point, normal, offset )
     return distance from point to hyperplane at normal/offset
 
   returns:
     dist
-  
-  notes:  
+
+  notes:
     dist > 0 if point is outside of hyperplane
-  
+
   see:
     qh_distplane in geom.c
 */
-realT qh_distnorm (int dim, pointT *point, pointT *normal, realT *offsetp) {
+realT qh_distnorm(int dim, pointT *point, pointT *normal, realT *offsetp) {
   coordT *normalp= normal, *coordp= point;
   realT dist;
   int k;
 
   dist= *offsetp;
-  for (k= dim; k--; )
+  for (k=dim; k--; )
     dist += *(coordp++) * *(normalp++);
   return dist;
 } /* distnorm */
@@ -355,7 +357,7 @@
 /*---------------------------------
 
-  qh_distround ( dimension, maxabs, maxsumabs )
+  qh_distround(dimension, maxabs, maxsumabs )
     compute maximum round-off error for a distance computation
       to a normalized hyperplane
     maxabs is the maximum absolute value of a coordinate
@@ -370,21 +372,21 @@
     use sqrt(dim) since one vector is normalized
       or use maxsumabs since one vector is < 1
 */
-realT qh_distround (int dimension, realT maxabs, realT maxsumabs) {
+realT qh_distround(int dimension, realT maxabs, realT maxsumabs) {
   realT maxdistsum, maxround;
 
-  maxdistsum= sqrt (dimension) * maxabs;
+  maxdistsum= sqrt((realT)dimension) * maxabs;
   minimize_( maxdistsum, maxsumabs);
   maxround= REALepsilon * (dimension * maxdistsum * 1.01 + maxabs);
               /* adds maxabs for offset */
-  trace4((qh ferr, "qh_distround: %2.2g maxabs %2.2g maxsumabs %2.2g maxdistsum %2.2g\n",
-	         maxround, maxabs, maxsumabs, maxdistsum));
+  trace4((qh ferr, 4008, "qh_distround: %2.2g maxabs %2.2g maxsumabs %2.2g maxdistsum %2.2g\n",
+                 maxround, maxabs, maxsumabs, maxdistsum));
   return maxround;
 } /* distround */
 
 /*---------------------------------
-  
+
   qh_divzero( numer, denom, mindenom1, zerodiv )
     divide by a number that's nearly zero
     mindenom1= minimum denominator for dividing into 1.0
@@ -392,7 +394,7 @@
   returns:
     quotient
     sets zerodiv and returns 0.0 if it would overflow
-  
+
   design:
     if numer is nearly zero and abs(numer) < abs(denom)
       return numer/denom
@@ -403,10 +405,10 @@
     else
       return 0 and zerodiv
 */
-realT qh_divzero (realT numer, realT denom, realT mindenom1, boolT *zerodiv) {
+realT qh_divzero(realT numer, realT denom, realT mindenom1, boolT *zerodiv) {
   realT temp, numerx, denomx;
-  
 
+
   if (numer < mindenom1 && numer > -mindenom1) {
     numerx= fabs_(numer);
     denomx= fabs_(denom);
@@ -427,22 +429,22 @@
     return 0.0;
   }
 } /* divzero */
-  
 
+
 /*---------------------------------
 
   qh_facetarea( facet )
     return area for a facet
-  
+
   notes:
-    if non-simplicial, 
+    if non-simplicial,
       uses centrum to triangulate facet and sums the projected areas.
     if (qh DELAUNAY),
       computes projected area instead for last coordinate
     assumes facet->normal exists
     projecting tricoplanar facets to the hyperplane does not appear to make a difference
-  
+
   design:
     if simplicial
       compute area
@@ -451,7 +453,7 @@
         compute area from centrum to ridge
     negate area if upper Delaunay facet
 */
-realT qh_facetarea (facetT *facet) {
+realT qh_facetarea(facetT *facet) {
   vertexT *apex;
   pointT *centrum;
   realT area= 0.0;
@@ -459,22 +461,22 @@
 
   if (facet->simplicial) {
     apex= SETfirstt_(facet->vertices, vertexT);
-    area= qh_facetarea_simplex (qh hull_dim, apex->point, facet->vertices, 
+    area= qh_facetarea_simplex(qh hull_dim, apex->point, facet->vertices,
                     apex, facet->toporient, facet->normal, &facet->offset);
   }else {
     if (qh CENTERtype == qh_AScentrum)
       centrum= facet->center;
     else
-      centrum= qh_getcentrum (facet);
-    FOREACHridge_(facet->ridges) 
-      area += qh_facetarea_simplex (qh hull_dim, centrum, ridge->vertices, 
-                 NULL, (ridge->top == facet),  facet->normal, &facet->offset);
+      centrum= qh_getcentrum(facet);
+    FOREACHridge_(facet->ridges)
+      area += qh_facetarea_simplex(qh hull_dim, centrum, ridge->vertices,
+                 NULL, (boolT)(ridge->top == facet),  facet->normal, &facet->offset);
     if (qh CENTERtype != qh_AScentrum)
-      qh_memfree (centrum, qh normal_size);
+      qh_memfree(centrum, qh normal_size);
   }
   if (facet->upperdelaunay && qh DELAUNAY)
     area= -area;  /* the normal should be [0,...,1] */
-  trace4((qh ferr, "qh_facetarea: f%d area %2.2g\n", facet->id, area)); 
+  trace4((qh ferr, 4009, "qh_facetarea: f%d area %2.2g\n", facet->id, area));
   return area;
 } /* facetarea */
 
@@ -482,22 +484,22 @@
   >--------------------------------
 
   qh_facetarea_simplex( dim, apex, vertices, notvertex, toporient, normal, offset )
-    return area for a simplex defined by 
+    return area for a simplex defined by
       an apex, a base of vertices, an orientation, and a unit normal
-    if simplicial or tricoplanar facet, 
+    if simplicial or tricoplanar facet,
       notvertex is defined and it is skipped in vertices
-  
+
   returns:
     computes area of simplex projected to plane [normal,offset]
     returns 0 if vertex too far below plane (qh WIDEfacet)
       vertex can't be apex of tricoplanar facet
-  
+
   notes:
     if (qh DELAUNAY),
       computes projected area instead for last coordinate
     uses qh gm_matrix/gm_row and qh hull_dim
     helper function for qh_facetarea
-  
+
   design:
     if Notvertex
       translate simplex to apex
@@ -505,13 +507,13 @@
       project simplex to normal/offset
       translate simplex to apex
     if Delaunay
-      set last row/column to 0 with -1 on diagonal 
+      set last row/column to 0 with -1 on diagonal
     else
       set last row to Normal
     compute determinate
     scale and flip sign for area
 */
-realT qh_facetarea_simplex (int dim, coordT *apex, setT *vertices, 
+realT qh_facetarea_simplex(int dim, coordT *apex, setT *vertices,
         vertexT *notvertex,  boolT toporient, coordT *normal, realT *offset) {
   pointT *coorda, *coordp, *gmcoord;
   coordT **rows, *normalp;
@@ -530,76 +532,76 @@
     coordp= vertex->point;
     normalp= normal;
     if (notvertex) {
-      for (k= dim; k--; )
-	*(gmcoord++)= *coordp++ - *coorda++;
+      for (k=dim; k--; )
+        *(gmcoord++)= *coordp++ - *coorda++;
     }else {
       dist= *offset;
-      for (k= dim; k--; )
-	dist += *coordp++ * *normalp++;
+      for (k=dim; k--; )
+        dist += *coordp++ * *normalp++;
       if (dist < -qh WIDEfacet) {
-	zinc_(Znoarea);
-	return 0.0;
+        zinc_(Znoarea);
+        return 0.0;
       }
       coordp= vertex->point;
       normalp= normal;
-      for (k= dim; k--; )
-	*(gmcoord++)= (*coordp++ - dist * *normalp++) - *coorda++;
+      for (k=dim; k--; )
+        *(gmcoord++)= (*coordp++ - dist * *normalp++) - *coorda++;
     }
   }
   if (i != dim-1) {
-    fprintf (qh ferr, "qhull internal error (qh_facetarea_simplex): #points %d != dim %d -1\n", 
+    qh_fprintf(qh ferr, 6008, "qhull internal error (qh_facetarea_simplex): #points %d != dim %d -1\n",
                i, dim);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   rows[i]= gmcoord;
   if (qh DELAUNAY) {
-    for (i= 0; i < dim-1; i++)
+    for (i=0; i < dim-1; i++)
       rows[i][dim-1]= 0.0;
-    for (k= dim; k--; )
+    for (k=dim; k--; )
       *(gmcoord++)= 0.0;
     rows[dim-1][dim-1]= -1.0;
   }else {
     normalp= normal;
-    for (k= dim; k--; )
+    for (k=dim; k--; )
       *(gmcoord++)= *normalp++;
   }
   zinc_(Zdetsimplex);
-  area= qh_determinant (rows, dim, &nearzero);
+  area= qh_determinant(rows, dim, &nearzero);
   if (toporient)
     area= -area;
   area *= qh AREAfactor;
-  trace4((qh ferr, "qh_facetarea_simplex: area=%2.2g for point p%d, toporient %d, nearzero? %d\n",
-	  area, qh_pointid(apex), toporient, nearzero)); 
+  trace4((qh ferr, 4010, "qh_facetarea_simplex: area=%2.2g for point p%d, toporient %d, nearzero? %d\n",
+          area, qh_pointid(apex), toporient, nearzero));
   return area;
 } /* facetarea_simplex */
 
 /*---------------------------------
-  
+
   qh_facetcenter( vertices )
     return Voronoi center (Voronoi vertex) for a facet's vertices
 
   returns:
     return temporary point equal to the center
-    
+
   see:
     qh_voronoi_center()
 */
-pointT *qh_facetcenter (setT *vertices) {
-  setT *points= qh_settemp (qh_setsize (vertices));
+pointT *qh_facetcenter(setT *vertices) {
+  setT *points= qh_settemp(qh_setsize(vertices));
   vertexT *vertex, **vertexp;
   pointT *center;
-  
-  FOREACHvertex_(vertices) 
-    qh_setappend (&points, vertex->point);
-  center= qh_voronoi_center (qh hull_dim-1, points);
-  qh_settempfree (&points);
+
+  FOREACHvertex_(vertices)
+    qh_setappend(&points, vertex->point);
+  center= qh_voronoi_center(qh hull_dim-1, points);
+  qh_settempfree(&points);
   return center;
 } /* facetcenter */
 
 /*---------------------------------
-  
+
   qh_findgooddist( point, facetA, dist, facetlist )
     find best good facet visible for point from facetA
     assumes facetA is visible from point
@@ -608,7 +610,7 @@
     best facet, i.e., good facet that is furthest from point
       distance to best facet
       NULL if none
-      
+
     moves good, visible facets (and some other visible facets)
       to end of qh facet_list
 
@@ -624,20 +626,20 @@
         update best good neighbor
         if no good neighbors, update best facet
 */
-facetT *qh_findgooddist (pointT *point, facetT *facetA, realT *distp, 
+facetT *qh_findgooddist(pointT *point, facetT *facetA, realT *distp,
                facetT **facetlist) {
   realT bestdist= -REALmax, dist;
   facetT *neighbor, **neighborp, *bestfacet=NULL, *facet;
-  boolT goodseen= False;  
+  boolT goodseen= False;
 
   if (facetA->good) {
-    zinc_(Zcheckpart);  /* calls from check_bestdist occur after print stats */
-    qh_distplane (point, facetA, &bestdist);
+    zzinc_(Zcheckpart);  /* calls from check_bestdist occur after print stats */
+    qh_distplane(point, facetA, &bestdist);
     bestfacet= facetA;
     goodseen= True;
   }
-  qh_removefacet (facetA);
-  qh_appendfacet (facetA);
+  qh_removefacet(facetA);
+  qh_appendfacet(facetA);
   *facetlist= facetA;
   facetA->visitid= ++qh visit_id;
   FORALLfacet_(*facetlist) {
@@ -647,11 +649,11 @@
       neighbor->visitid= qh visit_id;
       if (goodseen && !neighbor->good)
         continue;
-      zinc_(Zcheckpart); 
-      qh_distplane (point, neighbor, &dist);
+      zzinc_(Zcheckpart);
+      qh_distplane(point, neighbor, &dist);
       if (dist > 0) {
-        qh_removefacet (neighbor);
-        qh_appendfacet (neighbor);
+        qh_removefacet(neighbor);
+        qh_appendfacet(neighbor);
         if (neighbor->good) {
           goodseen= True;
           if (dist > bestdist) {
@@ -664,60 +666,66 @@
   }
   if (bestfacet) {
     *distp= bestdist;
-    trace2((qh ferr, "qh_findgooddist: p%d is %2.2g above good facet f%d\n",
+    trace2((qh ferr, 2003, "qh_findgooddist: p%d is %2.2g above good facet f%d\n",
       qh_pointid(point), bestdist, bestfacet->id));
     return bestfacet;
   }
-  trace4((qh ferr, "qh_findgooddist: no good facet for p%d above f%d\n", 
+  trace4((qh ferr, 4011, "qh_findgooddist: no good facet for p%d above f%d\n",
       qh_pointid(point), facetA->id));
   return NULL;
 }  /* findgooddist */
-    
+
 /*---------------------------------
-  
+
   qh_getarea( facetlist )
     set area of all facets in facetlist
     collect statistics
+    nop if hasAreaVolume
 
   returns:
     sets qh totarea/totvol to total area and volume of convex hull
     for Delaunay triangulation, computes projected area of the lower or upper hull
       ignores upper hull if qh ATinfinity
-  
+
   notes:
     could compute outer volume by expanding facet area by rays from interior
     the following attempt at perpendicular projection underestimated badly:
-      qh.totoutvol += (-dist + facet->maxoutside + qh DISTround) 
+      qh.totoutvol += (-dist + facet->maxoutside + qh DISTround)
                             * area/ qh hull_dim;
   design:
     for each facet on facetlist
       compute facet->area
       update qh.totarea and qh.totvol
 */
-void qh_getarea (facetT *facetlist) {
+void qh_getarea(facetT *facetlist) {
   realT area;
   realT dist;
   facetT *facet;
 
+  if (qh hasAreaVolume)
+    return;
   if (qh REPORTfreq)
-    fprintf (qh ferr, "computing area of each facet and volume of the convex hull\n");
-  else 
-    trace1((qh ferr, "qh_getarea: computing volume and area for each facet\n"));
+    qh_fprintf(qh ferr, 8020, "computing area of each facet and volume of the convex hull\n");
+  else
+    trace1((qh ferr, 1001, "qh_getarea: computing volume and area for each facet\n"));
   qh totarea= qh totvol= 0.0;
   FORALLfacet_(facetlist) {
     if (!facet->normal)
       continue;
     if (facet->upperdelaunay && qh ATinfinity)
       continue;
-    facet->f.area= area= qh_facetarea (facet);
-    facet->isarea= True;
+    if (!facet->isarea) {
+      facet->f.area= qh_facetarea(facet);
+      facet->isarea= True;
+    }
+    area= facet->f.area;
     if (qh DELAUNAY) {
       if (facet->upperdelaunay == qh UPPERdelaunay)
-	qh totarea += area;
+        qh totarea += area;
     }else {
       qh totarea += area;
-      qh_distplane (qh interior_point, facet, &dist);
+      qh_distplane(qh interior_point, facet, &dist);
       qh totvol += -dist * area/ qh hull_dim;
     }
     if (qh PRINTstatistics) {
@@ -726,11 +734,12 @@
       wmin_(Wareamin, area);
     }
   }
+  qh hasAreaVolume= True;
 } /* getarea */
 
 /*---------------------------------
-  
+
   qh_gram_schmidt( dim, row )
     implements Gram-Schmidt orthogonalization by rows
 
@@ -753,8 +762,8 @@
 boolT qh_gram_schmidt(int dim, realT **row) {
   realT *rowi, *rowj, norm;
   int i, j, k;
-  
-  for(i=0; i < dim; i++) {
+
+  for (i=0; i < dim; i++) {
     rowi= row[i];
     for (norm= 0.0, k= dim; k--; rowi++)
       norm += *rowi * *rowi;
@@ -762,14 +771,14 @@
     wmin_(Wmindenom, norm);
     if (norm == 0.0)  /* either 0 or overflow due to sqrt */
       return False;
-    for(k= dim; k--; )
-      *(--rowi) /= norm;  
-    for(j= i+1; j < dim; j++) {
+    for (k=dim; k--; )
+      *(--rowi) /= norm;
+    for (j=i+1; j < dim; j++) {
       rowj= row[j];
-      for(norm= 0.0, k=dim; k--; )
-	norm += *rowi++ * *rowj++;
-      for(k=dim; k--; )
-	*(--rowj) -= *(--rowi) * norm;
+      for (norm= 0.0, k=dim; k--; )
+        norm += *rowi++ * *rowj++;
+      for (k=dim; k--; )
+        *(--rowj) -= *(--rowi) * norm;
     }
   }
   return True;
@@ -778,7 +787,7 @@
 
 /*---------------------------------
-  
+
   qh_inthresholds( normal, angle )
     return True if normal within qh.lower_/upper_threshold
 
@@ -786,7 +795,7 @@
     estimate of angle by summing of threshold diffs
       angle may be NULL
       smaller "angle" is better
-  
+
   notes:
     invalid if qh.SPLITthresholds
 
@@ -798,21 +807,21 @@
     for each dimension
       test threshold
 */
-boolT qh_inthresholds (coordT *normal, realT *angle) {
+boolT qh_inthresholds(coordT *normal, realT *angle) {
   boolT within= True;
   int k;
   realT threshold;
 
   if (angle)
     *angle= 0.0;
-  for(k= 0; k < qh hull_dim; k++) {
+  for (k=0; k < qh hull_dim; k++) {
     threshold= qh lower_threshold[k];
     if (threshold > -REALmax/2) {
       if (normal[k] < threshold)
         within= False;
       if (angle) {
-	threshold -= normal[k];
-	*angle += fabs_(threshold);
+        threshold -= normal[k];
+        *angle += fabs_(threshold);
       }
     }
     if (qh upper_threshold[k] < REALmax/2) {
@@ -820,23 +829,23 @@
       if (normal[k] > threshold)
         within= False;
       if (angle) {
-	threshold -= normal[k];
-	*angle += fabs_(threshold);
+        threshold -= normal[k];
+        *angle += fabs_(threshold);
       }
     }
   }
   return within;
 } /* inthresholds */
-    
 
+
 /*---------------------------------
-  
+
   qh_joggleinput()
     randomly joggle input to Qhull by qh.JOGGLEmax
     initial input is qh.first_point/qh.num_points of qh.hull_dim
       repeated calls use qh.input_points/qh.num_points
- 
+
   returns:
     joggles points at qh.first_point/qh.num_points
     copies data to qh.input_points/qh.input_malloc if first time
@@ -861,8 +870,8 @@
     if qh.DELAUNAY
       sets the Delaunay projection
 */
-void qh_joggleinput (void) {
-  int size, i, seed;
+void qh_joggleinput(void) {
+  int i, seed, size;
   coordT *coordp, *inputp;
   realT randr, randa, randb;
 
@@ -870,66 +879,66 @@
     qh input_points= qh first_point;
     qh input_malloc= qh POINTSmalloc;
     size= qh num_points * qh hull_dim * sizeof(coordT);
-    if (!(qh first_point=(coordT*)malloc(size))) {
-      fprintf(qh ferr, "qhull error: insufficient memory to joggle %d points\n",
+    if (!(qh first_point=(coordT*)qh_malloc((size_t)size))) {
+      qh_fprintf(qh ferr, 6009, "qhull error: insufficient memory to joggle %d points\n",
           qh num_points);
       qh_errexit(qh_ERRmem, NULL, NULL);
     }
     qh POINTSmalloc= True;
     if (qh JOGGLEmax == 0.0) {
-      qh JOGGLEmax= qh_detjoggle (qh input_points, qh num_points, qh hull_dim);
-      qh_option ("QJoggle", NULL, &qh JOGGLEmax);
+      qh JOGGLEmax= qh_detjoggle(qh input_points, qh num_points, qh hull_dim);
+      qh_option("QJoggle", NULL, &qh JOGGLEmax);
     }
   }else {                 /* repeated call */
     if (!qh RERUN && qh build_cnt > qh_JOGGLEretry) {
       if (((qh build_cnt-qh_JOGGLEretry-1) % qh_JOGGLEagain) == 0) {
-	realT maxjoggle= qh MAXwidth * qh_JOGGLEmaxincrease;
-	if (qh JOGGLEmax < maxjoggle) {
-	  qh JOGGLEmax *= qh_JOGGLEincrease;
-	  minimize_(qh JOGGLEmax, maxjoggle); 
-	}
+        realT maxjoggle= qh MAXwidth * qh_JOGGLEmaxincrease;
+        if (qh JOGGLEmax < maxjoggle) {
+          qh JOGGLEmax *= qh_JOGGLEincrease;
+          minimize_(qh JOGGLEmax, maxjoggle);
+        }
       }
     }
-    qh_option ("QJoggle", NULL, &qh JOGGLEmax);
+    qh_option("QJoggle", NULL, &qh JOGGLEmax);
   }
   if (qh build_cnt > 1 && qh JOGGLEmax > fmax_(qh MAXwidth/4, 0.1)) {
-      fprintf (qh ferr, "qhull error: the current joggle for 'QJn', %.2g, is too large for the width\nof the input.  If possible, recompile Qhull with higher-precision reals.\n",
-	        qh JOGGLEmax);
-      qh_errexit (qh_ERRqhull, NULL, NULL);
+      qh_fprintf(qh ferr, 6010, "qhull error: the current joggle for 'QJn', %.2g, is too large for the width\nof the input.  If possible, recompile Qhull with higher-precision reals.\n",
+                qh JOGGLEmax);
+      qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   /* for some reason, using qh ROTATErandom and qh_RANDOMseed does not repeat the run. Use 'TRn' instead */
   seed= qh_RANDOMint;
-  qh_option ("_joggle-seed", &seed, NULL);
-  trace0((qh ferr, "qh_joggleinput: joggle input by %2.2g with seed %d\n", 
+  qh_option("_joggle-seed", &seed, NULL);
+  trace0((qh ferr, 6, "qh_joggleinput: joggle input by %2.2g with seed %d\n",
     qh JOGGLEmax, seed));
   inputp= qh input_points;
   coordp= qh first_point;
   randa= 2.0 * qh JOGGLEmax/qh_RANDOMmax;
   randb= -qh JOGGLEmax;
   size= qh num_points * qh hull_dim;
-  for (i= size; i--; ) {
+  for (i=size; i--; ) {
     randr= qh_RANDOMint;
     *(coordp++)= *(inputp++) + (randr * randa + randb);
   }
   if (qh DELAUNAY) {
     qh last_low= qh last_high= qh last_newhigh= REALmax;
-    qh_setdelaunay (qh hull_dim, qh num_points, qh first_point);
+    qh_setdelaunay(qh hull_dim, qh num_points, qh first_point);
   }
 } /* joggleinput */
 
 /*---------------------------------
-  
+
   qh_maxabsval( normal, dim )
     return pointer to maximum absolute value of a dim vector
     returns NULL if dim=0
 */
-realT *qh_maxabsval (realT *normal, int dim) {
+realT *qh_maxabsval(realT *normal, int dim) {
   realT maxval= -REALmax;
   realT *maxp= NULL, *colp, absval;
   int k;
 
-  for (k= dim, colp= normal; k--; colp++) {
+  for (k=dim, colp= normal; k--; colp++) {
     absval= fabs_(*colp);
     if (absval > maxval) {
       maxval= absval;
@@ -942,9 +951,9 @@
 
 /*---------------------------------
-  
+
   qh_maxmin( points, numpoints, dimension )
-    return max/min points for each dimension      
+    return max/min points for each dimension
     determine max and min coordinates
 
   returns:
@@ -984,24 +993,24 @@
   && REALmax > 0.0 && -REALmax < 0.0)
     ; /* all ok */
   else {
-    fprintf (qh ferr, "qhull error: floating point constants in user.h are wrong\n\
+    qh_fprintf(qh ferr, 6011, "qhull error: floating point constants in user.h are wrong\n\
 REALepsilon %g REALmin %g REALmax %g -REALmax %g\n",
-	     REALepsilon, REALmin, REALmax, -REALmax);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+             REALepsilon, REALmin, REALmax, -REALmax);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   set= qh_settemp(2*dimension);
-  for(k= 0; k < dimension; k++) {
+  for (k=0; k < dimension; k++) {
     if (points == qh GOODpointp)
       minimum= maximum= points + dimension;
     else
       minimum= maximum= points;
     FORALLpoint_(points, numpoints) {
       if (point == qh GOODpointp)
-	continue;
+        continue;
       if (maximum[k] < point[k])
-	maximum= point;
+        maximum= point;
       else if (minimum[k] > point[k])
-	minimum= point;
+        minimum= point;
     }
     if (k == dimension-1) {
       qh MINlastcoord= minimum[k];
@@ -1020,15 +1029,15 @@
     }
     maximize_(qh MAXabs_coord, maxcoord);
     qh MAXsumcoord += maxcoord;
-    qh_setappend (&set, maximum);
-    qh_setappend (&set, minimum);
+    qh_setappend(&set, maximum);
+    qh_setappend(&set, minimum);
     /* calculation of qh NEARzero is based on error formula 4.4-13 of
        Golub & van Loan, authors say n^3 can be ignored and 10 be used in
        place of rho */
     qh NEARzero[k]= 80 * qh MAXsumcoord * REALepsilon;
   }
   if (qh IStracing >=1)
-    qh_printpoints (qh ferr, "qh_maxmin: found the max and min points (by dim):", set);
+    qh_printpoints(qh ferr, "qh_maxmin: found the max and min points(by dim):", set);
   return(set);
 } /* maxmin */
 
@@ -1042,33 +1051,33 @@
 
   see:
     qh_outerinner()
-    
+
   notes:
     need to add another qh.DISTround if testing actual point with computation
 
   for joggle:
     qh_setfacetplane() updated qh.max_outer for Wnewvertexmax (max distance to vertex)
-    need to use Wnewvertexmax since could have a coplanar point for a high 
+    need to use Wnewvertexmax since could have a coplanar point for a high
       facet that is replaced by a low facet
     need to add qh.JOGGLEmax if testing input points
 */
-realT qh_maxouter (void) {
+realT qh_maxouter(void) {
   realT dist;
 
   dist= fmax_(qh max_outside, qh DISTround);
   dist += qh DISTround;
-  trace4((qh ferr, "qh_maxouter: max distance from facet to outer plane is %2.2g max_outside is %2.2g\n", dist, qh max_outside));
+  trace4((qh ferr, 4012, "qh_maxouter: max distance from facet to outer plane is %2.2g max_outside is %2.2g\n", dist, qh max_outside));
   return dist;
 } /* maxouter */
 
 /*---------------------------------
-  
+
   qh_maxsimplex( dim, maxpoints, points, numpoints, simplex )
-    determines maximum simplex for a set of points 
+    determines maximum simplex for a set of points
     starts from points already in simplex
     skips qh.GOODpointp (assumes that it isn't in maxpoints)
-  
+
   returns:
     simplex with dim+1 points
 
@@ -1082,114 +1091,114 @@
       (find points with max or min x coordinate)
     for each remaining dimension
       add point that maximizes the determinate
-        (use points from maxpoints first)    
+        (use points from maxpoints first)
 */
-void qh_maxsimplex (int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex) {
+void qh_maxsimplex(int dim, setT *maxpoints, pointT *points, int numpoints, setT **simplex) {
   pointT *point, **pointp, *pointtemp, *maxpoint, *minx=NULL, *maxx=NULL;
   boolT nearzero, maxnearzero= False;
   int k, sizinit;
   realT maxdet= -REALmax, det, mincoord= REALmax, maxcoord= -REALmax;
 
-  sizinit= qh_setsize (*simplex);
+  sizinit= qh_setsize(*simplex);
   if (sizinit < 2) {
-    if (qh_setsize (maxpoints) >= 2) {
+    if (qh_setsize(maxpoints) >= 2) {
       FOREACHpoint_(maxpoints) {
         if (maxcoord < point[0]) {
           maxcoord= point[0];
           maxx= point;
         }
-	if (mincoord > point[0]) {
+        if (mincoord > point[0]) {
           mincoord= point[0];
           minx= point;
         }
       }
     }else {
       FORALLpoint_(points, numpoints) {
-	if (point == qh GOODpointp)
-	  continue;
+        if (point == qh GOODpointp)
+          continue;
         if (maxcoord < point[0]) {
-	  maxcoord= point[0];
+          maxcoord= point[0];
           maxx= point;
         }
-	if (mincoord > point[0]) {
+        if (mincoord > point[0]) {
           mincoord= point[0];
           minx= point;
-	}
+        }
       }
     }
-    qh_setunique (simplex, minx);
-    if (qh_setsize (*simplex) < 2)
-      qh_setunique (simplex, maxx);
-    sizinit= qh_setsize (*simplex);
+    qh_setunique(simplex, minx);
+    if (qh_setsize(*simplex) < 2)
+      qh_setunique(simplex, maxx);
+    sizinit= qh_setsize(*simplex);
     if (sizinit < 2) {
-      qh_precision ("input has same x coordinate");
+      qh_precision("input has same x coordinate");
       if (zzval_(Zsetplane) > qh hull_dim+1) {
-	fprintf (qh ferr, "qhull precision error (qh_maxsimplex for voronoi_center):\n%d points with the same x coordinate.\n",
-		 qh_setsize(maxpoints)+numpoints);
-	qh_errexit (qh_ERRprec, NULL, NULL);
+        qh_fprintf(qh ferr, 6012, "qhull precision error (qh_maxsimplex for voronoi_center):\n%d points with the same x coordinate.\n",
+                 qh_setsize(maxpoints)+numpoints);
+        qh_errexit(qh_ERRprec, NULL, NULL);
       }else {
-	fprintf (qh ferr, "qhull input error: input is less than %d-dimensional since it has the same x coordinate\n", qh hull_dim);
-	qh_errexit (qh_ERRinput, NULL, NULL);
+        qh_fprintf(qh ferr, 6013, "qhull input error: input is less than %d-dimensional since it has the same x coordinate\n", qh hull_dim);
+        qh_errexit(qh_ERRinput, NULL, NULL);
       }
     }
   }
-  for(k= sizinit; k < dim+1; k++) {
+  for (k=sizinit; k < dim+1; k++) {
     maxpoint= NULL;
     maxdet= -REALmax;
     FOREACHpoint_(maxpoints) {
-      if (!qh_setin (*simplex, point)) {
+      if (!qh_setin(*simplex, point)) {
         det= qh_detsimplex(point, *simplex, k, &nearzero);
         if ((det= fabs_(det)) > maxdet) {
-	  maxdet= det;
+          maxdet= det;
           maxpoint= point;
-	  maxnearzero= nearzero;
+          maxnearzero= nearzero;
         }
       }
     }
     if (!maxpoint || maxnearzero) {
       zinc_(Zsearchpoints);
       if (!maxpoint) {
-        trace0((qh ferr, "qh_maxsimplex: searching all points for %d-th initial vertex.\n", k+1));
+        trace0((qh ferr, 7, "qh_maxsimplex: searching all points for %d-th initial vertex.\n", k+1));
       }else {
-        trace0((qh ferr, "qh_maxsimplex: searching all points for %d-th initial vertex, better than p%d det %2.2g\n",
-		k+1, qh_pointid(maxpoint), maxdet));
+        trace0((qh ferr, 8, "qh_maxsimplex: searching all points for %d-th initial vertex, better than p%d det %2.2g\n",
+                k+1, qh_pointid(maxpoint), maxdet));
       }
       FORALLpoint_(points, numpoints) {
-	if (point == qh GOODpointp)
-	  continue;
-        if (!qh_setin (*simplex, point)) {
+        if (point == qh GOODpointp)
+          continue;
+        if (!qh_setin(*simplex, point)) {
           det= qh_detsimplex(point, *simplex, k, &nearzero);
           if ((det= fabs_(det)) > maxdet) {
-	    maxdet= det;
+            maxdet= det;
             maxpoint= point;
-	    maxnearzero= nearzero;
-	  }
+            maxnearzero= nearzero;
+          }
         }
       }
     } /* !maxpoint */
     if (!maxpoint) {
-      fprintf (qh ferr, "qhull internal error (qh_maxsimplex): not enough points available\n");
-      qh_errexit (qh_ERRqhull, NULL, NULL);
+      qh_fprintf(qh ferr, 6014, "qhull internal error (qh_maxsimplex): not enough points available\n");
+      qh_errexit(qh_ERRqhull, NULL, NULL);
     }
     qh_setappend(simplex, maxpoint);
-    trace1((qh ferr, "qh_maxsimplex: selected point p%d for %d`th initial vertex, det=%2.2g\n",
-	    qh_pointid(maxpoint), k+1, maxdet));
-  } /* k */ 
+    trace1((qh ferr, 1002, "qh_maxsimplex: selected point p%d for %d`th initial vertex, det=%2.2g\n",
+            qh_pointid(maxpoint), k+1, maxdet));
+  } /* k */
 } /* maxsimplex */
 
 /*---------------------------------
-  
+
   qh_minabsval( normal, dim )
     return minimum absolute value of a dim vector
 */
-realT qh_minabsval (realT *normal, int dim) {
+realT qh_minabsval(realT *normal, int dim) {
   realT minval= 0;
   realT maxval= 0;
   realT *colp;
   int k;
 
-  for (k= dim, colp= normal; k--; colp++) {
+  for (k=dim, colp=normal; k--; colp++) {
     maximize_(maxval, *colp);
     minimize_(minval, *colp);
   }
@@ -1199,16 +1208,16 @@
 
 /*---------------------------------
-  
-  qh_mindif( vecA, vecB, dim )
+
+  qh_mindif ( vecA, vecB, dim )
     return index of min abs. difference of two vectors
 */
-int qh_mindiff (realT *vecA, realT *vecB, int dim) {
+int qh_mindiff(realT *vecA, realT *vecB, int dim) {
   realT mindiff= REALmax, diff;
   realT *vecAp= vecA, *vecBp= vecB;
   int k, mink= 0;
 
-  for (k= 0; k < dim; k++) {
+  for (k=0; k < dim; k++) {
     diff= *vecAp++ - *vecBp++;
     diff= fabs_(diff);
     if (diff < mindiff) {
@@ -1223,20 +1232,20 @@
 
 /*---------------------------------
-  
+
   qh_orientoutside( facet  )
     make facet outside oriented via qh.interior_point
 
   returns:
     True if facet reversed orientation.
 */
-boolT qh_orientoutside (facetT *facet) {
+boolT qh_orientoutside(facetT *facet) {
   int k;
   realT dist;
 
-  qh_distplane (qh interior_point, facet, &dist);
+  qh_distplane(qh interior_point, facet, &dist);
   if (dist > 0) {
-    for (k= qh hull_dim; k--; )
+    for (k=qh hull_dim; k--; )
       facet->normal[k]= -facet->normal[k];
     facet->offset= -facet->offset;
     return True;
@@ -1246,7 +1255,7 @@
 
 /*---------------------------------
-  
+
   qh_outerinner( facet, outerplane, innerplane  )
     if facet and qh.maxoutdone (i.e., qh_check_maxout)
       returns outer and inner plane for facet
@@ -1259,11 +1268,13 @@
 
   notes:
     outerplaner or innerplane may be NULL
-    
+    facet is const
+    Does not error (QhullFacet)
+
     includes qh.DISTround for actual points
     adds another qh.DISTround if testing with floating point arithmetic
 */
-void qh_outerinner (facetT *facet, realT *outerplane, realT *innerplane) {
+void qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane) {
   realT dist, mindist;
   vertexT *vertex, **vertexp;
 
@@ -1271,33 +1282,33 @@
     if (!qh_MAXoutside || !facet || !qh maxoutdone) {
       *outerplane= qh_maxouter();       /* includes qh.DISTround */
     }else { /* qh_MAXoutside ... */
-#if qh_MAXoutside 
+#if qh_MAXoutside
       *outerplane= facet->maxoutside + qh DISTround;
 #endif
-      
+
     }
     if (qh JOGGLEmax < REALmax/2)
-      *outerplane += qh JOGGLEmax * sqrt (qh hull_dim);
+      *outerplane += qh JOGGLEmax * sqrt((realT)qh hull_dim);
   }
   if (innerplane) {
     if (facet) {
       mindist= REALmax;
       FOREACHvertex_(facet->vertices) {
         zinc_(Zdistio);
-        qh_distplane (vertex->point, facet, &dist);
+        qh_distplane(vertex->point, facet, &dist);
         minimize_(mindist, dist);
       }
       *innerplane= mindist - qh DISTround;
-    }else 
+    }else
       *innerplane= qh min_vertex - qh DISTround;
     if (qh JOGGLEmax < REALmax/2)
-      *innerplane -= qh JOGGLEmax * sqrt (qh hull_dim);
+      *innerplane -= qh JOGGLEmax * sqrt((realT)qh hull_dim);
   }
 } /* outerinner */
 
 /*---------------------------------
-  
+
   qh_pointdist( point1, point2, dim )
     return distance between two points
 
@@ -1307,7 +1318,7 @@
 coordT qh_pointdist(pointT *point1, pointT *point2, int dim) {
   coordT dist, diff;
   int k;
-  
+
   dist= 0.0;
   for (k= (dim > 0 ? dim : -dim); k--; ) {
     diff= *point1++ - *point2++;
@@ -1321,7 +1332,7 @@
 
 /*---------------------------------
-  
+
   qh_printmatrix( fp, string, rows, numrow, numcol )
     print matrix to fp given by row vectors
     print string as header
@@ -1329,53 +1340,53 @@
   notes:
     print a vector by qh_printmatrix(fp, "", &vect, 1, len)
 */
-void qh_printmatrix (FILE *fp, char *string, realT **rows, int numrow, int numcol) {
+void qh_printmatrix(FILE *fp, const char *string, realT **rows, int numrow, int numcol) {
   realT *rowp;
   realT r; /*bug fix*/
   int i,k;
 
-  fprintf (fp, "%s\n", string);
-  for (i= 0; i < numrow; i++) {
+  qh_fprintf(fp, 9001, "%s\n", string);
+  for (i=0; i < numrow; i++) {
     rowp= rows[i];
-    for (k= 0; k < numcol; k++) {
+    for (k=0; k < numcol; k++) {
       r= *rowp++;
-      fprintf (fp, "%6.3g ", r);
+      qh_fprintf(fp, 9002, "%6.3g ", r);
     }
-    fprintf (fp, "\n");
+    qh_fprintf(fp, 9003, "\n");
   }
 } /* printmatrix */
 
-  
+
 /*---------------------------------
-  
+
   qh_printpoints( fp, string, points )
     print pointids to fp for a set of points
     if string, prints string and 'p' point ids
 */
-void qh_printpoints (FILE *fp, char *string, setT *points) {
+void qh_printpoints(FILE *fp, const char *string, setT *points) {
   pointT *point, **pointp;
 
   if (string) {
-    fprintf (fp, "%s", string);
-    FOREACHpoint_(points) 
-      fprintf (fp, " p%d", qh_pointid(point));
-    fprintf (fp, "\n");
+    qh_fprintf(fp, 9004, "%s", string);
+    FOREACHpoint_(points)
+      qh_fprintf(fp, 9005, " p%d", qh_pointid(point));
+    qh_fprintf(fp, 9006, "\n");
   }else {
-    FOREACHpoint_(points) 
-      fprintf (fp, " %d", qh_pointid(point));
-    fprintf (fp, "\n");
+    FOREACHpoint_(points)
+      qh_fprintf(fp, 9007, " %d", qh_pointid(point));
+    qh_fprintf(fp, 9008, "\n");
   }
 } /* printpoints */
 
-  
+
 /*---------------------------------
-  
+
   qh_projectinput()
     project input points using qh.lower_bound/upper_bound and qh DELAUNAY
-    if qh.lower_bound[k]=qh.upper_bound[k]= 0, 
-      removes dimension k 
+    if qh.lower_bound[k]=qh.upper_bound[k]= 0,
+      removes dimension k
     if halfspace intersection
       removes dimension k from qh.feasible_point
     input points in qh first_point, num_points, input_dim
@@ -1383,12 +1394,12 @@
   returns:
     new point array in qh first_point of qh hull_dim coordinates
     sets qh POINTSmalloc
-    if qh DELAUNAY 
+    if qh DELAUNAY
       projects points to paraboloid
       lowbound/highbound is also projected
     if qh ATinfinity
       adds point "at-infinity"
-    if qh POINTSmalloc 
+    if qh POINTSmalloc
       frees old point array
 
   notes:
@@ -1404,21 +1415,21 @@
     if qh DELAUNAY
       if qh ATINFINITY
         projects points to paraboloid
-        computes "infinity" point as vertex average and 10% above all points 
+        computes "infinity" point as vertex average and 10% above all points
       else
         uses qh_setdelaunay to project points to paraboloid
 */
-void qh_projectinput (void) {
+void qh_projectinput(void) {
   int k,i;
   int newdim= qh input_dim, newnum= qh num_points;
   signed char *project;
   int size= (qh input_dim+1)*sizeof(*project);
   pointT *newpoints, *coord, *infinity;
   realT paraboloid, maxboloid= 0;
-  
-  project= (signed char*)qh_memalloc (size);
-  memset ((char*)project, 0, size);
-  for (k= 0; k < qh input_dim; k++) {   /* skip Delaunay bound */
+
+  project= (signed char*)qh_memalloc(size);
+  memset((char*)project, 0, (size_t)size);
+  for (k=0; k < qh input_dim; k++) {   /* skip Delaunay bound */
     if (qh lower_bound[k] == 0 && qh upper_bound[k] == 0) {
       project[k]= -1;
       newdim--;
@@ -1431,32 +1442,32 @@
       newnum++;
   }
   if (newdim != qh hull_dim) {
-    fprintf(qh ferr, "qhull internal error (qh_projectinput): dimension after projection %d != hull_dim %d\n", newdim, qh hull_dim);
+    qh_fprintf(qh ferr, 6015, "qhull internal error (qh_projectinput): dimension after projection %d != hull_dim %d\n", newdim, qh hull_dim);
     qh_errexit(qh_ERRqhull, NULL, NULL);
   }
-  if (!(newpoints=(coordT*)malloc(newnum*newdim*sizeof(coordT)))){
-    fprintf(qh ferr, "qhull error: insufficient memory to project %d points\n",
+  if (!(newpoints=(coordT*)qh_malloc(newnum*newdim*sizeof(coordT)))){
+    qh_fprintf(qh ferr, 6016, "qhull error: insufficient memory to project %d points\n",
            qh num_points);
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
-  qh_projectpoints (project, qh input_dim+1, qh first_point,
+  qh_projectpoints(project, qh input_dim+1, qh first_point,
                     qh num_points, qh input_dim, newpoints, newdim);
-  trace1((qh ferr, "qh_projectinput: updating lower and upper_bound\n"));
-  qh_projectpoints (project, qh input_dim+1, qh lower_bound,
+  trace1((qh ferr, 1003, "qh_projectinput: updating lower and upper_bound\n"));
+  qh_projectpoints(project, qh input_dim+1, qh lower_bound,
                     1, qh input_dim+1, qh lower_bound, newdim+1);
-  qh_projectpoints (project, qh input_dim+1, qh upper_bound,
+  qh_projectpoints(project, qh input_dim+1, qh upper_bound,
                     1, qh input_dim+1, qh upper_bound, newdim+1);
   if (qh HALFspace) {
     if (!qh feasible_point) {
-      fprintf(qh ferr, "qhull internal error (qh_projectinput): HALFspace defined without qh.feasible_point\n");
+      qh_fprintf(qh ferr, 6017, "qhull internal error (qh_projectinput): HALFspace defined without qh.feasible_point\n");
       qh_errexit(qh_ERRqhull, NULL, NULL);
     }
-    qh_projectpoints (project, qh input_dim, qh feasible_point,
-		      1, qh input_dim, qh feasible_point, newdim);
+    qh_projectpoints(project, qh input_dim, qh feasible_point,
+                      1, qh input_dim, qh feasible_point, newdim);
   }
-  qh_memfree(project, ((qh input_dim+1)*sizeof(*project)));
+  qh_memfree(project, (qh input_dim+1)*sizeof(*project));
   if (qh POINTSmalloc)
-    free (qh first_point);
+    qh_free(qh first_point);
   qh first_point= newpoints;
   qh POINTSmalloc= True;
   if (qh DELAUNAY && qh ATinfinity) {
@@ -1468,7 +1479,7 @@
       paraboloid= 0.0;
       for (k=0; k < qh hull_dim-1; k++) {
         paraboloid += *coord * *coord;
-	infinity[k] += *coord;
+        infinity[k] += *coord;
         coord++;
       }
       *(coord++)= paraboloid;
@@ -1479,20 +1490,20 @@
       *(coord++) /= qh num_points;
     *(coord++)= maxboloid * 1.1;
     qh num_points++;
-    trace0((qh ferr, "qh_projectinput: projected points to paraboloid for Delaunay\n"));
+    trace0((qh ferr, 9, "qh_projectinput: projected points to paraboloid for Delaunay\n"));
   }else if (qh DELAUNAY)  /* !qh ATinfinity */
     qh_setdelaunay( qh hull_dim, qh num_points, qh first_point);
 } /* projectinput */
 
-  
+
 /*---------------------------------
-  
+
   qh_projectpoints( project, n, points, numpoints, dim, newpoints, newdim )
     project points/numpoints/dim to newpoints/newdim
     if project[k] == -1
-      delete dimension k 
-    if project[k] == 1 
+      delete dimension k
+    if project[k] == 1
       add dimension k by duplicating previous column
     n is size of project
 
@@ -1506,33 +1517,33 @@
         skip dimension
       else
         determine start of column in newpoints
-        determine start of column in points 
+        determine start of column in points
           if project == +1, duplicate previous column
         copy dimension (column) from points to newpoints
 */
-void qh_projectpoints (signed char *project, int n, realT *points, 
+void qh_projectpoints(signed char *project, int n, realT *points,
         int numpoints, int dim, realT *newpoints, int newdim) {
   int testdim= dim, oldk=0, newk=0, i,j=0,k;
   realT *newp, *oldp;
-  
-  for (k= 0; k < n; k++)
+
+  for (k=0; k < n; k++)
     testdim += project[k];
   if (testdim != newdim) {
-    fprintf (qh ferr, "qhull internal error (qh_projectpoints): newdim %d should be %d after projection\n",
+    qh_fprintf(qh ferr, 6018, "qhull internal error (qh_projectpoints): newdim %d should be %d after projection\n",
       newdim, testdim);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
-  for (j= 0; j= dim)
-	  continue;
-	oldp= points+oldk;
-      }else 
-	oldp= points+oldk++;
+        if (oldk >= dim)
+          continue;
+        oldp= points+oldk;
+      }else
+        oldp= points+oldk++;
       for (i=numpoints; i--; ) {
         *newp= *oldp;
         newp += newdim;
@@ -1542,105 +1553,14 @@
     if (oldk >= dim)
       break;
   }
-  trace1((qh ferr, "qh_projectpoints: projected %d points from dim %d to dim %d\n", 
+  trace1((qh ferr, 1004, "qh_projectpoints: projected %d points from dim %d to dim %d\n",
     numpoints, dim, newdim));
 } /* projectpoints */
-        
 
-/*---------------------------------
-  
-  qh_rand() 
-  qh_srand( seed )
-    generate pseudo-random number between 1 and 2^31 -2
 
-  notes:
-    from Park & Miller's minimimal standard random number generator
-       Communications of the ACM, 31:1192-1201, 1988.
-    does not use 0 or 2^31 -1
-       this is silently enforced by qh_srand()
-    can make 'Rn' much faster by moving qh_rand to qh_distplane
-*/
-int qh_rand_seed= 1;  /* define as global variable instead of using qh */
-
-int qh_rand( void) {
-#define qh_rand_a 16807
-#define qh_rand_m 2147483647
-#define qh_rand_q 127773  /* m div a */
-#define qh_rand_r 2836    /* m mod a */
-  int lo, hi, test;
-  int seed = qh_rand_seed;
-
-  hi = seed / qh_rand_q;  /* seed div q */
-  lo = seed % qh_rand_q;  /* seed mod q */
-  test = qh_rand_a * lo - qh_rand_r * hi;
-  if (test > 0)
-    seed= test;
-  else
-    seed= test + qh_rand_m;
-  qh_rand_seed= seed;
-  /* seed = seed < qh_RANDOMmax/2 ? 0 : qh_RANDOMmax;  for testing */
-  /* seed = qh_RANDOMmax;  for testing */
-  return seed;
-} /* rand */
-
-void qh_srand( int seed) {
-  if (seed < 1)
-    qh_rand_seed= 1;
-  else if (seed >= qh_rand_m)
-    qh_rand_seed= qh_rand_m - 1;
-  else
-    qh_rand_seed= seed;
-} /* qh_srand */
-
 /*---------------------------------
-  
-  qh_randomfactor()
-    return a random factor within qh.RANDOMmax of 1.0
-
-  notes:
-    qh.RANDOMa/b are defined in global.c
-*/
-realT qh_randomfactor (void) {
-  realT randr;
-
-  randr= qh_RANDOMint;
-  return randr * qh RANDOMa + qh RANDOMb;
-} /* randomfactor */
-
-/*---------------------------------
-  
-  qh_randommatrix( buffer, dim, rows )
-    generate a random dim X dim matrix in range [-1,1]
-    assumes buffer is [dim+1, dim]
-
-  returns:
-    sets buffer to random numbers
-    sets rows to rows of buffer
-      sets row[dim] as scratch row
-*/
-void qh_randommatrix (realT *buffer, int dim, realT **rows) {
-  int i, k;
-  realT **rowi, *coord, realr;
-
-  coord= buffer;
-  rowi= rows;
-  for (i=0; i < dim; i++) {
-    *(rowi++)= coord;
-    for (k=0; k < dim; k++) {
-      realr= qh_RANDOMint;
-      *(coord++)= 2.0 * realr/(qh_RANDOMmax+1) - 1.0;
-    }
-  }
-  *rowi= coord;
-} /* randommatrix */
-
-        
-/*---------------------------------
-  
+
   qh_rotateinput( rows )
     rotate input using row matrix
     input points given by qh first_point, num_points, hull_dim
@@ -1654,18 +1574,18 @@
   design:
     see qh_rotatepoints
 */
-void qh_rotateinput (realT **rows) {
+void qh_rotateinput(realT **rows) {
 
   if (!qh POINTSmalloc) {
-    qh first_point= qh_copypoints (qh first_point, qh num_points, qh hull_dim);
+    qh first_point= qh_copypoints(qh first_point, qh num_points, qh hull_dim);
     qh POINTSmalloc= True;
   }
-  qh_rotatepoints (qh first_point, qh num_points, qh hull_dim, rows);
+  qh_rotatepoints(qh first_point, qh num_points, qh hull_dim, rows);
 }  /* rotateinput */
 
 /*---------------------------------
-  
+
   qh_rotatepoints( points, numpoints, dim, row )
     rotate numpoints points by a d-dim row matrix
     assumes rows[dim] is a scratch buffer
@@ -1680,30 +1600,30 @@
       for each coordinate
         rotate by partial inner product
 */
-void qh_rotatepoints (realT *points, int numpoints, int dim, realT **row) {
+void qh_rotatepoints(realT *points, int numpoints, int dim, realT **row) {
   realT *point, *rowi, *coord= NULL, sum, *newval;
   int i,j,k;
 
   if (qh IStracing >= 1)
-    qh_printmatrix (qh ferr, "qh_rotatepoints: rotate points by", row, dim, dim);
+    qh_printmatrix(qh ferr, "qh_rotatepoints: rotate points by", row, dim, dim);
   for (point= points, j= numpoints; j--; point += dim) {
     newval= row[dim];
-    for (i= 0; i < dim; i++) {
+    for (i=0; i < dim; i++) {
       rowi= row[i];
       coord= point;
       for (sum= 0.0, k= dim; k--; )
         sum += *rowi++ * *coord++;
       *(newval++)= sum;
     }
-    for (k= dim; k--; )
+    for (k=dim; k--; )
       *(--coord)= *(--newval);
   }
-} /* rotatepoints */  
-  
+} /* rotatepoints */
 
+
 /*---------------------------------
-  
+
   qh_scaleinput()
     scale input points using qh low_bound/high_bound
     input points given by qh first_point, num_points, hull_dim
@@ -1716,19 +1636,19 @@
   design:
     see qh_scalepoints
 */
-void qh_scaleinput (void) {
+void qh_scaleinput(void) {
 
   if (!qh POINTSmalloc) {
-    qh first_point= qh_copypoints (qh first_point, qh num_points, qh hull_dim);
+    qh first_point= qh_copypoints(qh first_point, qh num_points, qh hull_dim);
     qh POINTSmalloc= True;
   }
-  qh_scalepoints (qh first_point, qh num_points, qh hull_dim,
+  qh_scalepoints(qh first_point, qh num_points, qh hull_dim,
        qh lower_bound, qh upper_bound);
 }  /* scaleinput */
-  
+
 /*---------------------------------
-  
+
   qh_scalelast( points, numpoints, dim, low, high, newhigh )
     scale last coordinate to [0,m] for Delaunay triangulations
     input points given by points, numpoints, dim
@@ -1740,42 +1660,42 @@
 
   notes:
     when called by qh_setdelaunay, low/high may not match actual data
-    
+
   design:
     compute scale and shift factors
     apply to last coordinate of each point
 */
-void qh_scalelast (coordT *points, int numpoints, int dim, coordT low,
-		   coordT high, coordT newhigh) {
+void qh_scalelast(coordT *points, int numpoints, int dim, coordT low,
+                   coordT high, coordT newhigh) {
   realT scale, shift;
   coordT *coord;
   int i;
   boolT nearzero= False;
 
-  trace4((qh ferr, "qh_scalelast: scale last coordinate from [%2.2g, %2.2g] to [0,%2.2g]\n",
+  trace4((qh ferr, 4013, "qh_scalelast: scale last coordinate from [%2.2g, %2.2g] to [0,%2.2g]\n",
     low, high, newhigh));
   qh last_low= low;
   qh last_high= high;
   qh last_newhigh= newhigh;
-  scale= qh_divzero (newhigh, high - low,
+  scale= qh_divzero(newhigh, high - low,
                   qh MINdenom_1, &nearzero);
   if (nearzero) {
     if (qh DELAUNAY)
-      fprintf (qh ferr, "qhull input error: can not scale last coordinate.  Input is cocircular\n   or cospherical.   Use option 'Qz' to add a point at infinity.\n");
+      qh_fprintf(qh ferr, 6019, "qhull input error: can not scale last coordinate.  Input is cocircular\n   or cospherical.   Use option 'Qz' to add a point at infinity.\n");
     else
-      fprintf (qh ferr, "qhull input error: can not scale last coordinate.  New bounds [0, %2.2g] are too wide for\nexisting bounds [%2.2g, %2.2g] (width %2.2g)\n",
-		newhigh, low, high, high-low);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6020, "qhull input error: can not scale last coordinate.  New bounds [0, %2.2g] are too wide for\nexisting bounds [%2.2g, %2.2g] (width %2.2g)\n",
+                newhigh, low, high, high-low);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   shift= - low * newhigh / (high-low);
   coord= points + dim - 1;
-  for (i= numpoints; i--; coord += dim)
+  for (i=numpoints; i--; coord += dim)
     *coord= *coord * scale + shift;
 } /* scalelast */
 
 /*---------------------------------
-  
+
   qh_scalepoints( points, numpoints, dim, newlows, newhighs )
     scale points to new lowbound and highbound
     retains old bound when newlow= -REALmax or newhigh= +REALmax
@@ -1791,20 +1711,20 @@
       scale all points
       enforce new low and high bound for all points
 */
-void qh_scalepoints (pointT *points, int numpoints, int dim,
-	realT *newlows, realT *newhighs) {
+void qh_scalepoints(pointT *points, int numpoints, int dim,
+        realT *newlows, realT *newhighs) {
   int i,k;
   realT shift, scale, *coord, low, high, newlow, newhigh, mincoord, maxcoord;
   boolT nearzero= False;
-     
-  for (k= 0; k < dim; k++) {
+
+  for (k=0; k < dim; k++) {
     newhigh= newhighs[k];
     newlow= newlows[k];
     if (newhigh > REALmax/2 && newlow < -REALmax/2)
       continue;
     low= REALmax;
     high= -REALmax;
-    for (i= numpoints, coord= points+k; i--; coord += dim) {
+    for (i=numpoints, coord=points+k; i--; coord += dim) {
       minimize_(low, *coord);
       maximize_(high, *coord);
     }
@@ -1813,20 +1733,20 @@
     if (newlow < -REALmax/2)
       newlow= low;
     if (qh DELAUNAY && k == dim-1 && newhigh < newlow) {
-      fprintf (qh ferr, "qhull input error: 'Qb%d' or 'QB%d' inverts paraboloid since high bound %.2g < low bound %.2g\n",
-	       k, k, newhigh, newlow);
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6021, "qhull input error: 'Qb%d' or 'QB%d' inverts paraboloid since high bound %.2g < low bound %.2g\n",
+               k, k, newhigh, newlow);
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
-    scale= qh_divzero (newhigh - newlow, high - low,
+    scale= qh_divzero(newhigh - newlow, high - low,
                   qh MINdenom_1, &nearzero);
     if (nearzero) {
-      fprintf (qh ferr, "qhull input error: %d'th dimension's new bounds [%2.2g, %2.2g] too wide for\nexisting bounds [%2.2g, %2.2g]\n",
+      qh_fprintf(qh ferr, 6022, "qhull input error: %d'th dimension's new bounds [%2.2g, %2.2g] too wide for\nexisting bounds [%2.2g, %2.2g]\n",
               k, newlow, newhigh, low, high);
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     shift= (newlow * high - low * newhigh)/(high-low);
     coord= points+k;
-    for (i= numpoints; i--; coord += dim)
+    for (i=numpoints; i--; coord += dim)
       *coord= *coord * scale + shift;
     coord= points+k;
     if (newlow < newhigh) {
@@ -1836,22 +1756,22 @@
       mincoord= newhigh;
       maxcoord= newlow;
     }
-    for (i= numpoints; i--; coord += dim) {
+    for (i=numpoints; i--; coord += dim) {
       minimize_(*coord, maxcoord);  /* because of roundoff error */
       maximize_(*coord, mincoord);
     }
-    trace0((qh ferr, "qh_scalepoints: scaled %d'th coordinate [%2.2g, %2.2g] to [%.2g, %.2g] for %d points by %2.2g and shifted %2.2g\n",
+    trace0((qh ferr, 10, "qh_scalepoints: scaled %d'th coordinate [%2.2g, %2.2g] to [%.2g, %.2g] for %d points by %2.2g and shifted %2.2g\n",
       k, low, high, newlow, newhigh, numpoints, scale, shift));
   }
-} /* scalepoints */    
+} /* scalepoints */
 
-       
+
 /*---------------------------------
-  
+
   qh_setdelaunay( dim, count, points )
     project count points to dim-d paraboloid for Delaunay triangulation
-    
+
     dim is one more than the dimension of the input set
     assumes dim is at least 3 (i.e., at least a 2-d Delaunay triangulation)
 
@@ -1867,39 +1787,39 @@
     for each point
       sets point[dim-1] to sum of squares of coordinates
     scale points to 'Qbb' if needed
-      
+
   notes:
     to project one point, use
-      qh_setdelaunay (qh hull_dim, 1, point)
-      
-    Do not use options 'Qbk', 'QBk', or 'QbB' since they scale 
+      qh_setdelaunay(qh hull_dim, 1, point)
+
+    Do not use options 'Qbk', 'QBk', or 'QbB' since they scale
     the coordinates after the original projection.
 
 */
-void qh_setdelaunay (int dim, int count, pointT *points) {
+void qh_setdelaunay(int dim, int count, pointT *points) {
   int i, k;
   coordT *coordp, coord;
   realT paraboloid;
 
-  trace0((qh ferr, "qh_setdelaunay: project %d points to paraboloid for Delaunay triangulation\n", count));
+  trace0((qh ferr, 11, "qh_setdelaunay: project %d points to paraboloid for Delaunay triangulation\n", count));
   coordp= points;
-  for (i= 0; i < count; i++) {
+  for (i=0; i < count; i++) {
     coord= *coordp++;
     paraboloid= coord*coord;
-    for (k= dim-2; k--; ) {
+    for (k=dim-2; k--; ) {
       coord= *coordp++;
       paraboloid += coord*coord;
     }
     *coordp++ = paraboloid;
   }
-  if (qh last_low < REALmax/2) 
-    qh_scalelast (points, count, dim, qh last_low, qh last_high, qh last_newhigh);
+  if (qh last_low < REALmax/2)
+    qh_scalelast(points, count, dim, qh last_low, qh last_high, qh last_newhigh);
 } /* setdelaunay */
 
-  
+
 /*---------------------------------
-  
+
   qh_sethalfspace( dim, coords, nextp, normal, offset, feasible )
     set point to dual of halfspace relative to feasible point
     halfspace is normal coefficients and offset.
@@ -1913,7 +1833,7 @@
     compute distance from feasible point to halfspace
     divide each normal coefficient by -dist
 */
-boolT qh_sethalfspace (int dim, coordT *coords, coordT **nextp, 
+boolT qh_sethalfspace(int dim, coordT *coords, coordT **nextp,
          coordT *normal, coordT *offset, coordT *feasible) {
   coordT *normp= normal, *feasiblep= feasible, *coordp= coords;
   realT dist;
@@ -1922,103 +1842,103 @@
   boolT zerodiv;
 
   dist= *offset;
-  for (k= dim; k--; )
+  for (k=dim; k--; )
     dist += *(normp++) * *(feasiblep++);
   if (dist > 0)
     goto LABELerroroutside;
   normp= normal;
   if (dist < -qh MINdenom) {
-    for (k= dim; k--; )
+    for (k=dim; k--; )
       *(coordp++)= *(normp++) / -dist;
   }else {
-    for (k= dim; k--; ) {
-      *(coordp++)= qh_divzero (*(normp++), -dist, qh MINdenom_1, &zerodiv);
-      if (zerodiv) 
+    for (k=dim; k--; ) {
+      *(coordp++)= qh_divzero(*(normp++), -dist, qh MINdenom_1, &zerodiv);
+      if (zerodiv)
         goto LABELerroroutside;
     }
   }
   *nextp= coordp;
   if (qh IStracing >= 4) {
-    fprintf (qh ferr, "qh_sethalfspace: halfspace at offset %6.2g to point: ", *offset);
-    for (k= dim, coordp= coords; k--; ) {
+    qh_fprintf(qh ferr, 8021, "qh_sethalfspace: halfspace at offset %6.2g to point: ", *offset);
+    for (k=dim, coordp=coords; k--; ) {
       r= *coordp++;
-      fprintf (qh ferr, " %6.2g", r);
+      qh_fprintf(qh ferr, 8022, " %6.2g", r);
     }
-    fprintf (qh ferr, "\n");
+    qh_fprintf(qh ferr, 8023, "\n");
   }
   return True;
 LABELerroroutside:
   feasiblep= feasible;
   normp= normal;
-  fprintf(qh ferr, "qhull input error: feasible point is not clearly inside halfspace\nfeasible point: ");
-  for (k= dim; k--; )
-    fprintf (qh ferr, qh_REAL_1, r=*(feasiblep++));
-  fprintf (qh ferr, "\n     halfspace: "); 
-  for (k= dim; k--; )
-    fprintf (qh ferr, qh_REAL_1, r=*(normp++));
-  fprintf (qh ferr, "\n     at offset: ");
-  fprintf (qh ferr, qh_REAL_1, *offset);
-  fprintf (qh ferr, " and distance: ");
-  fprintf (qh ferr, qh_REAL_1, dist);
-  fprintf (qh ferr, "\n");
+  qh_fprintf(qh ferr, 6023, "qhull input error: feasible point is not clearly inside halfspace\nfeasible point: ");
+  for (k=dim; k--; )
+    qh_fprintf(qh ferr, 8024, qh_REAL_1, r=*(feasiblep++));
+  qh_fprintf(qh ferr, 8025, "\n     halfspace: ");
+  for (k=dim; k--; )
+    qh_fprintf(qh ferr, 8026, qh_REAL_1, r=*(normp++));
+  qh_fprintf(qh ferr, 8027, "\n     at offset: ");
+  qh_fprintf(qh ferr, 8028, qh_REAL_1, *offset);
+  qh_fprintf(qh ferr, 8029, " and distance: ");
+  qh_fprintf(qh ferr, 8030, qh_REAL_1, dist);
+  qh_fprintf(qh ferr, 8031, "\n");
   return False;
 } /* sethalfspace */
 
 /*---------------------------------
-  
+
   qh_sethalfspace_all( dim, count, halfspaces, feasible )
     generate dual for halfspace intersection with feasible point
     array of count halfspaces
-      each halfspace is normal coefficients followed by offset 
+      each halfspace is normal coefficients followed by offset
       the origin is inside the halfspace if the offset is negative
 
   returns:
     malloc'd array of count X dim-1 points
 
   notes:
-    call before qh_init_B or qh_initqhull_globals 
+    call before qh_init_B or qh_initqhull_globals
     unused/untested code: please email bradb at shore.net if this works ok for you
-    If using option 'Fp', also set qh feasible_point. It is a malloc'd array 
+    If using option 'Fp', also set qh feasible_point. It is a malloc'd array
       that is freed by qh_freebuffers.
 
   design:
     see qh_sethalfspace
 */
-coordT *qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible) {
+coordT *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible) {
   int i, newdim;
   pointT *newpoints;
   coordT *coordp, *normalp, *offsetp;
 
-  trace0((qh ferr, "qh_sethalfspace_all: compute dual for halfspace intersection\n"));
+  trace0((qh ferr, 12, "qh_sethalfspace_all: compute dual for halfspace intersection\n"));
   newdim= dim - 1;
-  if (!(newpoints=(coordT*)malloc(count*newdim*sizeof(coordT)))){
-    fprintf(qh ferr, "qhull error: insufficient memory to compute dual of %d halfspaces\n",
+  if (!(newpoints=(coordT*)qh_malloc(count*newdim*sizeof(coordT)))){
+    qh_fprintf(qh ferr, 6024, "qhull error: insufficient memory to compute dual of %d halfspaces\n",
           count);
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
   coordp= newpoints;
   normalp= halfspaces;
-  for (i= 0; i < count; i++) {
+  for (i=0; i < count; i++) {
     offsetp= normalp + newdim;
-    if (!qh_sethalfspace (newdim, coordp, &coordp, normalp, offsetp, feasible)) {
-      fprintf (qh ferr, "The halfspace was at index %d\n", i);
-      qh_errexit (qh_ERRinput, NULL, NULL);
+    if (!qh_sethalfspace(newdim, coordp, &coordp, normalp, offsetp, feasible)) {
+      qh_fprintf(qh ferr, 8032, "The halfspace was at index %d\n", i);
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     normalp= offsetp + 1;
   }
   return newpoints;
 } /* sethalfspace_all */
 
-  
+
 /*---------------------------------
-  
+
   qh_sharpnewfacets()
 
   returns:
     true if could be an acute angle (facets in different quadrants)
- 
+
   notes:
     for qh_findbest
 
@@ -2027,18 +1947,18 @@
       if two facets are in different quadrants
         set issharp
 */
-boolT qh_sharpnewfacets () {
+boolT qh_sharpnewfacets() {
   facetT *facet;
   boolT issharp = False;
   int *quadrant, k;
-  
-  quadrant= (int*)qh_memalloc (qh hull_dim * sizeof(int));
+
+  quadrant= (int*)qh_memalloc(qh hull_dim * sizeof(int));
   FORALLfacet_(qh newfacet_list) {
     if (facet == qh newfacet_list) {
-      for (k= qh hull_dim; k--; )
-      	quadrant[ k]= (facet->normal[ k] > 0);
+      for (k=qh hull_dim; k--; )
+        quadrant[ k]= (facet->normal[ k] > 0);
     }else {
-      for (k= qh hull_dim; k--; ) {
+      for (k=qh hull_dim; k--; ) {
         if (quadrant[ k] != (facet->normal[ k] > 0)) {
           issharp= True;
           break;
@@ -2049,13 +1969,13 @@
       break;
   }
   qh_memfree( quadrant, qh hull_dim * sizeof(int));
-  trace3((qh ferr, "qh_sharpnewfacets: %d\n", issharp));
+  trace3((qh ferr, 3001, "qh_sharpnewfacets: %d\n", issharp));
   return issharp;
 } /* sharpnewfacets */
 
 /*---------------------------------
-  
+
   qh_voronoi_center( dim, points )
     return Voronoi center for a set of points
     dim is the orginal dimension of the points
@@ -2063,7 +1983,7 @@
 
   returns:
     center as a temporary point
-    if non-simplicial, 
+    if non-simplicial,
       returns center for max simplex of points
 
   notes:
@@ -2077,9 +1997,9 @@
     compute determinate
     compute Voronoi center (see Bowyer & Woodwark)
 */
-pointT *qh_voronoi_center (int dim, setT *points) {
+pointT *qh_voronoi_center(int dim, setT *points) {
   pointT *point, **pointp, *point0;
-  pointT *center= (pointT*)qh_memalloc (qh center_size);
+  pointT *center= (pointT*)qh_memalloc(qh center_size);
   setT *simplex;
   int i, j, k, size= qh_setsize(points);
   coordT *gmcoord;
@@ -2089,12 +2009,13 @@
   if (size == dim+1)
     simplex= points;
   else if (size < dim+1) {
-    fprintf (qh ferr, "qhull internal error (qh_voronoi_center):\n  need at least %d points to construct a Voronoi center\n",
-	     dim+1);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6025, "qhull internal error (qh_voronoi_center):\n  need at least %d points to construct a Voronoi center\n",
+             dim+1);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
+    simplex= points;  /* never executed -- avoids warning */
   }else {
-    simplex= qh_settemp (dim+1);
-    qh_maxsimplex (dim, points, NULL, 0, &simplex);
+    simplex= qh_settemp(dim+1);
+    qh_maxsimplex(dim, points, NULL, 0, &simplex);
   }
   point0= SETfirstt_(simplex, pointT);
   gmcoord= qh gm_matrix;
@@ -2108,53 +2029,53 @@
   sum2row= gmcoord;
   for (i=0; i < dim; i++) {
     sum2= 0.0;
-    for (k= 0; k < dim; k++) {
+    for (k=0; k < dim; k++) {
       diffp= qh gm_row[k] + i;
       sum2 += *diffp * *diffp;
     }
     *(gmcoord++)= sum2;
   }
-  det= qh_determinant (qh gm_row, dim, &nearzero);
-  factor= qh_divzero (0.5, det, qh MINdenom, &infinite);
+  det= qh_determinant(qh gm_row, dim, &nearzero);
+  factor= qh_divzero(0.5, det, qh MINdenom, &infinite);
   if (infinite) {
     for (k=dim; k--; )
       center[k]= qh_INFINITE;
     if (qh IStracing)
-      qh_printpoints (qh ferr, "qh_voronoi_center: at infinity for ", simplex);
+      qh_printpoints(qh ferr, "qh_voronoi_center: at infinity for ", simplex);
   }else {
     for (i=0; i < dim; i++) {
       gmcoord= qh gm_matrix;
       sum2p= sum2row;
       for (k=0; k < dim; k++) {
-	qh gm_row[k]= gmcoord;
-	if (k == i) {
-	  for (j= dim; j--; )
-	    *(gmcoord++)= *sum2p++;
-	}else {
-	  FOREACHpoint_(simplex) {
-	    if (point != point0)
-	      *(gmcoord++)= point[k] - point0[k];
-	  }
-	}
+        qh gm_row[k]= gmcoord;
+        if (k == i) {
+          for (j=dim; j--; )
+            *(gmcoord++)= *sum2p++;
+        }else {
+          FOREACHpoint_(simplex) {
+            if (point != point0)
+              *(gmcoord++)= point[k] - point0[k];
+          }
+        }
       }
-      center[i]= qh_determinant (qh gm_row, dim, &nearzero)*factor + point0[i];
+      center[i]= qh_determinant(qh gm_row, dim, &nearzero)*factor + point0[i];
     }
 #ifndef qh_NOtrace
     if (qh IStracing >= 3) {
-      fprintf (qh ferr, "qh_voronoi_center: det %2.2g factor %2.2g ", det, factor);
-      qh_printmatrix (qh ferr, "center:", ¢er, 1, dim);
+      qh_fprintf(qh ferr, 8033, "qh_voronoi_center: det %2.2g factor %2.2g ", det, factor);
+      qh_printmatrix(qh ferr, "center:", ¢er, 1, dim);
       if (qh IStracing >= 5) {
-	qh_printpoints (qh ferr, "points", simplex);
-	FOREACHpoint_(simplex)
-	  fprintf (qh ferr, "p%d dist %.2g, ", qh_pointid (point),
-		   qh_pointdist (point, center, dim));
-	fprintf (qh ferr, "\n");
+        qh_printpoints(qh ferr, "points", simplex);
+        FOREACHpoint_(simplex)
+          qh_fprintf(qh ferr, 8034, "p%d dist %.2g, ", qh_pointid(point),
+                   qh_pointdist(point, center, dim));
+        qh_fprintf(qh ferr, 8035, "\n");
       }
     }
 #endif
   }
   if (simplex != points)
-    qh_settempfree (&simplex);
+    qh_settempfree(&simplex);
   return center;
 } /* voronoi_center */
 

Modified: trunk/scipy/spatial/qhull/src/global.c
===================================================================
--- trunk/scipy/spatial/qhull/src/global.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/global.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,3 +1,4 @@
+
 /*
  ---------------------------------
 
@@ -6,26 +7,30 @@
 
    see README
 
-   see qhull.h for qh.globals and function prototypes
+   see libqhull.h for qh.globals and function prototypes
 
    see qhull_a.h for internal functions
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/global.c#60 $$Change: 1183 $
+   $DateTime: 2010/01/13 20:59:32 $$Author: bbarber $
  */
 
 #include "qhull_a.h"
 
-/*========= qh definition (see qhull.h) =======================*/
+/*========= qh definition -- globals defined in libqhull.h =======================*/
 
+int qhull_inuse= 0; /* not used */
+
 #if qh_QHpointer
-qhT *qh_qh= NULL;	/* pointer to all global variables */
+qhT *qh_qh= NULL;       /* pointer to all global variables */
 #else
-qhT qh_qh;     		/* all global variables.
-			   Add "= {0}" if this causes a compiler error.
-			   Also qh_qhstat in stat.c and qhmem in mem.c.  */
+qhT qh_qh;              /* all global variables.
+                           Add "= {0}" if this causes a compiler error.
+                           Also qh_qhstat in stat.c and qhmem in mem.c.  */
 #endif
 
-/*----------------------------------
 
   qh_version
@@ -34,15 +39,15 @@
     the revision increases on code changes only
 
   notes:
-    change date:    Changes.txt, Announce.txt, README.txt, 
-                    qhull.man, qhull.txt, qhull-news.html, Eudora signatures, 
+    change date:    Changes.txt, Announce.txt, index.htm, README.txt,
+                    qhull-news.html, Eudora signatures,
     change version: README.txt, qh-get.htm, File_id.diz, Makefile.txt
     change year:    Copying.txt
     check download size
-    recompile user_eg.c, rbox.c, qhull.c, qconvex.c, qdelaun.c qvoronoi.c, qhalf.c
+    recompile user_eg.c, rbox.c, libqhull.c, qconvex.c, qdelaun.c qvoronoi.c, qhalf.c
 */
 
-char *qh_version = "2003.1 2003/12/30";
+const char *qh_version = "2010.1 2010/01/14";
 
 /*---------------------------------
@@ -50,7 +55,7 @@
   qh_appendprint( printFormat )
     append printFormat to qh.PRINTout unless already defined
 */
-void qh_appendprint (qh_PRINT format) {
+void qh_appendprint(qh_PRINT format) {
   int i;
 
   for (i=0; i < qh_PRINTEND; i++) {
@@ -62,10 +67,10 @@
     }
   }
 } /* appendprint */
-     
+
 /*---------------------------------
-  
+
   qh_checkflags( commandStr, hiddenFlags )
     errors if commandStr contains hiddenFlags
     hiddenFlags starts and ends with a space and is space deliminated (checked)
@@ -73,22 +78,24 @@
   notes:
     ignores first word (e.g., "qconvex i")
     use qh_strtol/strtod since strtol/strtod may or may not skip trailing spaces
-  
+
   see:
     qh_initflags() initializes Qhull according to commandStr
 */
 void qh_checkflags(char *command, char *hiddenflags) {
-  char *s= command, *t, *chkerr, key, opt, prevopt;
+  char *s= command, *t, *chkerr; /* qh_skipfilename is non-const */
+  char key, opt, prevopt;
   char chkkey[]= "   ";
   char chkopt[]=  "    ";
   char chkopt2[]= "     ";
+  boolT waserr= False;
 
   if (*hiddenflags != ' ' || hiddenflags[strlen(hiddenflags)-1] != ' ') {
-    fprintf(qh ferr, "qhull error (qh_checkflags): hiddenflags must start and end with a space: \"%s\"", hiddenflags);
+    qh_fprintf(qh ferr, 6026, "qhull error (qh_checkflags): hiddenflags must start and end with a space: \"%s\"", hiddenflags);
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
-  if (strpbrk(hiddenflags, ",\n\r\t")) { 
-    fprintf(qh ferr, "qhull error (qh_checkflags): hiddenflags contains commas, newlines, or tabs: \"%s\"", hiddenflags);
+  if (strpbrk(hiddenflags, ",\n\r\t")) {
+    qh_fprintf(qh ferr, 6027, "qhull error (qh_checkflags): hiddenflags contains commas, newlines, or tabs: \"%s\"", hiddenflags);
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
   while (*s && !isspace(*s))  /* skip program name */
@@ -102,13 +109,8 @@
       break;
     key = *s++;
     chkerr = NULL;
-    if (key == '\'') {         /* TO 'file name' */
-      t= strchr(s, '\'');
-      if (!t) {
-	fprintf(qh ferr, "qhull error (qh_checkflags): missing the 2nd single-quote for:\n%s\n", s-1);
-	qh_errexit(qh_ERRinput, NULL, NULL);
-      }
-      s= t+1;
+    if (key == 'T' && (*s == 'I' || *s == 'O')) {  /* TI or TO 'file name' */
+      s= qh_skipfilename(++s);
       continue;
     }
     chkkey[1]= key;
@@ -120,42 +122,111 @@
       chkopt[1]= key;
       chkopt2[1]= key;
       while (!chkerr && *s && !isspace(*s)) {
-	opt= *s++;
-	if (isalpha(opt)) {
-	  chkopt[2]= opt;
-	  if (strstr(hiddenflags, chkopt))
-	    chkerr= chkopt;
-	  if (prevopt != ' ') {
- 	    chkopt2[2]= prevopt;
- 	    chkopt2[3]= opt;
-	    if (strstr(hiddenflags, chkopt2))
-	      chkerr= chkopt2;
-	  }
-	}else if (key == 'Q' && isdigit(opt) && prevopt != 'b' 
-	      && (prevopt == ' ' || islower(prevopt))) {
-  	    chkopt[2]= opt;
-	    if (strstr(hiddenflags, chkopt))
-	      chkerr= chkopt;
-	}else {
-	  qh_strtod (s-1, &t);
-	  if (s < t)
-	    s= t;
-	}
+        opt= *s++;
+        if (isalpha(opt)) {
+          chkopt[2]= opt;
+          if (strstr(hiddenflags, chkopt))
+            chkerr= chkopt;
+          if (prevopt != ' ') {
+            chkopt2[2]= prevopt;
+            chkopt2[3]= opt;
+            if (strstr(hiddenflags, chkopt2))
+              chkerr= chkopt2;
+          }
+        }else if (key == 'Q' && isdigit(opt) && prevopt != 'b'
+              && (prevopt == ' ' || islower(prevopt))) {
+            chkopt[2]= opt;
+            if (strstr(hiddenflags, chkopt))
+              chkerr= chkopt;
+        }else {
+          qh_strtod(s-1, &t);
+          if (s < t)
+            s= t;
+        }
         prevopt= opt;
       }
     }
     if (chkerr) {
       *chkerr= '\'';
       chkerr[strlen(chkerr)-1]=  '\'';
-      fprintf(qh ferr, "qhull error: option %s is not used with this program.\n             It may be used with qhull.\n", chkerr);
-      qh_errexit(qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6029, "qhull error: option %s is not used with this program.\n             It may be used with qhull.\n", chkerr);
+      waserr= True;
     }
   }
+  if (waserr)
+    qh_errexit(qh_ERRinput, NULL, NULL);
 } /* checkflags */
-    
+
 /*---------------------------------
+
+  qh_clear_outputflags()
+    Clear output flags for QhullPoints
+*/
+void qh_clear_outputflags(void) {
+  int i,k;
+
+  qh ANNOTATEoutput= False;
+  qh DOintersections= False;
+  qh DROPdim= -1;
+  qh FORCEoutput= False;
+  qh GETarea= False;
+  qh GOODpoint= 0;
+  qh GOODpointp= NULL;
+  qh GOODthreshold= False;
+  qh GOODvertex= 0;
+  qh GOODvertexp= NULL;
+  qh IStracing= 0;
+  qh KEEParea= False;
+  qh KEEPmerge= False;
+  qh KEEPminArea= REALmax;
+  qh PRINTcentrums= False;
+  qh PRINTcoplanar= False;
+  qh PRINTdots= False;
+  qh PRINTgood= False;
+  qh PRINTinner= False;
+  qh PRINTneighbors= False;
+  qh PRINTnoplanes= False;
+  qh PRINToptions1st= False;
+  qh PRINTouter= False;
+  qh PRINTprecision= True;
+  qh PRINTridges= False;
+  qh PRINTspheres= False;
+  qh PRINTstatistics= False;
+  qh PRINTsummary= False;
+  qh PRINTtransparent= False;
+  qh SPLITthresholds= False;
+  qh TRACElevel= 0;
+  qh TRInormals= False;
+  qh USEstdout= False;
+  qh VERIFYoutput= False;
+  for (k=qh input_dim+1; k--; ) {  /* duplicated in qh_initqhull_buffers and qh_clear_ouputflags */
+    qh lower_threshold[k]= -REALmax;
+    qh upper_threshold[k]= REALmax;
+    qh lower_bound[k]= -REALmax;
+    qh upper_bound[k]= REALmax;
+  }
+
+  for (i=0; i < qh_PRINTEND; i++) {
+    qh PRINTout[i]= qh_PRINTnone;
+  }
+
+  if (!qh qhull_commandsiz2)
+      qh qhull_commandsiz2= (int)strlen(qh qhull_command); /* WARN64 */
+  else {
+      qh qhull_command[qh qhull_commandsiz2]= '\0';
+  }
+  if (!qh qhull_optionsiz2)
+    qh qhull_optionsiz2= (int)strlen(qh qhull_options);  /* WARN64 */
+  else {
+    qh qhull_options[qh qhull_optionsiz2]= '\0';
+    qh qhull_optionlen= qh_OPTIONline;  /* start a new line */
+  }
+} /* clear_outputflags */
+
+/*---------------------------------
-  
+
   qh_clock()
     return user CPU time in 100ths (qh_SECtick)
     only defined for qh_CLOCKtype == 2
@@ -164,7 +235,7 @@
     use first value to determine time 0
     from Stevens '92 8.15
 */
-unsigned long qh_clock (void) {
+unsigned long qh_clock(void) {
 
 #if (qh_CLOCKtype == 2)
   struct tms time;
@@ -173,21 +244,21 @@
   unsigned long ticks;
 
   if (!clktck) {
-    if ((clktck= sysconf (_SC_CLK_TCK)) < 0) {
-      fprintf (qh ferr, "qhull internal error (qh_clock): sysconf() failed.  Use qh_CLOCKtype 1 in user.h\n");
-      qh_errexit (qh_ERRqhull, NULL, NULL);
+    if ((clktck= sysconf(_SC_CLK_TCK)) < 0) {
+      qh_fprintf(qh ferr, 6030, "qhull internal error (qh_clock): sysconf() failed.  Use qh_CLOCKtype 1 in user.h\n");
+      qh_errexit(qh_ERRqhull, NULL, NULL);
     }
   }
-  if (times (&time) == -1) {
-    fprintf (qh ferr, "qhull internal error (qh_clock): times() failed.  Use qh_CLOCKtype 1 in user.h\n");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+  if (times(&time) == -1) {
+    qh_fprintf(qh ferr, 6031, "qhull internal error (qh_clock): times() failed.  Use qh_CLOCKtype 1 in user.h\n");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   ratio= qh_SECticks / (double)clktck;
   ticks= time.tms_utime * ratio;
   return ticks;
 #else
-  fprintf (qh ferr, "qhull internal error (qh_clock): use qh_CLOCKtype 2 in user.h\n");
-  qh_errexit (qh_ERRqhull, NULL, NULL); /* never returns */
+  qh_fprintf(qh ferr, 6032, "qhull internal error (qh_clock): use qh_CLOCKtype 2 in user.h\n");
+  qh_errexit(qh_ERRqhull, NULL, NULL); /* never returns */
   return 0;
 #endif
 } /* clock */
@@ -201,46 +272,46 @@
   notes:
     must match qh_initbuffers()
 */
-void qh_freebuffers (void) {
+void qh_freebuffers(void) {
 
-  trace5((qh ferr, "qh_freebuffers: freeing up global memory buffers\n"));
+  trace5((qh ferr, 5001, "qh_freebuffers: freeing up global memory buffers\n"));
   /* allocated by qh_initqhull_buffers */
-  qh_memfree (qh NEARzero, qh hull_dim * sizeof(realT));
-  qh_memfree (qh lower_threshold, (qh input_dim+1) * sizeof(realT));
-  qh_memfree (qh upper_threshold, (qh input_dim+1) * sizeof(realT));
-  qh_memfree (qh lower_bound, (qh input_dim+1) * sizeof(realT));
-  qh_memfree (qh upper_bound, (qh input_dim+1) * sizeof(realT));
-  qh_memfree (qh gm_matrix, (qh hull_dim+1) * qh hull_dim * sizeof(coordT));
-  qh_memfree (qh gm_row, (qh hull_dim+1) * sizeof(coordT *));
+  qh_memfree(qh NEARzero, qh hull_dim * sizeof(realT));
+  qh_memfree(qh lower_threshold, (qh input_dim+1) * sizeof(realT));
+  qh_memfree(qh upper_threshold, (qh input_dim+1) * sizeof(realT));
+  qh_memfree(qh lower_bound, (qh input_dim+1) * sizeof(realT));
+  qh_memfree(qh upper_bound, (qh input_dim+1) * sizeof(realT));
+  qh_memfree(qh gm_matrix, (qh hull_dim+1) * qh hull_dim * sizeof(coordT));
+  qh_memfree(qh gm_row, (qh hull_dim+1) * sizeof(coordT *));
   qh NEARzero= qh lower_threshold= qh upper_threshold= NULL;
   qh lower_bound= qh upper_bound= NULL;
   qh gm_matrix= NULL;
   qh gm_row= NULL;
-  qh_setfree (&qh other_points);
-  qh_setfree (&qh del_vertices);
-  qh_setfree (&qh coplanarset);
+  qh_setfree(&qh other_points);
+  qh_setfree(&qh del_vertices);
+  qh_setfree(&qh coplanarfacetset);
   if (qh line)                /* allocated by qh_readinput, freed if no error */
-    free (qh line);
+    qh_free(qh line);
   if (qh half_space)
-    free (qh half_space);
+    qh_free(qh half_space);
   if (qh temp_malloc)
-    free (qh temp_malloc);
+    qh_free(qh temp_malloc);
   if (qh feasible_point)      /* allocated by qh_readfeasible */
-    free (qh feasible_point);
+    qh_free(qh feasible_point);
   if (qh feasible_string)     /* allocated by qh_initflags */
-    free (qh feasible_string);
+    qh_free(qh feasible_string);
   qh line= qh feasible_string= NULL;
   qh half_space= qh feasible_point= qh temp_malloc= NULL;
   /* usually allocated by qh_readinput */
   if (qh first_point && qh POINTSmalloc) {
-    free(qh first_point);
+    qh_free(qh first_point);
     qh first_point= NULL;
   }
   if (qh input_points && qh input_malloc) { /* set by qh_joggleinput */
-    free (qh input_points);
+    qh_free(qh input_points);
     qh input_points= NULL;
   }
-  trace5((qh ferr, "qh_freebuffers: finished\n"));
+  trace5((qh ferr, 5002, "qh_freebuffers: finished\n"));
 } /* freebuffers */
 
 
@@ -250,7 +321,7 @@
   qh_freebuild( allmem )
     free global memory used by qh_initbuild and qh_buildhull
     if !allmem,
-      does not free short memory (freed by qh_memfreeshort)
+      does not free short memory (e.g., facetT, freed by qh_memfreeshort)
 
   design:
     free centrums
@@ -265,28 +336,27 @@
     free merge set
     free temporary sets
 */
-void qh_freebuild (boolT allmem) {
+void qh_freebuild(boolT allmem) {
   facetT *facet;
   vertexT *vertex;
   ridgeT *ridge, **ridgep;
   mergeT *merge, **mergep;
 
-  trace1((qh ferr, "qh_freebuild: free memory from qh_inithull and qh_buildhull\n"));
+  trace1((qh ferr, 1005, "qh_freebuild: free memory from qh_inithull and qh_buildhull\n"));
   if (qh del_vertices)
-    qh_settruncate (qh del_vertices, 0);
+    qh_settruncate(qh del_vertices, 0);
   if (allmem) {
-    qh_clearcenters (qh_ASnone);
     while ((vertex= qh vertex_list)) {
       if (vertex->next)
-        qh_delvertex (vertex);
+        qh_delvertex(vertex);
       else {
-        qh_memfree (vertex, sizeof(vertexT));
+        qh_memfree(vertex, (int)sizeof(vertexT));
         qh newvertex_list= qh vertex_list= NULL;
       }
     }
   }else if (qh VERTEXneighbors) {
     FORALLvertices
-      qh_setfreelong (&(vertex->neighbors));
+      qh_setfreelong(&(vertex->neighbors));
   }
   qh VERTEXneighbors= False;
   qh GOODclosest= NULL;
@@ -297,48 +367,48 @@
     }
     FORALLfacets {
       if (facet->visible) {
-	FOREACHridge_(facet->ridges) {
-	  if (!otherfacet_(ridge, facet)->visible)
-	    ridge->seen= True;  /* an unattached ridge */
-	}
+        FOREACHridge_(facet->ridges) {
+          if (!otherfacet_(ridge, facet)->visible)
+            ridge->seen= True;  /* an unattached ridge */
+        }
       }
     }
     while ((facet= qh facet_list)) {
       FOREACHridge_(facet->ridges) {
         if (ridge->seen) {
           qh_setfree(&(ridge->vertices));
-          qh_memfree(ridge, sizeof(ridgeT));
+          qh_memfree(ridge, (int)sizeof(ridgeT));
         }else
           ridge->seen= True;
       }
-      qh_setfree (&(facet->outsideset));
-      qh_setfree (&(facet->coplanarset));
-      qh_setfree (&(facet->neighbors));
-      qh_setfree (&(facet->ridges));
-      qh_setfree (&(facet->vertices));
+      qh_setfree(&(facet->outsideset));
+      qh_setfree(&(facet->coplanarset));
+      qh_setfree(&(facet->neighbors));
+      qh_setfree(&(facet->ridges));
+      qh_setfree(&(facet->vertices));
       if (facet->next)
-        qh_delfacet (facet);
+        qh_delfacet(facet);
       else {
-        qh_memfree (facet, sizeof(facetT));
+        qh_memfree(facet, (int)sizeof(facetT));
         qh visible_list= qh newfacet_list= qh facet_list= NULL;
       }
     }
   }else {
     FORALLfacets {
-      qh_setfreelong (&(facet->outsideset));
-      qh_setfreelong (&(facet->coplanarset));
+      qh_setfreelong(&(facet->outsideset));
+      qh_setfreelong(&(facet->coplanarset));
       if (!facet->simplicial) {
-        qh_setfreelong (&(facet->neighbors));
-        qh_setfreelong (&(facet->ridges));
-        qh_setfreelong (&(facet->vertices));
+        qh_setfreelong(&(facet->neighbors));
+        qh_setfreelong(&(facet->ridges));
+        qh_setfreelong(&(facet->vertices));
       }
     }
   }
-  qh_setfree (&(qh hash_table));
-  qh_memfree (qh interior_point, qh normal_size);
+  qh_setfree(&(qh hash_table));
+  qh_memfree(qh interior_point, qh normal_size);
   qh interior_point= NULL;
   FOREACHmerge_(qh facet_mergeset)  /* usually empty */
-    qh_memfree (merge, sizeof(mergeT));
+    qh_memfree(merge, (int)sizeof(mergeT));
   qh facet_mergeset= NULL;  /* temp set */
   qh degen_mergeset= NULL;  /* temp set */
   qh_settempfree_all();
@@ -348,33 +418,51 @@
   >--------------------------------
 
   qh_freeqhull( allmem )
-    free global memory
-    if !allmem,
-      does not free short memory (freed by qh_memfreeshort)
+    see qh_freeqhull2
+    if qh_QHpointer, frees qh_qh
+*/
+void qh_freeqhull(boolT allmem) {
+    qh_freeqhull2(allmem);
+#if qh_QHpointer
+    qh_free(qh_qh);
+    qh_qh= NULL;
+#endif
+}
 
-  notes:
-    sets qh.NOerrexit in case caller forgets to
+/*---------------------------------
 
-  design:
-    free global and temporary memory from qh_initbuild and qh_buildhull
-    free buffers
-    free statistics
+qh_freeqhull2( allmem )
+  free global memory
+  if !allmem,
+    does not free short memory (freed by qh_memfreeshort)
+
+notes:
+  sets qh.NOerrexit in case caller forgets to
+
+see:
+  see qh_initqhull_start2()
+
+design:
+  free global and temporary memory from qh_initbuild and qh_buildhull
+  free buffers
+  free statistics
 */
-void qh_freeqhull (boolT allmem) {
+void qh_freeqhull2(boolT allmem) {
 
-  trace1((qh ferr, "qh_freeqhull: free global memory\n"));
-  qh NOerrexit= True;  /* no more setjmp since called at exit */
-  qh_freebuild (allmem);
+  trace1((qh ferr, 1006, "qh_freeqhull2: free global memory\n"));
+  qh NOerrexit= True;  /* no more setjmp since called at exit and ~QhullQh */
+  qh_freebuild(allmem);
   qh_freebuffers();
   qh_freestatistics();
 #if qh_QHpointer
-  free (qh_qh);
-  qh_qh= NULL;
+  memset((char *)qh_qh, 0, sizeof(qhT));
+  /* qh_qh freed by caller, qh_freeqhull() */
 #else
   memset((char *)&qh_qh, 0, sizeof(qhT));
+#endif
   qh NOerrexit= True;
-#endif
-} /* freeqhull */
+} /* freeqhull2 */
 
 /*---------------------------------
@@ -394,10 +482,10 @@
     called before error handling initialized
     qh_errexit() may not be used
 */
-void qh_init_A (FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]) {
-  qh_meminit (errfile);
-  qh_initqhull_start (infile, outfile, errfile);
-  qh_init_qhull_command (argc, argv);
+void qh_init_A(FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]) {
+  qh_meminit(errfile);
+  qh_initqhull_start(infile, outfile, errfile);
+  qh_init_qhull_command(argc, argv);
 } /* init_A */
 
 /*-= 0) {
-    qh_randommatrix (qh gm_matrix, qh hull_dim, qh gm_row);
+    qh_randommatrix(qh gm_matrix, qh hull_dim, qh gm_row);
     if (qh DELAUNAY) {
       int k, lastk= qh hull_dim-1;
-      for (k= 0; k < lastk; k++) {
+      for (k=0; k < lastk; k++) {
         qh gm_row[k][lastk]= 0.0;
         qh gm_row[lastk][k]= 0.0;
       }
       qh gm_row[lastk][lastk]= 1.0;
     }
-    qh_gram_schmidt (qh hull_dim, qh gm_row);
-    qh_rotateinput (qh gm_row);
+    qh_gram_schmidt(qh hull_dim, qh gm_row);
+    qh_rotateinput(qh gm_row);
   }
 } /* init_B */
 
@@ -474,7 +562,7 @@
     build qh.qhull_command from argc/argv
 
   returns:
-    a space-deliminated string of options (just as typed)
+    a space-delimited string of options (just as typed)
 
   notes:
     makes option string easy to input and output
@@ -482,28 +570,10 @@
     argc/argv may be 0/NULL
 */
 void qh_init_qhull_command(int argc, char *argv[]) {
-  int i;
-  char *s;
 
-  if (argc) {
-    if ((s= strrchr( argv[0], '\\'))) /* Borland gives full path */
-      strcpy (qh qhull_command, s+1);
-    else
-      strcpy (qh qhull_command, argv[0]);
-    if ((s= strstr (qh qhull_command, ".EXE"))
-    ||  (s= strstr (qh qhull_command, ".exe")))
-      *s= '\0';
+  if (!qh_argv_to_command(argc, argv, qh qhull_command, (int)sizeof(qh qhull_command))){
+    qh_exit(qh_ERRinput);  /* error reported, can not use qh_errexit */
   }
-  for (i=1; i < argc; i++) {
-    if (strlen (qh qhull_command) + strlen(argv[i]) + 1 < sizeof(qh qhull_command)) {
-      strcat (qh qhull_command, " ");
-      strcat (qh qhull_command, argv[i]);
-    }else {
-      fprintf (qh ferr, "qhull input error: more than %d characters in command line\n",
-        (int)sizeof(qh qhull_command));
-      exit (1);  /* can not use qh_errexit */
-    }
-  }
 } /* init_qhull_command */
 
 /*- &qh qhull_command[0] + sizeof(qh qhull_command)) {
+    if (command != &qh qhull_command[0]) {
+      *qh qhull_command= '\0';
+      strncat( qh qhull_command, command, sizeof( qh qhull_command));
+    }
+    while (*s && !isspace(*s))  /* skip program name */
+      s++;
   }
-  while (*s && !isspace(*s))  /* skip program name */
-    s++;
   while (*s) {
     while (*s && isspace(*s))
       s++;
@@ -559,802 +629,786 @@
     prev_s= s;
     switch (*s++) {
     case 'd':
-      qh_option ("delaunay", NULL, NULL);
+      qh_option("delaunay", NULL, NULL);
       qh DELAUNAY= True;
       break;
     case 'f':
-      qh_option ("facets", NULL, NULL);
-      qh_appendprint (qh_PRINTfacets);
+      qh_option("facets", NULL, NULL);
+      qh_appendprint(qh_PRINTfacets);
       break;
     case 'i':
-      qh_option ("incidence", NULL, NULL);
-      qh_appendprint (qh_PRINTincidences);
+      qh_option("incidence", NULL, NULL);
+      qh_appendprint(qh_PRINTincidences);
       break;
     case 'm':
-      qh_option ("mathematica", NULL, NULL);
-      qh_appendprint (qh_PRINTmathematica);
+      qh_option("mathematica", NULL, NULL);
+      qh_appendprint(qh_PRINTmathematica);
       break;
     case 'n':
-      qh_option ("normals", NULL, NULL);
-      qh_appendprint (qh_PRINTnormals);
+      qh_option("normals", NULL, NULL);
+      qh_appendprint(qh_PRINTnormals);
       break;
     case 'o':
-      qh_option ("offFile", NULL, NULL);
-      qh_appendprint (qh_PRINToff);
+      qh_option("offFile", NULL, NULL);
+      qh_appendprint(qh_PRINToff);
       break;
     case 'p':
-      qh_option ("points", NULL, NULL);
-      qh_appendprint (qh_PRINTpoints);
+      qh_option("points", NULL, NULL);
+      qh_appendprint(qh_PRINTpoints);
       break;
     case 's':
-      qh_option ("summary", NULL, NULL);
+      qh_option("summary", NULL, NULL);
       qh PRINTsummary= True;
       break;
     case 'v':
-      qh_option ("voronoi", NULL, NULL);
+      qh_option("voronoi", NULL, NULL);
       qh VORONOI= True;
       qh DELAUNAY= True;
       break;
     case 'A':
       if (!isdigit(*s) && *s != '.' && *s != '-')
-	fprintf(qh ferr, "qhull warning: no maximum cosine angle given for option 'An'.  Ignored.\n");
+        qh_fprintf(qh ferr, 7002, "qhull warning: no maximum cosine angle given for option 'An'.  Ignored.\n");
       else {
-	if (*s == '-') {
-	  qh premerge_cos= -qh_strtod (s, &s);
-          qh_option ("Angle-premerge-", NULL, &qh premerge_cos);
-	  qh PREmerge= True;
-	}else {
-	  qh postmerge_cos= qh_strtod (s, &s);
-          qh_option ("Angle-postmerge", NULL, &qh postmerge_cos);
-	  qh POSTmerge= True;
-	}
-	qh MERGING= True;
+        if (*s == '-') {
+          qh premerge_cos= -qh_strtod(s, &s);
+          qh_option("Angle-premerge-", NULL, &qh premerge_cos);
+          qh PREmerge= True;
+        }else {
+          qh postmerge_cos= qh_strtod(s, &s);
+          qh_option("Angle-postmerge", NULL, &qh postmerge_cos);
+          qh POSTmerge= True;
+        }
+        qh MERGING= True;
       }
       break;
     case 'C':
       if (!isdigit(*s) && *s != '.' && *s != '-')
-	fprintf(qh ferr, "qhull warning: no centrum radius given for option 'Cn'.  Ignored.\n");
+        qh_fprintf(qh ferr, 7003, "qhull warning: no centrum radius given for option 'Cn'.  Ignored.\n");
       else {
-	if (*s == '-') {
-	  qh premerge_centrum= -qh_strtod (s, &s);
-          qh_option ("Centrum-premerge-", NULL, &qh premerge_centrum);
-	  qh PREmerge= True;
-	}else {
-	  qh postmerge_centrum= qh_strtod (s, &s);
-          qh_option ("Centrum-postmerge", NULL, &qh postmerge_centrum);
-	  qh POSTmerge= True;
-	}
-	qh MERGING= True;
+        if (*s == '-') {
+          qh premerge_centrum= -qh_strtod(s, &s);
+          qh_option("Centrum-premerge-", NULL, &qh premerge_centrum);
+          qh PREmerge= True;
+        }else {
+          qh postmerge_centrum= qh_strtod(s, &s);
+          qh_option("Centrum-postmerge", NULL, &qh postmerge_centrum);
+          qh POSTmerge= True;
+        }
+        qh MERGING= True;
       }
       break;
     case 'E':
       if (*s == '-')
-	fprintf(qh ferr, "qhull warning: negative maximum roundoff given for option 'An'.  Ignored.\n");
+        qh_fprintf(qh ferr, 7004, "qhull warning: negative maximum roundoff given for option 'An'.  Ignored.\n");
       else if (!isdigit(*s))
-	fprintf(qh ferr, "qhull warning: no maximum roundoff given for option 'En'.  Ignored.\n");
+        qh_fprintf(qh ferr, 7005, "qhull warning: no maximum roundoff given for option 'En'.  Ignored.\n");
       else {
-	qh DISTround= qh_strtod (s, &s);
-        qh_option ("Distance-roundoff", NULL, &qh DISTround);
-	qh SETroundoff= True;
+        qh DISTround= qh_strtod(s, &s);
+        qh_option("Distance-roundoff", NULL, &qh DISTround);
+        qh SETroundoff= True;
       }
       break;
     case 'H':
       start= s;
       qh HALFspace= True;
-      qh_strtod (s, &t);
+      qh_strtod(s, &t);
       while (t > s)  {
-        if (*t && !isspace (*t)) {
-	  if (*t == ',')
-	    t++;
-	  else
-	    fprintf (qh ferr, "qhull warning: origin for Halfspace intersection should be 'Hn,n,n,...'\n");
-	}
+        if (*t && !isspace(*t)) {
+          if (*t == ',')
+            t++;
+          else
+            qh_fprintf(qh ferr, 7006, "qhull warning: origin for Halfspace intersection should be 'Hn,n,n,...'\n");
+        }
         s= t;
-	qh_strtod (s, &t);
+        qh_strtod(s, &t);
       }
       if (start < t) {
-        if (!(qh feasible_string= (char*)calloc (t-start+1, 1))) {
-          fprintf(qh ferr, "qhull error: insufficient memory for 'Hn,n,n'\n");
+        if (!(qh feasible_string= (char*)calloc((size_t)(t-start+1), (size_t)1))) {
+          qh_fprintf(qh ferr, 6034, "qhull error: insufficient memory for 'Hn,n,n'\n");
           qh_errexit(qh_ERRmem, NULL, NULL);
         }
-        strncpy (qh feasible_string, start, t-start);
-        qh_option ("Halfspace-about", NULL, NULL);
-        qh_option (qh feasible_string, NULL, NULL);
+        strncpy(qh feasible_string, start, (size_t)(t-start));
+        qh_option("Halfspace-about", NULL, NULL);
+        qh_option(qh feasible_string, NULL, NULL);
       }else
-        qh_option ("Halfspace", NULL, NULL);
+        qh_option("Halfspace", NULL, NULL);
       break;
     case 'R':
       if (!isdigit(*s))
-	fprintf(qh ferr, "qhull warning: missing random perturbation for option 'Rn'.  Ignored\n");
+        qh_fprintf(qh ferr, 7007, "qhull warning: missing random perturbation for option 'Rn'.  Ignored\n");
       else {
-	qh RANDOMfactor= qh_strtod (s, &s);
-        qh_option ("Random_perturb", NULL, &qh RANDOMfactor);
+        qh RANDOMfactor= qh_strtod(s, &s);
+        qh_option("Random_perturb", NULL, &qh RANDOMfactor);
         qh RANDOMdist= True;
       }
       break;
     case 'V':
       if (!isdigit(*s) && *s != '-')
-	fprintf(qh ferr, "qhull warning: missing visible distance for option 'Vn'.  Ignored\n");
+        qh_fprintf(qh ferr, 7008, "qhull warning: missing visible distance for option 'Vn'.  Ignored\n");
       else {
-	qh MINvisible= qh_strtod (s, &s);
-        qh_option ("Visible", NULL, &qh MINvisible);
+        qh MINvisible= qh_strtod(s, &s);
+        qh_option("Visible", NULL, &qh MINvisible);
       }
       break;
     case 'U':
       if (!isdigit(*s) && *s != '-')
-	fprintf(qh ferr, "qhull warning: missing coplanar distance for option 'Un'.  Ignored\n");
+        qh_fprintf(qh ferr, 7009, "qhull warning: missing coplanar distance for option 'Un'.  Ignored\n");
       else {
-	qh MAXcoplanar= qh_strtod (s, &s);
-        qh_option ("U-coplanar", NULL, &qh MAXcoplanar);
+        qh MAXcoplanar= qh_strtod(s, &s);
+        qh_option("U-coplanar", NULL, &qh MAXcoplanar);
       }
       break;
     case 'W':
       if (*s == '-')
-	fprintf(qh ferr, "qhull warning: negative outside width for option 'Wn'.  Ignored.\n");
+        qh_fprintf(qh ferr, 7010, "qhull warning: negative outside width for option 'Wn'.  Ignored.\n");
       else if (!isdigit(*s))
-	fprintf(qh ferr, "qhull warning: missing outside width for option 'Wn'.  Ignored\n");
+        qh_fprintf(qh ferr, 7011, "qhull warning: missing outside width for option 'Wn'.  Ignored\n");
       else {
-	qh MINoutside= qh_strtod (s, &s);
-        qh_option ("W-outside", NULL, &qh MINoutside);
+        qh MINoutside= qh_strtod(s, &s);
+        qh_option("W-outside", NULL, &qh MINoutside);
         qh APPROXhull= True;
       }
       break;
     /************  sub menus ***************/
     case 'F':
       while (*s && !isspace(*s)) {
-	switch(*s++) {
-	case 'a':
-	  qh_option ("Farea", NULL, NULL);
-	  qh_appendprint (qh_PRINTarea);
-	  qh GETarea= True;
-	  break;
-	case 'A':
-	  qh_option ("FArea-total", NULL, NULL);
-	  qh GETarea= True;
-	  break;
+        switch (*s++) {
+        case 'a':
+          qh_option("Farea", NULL, NULL);
+          qh_appendprint(qh_PRINTarea);
+          qh GETarea= True;
+          break;
+        case 'A':
+          qh_option("FArea-total", NULL, NULL);
+          qh GETarea= True;
+          break;
         case 'c':
-          qh_option ("Fcoplanars", NULL, NULL);
-          qh_appendprint (qh_PRINTcoplanars);
+          qh_option("Fcoplanars", NULL, NULL);
+          qh_appendprint(qh_PRINTcoplanars);
           break;
         case 'C':
-          qh_option ("FCentrums", NULL, NULL);
-          qh_appendprint (qh_PRINTcentrums);
+          qh_option("FCentrums", NULL, NULL);
+          qh_appendprint(qh_PRINTcentrums);
           break;
-	case 'd':
-          qh_option ("Fd-cdd-in", NULL, NULL);
-	  qh CDDinput= True;
-	  break;
-	case 'D':
-          qh_option ("FD-cdd-out", NULL, NULL);
-	  qh CDDoutput= True;
-	  break;
-	case 'F':
-	  qh_option ("FFacets-xridge", NULL, NULL);
-          qh_appendprint (qh_PRINTfacets_xridge);
-	  break;
+        case 'd':
+          qh_option("Fd-cdd-in", NULL, NULL);
+          qh CDDinput= True;
+          break;
+        case 'D':
+          qh_option("FD-cdd-out", NULL, NULL);
+          qh CDDoutput= True;
+          break;
+        case 'F':
+          qh_option("FFacets-xridge", NULL, NULL);
+          qh_appendprint(qh_PRINTfacets_xridge);
+          break;
         case 'i':
-          qh_option ("Finner", NULL, NULL);
-          qh_appendprint (qh_PRINTinner);
+          qh_option("Finner", NULL, NULL);
+          qh_appendprint(qh_PRINTinner);
           break;
         case 'I':
-          qh_option ("FIDs", NULL, NULL);
-          qh_appendprint (qh_PRINTids);
+          qh_option("FIDs", NULL, NULL);
+          qh_appendprint(qh_PRINTids);
           break;
         case 'm':
-          qh_option ("Fmerges", NULL, NULL);
-          qh_appendprint (qh_PRINTmerges);
+          qh_option("Fmerges", NULL, NULL);
+          qh_appendprint(qh_PRINTmerges);
           break;
         case 'M':
-          qh_option ("FMaple", NULL, NULL);
-          qh_appendprint (qh_PRINTmaple);
+          qh_option("FMaple", NULL, NULL);
+          qh_appendprint(qh_PRINTmaple);
           break;
         case 'n':
-          qh_option ("Fneighbors", NULL, NULL);
-          qh_appendprint (qh_PRINTneighbors);
+          qh_option("Fneighbors", NULL, NULL);
+          qh_appendprint(qh_PRINTneighbors);
           break;
         case 'N':
-          qh_option ("FNeighbors-vertex", NULL, NULL);
-          qh_appendprint (qh_PRINTvneighbors);
+          qh_option("FNeighbors-vertex", NULL, NULL);
+          qh_appendprint(qh_PRINTvneighbors);
           break;
         case 'o':
-          qh_option ("Fouter", NULL, NULL);
-          qh_appendprint (qh_PRINTouter);
+          qh_option("Fouter", NULL, NULL);
+          qh_appendprint(qh_PRINTouter);
           break;
-	case 'O':
-	  if (qh PRINToptions1st) {
-	    qh_option ("FOptions", NULL, NULL);
-	    qh_appendprint (qh_PRINToptions);
-	  }else
-	    qh PRINToptions1st= True;
-	  break;
-	case 'p':
-	  qh_option ("Fpoint-intersect", NULL, NULL);
-	  qh_appendprint (qh_PRINTpointintersect);
-	  break;
-	case 'P':
-	  qh_option ("FPoint-nearest", NULL, NULL);
-	  qh_appendprint (qh_PRINTpointnearest);
-	  break;
-	case 'Q':
-	  qh_option ("FQhull", NULL, NULL);
-	  qh_appendprint (qh_PRINTqhull);
-	  break;
+        case 'O':
+          if (qh PRINToptions1st) {
+            qh_option("FOptions", NULL, NULL);
+            qh_appendprint(qh_PRINToptions);
+          }else
+            qh PRINToptions1st= True;
+          break;
+        case 'p':
+          qh_option("Fpoint-intersect", NULL, NULL);
+          qh_appendprint(qh_PRINTpointintersect);
+          break;
+        case 'P':
+          qh_option("FPoint-nearest", NULL, NULL);
+          qh_appendprint(qh_PRINTpointnearest);
+          break;
+        case 'Q':
+          qh_option("FQhull", NULL, NULL);
+          qh_appendprint(qh_PRINTqhull);
+          break;
         case 's':
-          qh_option ("Fsummary", NULL, NULL);
-          qh_appendprint (qh_PRINTsummary);
+          qh_option("Fsummary", NULL, NULL);
+          qh_appendprint(qh_PRINTsummary);
           break;
         case 'S':
-          qh_option ("FSize", NULL, NULL);
-          qh_appendprint (qh_PRINTsize);
+          qh_option("FSize", NULL, NULL);
+          qh_appendprint(qh_PRINTsize);
           qh GETarea= True;
           break;
         case 't':
-          qh_option ("Ftriangles", NULL, NULL);
-          qh_appendprint (qh_PRINTtriangles);
+          qh_option("Ftriangles", NULL, NULL);
+          qh_appendprint(qh_PRINTtriangles);
           break;
         case 'v':
           /* option set in qh_initqhull_globals */
-          qh_appendprint (qh_PRINTvertices);
+          qh_appendprint(qh_PRINTvertices);
           break;
         case 'V':
-          qh_option ("FVertex-average", NULL, NULL);
-          qh_appendprint (qh_PRINTaverage);
+          qh_option("FVertex-average", NULL, NULL);
+          qh_appendprint(qh_PRINTaverage);
           break;
-	case 'x':
-	  qh_option ("Fxtremes", NULL, NULL);
-	  qh_appendprint (qh_PRINTextremes);
-	  break;
-	default:
-	  s--;
-	  fprintf (qh ferr, "qhull warning: unknown 'F' output option %c, rest ignored\n", (int)s[0]);
-	  while (*++s && !isspace(*s));
-	  break;
-	}
+        case 'x':
+          qh_option("Fxtremes", NULL, NULL);
+          qh_appendprint(qh_PRINTextremes);
+          break;
+        default:
+          s--;
+          qh_fprintf(qh ferr, 7012, "qhull warning: unknown 'F' output option %c, rest ignored\n", (int)s[0]);
+          while (*++s && !isspace(*s));
+          break;
+        }
       }
       break;
     case 'G':
       isgeom= True;
-      qh_appendprint (qh_PRINTgeom);
+      qh_appendprint(qh_PRINTgeom);
       while (*s && !isspace(*s)) {
-	switch(*s++) {
+        switch (*s++) {
         case 'a':
-          qh_option ("Gall-points", NULL, NULL);
+          qh_option("Gall-points", NULL, NULL);
           qh PRINTdots= True;
           break;
         case 'c':
-          qh_option ("Gcentrums", NULL, NULL);
+          qh_option("Gcentrums", NULL, NULL);
           qh PRINTcentrums= True;
           break;
-	case 'h':
-          qh_option ("Gintersections", NULL, NULL);
-	  qh DOintersections= True;
-	  break;
-	case 'i':
-          qh_option ("Ginner", NULL, NULL);
-	  qh PRINTinner= True;
-	  break;
-	case 'n':
-          qh_option ("Gno-planes", NULL, NULL);
-	  qh PRINTnoplanes= True;
-	  break;
-	case 'o':
-          qh_option ("Gouter", NULL, NULL);
-	  qh PRINTouter= True;
-	  break;
-	case 'p':
-          qh_option ("Gpoints", NULL, NULL);
-	  qh PRINTcoplanar= True;
-	  break;
-	case 'r':
-          qh_option ("Gridges", NULL, NULL);
-	  qh PRINTridges= True;
-	  break;
-	case 't':
-          qh_option ("Gtransparent", NULL, NULL);
-	  qh PRINTtransparent= True;
-	  break;
-	case 'v':
-          qh_option ("Gvertices", NULL, NULL);
-	  qh PRINTspheres= True;
-	  break;
-	case 'D':
-	  if (!isdigit (*s))
-	    fprintf (qh ferr, "qhull input error: missing dimension for option 'GDn'\n");
-	  else {
-	    if (qh DROPdim >= 0)
-	      fprintf (qh ferr, "qhull warning: can only drop one dimension.  Previous 'GD%d' ignored\n",
-	           qh DROPdim);
-  	    qh DROPdim= qh_strtol (s, &s);
-            qh_option ("GDrop-dim", &qh DROPdim, NULL);
+        case 'h':
+          qh_option("Gintersections", NULL, NULL);
+          qh DOintersections= True;
+          break;
+        case 'i':
+          qh_option("Ginner", NULL, NULL);
+          qh PRINTinner= True;
+          break;
+        case 'n':
+          qh_option("Gno-planes", NULL, NULL);
+          qh PRINTnoplanes= True;
+          break;
+        case 'o':
+          qh_option("Gouter", NULL, NULL);
+          qh PRINTouter= True;
+          break;
+        case 'p':
+          qh_option("Gpoints", NULL, NULL);
+          qh PRINTcoplanar= True;
+          break;
+        case 'r':
+          qh_option("Gridges", NULL, NULL);
+          qh PRINTridges= True;
+          break;
+        case 't':
+          qh_option("Gtransparent", NULL, NULL);
+          qh PRINTtransparent= True;
+          break;
+        case 'v':
+          qh_option("Gvertices", NULL, NULL);
+          qh PRINTspheres= True;
+          break;
+        case 'D':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 6035, "qhull input error: missing dimension for option 'GDn'\n");
+          else {
+            if (qh DROPdim >= 0)
+              qh_fprintf(qh ferr, 7013, "qhull warning: can only drop one dimension.  Previous 'GD%d' ignored\n",
+                   qh DROPdim);
+            qh DROPdim= qh_strtol(s, &s);
+            qh_option("GDrop-dim", &qh DROPdim, NULL);
           }
-	  break;
-	default:
-	  s--;
-	  fprintf (qh ferr, "qhull warning: unknown 'G' print option %c, rest ignored\n", (int)s[0]);
-	  while (*++s && !isspace(*s));
-	  break;
-	}
+          break;
+        default:
+          s--;
+          qh_fprintf(qh ferr, 7014, "qhull warning: unknown 'G' print option %c, rest ignored\n", (int)s[0]);
+          while (*++s && !isspace(*s));
+          break;
+        }
       }
       break;
     case 'P':
       while (*s && !isspace(*s)) {
-	switch(*s++) {
-	case 'd': case 'D':  /* see qh_initthresholds() */
-	  key= s[-1];
-	  i= qh_strtol (s, &s);
-	  r= 0;
-	  if (*s == ':') {
-	    s++;
-	    r= qh_strtod (s, &s);
-	  }
-	  if (key == 'd')
-  	    qh_option ("Pdrop-facets-dim-less", &i, &r);
-  	  else
-  	    qh_option ("PDrop-facets-dim-more", &i, &r);
-	  break;
+        switch (*s++) {
+        case 'd': case 'D':  /* see qh_initthresholds() */
+          key= s[-1];
+          i= qh_strtol(s, &s);
+          r= 0;
+          if (*s == ':') {
+            s++;
+            r= qh_strtod(s, &s);
+          }
+          if (key == 'd')
+            qh_option("Pdrop-facets-dim-less", &i, &r);
+          else
+            qh_option("PDrop-facets-dim-more", &i, &r);
+          break;
         case 'g':
-          qh_option ("Pgood-facets", NULL, NULL);
+          qh_option("Pgood-facets", NULL, NULL);
           qh PRINTgood= True;
           break;
         case 'G':
-          qh_option ("PGood-facet-neighbors", NULL, NULL);
+          qh_option("PGood-facet-neighbors", NULL, NULL);
           qh PRINTneighbors= True;
           break;
         case 'o':
-          qh_option ("Poutput-forced", NULL, NULL);
+          qh_option("Poutput-forced", NULL, NULL);
           qh FORCEoutput= True;
           break;
         case 'p':
-          qh_option ("Pprecision-ignore", NULL, NULL);
+          qh_option("Pprecision-ignore", NULL, NULL);
           qh PRINTprecision= False;
           break;
-	case 'A':
-	  if (!isdigit (*s))
-	    fprintf (qh ferr, "qhull input error: missing facet count for keep area option 'PAn'\n");
-	  else {
-  	    qh KEEParea= qh_strtol (s, &s);
-            qh_option ("PArea-keep", &qh KEEParea, NULL);
+        case 'A':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 6036, "qhull input error: missing facet count for keep area option 'PAn'\n");
+          else {
+            qh KEEParea= qh_strtol(s, &s);
+            qh_option("PArea-keep", &qh KEEParea, NULL);
             qh GETarea= True;
           }
-	  break;
-	case 'F':
-	  if (!isdigit (*s))
-	    fprintf (qh ferr, "qhull input error: missing facet area for option 'PFn'\n");
-	  else {
-  	    qh KEEPminArea= qh_strtod (s, &s);
-            qh_option ("PFacet-area-keep", NULL, &qh KEEPminArea);
+          break;
+        case 'F':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 6037, "qhull input error: missing facet area for option 'PFn'\n");
+          else {
+            qh KEEPminArea= qh_strtod(s, &s);
+            qh_option("PFacet-area-keep", NULL, &qh KEEPminArea);
             qh GETarea= True;
           }
-	  break;
-	case 'M':
-	  if (!isdigit (*s))
-	    fprintf (qh ferr, "qhull input error: missing merge count for option 'PMn'\n");
-	  else {
-  	    qh KEEPmerge= qh_strtol (s, &s);
-            qh_option ("PMerge-keep", &qh KEEPmerge, NULL);
+          break;
+        case 'M':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 6038, "qhull input error: missing merge count for option 'PMn'\n");
+          else {
+            qh KEEPmerge= qh_strtol(s, &s);
+            qh_option("PMerge-keep", &qh KEEPmerge, NULL);
           }
-	  break;
-	default:
-	  s--;
-	  fprintf (qh ferr, "qhull warning: unknown 'P' print option %c, rest ignored\n", (int)s[0]);
-	  while (*++s && !isspace(*s));
-	  break;
-	}
+          break;
+        default:
+          s--;
+          qh_fprintf(qh ferr, 7015, "qhull warning: unknown 'P' print option %c, rest ignored\n", (int)s[0]);
+          while (*++s && !isspace(*s));
+          break;
+        }
       }
       break;
     case 'Q':
       lastproject= -1;
       while (*s && !isspace(*s)) {
-	switch(*s++) {
-	case 'b': case 'B':  /* handled by qh_initthresholds */
-	  key= s[-1];
-	  if (key == 'b' && *s == 'B') {
-	    s++;
-	    r= qh_DEFAULTbox;
-	    qh SCALEinput= True;
-	    qh_option ("QbBound-unit-box", NULL, &r);
-	    break;
-	  }
-	  if (key == 'b' && *s == 'b') {
-	    s++;
-	    qh SCALElast= True;
-	    qh_option ("Qbbound-last", NULL, NULL);
-	    break;
-	  }
-	  k= qh_strtol (s, &s);
-	  r= 0.0;
-	  wasproject= False;
-	  if (*s == ':') {
-	    s++;
-	    if ((r= qh_strtod(s, &s)) == 0.0) {
- 	      t= s;            /* need true dimension for memory allocation */
-	      while (*t && !isspace(*t)) {
-	        if (toupper(*t++) == 'B'
-	         && k == qh_strtol (t, &t)
-	         && *t++ == ':'
-	         && qh_strtod(t, &t) == 0.0) {
-	          qh PROJECTinput++;
-	          trace2((qh ferr, "qh_initflags: project dimension %d\n", k));
-	          qh_option ("Qb-project-dim", &k, NULL);
-		  wasproject= True;
-	          lastproject= k;
-	          break;
-		}
-	      }
-	    }
-  	  }
-	  if (!wasproject) {
-	    if (lastproject == k && r == 0.0)
-	      lastproject= -1;  /* doesn't catch all possible sequences */
-	    else if (key == 'b') {
-	      qh SCALEinput= True;
-	      if (r == 0.0)
-		r= -qh_DEFAULTbox;
-	      qh_option ("Qbound-dim-low", &k, &r);
-	    }else {
-	      qh SCALEinput= True;
-	      if (r == 0.0)
-		r= qh_DEFAULTbox;
-	      qh_option ("QBound-dim-high", &k, &r);
-	    }
-	  }
-	  break;
-	case 'c':
-	  qh_option ("Qcoplanar-keep", NULL, NULL);
-	  qh KEEPcoplanar= True;
-	  break;
-	case 'f':
-	  qh_option ("Qfurthest-outside", NULL, NULL);
-	  qh BESToutside= True;
-	  break;
-	case 'g':
-	  qh_option ("Qgood-facets-only", NULL, NULL);
-	  qh ONLYgood= True;
-	  break;
-	case 'i':
-	  qh_option ("Qinterior-keep", NULL, NULL);
-	  qh KEEPinside= True;
-	  break;
-	case 'm':
-	  qh_option ("Qmax-outside-only", NULL, NULL);
-	  qh ONLYmax= True;
-	  break;
-	case 'r':
-	  qh_option ("Qrandom-outside", NULL, NULL);
-	  qh RANDOMoutside= True;
-	  break;
-	case 's':
-	  qh_option ("Qsearch-initial-simplex", NULL, NULL);
-	  qh ALLpoints= True;
-	  break;
-	case 't':
-	  qh_option ("Qtriangulate", NULL, NULL);
-	  qh TRIangulate= True;
-	  break;
-	case 'T':
-	  qh_option ("QTestPoints", NULL, NULL);
-	  if (!isdigit (*s))
-	    fprintf (qh ferr, "qhull input error: missing number of test points for option 'QTn'\n");
-	  else {
-  	    qh TESTpoints= qh_strtol (s, &s);
-            qh_option ("QTestPoints", &qh TESTpoints, NULL);
+        switch (*s++) {
+        case 'b': case 'B':  /* handled by qh_initthresholds */
+          key= s[-1];
+          if (key == 'b' && *s == 'B') {
+            s++;
+            r= qh_DEFAULTbox;
+            qh SCALEinput= True;
+            qh_option("QbBound-unit-box", NULL, &r);
+            break;
           }
-	  break;
-	case 'u':
-	  qh_option ("QupperDelaunay", NULL, NULL);
-	  qh UPPERdelaunay= True;
-	  break;
-	case 'v':
-	  qh_option ("Qvertex-neighbors-convex", NULL, NULL);
-	  qh TESTvneighbors= True;
-	  break;
-	case 'x':
-	  qh_option ("Qxact-merge", NULL, NULL);
-	  qh MERGEexact= True;
-	  break;
-	case 'z':
-	  qh_option ("Qz-infinity-point", NULL, NULL);
-	  qh ATinfinity= True;
-	  break;
-	case '0':
-	  qh_option ("Q0-no-premerge", NULL, NULL);
-	  qh NOpremerge= True;
-	  break;
-	case '1':
-	  if (!isdigit(*s)) {
-	    qh_option ("Q1-no-angle-sort", NULL, NULL);
-	    qh ANGLEmerge= False;
-	    break; 
-	  }
-	  switch(*s++) {
-  	  case '0':
-	    qh_option ("Q10-no-narrow", NULL, NULL);
-	    qh NOnarrow= True;
-	    break; 
-  	  case '1':
-	    qh_option ("Q11-trinormals Qtriangulate", NULL, NULL);
-	    qh TRInormals= True;
-	    qh TRIangulate= True;
-	    break; 
-	  default:
-	    s--;
-	    fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option 1%c, rest ignored\n", (int)s[0]);
-	    while (*++s && !isspace(*s));
-	    break;
-	  }
-	  break;
-	case '2':
-	  qh_option ("Q2-no-merge-independent", NULL, NULL);
-	  qh MERGEindependent= False;
-	  goto LABELcheckdigit;
-	  break; /* no warnings */
-	case '3':
-	  qh_option ("Q3-no-merge-vertices", NULL, NULL);
-	  qh MERGEvertices= False;
-	LABELcheckdigit:
-	  if (isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: can not follow '1', '2', or '3' with a digit.  '%c' skipped.\n",
-	             *s++);
-	  break;
-	case '4':
-	  qh_option ("Q4-avoid-old-into-new", NULL, NULL);
-	  qh AVOIDold= True;
-	  break;
-	case '5':
-	  qh_option ("Q5-no-check-outer", NULL, NULL);
-	  qh SKIPcheckmax= True;
-	  break;
-	case '6':
-	  qh_option ("Q6-no-concave-merge", NULL, NULL);
-	  qh SKIPconvex= True;
-	  break;
-	case '7':
-	  qh_option ("Q7-no-breadth-first", NULL, NULL);
-	  qh VIRTUALmemory= True;
-	  break;
-	case '8':
-	  qh_option ("Q8-no-near-inside", NULL, NULL);
-	  qh NOnearinside= True;
-	  break;
-	case '9':
-	  qh_option ("Q9-pick-furthest", NULL, NULL);
-	  qh PICKfurthest= True;
-	  break;
-	case 'G':
-	  i= qh_strtol (s, &t);
-	  if (qh GOODpoint)
-	    fprintf (qh ferr, "qhull warning: good point already defined for option 'QGn'.  Ignored\n");
+          if (key == 'b' && *s == 'b') {
+            s++;
+            qh SCALElast= True;
+            qh_option("Qbbound-last", NULL, NULL);
+            break;
+          }
+          k= qh_strtol(s, &s);
+          r= 0.0;
+          wasproject= False;
+          if (*s == ':') {
+            s++;
+            if ((r= qh_strtod(s, &s)) == 0.0) {
+              t= s;            /* need true dimension for memory allocation */
+              while (*t && !isspace(*t)) {
+                if (toupper(*t++) == 'B'
+                 && k == qh_strtol(t, &t)
+                 && *t++ == ':'
+                 && qh_strtod(t, &t) == 0.0) {
+                  qh PROJECTinput++;
+                  trace2((qh ferr, 2004, "qh_initflags: project dimension %d\n", k));
+                  qh_option("Qb-project-dim", &k, NULL);
+                  wasproject= True;
+                  lastproject= k;
+                  break;
+                }
+              }
+            }
+          }
+          if (!wasproject) {
+            if (lastproject == k && r == 0.0)
+              lastproject= -1;  /* doesn't catch all possible sequences */
+            else if (key == 'b') {
+              qh SCALEinput= True;
+              if (r == 0.0)
+                r= -qh_DEFAULTbox;
+              qh_option("Qbound-dim-low", &k, &r);
+            }else {
+              qh SCALEinput= True;
+              if (r == 0.0)
+                r= qh_DEFAULTbox;
+              qh_option("QBound-dim-high", &k, &r);
+            }
+          }
+          break;
+        case 'c':
+          qh_option("Qcoplanar-keep", NULL, NULL);
+          qh KEEPcoplanar= True;
+          break;
+        case 'f':
+          qh_option("Qfurthest-outside", NULL, NULL);
+          qh BESToutside= True;
+          break;
+        case 'g':
+          qh_option("Qgood-facets-only", NULL, NULL);
+          qh ONLYgood= True;
+          break;
+        case 'i':
+          qh_option("Qinterior-keep", NULL, NULL);
+          qh KEEPinside= True;
+          break;
+        case 'm':
+          qh_option("Qmax-outside-only", NULL, NULL);
+          qh ONLYmax= True;
+          break;
+        case 'r':
+          qh_option("Qrandom-outside", NULL, NULL);
+          qh RANDOMoutside= True;
+          break;
+        case 's':
+          qh_option("Qsearch-initial-simplex", NULL, NULL);
+          qh ALLpoints= True;
+          break;
+        case 't':
+          qh_option("Qtriangulate", NULL, NULL);
+          qh TRIangulate= True;
+          break;
+        case 'T':
+          qh_option("QTestPoints", NULL, NULL);
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 6039, "qhull input error: missing number of test points for option 'QTn'\n");
+          else {
+            qh TESTpoints= qh_strtol(s, &s);
+            qh_option("QTestPoints", &qh TESTpoints, NULL);
+          }
+          break;
+        case 'u':
+          qh_option("QupperDelaunay", NULL, NULL);
+          qh UPPERdelaunay= True;
+          break;
+        case 'v':
+          qh_option("Qvertex-neighbors-convex", NULL, NULL);
+          qh TESTvneighbors= True;
+          break;
+        case 'x':
+          qh_option("Qxact-merge", NULL, NULL);
+          qh MERGEexact= True;
+          break;
+        case 'z':
+          qh_option("Qz-infinity-point", NULL, NULL);
+          qh ATinfinity= True;
+          break;
+        case '0':
+          qh_option("Q0-no-premerge", NULL, NULL);
+          qh NOpremerge= True;
+          break;
+        case '1':
+          if (!isdigit(*s)) {
+            qh_option("Q1-no-angle-sort", NULL, NULL);
+            qh ANGLEmerge= False;
+            break;
+          }
+          switch (*s++) {
+          case '0':
+            qh_option("Q10-no-narrow", NULL, NULL);
+            qh NOnarrow= True;
+            break;
+          case '1':
+            qh_option("Q11-trinormals Qtriangulate", NULL, NULL);
+            qh TRInormals= True;
+            qh TRIangulate= True;
+            break;
+          default:
+            s--;
+            qh_fprintf(qh ferr, 7016, "qhull warning: unknown 'Q' qhull option 1%c, rest ignored\n", (int)s[0]);
+            while (*++s && !isspace(*s));
+            break;
+          }
+          break;
+        case '2':
+          qh_option("Q2-no-merge-independent", NULL, NULL);
+          qh MERGEindependent= False;
+          goto LABELcheckdigit;
+          break; /* no warnings */
+        case '3':
+          qh_option("Q3-no-merge-vertices", NULL, NULL);
+          qh MERGEvertices= False;
+        LABELcheckdigit:
+          if (isdigit(*s))
+            qh_fprintf(qh ferr, 7017, "qhull warning: can not follow '1', '2', or '3' with a digit.  '%c' skipped.\n",
+                     *s++);
+          break;
+        case '4':
+          qh_option("Q4-avoid-old-into-new", NULL, NULL);
+          qh AVOIDold= True;
+          break;
+        case '5':
+          qh_option("Q5-no-check-outer", NULL, NULL);
+          qh SKIPcheckmax= True;
+          break;
+        case '6':
+          qh_option("Q6-no-concave-merge", NULL, NULL);
+          qh SKIPconvex= True;
+          break;
+        case '7':
+          qh_option("Q7-no-breadth-first", NULL, NULL);
+          qh VIRTUALmemory= True;
+          break;
+        case '8':
+          qh_option("Q8-no-near-inside", NULL, NULL);
+          qh NOnearinside= True;
+          break;
+        case '9':
+          qh_option("Q9-pick-furthest", NULL, NULL);
+          qh PICKfurthest= True;
+          break;
+        case 'G':
+          i= qh_strtol(s, &t);
+          if (qh GOODpoint)
+            qh_fprintf(qh ferr, 7018, "qhull warning: good point already defined for option 'QGn'.  Ignored\n");
           else if (s == t)
-	    fprintf (qh ferr, "qhull warning: missing good point id for option 'QGn'.  Ignored\n");
-	  else if (i < 0 || *s == '-') {
- 	    qh GOODpoint= i-1;
-  	    qh_option ("QGood-if-dont-see-point", &i, NULL);
-	  }else {
- 	    qh GOODpoint= i+1;
-  	    qh_option ("QGood-if-see-point", &i, NULL);
-  	  }
- 	  s= t;
-	  break;
-	case 'J':
+            qh_fprintf(qh ferr, 7019, "qhull warning: missing good point id for option 'QGn'.  Ignored\n");
+          else if (i < 0 || *s == '-') {
+            qh GOODpoint= i-1;
+            qh_option("QGood-if-dont-see-point", &i, NULL);
+          }else {
+            qh GOODpoint= i+1;
+            qh_option("QGood-if-see-point", &i, NULL);
+          }
+          s= t;
+          break;
+        case 'J':
           if (!isdigit(*s) && *s != '-')
-   	    qh JOGGLEmax= 0.0;
-	  else {
- 	    qh JOGGLEmax= (realT) qh_strtod (s, &s);
-            qh_option ("QJoggle", NULL, &qh JOGGLEmax);
-	  }
-	  break;
-	case 'R':
+            qh JOGGLEmax= 0.0;
+          else {
+            qh JOGGLEmax= (realT) qh_strtod(s, &s);
+            qh_option("QJoggle", NULL, &qh JOGGLEmax);
+          }
+          break;
+        case 'R':
           if (!isdigit(*s) && *s != '-')
-	    fprintf (qh ferr, "qhull warning: missing random seed for option 'QRn'.  Ignored\n");
-	  else {
- 	    qh ROTATErandom= i= qh_strtol(s, &s);
-   	    if (i > 0)
-   	      qh_option ("QRotate-id", &i, NULL );
-	    else if (i < -1)
-   	      qh_option ("QRandom-seed", &i, NULL );
+            qh_fprintf(qh ferr, 7020, "qhull warning: missing random seed for option 'QRn'.  Ignored\n");
+          else {
+            qh ROTATErandom= i= qh_strtol(s, &s);
+            if (i > 0)
+              qh_option("QRotate-id", &i, NULL );
+            else if (i < -1)
+              qh_option("QRandom-seed", &i, NULL );
           }
-	  break;
-	case 'V':
-	  i= qh_strtol (s, &t);
-	  if (qh GOODvertex)
-	    fprintf (qh ferr, "qhull warning: good vertex already defined for option 'QVn'.  Ignored\n");
+          break;
+        case 'V':
+          i= qh_strtol(s, &t);
+          if (qh GOODvertex)
+            qh_fprintf(qh ferr, 7021, "qhull warning: good vertex already defined for option 'QVn'.  Ignored\n");
           else if (s == t)
-	    fprintf (qh ferr, "qhull warning: no good point id given for option 'QVn'.  Ignored\n");
-	  else if (i < 0) {
- 	    qh GOODvertex= i - 1;
- 	    qh_option ("QV-good-facets-not-point", &i, NULL);
-	  }else {
-  	    qh_option ("QV-good-facets-point", &i, NULL);
-	    qh GOODvertex= i + 1;
+            qh_fprintf(qh ferr, 7022, "qhull warning: no good point id given for option 'QVn'.  Ignored\n");
+          else if (i < 0) {
+            qh GOODvertex= i - 1;
+            qh_option("QV-good-facets-not-point", &i, NULL);
+          }else {
+            qh_option("QV-good-facets-point", &i, NULL);
+            qh GOODvertex= i + 1;
           }
- 	  s= t;
-	  break;
-	default:
-	  s--;
-	  fprintf (qh ferr, "qhull warning: unknown 'Q' qhull option %c, rest ignored\n", (int)s[0]);
-	  while (*++s && !isspace(*s));
-	  break;
-	}
+          s= t;
+          break;
+        default:
+          s--;
+          qh_fprintf(qh ferr, 7023, "qhull warning: unknown 'Q' qhull option %c, rest ignored\n", (int)s[0]);
+          while (*++s && !isspace(*s));
+          break;
+        }
       }
       break;
     case 'T':
       while (*s && !isspace(*s)) {
-	if (isdigit(*s) || *s == '-')
-	  qh IStracing= qh_strtol(s, &s);
-	else switch(*s++) {
-	case 'c':
-          qh_option ("Tcheck-frequently", NULL, NULL);
-	  qh CHECKfrequently= True;
-	  break;
-	case 's':
-          qh_option ("Tstatistics", NULL, NULL);
-	  qh PRINTstatistics= True;
-	  break;
-	case 'v':
-          qh_option ("Tverify", NULL, NULL);
-	  qh VERIFYoutput= True;
-	  break;
-	case 'z':
-	  if (!qh fout)
-	    fprintf (qh ferr, "qhull warning: output file undefined (stdout).  Option 'Tz' ignored.\n");
-	  else {
-	    qh_option ("Tz-stdout", NULL, NULL);
-  	    qh ferr= qh fout;
-  	    qhmem.ferr= qh fout;
-	  }
-	  break;
-	case 'C':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing point id for cone for trace option 'TCn'.  Ignored\n");
-	  else {
-	    i= qh_strtol (s, &s);
-	    qh_option ("TCone-stop", &i, NULL);
-	    qh STOPcone= i + 1;
+        if (isdigit(*s) || *s == '-')
+          qh IStracing= qh_strtol(s, &s);
+        else switch (*s++) {
+        case 'a':
+          qh_option("Tannotate-output", NULL, NULL);
+          qh ANNOTATEoutput= True;
+          break;
+        case 'c':
+          qh_option("Tcheck-frequently", NULL, NULL);
+          qh CHECKfrequently= True;
+          break;
+        case 's':
+          qh_option("Tstatistics", NULL, NULL);
+          qh PRINTstatistics= True;
+          break;
+        case 'v':
+          qh_option("Tverify", NULL, NULL);
+          qh VERIFYoutput= True;
+          break;
+        case 'z':
+          if (qh ferr == qh_FILEstderr) {
+            /* The C++ interface captures the output in qh_fprint_qhull() */
+            qh_option("Tz-stdout", NULL, NULL);
+            qh USEstdout= True;
+          }else if (!qh fout)
+            qh_fprintf(qh ferr, 7024, "qhull warning: output file undefined(stdout).  Option 'Tz' ignored.\n");
+          else {
+            qh_option("Tz-stdout", NULL, NULL);
+            qh USEstdout= True;
+            qh ferr= qh fout;
+            qhmem.ferr= qh fout;
           }
-	  break;
-	case 'F':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing frequency count for trace option 'TFn'.  Ignored\n");
-	  else {
-	    qh REPORTfreq= qh_strtol (s, &s);
-            qh_option ("TFacet-log", &qh REPORTfreq, NULL);
-	    qh REPORTfreq2= qh REPORTfreq/2;  /* for tracemerging() */
-	  }
-	  break;
-	case 'I':
-	  if (s[0] != ' ' || s[1] == '\"' || s[1] == '\'' ||isspace (s[1])) {
-	    s++;
-	    fprintf (qh ferr, "qhull warning: option 'TI' mistyped.\nUse 'TI', one space, file name, and space or end-of-line.\nDo not use quotes.  Option 'FI' ignored.\n");
-	  }else {  /* not a procedure because of qh_option (filename, NULL, NULL); */
-	    char filename[500], *t= filename;
+          break;
+        case 'C':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7025, "qhull warning: missing point id for cone for trace option 'TCn'.  Ignored\n");
+          else {
+            i= qh_strtol(s, &s);
+            qh_option("TCone-stop", &i, NULL);
+            qh STOPcone= i + 1;
+          }
+          break;
+        case 'F':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7026, "qhull warning: missing frequency count for trace option 'TFn'.  Ignored\n");
+          else {
+            qh REPORTfreq= qh_strtol(s, &s);
+            qh_option("TFacet-log", &qh REPORTfreq, NULL);
+            qh REPORTfreq2= qh REPORTfreq/2;  /* for tracemerging() */
+          }
+          break;
+        case 'I':
+          if (!isspace(*s))
+            qh_fprintf(qh ferr, 7027, "qhull warning: missing space between 'TI' and filename, %s\n", s);
+          while (isspace(*s))
+            s++;
+          t= qh_skipfilename(s);
+          {
+            char filename[qh_FILENAMElen];
 
-	    s++;
-	    while (*s) {
-	      if (t - filename >= sizeof (filename)-2) {
-		fprintf (qh ferr, "qhull error: filename for 'TI' too long.\n");
-		qh_errexit (qh_ERRinput, NULL, NULL);
-	      }
-	      if (isspace (*s))
-		break;
-	      *(t++)= *s++;
-	    }
-	    *t= '\0';
-	    if (!freopen (filename, "r", stdin)) {
-	      fprintf (qh ferr, "qhull error: could not open file \"%s\".", filename);
-	      qh_errexit (qh_ERRinput, NULL, NULL);
-	    }else {
-	      qh_option ("TInput-file", NULL, NULL);
-	      qh_option (filename, NULL, NULL);
-	    }
-	  }
-	  break;
-	case 'O':
-	  if (s[0] != ' ' || s[1] == '\"' || isspace (s[1])) {
-	    s++;
-	    fprintf (qh ferr, "qhull warning: option 'TO' mistyped.\nUse 'TO', one space, file name, and space or end-of-line.\nThe file name may be enclosed in single quotes.\nDo not use double quotes.  Option 'FO' ignored.\n");
-	  }else {  /* not a procedure because of qh_option (filename, NULL, NULL); */
-	    char filename[500], *t= filename;
-	    boolT isquote= False;
+            qh_copyfilename(filename, (int)sizeof(filename), s, (int)(t-s));   /* WARN64 */
+            s= t;
+            if (!freopen(filename, "r", stdin)) {
+              qh_fprintf(qh ferr, 6041, "qhull error: could not open file \"%s\".", filename);
+              qh_errexit(qh_ERRinput, NULL, NULL);
+            }else {
+              qh_option("TInput-file", NULL, NULL);
+              qh_option(filename, NULL, NULL);
+            }
+          }
+          break;
+        case 'O':
+            if (!isspace(*s))
+                qh_fprintf(qh ferr, 7028, "qhull warning: missing space between 'TO' and filename, %s\n", s);
+            while (isspace(*s))
+                s++;
+            t= qh_skipfilename(s);
+            {
+              char filename[qh_FILENAMElen];
 
-	    s++;
-	    if (*s == '\'') {
-	      isquote= True;
-	      s++;
-	    }
-	    while (*s) {
-	      if (t - filename >= sizeof (filename)-2) {
-		fprintf (qh ferr, "qhull error: filename for 'TO' too long.\n");
-		qh_errexit (qh_ERRinput, NULL, NULL);
-	      }
-	      if (isquote) {
-		if (*s == '\'') {
-		  s++;
-		  isquote= False;
-		  break;
-		}
-	      }else if (isspace (*s))
-		break;
-	      *(t++)= *s++;
-	    }
-	    *t= '\0';
-	    if (isquote)
-	      fprintf (qh ferr, "qhull error: missing end quote for option 'TO'.  Rest of line ignored.\n");
-	    else if (!freopen (filename, "w", stdout)) {
-	      fprintf (qh ferr, "qhull error: could not open file \"%s\".", filename);
-	      qh_errexit (qh_ERRinput, NULL, NULL);
-	    }else {
-	      qh_option ("TOutput-file", NULL, NULL);
-	      qh_option (filename, NULL, NULL);
-	    }
-	  }
-	  break;
-	case 'P':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing point id for trace option 'TPn'.  Ignored\n");
-	  else {
-	    qh TRACEpoint= qh_strtol (s, &s);
-            qh_option ("Trace-point", &qh TRACEpoint, NULL);
+              qh_copyfilename(filename, (int)sizeof(filename), s, (int)(t-s));  /* WARN64 */
+              s= t;
+              if (!freopen(filename, "w", stdout)) {
+                qh_fprintf(qh ferr, 6044, "qhull error: could not open file \"%s\".", filename);
+                qh_errexit(qh_ERRinput, NULL, NULL);
+              }else {
+                qh_option("TOutput-file", NULL, NULL);
+              qh_option(filename, NULL, NULL);
+            }
           }
-	  break;
-	case 'M':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing merge id for trace option 'TMn'.  Ignored\n");
-	  else {
-	    qh TRACEmerge= qh_strtol (s, &s);
-            qh_option ("Trace-merge", &qh TRACEmerge, NULL);
+          break;
+        case 'P':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7029, "qhull warning: missing point id for trace option 'TPn'.  Ignored\n");
+          else {
+            qh TRACEpoint= qh_strtol(s, &s);
+            qh_option("Trace-point", &qh TRACEpoint, NULL);
           }
-	  break;
-	case 'R':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing rerun count for trace option 'TRn'.  Ignored\n");
-	  else {
-	    qh RERUN= qh_strtol (s, &s);
-            qh_option ("TRerun", &qh RERUN, NULL);
+          break;
+        case 'M':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7030, "qhull warning: missing merge id for trace option 'TMn'.  Ignored\n");
+          else {
+            qh TRACEmerge= qh_strtol(s, &s);
+            qh_option("Trace-merge", &qh TRACEmerge, NULL);
           }
-	  break;
-	case 'V':
-	  i= qh_strtol (s, &t);
-	  if (s == t)
-	    fprintf (qh ferr, "qhull warning: missing furthest point id for trace option 'TVn'.  Ignored\n");
-	  else if (i < 0) {
-	    qh STOPpoint= i - 1;
-            qh_option ("TV-stop-before-point", &i, NULL);
-	  }else {
-	    qh STOPpoint= i + 1;
-            qh_option ("TV-stop-after-point", &i, NULL);
+          break;
+        case 'R':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7031, "qhull warning: missing rerun count for trace option 'TRn'.  Ignored\n");
+          else {
+            qh RERUN= qh_strtol(s, &s);
+            qh_option("TRerun", &qh RERUN, NULL);
           }
+          break;
+        case 'V':
+          i= qh_strtol(s, &t);
+          if (s == t)
+            qh_fprintf(qh ferr, 7032, "qhull warning: missing furthest point id for trace option 'TVn'.  Ignored\n");
+          else if (i < 0) {
+            qh STOPpoint= i - 1;
+            qh_option("TV-stop-before-point", &i, NULL);
+          }else {
+            qh STOPpoint= i + 1;
+            qh_option("TV-stop-after-point", &i, NULL);
+          }
           s= t;
-	  break;
-	case 'W':
-	  if (!isdigit(*s))
-	    fprintf (qh ferr, "qhull warning: missing max width for trace option 'TWn'.  Ignored\n");
-	  else {
- 	    qh TRACEdist= (realT) qh_strtod (s, &s);
-            qh_option ("TWide-trace", NULL, &qh TRACEdist);
+          break;
+        case 'W':
+          if (!isdigit(*s))
+            qh_fprintf(qh ferr, 7033, "qhull warning: missing max width for trace option 'TWn'.  Ignored\n");
+          else {
+            qh TRACEdist= (realT) qh_strtod(s, &s);
+            qh_option("TWide-trace", NULL, &qh TRACEdist);
           }
-	  break;
-	default:
-	  s--;
-	  fprintf (qh ferr, "qhull warning: unknown 'T' trace option %c, rest ignored\n", (int)s[0]);
-	  while (*++s && !isspace(*s));
-	  break;
-	}
+          break;
+        default:
+          s--;
+          qh_fprintf(qh ferr, 7034, "qhull warning: unknown 'T' trace option %c, rest ignored\n", (int)s[0]);
+          while (*++s && !isspace(*s));
+          break;
+        }
       }
       break;
     default:
-      fprintf (qh ferr, "qhull warning: unknown flag %c (%x)\n", (int)s[-1],
-	       (int)s[-1]);
+      qh_fprintf(qh ferr, 7035, "qhull warning: unknown flag %c(%x)\n", (int)s[-1],
+               (int)s[-1]);
       break;
     }
     if (s-1 == prev_s && *s && !isspace(*s)) {
-      fprintf (qh ferr, "qhull warning: missing space after flag %c (%x); reserved for menu. Skipped.\n",
-	       (int)*prev_s, (int)*prev_s);
+      qh_fprintf(qh ferr, 7036, "qhull warning: missing space after flag %c(%x); reserved for menu. Skipped.\n",
+               (int)*prev_s, (int)*prev_s);
       while (*s && !isspace(*s))
-	s++;
+        s++;
     }
   }
+  if (qh STOPcone && qh JOGGLEmax < REALmax/2)
+    qh_fprintf(qh ferr, 7078, "qhull warning: 'TCn' (stopCone) ignored when used with 'QJn' (joggle)\n");
   if (isgeom && !qh FORCEoutput && qh PRINTout[1])
-    fprintf (qh ferr, "qhull warning: additional output formats are not compatible with Geomview\n");
+    qh_fprintf(qh ferr, 7037, "qhull warning: additional output formats are not compatible with Geomview\n");
   /* set derived values in qh_initqhull_globals */
 } /* initflags */
 
@@ -1368,21 +1422,21 @@
   notes:
     must match qh_freebuffers()
 */
-void qh_initqhull_buffers (void) {
+void qh_initqhull_buffers(void) {
   int k;
 
-  qh TEMPsize= (qhmem.LASTsize - sizeof (setT))/SETelemsize;
+  qh TEMPsize= (qhmem.LASTsize - sizeof(setT))/SETelemsize;
   if (qh TEMPsize <= 0 || qh TEMPsize > qhmem.LASTsize)
     qh TEMPsize= 8;  /* e.g., if qh_NOmem */
-  qh other_points= qh_setnew (qh TEMPsize);
-  qh del_vertices= qh_setnew (qh TEMPsize);
-  qh coplanarset= qh_setnew (qh TEMPsize);
+  qh other_points= qh_setnew(qh TEMPsize);
+  qh del_vertices= qh_setnew(qh TEMPsize);
+  qh coplanarfacetset= qh_setnew(qh TEMPsize);
   qh NEARzero= (realT *)qh_memalloc(qh hull_dim * sizeof(realT));
   qh lower_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));
   qh upper_threshold= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));
   qh lower_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));
   qh upper_bound= (realT *)qh_memalloc((qh input_dim+1) * sizeof(realT));
-  for(k= qh input_dim+1; k--; ) {
+  for (k=qh input_dim+1; k--; ) {  /* duplicated in qh_initqhull_buffers and qh_clear_ouputflags */
     qh lower_threshold[k]= -REALmax;
     qh upper_threshold[k]= REALmax;
     qh lower_bound[k]= -REALmax;
@@ -1417,21 +1471,19 @@
     initialize points array from input arguments
     test for qh.ZEROcentrum
       (i.e., use opposite vertex instead of cetrum for convexity testing)
-    test for qh.PRINTgood (i.e., only print 'good' facets)
     initialize qh.CENTERtype, qh.normal_size,
       qh.center_size, qh.TRACEpoint/level,
     initialize and test random numbers
-    check for conflicting print output options
+    qh_initqhull_outputflags() -- adjust and test output flags
 */
-void qh_initqhull_globals (coordT *points, int numpoints, int dim, boolT ismalloc) {
+void qh_initqhull_globals(coordT *points, int numpoints, int dim, boolT ismalloc) {
   int seed, pointsneeded, extra= 0, i, randi, k;
-  boolT printgeom= False, printmath= False, printcoplanar= False;
   realT randr;
   realT factorial;
 
   time_t timedata;
 
-  trace0((qh ferr, "qh_initqhull_globals: for %s | %s\n", qh rbox_command,
+  trace0((qh ferr, 13, "qh_initqhull_globals: for %s | %s\n", qh rbox_command,
       qh qhull_command));
   qh POINTSmalloc= ismalloc;
   qh first_point= points;
@@ -1441,12 +1493,12 @@
     qh MERGING= True;
     if (qh hull_dim <= 4) {
       qh PREmerge= True;
-      qh_option ("_pre-merge", NULL, NULL);
+      qh_option("_pre-merge", NULL, NULL);
     }else {
       qh MERGEexact= True;
-      qh_option ("Qxact_merge", NULL, NULL);
+      qh_option("Qxact_merge", NULL, NULL);
     }
-  }else if (qh MERGEexact) 
+  }else if (qh MERGEexact)
     qh MERGING= True;
   if (!qh NOpremerge && qh JOGGLEmax > REALmax/2) {
 #ifdef qh_NOmerge
@@ -1454,91 +1506,85 @@
 #endif
   }
   if (qh TRIangulate && qh JOGGLEmax < REALmax/2 && qh PRINTprecision)
-    fprintf(qh ferr, "qhull warning: joggle ('QJ') always produces simplicial output.  Triangulated output ('Qt') does nothing.\n");
+    qh_fprintf(qh ferr, 7038, "qhull warning: joggle('QJ') always produces simplicial output.  Triangulated output('Qt') does nothing.\n");
   if (qh JOGGLEmax < REALmax/2 && qh DELAUNAY && !qh SCALEinput && !qh SCALElast) {
     qh SCALElast= True;
-    qh_option ("Qbbound-last-qj", NULL, NULL);
+    qh_option("Qbbound-last-qj", NULL, NULL);
   }
   if (qh MERGING && !qh POSTmerge && qh premerge_cos > REALmax/2
   && qh premerge_centrum == 0) {
     qh ZEROcentrum= True;
     qh ZEROall_ok= True;
-    qh_option ("_zero-centrum", NULL, NULL);
+    qh_option("_zero-centrum", NULL, NULL);
   }
   if (qh JOGGLEmax < REALmax/2 && REALepsilon > 2e-8 && qh PRINTprecision)
-    fprintf(qh ferr, "qhull warning: real epsilon, %2.2g, is probably too large for joggle ('QJn')\nRecompile with double precision reals (see user.h).\n",
+    qh_fprintf(qh ferr, 7039, "qhull warning: real epsilon, %2.2g, is probably too large for joggle('QJn')\nRecompile with double precision reals(see user.h).\n",
           REALepsilon);
 #ifdef qh_NOmerge
   if (qh MERGING) {
-    fprintf (qh ferr, "qhull input error: merging not installed (qh_NOmerge + 'Qx', 'Cn' or 'An')\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6045, "qhull input error: merging not installed(qh_NOmerge + 'Qx', 'Cn' or 'An')\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
 #endif
-  if (!(qh PRINTgood || qh PRINTneighbors)) {
-    if (qh KEEParea || qh KEEPminArea < REALmax/2 || qh KEEPmerge || qh DELAUNAY
-	|| (!qh ONLYgood && (qh GOODvertex || qh GOODpoint))) {
-      qh PRINTgood= True;
-      qh_option ("Pgood", NULL, NULL);
-    }
-  }
   if (qh DELAUNAY && qh KEEPcoplanar && !qh KEEPinside) {
     qh KEEPinside= True;
-    qh_option ("Qinterior-keep", NULL, NULL);
+    qh_option("Qinterior-keep", NULL, NULL);
   }
   if (qh DELAUNAY && qh HALFspace) {
-    fprintf (qh ferr, "qhull input error: can not use Delaunay ('d') or Voronoi ('v') with halfspace intersection ('H')\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6046, "qhull input error: can not use Delaunay('d') or Voronoi('v') with halfspace intersection('H')\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (!qh DELAUNAY && (qh UPPERdelaunay || qh ATinfinity)) {
-    fprintf (qh ferr, "qhull input error: use upper-Delaunay ('Qu') or infinity-point ('Qz') with Delaunay ('d') or Voronoi ('v')\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6047, "qhull input error: use upper-Delaunay('Qu') or infinity-point('Qz') with Delaunay('d') or Voronoi('v')\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (qh UPPERdelaunay && qh ATinfinity) {
-    fprintf (qh ferr, "qhull input error: can not use infinity-point ('Qz') with upper-Delaunay ('Qu')\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6048, "qhull input error: can not use infinity-point('Qz') with upper-Delaunay('Qu')\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (qh SCALElast && !qh DELAUNAY && qh PRINTprecision)
-    fprintf (qh ferr, "qhull input warning: option 'Qbb' (scale-last-coordinate) is normally used with 'd' or 'v'\n");
+    qh_fprintf(qh ferr, 7040, "qhull input warning: option 'Qbb' (scale-last-coordinate) is normally used with 'd' or 'v'\n");
   qh DOcheckmax= (!qh SKIPcheckmax && qh MERGING );
-  qh KEEPnearinside= (qh DOcheckmax && !(qh KEEPinside && qh KEEPcoplanar) 
+  qh KEEPnearinside= (qh DOcheckmax && !(qh KEEPinside && qh KEEPcoplanar)
                           && !qh NOnearinside);
   if (qh MERGING)
     qh CENTERtype= qh_AScentrum;
   else if (qh VORONOI)
     qh CENTERtype= qh_ASvoronoi;
   if (qh TESTvneighbors && !qh MERGING) {
-    fprintf(qh ferr, "qhull input error: test vertex neighbors ('Qv') needs a merge option\n");
-    qh_errexit (qh_ERRinput, NULL ,NULL);
+    qh_fprintf(qh ferr, 6049, "qhull input error: test vertex neighbors('Qv') needs a merge option\n");
+    qh_errexit(qh_ERRinput, NULL ,NULL);
   }
   if (qh PROJECTinput || (qh DELAUNAY && qh PROJECTdelaunay)) {
     qh hull_dim -= qh PROJECTinput;
     if (qh DELAUNAY) {
       qh hull_dim++;
-      extra= 1;
+      if (qh ATinfinity)
+        extra= 1;
     }
   }
   if (qh hull_dim <= 1) {
-    fprintf(qh ferr, "qhull error: dimension %d must be > 1\n", qh hull_dim);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6050, "qhull error: dimension %d must be > 1\n", qh hull_dim);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
-  for (k= 2, factorial=1.0; k < qh hull_dim; k++)
+  for (k=2, factorial=1.0; k < qh hull_dim; k++)
     factorial *= k;
   qh AREAfactor= 1.0 / factorial;
-  trace2((qh ferr, "qh_initqhull_globals: initialize globals.  dim %d numpoints %d malloc? %d projected %d to hull_dim %d\n",
-	dim, numpoints, ismalloc, qh PROJECTinput, qh hull_dim));
+  trace2((qh ferr, 2005, "qh_initqhull_globals: initialize globals.  dim %d numpoints %d malloc? %d projected %d to hull_dim %d\n",
+        dim, numpoints, ismalloc, qh PROJECTinput, qh hull_dim));
   qh normal_size= qh hull_dim * sizeof(coordT);
   qh center_size= qh normal_size - sizeof(coordT);
   pointsneeded= qh hull_dim+1;
   if (qh hull_dim > qh_DIMmergeVertex) {
     qh MERGEvertices= False;
-    qh_option ("Q3-no-merge-vertices-dim-high", NULL, NULL);
+    qh_option("Q3-no-merge-vertices-dim-high", NULL, NULL);
   }
   if (qh GOODpoint)
     pointsneeded++;
 #ifdef qh_NOtrace
   if (qh IStracing) {
-    fprintf (qh ferr, "qhull input error: tracing is not installed (qh_NOtrace in user.h)");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6051, "qhull input error: tracing is not installed(qh_NOtrace in user.h)");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
 #endif
   if (qh RERUN > 1) {
@@ -1550,12 +1596,12 @@
     qh IStracing= 0;
   }
   if (qh ROTATErandom == 0 || qh ROTATErandom == -1) {
-    seed= time (&timedata);
+    seed= (int)time(&timedata);
     if (qh ROTATErandom  == -1) {
       seed= -seed;
-      qh_option ("QRandom-seed", &seed, NULL );
+      qh_option("QRandom-seed", &seed, NULL );
     }else
-      qh_option ("QRotate-random", &seed, NULL);
+      qh_option("QRotate-random", &seed, NULL);
     qh ROTATErandom= seed;
   }
   seed= qh ROTATErandom;
@@ -1565,47 +1611,118 @@
     seed= -seed;
   qh_RANDOMseed_(seed);
   randr= 0.0;
-  for (i= 1000; i--; ) {
+  for (i=1000; i--; ) {
     randi= qh_RANDOMint;
     randr += randi;
     if (randi > qh_RANDOMmax) {
-      fprintf (qh ferr, "\
+      qh_fprintf(qh ferr, 8036, "\
 qhull configuration error (qh_RANDOMmax in user.h):\n\
-   random integer %d > qh_RANDOMmax (%.8g)\n",
-	       randi, qh_RANDOMmax);
-      qh_errexit (qh_ERRinput, NULL, NULL);
+   random integer %d > qh_RANDOMmax(%.8g)\n",
+               randi, qh_RANDOMmax);
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
   }
   qh_RANDOMseed_(seed);
   randr = randr/1000;
-  if (randr < qh_RANDOMmax/10
-  || randr > qh_RANDOMmax * 5)
-    fprintf (qh ferr, "\
+  if (randr < qh_RANDOMmax * 0.1
+  || randr > qh_RANDOMmax * 0.9)
+    qh_fprintf(qh ferr, 8037, "\
 qhull configuration warning (qh_RANDOMmax in user.h):\n\
    average of 1000 random integers (%.2g) is much different than expected (%.2g).\n\
    Is qh_RANDOMmax (%.2g) wrong?\n",
-	     randr, qh_RANDOMmax/2.0, qh_RANDOMmax);
+             randr, qh_RANDOMmax * 0.5, qh_RANDOMmax);
   qh RANDOMa= 2.0 * qh RANDOMfactor/qh_RANDOMmax;
   qh RANDOMb= 1.0 - qh RANDOMfactor;
   if (qh_HASHfactor < 1.1) {
-    fprintf(qh ferr, "qhull internal error (qh_initqhull_globals): qh_HASHfactor %d must be at least 1.1.  Qhull uses linear hash probing\n",
+    qh_fprintf(qh ferr, 6052, "qhull internal error (qh_initqhull_globals): qh_HASHfactor %d must be at least 1.1.  Qhull uses linear hash probing\n",
       qh_HASHfactor);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   if (numpoints+extra < pointsneeded) {
-    fprintf(qh ferr,"qhull input error: not enough points (%d) to construct initial simplex (need %d)\n",
-	    numpoints, pointsneeded);
+    qh_fprintf(qh ferr, 6214, "qhull input error: not enough points(%d) to construct initial simplex(need %d)\n",
+            numpoints, pointsneeded);
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
+  qh_initqhull_outputflags();
+} /* initqhull_globals */
+
+/*---------------------------------
+
+  qh_initqhull_mem(  )
+    initialize mem.c for qhull
+    qh.hull_dim and qh.normal_size determine some of the allocation sizes
+    if qh.MERGING,
+      includes ridgeT
+    calls qh_user_memsizes() to add up to 10 additional sizes for quick allocation
+      (see numsizes below)
+
+  returns:
+    mem.c already for qh_memalloc/qh_memfree (errors if called beforehand)
+
+  notes:
+    qh_produceoutput() prints memsizes
+
+*/
+void qh_initqhull_mem(void) {
+  int numsizes;
+  int i;
+
+  numsizes= 8+10;
+  qh_meminitbuffers(qh IStracing, qh_MEMalign, numsizes,
+                     qh_MEMbufsize,qh_MEMinitbuf);
+  qh_memsize((int)sizeof(vertexT));
+  if (qh MERGING) {
+    qh_memsize((int)sizeof(ridgeT));
+    qh_memsize((int)sizeof(mergeT));
+  }
+  qh_memsize((int)sizeof(facetT));
+  i= sizeof(setT) + (qh hull_dim - 1) * SETelemsize;  /* ridge.vertices */
+  qh_memsize(i);
+  qh_memsize(qh normal_size);        /* normal */
+  i += SETelemsize;                 /* facet.vertices, .ridges, .neighbors */
+  qh_memsize(i);
+  qh_user_memsizes();
+  qh_memsetup();
+} /* initqhull_mem */
+
+/*---------------------------------
+
+  qh_initqhull_outputflags
+    initialize flags concerned with output
+
+  returns:
+    adjust user flags as needed
+
+  see:
+    qh_clear_outputflags() resets the flags
+
+  design:
+    test for qh.PRINTgood (i.e., only print 'good' facets)
+    check for conflicting print output options
+*/
+void qh_initqhull_outputflags(void) {
+  boolT printgeom= False, printmath= False, printcoplanar= False;
+  int i;
+
+  trace3((qh ferr, 3024, "qh_initqhull_outputflags: %s\n", qh qhull_command));
+  if (!(qh PRINTgood || qh PRINTneighbors)) {
+    if (qh KEEParea || qh KEEPminArea < REALmax/2 || qh KEEPmerge || qh DELAUNAY
+        || (!qh ONLYgood && (qh GOODvertex || qh GOODpoint))) {
+      qh PRINTgood= True;
+      qh_option("Pgood", NULL, NULL);
+    }
+  }
   if (qh PRINTtransparent) {
     if (qh hull_dim != 4 || !qh DELAUNAY || qh VORONOI || qh DROPdim >= 0) {
-      fprintf(qh ferr,"qhull input error: transparent Delaunay ('Gt') needs 3-d Delaunay ('d') w/o 'GDn'\n");
+      qh_fprintf(qh ferr, 6215, "qhull input error: transparent Delaunay('Gt') needs 3-d Delaunay('d') w/o 'GDn'\n");
       qh_errexit(qh_ERRinput, NULL, NULL);
     }
     qh DROPdim = 3;
     qh PRINTridges = True;
   }
-  for (i= qh_PRINTEND; i--; ) {
+  for (i=qh_PRINTEND; i--; ) {
     if (qh PRINTout[i] == qh_PRINTgeom)
       printgeom= True;
     else if (qh PRINTout[i] == qh_PRINTmathematica || qh PRINTout[i] == qh_PRINTmaple)
@@ -1615,135 +1732,120 @@
     else if (qh PRINTout[i] == qh_PRINTpointnearest)
       printcoplanar= True;
     else if (qh PRINTout[i] == qh_PRINTpointintersect && !qh HALFspace) {
-      fprintf (qh ferr, "qhull input error: option 'Fp' is only used for \nhalfspace intersection ('Hn,n,n').\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6053, "qhull input error: option 'Fp' is only used for \nhalfspace intersection('Hn,n,n').\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }else if (qh PRINTout[i] == qh_PRINTtriangles && (qh HALFspace || qh VORONOI)) {
-      fprintf (qh ferr, "qhull input error: option 'Ft' is not available for Voronoi vertices or halfspace intersection\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6054, "qhull input error: option 'Ft' is not available for Voronoi vertices or halfspace intersection\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }else if (qh PRINTout[i] == qh_PRINTcentrums && qh VORONOI) {
-      fprintf (qh ferr, "qhull input error: option 'FC' is not available for Voronoi vertices ('v')\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6055, "qhull input error: option 'FC' is not available for Voronoi vertices('v')\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }else if (qh PRINTout[i] == qh_PRINTvertices) {
       if (qh VORONOI)
-        qh_option ("Fvoronoi", NULL, NULL);
-      else 
-        qh_option ("Fvertices", NULL, NULL);
+        qh_option("Fvoronoi", NULL, NULL);
+      else
+        qh_option("Fvertices", NULL, NULL);
     }
   }
   if (printcoplanar && qh DELAUNAY && qh JOGGLEmax < REALmax/2) {
-    if (qh PRINTprecision) 
-      fprintf (qh ferr, "qhull input warning: 'QJ' (joggle) will usually prevent coincident input sites for options 'Fc' and 'FP'\n");
+    if (qh PRINTprecision)
+      qh_fprintf(qh ferr, 7041, "qhull input warning: 'QJ' (joggle) will usually prevent coincident input sites for options 'Fc' and 'FP'\n");
   }
-  if (!qh KEEPcoplanar && !qh KEEPinside && !qh ONLYgood) {
-    if ((qh PRINTcoplanar && qh PRINTspheres) || printcoplanar) {
-      qh KEEPcoplanar = True;
-      qh_option ("Qcoplanar", NULL, NULL);
-    }
-  }
   if (printmath && (qh hull_dim > 3 || qh VORONOI)) {
-    fprintf (qh ferr, "qhull input error: Mathematica and Maple output is only available for 2-d and 3-d convex hulls and 2-d Delaunay triangulations\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6056, "qhull input error: Mathematica and Maple output is only available for 2-d and 3-d convex hulls and 2-d Delaunay triangulations\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (printgeom) {
     if (qh hull_dim > 4) {
-      fprintf (qh ferr, "qhull input error: Geomview output is only available for 2-d, 3-d and 4-d\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6057, "qhull input error: Geomview output is only available for 2-d, 3-d and 4-d\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     if (qh PRINTnoplanes && !(qh PRINTcoplanar + qh PRINTcentrums
      + qh PRINTdots + qh PRINTspheres + qh DOintersections + qh PRINTridges)) {
-      fprintf (qh ferr, "qhull input error: no output specified for Geomview\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6058, "qhull input error: no output specified for Geomview\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     if (qh VORONOI && (qh hull_dim > 3 || qh DROPdim >= 0)) {
-      fprintf (qh ferr, "qhull input error: Geomview output for Voronoi diagrams only for 2-d\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6059, "qhull input error: Geomview output for Voronoi diagrams only for 2-d\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     /* can not warn about furthest-site Geomview output: no lower_threshold */
     if (qh hull_dim == 4 && qh DROPdim == -1 &&
-	(qh PRINTcoplanar || qh PRINTspheres || qh PRINTcentrums)) {
-      fprintf (qh ferr, "qhull input warning: coplanars, vertices, and centrums output not\n\
-available for 4-d output (ignored).  Could use 'GDn' instead.\n");
+        (qh PRINTcoplanar || qh PRINTspheres || qh PRINTcentrums)) {
+      qh_fprintf(qh ferr, 7042, "qhull input warning: coplanars, vertices, and centrums output not\n\
+available for 4-d output(ignored).  Could use 'GDn' instead.\n");
       qh PRINTcoplanar= qh PRINTspheres= qh PRINTcentrums= False;
     }
   }
+  if (!qh KEEPcoplanar && !qh KEEPinside && !qh ONLYgood) {
+    if ((qh PRINTcoplanar && qh PRINTspheres) || printcoplanar) {
+      if (qh QHULLfinished) {
+        qh_fprintf(qh ferr, 7072, "qhull output warning: ignoring coplanar points, option 'Qc' was not set for the first run of qhull.\n");
+      }else {
+        qh KEEPcoplanar = True;
+        qh_option("Qcoplanar", NULL, NULL);
+      }
+    }
+  }
   qh PRINTdim= qh hull_dim;
   if (qh DROPdim >=0) {    /* after Geomview checks */
     if (qh DROPdim < qh hull_dim) {
       qh PRINTdim--;
       if (!printgeom || qh hull_dim < 3)
-        fprintf (qh ferr, "qhull input warning: drop dimension 'GD%d' is only available for 3-d/4-d Geomview\n", qh DROPdim);
+        qh_fprintf(qh ferr, 7043, "qhull input warning: drop dimension 'GD%d' is only available for 3-d/4-d Geomview\n", qh DROPdim);
     }else
       qh DROPdim= -1;
   }else if (qh VORONOI) {
     qh DROPdim= qh hull_dim-1;
     qh PRINTdim= qh hull_dim-1;
   }
-} /* initqhull_globals */
- 
+} /* qh_initqhull_outputflags */
+
 /*---------------------------------
+  >--------------------------------
 
-  qh_initqhull_mem(  )
-    initialize mem.c for qhull
-    qh.hull_dim and qh.normal_size determine some of the allocation sizes
-    if qh.MERGING,
-      includes ridgeT
-    calls qh_user_memsizes() to add up to 10 additional sizes for quick allocation
-      (see numsizes below)
-
-  returns:
-    mem.c already for qh_memalloc/qh_memfree (errors if called beforehand)
-
-  notes:
-    qh_produceoutput() prints memsizes
-
+  qh_initqhull_start( infile, outfile, errfile )
+    allocate memory if needed and call qh_initqhull_start2()
 */
-void qh_initqhull_mem (void) {
-  int numsizes;
-  int i;
+void qh_initqhull_start(FILE *infile, FILE *outfile, FILE *errfile) {
 
-  numsizes= 8+10;
-  qh_meminitbuffers (qh IStracing, qh_MEMalign, numsizes,
-                     qh_MEMbufsize,qh_MEMinitbuf);
-  qh_memsize(sizeof(vertexT));
-  if (qh MERGING) {
-    qh_memsize(sizeof(ridgeT));
-    qh_memsize(sizeof(mergeT));
+#if qh_QHpointer
+  if (qh_qh) {
+    qh_fprintf(errfile, 6205, "qhull error (qh_initqhull_start): qh_qh already defined.  Call qh_save_qhull() first\n");
+    qh_exit(qh_ERRqhull);  /* no error handler */
   }
-  qh_memsize(sizeof(facetT));
-  i= sizeof(setT) + (qh hull_dim - 1) * SETelemsize;  /* ridge.vertices */
-  qh_memsize(i);
-  qh_memsize(qh normal_size);        /* normal */
-  i += SETelemsize;                 /* facet.vertices, .ridges, .neighbors */
-  qh_memsize(i);
-  qh_user_memsizes();
-  qh_memsetup();
-} /* initqhull_mem */
+  if (!(qh_qh= (qhT *)qh_malloc(sizeof(qhT)))) {
+    qh_fprintf(errfile, 6060, "qhull error (qh_initqhull_start): insufficient memory\n");
+    qh_exit(qh_ERRmem);  /* no error handler */
+  }
+#endif
+  qh_initstatistics();
+  qh_initqhull_start2(infile, outfile, errfile);
+} /* initqhull_start */
 
 /*---------------------------------
+  >--------------------------------
 
-  qh_initqhull_start( infile, outfile, errfile )
+  qh_initqhull_start2( infile, outfile, errfile )
     start initialization of qhull
     initialize statistics, stdio, default values for global variables
-
+    assumes qh_qh is defined
+  notes:
+    report errors elsewhere, error handling and g_qhull_output [Qhull.cpp, QhullQh()] not in initialized
   see:
     qh_maxmin() determines the precision constants
+    qh_freeqhull2()
 */
-void qh_initqhull_start (FILE *infile, FILE *outfile, FILE *errfile) {
+void qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile) {
+  time_t timedata;
+  int seed;
 
-  qh_CPUclock; /* start the clock */
+  qh_CPUclock; /* start the clock(for qh_clock).  One-shot. */
 #if qh_QHpointer
-  if (!(qh_qh= (qhT *)malloc (sizeof(qhT)))) {
-    fprintf (errfile, "qhull error (qh_initqhull_globals): insufficient memory\n");
-    exit (qh_ERRmem);  /* no error handler */
-  }
   memset((char *)qh_qh, 0, sizeof(qhT));   /* every field is 0, FALSE, NULL */
 #else
   memset((char *)&qh_qh, 0, sizeof(qhT));
 #endif
-  strcat (qh qhull, "qhull");
-  qh_initstatistics();
   qh ANGLEmerge= True;
   qh DROPdim= -1;
   qh ferr= errfile;
@@ -1780,8 +1882,12 @@
   qh TRACEpoint= -1; /* recompile or use 'TPn' */
   qh tracefacet_id= UINT_MAX;  /* recompile to trace a facet */
   qh tracevertex_id= UINT_MAX; /* recompile to trace a vertex */
-  qh_RANDOMseed_(1);
-} /* initqhull_start */
+  seed= (int)time(&timedata);
+  qh_RANDOMseed_(seed);
+  qh run_id= qh_RANDOMint+1; /* disallow 0 [UsingLibQhull::NOqhRunId] */
+  qh_option("run-id", &qh run_id, NULL);
+  strcat(qh qhull, "qhull");
+} /* initqhull_start2 */
 
 /*---------------------------------
@@ -1805,8 +1911,8 @@
 */
 void qh_initthresholds(char *command) {
   realT value;
-  int index, maxdim, k;
-  char *s= command;
+  int idx, maxdim, k;
+  char *s= command; /* non-const due to strtol */
   char key;
 
   maxdim= qh input_dim;
@@ -1818,78 +1924,78 @@
     if (*s == 'P') {
       s++;
       while (*s && !isspace(key= *s++)) {
-	if (key == 'd' || key == 'D') {
-	  if (!isdigit(*s)) {
-	    fprintf(qh ferr, "qhull warning: no dimension given for Print option '%c' at: %s.  Ignored\n",
-		    key, s-1);
-	    continue;
-	  }
-	  index= qh_strtol (s, &s);
-	  if (index >= qh hull_dim) {
-	    fprintf(qh ferr, "qhull warning: dimension %d for Print option '%c' is >= %d.  Ignored\n",
-	        index, key, qh hull_dim);
-	    continue;
-	  }
-	  if (*s == ':') {
-	    s++;
-	    value= qh_strtod(s, &s);
-	    if (fabs((double)value) > 1.0) {
-	      fprintf(qh ferr, "qhull warning: value %2.4g for Print option %c is > +1 or < -1.  Ignored\n",
-	              value, key);
-	      continue;
-	    }
-	  }else
-	    value= 0.0;
-	  if (key == 'd')
-	    qh lower_threshold[index]= value;
-	  else
-	    qh upper_threshold[index]= value;
-	}
+        if (key == 'd' || key == 'D') {
+          if (!isdigit(*s)) {
+            qh_fprintf(qh ferr, 7044, "qhull warning: no dimension given for Print option '%c' at: %s.  Ignored\n",
+                    key, s-1);
+            continue;
+          }
+          idx= qh_strtol(s, &s);
+          if (idx >= qh hull_dim) {
+            qh_fprintf(qh ferr, 7045, "qhull warning: dimension %d for Print option '%c' is >= %d.  Ignored\n",
+                idx, key, qh hull_dim);
+            continue;
+          }
+          if (*s == ':') {
+            s++;
+            value= qh_strtod(s, &s);
+            if (fabs((double)value) > 1.0) {
+              qh_fprintf(qh ferr, 7046, "qhull warning: value %2.4g for Print option %c is > +1 or < -1.  Ignored\n",
+                      value, key);
+              continue;
+            }
+          }else
+            value= 0.0;
+          if (key == 'd')
+            qh lower_threshold[idx]= value;
+          else
+            qh upper_threshold[idx]= value;
+        }
       }
     }else if (*s == 'Q') {
       s++;
       while (*s && !isspace(key= *s++)) {
-	if (key == 'b' && *s == 'B') {
-	  s++;
-	  for (k=maxdim; k--; ) {
-	    qh lower_bound[k]= -qh_DEFAULTbox;
-	    qh upper_bound[k]= qh_DEFAULTbox;
-	  }
-	}else if (key == 'b' && *s == 'b')
-	  s++;
-	else if (key == 'b' || key == 'B') {
-	  if (!isdigit(*s)) {
-	    fprintf(qh ferr, "qhull warning: no dimension given for Qhull option %c.  Ignored\n",
-		    key);
-	    continue;
-	  }
-	  index= qh_strtol (s, &s);
-	  if (index >= maxdim) {
-	    fprintf(qh ferr, "qhull warning: dimension %d for Qhull option %c is >= %d.  Ignored\n",
-	        index, key, maxdim);
-	    continue;
-	  }
-	  if (*s == ':') {
-	    s++;
-	    value= qh_strtod(s, &s);
-	  }else if (key == 'b')
-	    value= -qh_DEFAULTbox;
-	  else
-	    value= qh_DEFAULTbox;
-	  if (key == 'b')
-	    qh lower_bound[index]= value;
-	  else
-	    qh upper_bound[index]= value;
-	}
+        if (key == 'b' && *s == 'B') {
+          s++;
+          for (k=maxdim; k--; ) {
+            qh lower_bound[k]= -qh_DEFAULTbox;
+            qh upper_bound[k]= qh_DEFAULTbox;
+          }
+        }else if (key == 'b' && *s == 'b')
+          s++;
+        else if (key == 'b' || key == 'B') {
+          if (!isdigit(*s)) {
+            qh_fprintf(qh ferr, 7047, "qhull warning: no dimension given for Qhull option %c.  Ignored\n",
+                    key);
+            continue;
+          }
+          idx= qh_strtol(s, &s);
+          if (idx >= maxdim) {
+            qh_fprintf(qh ferr, 7048, "qhull warning: dimension %d for Qhull option %c is >= %d.  Ignored\n",
+                idx, key, maxdim);
+            continue;
+          }
+          if (*s == ':') {
+            s++;
+            value= qh_strtod(s, &s);
+          }else if (key == 'b')
+            value= -qh_DEFAULTbox;
+          else
+            value= qh_DEFAULTbox;
+          if (key == 'b')
+            qh lower_bound[idx]= value;
+          else
+            qh upper_bound[idx]= value;
+        }
       }
     }else {
-      while (*s && !isspace (*s))
+      while (*s && !isspace(*s))
         s++;
     }
-    while (isspace (*s))
+    while (isspace(*s))
       s++;
   }
-  for (k= qh hull_dim; k--; ) {
+  for (k=qh hull_dim; k--; ) {
     if (qh lower_threshold[k] > -REALmax/2) {
       qh GOODthreshold= True;
       if (qh upper_threshold[k] < REALmax/2) {
@@ -1909,27 +2015,28 @@
     add an option description to qh.qhull_options
 
   notes:
+    NOerrors -- qh_option can not call qh_errexit() [qh_initqhull_start2]
     will be printed with statistics ('Ts') and errors
     strlen(option) < 40
 */
-void qh_option (char *option, int *i, realT *r) {
+void qh_option(const char *option, int *i, realT *r) {
   char buf[200];
   int len, maxlen;
 
-  sprintf (buf, "  %s", option);
+  sprintf(buf, "  %s", option);
   if (i)
-    sprintf (buf+strlen(buf), " %d", *i);
+    sprintf(buf+strlen(buf), " %d", *i);
   if (r)
-    sprintf (buf+strlen(buf), " %2.2g", *r);
-  len= strlen(buf);
+    sprintf(buf+strlen(buf), " %2.2g", *r);
+  len= (int)strlen(buf);  /* WARN64 */
   qh qhull_optionlen += len;
-  maxlen= sizeof (qh qhull_options) - len -1;
+  maxlen= sizeof(qh qhull_options) - len -1;
   maximize_(maxlen, 0);
-  if (qh qhull_optionlen >= 80 && maxlen > 0) {
+  if (qh qhull_optionlen >= qh_OPTIONline && maxlen > 0) {
     qh qhull_optionlen= len;
-    strncat (qh qhull_options, "\n", maxlen--);
+    strncat(qh qhull_options, "\n", (size_t)(maxlen--));
   }
-  strncat (qh qhull_options, buf, maxlen);
+  strncat(qh qhull_options, buf, (size_t)maxlen);
 } /* option */
 
 #if qh_QHpointer
@@ -1939,7 +2046,7 @@
   qh_restore_qhull( oldqh )
     restores a previously saved qhull
     also restores qh_qhstat and qhmem.tempstack
-
+    Sets *oldqh to NULL
   notes:
     errors if current qhull hasn't been saved or freed
     uses qhmem for error reporting
@@ -1949,29 +2056,31 @@
     is complicated.  The procedures will be redesigned.
 
   see:
-    qh_save_qhull()
+    qh_save_qhull(), UsingLibQhull
 */
-void qh_restore_qhull (qhT **oldqh) {
+void qh_restore_qhull(qhT **oldqh) {
 
-  if (*oldqh && strcmp ((*oldqh)->qhull, "qhull")) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_restore_qhull): %p is not a qhull data structure\n",
+  if (*oldqh && strcmp((*oldqh)->qhull, "qhull")) {
+    qh_fprintf(qhmem.ferr, 6061, "qhull internal error (qh_restore_qhull): %p is not a qhull data structure\n",
                   *oldqh);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   if (qh_qh) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_restore_qhull): did not save or free existing qhull\n");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6062, "qhull internal error (qh_restore_qhull): did not save or free existing qhull\n");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   if (!*oldqh || !(*oldqh)->old_qhstat) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_restore_qhull): did not previously save qhull %p\n",
+    qh_fprintf(qhmem.ferr, 6063, "qhull internal error (qh_restore_qhull): did not previously save qhull %p\n",
                   *oldqh);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   qh_qh= *oldqh;
   *oldqh= NULL;
   qh_qhstat= qh old_qhstat;
   qhmem.tempstack= qh old_tempstack;
-  trace1((qh ferr, "qh_restore_qhull: restored qhull from %p\n", *oldqh));
+  qh old_qhstat= 0;
+  qh old_tempstack= 0;
+  trace1((qh ferr, 1007, "qh_restore_qhull: restored qhull from %p\n", *oldqh));
 } /* restore_qhull */
 
 /*---------------------------------
-
-  qh_strtol( s, endp) qh_strtod( s, endp)
-    internal versions of strtol() and strtod()
-    does not skip trailing spaces
-  notes:
-    some implementations of strtol()/strtod() skip trailing spaces
-*/
-double qh_strtod (const char *s, char **endp) {
-  double result;
-
-  result= strtod (s, endp);
-  if (s < (*endp) && (*endp)[-1] == ' ')
-    (*endp)--;
-  return result;
-} /* strtod */
-
-int qh_strtol (const char *s, char **endp) {
-  int result;
-
-  result= (int) strtol (s, endp, 10);
-  if (s< (*endp) && (*endp)[-1] == ' ')
-    (*endp)--;
-  return result;
-} /* strtol */

Modified: trunk/scipy/spatial/qhull/src/io.c
===================================================================
--- trunk/scipy/spatial/qhull/src/io.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/io.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,7 +1,7 @@
 /*
  ---------------------------------
 
-   io.c 
+   io.c
    Input/Output routines of qhull application
 
    see qh-io.htm and io.h
@@ -13,7 +13,9 @@
    unix.c and user.c are the only callers of io.c functions
    This allows the user to avoid loading io.o from qhull.a
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/io.c#38 $$Change: 1179 $
+   $DateTime: 2010/01/12 19:53:15 $$Author: bbarber $
 */
 
 #include "qhull_a.h"
@@ -22,9 +24,11 @@
 
 /*---------------------------------
-  
+
   qh_produce_output()
+  qh_produce_output2()
     prints out the result of qhull in desired format
+    qh_produce_output2() does not call qh_prepare_output()
     if qh.GETarea
       computes and prints area and volume
     qh.PRINTout[] is an array of output formats
@@ -33,66 +37,63 @@
     prints output in qh.PRINTout order
 */
 void qh_produce_output(void) {
-  int i, tempsize= qh_setsize ((setT*)qhmem.tempstack), d_1;
+    int tempsize= qh_setsize(qhmem.tempstack);
 
-  if (qh VORONOI) {
-    qh_clearcenters (qh_ASvoronoi);
-    qh_vertexneighbors();
-  }
-  if (qh TRIangulate) {
-    qh_triangulate(); 
-    if (qh VERIFYoutput && !qh CHECKfrequently) 
-      qh_checkpolygon (qh facet_list);
-  }
-  qh_findgood_all (qh facet_list); 
-  if (qh GETarea)
-    qh_getarea(qh facet_list);
-  if (qh KEEParea || qh KEEPmerge || qh KEEPminArea < REALmax/2)
-    qh_markkeep (qh facet_list);
+    qh_prepare_output();
+    qh_produce_output2();
+    if (qh_setsize(qhmem.tempstack) != tempsize) {
+        qh_fprintf(qh ferr, 6206, "qhull internal error (qh_produce_output): temporary sets not empty(%d)\n",
+            qh_setsize(qhmem.tempstack));
+        qh_errexit(qh_ERRqhull, NULL, NULL);
+    }
+} /* produce_output */
+
+
+void qh_produce_output2(void) {
+  int i, tempsize= qh_setsize(qhmem.tempstack), d_1;
+
   if (qh PRINTsummary)
     qh_printsummary(qh ferr);
   else if (qh PRINTout[0] == qh_PRINTnone)
     qh_printsummary(qh fout);
-  for (i= 0; i < qh_PRINTEND; i++)
-    qh_printfacets (qh fout, qh PRINTout[i], qh facet_list, NULL, !qh_ALL);
+  for (i=0; i < qh_PRINTEND; i++)
+    qh_printfacets(qh fout, qh PRINTout[i], qh facet_list, NULL, !qh_ALL);
   qh_allstatistics();
   if (qh PRINTprecision && !qh MERGING && (qh JOGGLEmax > REALmax/2 || qh RERUN))
-    qh_printstats (qh ferr, qhstat precision, NULL);
-  if (qh VERIFYoutput && (zzval_(Zridge) > 0 || zzval_(Zridgemid) > 0)) 
-    qh_printstats (qh ferr, qhstat vridges, NULL);
+    qh_printstats(qh ferr, qhstat precision, NULL);
+  if (qh VERIFYoutput && (zzval_(Zridge) > 0 || zzval_(Zridgemid) > 0))
+    qh_printstats(qh ferr, qhstat vridges, NULL);
   if (qh PRINTstatistics) {
-    qh_collectstatistics();
     qh_printstatistics(qh ferr, "");
-    qh_memstatistics (qh ferr);
+    qh_memstatistics(qh ferr);
     d_1= sizeof(setT) + (qh hull_dim - 1) * SETelemsize;
-    fprintf(qh ferr, "\
+    qh_fprintf(qh ferr, 8040, "\
     size in bytes: merge %d ridge %d vertex %d facet %d\n\
          normal %d ridge vertices %d facet vertices or neighbors %d\n",
-	    sizeof(mergeT), sizeof(ridgeT),
-	    sizeof(vertexT), sizeof(facetT),
-	    qh normal_size, d_1, d_1 + SETelemsize);
+            (int)sizeof(mergeT), (int)sizeof(ridgeT),
+            (int)sizeof(vertexT), (int)sizeof(facetT),
+            qh normal_size, d_1, d_1 + SETelemsize);
   }
-  if (qh_setsize ((setT*)qhmem.tempstack) != tempsize) {
-    fprintf (qh ferr, "qhull internal error (qh_produce_output): temporary sets not empty (%d)\n",
-	     qh_setsize ((setT*)qhmem.tempstack));
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+  if (qh_setsize(qhmem.tempstack) != tempsize) {
+    qh_fprintf(qh ferr, 6065, "qhull internal error (qh_produce_output2): temporary sets not empty(%d)\n",
+             qh_setsize(qhmem.tempstack));
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
-} /* produce_output */
+} /* produce_output2 */
 
-
 /*---------------------------------
-  
+
   dfacet( id )
     print facet by id, for debugging
 
 */
-void dfacet (unsigned id) {
+void dfacet(unsigned id) {
   facetT *facet;
 
   FORALLfacets {
     if (facet->id == id) {
-      qh_printfacet (qh fout, facet);
+      qh_printfacet(qh fout, facet);
       break;
     }
   }
@@ -101,16 +102,16 @@
 
 /*---------------------------------
-  
+
   dvertex( id )
     print vertex by id, for debugging
 */
-void dvertex (unsigned id) {
+void dvertex(unsigned id) {
   vertexT *vertex;
 
   FORALLvertices {
     if (vertex->id == id) {
-      qh_printvertex (qh fout, vertex);
+      qh_printvertex(qh fout, vertex);
       break;
     }
   }
@@ -119,29 +120,29 @@
 
 /*---------------------------------
-  
+
   qh_compare_vertexpoint( p1, p2 )
-    used by qsort() to order vertices by point id 
+    used by qsort() to order vertices by point id
 */
 int qh_compare_vertexpoint(const void *p1, const void *p2) {
-  vertexT *a= *((vertexT **)p1), *b= *((vertexT **)p2);
- 
-  return ((qh_pointid(a->point) > qh_pointid(b->point)?1:-1));
+  const vertexT *a= *((vertexT *const*)p1), *b= *((vertexT *const*)p2);
+
+  return((qh_pointid(a->point) > qh_pointid(b->point)?1:-1));
 } /* compare_vertexpoint */
 
 /*---------------------------------
-  
+
   qh_compare_facetarea( p1, p2 )
     used by qsort() to order facets by area
 */
 int qh_compare_facetarea(const void *p1, const void *p2) {
-  facetT *a= *((facetT **)p1), *b= *((facetT **)p2);
+  const facetT *a= *((facetT *const*)p1), *b= *((facetT *const*)p2);
 
   if (!a->isarea)
     return -1;
   if (!b->isarea)
-    return 1; 
+    return 1;
   if (a->f.area > b->f.area)
     return 1;
   else if (a->f.area == b->f.area)
@@ -151,37 +152,70 @@
 
 /*---------------------------------
-  
+
   qh_compare_facetmerge( p1, p2 )
     used by qsort() to order facets by number of merges
 */
 int qh_compare_facetmerge(const void *p1, const void *p2) {
-  facetT *a= *((facetT **)p1), *b= *((facetT **)p2);
- 
-  return (a->nummerge - b->nummerge);
+  const facetT *a= *((facetT *const*)p1), *b= *((facetT *const*)p2);
+
+  return(a->nummerge - b->nummerge);
 } /* compare_facetvisit */
 
 /*---------------------------------
-  
+
   qh_compare_facetvisit( p1, p2 )
     used by qsort() to order facets by visit id or id
 */
 int qh_compare_facetvisit(const void *p1, const void *p2) {
-  facetT *a= *((facetT **)p1), *b= *((facetT **)p2);
+  const facetT *a= *((facetT *const*)p1), *b= *((facetT *const*)p2);
   int i,j;
 
   if (!(i= a->visitid))
-    i= - a->id; /* do not convert to int */
+    i= 0 - a->id; /* do not convert to int, sign distinguishes id from visitid */
   if (!(j= b->visitid))
-    j= - b->id;
-  return (i - j);
+    j= 0 - b->id;
+  return(i - j);
 } /* compare_facetvisit */
 
 /*---------------------------------
+
+  qh_copyfilename( dest, size, source, length )
+    copy filename identified by qh_skipfilename()
+
+  notes:
+    see qh_skipfilename() for syntax
+*/
+void qh_copyfilename(char *filename, int size, const char* source, int length) {
+  char c= *source;
+
+  if (length > size + 1) {
+      qh_fprintf(qh ferr, 6040, "qhull error: filename is more than %d characters, %s\n",  size-1, source);
+      qh_errexit(qh_ERRinput, NULL, NULL);
+  }
+  strncpy(filename, source, length);
+  filename[length]= '\0';
+  if (c == '\'' || c == '"') {
+    char *s= filename + 1;
+    char *t= filename;
+    while (*s) {
+      if (*s == c) {
+          if (s[-1] == '\\')
+              t[-1]= c;
+      }else
+          *t++= *s;
+      s++;
+    }
+    *t= '\0';
+  }
+} /* copyfilename */
+
+/*---------------------------------
-  
-  qh_countfacets( facetlist, facets, printall, 
+
+  qh_countfacets( facetlist, facets, printall,
           numfacets, numsimplicial, totneighbors, numridges, numcoplanar, numtricoplanars  )
     count good facets for printing and set visitid
     if allfacets, ignores qh_skipfacet()
@@ -193,10 +227,10 @@
     numfacets, numsimplicial, total neighbors, numridges, coplanars
     each facet with ->visitid indicating 1-relative position
       ->visitid==0 indicates not good
-  
+
   notes
     numfacets >= numsimplicial
-    if qh.NEWfacets, 
+    if qh.NEWfacets,
       does not count visible facets (matches qh_printafacet)
 
   design:
@@ -205,7 +239,7 @@
         mark facet->visitid
         update counts
 */
-void qh_countfacets (facetT *facetlist, setT *facets, boolT printall,
+void qh_countfacets(facetT *facetlist, setT *facets, boolT printall,
     int *numfacetsp, int *numsimplicialp, int *totneighborsp, int *numridgesp, int *numcoplanarsp, int *numtricoplanarsp) {
   facetT *facet, **facetp;
   int numfacets= 0, numsimplicial= 0, numridges= 0, totneighbors= 0, numcoplanars= 0, numtricoplanars= 0;
@@ -216,32 +250,33 @@
       facet->visitid= 0;
     else {
       facet->visitid= ++numfacets;
-      totneighbors += qh_setsize (facet->neighbors);
+      totneighbors += qh_setsize(facet->neighbors);
       if (facet->simplicial) {
         numsimplicial++;
-	if (facet->keepcentrum && facet->tricoplanar)
-	  numtricoplanars++;
+        if (facet->keepcentrum && facet->tricoplanar)
+          numtricoplanars++;
       }else
-        numridges += qh_setsize (facet->ridges);
+        numridges += qh_setsize(facet->ridges);
       if (facet->coplanarset)
-        numcoplanars += qh_setsize (facet->coplanarset);
+        numcoplanars += qh_setsize(facet->coplanarset);
     }
   }
+
   FOREACHfacet_(facets) {
     if ((facet->visible && qh NEWfacets)
     || (!printall && qh_skipfacet(facet)))
       facet->visitid= 0;
     else {
       facet->visitid= ++numfacets;
-      totneighbors += qh_setsize (facet->neighbors);
+      totneighbors += qh_setsize(facet->neighbors);
       if (facet->simplicial){
         numsimplicial++;
-	if (facet->keepcentrum && facet->tricoplanar)
-	  numtricoplanars++;
+        if (facet->keepcentrum && facet->tricoplanar)
+          numtricoplanars++;
       }else
-        numridges += qh_setsize (facet->ridges);
+        numridges += qh_setsize(facet->ridges);
       if (facet->coplanarset)
-        numcoplanars += qh_setsize (facet->coplanarset);
+        numcoplanars += qh_setsize(facet->coplanarset);
     }
   }
   qh visit_id += numfacets+1;
@@ -255,15 +290,15 @@
 
 /*---------------------------------
-  
+
   qh_detvnorm( vertex, vertexA, centers, offset )
     compute separating plane of the Voronoi diagram for a pair of input sites
     centers= set of facets (i.e., Voronoi vertices)
       facet->visitid= 0 iff vertex-at-infinity (i.e., unbounded)
-        
+
   assumes:
     qh_ASvoronoi and qh_vertexneighbors() already set
-  
+
   returns:
     norm
       a pointer into qh.gm_matrix to qh.hull_dim-1 reals
@@ -273,13 +308,13 @@
         sign adjusted so that qh.GOODvertexp is inside
       else
         sign adjusted so that vertex is inside
-      
+
     qh.gm_matrix= simplex of points from centers relative to first center
-    
+
   notes:
     in io.c so that code for 'v Tv' can be removed by removing io.c
     returns pointer into qh.gm_matrix to avoid tracking of temporary memory
-  
+
   design:
     determine midpoint of input sites
     build points as the set of Voronoi vertices
@@ -294,13 +329,13 @@
       test that Voronoi vertices not in the simplex are still on the hyperplane
     free up temporary memory
 */
-pointT *qh_detvnorm (vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp) {
+pointT *qh_detvnorm(vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp) {
   facetT *facet, **facetp;
   int  i, k, pointid, pointidA, point_i, point_n;
   setT *simplex= NULL;
   pointT *point, **pointp, *point0, *midpoint, *normal, *inpoint;
   coordT *coord, *gmcoord, *normalp;
-  setT *points= qh_settemp (qh TEMPsize);
+  setT *points= qh_settemp(qh TEMPsize);
   boolT nearzero= False;
   boolT unbounded= False;
   int numcenters= 0;
@@ -308,7 +343,7 @@
   realT dist, offset, angle, zero= 0.0;
 
   midpoint= qh gm_matrix + qh hull_dim * qh hull_dim;  /* last row */
-  for (k= 0; k < dim; k++)
+  for (k=0; k < dim; k++)
     midpoint[k]= (vertex->point[k] + vertexA->point[k])/2;
   FOREACHfacet_(centers) {
     numcenters++;
@@ -316,81 +351,81 @@
       unbounded= True;
     else {
       if (!facet->center)
-        facet->center= qh_facetcenter (facet->vertices);
-      qh_setappend (&points, facet->center);
+        facet->center= qh_facetcenter(facet->vertices);
+      qh_setappend(&points, facet->center);
     }
   }
   if (numcenters > dim) {
-    simplex= qh_settemp (qh TEMPsize);
-    qh_setappend (&simplex, vertex->point);
+    simplex= qh_settemp(qh TEMPsize);
+    qh_setappend(&simplex, vertex->point);
     if (unbounded)
-      qh_setappend (&simplex, midpoint);
-    qh_maxsimplex (dim, points, NULL, 0, &simplex);
-    qh_setdelnth (simplex, 0);
+      qh_setappend(&simplex, midpoint);
+    qh_maxsimplex(dim, points, NULL, 0, &simplex);
+    qh_setdelnth(simplex, 0);
   }else if (numcenters == dim) {
     if (unbounded)
-      qh_setappend (&points, midpoint);
-    simplex= points; 
+      qh_setappend(&points, midpoint);
+    simplex= points;
   }else {
-    fprintf(qh ferr, "qh_detvnorm: too few points (%d) to compute separating plane\n", numcenters);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6216, "qhull internal error (qh_detvnorm): too few points(%d) to compute separating plane\n", numcenters);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   i= 0;
   gmcoord= qh gm_matrix;
   point0= SETfirstt_(simplex, pointT);
   FOREACHpoint_(simplex) {
     if (qh IStracing >= 4)
-      qh_printmatrix(qh ferr, "qh_detvnorm: Voronoi vertex or midpoint", 
+      qh_printmatrix(qh ferr, "qh_detvnorm: Voronoi vertex or midpoint",
                               &point, 1, dim);
     if (point != point0) {
       qh gm_row[i++]= gmcoord;
       coord= point0;
-      for (k= dim; k--; )
+      for (k=dim; k--; )
         *(gmcoord++)= *point++ - *coord++;
     }
   }
   qh gm_row[i]= gmcoord;  /* does not overlap midpoint, may be used later for qh_areasimplex */
   normal= gmcoord;
-  qh_sethyperplane_gauss (dim, qh gm_row, point0, True,
-           	normal, &offset, &nearzero);
+  qh_sethyperplane_gauss(dim, qh gm_row, point0, True,
+                normal, &offset, &nearzero);
   if (qh GOODvertexp == vertexA->point)
     inpoint= vertexA->point;
   else
     inpoint= vertex->point;
   zinc_(Zdistio);
-  dist= qh_distnorm (dim, inpoint, normal, &offset);
+  dist= qh_distnorm(dim, inpoint, normal, &offset);
   if (dist > 0) {
     offset= -offset;
     normalp= normal;
-    for (k= dim; k--; ) {
+    for (k=dim; k--; ) {
       *normalp= -(*normalp);
       normalp++;
     }
   }
   if (qh VERIFYoutput || qh PRINTstatistics) {
-    pointid= qh_pointid (vertex->point);
-    pointidA= qh_pointid (vertexA->point);
+    pointid= qh_pointid(vertex->point);
+    pointidA= qh_pointid(vertexA->point);
     if (!unbounded) {
       zinc_(Zdiststat);
-      dist= qh_distnorm (dim, midpoint, normal, &offset);
+      dist= qh_distnorm(dim, midpoint, normal, &offset);
       if (dist < 0)
         dist= -dist;
       zzinc_(Zridgemid);
       wwmax_(Wridgemidmax, dist);
       wwadd_(Wridgemid, dist);
-      trace4((qh ferr, "qh_detvnorm: points %d %d midpoint dist %2.2g\n",
+      trace4((qh ferr, 4014, "qh_detvnorm: points %d %d midpoint dist %2.2g\n",
                  pointid, pointidA, dist));
-      for (k= 0; k < dim; k++) 
+      for (k=0; k < dim; k++)
         midpoint[k]= vertexA->point[k] - vertex->point[k];  /* overwrites midpoint! */
-      qh_normalize (midpoint, dim, False);
-      angle= qh_distnorm (dim, midpoint, normal, &zero); /* qh_detangle uses dim+1 */
+      qh_normalize(midpoint, dim, False);
+      angle= qh_distnorm(dim, midpoint, normal, &zero); /* qh_detangle uses dim+1 */
       if (angle < 0.0)
-	angle= angle + 1.0;
+        angle= angle + 1.0;
       else
-	angle= angle - 1.0;
+        angle= angle - 1.0;
       if (angle < 0.0)
-	angle -= angle;
-      trace4((qh ferr, "qh_detvnorm: points %d %d angle %2.2g nearzero %d\n",
+        angle -= angle;
+      trace4((qh ferr, 4015, "qh_detvnorm: points %d %d angle %2.2g nearzero %d\n",
                  pointid, pointidA, angle, nearzero));
       if (nearzero) {
         zzinc_(Zridge0);
@@ -404,16 +439,16 @@
     }
     if (simplex != points) {
       FOREACHpoint_i_(points) {
-        if (!qh_setin (simplex, point)) {
+        if (!qh_setin(simplex, point)) {
           facet= SETelemt_(centers, point_i, facetT);
-	  zinc_(Zdiststat);
-  	  dist= qh_distnorm (dim, point, normal, &offset);
+          zinc_(Zdiststat);
+          dist= qh_distnorm(dim, point, normal, &offset);
           if (dist < 0)
             dist= -dist;
-	  zzinc_(Zridge);
+          zzinc_(Zridge);
           wwmax_(Wridgemax, dist);
           wwadd_(Wridge, dist);
-          trace4((qh ferr, "qh_detvnorm: points %d %d Voronoi vertex %d dist %2.2g\n",
+          trace4((qh ferr, 4016, "qh_detvnorm: points %d %d Voronoi vertex %d dist %2.2g\n",
                              pointid, pointidA, facet->visitid, dist));
         }
       }
@@ -421,8 +456,8 @@
   }
   *offsetp= offset;
   if (simplex != points)
-    qh_settempfree (&simplex);
-  qh_settempfree (&points);
+    qh_settempfree(&simplex);
+  qh_settempfree(&points);
   return normal;
 } /* detvnorm */
 
@@ -437,28 +472,28 @@
     temporary set of centers (facets, i.e., Voronoi vertices)
     sorted by center id
 */
-setT *qh_detvridge (vertexT *vertex) {
-  setT *centers= qh_settemp (qh TEMPsize);
-  setT *tricenters= qh_settemp (qh TEMPsize);
+setT *qh_detvridge(vertexT *vertex) {
+  setT *centers= qh_settemp(qh TEMPsize);
+  setT *tricenters= qh_settemp(qh TEMPsize);
   facetT *neighbor, **neighborp;
   boolT firstinf= True;
-  
+
   FOREACHneighbor_(vertex) {
     if (neighbor->seen) {
       if (neighbor->visitid) {
-	if (!neighbor->tricoplanar || qh_setunique (&tricenters, neighbor->center)) 
-	  qh_setappend (¢ers, neighbor);
+        if (!neighbor->tricoplanar || qh_setunique(&tricenters, neighbor->center))
+          qh_setappend(¢ers, neighbor);
       }else if (firstinf) {
         firstinf= False;
-        qh_setappend (¢ers, neighbor);
+        qh_setappend(¢ers, neighbor);
       }
     }
   }
-  qsort (SETaddr_(centers, facetT), qh_setsize (centers),
-             sizeof (facetT *), qh_compare_facetvisit);
-  qh_settempfree (&tricenters);
+  qsort(SETaddr_(centers, facetT), (size_t)qh_setsize(centers),
+             sizeof(facetT *), qh_compare_facetvisit);
+  qh_settempfree(&tricenters);
   return centers;
-} /* detvridge */      
+} /* detvridge */
 
 /*---------------------------------
@@ -470,7 +505,7 @@
 
   returns:
     temporary set of centers (facets, i.e., Voronoi vertices)
-    listed in adjacency order (not oriented)
+    listed in adjacency order (!oriented)
     all facet->seen2= True
 
   design:
@@ -480,11 +515,11 @@
         add neighbor to set of Voronoi vertices
 */
 setT *qh_detvridge3 (vertexT *atvertex, vertexT *vertex) {
-  setT *centers= qh_settemp (qh TEMPsize);
-  setT *tricenters= qh_settemp (qh TEMPsize);
+  setT *centers= qh_settemp(qh TEMPsize);
+  setT *tricenters= qh_settemp(qh TEMPsize);
   facetT *neighbor, **neighborp, *facet= NULL;
   boolT firstinf= True;
-  
+
   FOREACHneighbor_(atvertex)
     neighbor->seen2= False;
   FOREACHneighbor_(vertex) {
@@ -493,23 +528,23 @@
       break;
     }
   }
-  while (facet) { 
+  while (facet) {
     facet->seen2= True;
     if (neighbor->seen) {
       if (facet->visitid) {
-	if (!facet->tricoplanar || qh_setunique (&tricenters, facet->center)) 
-	  qh_setappend (¢ers, facet);
+        if (!facet->tricoplanar || qh_setunique(&tricenters, facet->center))
+          qh_setappend(¢ers, facet);
       }else if (firstinf) {
         firstinf= False;
-        qh_setappend (¢ers, facet);
+        qh_setappend(¢ers, facet);
       }
     }
     FOREACHneighbor_(facet) {
       if (!neighbor->seen2) {
-	if (qh_setin (vertex->neighbors, neighbor))
+        if (qh_setin(vertex->neighbors, neighbor))
           break;
-	else
-	  neighbor->seen2= True;
+        else
+          neighbor->seen2= True;
       }
     }
     facet= neighbor;
@@ -517,21 +552,21 @@
   if (qh CHECKfrequently) {
     FOREACHneighbor_(vertex) {
       if (!neighbor->seen2) {
-	fprintf (stderr, "qh_detvridge3: neigbors of vertex p%d are not connected at facet %d\n",
-	         qh_pointid (vertex->point), neighbor->id);
-	qh_errexit (qh_ERRqhull, neighbor, NULL);
+          qh_fprintf(qh ferr, 6217, "qhull internal error (qh_detvridge3): neighbors of vertex p%d are not connected at facet %d\n",
+                 qh_pointid(vertex->point), neighbor->id);
+        qh_errexit(qh_ERRqhull, neighbor, NULL);
       }
     }
   }
-  FOREACHneighbor_(atvertex) 
+  FOREACHneighbor_(atvertex)
     neighbor->seen2= True;
-  qh_settempfree (&tricenters);
+  qh_settempfree(&tricenters);
   return centers;
-} /* detvridge3 */      
+} /* detvridge3 */
 
 /*---------------------------------
-  
+
   qh_eachvoronoi( fp, printvridge, vertex, visitall, innerouter, inorder )
     if visitall,
       visit all Voronoi ridges for vertex (i.e., an input site)
@@ -542,19 +577,19 @@
       all facet->seen= False
       all facet->seen2= True (for qh_detvridge3)
       all facet->visitid == 0 if vertex_at_infinity
-                         == index of Voronoi vertex 
+                         == index of Voronoi vertex
                          >= qh.num_facets if ignored
     innerouter:
-      qh_RIDGEall--  both inner (bounded) and outer (unbounded) ridges
+      qh_RIDGEall--  both inner (bounded) and outer(unbounded) ridges
       qh_RIDGEinner- only inner
       qh_RIDGEouter- only outer
-      
+
     if inorder
       orders vertices for 3-d Voronoi diagrams
-  
+
   returns:
     number of visited ridges (does not include previously visited ridges)
-    
+
     if printvridge,
       calls printvridge( fp, vertex, vertexA, centers)
         fp== any pointer (assumes FILE*)
@@ -564,26 +599,26 @@
                  ordered for 3-d Voronoi diagram
   notes:
     uses qh.vertex_visit
-  
+
   see:
     qh_eachvoronoi_all()
-  
+
   design:
     mark selected neighbors of atvertex
     for each selected neighbor (either Voronoi vertex or vertex-at-infinity)
-      for each unvisited vertex 
+      for each unvisited vertex
         if atvertex and vertex share more than d-1 neighbors
           bump totalcount
           if printvridge defined
             build the set of shared neighbors (i.e., Voronoi vertices)
             call printvridge
 */
-int qh_eachvoronoi (FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder) {
+int qh_eachvoronoi(FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder) {
   boolT unbounded;
   int count;
   facetT *neighbor, **neighborp, *neighborA, **neighborAp;
   setT *centers;
-  setT *tricenters= qh_settemp (qh TEMPsize);
+  setT *tricenters= qh_settemp(qh TEMPsize);
 
   vertexT *vertex, **vertexp;
   boolT firstinf;
@@ -593,31 +628,31 @@
   qh vertex_visit++;
   atvertex->seen= True;
   if (visitall) {
-    FORALLvertices 
+    FORALLvertices
       vertex->seen= False;
   }
   FOREACHneighbor_(atvertex) {
-    if (neighbor->visitid < numfacets) 
+    if (neighbor->visitid < numfacets)
       neighbor->seen= True;
   }
   FOREACHneighbor_(atvertex) {
     if (neighbor->seen) {
       FOREACHvertex_(neighbor->vertices) {
         if (vertex->visitid != qh vertex_visit && !vertex->seen) {
-	  vertex->visitid= qh vertex_visit;
+          vertex->visitid= qh vertex_visit;
           count= 0;
           firstinf= True;
-	  qh_settruncate (tricenters, 0);
+          qh_settruncate(tricenters, 0);
           FOREACHneighborA_(vertex) {
             if (neighborA->seen) {
-	      if (neighborA->visitid) {
-		if (!neighborA->tricoplanar || qh_setunique (&tricenters, neighborA->center))
-		  count++;
+              if (neighborA->visitid) {
+                if (!neighborA->tricoplanar || qh_setunique(&tricenters, neighborA->center))
+                  count++;
               }else if (firstinf) {
                 count++;
                 firstinf= False;
-	      }
-	    }
+              }
+            }
           }
           if (count >= qh hull_dim - 1) {  /* e.g., 3 for 3-d Voronoi */
             if (firstinf) {
@@ -630,63 +665,63 @@
               unbounded= True;
             }
             totridges++;
-            trace4((qh ferr, "qh_eachvoronoi: Voronoi ridge of %d vertices between sites %d and %d\n",
-                  count, qh_pointid (atvertex->point), qh_pointid (vertex->point)));
-            if (printvridge) { 
-	      if (inorder && qh hull_dim == 3+1) /* 3-d Voronoi diagram */
+            trace4((qh ferr, 4017, "qh_eachvoronoi: Voronoi ridge of %d vertices between sites %d and %d\n",
+                  count, qh_pointid(atvertex->point), qh_pointid(vertex->point)));
+            if (printvridge && fp) {
+              if (inorder && qh hull_dim == 3+1) /* 3-d Voronoi diagram */
                 centers= qh_detvridge3 (atvertex, vertex);
-	      else
-                centers= qh_detvridge (vertex);
+              else
+                centers= qh_detvridge(vertex);
               (*printvridge) (fp, atvertex, vertex, centers, unbounded);
-              qh_settempfree (¢ers);
+              qh_settempfree(¢ers);
             }
           }
         }
       }
     }
   }
-  FOREACHneighbor_(atvertex) 
+  FOREACHneighbor_(atvertex)
     neighbor->seen= False;
-  qh_settempfree (&tricenters);
+  qh_settempfree(&tricenters);
   return totridges;
 } /* eachvoronoi */
-  
 
+
 /*---------------------------------
-  
-  qh_eachvoronoi_all( fp, printvridge, isupper, innerouter, inorder )
+
+  qh_eachvoronoi_all( fp, printvridge, isUpper, innerouter, inorder )
     visit all Voronoi ridges
-    
+
     innerouter:
       see qh_eachvoronoi()
-      
+
     if inorder
       orders vertices for 3-d Voronoi diagrams
-    
+
   returns
-    total number of ridges 
+    total number of ridges
 
-    if isupper == facet->upperdelaunay  (i.e., a Vornoi vertex)
-      facet->visitid= Voronoi vertex index (same as 'o' format)
-    else 
+    if isUpper == facet->upperdelaunay  (i.e., a Vornoi vertex)
+      facet->visitid= Voronoi vertex index(same as 'o' format)
+    else
       facet->visitid= 0
 
     if printvridge,
       calls printvridge( fp, vertex, vertexA, centers)
       [see qh_eachvoronoi]
-      
+
   notes:
     Not used for qhull.exe
     same effect as qh_printvdiagram but ridges not sorted by point id
 */
-int qh_eachvoronoi_all (FILE *fp, printvridgeT printvridge, boolT isupper, qh_RIDGE innerouter, boolT inorder) {
+int qh_eachvoronoi_all(FILE *fp, printvridgeT printvridge, boolT isUpper, qh_RIDGE innerouter, boolT inorder) {
   facetT *facet;
   vertexT *vertex;
   int numcenters= 1;  /* vertex 0 is vertex-at-infinity */
   int totridges= 0;
 
-  qh_clearcenters (qh_ASvoronoi);
+  qh_clearcenters(qh_ASvoronoi);
   qh_vertexneighbors();
   maximize_(qh visit_id, (unsigned) qh num_facets);
   FORALLfacets {
@@ -695,23 +730,23 @@
     facet->seen2= True;
   }
   FORALLfacets {
-    if (facet->upperdelaunay == isupper)
+    if (facet->upperdelaunay == isUpper)
       facet->visitid= numcenters++;
   }
-  FORALLvertices 
+  FORALLvertices
     vertex->seen= False;
   FORALLvertices {
     if (qh GOODvertex > 0 && qh_pointid(vertex->point)+1 != qh GOODvertex)
       continue;
-    totridges += qh_eachvoronoi (fp, printvridge, vertex, 
+    totridges += qh_eachvoronoi(fp, printvridge, vertex,
                    !qh_ALL, innerouter, inorder);
   }
   return totridges;
 } /* eachvoronoi_all */
-      
+
 /*---------------------------------
-  
+
   qh_facet2point( facet, point0, point1, mindist )
     return two projected temporary vertices for a 2-d facet
     may be non-simplicial
@@ -723,7 +758,7 @@
 void qh_facet2point(facetT *facet, pointT **point0, pointT **point1, realT *mindist) {
   vertexT *vertex0, *vertex1;
   realT dist;
-  
+
   if (facet->toporient ^ qh_ORIENTclock) {
     vertex0= SETfirstt_(facet->vertices, vertexT);
     vertex1= SETsecondt_(facet->vertices, vertexT);
@@ -736,21 +771,21 @@
   *mindist= dist;
   *point0= qh_projectpoint(vertex0->point, facet, dist);
   qh_distplane(vertex1->point, facet, &dist);
-  minimize_(*mindist, dist);		
+  minimize_(*mindist, dist);
   *point1= qh_projectpoint(vertex1->point, facet, dist);
 } /* facet2point */
 
 
 /*---------------------------------
-  
+
   qh_facetvertices( facetlist, facets, allfacets )
     returns temporary set of vertices in a set and/or list of facets
     if allfacets, ignores qh_skipfacet()
 
   returns:
     vertices with qh.vertex_visit
-    
+
   notes:
     optimized for allfacets of facet_list
 
@@ -761,38 +796,38 @@
       for each selected facet in facets or facetlist
         append unvisited vertices to vertex set
 */
-setT *qh_facetvertices (facetT *facetlist, setT *facets, boolT allfacets) {
+setT *qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets) {
   setT *vertices;
   facetT *facet, **facetp;
   vertexT *vertex, **vertexp;
 
   qh vertex_visit++;
   if (facetlist == qh facet_list && allfacets && !facets) {
-    vertices= qh_settemp (qh num_vertices);
+    vertices= qh_settemp(qh num_vertices);
     FORALLvertices {
-      vertex->visitid= qh vertex_visit; 
-      qh_setappend (&vertices, vertex);
+      vertex->visitid= qh vertex_visit;
+      qh_setappend(&vertices, vertex);
     }
   }else {
-    vertices= qh_settemp (qh TEMPsize);
+    vertices= qh_settemp(qh TEMPsize);
     FORALLfacet_(facetlist) {
-      if (!allfacets && qh_skipfacet (facet))
+      if (!allfacets && qh_skipfacet(facet))
         continue;
       FOREACHvertex_(facet->vertices) {
         if (vertex->visitid != qh vertex_visit) {
           vertex->visitid= qh vertex_visit;
-          qh_setappend (&vertices, vertex);
+          qh_setappend(&vertices, vertex);
         }
       }
     }
   }
   FOREACHfacet_(facets) {
-    if (!allfacets && qh_skipfacet (facet))
+    if (!allfacets && qh_skipfacet(facet))
       continue;
     FOREACHvertex_(facet->vertices) {
       if (vertex->visitid != qh vertex_visit) {
         vertex->visitid= qh vertex_visit;
-        qh_setappend (&vertices, vertex);
+        qh_setappend(&vertices, vertex);
       }
     }
   }
@@ -801,39 +836,39 @@
 
 /*---------------------------------
-  
+
   qh_geomplanes( facet, outerplane, innerplane )
-    return outer and inner planes for Geomview 
+    return outer and inner planes for Geomview
     qh.PRINTradius is size of vertices and points (includes qh.JOGGLEmax)
 
   notes:
     assume precise calculations in io.c with roundoff covered by qh_GEOMepsilon
 */
-void qh_geomplanes (facetT *facet, realT *outerplane, realT *innerplane) {
+void qh_geomplanes(facetT *facet, realT *outerplane, realT *innerplane) {
   realT radius;
 
   if (qh MERGING || qh JOGGLEmax < REALmax/2) {
-    qh_outerinner (facet, outerplane, innerplane);
+    qh_outerinner(facet, outerplane, innerplane);
     radius= qh PRINTradius;
     if (qh JOGGLEmax < REALmax/2)
-      radius -= qh JOGGLEmax * sqrt (qh hull_dim);  /* already accounted for in qh_outerinner() */
+      radius -= qh JOGGLEmax * sqrt((realT)qh hull_dim);  /* already accounted for in qh_outerinner() */
     *outerplane += radius;
     *innerplane -= radius;
     if (qh PRINTcoplanar || qh PRINTspheres) {
       *outerplane += qh MAXabs_coord * qh_GEOMepsilon;
       *innerplane -= qh MAXabs_coord * qh_GEOMepsilon;
     }
-  }else 
+  }else
     *innerplane= *outerplane= 0;
 } /* geomplanes */
 
 
 /*---------------------------------
-  
+
   qh_markkeep( facetlist )
     mark good facets that meet qh.KEEParea, qh.KEEPmerge, and qh.KEEPminArea
-    ignores visible facets (not part of convex hull)
+    ignores visible facets (!part of convex hull)
 
   returns:
     may clear facet->good
@@ -849,23 +884,23 @@
       clear facet->good for all but n most merged facets
     if qh.KEEPminarea
       clear facet->good if area too small
-    update qh.num_good    
+    update qh.num_good
 */
-void qh_markkeep (facetT *facetlist) {
+void qh_markkeep(facetT *facetlist) {
   facetT *facet, **facetp;
-  setT *facets= qh_settemp (qh num_facets);
+  setT *facets= qh_settemp(qh num_facets);
   int size, count;
 
-  trace2((qh ferr, "qh_markkeep: only keep %d largest and/or %d most merged facets and/or min area %.2g\n",
+  trace2((qh ferr, 2006, "qh_markkeep: only keep %d largest and/or %d most merged facets and/or min area %.2g\n",
           qh KEEParea, qh KEEPmerge, qh KEEPminArea));
   FORALLfacet_(facetlist) {
     if (!facet->visible && facet->good)
-      qh_setappend (&facets, facet);
+      qh_setappend(&facets, facet);
   }
-  size= qh_setsize (facets);
+  size= qh_setsize(facets);
   if (qh KEEParea) {
-    qsort (SETaddr_(facets, facetT), size,
-             sizeof (facetT *), qh_compare_facetarea);
+    qsort(SETaddr_(facets, facetT), (size_t)size,
+             sizeof(facetT *), qh_compare_facetarea);
     if ((count= size - qh KEEParea) > 0) {
       FOREACHfacet_(facets) {
         facet->good= False;
@@ -875,8 +910,8 @@
     }
   }
   if (qh KEEPmerge) {
-    qsort (SETaddr_(facets, facetT), size,
-             sizeof (facetT *), qh_compare_facetmerge);
+    qsort(SETaddr_(facets, facetT), (size_t)size,
+             sizeof(facetT *), qh_compare_facetmerge);
     if ((count= size - qh KEEPmerge) > 0) {
       FOREACHfacet_(facets) {
         facet->good= False;
@@ -888,10 +923,10 @@
   if (qh KEEPminArea < REALmax/2) {
     FOREACHfacet_(facets) {
       if (!facet->isarea || facet->f.area < qh KEEPminArea)
-	facet->good= False;
+        facet->good= False;
     }
   }
-  qh_settempfree (&facets);
+  qh_settempfree(&facets);
   count= 0;
   FORALLfacet_(facetlist) {
     if (facet->good)
@@ -903,59 +938,59 @@
 
 /*---------------------------------
-  
-  qh_markvoronoi( facetlist, facets, printall, islower, numcenters )
+
+  qh_markvoronoi( facetlist, facets, printall, isLower, numcenters )
     mark voronoi vertices for printing by site pairs
-  
+
   returns:
     temporary set of vertices indexed by pointid
-    islower set if printing lower hull (i.e., at least one facet is lower hull)
+    isLower set if printing lower hull (i.e., at least one facet is lower hull)
     numcenters= total number of Voronoi vertices
     bumps qh.printoutnum for vertex-at-infinity
     clears all facet->seen and sets facet->seen2
-    
+
     if selected
       facet->visitid= Voronoi vertex id
     else if upper hull (or 'Qu' and lower hull)
       facet->visitid= 0
     else
       facet->visitid >= qh num_facets
-  
+
   notes:
     ignores qh.ATinfinity, if defined
 */
-setT *qh_markvoronoi (facetT *facetlist, setT *facets, boolT printall, boolT *islowerp, int *numcentersp) {
+setT *qh_markvoronoi(facetT *facetlist, setT *facets, boolT printall, boolT *isLowerp, int *numcentersp) {
   int numcenters=0;
   facetT *facet, **facetp;
   setT *vertices;
-  boolT islower= False;
+  boolT isLower= False;
 
   qh printoutnum++;
-  qh_clearcenters (qh_ASvoronoi);  /* in case, qh_printvdiagram2 called by user */
+  qh_clearcenters(qh_ASvoronoi);  /* in case, qh_printvdiagram2 called by user */
   qh_vertexneighbors();
   vertices= qh_pointvertex();
-  if (qh ATinfinity) 
+  if (qh ATinfinity)
     SETelem_(vertices, qh num_points-1)= NULL;
   qh visit_id++;
   maximize_(qh visit_id, (unsigned) qh num_facets);
-  FORALLfacet_(facetlist) { 
-    if (printall || !qh_skipfacet (facet)) {
+  FORALLfacet_(facetlist) {
+    if (printall || !qh_skipfacet(facet)) {
       if (!facet->upperdelaunay) {
-        islower= True;
-	break;
+        isLower= True;
+        break;
       }
     }
   }
   FOREACHfacet_(facets) {
-    if (printall || !qh_skipfacet (facet)) {
+    if (printall || !qh_skipfacet(facet)) {
       if (!facet->upperdelaunay) {
-        islower= True;
-	break;
+        isLower= True;
+        break;
       }
     }
   }
   FORALLfacets {
-    if (facet->normal && (facet->upperdelaunay == islower))
+    if (facet->normal && (facet->upperdelaunay == isLower))
       facet->visitid= 0;  /* facetlist or facets may overwrite */
     else
       facet->visitid= qh visit_id;
@@ -964,22 +999,22 @@
   }
   numcenters++;  /* qh_INFINITE */
   FORALLfacet_(facetlist) {
-    if (printall || !qh_skipfacet (facet))
+    if (printall || !qh_skipfacet(facet))
       facet->visitid= numcenters++;
   }
   FOREACHfacet_(facets) {
-    if (printall || !qh_skipfacet (facet))
-      facet->visitid= numcenters++;  
+    if (printall || !qh_skipfacet(facet))
+      facet->visitid= numcenters++;
   }
-  *islowerp= islower;
+  *isLowerp= isLower;
   *numcentersp= numcenters;
-  trace2((qh ferr, "qh_markvoronoi: islower %d numcenters %d\n", islower, numcenters));
+  trace2((qh ferr, 2007, "qh_markvoronoi: isLower %d numcenters %d\n", isLower, numcenters));
   return vertices;
 } /* markvoronoi */
 
 /*---------------------------------
-  
+
   qh_order_vertexneighbors( vertex )
     order facet neighbors of a 2-d or 3-d vertex by adjacency
 
@@ -996,33 +1031,63 @@
   setT *newset;
   facetT *facet, *neighbor, **neighborp;
 
-  trace4((qh ferr, "qh_order_vertexneighbors: order neighbors of v%d for 3-d\n", vertex->id));
-  newset= qh_settemp (qh_setsize (vertex->neighbors));
-  facet= (facetT*)qh_setdellast (vertex->neighbors);
-  qh_setappend (&newset, facet);
-  while (qh_setsize (vertex->neighbors)) {
+  trace4((qh ferr, 4018, "qh_order_vertexneighbors: order neighbors of v%d for 3-d\n", vertex->id));
+  newset= qh_settemp(qh_setsize(vertex->neighbors));
+  facet= (facetT*)qh_setdellast(vertex->neighbors);
+  qh_setappend(&newset, facet);
+  while (qh_setsize(vertex->neighbors)) {
     FOREACHneighbor_(vertex) {
-      if (qh_setin (facet->neighbors, neighbor)) {
+      if (qh_setin(facet->neighbors, neighbor)) {
         qh_setdel(vertex->neighbors, neighbor);
-        qh_setappend (&newset, neighbor);
+        qh_setappend(&newset, neighbor);
         facet= neighbor;
         break;
       }
     }
     if (!neighbor) {
-      fprintf (qh ferr, "qhull internal error (qh_order_vertexneighbors): no neighbor of v%d for f%d\n",
+      qh_fprintf(qh ferr, 6066, "qhull internal error (qh_order_vertexneighbors): no neighbor of v%d for f%d\n",
         vertex->id, facet->id);
-      qh_errexit (qh_ERRqhull, facet, NULL);
+      qh_errexit(qh_ERRqhull, facet, NULL);
     }
   }
-  qh_setfree (&vertex->neighbors);
-  qh_settemppop ();
+  qh_setfree(&vertex->neighbors);
+  qh_settemppop();
   vertex->neighbors= newset;
 } /* order_vertexneighbors */
 
 /*---------------------------------
+
+  qh_prepare_output( )
+    prepare for qh_produce_output2() according to
+      qh.KEEPminArea, KEEParea, KEEPmerge, GOODvertex, GOODthreshold, GOODpoint, ONLYgood, SPLITthresholds
+    does not reset facet->good
+
+  notes
+    except for PRINTstatistics, no-op if previously called with same options
+*/
+void qh_prepare_output(void) {
+  if (qh VORONOI) {
+    qh_clearcenters (qh_ASvoronoi);
+    qh_vertexneighbors();
+  }
+  if (qh TRIangulate && !qh hasTriangulation) {
+    qh_triangulate();
+    if (qh VERIFYoutput && !qh CHECKfrequently)
+      qh_checkpolygon (qh facet_list);
+  }
+  qh_findgood_all (qh facet_list);
+  if (qh GETarea)
+    qh_getarea(qh facet_list);
+  if (qh KEEParea || qh KEEPmerge || qh KEEPminArea < REALmax/2)
+    qh_markkeep (qh facet_list);
+  if (qh PRINTstatistics)
+    qh_collectstatistics();
+}
+
+/*---------------------------------
-  
+
   qh_printafacet( fp, format, facet, printall )
     print facet to fp in given output format (see qh.PRINTout)
 
@@ -1043,7 +1108,7 @@
     call appropriate routine for format
     or output results directly
 */
-void qh_printafacet(FILE *fp, int format, facetT *facet, boolT printall) {
+void qh_printafacet(FILE *fp, qh_PRINT format, facetT *facet, boolT printall) {
   realT color[4], offset, dist, outerplane, innerplane;
   boolT zerodiv;
   coordT *point, *normp, *coordp, **pointp, *feasiblep;
@@ -1051,7 +1116,7 @@
   vertexT *vertex, **vertexp;
   facetT *neighbor, **neighborp;
 
-  if (!printall && qh_skipfacet (facet))
+  if (!printall && qh_skipfacet(facet))
     return;
   if (facet->visible && qh NEWfacets && format != qh_PRINTfacets)
     return;
@@ -1059,30 +1124,30 @@
   switch (format) {
   case qh_PRINTarea:
     if (facet->isarea) {
-      fprintf (fp, qh_REAL_1, facet->f.area);
-      fprintf (fp, "\n");
+      qh_fprintf(fp, 9009, qh_REAL_1, facet->f.area);
+      qh_fprintf(fp, 9010, "\n");
     }else
-      fprintf (fp, "0\n");
+      qh_fprintf(fp, 9011, "0\n");
     break;
   case qh_PRINTcoplanars:
-    fprintf (fp, "%d", qh_setsize (facet->coplanarset));
+    qh_fprintf(fp, 9012, "%d", qh_setsize(facet->coplanarset));
     FOREACHpoint_(facet->coplanarset)
-      fprintf (fp, " %d", qh_pointid (point));
-    fprintf (fp, "\n");
+      qh_fprintf(fp, 9013, " %d", qh_pointid(point));
+    qh_fprintf(fp, 9014, "\n");
     break;
   case qh_PRINTcentrums:
-    qh_printcenter (fp, format, NULL, facet);
+    qh_printcenter(fp, format, NULL, facet);
     break;
   case qh_PRINTfacets:
-    qh_printfacet (fp, facet);
+    qh_printfacet(fp, facet);
     break;
   case qh_PRINTfacets_xridge:
-    qh_printfacetheader (fp, facet);
+    qh_printfacetheader(fp, facet);
     break;
   case qh_PRINTgeom:  /* either 2 , 3, or 4-d by qh_printbegin */
     if (!facet->normal)
       break;
-    for (k= qh hull_dim; k--; ) {
+    for (k=qh hull_dim; k--; ) {
       color[k]= (facet->normal[k]+1.0)/2.0;
       maximize_(color[k], -1.0);
       minimize_(color[k], +1.0);
@@ -1091,153 +1156,155 @@
     if (qh PRINTdim != qh hull_dim)
       qh_normalize2 (color, 3, True, NULL, NULL);
     if (qh hull_dim <= 2)
-      qh_printfacet2geom (fp, facet, color);
+      qh_printfacet2geom(fp, facet, color);
     else if (qh hull_dim == 3) {
       if (facet->simplicial)
-        qh_printfacet3geom_simplicial (fp, facet, color);
+        qh_printfacet3geom_simplicial(fp, facet, color);
       else
-        qh_printfacet3geom_nonsimplicial (fp, facet, color);
+        qh_printfacet3geom_nonsimplicial(fp, facet, color);
     }else {
       if (facet->simplicial)
-        qh_printfacet4geom_simplicial (fp, facet, color);
+        qh_printfacet4geom_simplicial(fp, facet, color);
       else
-        qh_printfacet4geom_nonsimplicial (fp, facet, color);
+        qh_printfacet4geom_nonsimplicial(fp, facet, color);
     }
     break;
   case qh_PRINTids:
-    fprintf (fp, "%d\n", facet->id);
+    qh_fprintf(fp, 9015, "%d\n", facet->id);
     break;
   case qh_PRINTincidences:
   case qh_PRINToff:
   case qh_PRINTtriangles:
-    if (qh hull_dim == 3 && format != qh_PRINTtriangles) 
-      qh_printfacet3vertex (fp, facet, format);
+    if (qh hull_dim == 3 && format != qh_PRINTtriangles)
+      qh_printfacet3vertex(fp, facet, format);
     else if (facet->simplicial || qh hull_dim == 2 || format == qh_PRINToff)
-      qh_printfacetNvertex_simplicial (fp, facet, format);
+      qh_printfacetNvertex_simplicial(fp, facet, format);
     else
-      qh_printfacetNvertex_nonsimplicial (fp, facet, qh printoutvar++, format);
+      qh_printfacetNvertex_nonsimplicial(fp, facet, qh printoutvar++, format);
     break;
   case qh_PRINTinner:
-    qh_outerinner (facet, NULL, &innerplane);
+    qh_outerinner(facet, NULL, &innerplane);
     offset= facet->offset - innerplane;
     goto LABELprintnorm;
     break; /* prevent warning */
   case qh_PRINTmerges:
-    fprintf (fp, "%d\n", facet->nummerge);
+    qh_fprintf(fp, 9016, "%d\n", facet->nummerge);
     break;
   case qh_PRINTnormals:
     offset= facet->offset;
     goto LABELprintnorm;
     break; /* prevent warning */
   case qh_PRINTouter:
-    qh_outerinner (facet, &outerplane, NULL);
+    qh_outerinner(facet, &outerplane, NULL);
     offset= facet->offset - outerplane;
   LABELprintnorm:
     if (!facet->normal) {
-      fprintf (fp, "no normal for facet f%d\n", facet->id);
+      qh_fprintf(fp, 9017, "no normal for facet f%d\n", facet->id);
       break;
     }
     if (qh CDDoutput) {
-      fprintf (fp, qh_REAL_1, -offset);
-      for (k=0; k < qh hull_dim; k++) 
-	fprintf (fp, qh_REAL_1, -facet->normal[k]);
+      qh_fprintf(fp, 9018, qh_REAL_1, -offset);
+      for (k=0; k < qh hull_dim; k++)
+        qh_fprintf(fp, 9019, qh_REAL_1, -facet->normal[k]);
     }else {
-      for (k=0; k < qh hull_dim; k++) 
-	fprintf (fp, qh_REAL_1, facet->normal[k]);
-      fprintf (fp, qh_REAL_1, offset);
+      for (k=0; k < qh hull_dim; k++)
+        qh_fprintf(fp, 9020, qh_REAL_1, facet->normal[k]);
+      qh_fprintf(fp, 9021, qh_REAL_1, offset);
     }
-    fprintf (fp, "\n");
+    qh_fprintf(fp, 9022, "\n");
     break;
   case qh_PRINTmathematica:  /* either 2 or 3-d by qh_printbegin */
   case qh_PRINTmaple:
     if (qh hull_dim == 2)
-      qh_printfacet2math (fp, facet, format, qh printoutvar++);
-    else 
-      qh_printfacet3math (fp, facet, format, qh printoutvar++);
+      qh_printfacet2math(fp, facet, format, qh printoutvar++);
+    else
+      qh_printfacet3math(fp, facet, format, qh printoutvar++);
     break;
   case qh_PRINTneighbors:
-    fprintf (fp, "%d", qh_setsize (facet->neighbors));
+    qh_fprintf(fp, 9023, "%d", qh_setsize(facet->neighbors));
     FOREACHneighbor_(facet)
-      fprintf (fp, " %d", 
-	       neighbor->visitid ? neighbor->visitid - 1: - neighbor->id);
-    fprintf (fp, "\n");
+      qh_fprintf(fp, 9024, " %d",
+               neighbor->visitid ? neighbor->visitid - 1: 0 - neighbor->id);
+    qh_fprintf(fp, 9025, "\n");
     break;
   case qh_PRINTpointintersect:
     if (!qh feasible_point) {
-      fprintf (fp, "qhull input error (qh_printafacet): option 'Fp' needs qh feasible_point\n");
+      qh_fprintf(qh ferr, 6067, "qhull input error (qh_printafacet): option 'Fp' needs qh feasible_point\n");
       qh_errexit( qh_ERRinput, NULL, NULL);
     }
     if (facet->offset > 0)
       goto LABELprintinfinite;
-    point= coordp= (coordT*)qh_memalloc (qh normal_size);
+    point= coordp= (coordT*)qh_memalloc(qh normal_size);
     normp= facet->normal;
     feasiblep= qh feasible_point;
     if (facet->offset < -qh MINdenom) {
-      for (k= qh hull_dim; k--; )
+      for (k=qh hull_dim; k--; )
         *(coordp++)= (*(normp++) / - facet->offset) + *(feasiblep++);
     }else {
-      for (k= qh hull_dim; k--; ) {
-        *(coordp++)= qh_divzero (*(normp++), facet->offset, qh MINdenom_1,
-				 &zerodiv) + *(feasiblep++);
+      for (k=qh hull_dim; k--; ) {
+        *(coordp++)= qh_divzero(*(normp++), facet->offset, qh MINdenom_1,
+                                 &zerodiv) + *(feasiblep++);
         if (zerodiv) {
-          qh_memfree (point, qh normal_size);
+          qh_memfree(point, qh normal_size);
           goto LABELprintinfinite;
         }
       }
     }
-    qh_printpoint (fp, NULL, point);
-    qh_memfree (point, qh normal_size);
+    qh_printpoint(fp, NULL, point);
+    qh_memfree(point, qh normal_size);
     break;
   LABELprintinfinite:
-    for (k= qh hull_dim; k--; )
-      fprintf (fp, qh_REAL_1, qh_INFINITE);
-    fprintf (fp, "\n");   
+    for (k=qh hull_dim; k--; )
+      qh_fprintf(fp, 9026, qh_REAL_1, qh_INFINITE);
+    qh_fprintf(fp, 9027, "\n");
     break;
   case qh_PRINTpointnearest:
     FOREACHpoint_(facet->coplanarset) {
       int id, id2;
-      vertex= qh_nearvertex (facet, point, &dist);
-      id= qh_pointid (vertex->point);
-      id2= qh_pointid (point);
-      fprintf (fp, "%d %d %d " qh_REAL_1 "\n", id, id2, facet->id, dist);
+      vertex= qh_nearvertex(facet, point, &dist);
+      id= qh_pointid(vertex->point);
+      id2= qh_pointid(point);
+      qh_fprintf(fp, 9028, "%d %d %d " qh_REAL_1 "\n", id, id2, facet->id, dist);
     }
     break;
   case qh_PRINTpoints:  /* VORONOI only by qh_printbegin */
     if (qh CDDoutput)
-      fprintf (fp, "1 ");
-    qh_printcenter (fp, format, NULL, facet);
+      qh_fprintf(fp, 9029, "1 ");
+    qh_printcenter(fp, format, NULL, facet);
     break;
   case qh_PRINTvertices:
-    fprintf (fp, "%d", qh_setsize (facet->vertices));
+    qh_fprintf(fp, 9030, "%d", qh_setsize(facet->vertices));
     FOREACHvertex_(facet->vertices)
-      fprintf (fp, " %d", qh_pointid (vertex->point));
-    fprintf (fp, "\n");
+      qh_fprintf(fp, 9031, " %d", qh_pointid(vertex->point));
+    qh_fprintf(fp, 9032, "\n");
     break;
+  default:
+    break;
   }
 } /* printafacet */
 
 /*---------------------------------
-  
+
   qh_printbegin(  )
     prints header for all output formats
 
   returns:
     checks for valid format
-  
+
   notes:
     uses qh.visit_id for 3/4off
     changes qh.interior_point if printing centrums
     qh_countfacets clears facet->visitid for non-good facets
-    
+
   see
     qh_printend() and qh_printafacet()
-    
+
   design:
     count facets and related statistics
     print header for format
 */
-void qh_printbegin (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall) {
+void qh_printbegin(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall) {
   int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
   int i, num;
   facetT *facet, **facetp;
@@ -1246,98 +1313,101 @@
   pointT *point, **pointp, *pointtemp;
 
   qh printoutnum= 0;
-  qh_countfacets (facetlist, facets, printall, &numfacets, &numsimplicial, 
+  qh_countfacets(facetlist, facets, printall, &numfacets, &numsimplicial,
       &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
   switch (format) {
   case qh_PRINTnone:
     break;
   case qh_PRINTarea:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9033, "%d\n", numfacets);
     break;
   case qh_PRINTcoplanars:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9034, "%d\n", numfacets);
     break;
   case qh_PRINTcentrums:
     if (qh CENTERtype == qh_ASnone)
-      qh_clearcenters (qh_AScentrum);
-    fprintf (fp, "%d\n%d\n", qh hull_dim, numfacets);
+      qh_clearcenters(qh_AScentrum);
+    qh_fprintf(fp, 9035, "%d\n%d\n", qh hull_dim, numfacets);
     break;
   case qh_PRINTfacets:
   case qh_PRINTfacets_xridge:
     if (facetlist)
-      qh_printvertexlist (fp, "Vertices and facets:\n", facetlist, facets, printall);
+      qh_printvertexlist(fp, "Vertices and facets:\n", facetlist, facets, printall);
     break;
-  case qh_PRINTgeom: 
+  case qh_PRINTgeom:
     if (qh hull_dim > 4)  /* qh_initqhull_globals also checks */
       goto LABELnoformat;
     if (qh VORONOI && qh hull_dim > 3)  /* PRINTdim == DROPdim == hull_dim-1 */
       goto LABELnoformat;
     if (qh hull_dim == 2 && (qh PRINTridges || qh DOintersections))
-      fprintf (qh ferr, "qhull warning: output for ridges and intersections not implemented in 2-d\n");
+      qh_fprintf(qh ferr, 7049, "qhull warning: output for ridges and intersections not implemented in 2-d\n");
     if (qh hull_dim == 4 && (qh PRINTinner || qh PRINTouter ||
-			     (qh PRINTdim == 4 && qh PRINTcentrums)))
-      fprintf (qh ferr, "qhull warning: output for outer/inner planes and centrums not implemented in 4-d\n");
+                             (qh PRINTdim == 4 && qh PRINTcentrums)))
+      qh_fprintf(qh ferr, 7050, "qhull warning: output for outer/inner planes and centrums not implemented in 4-d\n");
     if (qh PRINTdim == 4 && (qh PRINTspheres))
-      fprintf (qh ferr, "qhull warning: output for vertices not implemented in 4-d\n");
+      qh_fprintf(qh ferr, 7051, "qhull warning: output for vertices not implemented in 4-d\n");
     if (qh PRINTdim == 4 && qh DOintersections && qh PRINTnoplanes)
-      fprintf (qh ferr, "qhull warning: 'Gnh' generates no output in 4-d\n");
+      qh_fprintf(qh ferr, 7052, "qhull warning: 'Gnh' generates no output in 4-d\n");
     if (qh PRINTdim == 2) {
-      fprintf(fp, "{appearance {linewidth 3} LIST # %s | %s\n",
-	      qh rbox_command, qh qhull_command);
+      qh_fprintf(fp, 9036, "{appearance {linewidth 3} LIST # %s | %s\n",
+              qh rbox_command, qh qhull_command);
     }else if (qh PRINTdim == 3) {
-      fprintf(fp, "{appearance {+edge -evert linewidth 2} LIST # %s | %s\n",
-	      qh rbox_command, qh qhull_command);
+      qh_fprintf(fp, 9037, "{appearance {+edge -evert linewidth 2} LIST # %s | %s\n",
+              qh rbox_command, qh qhull_command);
     }else if (qh PRINTdim == 4) {
       qh visit_id++;
       num= 0;
       FORALLfacet_(facetlist)    /* get number of ridges to be printed */
-        qh_printend4geom (NULL, facet, &num, printall);
+        qh_printend4geom(NULL, facet, &num, printall);
       FOREACHfacet_(facets)
-        qh_printend4geom (NULL, facet, &num, printall);
+        qh_printend4geom(NULL, facet, &num, printall);
       qh ridgeoutnum= num;
       qh printoutvar= 0;  /* counts number of ridges in output */
-      fprintf (fp, "LIST # %s | %s\n", qh rbox_command, qh qhull_command);
+      qh_fprintf(fp, 9038, "LIST # %s | %s\n", qh rbox_command, qh qhull_command);
     }
+
     if (qh PRINTdots) {
       qh printoutnum++;
-      num= qh num_points + qh_setsize (qh other_points);
+      num= qh num_points + qh_setsize(qh other_points);
       if (qh DELAUNAY && qh ATinfinity)
-	num--;
+        num--;
       if (qh PRINTdim == 4)
-        fprintf (fp, "4VECT %d %d 1\n", num, num);
+        qh_fprintf(fp, 9039, "4VECT %d %d 1\n", num, num);
       else
-	fprintf (fp, "VECT %d %d 1\n", num, num);
-      for (i= num; i--; ) {
+        qh_fprintf(fp, 9040, "VECT %d %d 1\n", num, num);
+
+      for (i=num; i--; ) {
         if (i % 20 == 0)
-          fprintf (fp, "\n");
-	fprintf (fp, "1 ");
+          qh_fprintf(fp, 9041, "\n");
+        qh_fprintf(fp, 9042, "1 ");
       }
-      fprintf (fp, "# 1 point per line\n1 ");
-      for (i= num-1; i--; ) {
+      qh_fprintf(fp, 9043, "# 1 point per line\n1 ");
+      for (i=num-1; i--; ) { /* num at least 3 for D2 */
         if (i % 20 == 0)
-          fprintf (fp, "\n");
-	fprintf (fp, "0 ");
+          qh_fprintf(fp, 9044, "\n");
+        qh_fprintf(fp, 9045, "0 ");
       }
-      fprintf (fp, "# 1 color for all\n");
+      qh_fprintf(fp, 9046, "# 1 color for all\n");
       FORALLpoints {
         if (!qh DELAUNAY || !qh ATinfinity || qh_pointid(point) != qh num_points-1) {
-	  if (qh PRINTdim == 4)
-	    qh_printpoint (fp, NULL, point);
-	  else
-	    qh_printpoint3 (fp, point);
-	}
+          if (qh PRINTdim == 4)
+            qh_printpoint(fp, NULL, point);
+            else
+              qh_printpoint3 (fp, point);
+        }
       }
       FOREACHpoint_(qh other_points) {
-	if (qh PRINTdim == 4)
-	  qh_printpoint (fp, NULL, point);
-	else
-	  qh_printpoint3 (fp, point);
+        if (qh PRINTdim == 4)
+          qh_printpoint(fp, NULL, point);
+        else
+          qh_printpoint3 (fp, point);
       }
-      fprintf (fp, "0 1 1 1  # color of points\n");
+      qh_fprintf(fp, 9047, "0 1 1 1  # color of points\n");
     }
+
     if (qh PRINTdim == 4  && !qh PRINTnoplanes)
       /* 4dview loads up multiple 4OFF objects slowly */
-      fprintf(fp, "4OFF %d %d 1\n", 3*qh ridgeoutnum, qh ridgeoutnum);
+      qh_fprintf(fp, 9048, "4OFF %d %d 1\n", 3*qh ridgeoutnum, qh ridgeoutnum);
     qh PRINTcradius= 2 * qh DISTround;  /* include test DISTround */
     if (qh PREmerge) {
       maximize_(qh PRINTcradius, qh premerge_centrum + qh DISTround);
@@ -1351,98 +1421,97 @@
     }else if (!qh PREmerge && qh POSTmerge && qh postmerge_cos < REALmax/2) {
       maximize_(qh PRINTradius, (1- qh postmerge_cos) * qh MAXabs_coord);
     }
-    maximize_(qh PRINTradius, qh MINvisible); 
+    maximize_(qh PRINTradius, qh MINvisible);
     if (qh JOGGLEmax < REALmax/2)
-      qh PRINTradius += qh JOGGLEmax * sqrt (qh hull_dim);
+      qh PRINTradius += qh JOGGLEmax * sqrt((realT)qh hull_dim);
     if (qh PRINTdim != 4 &&
-	(qh PRINTcoplanar || qh PRINTspheres || qh PRINTcentrums)) {
-      vertices= qh_facetvertices (facetlist, facets, printall);
+        (qh PRINTcoplanar || qh PRINTspheres || qh PRINTcentrums)) {
+      vertices= qh_facetvertices(facetlist, facets, printall);
       if (qh PRINTspheres && qh PRINTdim <= 3)
-         qh_printspheres (fp, vertices, qh PRINTradius);
+        qh_printspheres(fp, vertices, qh PRINTradius);
       if (qh PRINTcoplanar || qh PRINTcentrums) {
         qh firstcentrum= True;
         if (qh PRINTcoplanar&& !qh PRINTspheres) {
-          FOREACHvertex_(vertices) 
-            qh_printpointvect2 (fp, vertex->point, NULL,
-				qh interior_point, qh PRINTradius);
-	}
+          FOREACHvertex_(vertices)
+            qh_printpointvect2 (fp, vertex->point, NULL, qh interior_point, qh PRINTradius);
+        }
         FORALLfacet_(facetlist) {
-	  if (!printall && qh_skipfacet(facet))
-	    continue;
-	  if (!facet->normal)
-	    continue;
+          if (!printall && qh_skipfacet(facet))
+            continue;
+          if (!facet->normal)
+            continue;
           if (qh PRINTcentrums && qh PRINTdim <= 3)
-            qh_printcentrum (fp, facet, qh PRINTcradius);
-	  if (!qh PRINTcoplanar)
-	    continue;
+            qh_printcentrum(fp, facet, qh PRINTcradius);
+          if (!qh PRINTcoplanar)
+            continue;
           FOREACHpoint_(facet->coplanarset)
             qh_printpointvect2 (fp, point, facet->normal, NULL, qh PRINTradius);
           FOREACHpoint_(facet->outsideset)
             qh_printpointvect2 (fp, point, facet->normal, NULL, qh PRINTradius);
         }
         FOREACHfacet_(facets) {
-	  if (!printall && qh_skipfacet(facet))
-	    continue;
-	  if (!facet->normal)
-	    continue;
+          if (!printall && qh_skipfacet(facet))
+            continue;
+          if (!facet->normal)
+            continue;
           if (qh PRINTcentrums && qh PRINTdim <= 3)
-            qh_printcentrum (fp, facet, qh PRINTcradius);
-	  if (!qh PRINTcoplanar)
-	    continue;
+            qh_printcentrum(fp, facet, qh PRINTcradius);
+          if (!qh PRINTcoplanar)
+            continue;
           FOREACHpoint_(facet->coplanarset)
             qh_printpointvect2 (fp, point, facet->normal, NULL, qh PRINTradius);
           FOREACHpoint_(facet->outsideset)
             qh_printpointvect2 (fp, point, facet->normal, NULL, qh PRINTradius);
         }
       }
-      qh_settempfree (&vertices);
+      qh_settempfree(&vertices);
     }
     qh visit_id++; /* for printing hyperplane intersections */
     break;
   case qh_PRINTids:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9049, "%d\n", numfacets);
     break;
   case qh_PRINTincidences:
     if (qh VORONOI && qh PRINTprecision)
-      fprintf (qh ferr, "qhull warning: writing Delaunay.  Use 'p' or 'o' for Voronoi centers\n");
+      qh_fprintf(qh ferr, 7053, "qhull warning: writing Delaunay.  Use 'p' or 'o' for Voronoi centers\n");
     qh printoutvar= qh vertex_id;  /* centrum id for non-simplicial facets */
     if (qh hull_dim <= 3)
-      fprintf(fp, "%d\n", numfacets);
+      qh_fprintf(fp, 9050, "%d\n", numfacets);
     else
-      fprintf(fp, "%d\n", numsimplicial+numridges);
+      qh_fprintf(fp, 9051, "%d\n", numsimplicial+numridges);
     break;
   case qh_PRINTinner:
   case qh_PRINTnormals:
   case qh_PRINTouter:
     if (qh CDDoutput)
-      fprintf (fp, "%s | %s\nbegin\n    %d %d real\n", qh rbox_command, 
-              qh qhull_command, numfacets, qh hull_dim+1);
+      qh_fprintf(fp, 9052, "%s | %s\nbegin\n    %d %d real\n", qh rbox_command,
+            qh qhull_command, numfacets, qh hull_dim+1);
     else
-      fprintf (fp, "%d\n%d\n", qh hull_dim+1, numfacets);
+      qh_fprintf(fp, 9053, "%d\n%d\n", qh hull_dim+1, numfacets);
     break;
-  case qh_PRINTmathematica:  
+  case qh_PRINTmathematica:
   case qh_PRINTmaple:
     if (qh hull_dim > 3)  /* qh_initbuffers also checks */
       goto LABELnoformat;
     if (qh VORONOI)
-      fprintf (qh ferr, "qhull warning: output is the Delaunay triangulation\n");
+      qh_fprintf(qh ferr, 7054, "qhull warning: output is the Delaunay triangulation\n");
     if (format == qh_PRINTmaple) {
       if (qh hull_dim == 2)
-	fprintf(fp, "PLOT(CURVES(\n");
+        qh_fprintf(fp, 9054, "PLOT(CURVES(\n");
       else
-	fprintf(fp, "PLOT3D(POLYGONS(\n");
+        qh_fprintf(fp, 9055, "PLOT3D(POLYGONS(\n");
     }else
-      fprintf(fp, "{\n");
+      qh_fprintf(fp, 9056, "{\n");
     qh printoutvar= 0;   /* counts number of facets for notfirst */
     break;
   case qh_PRINTmerges:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9057, "%d\n", numfacets);
     break;
   case qh_PRINTpointintersect:
-    fprintf (fp, "%d\n%d\n", qh hull_dim, numfacets);
+    qh_fprintf(fp, 9058, "%d\n%d\n", qh hull_dim, numfacets);
     break;
   case qh_PRINTneighbors:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9059, "%d\n", numfacets);
     break;
   case qh_PRINToff:
   case qh_PRINTtriangles:
@@ -1450,53 +1519,53 @@
       goto LABELnoformat;
     num = qh hull_dim;
     if (format == qh_PRINToff || qh hull_dim == 2)
-      fprintf (fp, "%d\n%d %d %d\n", num, 
-        qh num_points+qh_setsize (qh other_points), numfacets, totneighbors/2);
+      qh_fprintf(fp, 9060, "%d\n%d %d %d\n", num,
+        qh num_points+qh_setsize(qh other_points), numfacets, totneighbors/2);
     else { /* qh_PRINTtriangles */
-      qh printoutvar= qh num_points+qh_setsize (qh other_points); /* first centrum */
+      qh printoutvar= qh num_points+qh_setsize(qh other_points); /* first centrum */
       if (qh DELAUNAY)
         num--;  /* drop last dimension */
-      fprintf (fp, "%d\n%d %d %d\n", num, qh printoutvar 
-	+ numfacets - numsimplicial, numsimplicial + numridges, totneighbors/2);
+      qh_fprintf(fp, 9061, "%d\n%d %d %d\n", num, qh printoutvar
+        + numfacets - numsimplicial, numsimplicial + numridges, totneighbors/2);
     }
     FORALLpoints
-      qh_printpointid (qh fout, NULL, num, point, -1);
+      qh_printpointid(qh fout, NULL, num, point, -1);
     FOREACHpoint_(qh other_points)
-      qh_printpointid (qh fout, NULL, num, point, -1);
+      qh_printpointid(qh fout, NULL, num, point, -1);
     if (format == qh_PRINTtriangles && qh hull_dim > 2) {
       FORALLfacets {
-	if (!facet->simplicial && facet->visitid)
-          qh_printcenter (qh fout, format, NULL, facet);
+        if (!facet->simplicial && facet->visitid)
+          qh_printcenter(qh fout, format, NULL, facet);
       }
     }
     break;
   case qh_PRINTpointnearest:
-    fprintf (fp, "%d\n", numcoplanars);
+    qh_fprintf(fp, 9062, "%d\n", numcoplanars);
     break;
   case qh_PRINTpoints:
     if (!qh VORONOI)
       goto LABELnoformat;
     if (qh CDDoutput)
-      fprintf (fp, "%s | %s\nbegin\n%d %d real\n", qh rbox_command,
-             qh qhull_command, numfacets, qh hull_dim);
+      qh_fprintf(fp, 9063, "%s | %s\nbegin\n%d %d real\n", qh rbox_command,
+           qh qhull_command, numfacets, qh hull_dim);
     else
-      fprintf (fp, "%d\n%d\n", qh hull_dim-1, numfacets);
+      qh_fprintf(fp, 9064, "%d\n%d\n", qh hull_dim-1, numfacets);
     break;
   case qh_PRINTvertices:
-    fprintf (fp, "%d\n", numfacets);
+    qh_fprintf(fp, 9065, "%d\n", numfacets);
     break;
   case qh_PRINTsummary:
   default:
   LABELnoformat:
-    fprintf (qh ferr, "qhull internal error (qh_printbegin): can not use this format for dimension %d\n",
+    qh_fprintf(qh ferr, 6068, "qhull internal error (qh_printbegin): can not use this format for dimension %d\n",
          qh hull_dim);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
 } /* printbegin */
 
 /*---------------------------------
-  
+
   qh_printcenter( fp, string, facet )
     print facet->center as centrum or Voronoi center
     string may be NULL.  Don't include '%' codes.
@@ -1507,43 +1576,44 @@
   notes:
     defines facet->center if needed
     if format=PRINTgeom, adds a 0 if would otherwise be 2-d
+    Same as QhullFacet::printCenter
 */
-void qh_printcenter (FILE *fp, int format, char *string, facetT *facet) {
+void qh_printcenter(FILE *fp, qh_PRINT format, const char *string, facetT *facet) {
   int k, num;
 
   if (qh CENTERtype != qh_ASvoronoi && qh CENTERtype != qh_AScentrum)
     return;
   if (string)
-    fprintf (fp, string, facet->id);
+    qh_fprintf(fp, 9066, string);
   if (qh CENTERtype == qh_ASvoronoi) {
     num= qh hull_dim-1;
     if (!facet->normal || !facet->upperdelaunay || !qh ATinfinity) {
       if (!facet->center)
-        facet->center= qh_facetcenter (facet->vertices);
+        facet->center= qh_facetcenter(facet->vertices);
       for (k=0; k < num; k++)
-        fprintf (fp, qh_REAL_1, facet->center[k]);
+        qh_fprintf(fp, 9067, qh_REAL_1, facet->center[k]);
     }else {
       for (k=0; k < num; k++)
-        fprintf (fp, qh_REAL_1, qh_INFINITE);
+        qh_fprintf(fp, 9068, qh_REAL_1, qh_INFINITE);
     }
   }else /* qh CENTERtype == qh_AScentrum */ {
     num= qh hull_dim;
-    if (format == qh_PRINTtriangles && qh DELAUNAY) 
+    if (format == qh_PRINTtriangles && qh DELAUNAY)
       num--;
-    if (!facet->center) 
-      facet->center= qh_getcentrum (facet);
+    if (!facet->center)
+      facet->center= qh_getcentrum(facet);
     for (k=0; k < num; k++)
-      fprintf (fp, qh_REAL_1, facet->center[k]);
+      qh_fprintf(fp, 9069, qh_REAL_1, facet->center[k]);
   }
   if (format == qh_PRINTgeom && num == 2)
-    fprintf (fp, " 0\n");
+    qh_fprintf(fp, 9070, " 0\n");
   else
-    fprintf (fp, "\n");
+    qh_fprintf(fp, 9071, "\n");
 } /* printcenter */
 
 /*---------------------------------
-  
+
   qh_printcentrum( fp, facet, radius )
     print centrum for a facet in OOGL format
     radius defines size of centrum
@@ -1552,36 +1622,36 @@
   returns:
     defines facet->center if needed
 */
-void qh_printcentrum (FILE *fp, facetT *facet, realT radius) {
+void qh_printcentrum(FILE *fp, facetT *facet, realT radius) {
   pointT *centrum, *projpt;
   boolT tempcentrum= False;
   realT xaxis[4], yaxis[4], normal[4], dist;
   realT green[3]={0, 1, 0};
   vertexT *apex;
   int k;
-  
+
   if (qh CENTERtype == qh_AScentrum) {
     if (!facet->center)
-      facet->center= qh_getcentrum (facet);
+      facet->center= qh_getcentrum(facet);
     centrum= facet->center;
   }else {
-    centrum= qh_getcentrum (facet);
+    centrum= qh_getcentrum(facet);
     tempcentrum= True;
   }
-  fprintf (fp, "{appearance {-normal -edge normscale 0} ");
+  qh_fprintf(fp, 9072, "{appearance {-normal -edge normscale 0} ");
   if (qh firstcentrum) {
     qh firstcentrum= False;
-    fprintf (fp, "{INST geom { define centrum CQUAD  # f%d\n\
+    qh_fprintf(fp, 9073, "{INST geom { define centrum CQUAD  # f%d\n\
 -0.3 -0.3 0.0001     0 0 1 1\n\
  0.3 -0.3 0.0001     0 0 1 1\n\
  0.3  0.3 0.0001     0 0 1 1\n\
 -0.3  0.3 0.0001     0 0 1 1 } transform { \n", facet->id);
   }else
-    fprintf (fp, "{INST geom { : centrum } transform { # f%d\n", facet->id);
+    qh_fprintf(fp, 9074, "{INST geom { : centrum } transform { # f%d\n", facet->id);
   apex= SETfirstt_(facet->vertices, vertexT);
   qh_distplane(apex->point, facet, &dist);
   projpt= qh_projectpoint(apex->point, facet, dist);
-  for (k= qh hull_dim; k--; ) {
+  for (k=qh hull_dim; k--; ) {
     xaxis[k]= projpt[k] - centrum[k];
     normal[k]= facet->normal[k];
   }
@@ -1593,78 +1663,80 @@
     qh_projectdim3 (normal, normal);
     qh_normalize2 (normal, qh PRINTdim, True, NULL, NULL);
   }
-  qh_crossproduct (3, xaxis, normal, yaxis);
-  fprintf (fp, "%8.4g %8.4g %8.4g 0\n", xaxis[0], xaxis[1], xaxis[2]);
-  fprintf (fp, "%8.4g %8.4g %8.4g 0\n", yaxis[0], yaxis[1], yaxis[2]);
-  fprintf (fp, "%8.4g %8.4g %8.4g 0\n", normal[0], normal[1], normal[2]);
+  qh_crossproduct(3, xaxis, normal, yaxis);
+  qh_fprintf(fp, 9075, "%8.4g %8.4g %8.4g 0\n", xaxis[0], xaxis[1], xaxis[2]);
+  qh_fprintf(fp, 9076, "%8.4g %8.4g %8.4g 0\n", yaxis[0], yaxis[1], yaxis[2]);
+  qh_fprintf(fp, 9077, "%8.4g %8.4g %8.4g 0\n", normal[0], normal[1], normal[2]);
   qh_printpoint3 (fp, centrum);
-  fprintf (fp, "1 }}}\n"); 
-  qh_memfree (projpt, qh normal_size);
-  qh_printpointvect (fp, centrum, facet->normal, NULL, radius, green);
+  qh_fprintf(fp, 9078, "1 }}}\n");
+  qh_memfree(projpt, qh normal_size);
+  qh_printpointvect(fp, centrum, facet->normal, NULL, radius, green);
   if (tempcentrum)
-    qh_memfree (centrum, qh normal_size);
+    qh_memfree(centrum, qh normal_size);
 } /* printcentrum */
-  
+
 /*---------------------------------
-  
+
   qh_printend( fp, format )
     prints trailer for all output formats
 
   see:
     qh_printbegin() and qh_printafacet()
-      
+
 */
-void qh_printend (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall) {
+void qh_printend(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall) {
   int num;
   facetT *facet, **facetp;
 
   if (!qh printoutnum)
-    fprintf (qh ferr, "qhull warning: no facets printed\n");
+    qh_fprintf(qh ferr, 7055, "qhull warning: no facets printed\n");
   switch (format) {
   case qh_PRINTgeom:
     if (qh hull_dim == 4 && qh DROPdim < 0  && !qh PRINTnoplanes) {
       qh visit_id++;
       num= 0;
       FORALLfacet_(facetlist)
-        qh_printend4geom (fp, facet,&num, printall);
-      FOREACHfacet_(facets) 
-        qh_printend4geom (fp, facet, &num, printall);
+        qh_printend4geom(fp, facet,&num, printall);
+      FOREACHfacet_(facets)
+        qh_printend4geom(fp, facet, &num, printall);
       if (num != qh ridgeoutnum || qh printoutvar != qh ridgeoutnum) {
-	fprintf (qh ferr, "qhull internal error (qh_printend): number of ridges %d != number printed %d and at end %d\n", qh ridgeoutnum, qh printoutvar, num);
-	qh_errexit (qh_ERRqhull, NULL, NULL);
+        qh_fprintf(qh ferr, 6069, "qhull internal error (qh_printend): number of ridges %d != number printed %d and at end %d\n", qh ridgeoutnum, qh printoutvar, num);
+        qh_errexit(qh_ERRqhull, NULL, NULL);
       }
     }else
-      fprintf(fp, "}\n");
+      qh_fprintf(fp, 9079, "}\n");
     break;
   case qh_PRINTinner:
   case qh_PRINTnormals:
   case qh_PRINTouter:
-    if (qh CDDoutput) 
-      fprintf (fp, "end\n");
+    if (qh CDDoutput)
+      qh_fprintf(fp, 9080, "end\n");
     break;
   case qh_PRINTmaple:
-    fprintf(fp, "));\n");
+    qh_fprintf(fp, 9081, "));\n");
     break;
   case qh_PRINTmathematica:
-    fprintf(fp, "}\n");
+    qh_fprintf(fp, 9082, "}\n");
     break;
   case qh_PRINTpoints:
     if (qh CDDoutput)
-      fprintf (fp, "end\n");
+      qh_fprintf(fp, 9083, "end\n");
     break;
+  default:
+    break;
   }
 } /* printend */
 
 /*---------------------------------
-  
+
   qh_printend4geom( fp, facet, numridges, printall )
     helper function for qh_printbegin/printend
 
   returns:
     number of printed ridges
-  
+
   notes:
     just counts printed ridges if fp=NULL
     uses facet->visitid
@@ -1672,14 +1744,14 @@
 
   design:
     computes color for facet from its normal
-    prints each ridge of facet 
+    prints each ridge of facet
 */
-void qh_printend4geom (FILE *fp, facetT *facet, int *nump, boolT printall) {
+void qh_printend4geom(FILE *fp, facetT *facet, int *nump, boolT printall) {
   realT color[3];
   int i, num= *nump;
   facetT *neighbor, **neighborp;
   ridgeT *ridge, **ridgep;
-  
+
   if (!printall && qh_skipfacet(facet))
     return;
   if (qh PRINTnoplanes || (facet->visible && qh NEWfacets))
@@ -1697,22 +1769,22 @@
   if (facet->simplicial) {
     FOREACHneighbor_(facet) {
       if (neighbor->visitid != qh visit_id) {
-	if (fp)
-          fprintf (fp, "3 %d %d %d %8.4g %8.4g %8.4g 1 # f%d f%d\n",
-		 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
-		 facet->id, neighbor->id);
-	num++;
+        if (fp)
+          qh_fprintf(fp, 9084, "3 %d %d %d %8.4g %8.4g %8.4g 1 # f%d f%d\n",
+                 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
+                 facet->id, neighbor->id);
+        num++;
       }
     }
   }else {
     FOREACHridge_(facet->ridges) {
       neighbor= otherfacet_(ridge, facet);
       if (neighbor->visitid != qh visit_id) {
-	if (fp)
-          fprintf (fp, "3 %d %d %d %8.4g %8.4g %8.4g 1 #r%d f%d f%d\n",
-		 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
-		 ridge->id, facet->id, neighbor->id);
-	num++;
+        if (fp)
+          qh_fprintf(fp, 9085, "3 %d %d %d %8.4g %8.4g %8.4g 1 #r%d f%d f%d\n",
+                 3*num, 3*num+1, 3*num+2, color[0], color[1], color[2],
+                 ridge->id, facet->id, neighbor->id);
+        num++;
       }
     }
   }
@@ -1721,46 +1793,46 @@
 
 /*---------------------------------
-  
+
   qh_printextremes( fp, facetlist, facets, printall )
     print extreme points for convex hulls or halfspace intersections
 
   notes:
     #points, followed by ids, one per line
-    
+
     sorted by id
     same order as qh_printpoints_out if no coplanar/interior points
 */
-void qh_printextremes (FILE *fp, facetT *facetlist, setT *facets, int printall) {
+void qh_printextremes(FILE *fp, facetT *facetlist, setT *facets, boolT printall) {
   setT *vertices, *points;
   pointT *point;
   vertexT *vertex, **vertexp;
   int id;
   int numpoints=0, point_i, point_n;
-  int allpoints= qh num_points + qh_setsize (qh other_points);
+  int allpoints= qh num_points + qh_setsize(qh other_points);
 
-  points= qh_settemp (allpoints);
-  qh_setzero (points, 0, allpoints);
-  vertices= qh_facetvertices (facetlist, facets, printall);
+  points= qh_settemp(allpoints);
+  qh_setzero(points, 0, allpoints);
+  vertices= qh_facetvertices(facetlist, facets, printall);
   FOREACHvertex_(vertices) {
-    id= qh_pointid (vertex->point);
+    id= qh_pointid(vertex->point);
     if (id >= 0) {
       SETelem_(points, id)= vertex->point;
       numpoints++;
     }
   }
-  qh_settempfree (&vertices);
-  fprintf (fp, "%d\n", numpoints);
+  qh_settempfree(&vertices);
+  qh_fprintf(fp, 9086, "%d\n", numpoints);
   FOREACHpoint_i_(points) {
-    if (point) 
-      fprintf (fp, "%d\n", point_i);
+    if (point)
+      qh_fprintf(fp, 9087, "%d\n", point_i);
   }
-  qh_settempfree (&points);
+  qh_settempfree(&points);
 } /* printextremes */
 
 /*---------------------------------
-  
+
   qh_printextremes_2d( fp, facetlist, facets, printall )
     prints point ids for facets in qh_ORIENTclock order
 
@@ -1770,17 +1842,17 @@
     errors if facets form a loop
     does not print coplanar points
 */
-void qh_printextremes_2d (FILE *fp, facetT *facetlist, setT *facets, int printall) {
+void qh_printextremes_2d(FILE *fp, facetT *facetlist, setT *facets, boolT printall) {
   int numfacets, numridges, totneighbors, numcoplanars, numsimplicial, numtricoplanars;
   setT *vertices;
   facetT *facet, *startfacet, *nextfacet;
   vertexT *vertexA, *vertexB;
 
-  qh_countfacets (facetlist, facets, printall, &numfacets, &numsimplicial, 
+  qh_countfacets(facetlist, facets, printall, &numfacets, &numsimplicial,
       &totneighbors, &numridges, &numcoplanars, &numtricoplanars); /* marks qh visit_id */
-  vertices= qh_facetvertices (facetlist, facets, printall);
-  fprintf(fp, "%d\n", qh_setsize (vertices));
-  qh_settempfree (&vertices);
+  vertices= qh_facetvertices(facetlist, facets, printall);
+  qh_fprintf(fp, 9088, "%d\n", qh_setsize(vertices));
+  qh_settempfree(&vertices);
   if (!numfacets)
     return;
   facet= startfacet= facetlist ? facetlist : SETfirstt_(facets, facetT);
@@ -1797,18 +1869,18 @@
       nextfacet= SETsecondt_(facet->neighbors, facetT);
     }
     if (facet->visitid == qh visit_id) {
-      fprintf(qh ferr, "qh_printextremes_2d: loop in facet list.  facet %d nextfacet %d\n",
+      qh_fprintf(qh ferr, 6218, "Qhull internal error (qh_printextremes_2d): loop in facet list.  facet %d nextfacet %d\n",
                  facet->id, nextfacet->id);
       qh_errexit2 (qh_ERRqhull, facet, nextfacet);
     }
     if (facet->visitid) {
       if (vertexA->visitid != qh vertex_visit) {
-	vertexA->visitid= qh vertex_visit;
-	fprintf(fp, "%d\n", qh_pointid (vertexA->point));
+        vertexA->visitid= qh vertex_visit;
+        qh_fprintf(fp, 9089, "%d\n", qh_pointid(vertexA->point));
       }
       if (vertexB->visitid != qh vertex_visit) {
-	vertexB->visitid= qh vertex_visit;
-	fprintf(fp, "%d\n", qh_pointid (vertexB->point));
+        vertexB->visitid= qh vertex_visit;
+        qh_fprintf(fp, 9090, "%d\n", qh_pointid(vertexB->point));
       }
     }
     facet->visitid= qh visit_id;
@@ -1818,23 +1890,23 @@
 
 /*---------------------------------
-  
+
   qh_printextremes_d( fp, facetlist, facets, printall )
     print extreme points of input sites for Delaunay triangulations
 
   notes:
     #points, followed by ids, one per line
-    
+
     unordered
 */
-void qh_printextremes_d (FILE *fp, facetT *facetlist, setT *facets, int printall) {
+void qh_printextremes_d(FILE *fp, facetT *facetlist, setT *facets, boolT printall) {
   setT *vertices;
   vertexT *vertex, **vertexp;
   boolT upperseen, lowerseen;
   facetT *neighbor, **neighborp;
   int numpoints=0;
 
-  vertices= qh_facetvertices (facetlist, facets, printall);
+  vertices= qh_facetvertices(facetlist, facets, printall);
   qh_vertexneighbors();
   FOREACHvertex_(vertices) {
     upperseen= lowerseen= False;
@@ -1850,17 +1922,17 @@
     }else
       vertex->seen= False;
   }
-  fprintf (fp, "%d\n", numpoints);
+  qh_fprintf(fp, 9091, "%d\n", numpoints);
   FOREACHvertex_(vertices) {
     if (vertex->seen)
-      fprintf (fp, "%d\n", qh_pointid (vertex->point));
+      qh_fprintf(fp, 9092, "%d\n", qh_pointid(vertex->point));
   }
-  qh_settempfree (&vertices);
+  qh_settempfree(&vertices);
 } /* printextremes_d */
 
 /*---------------------------------
-  
+
   qh_printfacet( fp, facet )
     prints all fields of a facet to fp
 
@@ -1869,18 +1941,18 @@
 */
 void qh_printfacet(FILE *fp, facetT *facet) {
 
-  qh_printfacetheader (fp, facet);
+  qh_printfacetheader(fp, facet);
   if (facet->ridges)
-    qh_printfacetridges (fp, facet);
+    qh_printfacetridges(fp, facet);
 } /* printfacet */
 
 
 /*---------------------------------
-  
+
   qh_printfacet2geom( fp, facet, color )
     print facet as part of a 2-d VECT for Geomview
-  
+
     notes:
       assume precise calculations in io.c with roundoff covered by qh_GEOMepsilon
       mindist is calculated within io.c.  maxoutside is calculated elsewhere
@@ -1891,49 +1963,49 @@
   realT mindist, innerplane, outerplane;
   int k;
 
-  qh_facet2point (facet, &point0, &point1, &mindist);
-  qh_geomplanes (facet, &outerplane, &innerplane);
+  qh_facet2point(facet, &point0, &point1, &mindist);
+  qh_geomplanes(facet, &outerplane, &innerplane);
   if (qh PRINTouter || (!qh PRINTnoplanes && !qh PRINTinner))
     qh_printfacet2geom_points(fp, point0, point1, facet, outerplane, color);
   if (qh PRINTinner || (!qh PRINTnoplanes && !qh PRINTouter &&
                 outerplane - innerplane > 2 * qh MAXabs_coord * qh_GEOMepsilon)) {
-    for(k= 3; k--; )
+    for (k=3; k--; )
       color[k]= 1.0 - color[k];
     qh_printfacet2geom_points(fp, point0, point1, facet, innerplane, color);
   }
-  qh_memfree (point1, qh normal_size);
-  qh_memfree (point0, qh normal_size); 
+  qh_memfree(point1, qh normal_size);
+  qh_memfree(point0, qh normal_size);
 } /* printfacet2geom */
 
 /*---------------------------------
-  
+
   qh_printfacet2geom_points( fp, point1, point2, facet, offset, color )
-    prints a 2-d facet as a VECT with 2 points at some offset.   
+    prints a 2-d facet as a VECT with 2 points at some offset.
     The points are on the facet's plane.
 */
 void qh_printfacet2geom_points(FILE *fp, pointT *point1, pointT *point2,
-			       facetT *facet, realT offset, realT color[3]) {
+                               facetT *facet, realT offset, realT color[3]) {
   pointT *p1= point1, *p2= point2;
 
-  fprintf(fp, "VECT 1 2 1 2 1 # f%d\n", facet->id);
+  qh_fprintf(fp, 9093, "VECT 1 2 1 2 1 # f%d\n", facet->id);
   if (offset != 0.0) {
-    p1= qh_projectpoint (p1, facet, -offset);
-    p2= qh_projectpoint (p2, facet, -offset);
+    p1= qh_projectpoint(p1, facet, -offset);
+    p2= qh_projectpoint(p2, facet, -offset);
   }
-  fprintf(fp, "%8.4g %8.4g %8.4g\n%8.4g %8.4g %8.4g\n",
+  qh_fprintf(fp, 9094, "%8.4g %8.4g %8.4g\n%8.4g %8.4g %8.4g\n",
            p1[0], p1[1], 0.0, p2[0], p2[1], 0.0);
   if (offset != 0.0) {
-    qh_memfree (p1, qh normal_size);
-    qh_memfree (p2, qh normal_size);
+    qh_memfree(p1, qh normal_size);
+    qh_memfree(p2, qh normal_size);
   }
-  fprintf(fp, "%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
+  qh_fprintf(fp, 9095, "%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
 } /* printfacet2geom_points */
 
 
 /*---------------------------------
-  
+
   qh_printfacet2math( fp, facet, format, notfirst )
     print 2-d Maple or Mathematica output for a facet
     may be non-simplicial
@@ -1942,30 +2014,30 @@
     use %16.8f since Mathematica 2.2 does not handle exponential format
     see qh_printfacet3math
 */
-void qh_printfacet2math(FILE *fp, facetT *facet, int format, int notfirst) {
+void qh_printfacet2math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst) {
   pointT *point0, *point1;
   realT mindist;
-  char *pointfmt;
-  
-  qh_facet2point (facet, &point0, &point1, &mindist);
+  const char *pointfmt;
+
+  qh_facet2point(facet, &point0, &point1, &mindist);
   if (notfirst)
-    fprintf(fp, ",");
+    qh_fprintf(fp, 9096, ",");
   if (format == qh_PRINTmaple)
     pointfmt= "[[%16.8f, %16.8f], [%16.8f, %16.8f]]\n";
   else
     pointfmt= "Line[{{%16.8f, %16.8f}, {%16.8f, %16.8f}}]\n";
-  fprintf(fp, pointfmt, point0[0], point0[1], point1[0], point1[1]);
-  qh_memfree (point1, qh normal_size);
-  qh_memfree (point0, qh normal_size);
+  qh_fprintf(fp, 9097, pointfmt, point0[0], point0[1], point1[0], point1[1]);
+  qh_memfree(point1, qh normal_size);
+  qh_memfree(point0, qh normal_size);
 } /* printfacet2math */
 
 
 /*---------------------------------
-  
+
   qh_printfacet3geom_nonsimplicial( fp, facet, color )
     print Geomview OFF for a 3-d nonsimplicial facet.
-    if DOintersections, prints ridges to unvisited neighbors (qh visit_id) 
+    if DOintersections, prints ridges to unvisited neighbors(qh visit_id)
 
   notes
     uses facet->visitid for intersections and ridges
@@ -1980,15 +2052,15 @@
   int cntvertices, k;
   realT black[3]={0, 0, 0}, green[3]={0, 1, 0};
 
-  qh_geomplanes (facet, &outerplane, &innerplane); 
-  vertices= qh_facet3vertex (facet); /* oriented */
+  qh_geomplanes(facet, &outerplane, &innerplane);
+  vertices= qh_facet3vertex(facet); /* oriented */
   cntvertices= qh_setsize(vertices);
   projectedpoints= qh_settemp(cntvertices);
   FOREACHvertex_(vertices) {
     zinc_(Zdistio);
     qh_distplane(vertex->point, facet, &dist);
     projpt= qh_projectpoint(vertex->point, facet, dist);
-    qh_setappend (&projectedpoints, projpt);
+    qh_setappend(&projectedpoints, projpt);
   }
   if (qh PRINTouter || (!qh PRINTnoplanes && !qh PRINTinner))
     qh_printfacet3geom_points(fp, projectedpoints, facet, outerplane, color);
@@ -1999,7 +2071,7 @@
     qh_printfacet3geom_points(fp, projectedpoints, facet, innerplane, color);
   }
   FOREACHpoint_(projectedpoints)
-    qh_memfree (point, qh normal_size);
+    qh_memfree(point, qh normal_size);
   qh_settempfree(&projectedpoints);
   qh_settempfree(&vertices);
   if ((qh DOintersections || qh PRINTridges)
@@ -2013,7 +2085,7 @@
         if (qh PRINTridges) {
           vertexA= SETfirstt_(ridge->vertices, vertexT);
           vertexB= SETsecondt_(ridge->vertices, vertexT);
-          qh_printline3geom (fp, vertexA->point, vertexB->point, green);
+          qh_printline3geom(fp, vertexA->point, vertexB->point, green);
         }
       }
     }
@@ -2022,9 +2094,9 @@
 
 /*---------------------------------
-  
+
   qh_printfacet3geom_points( fp, points, facet, offset )
-    prints a 3-d facet as OFF Geomview object. 
+    prints a 3-d facet as OFF Geomview object.
     offset is relative to the facet's hyperplane
     Facet is determined as a list of points
 */
@@ -2033,36 +2105,36 @@
   pointT *point, **pointp;
   setT *printpoints;
 
-  fprintf(fp, "{ OFF %d 1 1 # f%d\n", n, facet->id);
+  qh_fprintf(fp, 9098, "{ OFF %d 1 1 # f%d\n", n, facet->id);
   if (offset != 0.0) {
-    printpoints= qh_settemp (n);
-    FOREACHpoint_(points) 
-      qh_setappend (&printpoints, qh_projectpoint(point, facet, -offset));
+    printpoints= qh_settemp(n);
+    FOREACHpoint_(points)
+      qh_setappend(&printpoints, qh_projectpoint(point, facet, -offset));
   }else
     printpoints= points;
   FOREACHpoint_(printpoints) {
     for (k=0; k < qh hull_dim; k++) {
       if (k == qh DROPdim)
-        fprintf(fp, "0 ");
+        qh_fprintf(fp, 9099, "0 ");
       else
-        fprintf(fp, "%8.4g ", point[k]);
+        qh_fprintf(fp, 9100, "%8.4g ", point[k]);
     }
     if (printpoints != points)
-      qh_memfree (point, qh normal_size);
-    fprintf (fp, "\n");
+      qh_memfree(point, qh normal_size);
+    qh_fprintf(fp, 9101, "\n");
   }
   if (printpoints != points)
-    qh_settempfree (&printpoints);
-  fprintf(fp, "%d ", n);
-  for(i= 0; i < n; i++)
-    fprintf(fp, "%d ", i);
-  fprintf(fp, "%8.4g %8.4g %8.4g 1.0 }\n", color[0], color[1], color[2]);
+    qh_settempfree(&printpoints);
+  qh_fprintf(fp, 9102, "%d ", n);
+  for (i=0; i < n; i++)
+    qh_fprintf(fp, 9103, "%d ", i);
+  qh_fprintf(fp, 9104, "%8.4g %8.4g %8.4g 1.0 }\n", color[0], color[1], color[2]);
 } /* printfacet3geom_points */
 
 
 /*---------------------------------
-  
+
   qh_printfacet3geom_simplicial(  )
     print Geomview OFF for a 3-d simplicial facet.
 
@@ -2082,16 +2154,16 @@
   realT black[3]={0, 0, 0}, green[3]={0, 1, 0};
   int k;
 
-  qh_geomplanes (facet, &outerplane, &innerplane); 
-  vertices= qh_facet3vertex (facet);
-  points= qh_settemp (qh TEMPsize);
+  qh_geomplanes(facet, &outerplane, &innerplane);
+  vertices= qh_facet3vertex(facet);
+  points= qh_settemp(qh TEMPsize);
   FOREACHvertex_(vertices)
     qh_setappend(&points, vertex->point);
   if (qh PRINTouter || (!qh PRINTnoplanes && !qh PRINTinner))
     qh_printfacet3geom_points(fp, points, facet, outerplane, color);
   if (qh PRINTinner || (!qh PRINTnoplanes && !qh PRINTouter &&
               outerplane - innerplane > 2 * qh MAXabs_coord * qh_GEOMepsilon)) {
-    for (k= 3; k--; )
+    for (k=3; k--; )
       color[k]= 1.0 - color[k];
     qh_printfacet3geom_points(fp, points, facet, innerplane, color);
   }
@@ -2102,16 +2174,16 @@
     facet->visitid= qh visit_id;
     FOREACHneighbor_(facet) {
       if (neighbor->visitid != qh visit_id) {
-	vertices= qh_setnew_delnthsorted (facet->vertices, qh hull_dim,
-	                  SETindex_(facet->neighbors, neighbor), 0);
+        vertices= qh_setnew_delnthsorted(facet->vertices, qh hull_dim,
+                          SETindex_(facet->neighbors, neighbor), 0);
         if (qh DOintersections)
-	   qh_printhyperplaneintersection(fp, facet, neighbor, vertices, black); 
+           qh_printhyperplaneintersection(fp, facet, neighbor, vertices, black);
         if (qh PRINTridges) {
           vertexA= SETfirstt_(vertices, vertexT);
           vertexB= SETsecondt_(vertices, vertexT);
-          qh_printline3geom (fp, vertexA->point, vertexB->point, green);
+          qh_printline3geom(fp, vertexA->point, vertexB->point, green);
         }
-	qh_setfree(&vertices);
+        qh_setfree(&vertices);
       }
     }
   }
@@ -2119,7 +2191,7 @@
 
 /*---------------------------------
-  
+
   qh_printfacet3math( fp, facet, notfirst )
     print 3-d Maple or Mathematica output for a facet
 
@@ -2128,30 +2200,30 @@
     use %16.8f since Mathematica 2.2 does not handle exponential format
     see qh_printfacet2math
 */
-void qh_printfacet3math (FILE *fp, facetT *facet, int format, int notfirst) {
+void qh_printfacet3math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst) {
   vertexT *vertex, **vertexp;
   setT *points, *vertices;
   pointT *point, **pointp;
   boolT firstpoint= True;
   realT dist;
-  char *pointfmt, *endfmt;
-  
+  const char *pointfmt, *endfmt;
+
   if (notfirst)
-    fprintf(fp, ",\n");
-  vertices= qh_facet3vertex (facet);
-  points= qh_settemp (qh_setsize (vertices));
+    qh_fprintf(fp, 9105, ",\n");
+  vertices= qh_facet3vertex(facet);
+  points= qh_settemp(qh_setsize(vertices));
   FOREACHvertex_(vertices) {
     zinc_(Zdistio);
     qh_distplane(vertex->point, facet, &dist);
     point= qh_projectpoint(vertex->point, facet, dist);
-    qh_setappend (&points, point);
+    qh_setappend(&points, point);
   }
   if (format == qh_PRINTmaple) {
-    fprintf(fp, "[");
+    qh_fprintf(fp, 9106, "[");
     pointfmt= "[%16.8f, %16.8f, %16.8f]";
     endfmt= "]";
   }else {
-    fprintf(fp, "Polygon[{");
+    qh_fprintf(fp, 9107, "Polygon[{");
     pointfmt= "{%16.8f, %16.8f, %16.8f}";
     endfmt= "}]";
   }
@@ -2159,20 +2231,20 @@
     if (firstpoint)
       firstpoint= False;
     else
-      fprintf(fp, ",\n");
-    fprintf(fp, pointfmt, point[0], point[1], point[2]);
+      qh_fprintf(fp, 9108, ",\n");
+    qh_fprintf(fp, 9109, pointfmt, point[0], point[1], point[2]);
   }
   FOREACHpoint_(points)
-    qh_memfree (point, qh normal_size);
+    qh_memfree(point, qh normal_size);
   qh_settempfree(&points);
   qh_settempfree(&vertices);
-  fprintf(fp, endfmt);
+  qh_fprintf(fp, 9110, endfmt);
 } /* printfacet3math */
 
 
 /*---------------------------------
-  
+
   qh_printfacet3vertex( fp, facet, format )
     print vertices in a 3-d facet as point ids
 
@@ -2180,29 +2252,29 @@
     prints number of vertices first if format == qh_PRINToff
     the facet may be non-simplicial
 */
-void qh_printfacet3vertex(FILE *fp, facetT *facet, int format) {
+void qh_printfacet3vertex(FILE *fp, facetT *facet, qh_PRINT format) {
   vertexT *vertex, **vertexp;
   setT *vertices;
 
-  vertices= qh_facet3vertex (facet);
+  vertices= qh_facet3vertex(facet);
   if (format == qh_PRINToff)
-    fprintf (fp, "%d ", qh_setsize (vertices));
-  FOREACHvertex_(vertices) 
-    fprintf (fp, "%d ", qh_pointid(vertex->point));
-  fprintf (fp, "\n");
+    qh_fprintf(fp, 9111, "%d ", qh_setsize(vertices));
+  FOREACHvertex_(vertices)
+    qh_fprintf(fp, 9112, "%d ", qh_pointid(vertex->point));
+  qh_fprintf(fp, 9113, "\n");
   qh_settempfree(&vertices);
 } /* printfacet3vertex */
 
 
 /*---------------------------------
-  
+
   qh_printfacet4geom_nonsimplicial(  )
     print Geomview 4OFF file for a 4d nonsimplicial facet
     prints all ridges to unvisited neighbors (qh.visit_id)
     if qh.DROPdim
       prints in OFF format
-  
+
   notes:
     must agree with printend4geom()
 */
@@ -2213,38 +2285,38 @@
   pointT *point;
   int k;
   realT dist;
-  
+
   facet->visitid= qh visit_id;
   if (qh PRINTnoplanes || (facet->visible && qh NEWfacets))
     return;
   FOREACHridge_(facet->ridges) {
     neighbor= otherfacet_(ridge, facet);
-    if (neighbor->visitid == qh visit_id) 
+    if (neighbor->visitid == qh visit_id)
       continue;
     if (qh PRINTtransparent && !neighbor->good)
-      continue;  
+      continue;
     if (qh DOintersections)
       qh_printhyperplaneintersection(fp, facet, neighbor, ridge->vertices, color);
     else {
-      if (qh DROPdim >= 0) 
-	fprintf(fp, "OFF 3 1 1 # f%d\n", facet->id);
+      if (qh DROPdim >= 0)
+        qh_fprintf(fp, 9114, "OFF 3 1 1 # f%d\n", facet->id);
       else {
-	qh printoutvar++;
-	fprintf (fp, "# r%d between f%d f%d\n", ridge->id, facet->id, neighbor->id);
+        qh printoutvar++;
+        qh_fprintf(fp, 9115, "# r%d between f%d f%d\n", ridge->id, facet->id, neighbor->id);
       }
       FOREACHvertex_(ridge->vertices) {
-	zinc_(Zdistio);
-	qh_distplane(vertex->point,facet, &dist);
-	point=qh_projectpoint(vertex->point,facet, dist);
-	for(k= 0; k < qh hull_dim; k++) {
-	  if (k != qh DROPdim)
-  	    fprintf(fp, "%8.4g ", point[k]);
-  	}
-	fprintf (fp, "\n");
-	qh_memfree (point, qh normal_size);
+        zinc_(Zdistio);
+        qh_distplane(vertex->point,facet, &dist);
+        point=qh_projectpoint(vertex->point,facet, dist);
+        for (k=0; k < qh hull_dim; k++) {
+          if (k != qh DROPdim)
+            qh_fprintf(fp, 9116, "%8.4g ", point[k]);
+        }
+        qh_fprintf(fp, 9117, "\n");
+        qh_memfree(point, qh normal_size);
       }
       if (qh DROPdim >= 0)
-        fprintf(fp, "3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
+        qh_fprintf(fp, 9118, "3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
     }
   }
 } /* printfacet4geom_nonsimplicial */
@@ -2252,7 +2324,7 @@
 
 /*---------------------------------
-  
+
   qh_printfacet4geom_simplicial( fp, facet, color )
     print Geomview 4OFF file for a 4d simplicial facet
     prints triangles for unvisited neighbors (qh.visit_id)
@@ -2265,7 +2337,7 @@
   facetT *neighbor, **neighborp;
   vertexT *vertex, **vertexp;
   int k;
-  
+
   facet->visitid= qh visit_id;
   if (qh PRINTnoplanes || (facet->visible && qh NEWfacets))
     return;
@@ -2273,28 +2345,28 @@
     if (neighbor->visitid == qh visit_id)
       continue;
     if (qh PRINTtransparent && !neighbor->good)
-      continue;  
-    vertices= qh_setnew_delnthsorted (facet->vertices, qh hull_dim,
-	                  SETindex_(facet->neighbors, neighbor), 0);
+      continue;
+    vertices= qh_setnew_delnthsorted(facet->vertices, qh hull_dim,
+                          SETindex_(facet->neighbors, neighbor), 0);
     if (qh DOintersections)
       qh_printhyperplaneintersection(fp, facet, neighbor, vertices, color);
     else {
-      if (qh DROPdim >= 0) 
-	fprintf(fp, "OFF 3 1 1 # ridge between f%d f%d\n",
-		facet->id, neighbor->id);
+      if (qh DROPdim >= 0)
+        qh_fprintf(fp, 9119, "OFF 3 1 1 # ridge between f%d f%d\n",
+                facet->id, neighbor->id);
       else {
-	qh printoutvar++;
-	fprintf (fp, "# ridge between f%d f%d\n", facet->id, neighbor->id);
+        qh printoutvar++;
+        qh_fprintf(fp, 9120, "# ridge between f%d f%d\n", facet->id, neighbor->id);
       }
       FOREACHvertex_(vertices) {
-	for(k= 0; k < qh hull_dim; k++) {
-	  if (k != qh DROPdim)
-  	    fprintf(fp, "%8.4g ", vertex->point[k]);
-  	}
-	fprintf (fp, "\n");
+        for (k=0; k < qh hull_dim; k++) {
+          if (k != qh DROPdim)
+            qh_fprintf(fp, 9121, "%8.4g ", vertex->point[k]);
+        }
+        qh_fprintf(fp, 9122, "\n");
       }
-      if (qh DROPdim >= 0) 
-        fprintf(fp, "3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
+      if (qh DROPdim >= 0)
+        qh_fprintf(fp, 9123, "3 0 1 2 %8.4g %8.4g %8.4g\n", color[0], color[1], color[2]);
     }
     qh_setfree(&vertices);
   }
@@ -2303,12 +2375,12 @@
 
 /*---------------------------------
-  
+
   qh_printfacetNvertex_nonsimplicial( fp, facet, id, format )
     print vertices for an N-d non-simplicial facet
     triangulates each ridge to the id
 */
-void qh_printfacetNvertex_nonsimplicial(FILE *fp, facetT *facet, int id, int format) {
+void qh_printfacetNvertex_nonsimplicial(FILE *fp, facetT *facet, int id, qh_PRINT format) {
   vertexT *vertex, **vertexp;
   ridgeT *ridge, **ridgep;
 
@@ -2316,54 +2388,55 @@
     return;
   FOREACHridge_(facet->ridges) {
     if (format == qh_PRINTtriangles)
-      fprintf(fp, "%d ", qh hull_dim);
-    fprintf(fp, "%d ", id);
+      qh_fprintf(fp, 9124, "%d ", qh hull_dim);
+    qh_fprintf(fp, 9125, "%d ", id);
     if ((ridge->top == facet) ^ qh_ORIENTclock) {
       FOREACHvertex_(ridge->vertices)
-        fprintf(fp, "%d ", qh_pointid(vertex->point));
+        qh_fprintf(fp, 9126, "%d ", qh_pointid(vertex->point));
     }else {
       FOREACHvertexreverse12_(ridge->vertices)
-        fprintf(fp, "%d ", qh_pointid(vertex->point));
+        qh_fprintf(fp, 9127, "%d ", qh_pointid(vertex->point));
     }
-    fprintf(fp, "\n");
+    qh_fprintf(fp, 9128, "\n");
   }
 } /* printfacetNvertex_nonsimplicial */
 
 
 /*---------------------------------
-  
+
   qh_printfacetNvertex_simplicial( fp, facet, format )
     print vertices for an N-d simplicial facet
     prints vertices for non-simplicial facets
       2-d facets (orientation preserved by qh_mergefacet2d)
       PRINToff ('o') for 4-d and higher
 */
-void qh_printfacetNvertex_simplicial(FILE *fp, facetT *facet, int format) {
+void qh_printfacetNvertex_simplicial(FILE *fp, facetT *facet, qh_PRINT format) {
   vertexT *vertex, **vertexp;
 
   if (format == qh_PRINToff || format == qh_PRINTtriangles)
-    fprintf (fp, "%d ", qh_setsize (facet->vertices));
-  if ((facet->toporient ^ qh_ORIENTclock) 
+    qh_fprintf(fp, 9129, "%d ", qh_setsize(facet->vertices));
+  if ((facet->toporient ^ qh_ORIENTclock)
   || (qh hull_dim > 2 && !facet->simplicial)) {
     FOREACHvertex_(facet->vertices)
-      fprintf(fp, "%d ", qh_pointid(vertex->point));
+      qh_fprintf(fp, 9130, "%d ", qh_pointid(vertex->point));
   }else {
     FOREACHvertexreverse12_(facet->vertices)
-      fprintf(fp, "%d ", qh_pointid(vertex->point));
+      qh_fprintf(fp, 9131, "%d ", qh_pointid(vertex->point));
   }
-  fprintf(fp, "\n");
+  qh_fprintf(fp, 9132, "\n");
 } /* printfacetNvertex_simplicial */
 
 
 /*---------------------------------
-  
+
   qh_printfacetheader( fp, facet )
     prints header fields of a facet to fp
-    
+
   notes:
     for 'f' output and debugging
+    Same as QhullFacet::printHeader()
 */
 void qh_printfacetheader(FILE *fp, facetT *facet) {
   pointT *point, **pointp, *furthest;
@@ -2371,134 +2444,134 @@
   realT dist;
 
   if (facet == qh_MERGEridge) {
-    fprintf (fp, " MERGEridge\n");
+    qh_fprintf(fp, 9133, " MERGEridge\n");
     return;
   }else if (facet == qh_DUPLICATEridge) {
-    fprintf (fp, " DUPLICATEridge\n");
+    qh_fprintf(fp, 9134, " DUPLICATEridge\n");
     return;
   }else if (!facet) {
-    fprintf (fp, " NULLfacet\n");
+    qh_fprintf(fp, 9135, " NULLfacet\n");
     return;
   }
   qh old_randomdist= qh RANDOMdist;
   qh RANDOMdist= False;
-  fprintf(fp, "- f%d\n", facet->id);
-  fprintf(fp, "    - flags:");
-  if (facet->toporient) 
-    fprintf(fp, " top");
+  qh_fprintf(fp, 9136, "- f%d\n", facet->id);
+  qh_fprintf(fp, 9137, "    - flags:");
+  if (facet->toporient)
+    qh_fprintf(fp, 9138, " top");
   else
-    fprintf(fp, " bottom");
+    qh_fprintf(fp, 9139, " bottom");
   if (facet->simplicial)
-    fprintf(fp, " simplicial");
+    qh_fprintf(fp, 9140, " simplicial");
   if (facet->tricoplanar)
-    fprintf(fp, " tricoplanar");
+    qh_fprintf(fp, 9141, " tricoplanar");
   if (facet->upperdelaunay)
-    fprintf(fp, " upperDelaunay");
+    qh_fprintf(fp, 9142, " upperDelaunay");
   if (facet->visible)
-    fprintf(fp, " visible");
+    qh_fprintf(fp, 9143, " visible");
   if (facet->newfacet)
-    fprintf(fp, " new");
+    qh_fprintf(fp, 9144, " new");
   if (facet->tested)
-    fprintf(fp, " tested");
+    qh_fprintf(fp, 9145, " tested");
   if (!facet->good)
-    fprintf(fp, " notG");
+    qh_fprintf(fp, 9146, " notG");
   if (facet->seen)
-    fprintf(fp, " seen");
+    qh_fprintf(fp, 9147, " seen");
   if (facet->coplanar)
-    fprintf(fp, " coplanar");
+    qh_fprintf(fp, 9148, " coplanar");
   if (facet->mergehorizon)
-    fprintf(fp, " mergehorizon");
+    qh_fprintf(fp, 9149, " mergehorizon");
   if (facet->keepcentrum)
-    fprintf(fp, " keepcentrum");
+    qh_fprintf(fp, 9150, " keepcentrum");
   if (facet->dupridge)
-    fprintf(fp, " dupridge");
+    qh_fprintf(fp, 9151, " dupridge");
   if (facet->mergeridge && !facet->mergeridge2)
-    fprintf(fp, " mergeridge1");
+    qh_fprintf(fp, 9152, " mergeridge1");
   if (facet->mergeridge2)
-    fprintf(fp, " mergeridge2");
+    qh_fprintf(fp, 9153, " mergeridge2");
   if (facet->newmerge)
-    fprintf(fp, " newmerge");
-  if (facet->flipped) 
-    fprintf(fp, " flipped");
-  if (facet->notfurthest) 
-    fprintf(fp, " notfurthest");
+    qh_fprintf(fp, 9154, " newmerge");
+  if (facet->flipped)
+    qh_fprintf(fp, 9155, " flipped");
+  if (facet->notfurthest)
+    qh_fprintf(fp, 9156, " notfurthest");
   if (facet->degenerate)
-    fprintf(fp, " degenerate");
+    qh_fprintf(fp, 9157, " degenerate");
   if (facet->redundant)
-    fprintf(fp, " redundant");
-  fprintf(fp, "\n");
+    qh_fprintf(fp, 9158, " redundant");
+  qh_fprintf(fp, 9159, "\n");
   if (facet->isarea)
-    fprintf(fp, "    - area: %2.2g\n", facet->f.area);
+    qh_fprintf(fp, 9160, "    - area: %2.2g\n", facet->f.area);
   else if (qh NEWfacets && facet->visible && facet->f.replace)
-    fprintf(fp, "    - replacement: f%d\n", facet->f.replace->id);
+    qh_fprintf(fp, 9161, "    - replacement: f%d\n", facet->f.replace->id);
   else if (facet->newfacet) {
     if (facet->f.samecycle && facet->f.samecycle != facet)
-      fprintf(fp, "    - shares same visible/horizon as f%d\n", facet->f.samecycle->id);
+      qh_fprintf(fp, 9162, "    - shares same visible/horizon as f%d\n", facet->f.samecycle->id);
   }else if (facet->tricoplanar /* !isarea */) {
     if (facet->f.triowner)
-      fprintf(fp, "    - owner of normal & centrum is facet f%d\n", facet->f.triowner->id);
+      qh_fprintf(fp, 9163, "    - owner of normal & centrum is facet f%d\n", facet->f.triowner->id);
   }else if (facet->f.newcycle)
-    fprintf(fp, "    - was horizon to f%d\n", facet->f.newcycle->id);
+    qh_fprintf(fp, 9164, "    - was horizon to f%d\n", facet->f.newcycle->id);
   if (facet->nummerge)
-    fprintf(fp, "    - merges: %d\n", facet->nummerge);
+    qh_fprintf(fp, 9165, "    - merges: %d\n", facet->nummerge);
   qh_printpointid(fp, "    - normal: ", qh hull_dim, facet->normal, -1);
-  fprintf(fp, "    - offset: %10.7g\n", facet->offset);
+  qh_fprintf(fp, 9166, "    - offset: %10.7g\n", facet->offset);
   if (qh CENTERtype == qh_ASvoronoi || facet->center)
-    qh_printcenter (fp, qh_PRINTfacets, "    - center: ", facet);
+    qh_printcenter(fp, qh_PRINTfacets, "    - center: ", facet);
 #if qh_MAXoutside
   if (facet->maxoutside > qh DISTround)
-    fprintf(fp, "    - maxoutside: %10.7g\n", facet->maxoutside);
+    qh_fprintf(fp, 9167, "    - maxoutside: %10.7g\n", facet->maxoutside);
 #endif
   if (!SETempty_(facet->outsideset)) {
     furthest= (pointT*)qh_setlast(facet->outsideset);
-    if (qh_setsize (facet->outsideset) < 6) {
-      fprintf(fp, "    - outside set (furthest p%d):\n", qh_pointid(furthest));
+    if (qh_setsize(facet->outsideset) < 6) {
+      qh_fprintf(fp, 9168, "    - outside set(furthest p%d):\n", qh_pointid(furthest));
       FOREACHpoint_(facet->outsideset)
-	qh_printpoint(fp, "     ", point);
-    }else if (qh_setsize (facet->outsideset) < 21) {
+        qh_printpoint(fp, "     ", point);
+    }else if (qh_setsize(facet->outsideset) < 21) {
       qh_printpoints(fp, "    - outside set:", facet->outsideset);
     }else {
-      fprintf(fp, "    - outside set:  %d points.", qh_setsize(facet->outsideset));
+      qh_fprintf(fp, 9169, "    - outside set:  %d points.", qh_setsize(facet->outsideset));
       qh_printpoint(fp, "  Furthest", furthest);
     }
 #if !qh_COMPUTEfurthest
-    fprintf(fp, "    - furthest distance= %2.2g\n", facet->furthestdist);
+    qh_fprintf(fp, 9170, "    - furthest distance= %2.2g\n", facet->furthestdist);
 #endif
   }
   if (!SETempty_(facet->coplanarset)) {
     furthest= (pointT*)qh_setlast(facet->coplanarset);
-    if (qh_setsize (facet->coplanarset) < 6) {
-      fprintf(fp, "    - coplanar set (furthest p%d):\n", qh_pointid(furthest));
+    if (qh_setsize(facet->coplanarset) < 6) {
+      qh_fprintf(fp, 9171, "    - coplanar set(furthest p%d):\n", qh_pointid(furthest));
       FOREACHpoint_(facet->coplanarset)
-	qh_printpoint(fp, "     ", point);
-    }else if (qh_setsize (facet->coplanarset) < 21) {
+        qh_printpoint(fp, "     ", point);
+    }else if (qh_setsize(facet->coplanarset) < 21) {
       qh_printpoints(fp, "    - coplanar set:", facet->coplanarset);
     }else {
-      fprintf(fp, "    - coplanar set:  %d points.", qh_setsize(facet->coplanarset));
+      qh_fprintf(fp, 9172, "    - coplanar set:  %d points.", qh_setsize(facet->coplanarset));
       qh_printpoint(fp, "  Furthest", furthest);
     }
     zinc_(Zdistio);
-    qh_distplane (furthest, facet, &dist);
-    fprintf(fp, "      furthest distance= %2.2g\n", dist);
+    qh_distplane(furthest, facet, &dist);
+    qh_fprintf(fp, 9173, "      furthest distance= %2.2g\n", dist);
   }
-  qh_printvertices (fp, "    - vertices:", facet->vertices);
-  fprintf(fp, "    - neighboring facets: ");
+  qh_printvertices(fp, "    - vertices:", facet->vertices);
+  qh_fprintf(fp, 9174, "    - neighboring facets:");
   FOREACHneighbor_(facet) {
     if (neighbor == qh_MERGEridge)
-      fprintf(fp, " MERGE");
+      qh_fprintf(fp, 9175, " MERGE");
     else if (neighbor == qh_DUPLICATEridge)
-      fprintf(fp, " DUP");
+      qh_fprintf(fp, 9176, " DUP");
     else
-      fprintf(fp, " f%d", neighbor->id);
+      qh_fprintf(fp, 9177, " f%d", neighbor->id);
   }
-  fprintf(fp, "\n");
+  qh_fprintf(fp, 9178, "\n");
   qh RANDOMdist= qh old_randomdist;
 } /* printfacetheader */
 
 
 /*---------------------------------
-  
+
   qh_printfacetridges( fp, facet )
     prints ridges of a facet to fp
 
@@ -2506,6 +2579,7 @@
     ridges printed in neighbor order
     assumes the ridges exist
     for 'f' output
+    same as QhullFacet::printRidges
 */
 void qh_printfacetridges(FILE *fp, facetT *facet) {
   facetT *neighbor, **neighborp;
@@ -2514,57 +2588,57 @@
 
 
   if (facet->visible && qh NEWfacets) {
-    fprintf(fp, "    - ridges (ids may be garbage):");
+    qh_fprintf(fp, 9179, "    - ridges(ids may be garbage):");
     FOREACHridge_(facet->ridges)
-      fprintf(fp, " r%d", ridge->id);
-    fprintf(fp, "\n");
+      qh_fprintf(fp, 9180, " r%d", ridge->id);
+    qh_fprintf(fp, 9181, "\n");
   }else {
-    fprintf(fp, "    - ridges:\n");
+    qh_fprintf(fp, 9182, "    - ridges:\n");
     FOREACHridge_(facet->ridges)
       ridge->seen= False;
     if (qh hull_dim == 3) {
       ridge= SETfirstt_(facet->ridges, ridgeT);
       while (ridge && !ridge->seen) {
-	ridge->seen= True;
-	qh_printridge(fp, ridge);
-	numridges++;
-	ridge= qh_nextridge3d (ridge, facet, NULL);
-	}
+        ridge->seen= True;
+        qh_printridge(fp, ridge);
+        numridges++;
+        ridge= qh_nextridge3d(ridge, facet, NULL);
+        }
     }else {
       FOREACHneighbor_(facet) {
-	FOREACHridge_(facet->ridges) {
-	  if (otherfacet_(ridge,facet) == neighbor) {
-	    ridge->seen= True;
-	    qh_printridge(fp, ridge);
-	    numridges++;
-	  }
-	}
+        FOREACHridge_(facet->ridges) {
+          if (otherfacet_(ridge,facet) == neighbor) {
+            ridge->seen= True;
+            qh_printridge(fp, ridge);
+            numridges++;
+          }
+        }
       }
     }
-    if (numridges != qh_setsize (facet->ridges)) {
-      fprintf (fp, "     - all ridges:");
-      FOREACHridge_(facet->ridges) 
-	fprintf (fp, " r%d", ridge->id);
-        fprintf (fp, "\n");
+    if (numridges != qh_setsize(facet->ridges)) {
+      qh_fprintf(fp, 9183, "     - all ridges:");
+      FOREACHridge_(facet->ridges)
+        qh_fprintf(fp, 9184, " r%d", ridge->id);
+        qh_fprintf(fp, 9185, "\n");
     }
     FOREACHridge_(facet->ridges) {
-      if (!ridge->seen) 
-	qh_printridge(fp, ridge);
+      if (!ridge->seen)
+        qh_printridge(fp, ridge);
     }
   }
 } /* printfacetridges */
 
 /*---------------------------------
-  
+
   qh_printfacets( fp, format, facetlist, facets, printall )
     prints facetlist and/or facet set in output format
-  
+
   notes:
     also used for specialized formats ('FO' and summary)
     turns off 'Rn' option since want actual numbers
 */
-void qh_printfacets(FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall) {
+void qh_printfacets(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall) {
   int numfacets, numsimplicial, numridges, totneighbors, numcoplanars, numtricoplanars;
   facetT *facet, **facetp;
   setT *vertices;
@@ -2574,362 +2648,193 @@
   qh old_randomdist= qh RANDOMdist;
   qh RANDOMdist= False;
   if (qh CDDoutput && (format == qh_PRINTcentrums || format == qh_PRINTpointintersect || format == qh_PRINToff))
-    fprintf (qh ferr, "qhull warning: CDD format is not available for centrums, halfspace\nintersections, and OFF file format.\n");
+    qh_fprintf(qh ferr, 7056, "qhull warning: CDD format is not available for centrums, halfspace\nintersections, and OFF file format.\n");
   if (format == qh_PRINTnone)
     ; /* print nothing */
   else if (format == qh_PRINTaverage) {
-    vertices= qh_facetvertices (facetlist, facets, printall);
-    center= qh_getcenter (vertices);
-    fprintf (fp, "%d 1\n", qh hull_dim);
-    qh_printpointid (fp, NULL, qh hull_dim, center, -1);
-    qh_memfree (center, qh normal_size);
-    qh_settempfree (&vertices);
+    vertices= qh_facetvertices(facetlist, facets, printall);
+    center= qh_getcenter(vertices);
+    qh_fprintf(fp, 9186, "%d 1\n", qh hull_dim);
+    qh_printpointid(fp, NULL, qh hull_dim, center, -1);
+    qh_memfree(center, qh normal_size);
+    qh_settempfree(&vertices);
   }else if (format == qh_PRINTextremes) {
     if (qh DELAUNAY)
-      qh_printextremes_d (fp, facetlist, facets, printall);
+      qh_printextremes_d(fp, facetlist, facets, printall);
     else if (qh hull_dim == 2)
-      qh_printextremes_2d (fp, facetlist, facets, printall);
-    else 
-      qh_printextremes (fp, facetlist, facets, printall);
+      qh_printextremes_2d(fp, facetlist, facets, printall);
+    else
+      qh_printextremes(fp, facetlist, facets, printall);
   }else if (format == qh_PRINToptions)
-    fprintf(fp, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
+    qh_fprintf(fp, 9187, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
   else if (format == qh_PRINTpoints && !qh VORONOI)
-    qh_printpoints_out (fp, facetlist, facets, printall);
+    qh_printpoints_out(fp, facetlist, facets, printall);
   else if (format == qh_PRINTqhull)
-    fprintf (fp, "%s | %s\n", qh rbox_command, qh qhull_command);
+    qh_fprintf(fp, 9188, "%s | %s\n", qh rbox_command, qh qhull_command);
   else if (format == qh_PRINTsize) {
-    fprintf (fp, "0\n2 ");
-    fprintf (fp, qh_REAL_1, qh totarea);
-    fprintf (fp, qh_REAL_1, qh totvol);
-    fprintf (fp, "\n");
+    qh_fprintf(fp, 9189, "0\n2 ");
+    qh_fprintf(fp, 9190, qh_REAL_1, qh totarea);
+    qh_fprintf(fp, 9191, qh_REAL_1, qh totvol);
+    qh_fprintf(fp, 9192, "\n");
   }else if (format == qh_PRINTsummary) {
-    qh_countfacets (facetlist, facets, printall, &numfacets, &numsimplicial, 
+    qh_countfacets(facetlist, facets, printall, &numfacets, &numsimplicial,
       &totneighbors, &numridges, &numcoplanars, &numtricoplanars);
-    vertices= qh_facetvertices (facetlist, facets, printall); 
-    fprintf (fp, "10 %d %d %d %d %d %d %d %d %d %d\n2 ", qh hull_dim, 
-                qh num_points + qh_setsize (qh other_points),
+    vertices= qh_facetvertices(facetlist, facets, printall);
+    qh_fprintf(fp, 9193, "10 %d %d %d %d %d %d %d %d %d %d\n2 ", qh hull_dim,
+                qh num_points + qh_setsize(qh other_points),
                 qh num_vertices, qh num_facets - qh num_visible,
-                qh_setsize (vertices), numfacets, numcoplanars, 
-		numfacets - numsimplicial, zzval_(Zdelvertextot), 
-		numtricoplanars);
-    qh_settempfree (&vertices);
-    qh_outerinner (NULL, &outerplane, &innerplane);
-    fprintf (fp, qh_REAL_2n, outerplane, innerplane);
+                qh_setsize(vertices), numfacets, numcoplanars,
+                numfacets - numsimplicial, zzval_(Zdelvertextot),
+                numtricoplanars);
+    qh_settempfree(&vertices);
+    qh_outerinner(NULL, &outerplane, &innerplane);
+    qh_fprintf(fp, 9194, qh_REAL_2n, outerplane, innerplane);
   }else if (format == qh_PRINTvneighbors)
-    qh_printvneighbors (fp, facetlist, facets, printall);
+    qh_printvneighbors(fp, facetlist, facets, printall);
   else if (qh VORONOI && format == qh_PRINToff)
-    qh_printvoronoi (fp, format, facetlist, facets, printall);
+    qh_printvoronoi(fp, format, facetlist, facets, printall);
   else if (qh VORONOI && format == qh_PRINTgeom) {
-    qh_printbegin (fp, format, facetlist, facets, printall);
-    qh_printvoronoi (fp, format, facetlist, facets, printall);
-    qh_printend (fp, format, facetlist, facets, printall);
-  }else if (qh VORONOI 
+    qh_printbegin(fp, format, facetlist, facets, printall);
+    qh_printvoronoi(fp, format, facetlist, facets, printall);
+    qh_printend(fp, format, facetlist, facets, printall);
+  }else if (qh VORONOI
   && (format == qh_PRINTvertices || format == qh_PRINTinner || format == qh_PRINTouter))
-    qh_printvdiagram (fp, format, facetlist, facets, printall);
+    qh_printvdiagram(fp, format, facetlist, facets, printall);
   else {
-    qh_printbegin (fp, format, facetlist, facets, printall);
+    qh_printbegin(fp, format, facetlist, facets, printall);
     FORALLfacet_(facetlist)
-      qh_printafacet (fp, format, facet, printall);
-    FOREACHfacet_(facets) 
-      qh_printafacet (fp, format, facet, printall);
-    qh_printend (fp, format, facetlist, facets, printall);
+      qh_printafacet(fp, format, facet, printall);
+    FOREACHfacet_(facets)
+      qh_printafacet(fp, format, facet, printall);
+    qh_printend(fp, format, facetlist, facets, printall);
   }
   qh RANDOMdist= qh old_randomdist;
 } /* printfacets */
 
 
 /*---------------------------------
-  
-  qh_printhelp_degenerate( fp )
-    prints descriptive message for precision error
-
-  notes:
-    no message if qh_QUICKhelp
-*/
-void qh_printhelp_degenerate(FILE *fp) {
-  
-  if (qh MERGEexact || qh PREmerge || qh JOGGLEmax < REALmax/2) 
-    fprintf(fp, "\n\
-A Qhull error has occurred.  Qhull should have corrected the above\n\
-precision error.  Please send the input and all of the output to\n\
-qhull_bug at qhull.org\n");
-  else if (!qh_QUICKhelp) {
-    fprintf(fp, "\n\
-Precision problems were detected during construction of the convex hull.\n\
-This occurs because convex hull algorithms assume that calculations are\n\
-exact, but floating-point arithmetic has roundoff errors.\n\
-\n\
-To correct for precision problems, do not use 'Q0'.  By default, Qhull\n\
-selects 'C-0' or 'Qx' and merges non-convex facets.  With option 'QJ',\n\
-Qhull joggles the input to prevent precision problems.  See \"Imprecision\n\
-in Qhull\" (qh-impre.htm).\n\
-\n\
-If you use 'Q0', the output may include\n\
-coplanar ridges, concave ridges, and flipped facets.  In 4-d and higher,\n\
-Qhull may produce a ridge with four neighbors or two facets with the same \n\
-vertices.  Qhull reports these events when they occur.  It stops when a\n\
-concave ridge, flipped facet, or duplicate facet occurs.\n");
-#if REALfloat
-    fprintf (fp, "\
-\n\
-Qhull is currently using single precision arithmetic.  The following\n\
-will probably remove the precision problems:\n\
-  - recompile qhull for double precision (#define REALfloat 0 in user.h).\n");
-#endif
-    if (qh DELAUNAY && !qh SCALElast && qh MAXabs_coord > 1e4)
-      fprintf( fp, "\
-\n\
-When computing the Delaunay triangulation of coordinates > 1.0,\n\
-  - use 'Qbb' to scale the last coordinate to [0,m] (max previous coordinate)\n");
-    if (qh DELAUNAY && !qh ATinfinity) 
-      fprintf( fp, "\
-When computing the Delaunay triangulation:\n\
-  - use 'Qz' to add a point at-infinity.  This reduces precision problems.\n");
- 
-    fprintf(fp, "\
-\n\
-If you need triangular output:\n\
-  - use option 'Qt' to triangulate the output\n\
-  - use option 'QJ' to joggle the input points and remove precision errors\n\
-  - use option 'Ft'.  It triangulates non-simplicial facets with added points.\n\
-\n\
-If you must use 'Q0',\n\
-try one or more of the following options.  They can not guarantee an output.\n\
-  - use 'QbB' to scale the input to a cube.\n\
-  - use 'Po' to produce output and prevent partitioning for flipped facets\n\
-  - use 'V0' to set min. distance to visible facet as 0 instead of roundoff\n\
-  - use 'En' to specify a maximum roundoff error less than %2.2g.\n\
-  - options 'Qf', 'Qbb', and 'QR0' may also help\n",
-               qh DISTround);
-    fprintf(fp, "\
-\n\
-To guarantee simplicial output:\n\
-  - use option 'Qt' to triangulate the output\n\
-  - use option 'QJ' to joggle the input points and remove precision errors\n\
-  - use option 'Ft' to triangulate the output by adding points\n\
-  - use exact arithmetic (see \"Imprecision in Qhull\", qh-impre.htm)\n\
-");
-  }
-} /* printhelp_degenerate */
-
-
-/*---------------------------------
-  
-  qh_printhelp_singular( fp )
-    prints descriptive message for singular input
-*/
-void qh_printhelp_singular(FILE *fp) {
-  facetT *facet;
-  vertexT *vertex, **vertexp;
-  realT min, max, *coord, dist;
-  int i,k;
-  
-  fprintf(fp, "\n\
-The input to qhull appears to be less than %d dimensional, or a\n\
-computation has overflowed.\n\n\
-Qhull could not construct a clearly convex simplex from points:\n",
-           qh hull_dim);
-  qh_printvertexlist (fp, "", qh facet_list, NULL, qh_ALL);
-  if (!qh_QUICKhelp)
-    fprintf(fp, "\n\
-The center point is coplanar with a facet, or a vertex is coplanar\n\
-with a neighboring facet.  The maximum round off error for\n\
-computing distances is %2.2g.  The center point, facets and distances\n\
-to the center point are as follows:\n\n", qh DISTround);
-  qh_printpointid (fp, "center point", qh hull_dim, qh interior_point, -1);
-  fprintf (fp, "\n");
-  FORALLfacets {
-    fprintf (fp, "facet");
-    FOREACHvertex_(facet->vertices)
-      fprintf (fp, " p%d", qh_pointid(vertex->point));
-    zinc_(Zdistio);
-    qh_distplane(qh interior_point, facet, &dist);
-    fprintf (fp, " distance= %4.2g\n", dist);
-  }
-  if (!qh_QUICKhelp) {
-    if (qh HALFspace) 
-      fprintf (fp, "\n\
-These points are the dual of the given halfspaces.  They indicate that\n\
-the intersection is degenerate.\n");
-    fprintf (fp,"\n\
-These points either have a maximum or minimum x-coordinate, or\n\
-they maximize the determinant for k coordinates.  Trial points\n\
-are first selected from points that maximize a coordinate.\n");
-    if (qh hull_dim >= qh_INITIALmax)
-      fprintf (fp, "\n\
-Because of the high dimension, the min x-coordinate and max-coordinate\n\
-points are used if the determinant is non-zero.  Option 'Qs' will\n\
-do a better, though much slower, job.  Instead of 'Qs', you can change\n\
-the points by randomly rotating the input with 'QR0'.\n");
-  }
-  fprintf (fp, "\nThe min and max coordinates for each dimension are:\n");
-  for (k=0; k < qh hull_dim; k++) {
-    min= REALmax;
-    max= -REALmin;
-    for (i=qh num_points, coord= qh first_point+k; i--; coord += qh hull_dim) {
-      maximize_(max, *coord);
-      minimize_(min, *coord);
-    }
-    fprintf (fp, "  %d:  %8.4g  %8.4g  difference= %4.4g\n", k, min, max, max-min);
-  }
-  if (!qh_QUICKhelp) {
-    fprintf (fp, "\n\
-If the input should be full dimensional, you have several options that\n\
-may determine an initial simplex:\n\
-  - use 'QJ'  to joggle the input and make it full dimensional\n\
-  - use 'QbB' to scale the points to the unit cube\n\
-  - use 'QR0' to randomly rotate the input for different maximum points\n\
-  - use 'Qs'  to search all points for the initial simplex\n\
-  - use 'En'  to specify a maximum roundoff error less than %2.2g.\n\
-  - trace execution with 'T3' to see the determinant for each point.\n",
-                     qh DISTround);
-#if REALfloat
-    fprintf (fp, "\
-  - recompile qhull for double precision (#define REALfloat 0 in qhull.h).\n");
-#endif
-    fprintf (fp, "\n\
-If the input is lower dimensional:\n\
-  - use 'QJ' to joggle the input and make it full dimensional\n\
-  - use 'Qbk:0Bk:0' to delete coordinate k from the input.  You should\n\
-    pick the coordinate with the least range.  The hull will have the\n\
-    correct topology.\n\
-  - determine the flat containing the points, rotate the points\n\
-    into a coordinate plane, and delete the other coordinates.\n\
-  - add one or more points to make the input full dimensional.\n\
-");
-    if (qh DELAUNAY && !qh ATinfinity)
-      fprintf (fp, "\n\n\
-This is a Delaunay triangulation and the input is co-circular or co-spherical:\n\
-  - use 'Qz' to add a point \"at infinity\" (i.e., above the paraboloid)\n\
-  - or use 'QJ' to joggle the input and avoid co-circular data\n");
-  }
-} /* printhelp_singular */
-
-/*---------------------------------
-  
+
   qh_printhyperplaneintersection( fp, facet1, facet2, vertices, color )
     print Geomview OFF or 4OFF for the intersection of two hyperplanes in 3-d or 4-d
 */
 void qh_printhyperplaneintersection(FILE *fp, facetT *facet1, facetT *facet2,
-		   setT *vertices, realT color[3]) {
+                   setT *vertices, realT color[3]) {
   realT costheta, denominator, dist1, dist2, s, t, mindenom, p[4];
   vertexT *vertex, **vertexp;
   int i, k;
   boolT nearzero1, nearzero2;
-  
+
   costheta= qh_getangle(facet1->normal, facet2->normal);
   denominator= 1 - costheta * costheta;
   i= qh_setsize(vertices);
   if (qh hull_dim == 3)
-    fprintf(fp, "VECT 1 %d 1 %d 1 ", i, i);
+    qh_fprintf(fp, 9195, "VECT 1 %d 1 %d 1 ", i, i);
   else if (qh hull_dim == 4 && qh DROPdim >= 0)
-    fprintf(fp, "OFF 3 1 1 ");
+    qh_fprintf(fp, 9196, "OFF 3 1 1 ");
   else
     qh printoutvar++;
-  fprintf (fp, "# intersect f%d f%d\n", facet1->id, facet2->id);
+  qh_fprintf(fp, 9197, "# intersect f%d f%d\n", facet1->id, facet2->id);
   mindenom= 1 / (10.0 * qh MAXabs_coord);
   FOREACHvertex_(vertices) {
     zadd_(Zdistio, 2);
     qh_distplane(vertex->point, facet1, &dist1);
     qh_distplane(vertex->point, facet2, &dist2);
-    s= qh_divzero (-dist1 + costheta * dist2, denominator,mindenom,&nearzero1);
-    t= qh_divzero (-dist2 + costheta * dist1, denominator,mindenom,&nearzero2);
+    s= qh_divzero(-dist1 + costheta * dist2, denominator,mindenom,&nearzero1);
+    t= qh_divzero(-dist2 + costheta * dist1, denominator,mindenom,&nearzero2);
     if (nearzero1 || nearzero2)
       s= t= 0.0;
-    for(k= qh hull_dim; k--; )
+    for (k=qh hull_dim; k--; )
       p[k]= vertex->point[k] + facet1->normal[k] * s + facet2->normal[k] * t;
     if (qh PRINTdim <= 3) {
       qh_projectdim3 (p, p);
-      fprintf(fp, "%8.4g %8.4g %8.4g # ", p[0], p[1], p[2]);
-    }else 
-      fprintf(fp, "%8.4g %8.4g %8.4g %8.4g # ", p[0], p[1], p[2], p[3]);
+      qh_fprintf(fp, 9198, "%8.4g %8.4g %8.4g # ", p[0], p[1], p[2]);
+    }else
+      qh_fprintf(fp, 9199, "%8.4g %8.4g %8.4g %8.4g # ", p[0], p[1], p[2], p[3]);
     if (nearzero1+nearzero2)
-      fprintf (fp, "p%d (coplanar facets)\n", qh_pointid (vertex->point));
+      qh_fprintf(fp, 9200, "p%d(coplanar facets)\n", qh_pointid(vertex->point));
     else
-      fprintf (fp, "projected p%d\n", qh_pointid (vertex->point));
+      qh_fprintf(fp, 9201, "projected p%d\n", qh_pointid(vertex->point));
   }
   if (qh hull_dim == 3)
-    fprintf(fp, "%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]); 
-  else if (qh hull_dim == 4 && qh DROPdim >= 0)  
-    fprintf(fp, "3 0 1 2 %8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
+    qh_fprintf(fp, 9202, "%8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
+  else if (qh hull_dim == 4 && qh DROPdim >= 0)
+    qh_fprintf(fp, 9203, "3 0 1 2 %8.4g %8.4g %8.4g 1.0\n", color[0], color[1], color[2]);
 } /* printhyperplaneintersection */
 
 /*---------------------------------
-  
+
   qh_printline3geom( fp, pointA, pointB, color )
     prints a line as a VECT
     prints 0's for qh.DROPdim
-  
+
   notes:
-    if pointA == pointB, 
+    if pointA == pointB,
       it's a 1 point VECT
 */
-void qh_printline3geom (FILE *fp, pointT *pointA, pointT *pointB, realT color[3]) {
+void qh_printline3geom(FILE *fp, pointT *pointA, pointT *pointB, realT color[3]) {
   int k;
   realT pA[4], pB[4];
 
   qh_projectdim3(pointA, pA);
   qh_projectdim3(pointB, pB);
-  if ((fabs(pA[0] - pB[0]) > 1e-3) || 
-      (fabs(pA[1] - pB[1]) > 1e-3) || 
+  if ((fabs(pA[0] - pB[0]) > 1e-3) ||
+      (fabs(pA[1] - pB[1]) > 1e-3) ||
       (fabs(pA[2] - pB[2]) > 1e-3)) {
-    fprintf (fp, "VECT 1 2 1 2 1\n");
-    for (k= 0; k < 3; k++)
-       fprintf (fp, "%8.4g ", pB[k]);
-    fprintf (fp, " # p%d\n", qh_pointid (pointB));
+    qh_fprintf(fp, 9204, "VECT 1 2 1 2 1\n");
+    for (k=0; k < 3; k++)
+       qh_fprintf(fp, 9205, "%8.4g ", pB[k]);
+    qh_fprintf(fp, 9206, " # p%d\n", qh_pointid(pointB));
   }else
-    fprintf (fp, "VECT 1 1 1 1 1\n");
+    qh_fprintf(fp, 9207, "VECT 1 1 1 1 1\n");
   for (k=0; k < 3; k++)
-    fprintf (fp, "%8.4g ", pA[k]);
-  fprintf (fp, " # p%d\n", qh_pointid (pointA));
-  fprintf (fp, "%8.4g %8.4g %8.4g 1\n", color[0], color[1], color[2]);
+    qh_fprintf(fp, 9208, "%8.4g ", pA[k]);
+  qh_fprintf(fp, 9209, " # p%d\n", qh_pointid(pointA));
+  qh_fprintf(fp, 9210, "%8.4g %8.4g %8.4g 1\n", color[0], color[1], color[2]);
 }
 
 /*---------------------------------
-  
+
   qh_printneighborhood( fp, format, facetA, facetB, printall )
     print neighborhood of one or two facets
 
   notes:
-    calls qh_findgood_all() 
+    calls qh_findgood_all()
     bumps qh.visit_id
 */
-void qh_printneighborhood (FILE *fp, int format, facetT *facetA, facetT *facetB, boolT printall) {
+void qh_printneighborhood(FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall) {
   facetT *neighbor, **neighborp, *facet;
   setT *facets;
 
   if (format == qh_PRINTnone)
     return;
-  qh_findgood_all (qh facet_list);
+  qh_findgood_all(qh facet_list);
   if (facetA == facetB)
     facetB= NULL;
-  facets= qh_settemp (2*(qh_setsize (facetA->neighbors)+1));
+  facets= qh_settemp(2*(qh_setsize(facetA->neighbors)+1));
   qh visit_id++;
   for (facet= facetA; facet; facet= ((facet == facetA) ? facetB : NULL)) {
     if (facet->visitid != qh visit_id) {
       facet->visitid= qh visit_id;
-      qh_setappend (&facets, facet);
+      qh_setappend(&facets, facet);
     }
     FOREACHneighbor_(facet) {
       if (neighbor->visitid == qh visit_id)
         continue;
       neighbor->visitid= qh visit_id;
-      if (printall || !qh_skipfacet (neighbor))
-        qh_setappend (&facets, neighbor);
+      if (printall || !qh_skipfacet(neighbor))
+        qh_setappend(&facets, neighbor);
     }
   }
-  qh_printfacets (fp, format, NULL, facets, printall);
-  qh_settempfree (&facets);
+  qh_printfacets(fp, format, NULL, facets, printall);
+  qh_settempfree(&facets);
 } /* printneighborhood */
 
 /*---------------------------------
-  
+
   qh_printpoint( fp, string, point )
   qh_printpointid( fp, string, dim, point, id )
     prints the coordinates of a point
@@ -2941,58 +2846,59 @@
   notes:
     nop if point is NULL
     prints id unless it is undefined (-1)
+    Same as QhullPoint's printPoint
 */
-void qh_printpoint(FILE *fp, char *string, pointT *point) {
+void qh_printpoint(FILE *fp, const char *string, pointT *point) {
   int id= qh_pointid( point);
 
   qh_printpointid( fp, string, qh hull_dim, point, id);
 } /* printpoint */
 
-void qh_printpointid(FILE *fp, char *string, int dim, pointT *point, int id) {
+void qh_printpointid(FILE *fp, const char *string, int dim, pointT *point, int id) {
   int k;
   realT r; /*bug fix*/
-  
+
   if (!point)
     return;
   if (string) {
-    fputs (string, fp);
+    qh_fprintf(fp, 9211, "%s", string);
    if (id != -1)
-      fprintf(fp, " p%d: ", id);
+      qh_fprintf(fp, 9212, " p%d: ", id);
   }
-  for(k= dim; k--; ) {
+  for (k=dim; k--; ) {
     r= *point++;
     if (string)
-      fprintf(fp, " %8.4g", r);
+      qh_fprintf(fp, 9213, " %8.4g", r);
     else
-      fprintf(fp, qh_REAL_1, r);
+      qh_fprintf(fp, 9214, qh_REAL_1, r);
   }
-  fprintf(fp, "\n");
+  qh_fprintf(fp, 9215, "\n");
 } /* printpointid */
 
 /*---------------------------------
-  
+
   qh_printpoint3( fp, point )
     prints 2-d, 3-d, or 4-d point as Geomview 3-d coordinates
 */
 void qh_printpoint3 (FILE *fp, pointT *point) {
   int k;
   realT p[4];
-  
+
   qh_projectdim3 (point, p);
   for (k=0; k < 3; k++)
-    fprintf (fp, "%8.4g ", p[k]);
-  fprintf (fp, " # p%d\n", qh_pointid (point));
+    qh_fprintf(fp, 9216, "%8.4g ", p[k]);
+  qh_fprintf(fp, 9217, " # p%d\n", qh_pointid(point));
 } /* printpoint3 */
 
 /*----------------------------------------
--printpoints- print pointids for a set of points starting at index 
+-printpoints- print pointids for a set of points starting at index
    see geom.c
 */
 
 /*---------------------------------
-  
+
   qh_printpoints_out( fp, facetlist, facets, printall )
     prints vertices, coplanar/inside points, for facets by their point coordinates
     allows qh.CDDoutput
@@ -3002,8 +2908,8 @@
     if no coplanar/interior points,
       same order as qh_printextremes
 */
-void qh_printpoints_out (FILE *fp, facetT *facetlist, setT *facets, int printall) {
-  int allpoints= qh num_points + qh_setsize (qh other_points);
+void qh_printpoints_out(FILE *fp, facetT *facetlist, setT *facets, boolT printall) {
+  int allpoints= qh num_points + qh_setsize(qh other_points);
   int numpoints=0, point_i, point_n;
   setT *vertices, *points;
   facetT *facet, **facetp;
@@ -3011,11 +2917,11 @@
   vertexT *vertex, **vertexp;
   int id;
 
-  points= qh_settemp (allpoints);
-  qh_setzero (points, 0, allpoints);
-  vertices= qh_facetvertices (facetlist, facets, printall);
+  points= qh_settemp(allpoints);
+  qh_setzero(points, 0, allpoints);
+  vertices= qh_facetvertices(facetlist, facets, printall);
   FOREACHvertex_(vertices) {
-    id= qh_pointid (vertex->point);
+    id= qh_pointid(vertex->point);
     if (id >= 0)
       SETelem_(points, id)= vertex->point;
   }
@@ -3024,7 +2930,7 @@
       if (!printall && qh_skipfacet(facet))
         continue;
       FOREACHpoint_(facet->coplanarset) {
-        id= qh_pointid (point);
+        id= qh_pointid(point);
         if (id >= 0)
           SETelem_(points, id)= point;
       }
@@ -3033,99 +2939,100 @@
       if (!printall && qh_skipfacet(facet))
         continue;
       FOREACHpoint_(facet->coplanarset) {
-        id= qh_pointid (point);
+        id= qh_pointid(point);
         if (id >= 0)
           SETelem_(points, id)= point;
       }
     }
   }
-  qh_settempfree (&vertices);
+  qh_settempfree(&vertices);
   FOREACHpoint_i_(points) {
     if (point)
       numpoints++;
   }
   if (qh CDDoutput)
-    fprintf (fp, "%s | %s\nbegin\n%d %d real\n", qh rbox_command,
+    qh_fprintf(fp, 9218, "%s | %s\nbegin\n%d %d real\n", qh rbox_command,
              qh qhull_command, numpoints, qh hull_dim + 1);
   else
-    fprintf (fp, "%d\n%d\n", qh hull_dim, numpoints);
+    qh_fprintf(fp, 9219, "%d\n%d\n", qh hull_dim, numpoints);
   FOREACHpoint_i_(points) {
     if (point) {
       if (qh CDDoutput)
-	fprintf (fp, "1 ");
-      qh_printpoint (fp, NULL, point);
+        qh_fprintf(fp, 9220, "1 ");
+      qh_printpoint(fp, NULL, point);
     }
   }
   if (qh CDDoutput)
-    fprintf (fp, "end\n");
-  qh_settempfree (&points);
+    qh_fprintf(fp, 9221, "end\n");
+  qh_settempfree(&points);
 } /* printpoints_out */
-  
 
+
 /*---------------------------------
-  
+
   qh_printpointvect( fp, point, normal, center, radius, color )
     prints a 2-d, 3-d, or 4-d point as 3-d VECT's relative to normal or to center point
 */
-void qh_printpointvect (FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]) {
+void qh_printpointvect(FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]) {
   realT diff[4], pointA[4];
   int k;
-  
-  for (k= qh hull_dim; k--; ) {
+
+  for (k=qh hull_dim; k--; ) {
     if (center)
       diff[k]= point[k]-center[k];
-    else if (normal) 
+    else if (normal)
       diff[k]= normal[k];
     else
       diff[k]= 0;
   }
   if (center)
     qh_normalize2 (diff, qh hull_dim, True, NULL, NULL);
-  for (k= qh hull_dim; k--; ) 
+  for (k=qh hull_dim; k--; )
     pointA[k]= point[k]+diff[k] * radius;
-  qh_printline3geom (fp, point, pointA, color);
-} /* printpointvect */  
+  qh_printline3geom(fp, point, pointA, color);
+} /* printpointvect */
 
 /*---------------------------------
-  
+
   qh_printpointvect2( fp, point, normal, center, radius )
     prints a 2-d, 3-d, or 4-d point as 2 3-d VECT's for an imprecise point
 */
 void qh_printpointvect2 (FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius) {
   realT red[3]={1, 0, 0}, yellow[3]={1, 1, 0};
 
-  qh_printpointvect (fp, point, normal, center, radius, red);
-  qh_printpointvect (fp, point, normal, center, -radius, yellow);
+  qh_printpointvect(fp, point, normal, center, radius, red);
+  qh_printpointvect(fp, point, normal, center, -radius, yellow);
 } /* printpointvect2 */
 
 /*---------------------------------
-  
+
   qh_printridge( fp, ridge )
     prints the information in a ridge
 
   notes:
     for qh_printfacetridges()
+    same as operator<< [QhullRidge.cpp]
 */
 void qh_printridge(FILE *fp, ridgeT *ridge) {
-  
-  fprintf(fp, "     - r%d", ridge->id);
+
+  qh_fprintf(fp, 9222, "     - r%d", ridge->id);
   if (ridge->tested)
-    fprintf (fp, " tested");
+    qh_fprintf(fp, 9223, " tested");
   if (ridge->nonconvex)
-    fprintf (fp, " nonconvex");
-  fprintf (fp, "\n");
-  qh_printvertices (fp, "           vertices:", ridge->vertices);
+    qh_fprintf(fp, 9224, " nonconvex");
+  qh_fprintf(fp, 9225, "\n");
+  qh_printvertices(fp, "           vertices:", ridge->vertices);
   if (ridge->top && ridge->bottom)
-    fprintf(fp, "           between f%d and f%d\n",
-	    ridge->top->id, ridge->bottom->id);
+    qh_fprintf(fp, 9226, "           between f%d and f%d\n",
+            ridge->top->id, ridge->bottom->id);
 } /* printridge */
 
 /*---------------------------------
-  
+
   qh_printspheres( fp, vertices, radius )
     prints 3-d vertices as OFF spheres
 
@@ -3136,7 +3043,7 @@
   vertexT *vertex, **vertexp;
 
   qh printoutnum++;
-  fprintf (fp, "{appearance {-edge -normal normscale 0} {\n\
+  qh_fprintf(fp, 9227, "{appearance {-edge -normal normscale 0} {\n\
 INST geom {define vsphere OFF\n\
 18 32 48\n\
 \n\
@@ -3160,10 +3067,10 @@
 0 -0.707107 -0.707107\n\
 \n\
 3 0 6 11\n\
-3 0 7 6	\n\
-3 0 9 7	\n\
+3 0 7 6 \n\
+3 0 9 7 \n\
 3 0 11 9\n\
-3 1 6 8	\n\
+3 1 6 8 \n\
 3 1 8 14\n\
 3 1 13 6\n\
 3 1 14 13\n\
@@ -3192,28 +3099,28 @@
 3 16 12 15\n\
 3 17 10 16\n} transforms { TLIST\n");
   FOREACHvertex_(vertices) {
-    fprintf(fp, "%8.4g 0 0 0 # v%d\n 0 %8.4g 0 0\n0 0 %8.4g 0\n",
+    qh_fprintf(fp, 9228, "%8.4g 0 0 0 # v%d\n 0 %8.4g 0 0\n0 0 %8.4g 0\n",
       radius, vertex->id, radius, radius);
     qh_printpoint3 (fp, vertex->point);
-    fprintf (fp, "1\n");
+    qh_fprintf(fp, 9229, "1\n");
   }
-  fprintf (fp, "}}}\n");
+  qh_fprintf(fp, 9230, "}}}\n");
 } /* printspheres */
 
 
 /*----------------------------------------------
 -printsummary-
-                see qhull.c
+                see libqhull.c
 */
 
 /*---------------------------------
-  
+
   qh_printvdiagram( fp, format, facetlist, facets, printall )
     print voronoi diagram
       # of pairs of input sites
       #indices site1 site2 vertex1 ...
-    
+
     sites indexed by input point id
       point 0 is the first input point
     vertices indexed by 'o' and 'p' order
@@ -3225,13 +3132,13 @@
     qh_eachvoronoi_all()
 
   notes:
-    if all facets are upperdelaunay, 
+    if all facets are upperdelaunay,
       prints upper hull (furthest-site Voronoi diagram)
 */
-void qh_printvdiagram (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall) {
+void qh_printvdiagram(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall) {
   setT *vertices;
   int totcount, numcenters;
-  boolT islower;
+  boolT isLower;
   qh_RIDGE innerouter= qh_RIDGEall;
   printvridgeT printvridge= NULL;
 
@@ -3245,47 +3152,47 @@
     innerouter= qh_RIDGEouter;
     printvridge= qh_printvnorm;
   }else {
-    fprintf(qh ferr, "qh_printvdiagram: unknown print format %d.\n", format);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_fprintf(qh ferr, 6219, "Qhull internal error (qh_printvdiagram): unknown print format %d.\n", format);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
-  vertices= qh_markvoronoi (facetlist, facets, printall, &islower, &numcenters);
+  vertices= qh_markvoronoi(facetlist, facets, printall, &isLower, &numcenters);
   totcount= qh_printvdiagram2 (NULL, NULL, vertices, innerouter, False);
-  fprintf (fp, "%d\n", totcount);
+  qh_fprintf(fp, 9231, "%d\n", totcount);
   totcount= qh_printvdiagram2 (fp, printvridge, vertices, innerouter, True /* inorder*/);
-  qh_settempfree (&vertices);
+  qh_settempfree(&vertices);
 #if 0  /* for testing qh_eachvoronoi_all */
-  fprintf (fp, "\n");
+  qh_fprintf(fp, 9232, "\n");
   totcount= qh_eachvoronoi_all(fp, printvridge, qh UPPERdelaunay, innerouter, True /* inorder*/);
-  fprintf (fp, "%d\n", totcount);
+  qh_fprintf(fp, 9233, "%d\n", totcount);
 #endif
 } /* printvdiagram */
-  
+
 /*---------------------------------
-  
+
   qh_printvdiagram2( fp, printvridge, vertices, innerouter, inorder )
     visit all pairs of input sites (vertices) for selected Voronoi vertices
     vertices may include NULLs
-  
+
   innerouter:
-    qh_RIDGEall   print inner ridges (bounded) and outer ridges (unbounded)
+    qh_RIDGEall   print inner ridges(bounded) and outer ridges(unbounded)
     qh_RIDGEinner print only inner ridges
     qh_RIDGEouter print only outer ridges
-  
+
   inorder:
     print 3-d Voronoi vertices in order
-  
+
   assumes:
     qh_markvoronoi marked facet->visitid for Voronoi vertices
     all facet->seen= False
     all facet->seen2= True
-  
+
   returns:
-    total number of Voronoi ridges 
+    total number of Voronoi ridges
     if printvridge,
       calls printvridge( fp, vertex, vertexA, centers) for each ridge
       [see qh_eachvoronoi()]
-  
+
   see:
     qh_eachvoronoi_all()
 */
@@ -3294,23 +3201,24 @@
   int vertex_i, vertex_n;
   vertexT *vertex;
 
-  FORALLvertices 
+  FORALLvertices
     vertex->seen= False;
   FOREACHvertex_i_(vertices) {
     if (vertex) {
       if (qh GOODvertex > 0 && qh_pointid(vertex->point)+1 != qh GOODvertex)
-	continue;
-      totcount += qh_eachvoronoi (fp, printvridge, vertex, !qh_ALL, innerouter, inorder);
+        continue;
+      totcount += qh_eachvoronoi(fp, printvridge, vertex, !qh_ALL, innerouter, inorder);
     }
   }
   return totcount;
 } /* printvdiagram2 */
-  
+
 /*---------------------------------
-  
+
   qh_printvertex( fp, vertex )
     prints the information in a vertex
+    Duplicated as operator<< [QhullVertex.cpp]
 */
 void qh_printvertex(FILE *fp, vertexT *vertex) {
   pointT *point;
@@ -3319,72 +3227,73 @@
   realT r; /*bug fix*/
 
   if (!vertex) {
-    fprintf (fp, "  NULLvertex\n");
+    qh_fprintf(fp, 9234, "  NULLvertex\n");
     return;
   }
-  fprintf(fp, "- p%d (v%d):", qh_pointid(vertex->point), vertex->id);
+  qh_fprintf(fp, 9235, "- p%d(v%d):", qh_pointid(vertex->point), vertex->id);
   point= vertex->point;
   if (point) {
-    for(k= qh hull_dim; k--; ) {
+    for (k=qh hull_dim; k--; ) {
       r= *point++;
-      fprintf(fp, " %5.2g", r);
+      qh_fprintf(fp, 9236, " %5.2g", r);
     }
   }
   if (vertex->deleted)
-    fprintf(fp, " deleted");
+    qh_fprintf(fp, 9237, " deleted");
   if (vertex->delridge)
-    fprintf (fp, " ridgedeleted");
-  fprintf(fp, "\n");
+    qh_fprintf(fp, 9238, " ridgedeleted");
+  qh_fprintf(fp, 9239, "\n");
   if (vertex->neighbors) {
-    fprintf(fp, "  neighbors:");
+    qh_fprintf(fp, 9240, "  neighbors:");
     FOREACHneighbor_(vertex) {
       if (++count % 100 == 0)
-	fprintf (fp, "\n     ");
-      fprintf(fp, " f%d", neighbor->id);
+        qh_fprintf(fp, 9241, "\n     ");
+      qh_fprintf(fp, 9242, " f%d", neighbor->id);
     }
-    fprintf(fp, "\n");
+    qh_fprintf(fp, 9243, "\n");
   }
 } /* printvertex */
 
 
 /*---------------------------------
-  
+
   qh_printvertexlist( fp, string, facetlist, facets, printall )
     prints vertices used by a facetlist or facet set
     tests qh_skipfacet() if !printall
 */
-void qh_printvertexlist (FILE *fp, char* string, facetT *facetlist, 
+void qh_printvertexlist(FILE *fp, const char* string, facetT *facetlist,
                          setT *facets, boolT printall) {
   vertexT *vertex, **vertexp;
   setT *vertices;
-  
-  vertices= qh_facetvertices (facetlist, facets, printall);
-  fputs (string, fp);
+
+  vertices= qh_facetvertices(facetlist, facets, printall);
+  qh_fprintf(fp, 9244, "%s", string);
   FOREACHvertex_(vertices)
     qh_printvertex(fp, vertex);
-  qh_settempfree (&vertices);
+  qh_settempfree(&vertices);
 } /* printvertexlist */
 
 
 /*---------------------------------
-  
+
   qh_printvertices( fp, string, vertices )
     prints vertices in a set
+    duplicated as printVertexSet [QhullVertex.cpp]
 */
-void qh_printvertices(FILE *fp, char* string, setT *vertices) {
+void qh_printvertices(FILE *fp, const char* string, setT *vertices) {
   vertexT *vertex, **vertexp;
-  
-  fputs (string, fp);
-  FOREACHvertex_(vertices) 
-    fprintf (fp, " p%d (v%d)", qh_pointid(vertex->point), vertex->id);
-  fprintf(fp, "\n");
+
+  qh_fprintf(fp, 9245, "%s", string);
+  FOREACHvertex_(vertices)
+    qh_fprintf(fp, 9246, " p%d(v%d)", qh_pointid(vertex->point), vertex->id);
+  qh_fprintf(fp, 9247, "\n");
 } /* printvertices */
 
 /*---------------------------------
-  
+
   qh_printvneighbors( fp, facetlist, facets, printall )
     print vertex neighbors of vertices in facetlist and facets ('FN')
 
@@ -3399,61 +3308,61 @@
     for each point
       list vertex neighbors or coplanar facet
 */
-void qh_printvneighbors (FILE *fp, facetT* facetlist, setT *facets, boolT printall) {
+void qh_printvneighbors(FILE *fp, facetT* facetlist, setT *facets, boolT printall) {
   int numfacets, numsimplicial, numridges, totneighbors, numneighbors, numcoplanars, numtricoplanars;
   setT *vertices, *vertex_points, *coplanar_points;
-  int numpoints= qh num_points + qh_setsize (qh other_points);
+  int numpoints= qh num_points + qh_setsize(qh other_points);
   vertexT *vertex, **vertexp;
   int vertex_i, vertex_n;
   facetT *facet, **facetp, *neighbor, **neighborp;
   pointT *point, **pointp;
 
-  qh_countfacets (facetlist, facets, printall, &numfacets, &numsimplicial, 
+  qh_countfacets(facetlist, facets, printall, &numfacets, &numsimplicial,
       &totneighbors, &numridges, &numcoplanars, &numtricoplanars);  /* sets facet->visitid */
-  fprintf (fp, "%d\n", numpoints);
+  qh_fprintf(fp, 9248, "%d\n", numpoints);
   qh_vertexneighbors();
-  vertices= qh_facetvertices (facetlist, facets, printall);
-  vertex_points= qh_settemp (numpoints);
-  coplanar_points= qh_settemp (numpoints);
-  qh_setzero (vertex_points, 0, numpoints);
-  qh_setzero (coplanar_points, 0, numpoints);
+  vertices= qh_facetvertices(facetlist, facets, printall);
+  vertex_points= qh_settemp(numpoints);
+  coplanar_points= qh_settemp(numpoints);
+  qh_setzero(vertex_points, 0, numpoints);
+  qh_setzero(coplanar_points, 0, numpoints);
   FOREACHvertex_(vertices)
-    qh_point_add (vertex_points, vertex->point, vertex);
+    qh_point_add(vertex_points, vertex->point, vertex);
   FORALLfacet_(facetlist) {
     FOREACHpoint_(facet->coplanarset)
-      qh_point_add (coplanar_points, point, facet);
+      qh_point_add(coplanar_points, point, facet);
   }
   FOREACHfacet_(facets) {
     FOREACHpoint_(facet->coplanarset)
-      qh_point_add (coplanar_points, point, facet);
+      qh_point_add(coplanar_points, point, facet);
   }
   FOREACHvertex_i_(vertex_points) {
-    if (vertex) { 
-      numneighbors= qh_setsize (vertex->neighbors);
-      fprintf (fp, "%d", numneighbors);
+    if (vertex) {
+      numneighbors= qh_setsize(vertex->neighbors);
+      qh_fprintf(fp, 9249, "%d", numneighbors);
       if (qh hull_dim == 3)
-        qh_order_vertexneighbors (vertex);
+        qh_order_vertexneighbors(vertex);
       else if (qh hull_dim >= 4)
-        qsort (SETaddr_(vertex->neighbors, facetT), numneighbors,
-             sizeof (facetT *), qh_compare_facetvisit);
-      FOREACHneighbor_(vertex) 
-        fprintf (fp, " %d", 
-		 neighbor->visitid ? neighbor->visitid - 1 : - neighbor->id);
-      fprintf (fp, "\n");
+        qsort(SETaddr_(vertex->neighbors, facetT), (size_t)numneighbors,
+             sizeof(facetT *), qh_compare_facetvisit);
+      FOREACHneighbor_(vertex)
+        qh_fprintf(fp, 9250, " %d",
+                 neighbor->visitid ? neighbor->visitid - 1 : 0 - neighbor->id);
+      qh_fprintf(fp, 9251, "\n");
     }else if ((facet= SETelemt_(coplanar_points, vertex_i, facetT)))
-      fprintf (fp, "1 %d\n",
-                  facet->visitid ? facet->visitid - 1 : - facet->id);
+      qh_fprintf(fp, 9252, "1 %d\n",
+                  facet->visitid ? facet->visitid - 1 : 0 - facet->id);
     else
-      fprintf (fp, "0\n");
+      qh_fprintf(fp, 9253, "0\n");
   }
-  qh_settempfree (&coplanar_points);
-  qh_settempfree (&vertex_points);
-  qh_settempfree (&vertices);
+  qh_settempfree(&coplanar_points);
+  qh_settempfree(&vertex_points);
+  qh_settempfree(&vertices);
 } /* printvneighbors */
 
 /*---------------------------------
-  
+
   qh_printvoronoi( fp, format, facetlist, facets, printall )
     print voronoi diagram in 'o' or 'G' format
     for 'o' format
@@ -3469,62 +3378,62 @@
     qh_printvdiagram()
 
   notes:
-    if 'o', 
+    if 'o',
       prints a line for each point except "at-infinity"
-    if all facets are upperdelaunay, 
+    if all facets are upperdelaunay,
       reverses lower and upper hull
 */
-void qh_printvoronoi (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall) {
+void qh_printvoronoi(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall) {
   int k, numcenters, numvertices= 0, numneighbors, numinf, vid=1, vertex_i, vertex_n;
   facetT *facet, **facetp, *neighbor, **neighborp;
   setT *vertices;
   vertexT *vertex;
-  boolT islower;
+  boolT isLower;
   unsigned int numfacets= (unsigned int) qh num_facets;
 
-  vertices= qh_markvoronoi (facetlist, facets, printall, &islower, &numcenters);
+  vertices= qh_markvoronoi(facetlist, facets, printall, &isLower, &numcenters);
   FOREACHvertex_i_(vertices) {
     if (vertex) {
       numvertices++;
       numneighbors = numinf = 0;
       FOREACHneighbor_(vertex) {
         if (neighbor->visitid == 0)
-	  numinf= 1;
+          numinf= 1;
         else if (neighbor->visitid < numfacets)
           numneighbors++;
       }
       if (numinf && !numneighbors) {
-	SETelem_(vertices, vertex_i)= NULL;
-	numvertices--;
+        SETelem_(vertices, vertex_i)= NULL;
+        numvertices--;
       }
     }
   }
-  if (format == qh_PRINTgeom) 
-    fprintf (fp, "{appearance {+edge -face} OFF %d %d 1 # Voronoi centers and cells\n", 
+  if (format == qh_PRINTgeom)
+    qh_fprintf(fp, 9254, "{appearance {+edge -face} OFF %d %d 1 # Voronoi centers and cells\n",
                 numcenters, numvertices);
   else
-    fprintf (fp, "%d\n%d %d 1\n", qh hull_dim-1, numcenters, qh_setsize(vertices));
+    qh_fprintf(fp, 9255, "%d\n%d %d 1\n", qh hull_dim-1, numcenters, qh_setsize(vertices));
   if (format == qh_PRINTgeom) {
-    for (k= qh hull_dim-1; k--; )
-      fprintf (fp, qh_REAL_1, 0.0);
-    fprintf (fp, " 0 # infinity not used\n");
+    for (k=qh hull_dim-1; k--; )
+      qh_fprintf(fp, 9256, qh_REAL_1, 0.0);
+    qh_fprintf(fp, 9257, " 0 # infinity not used\n");
   }else {
-    for (k= qh hull_dim-1; k--; )
-      fprintf (fp, qh_REAL_1, qh_INFINITE);
-    fprintf (fp, "\n");
+    for (k=qh hull_dim-1; k--; )
+      qh_fprintf(fp, 9258, qh_REAL_1, qh_INFINITE);
+    qh_fprintf(fp, 9259, "\n");
   }
   FORALLfacet_(facetlist) {
     if (facet->visitid && facet->visitid < numfacets) {
       if (format == qh_PRINTgeom)
-        fprintf (fp, "# %d f%d\n", vid++, facet->id);
-      qh_printcenter (fp, format, NULL, facet);
+        qh_fprintf(fp, 9260, "# %d f%d\n", vid++, facet->id);
+      qh_printcenter(fp, format, NULL, facet);
     }
   }
   FOREACHfacet_(facets) {
     if (facet->visitid && facet->visitid < numfacets) {
       if (format == qh_PRINTgeom)
-        fprintf (fp, "# %d f%d\n", vid++, facet->id);
-      qh_printcenter (fp, format, NULL, facet);
+        qh_fprintf(fp, 9261, "# %d f%d\n", vid++, facet->id);
+      qh_printcenter(fp, format, NULL, facet);
     }
   }
   FOREACHvertex_i_(vertices) {
@@ -3534,117 +3443,123 @@
       if (qh hull_dim == 3)
         qh_order_vertexneighbors(vertex);
       else if (qh hull_dim >= 4)
-        qsort (SETaddr_(vertex->neighbors, vertexT), 
-	     qh_setsize (vertex->neighbors),
-	     sizeof (facetT *), qh_compare_facetvisit);
+        qsort(SETaddr_(vertex->neighbors, vertexT),
+             (size_t)qh_setsize(vertex->neighbors),
+             sizeof(facetT *), qh_compare_facetvisit);
       FOREACHneighbor_(vertex) {
         if (neighbor->visitid == 0)
-	  numinf= 1;
-	else if (neighbor->visitid < numfacets)
+          numinf= 1;
+        else if (neighbor->visitid < numfacets)
           numneighbors++;
       }
     }
     if (format == qh_PRINTgeom) {
       if (vertex) {
-	fprintf (fp, "%d", numneighbors);
-	if (vertex) {
-	  FOREACHneighbor_(vertex) {
-	    if (neighbor->visitid && neighbor->visitid < numfacets)
-	      fprintf (fp, " %d", neighbor->visitid);
-	  }
-	}
-	fprintf (fp, " # p%d (v%d)\n", vertex_i, vertex->id);
+        qh_fprintf(fp, 9262, "%d", numneighbors);
+        if (vertex) {
+          FOREACHneighbor_(vertex) {
+            if (neighbor->visitid && neighbor->visitid < numfacets)
+              qh_fprintf(fp, 9263, " %d", neighbor->visitid);
+          }
+        }
+        qh_fprintf(fp, 9264, " # p%d(v%d)\n", vertex_i, vertex->id);
       }else
-	fprintf (fp, " # p%d is coplanar or isolated\n", vertex_i);
+        qh_fprintf(fp, 9265, " # p%d is coplanar or isolated\n", vertex_i);
     }else {
       if (numinf)
-	numneighbors++;
-      fprintf (fp, "%d", numneighbors);
+        numneighbors++;
+      qh_fprintf(fp, 9266, "%d", numneighbors);
       if (vertex) {
         FOREACHneighbor_(vertex) {
-  	  if (neighbor->visitid == 0) {
-  	    if (numinf) {
-  	      numinf= 0;
-	      fprintf (fp, " %d", neighbor->visitid);
-	    }
-	  }else if (neighbor->visitid < numfacets)
-	    fprintf (fp, " %d", neighbor->visitid);
-	}
+          if (neighbor->visitid == 0) {
+            if (numinf) {
+              numinf= 0;
+              qh_fprintf(fp, 9267, " %d", neighbor->visitid);
+            }
+          }else if (neighbor->visitid < numfacets)
+            qh_fprintf(fp, 9268, " %d", neighbor->visitid);
+        }
       }
-      fprintf (fp, "\n");
+      qh_fprintf(fp, 9269, "\n");
     }
   }
   if (format == qh_PRINTgeom)
-    fprintf (fp, "}\n");
-  qh_settempfree (&vertices);
+    qh_fprintf(fp, 9270, "}\n");
+  qh_settempfree(&vertices);
 } /* printvoronoi */
-  
+
 /*---------------------------------
-  
+
   qh_printvnorm( fp, vertex, vertexA, centers, unbounded )
     print one separating plane of the Voronoi diagram for a pair of input sites
     unbounded==True if centers includes vertex-at-infinity
-  
+
   assumes:
     qh_ASvoronoi and qh_vertexneighbors() already set
-    
+
+  note:
+    parameter unbounded is UNUSED by this callback
+
   see:
     qh_printvdiagram()
     qh_eachvoronoi()
 */
-void qh_printvnorm (FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded) {
+void qh_printvnorm(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded) {
   pointT *normal;
   realT offset;
   int k;
-  
-  normal= qh_detvnorm (vertex, vertexA, centers, &offset);
-  fprintf (fp, "%d %d %d ", 
-      2+qh hull_dim, qh_pointid (vertex->point), qh_pointid (vertexA->point));
-  for (k= 0; k< qh hull_dim-1; k++)
-    fprintf (fp, qh_REAL_1, normal[k]);
-  fprintf (fp, qh_REAL_1, offset);
-  fprintf (fp, "\n");
+  QHULL_UNUSED(unbounded);
+
+  normal= qh_detvnorm(vertex, vertexA, centers, &offset);
+  qh_fprintf(fp, 9271, "%d %d %d ",
+      2+qh hull_dim, qh_pointid(vertex->point), qh_pointid(vertexA->point));
+  for (k=0; k< qh hull_dim-1; k++)
+    qh_fprintf(fp, 9272, qh_REAL_1, normal[k]);
+  qh_fprintf(fp, 9273, qh_REAL_1, offset);
+  qh_fprintf(fp, 9274, "\n");
 } /* printvnorm */
 
 /*---------------------------------
-  
+
   qh_printvridge( fp, vertex, vertexA, centers, unbounded )
     print one ridge of the Voronoi diagram for a pair of input sites
     unbounded==True if centers includes vertex-at-infinity
-  
+
   see:
     qh_printvdiagram()
-  
+
   notes:
     the user may use a different function
+    parameter unbounded is UNUSED
 */
-void qh_printvridge (FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded) {
+void qh_printvridge(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded) {
   facetT *facet, **facetp;
+  QHULL_UNUSED(unbounded);
 
-  fprintf (fp, "%d %d %d", qh_setsize (centers)+2, 
-       qh_pointid (vertex->point), qh_pointid (vertexA->point));
-  FOREACHfacet_(centers) 
-    fprintf (fp, " %d", facet->visitid);
-  fprintf (fp, "\n");
+  qh_fprintf(fp, 9275, "%d %d %d", qh_setsize(centers)+2,
+       qh_pointid(vertex->point), qh_pointid(vertexA->point));
+  FOREACHfacet_(centers)
+    qh_fprintf(fp, 9276, " %d", facet->visitid);
+  qh_fprintf(fp, 9277, "\n");
 } /* printvridge */
 
 /*---------------------------------
-  
+
   qh_projectdim3( source, destination )
     project 2-d 3-d or 4-d point to a 3-d point
     uses qh.DROPdim and qh.hull_dim
     source and destination may be the same
-    
+
   notes:
     allocate 4 elements to destination just in case
 */
 void qh_projectdim3 (pointT *source, pointT *destination) {
   int i,k;
 
-  for (k= 0, i=0; k < qh hull_dim; k++) {
+  for (k=0, i=0; k < qh hull_dim; k++) {
     if (qh hull_dim == 4) {
       if (k != qh DROPdim)
         destination[i++]= source[k];
@@ -3659,10 +3574,10 @@
 
 /*---------------------------------
-  
-  qh_readfeasible( dim, remainder )
-    read feasible point from remainder string and qh.fin
 
+  qh_readfeasible( dim, curline )
+    read feasible point from current line and qh.fin
+
   returns:
     number of lines read from qh.fin
     sets qh.FEASIBLEpoint with malloc'd coordinates
@@ -3674,24 +3589,25 @@
   see:
     qh_setfeasible
 */
-int qh_readfeasible (int dim, char *remainder) {
+int qh_readfeasible(int dim, const char *curline) {
   boolT isfirst= True;
   int linecount= 0, tokcount= 0;
-  char *s, *t, firstline[qh_MAXfirst+1];
+  const char *s;
+  char *t, firstline[qh_MAXfirst+1];
   coordT *coords, value;
 
   if (!qh HALFspace) {
-    fprintf  (qh ferr, "qhull input error: feasible point (dim 1 coords) is only valid for halfspace intersection\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
-  }  
+    qh_fprintf(qh ferr, 6070, "qhull input error: feasible point(dim 1 coords) is only valid for halfspace intersection\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
+  }
   if (qh feasible_string)
-    fprintf  (qh ferr, "qhull input warning: feasible point (dim 1 coords) overrides 'Hn,n,n' feasible point for halfspace intersection\n");
-  if (!(qh feasible_point= (coordT*)malloc (dim* sizeof(coordT)))) {
-    fprintf(qh ferr, "qhull error: insufficient memory for feasible point\n");
+    qh_fprintf(qh ferr, 7057, "qhull input warning: feasible point(dim 1 coords) overrides 'Hn,n,n' feasible point for halfspace intersection\n");
+  if (!(qh feasible_point= (coordT*)qh_malloc(dim* sizeof(coordT)))) {
+    qh_fprintf(qh ferr, 6071, "qhull error: insufficient memory for feasible point\n");
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
   coords= qh feasible_point;
-  while ((s= (isfirst ?  remainder : fgets(firstline, qh_MAXfirst, qh fin)))) {
+  while ((s= (isfirst ?  curline : fgets(firstline, qh_MAXfirst, qh fin)))) {
     if (isfirst)
       isfirst= False;
     else
@@ -3699,33 +3615,33 @@
     while (*s) {
       while (isspace(*s))
         s++;
-      value= qh_strtod (s, &t);
+      value= qh_strtod(s, &t);
       if (s == t)
         break;
       s= t;
       *(coords++)= value;
       if (++tokcount == dim) {
-        while (isspace (*s))
+        while (isspace(*s))
           s++;
-        qh_strtod (s, &t);
+        qh_strtod(s, &t);
         if (s != t) {
-          fprintf (qh ferr, "qhull input error: coordinates for feasible point do not finish out the line: %s\n",
+          qh_fprintf(qh ferr, 6072, "qhull input error: coordinates for feasible point do not finish out the line: %s\n",
                s);
-          qh_errexit (qh_ERRinput, NULL, NULL);
+          qh_errexit(qh_ERRinput, NULL, NULL);
         }
         return linecount;
       }
     }
   }
-  fprintf (qh ferr, "qhull input error: only %d coordinates.  Could not read %d-d feasible point.\n",
+  qh_fprintf(qh ferr, 6073, "qhull input error: only %d coordinates.  Could not read %d-d feasible point.\n",
            tokcount, dim);
-  qh_errexit (qh_ERRinput, NULL, NULL);
+  qh_errexit(qh_ERRinput, NULL, NULL);
   return 0;
 } /* readfeasible */
 
 /*---------------------------------
-  
+
   qh_readpoints( numpoints, dimension, ismalloc )
     read points from qh.fin into qh.first_point, qh.num_points
     qh.fin is lines of coordinates, one per vertex, first line number of points
@@ -3753,13 +3669,13 @@
   notes:
     dimension will change in qh_initqhull_globals if qh.PROJECTinput
     uses malloc() since qh_mem not initialized
-    FIXUP: this routine needs rewriting
+    FIXUP QH10012: qh_readpoints needs rewriting, too long
 */
 coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc) {
   coordT *points, *coords, *infinity= NULL;
   realT paraboloid, maxboloid= -REALmax, value;
   realT *coordp= NULL, *offsetp= NULL, *normalp= NULL;
-  char *s, *t, firstline[qh_MAXfirst+1];
+  char *s= 0, *t, firstline[qh_MAXfirst+1];
   int diminput=0, numinput=0, dimfeasible= 0, newnum, k, tempi;
   int firsttext=0, firstshort=0, firstlong=0, firstpoint=0;
   int tokcount= 0, linecount=0, maxcount, coordcount=0;
@@ -3770,26 +3686,26 @@
     while ((s= fgets(firstline, qh_MAXfirst, qh fin))) {
       linecount++;
       if (qh HALFspace && linecount == 1 && isdigit(*s)) {
-	dimfeasible= qh_strtol (s, &s);	
-	while (isspace(*s))
+        dimfeasible= qh_strtol(s, &s);
+        while (isspace(*s))
           s++;
-        if (qh_strtol (s, &s) == 1)
-          linecount += qh_readfeasible (dimfeasible, s);
+        if (qh_strtol(s, &s) == 1)
+          linecount += qh_readfeasible(dimfeasible, s);
         else
           dimfeasible= 0;
-      }else if (!memcmp (firstline, "begin", 5) || !memcmp (firstline, "BEGIN", 5))
+      }else if (!memcmp(firstline, "begin", (size_t)5) || !memcmp(firstline, "BEGIN", (size_t)5))
         break;
       else if (!*qh rbox_command)
-	strncat(qh rbox_command, s, sizeof (qh rbox_command)-1);
+        strncat(qh rbox_command, s, sizeof(qh rbox_command)-1);
     }
     if (!s) {
-      fprintf (qh ferr, "qhull input error: missing \"begin\" for cdd-formated input\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6074, "qhull input error: missing \"begin\" for cdd-formated input\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
   }
-  while(!numinput && (s= fgets(firstline, qh_MAXfirst, qh fin))) {
+  while (!numinput && (s= fgets(firstline, qh_MAXfirst, qh fin))) {
     linecount++;
-    if (!memcmp (s, "begin", 5) || !memcmp (s, "BEGIN", 5))
+    if (!memcmp(s, "begin", (size_t)5) || !memcmp(s, "BEGIN", (size_t)5))
       wasbegin= True;
     while (*s) {
       while (isspace(*s))
@@ -3798,36 +3714,36 @@
         break;
       if (!isdigit(*s)) {
         if (!*qh rbox_command) {
-          strncat(qh rbox_command, s, sizeof (qh rbox_command)-1);
-	  firsttext= linecount;
+          strncat(qh rbox_command, s, sizeof(qh rbox_command)-1);
+          firsttext= linecount;
         }
         break;
       }
-      if (!diminput) 
-        diminput= qh_strtol (s, &s);
+      if (!diminput)
+        diminput= qh_strtol(s, &s);
       else {
-        numinput= qh_strtol (s, &s);
+        numinput= qh_strtol(s, &s);
         if (numinput == 1 && diminput >= 2 && qh HALFspace && !qh CDDinput) {
-          linecount += qh_readfeasible (diminput, s); /* checks if ok */
+          linecount += qh_readfeasible(diminput, s); /* checks if ok */
           dimfeasible= diminput;
           diminput= numinput= 0;
-        }else 
+        }else
           break;
       }
     }
   }
   if (!s) {
-    fprintf(qh ferr, "qhull input error: short input file.  Did not find dimension and number of points\n");
+    qh_fprintf(qh ferr, 6075, "qhull input error: short input file.  Did not find dimension and number of points\n");
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (diminput > numinput) {
-    tempi= diminput;	/* exchange dim and n, e.g., for cdd input format */
+    tempi= diminput;    /* exchange dim and n, e.g., for cdd input format */
     diminput= numinput;
     numinput= tempi;
   }
   if (diminput < 2) {
-    fprintf(qh ferr,"qhull input error: dimension %d (first number) should be at least 2\n",
-	    diminput);
+    qh_fprintf(qh ferr, 6220,"qhull input error: dimension %d(first number) should be at least 2\n",
+            diminput);
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (isdelaunay) {
@@ -3843,20 +3759,20 @@
     *dimension= diminput - 1;
     *numpoints= numinput;
     if (diminput < 3) {
-      fprintf(qh ferr,"qhull input error: dimension %d (first number, includes offset) should be at least 3 for halfspaces\n",
-  	    diminput);
+      qh_fprintf(qh ferr, 6221,"qhull input error: dimension %d(first number, includes offset) should be at least 3 for halfspaces\n",
+            diminput);
       qh_errexit(qh_ERRinput, NULL, NULL);
     }
     if (dimfeasible) {
       if (dimfeasible != *dimension) {
-        fprintf(qh ferr,"qhull input error: dimension %d of feasible point is not one less than dimension %d for halfspaces\n",
+        qh_fprintf(qh ferr, 6222,"qhull input error: dimension %d of feasible point is not one less than dimension %d for halfspaces\n",
           dimfeasible, diminput);
         qh_errexit(qh_ERRinput, NULL, NULL);
       }
-    }else 
-      qh_setfeasible (*dimension);
+    }else
+      qh_setfeasible(*dimension);
   }else {
-    if (qh CDDinput) 
+    if (qh CDDinput)
       *dimension= diminput-1;
     else
       *dimension= diminput;
@@ -3864,7 +3780,7 @@
   }
   qh normal_size= *dimension * sizeof(coordT); /* for tracing with qh_printpoint */
   if (qh HALFspace) {
-    qh half_space= coordp= (coordT*) malloc (qh normal_size + sizeof(coordT));
+    qh half_space= coordp= (coordT*)qh_malloc(qh normal_size + sizeof(coordT));
     if (qh CDDinput) {
       offsetp= qh half_space;
       normalp= offsetp + 1;
@@ -3872,16 +3788,16 @@
       normalp= qh half_space;
       offsetp= normalp + *dimension;
     }
-  } 
+  }
   qh maxline= diminput * (qh_REALdigits + 5);
   maximize_(qh maxline, 500);
-  qh line= (char*)malloc ((qh maxline+1) * sizeof (char));
+  qh line= (char*)qh_malloc((qh maxline+1) * sizeof(char));
   *ismalloc= True;  /* use malloc since memory not setup */
-  coords= points= qh temp_malloc= 
-        (coordT*)malloc((*numpoints)*(*dimension)*sizeof(coordT));
+  coords= points= qh temp_malloc=
+        (coordT*)qh_malloc((*numpoints)*(*dimension)*sizeof(coordT));
   if (!coords || !qh line || (qh HALFspace && !qh half_space)) {
-    fprintf(qh ferr, "qhull error: insufficient memory to read %d points\n",
-	    numinput);
+    qh_fprintf(qh ferr, 6076, "qhull error: insufficient memory to read %d points\n",
+            numinput);
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
   if (isdelaunay && qh ATinfinity) {
@@ -3895,56 +3811,56 @@
     if (!isfirst) {
       linecount++;
       if (*s == 'e' || *s == 'E') {
-	if (!memcmp (s, "end", 3) || !memcmp (s, "END", 3)) {
-	  if (qh CDDinput )
-	    break;
-	  else if (wasbegin) 
-	    fprintf (qh ferr, "qhull input warning: the input appears to be in cdd format.  If so, use 'Fd'\n");
-	}
+        if (!memcmp(s, "end", (size_t)3) || !memcmp(s, "END", (size_t)3)) {
+          if (qh CDDinput )
+            break;
+          else if (wasbegin)
+            qh_fprintf(qh ferr, 7058, "qhull input warning: the input appears to be in cdd format.  If so, use 'Fd'\n");
+        }
       }
     }
     islong= False;
     while (*s) {
       while (isspace(*s))
         s++;
-      value= qh_strtod (s, &t);
+      value= qh_strtod(s, &t);
       if (s == t) {
         if (!*qh rbox_command)
- 	 strncat(qh rbox_command, s, sizeof (qh rbox_command)-1);
-        if (*s && !firsttext) 
+         strncat(qh rbox_command, s, sizeof(qh rbox_command)-1);
+        if (*s && !firsttext)
           firsttext= linecount;
         if (!islong && !firstshort && coordcount)
           firstshort= linecount;
         break;
       }
       if (!firstpoint)
-	firstpoint= linecount;
+        firstpoint= linecount;
       s= t;
       if (++tokcount > maxcount)
         continue;
       if (qh HALFspace) {
-	if (qh CDDinput) 
-	  *(coordp++)= -value; /* both coefficients and offset */
-	else
-	  *(coordp++)= value;
+        if (qh CDDinput)
+          *(coordp++)= -value; /* both coefficients and offset */
+        else
+          *(coordp++)= value;
       }else {
         *(coords++)= value;
         if (qh CDDinput && !coordcount) {
           if (value != 1.0) {
-            fprintf (qh ferr, "qhull input error: for cdd format, point at line %d does not start with '1'\n",
+            qh_fprintf(qh ferr, 6077, "qhull input error: for cdd format, point at line %d does not start with '1'\n",
                    linecount);
-            qh_errexit (qh_ERRinput, NULL, NULL);
+            qh_errexit(qh_ERRinput, NULL, NULL);
           }
           coords--;
         }else if (isdelaunay) {
-	  paraboloid += value * value;
-	  if (qh ATinfinity) {
-	    if (qh CDDinput)
-	      infinity[coordcount-1] += value;
-	    else
-	      infinity[coordcount] += value;
-	  }
-	}
+          paraboloid += value * value;
+          if (qh ATinfinity) {
+            if (qh CDDinput)
+              infinity[coordcount-1] += value;
+            else
+              infinity[coordcount] += value;
+          }
+        }
       }
       if (++coordcount == diminput) {
         coordcount= 0;
@@ -3953,49 +3869,49 @@
           maximize_(maxboloid, paraboloid);
           paraboloid= 0.0;
         }else if (qh HALFspace) {
-          if (!qh_sethalfspace (*dimension, coords, &coords, normalp, offsetp, qh feasible_point)) {
-	    fprintf (qh ferr, "The halfspace was on line %d\n", linecount);
-	    if (wasbegin)
-	      fprintf (qh ferr, "The input appears to be in cdd format.  If so, you should use option 'Fd'\n");
-	    qh_errexit (qh_ERRinput, NULL, NULL);
-	  }
+          if (!qh_sethalfspace(*dimension, coords, &coords, normalp, offsetp, qh feasible_point)) {
+            qh_fprintf(qh ferr, 8048, "The halfspace was on line %d\n", linecount);
+            if (wasbegin)
+              qh_fprintf(qh ferr, 8049, "The input appears to be in cdd format.  If so, you should use option 'Fd'\n");
+            qh_errexit(qh_ERRinput, NULL, NULL);
+          }
           coordp= qh half_space;
-        }          
+        }
         while (isspace(*s))
           s++;
         if (*s) {
           islong= True;
           if (!firstlong)
             firstlong= linecount;
-	}
+        }
       }
     }
     if (!islong && !firstshort && coordcount)
       firstshort= linecount;
     if (!isfirst && s - qh line >= qh maxline) {
-      fprintf(qh ferr, "qhull input error: line %d contained more than %d characters\n", 
-	      linecount, (int) (s - qh line));
+      qh_fprintf(qh ferr, 6078, "qhull input error: line %d contained more than %d characters\n",
+              linecount, (int) (s - qh line));   /* WARN64 */
       qh_errexit(qh_ERRinput, NULL, NULL);
     }
     isfirst= False;
   }
   if (tokcount != maxcount) {
     newnum= fmin_(numinput, tokcount/diminput);
-    fprintf(qh ferr,"\
+    qh_fprintf(qh ferr, 7073,"\
 qhull warning: instead of %d %d-dimensional points, input contains\n\
 %d points and %d extra coordinates.  Line %d is the first\npoint",
        numinput, diminput, tokcount/diminput, tokcount % diminput, firstpoint);
     if (firsttext)
-      fprintf(qh ferr, ", line %d is the first comment", firsttext);
+      qh_fprintf(qh ferr, 8051, ", line %d is the first comment", firsttext);
     if (firstshort)
-      fprintf(qh ferr, ", line %d is the first short\nline", firstshort);
+      qh_fprintf(qh ferr, 8052, ", line %d is the first short\nline", firstshort);
     if (firstlong)
-      fprintf(qh ferr, ", line %d is the first long line", firstlong);
-    fprintf(qh ferr, ".  Continue with %d points.\n", newnum);
+      qh_fprintf(qh ferr, 8053, ", line %d is the first long line", firstlong);
+    qh_fprintf(qh ferr, 8054, ".  Continue with %d points.\n", newnum);
     numinput= newnum;
     if (isdelaunay && qh ATinfinity) {
       for (k= tokcount % diminput; k--; )
-	infinity[k] -= *(--coords);
+        infinity[k] -= *(--coords);
       *numpoints= newnum+1;
     }else {
       coords -= tokcount % diminput;
@@ -4008,15 +3924,15 @@
     if (coords == infinity)
       coords += (*dimension) -1;
     else {
-      for (k= 0; k < (*dimension) -1; k++)
-	*(coords++)= infinity[k];
+      for (k=0; k < (*dimension) -1; k++)
+        *(coords++)= infinity[k];
     }
     *(coords++)= maxboloid * 1.1;
   }
   if (qh rbox_command[0]) {
     qh rbox_command[strlen(qh rbox_command)-1]= '\0';
-    if (!strcmp (qh rbox_command, "./rbox D4")) 
-      fprintf (qh ferr, "\n\
+    if (!strcmp(qh rbox_command, "./rbox D4"))
+      qh_fprintf(qh ferr, 8055, "\n\
 This is the qhull test case.  If any errors or core dumps occur,\n\
 recompile qhull with 'make new'.  If errors still occur, there is\n\
 an incompatibility.  You should try a different compiler.  You can also\n\
@@ -4025,22 +3941,22 @@
 \n\
 Type 'qhull' for a short list of options.\n");
   }
-  free (qh line);
+  qh_free(qh line);
   qh line= NULL;
   if (qh half_space) {
-    free (qh half_space);
+    qh_free(qh half_space);
     qh half_space= NULL;
   }
   qh temp_malloc= NULL;
-  trace1((qh ferr,"qh_readpoints: read in %d %d-dimensional points\n",
-	  numinput, diminput));
+  trace1((qh ferr, 1008,"qh_readpoints: read in %d %d-dimensional points\n",
+          numinput, diminput));
   return(points);
 } /* readpoints */
 
 
 /*---------------------------------
-  
+
   qh_setfeasible( dim )
     set qh.FEASIBLEpoint from qh.feasible_string in "n,n,n" or "n n n" format
 
@@ -4048,26 +3964,26 @@
     "n,n,n" already checked by qh_initflags()
     see qh_readfeasible()
 */
-void qh_setfeasible (int dim) {
+void qh_setfeasible(int dim) {
   int tokcount= 0;
   char *s;
   coordT *coords, value;
 
   if (!(s= qh feasible_string)) {
-    fprintf(qh ferr, "\
+    qh_fprintf(qh ferr, 6223, "\
 qhull input error: halfspace intersection needs a feasible point.\n\
 Either prepend the input with 1 point or use 'Hn,n,n'.  See manual.\n");
-    qh_errexit (qh_ERRinput, NULL, NULL);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
-  if (!(qh feasible_point= (pointT*)malloc (dim* sizeof(coordT)))) {
-    fprintf(qh ferr, "qhull error: insufficient memory for 'Hn,n,n'\n");
+  if (!(qh feasible_point= (pointT*)qh_malloc(dim * sizeof(coordT)))) {
+    qh_fprintf(qh ferr, 6079, "qhull error: insufficient memory for 'Hn,n,n'\n");
     qh_errexit(qh_ERRmem, NULL, NULL);
   }
   coords= qh feasible_point;
   while (*s) {
-    value= qh_strtod (s, &s);
+    value= qh_strtod(s, &s);
     if (++tokcount > dim) {
-      fprintf (qh ferr, "qhull input warning: more coordinates for 'H%s' than dimension %d\n",
+      qh_fprintf(qh ferr, 7059, "qhull input warning: more coordinates for 'H%s' than dimension %d\n",
           qh feasible_string, dim);
       break;
     }
@@ -4075,15 +3991,15 @@
     if (*s)
       s++;
   }
-  while (++tokcount <= dim)    
+  while (++tokcount <= dim)
     *(coords++)= 0.0;
 } /* setfeasible */
 
 /*---------------------------------
-  
+
   qh_skipfacet( facet )
-    returns 'True' if this facet is not to be printed 
+    returns 'True' if this facet is not to be printed
 
   notes:
     based on the user provided slice thresholds and 'good' specifications
@@ -4096,13 +4012,51 @@
       return !qh PRINTgood;
     FOREACHneighbor_(facet) {
       if (neighbor->good)
-	return False;
+        return False;
     }
     return True;
   }else if (qh PRINTgood)
     return !facet->good;
   else if (!facet->normal)
     return True;
-  return (!qh_inthresholds (facet->normal, NULL));
+  return(!qh_inthresholds(facet->normal, NULL));
 } /* skipfacet */
 
+/*---------------------------------
+
+  qh_skipfilename( string )
+    returns pointer to character after filename
+
+  notes:
+    skips leading spaces
+    ends with spacing or eol
+    if starts with ' or " ends with the same, skipping \' or \"
+    For qhull, qh_argv_to_command() only uses double quotes
+*/
+char *qh_skipfilename(char *filename) {
+  char *s= filename;  /* non-const due to return */
+  char c;
+
+  while (*s && isspace(*s))
+    s++;
+  c= *s++;
+  if (c == '\0') {
+    qh_fprintf(qh ferr, 6204, "qhull input error: filename expected, none found.\n");
+    qh_errexit(qh_ERRinput, NULL, NULL);
+  }
+  if (c == '\'' || c == '"') {
+    while (*s !=c || s[-1] == '\\') {
+      if (!*s) {
+        qh_fprintf(qh ferr, 6203, "qhull input error: missing quote after filename -- %s\n", filename);
+        qh_errexit(qh_ERRinput, NULL, NULL);
+      }
+      s++;
+    }
+    s++;
+  }
+  else while (*s && !isspace(*s))
+      s++;
+  return s;
+} /* skipfilename */
+

Modified: trunk/scipy/spatial/qhull/src/io.h
===================================================================
--- trunk/scipy/spatial/qhull/src/io.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/io.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,22 +1,26 @@
 /*
  ---------------------------------
 
-   io.h 
+   io.h
    declarations of Input/Output functions
 
-   see README, qhull.h and io.c
+   see README, libqhull.h and io.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/io.h#25 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFio
 #define qhDEFio 1
 
+#include "libqhull.h"
+
 /*============ constants and flags ==================*/
 
 /*----------------------------------
-  
+
   qh_MAXfirst
     maximum length of first two lines of stdin
 */
@@ -24,7 +28,7 @@
 
 /*----------------------------------
-  
+
   qh_MINradius
     min radius for Gp and Gv, fraction of maxcoord
 */
@@ -32,16 +36,16 @@
 
 /*----------------------------------
-  
+
   qh_GEOMepsilon
-    adjust outer planes for 'lines closer' and geomview roundoff.  
+    adjust outer planes for 'lines closer' and geomview roundoff.
     This prevents bleed through.
 */
 #define qh_GEOMepsilon 2e-3
 
 /*----------------------------------
-  
+
   qh_WHITESPACE
     possible values of white space
 */
@@ -50,7 +54,7 @@
 
 /*----------------------------------
-  
+
   qh_RIDGE
     to select which ridges to print in qh_eachvoronoi
 */
@@ -62,7 +66,7 @@
 
 /*----------------------------------
-  
+
   printvridgeT
     prints results of qh_printvdiagram
 
@@ -73,82 +77,83 @@
 
 /*============== -prototypes in alphabetical order =========*/
 
-void    dfacet( unsigned id);
-void    dvertex( unsigned id);
-int	qh_compare_facetarea(const void *p1, const void *p2);
-int	qh_compare_facetmerge(const void *p1, const void *p2);
-int	qh_compare_facetvisit(const void *p1, const void *p2);
-int	qh_compare_vertexpoint(const void *p1, const void *p2); /* not used */
-
-void    qh_countfacets (facetT *facetlist, setT *facets, boolT printall, 
-              int *numfacetsp, int *numsimplicialp, int *totneighborsp, 
+void    dfacet(unsigned id);
+void    dvertex(unsigned id);
+int     qh_compare_facetarea(const void *p1, const void *p2);
+int     qh_compare_facetmerge(const void *p1, const void *p2);
+int     qh_compare_facetvisit(const void *p1, const void *p2);
+int     qh_compare_vertexpoint(const void *p1, const void *p2); /* not used */
+void    qh_copyfilename(char *filename, int size, const char* source, int length);
+void    qh_countfacets(facetT *facetlist, setT *facets, boolT printall,
+              int *numfacetsp, int *numsimplicialp, int *totneighborsp,
               int *numridgesp, int *numcoplanarsp, int *numnumtricoplanarsp);
-pointT *qh_detvnorm (vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp);
-setT   *qh_detvridge (vertexT *vertex);
+pointT *qh_detvnorm(vertexT *vertex, vertexT *vertexA, setT *centers, realT *offsetp);
+setT   *qh_detvridge(vertexT *vertex);
 setT   *qh_detvridge3 (vertexT *atvertex, vertexT *vertex);
-int     qh_eachvoronoi (FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder);
-int     qh_eachvoronoi_all (FILE *fp, printvridgeT printvridge, boolT isupper, qh_RIDGE innerouter, boolT inorder);
-void	qh_facet2point(facetT *facet, pointT **point0, pointT **point1, realT *mindist);
-setT   *qh_facetvertices (facetT *facetlist, setT *facets, boolT allfacets);
-void    qh_geomplanes (facetT *facet, realT *outerplane, realT *innerplane);
-void    qh_markkeep (facetT *facetlist);
-setT   *qh_markvoronoi (facetT *facetlist, setT *facets, boolT printall, boolT *islowerp, int *numcentersp);
+int     qh_eachvoronoi(FILE *fp, printvridgeT printvridge, vertexT *atvertex, boolT visitall, qh_RIDGE innerouter, boolT inorder);
+int     qh_eachvoronoi_all(FILE *fp, printvridgeT printvridge, boolT isUpper, qh_RIDGE innerouter, boolT inorder);
+void    qh_facet2point(facetT *facet, pointT **point0, pointT **point1, realT *mindist);
+setT   *qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets);
+void    qh_geomplanes(facetT *facet, realT *outerplane, realT *innerplane);
+void    qh_markkeep(facetT *facetlist);
+setT   *qh_markvoronoi(facetT *facetlist, setT *facets, boolT printall, boolT *isLowerp, int *numcentersp);
 void    qh_order_vertexneighbors(vertexT *vertex);
-void	qh_printafacet(FILE *fp, int format, facetT *facet, boolT printall);
-void    qh_printbegin (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall);
-void 	qh_printcenter (FILE *fp, int format, char *string, facetT *facet);
-void    qh_printcentrum (FILE *fp, facetT *facet, realT radius);
-void    qh_printend (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall);
-void    qh_printend4geom (FILE *fp, facetT *facet, int *num, boolT printall);
-void    qh_printextremes (FILE *fp, facetT *facetlist, setT *facets, int printall);
-void    qh_printextremes_2d (FILE *fp, facetT *facetlist, setT *facets, int printall);
-void    qh_printextremes_d (FILE *fp, facetT *facetlist, setT *facets, int printall);
-void	qh_printfacet(FILE *fp, facetT *facet);
-void	qh_printfacet2math(FILE *fp, facetT *facet, int format, int notfirst);
-void	qh_printfacet2geom(FILE *fp, facetT *facet, realT color[3]);
+void    qh_prepare_output(void);
+void    qh_printafacet(FILE *fp, qh_PRINT format, facetT *facet, boolT printall);
+void    qh_printbegin(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printcenter(FILE *fp, qh_PRINT format, const char *string, facetT *facet);
+void    qh_printcentrum(FILE *fp, facetT *facet, realT radius);
+void    qh_printend(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printend4geom(FILE *fp, facetT *facet, int *num, boolT printall);
+void    qh_printextremes(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printextremes_2d(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printextremes_d(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printfacet(FILE *fp, facetT *facet);
+void    qh_printfacet2math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
+void    qh_printfacet2geom(FILE *fp, facetT *facet, realT color[3]);
 void    qh_printfacet2geom_points(FILE *fp, pointT *point1, pointT *point2,
-			       facetT *facet, realT offset, realT color[3]);
-void	qh_printfacet3math (FILE *fp, facetT *facet, int format, int notfirst);
-void	qh_printfacet3geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
-void	qh_printfacet3geom_points(FILE *fp, setT *points, facetT *facet, realT offset, realT color[3]);
-void	qh_printfacet3geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
-void	qh_printfacet3vertex(FILE *fp, facetT *facet, int format);
-void	qh_printfacet4geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
-void	qh_printfacet4geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
-void	qh_printfacetNvertex_nonsimplicial(FILE *fp, facetT *facet, int id, int format);
-void	qh_printfacetNvertex_simplicial(FILE *fp, facetT *facet, int format);
+                               facetT *facet, realT offset, realT color[3]);
+void    qh_printfacet3math(FILE *fp, facetT *facet, qh_PRINT format, int notfirst);
+void    qh_printfacet3geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
+void    qh_printfacet3geom_points(FILE *fp, setT *points, facetT *facet, realT offset, realT color[3]);
+void    qh_printfacet3geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
+void    qh_printfacet3vertex(FILE *fp, facetT *facet, qh_PRINT format);
+void    qh_printfacet4geom_nonsimplicial(FILE *fp, facetT *facet, realT color[3]);
+void    qh_printfacet4geom_simplicial(FILE *fp, facetT *facet, realT color[3]);
+void    qh_printfacetNvertex_nonsimplicial(FILE *fp, facetT *facet, int id, qh_PRINT format);
+void    qh_printfacetNvertex_simplicial(FILE *fp, facetT *facet, qh_PRINT format);
 void    qh_printfacetheader(FILE *fp, facetT *facet);
 void    qh_printfacetridges(FILE *fp, facetT *facet);
-void	qh_printfacets(FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall);
-void	qh_printhelp_degenerate(FILE *fp);
-void	qh_printhelp_singular(FILE *fp);
-void	qh_printhyperplaneintersection(FILE *fp, facetT *facet1, facetT *facet2,
-  		   setT *vertices, realT color[3]);
-void	qh_printneighborhood (FILE *fp, int format, facetT *facetA, facetT *facetB, boolT printall);
-void    qh_printline3geom (FILE *fp, pointT *pointA, pointT *pointB, realT color[3]);
-void	qh_printpoint(FILE *fp, char *string, pointT *point);
-void	qh_printpointid(FILE *fp, char *string, int dim, pointT *point, int id);
+void    qh_printfacets(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printhyperplaneintersection(FILE *fp, facetT *facet1, facetT *facet2,
+                   setT *vertices, realT color[3]);
+void    qh_printneighborhood(FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall);
+void    qh_printline3geom(FILE *fp, pointT *pointA, pointT *pointB, realT color[3]);
+void    qh_printpoint(FILE *fp, const char *string, pointT *point);
+void    qh_printpointid(FILE *fp, const char *string, int dim, pointT *point, int id);
 void    qh_printpoint3 (FILE *fp, pointT *point);
-void    qh_printpoints_out (FILE *fp, facetT *facetlist, setT *facets, int printall);
-void    qh_printpointvect (FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]);
+void    qh_printpoints_out(FILE *fp, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printpointvect(FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius, realT color[3]);
 void    qh_printpointvect2 (FILE *fp, pointT *point, coordT *normal, pointT *center, realT radius);
-void	qh_printridge(FILE *fp, ridgeT *ridge);
+void    qh_printridge(FILE *fp, ridgeT *ridge);
 void    qh_printspheres(FILE *fp, setT *vertices, realT radius);
-void    qh_printvdiagram (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printvdiagram(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
 int     qh_printvdiagram2 (FILE *fp, printvridgeT printvridge, setT *vertices, qh_RIDGE innerouter, boolT inorder);
-void	qh_printvertex(FILE *fp, vertexT *vertex);
-void	qh_printvertexlist (FILE *fp, char* string, facetT *facetlist,
+void    qh_printvertex(FILE *fp, vertexT *vertex);
+void    qh_printvertexlist(FILE *fp, const char* string, facetT *facetlist,
                          setT *facets, boolT printall);
-void	qh_printvertices (FILE *fp, char* string, setT *vertices);
-void    qh_printvneighbors (FILE *fp, facetT* facetlist, setT *facets, boolT printall);
-void    qh_printvoronoi (FILE *fp, int format, facetT *facetlist, setT *facets, boolT printall);
-void    qh_printvnorm (FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
-void    qh_printvridge (FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
-void	qh_produce_output(void);
+void    qh_printvertices(FILE *fp, const char* string, setT *vertices);
+void    qh_printvneighbors(FILE *fp, facetT* facetlist, setT *facets, boolT printall);
+void    qh_printvoronoi(FILE *fp, qh_PRINT format, facetT *facetlist, setT *facets, boolT printall);
+void    qh_printvnorm(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
+void    qh_printvridge(FILE *fp, vertexT *vertex, vertexT *vertexA, setT *centers, boolT unbounded);
+void    qh_produce_output(void);
+void    qh_produce_output2(void);
 void    qh_projectdim3 (pointT *source, pointT *destination);
-int     qh_readfeasible (int dim, char *remainder);
+int     qh_readfeasible(int dim, const char *curline);
 coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);
-void    qh_setfeasible (int dim);
-boolT	qh_skipfacet(facetT *facet);
+void    qh_setfeasible(int dim);
+boolT   qh_skipfacet(facetT *facet);
+char   *qh_skipfilename(char *filename);
 
 #endif /* qhDEFio */

Copied: trunk/scipy/spatial/qhull/src/libqhull.c (from rev 6901, trunk/scipy/spatial/qhull/src/qhull.c)
===================================================================
--- trunk/scipy/spatial/qhull/src/libqhull.c	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/libqhull.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,1401 @@
+/*
  ---------------------------------
+
+   libqhull.c
+   Quickhull algorithm for convex hulls
+
+   qhull() and top-level routines
+
+   see qh-qhull.htm, libqhull.h, unix.c
+
+   see qhull_a.h for internal functions
+
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/libqhull.c#7 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
+*/
+
+#include "qhull_a.h"
+
+/*============= functions in alphabetic order after qhull() =======*/
+
+/*---------------------------------
+
+  qh_qhull()
+    compute DIM3 convex hull of qh.num_points starting at qh.first_point
+    qh contains all global options and variables
+
+  returns:
+    returns polyhedron
+      qh.facet_list, qh.num_facets, qh.vertex_list, qh.num_vertices,
+
+    returns global variables
+      qh.hulltime, qh.max_outside, qh.interior_point, qh.max_vertex, qh.min_vertex
+
+    returns precision constants
+      qh.ANGLEround, centrum_radius, cos_max, DISTround, MAXabs_coord, ONEmerge
+
+  notes:
+    unless needed for output
+      qh.max_vertex and qh.min_vertex are max/min due to merges
+
+  see:
+    to add individual points to either qh.num_points
+      use qh_addpoint()
+
+    if qh.GETarea
+      qh_produceoutput() returns qh.totarea and qh.totvol via qh_getarea()
+
+  design:
+    record starting time
+    initialize hull and partition points
+    build convex hull
+    unless early termination
+      update facet->maxoutside for vertices, coplanar, and near-inside points
+    error if temporary sets exist
+    record end time
+*/
+
+void qh_qhull(void) {
+  int numoutside;
+
+  qh hulltime= qh_CPUclock;
+  if (qh RERUN || qh JOGGLEmax < REALmax/2)
+    qh_build_withrestart();
+  else {
+    qh_initbuild();
+    qh_buildhull();
+  }
+  if (!qh STOPpoint && !qh STOPcone) {
+    if (qh ZEROall_ok && !qh TESTvneighbors && qh MERGEexact)
+      qh_checkzero( qh_ALL);
+    if (qh ZEROall_ok && !qh TESTvneighbors && !qh WAScoplanar) {
+      trace2((qh ferr, 2055, "qh_qhull: all facets are clearly convex and no coplanar points.  Post-merging and check of maxout not needed.\n"));
+      qh DOcheckmax= False;
+    }else {
+      if (qh MERGEexact || (qh hull_dim > qh_DIMreduceBuild && qh PREmerge))
+        qh_postmerge("First post-merge", qh premerge_centrum, qh premerge_cos,
+             (qh POSTmerge ? False : qh TESTvneighbors));
+      else if (!qh POSTmerge && qh TESTvneighbors)
+        qh_postmerge("For testing vertex neighbors", qh premerge_centrum,
+             qh premerge_cos, True);
+      if (qh POSTmerge)
+        qh_postmerge("For post-merging", qh postmerge_centrum,
+             qh postmerge_cos, qh TESTvneighbors);
+      if (qh visible_list == qh facet_list) { /* i.e., merging done */
+        qh findbestnew= True;
+        qh_partitionvisible(/*visible_list, newfacet_list*/ !qh_ALL, &numoutside);
+        qh findbestnew= False;
+        qh_deletevisible(/*qh visible_list*/);
+        qh_resetlists(False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
+      }
+    }
+    if (qh DOcheckmax){
+      if (qh REPORTfreq) {
+        qh_buildtracing(NULL, NULL);
+        qh_fprintf(qh ferr, 8115, "\nTesting all coplanar points.\n");
+      }
+      qh_check_maxout();
+    }
+    if (qh KEEPnearinside && !qh maxoutdone)
+      qh_nearcoplanar();
+  }
+  if (qh_setsize(qhmem.tempstack) != 0) {
+    qh_fprintf(qh ferr, 6164, "qhull internal error (qh_qhull): temporary sets not empty(%d)\n",
+             qh_setsize(qhmem.tempstack));
+    qh_errexit(qh_ERRqhull, NULL, NULL);
+  }
+  qh hulltime= qh_CPUclock - qh hulltime;
+  qh QHULLfinished= True;
+  trace1((qh ferr, 1036, "Qhull: algorithm completed\n"));
+} /* qhull */
+
+/*---------------------------------
+
+  qh_addpoint( furthest, facet, checkdist )
+    add point (usually furthest point) above facet to hull
+    if checkdist,
+      check that point is above facet.
+      if point is not outside of the hull, uses qh_partitioncoplanar()
+      assumes that facet is defined by qh_findbestfacet()
+    else if facet specified,
+      assumes that point is above facet (major damage if below)
+    for Delaunay triangulations,
+      Use qh_setdelaunay() to lift point to paraboloid and scale by 'Qbb' if needed
+      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates.
+
+  returns:
+    returns False if user requested an early termination
+     qh.visible_list, newfacet_list, delvertex_list, NEWfacets may be defined
+    updates qh.facet_list, qh.num_facets, qh.vertex_list, qh.num_vertices
+    clear qh.maxoutdone (will need to call qh_check_maxout() for facet->maxoutside)
+    if unknown point, adds a pointer to qh.other_points
+      do not deallocate the point's coordinates
+
+  notes:
+    assumes point is near its best facet and not at a local minimum of a lens
+      distributions.  Use qh_findbestfacet to avoid this case.
+    uses qh.visible_list, qh.newfacet_list, qh.delvertex_list, qh.NEWfacets
+
+  see also:
+    qh_triangulate() -- triangulate non-simplicial facets
+
+  design:
+    add point to other_points if needed
+    if checkdist
+      if point not above facet
+        partition coplanar point
+        exit
+    exit if pre STOPpoint requested
+    find horizon and visible facets for point
+    make new facets for point to horizon
+    make hyperplanes for point
+    compute balance statistics
+    match neighboring new facets
+    update vertex neighbors and delete interior vertices
+    exit if STOPcone requested
+    merge non-convex new facets
+    if merge found, many merges, or 'Qf'
+       use qh_findbestnew() instead of qh_findbest()
+    partition outside points from visible facets
+    delete visible facets
+    check polyhedron if requested
+    exit if post STOPpoint requested
+    reset working lists of facets and vertices
+*/
+boolT qh_addpoint(pointT *furthest, facetT *facet, boolT checkdist) {
+  int goodvisible, goodhorizon;
+  vertexT *vertex;
+  facetT *newfacet;
+  realT dist, newbalance, pbalance;
+  boolT isoutside= False;
+  int numpart, numpoints, numnew, firstnew;
+
+  qh maxoutdone= False;
+  if (qh_pointid(furthest) == -1)
+    qh_setappend(&qh other_points, furthest);
+  if (!facet) {
+    qh_fprintf(qh ferr, 6213, "qhull internal error (qh_addpoint): NULL facet.  Need to call qh_findbestfacet first\n");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
+  }
+  if (checkdist) {
+    facet= qh_findbest(furthest, facet, !qh_ALL, !qh_ISnewfacets, !qh_NOupper,
+                        &dist, &isoutside, &numpart);
+    zzadd_(Zpartition, numpart);
+    if (!isoutside) {
+      zinc_(Znotmax);  /* last point of outsideset is no longer furthest. */
+      facet->notfurthest= True;
+      qh_partitioncoplanar(furthest, facet, &dist);
+      return True;
+    }
+  }
+  qh_buildtracing(furthest, facet);
+  if (qh STOPpoint < 0 && qh furthest_id == -qh STOPpoint-1) {
+    facet->notfurthest= True;
+    return False;
+  }
+  qh_findhorizon(furthest, facet, &goodvisible, &goodhorizon);
+  if (qh ONLYgood && !(goodvisible+goodhorizon) && !qh GOODclosest) {
+    zinc_(Znotgood);
+    facet->notfurthest= True;
+    /* last point of outsideset is no longer furthest.  This is ok
+       since all points of the outside are likely to be bad */
+    qh_resetlists(False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
+    return True;
+  }
+  zzinc_(Zprocessed);
+  firstnew= qh facet_id;
+  vertex= qh_makenewfacets(furthest /*visible_list, attaches if !ONLYgood */);
+  qh_makenewplanes(/* newfacet_list */);
+  numnew= qh facet_id - firstnew;
+  newbalance= numnew - (realT) (qh num_facets-qh num_visible)
+                         * qh hull_dim/qh num_vertices;
+  wadd_(Wnewbalance, newbalance);
+  wadd_(Wnewbalance2, newbalance * newbalance);
+  if (qh ONLYgood
+  && !qh_findgood(qh newfacet_list, goodhorizon) && !qh GOODclosest) {
+    FORALLnew_facets
+      qh_delfacet(newfacet);
+    qh_delvertex(vertex);
+    qh_resetlists(True, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
+    zinc_(Znotgoodnew);
+    facet->notfurthest= True;
+    return True;
+  }
+  if (qh ONLYgood)
+    qh_attachnewfacets(/*visible_list*/);
+  qh_matchnewfacets();
+  qh_updatevertices();
+  if (qh STOPcone && qh furthest_id == qh STOPcone-1) {
+    facet->notfurthest= True;
+    return False;  /* visible_list etc. still defined */
+  }
+  qh findbestnew= False;
+  if (qh PREmerge || qh MERGEexact) {
+    qh_premerge(vertex, qh premerge_centrum, qh premerge_cos);
+    if (qh_USEfindbestnew)
+      qh findbestnew= True;
+    else {
+      FORALLnew_facets {
+        if (!newfacet->simplicial) {
+          qh findbestnew= True;  /* use qh_findbestnew instead of qh_findbest*/
+          break;
+        }
+      }
+    }
+  }else if (qh BESToutside)
+    qh findbestnew= True;
+  qh_partitionvisible(/*visible_list, newfacet_list*/ !qh_ALL, &numpoints);
+  qh findbestnew= False;
+  qh findbest_notsharp= False;
+  zinc_(Zpbalance);
+  pbalance= numpoints - (realT) qh hull_dim /* assumes all points extreme */
+                * (qh num_points - qh num_vertices)/qh num_vertices;
+  wadd_(Wpbalance, pbalance);
+  wadd_(Wpbalance2, pbalance * pbalance);
+  qh_deletevisible(/*qh visible_list*/);
+  zmax_(Zmaxvertex, qh num_vertices);
+  qh NEWfacets= False;
+  if (qh IStracing >= 4) {
+    if (qh num_facets < 2000)
+      qh_printlists();
+    qh_printfacetlist(qh newfacet_list, NULL, True);
+    qh_checkpolygon(qh facet_list);
+  }else if (qh CHECKfrequently) {
+    if (qh num_facets < 50)
+      qh_checkpolygon(qh facet_list);
+    else
+      qh_checkpolygon(qh newfacet_list);
+  }
+  if (qh STOPpoint > 0 && qh furthest_id == qh STOPpoint-1)
+    return False;
+  qh_resetlists(True, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
+  /* qh_triangulate(); to test qh.TRInormals */
+  trace2((qh ferr, 2056, "qh_addpoint: added p%d new facets %d new balance %2.2g point balance %2.2g\n",
+    qh_pointid(furthest), numnew, newbalance, pbalance));
+  return True;
+} /* addpoint */
+
+/*---------------------------------
+
+  qh_build_withrestart()
+    allow restarts due to qh.JOGGLEmax while calling qh_buildhull()
+    qh.FIRSTpoint/qh.NUMpoints is point array
+        it may be moved by qh_joggleinput()
+*/
+void qh_build_withrestart(void) {
+  int restart;
+
+  qh ALLOWrestart= True;
+  while (True) {
+    restart= setjmp(qh restartexit); /* simple statement for CRAY J916 */
+    if (restart) {       /* only from qh_precision() */
+      zzinc_(Zretry);
+      wmax_(Wretrymax, qh JOGGLEmax);
+      /* QH7078 warns about using 'TCn' with 'QJn' */
+      qh STOPcone= -1; /* if break from joggle, prevents normal output */
+    }
+    if (!qh RERUN && qh JOGGLEmax < REALmax/2) {
+      if (qh build_cnt > qh_JOGGLEmaxretry) {
+        qh_fprintf(qh ferr, 6229, "qhull precision error: %d attempts to construct a convex hull\n\
+        with joggled input.  Increase joggle above 'QJ%2.2g'\n\
+        or modify qh_JOGGLE... parameters in user.h\n",
+           qh build_cnt, qh JOGGLEmax);
+        qh_errexit(qh_ERRqhull, NULL, NULL);
+      }
+      if (qh build_cnt && !restart)
+        break;
+    }else if (qh build_cnt && qh build_cnt >= qh RERUN)
+      break;
+    qh STOPcone= 0;
+    qh_freebuild(True);  /* first call is a nop */
+    qh build_cnt++;
+    if (!qh qhull_optionsiz)
+      qh qhull_optionsiz= (int)strlen(qh qhull_options);   /* WARN64 */
+    else {
+      qh qhull_options [qh qhull_optionsiz]= '\0';
+      qh qhull_optionlen= qh_OPTIONline;  /* starts a new line */
+    }
+    qh_option("_run", &qh build_cnt, NULL);
+    if (qh build_cnt == qh RERUN) {
+      qh IStracing= qh TRACElastrun;  /* duplicated from qh_initqhull_globals */
+      if (qh TRACEpoint != -1 || qh TRACEdist < REALmax/2 || qh TRACEmerge) {
+        qh TRACElevel= (qh IStracing? qh IStracing : 3);
+        qh IStracing= 0;
+      }
+      qhmem.IStracing= qh IStracing;
+    }
+    if (qh JOGGLEmax < REALmax/2)
+      qh_joggleinput();
+    qh_initbuild();
+    qh_buildhull();
+    if (qh JOGGLEmax < REALmax/2 && !qh MERGING)
+      qh_checkconvex(qh facet_list, qh_ALGORITHMfault);
+  }
+  qh ALLOWrestart= False;
+} /* qh_build_withrestart */
+
+/*---------------------------------
+
+  qh_buildhull()
+    construct a convex hull by adding outside points one at a time
+
+  returns:
+
+  notes:
+    may be called multiple times
+    checks facet and vertex lists for incorrect flags
+    to recover from STOPcone, call qh_deletevisible and qh_resetlists
+
+  design:
+    check visible facet and newfacet flags
+    check newlist vertex flags and qh.STOPcone/STOPpoint
+    for each facet with a furthest outside point
+      add point to facet
+      exit if qh.STOPcone or qh.STOPpoint requested
+    if qh.NARROWhull for initial simplex
+      partition remaining outside points to coplanar sets
+*/
+void qh_buildhull(void) {
+  facetT *facet;
+  pointT *furthest;
+  vertexT *vertex;
+  int id;
+
+  trace1((qh ferr, 1037, "qh_buildhull: start build hull\n"));
+  FORALLfacets {
+    if (facet->visible || facet->newfacet) {
+      qh_fprintf(qh ferr, 6165, "qhull internal error (qh_buildhull): visible or new facet f%d in facet list\n",
+                   facet->id);
+      qh_errexit(qh_ERRqhull, facet, NULL);
+    }
+  }
+  FORALLvertices {
+    if (vertex->newlist) {
+      qh_fprintf(qh ferr, 6166, "qhull internal error (qh_buildhull): new vertex f%d in vertex list\n",
+                   vertex->id);
+      qh_errprint("ERRONEOUS", NULL, NULL, NULL, vertex);
+      qh_errexit(qh_ERRqhull, NULL, NULL);
+    }
+    id= qh_pointid(vertex->point);
+    if ((qh STOPpoint>0 && id == qh STOPpoint-1) ||
+        (qh STOPpoint<0 && id == -qh STOPpoint-1) ||
+        (qh STOPcone>0 && id == qh STOPcone-1)) {
+      trace1((qh ferr, 1038,"qh_buildhull: stop point or cone P%d in initial hull\n", id));
+      return;
+    }
+  }
+  qh facet_next= qh facet_list;      /* advance facet when processed */
+  while ((furthest= qh_nextfurthest(&facet))) {
+    qh num_outside--;  /* if ONLYmax, furthest may not be outside */
+    if (!qh_addpoint(furthest, facet, qh ONLYmax))
+      break;
+  }
+  if (qh NARROWhull) /* move points from outsideset to coplanarset */
+    qh_outcoplanar( /* facet_list */ );
+  if (qh num_outside && !furthest) {
+    qh_fprintf(qh ferr, 6167, "qhull internal error (qh_buildhull): %d outside points were never processed.\n", qh num_outside);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
+  }
+  trace1((qh ferr, 1039, "qh_buildhull: completed the hull construction\n"));
+} /* buildhull */
+
+
+/*---------------------------------
+
+  qh_buildtracing( furthest, facet )
+    trace an iteration of qh_buildhull() for furthest point and facet
+    if !furthest, prints progress message
+
+  returns:
+    tracks progress with qh.lastreport
+    updates qh.furthest_id (-3 if furthest is NULL)
+    also resets visit_id, vertext_visit on wrap around
+
+  see:
+    qh_tracemerging()
+
+  design:
+    if !furthest
+      print progress message
+      exit
+    if 'TFn' iteration
+      print progress message
+    else if tracing
+      trace furthest point and facet
+    reset qh.visit_id and qh.vertex_visit if overflow may occur
+    set qh.furthest_id for tracing
+*/
+void qh_buildtracing(pointT *furthest, facetT *facet) {
+  realT dist= 0;
+  float cpu;
+  int total, furthestid;
+  time_t timedata;
+  struct tm *tp;
+  vertexT *vertex;
+
+  qh old_randomdist= qh RANDOMdist;
+  qh RANDOMdist= False;
+  if (!furthest) {
+    time(&timedata);
+    tp= localtime(&timedata);
+    cpu= (float)qh_CPUclock - (float)qh hulltime;
+    cpu /= (float)qh_SECticks;
+    total= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
+    qh_fprintf(qh ferr, 8118, "\n\
+At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\
+ The current hull contains %d facets and %d vertices.  Last point was p%d\n",
+      tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh facet_id -1,
+      total, qh num_facets, qh num_vertices, qh furthest_id);
+    return;
+  }
+  furthestid= qh_pointid(furthest);
+  if (qh TRACEpoint == furthestid) {
+    qh IStracing= qh TRACElevel;
+    qhmem.IStracing= qh TRACElevel;
+  }else if (qh TRACEpoint != -1 && qh TRACEdist < REALmax/2) {
+    qh IStracing= 0;
+    qhmem.IStracing= 0;
+  }
+  if (qh REPORTfreq && (qh facet_id-1 > qh lastreport+qh REPORTfreq)) {
+    qh lastreport= qh facet_id-1;
+    time(&timedata);
+    tp= localtime(&timedata);
+    cpu= (float)qh_CPUclock - (float)qh hulltime;
+    cpu /= (float)qh_SECticks;
+    total= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
+    zinc_(Zdistio);
+    qh_distplane(furthest, facet, &dist);
+    qh_fprintf(qh ferr, 8119, "\n\
+At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\
+ The current hull contains %d facets and %d vertices.  There are %d\n\
+ outside points.  Next is point p%d(v%d), %2.2g above f%d.\n",
+      tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh facet_id -1,
+      total, qh num_facets, qh num_vertices, qh num_outside+1,
+      furthestid, qh vertex_id, dist, getid_(facet));
+  }else if (qh IStracing >=1) {
+    cpu= (float)qh_CPUclock - (float)qh hulltime;
+    cpu /= (float)qh_SECticks;
+    qh_distplane(furthest, facet, &dist);
+    qh_fprintf(qh ferr, 8120, "qh_addpoint: add p%d(v%d) to hull of %d facets(%2.2g above f%d) and %d outside at %4.4g CPU secs.  Previous was p%d.\n",
+      furthestid, qh vertex_id, qh num_facets, dist,
+      getid_(facet), qh num_outside+1, cpu, qh furthest_id);
+  }
+  zmax_(Zvisit2max, (int)qh visit_id/2);
+  if (qh visit_id > (unsigned) INT_MAX) {
+    zinc_(Zvisit);
+    qh visit_id= 0;
+    FORALLfacets
+      facet->visitid= 0;
+  }
+  zmax_(Zvvisit2max, (int)qh vertex_visit/2);
+  if (qh vertex_visit > (unsigned) INT_MAX/2) { /* 31 bits */
+    zinc_(Zvvisit);
+    qh vertex_visit= 0;
+    FORALLvertices
+      vertex->visitid= 0;
+  }
+  qh furthest_id= furthestid;
+  qh RANDOMdist= qh old_randomdist;
+} /* buildtracing */
+
+/*---------------------------------
+
+  qh_errexit2( exitcode, facet, otherfacet )
+    return exitcode to system after an error
+    report two facets
+
+  returns:
+    assumes exitcode non-zero
+
+  see:
+    normally use qh_errexit() in user.c(reports a facet and a ridge)
+*/
+void qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet) {
+
+  qh_errprint("ERRONEOUS", facet, otherfacet, NULL, NULL);
+  qh_errexit(exitcode, NULL, NULL);
+} /* errexit2 */
+
+
+/*---------------------------------
+
+  qh_findhorizon( point, facet, goodvisible, goodhorizon )
+    given a visible facet, find the point's horizon and visible facets
+    for all facets, !facet-visible
+
+  returns:
+    returns qh.visible_list/num_visible with all visible facets
+      marks visible facets with ->visible
+    updates count of good visible and good horizon facets
+    updates qh.max_outside, qh.max_vertex, facet->maxoutside
+
+  see:
+    similar to qh_delpoint()
+
+  design:
+    move facet to qh.visible_list at end of qh.facet_list
+    for all visible facets
+     for each unvisited neighbor of a visible facet
+       compute distance of point to neighbor
+       if point above neighbor
+         move neighbor to end of qh.visible_list
+       else if point is coplanar with neighbor
+         update qh.max_outside, qh.max_vertex, neighbor->maxoutside
+         mark neighbor coplanar (will create a samecycle later)
+         update horizon statistics
+*/
+void qh_findhorizon(pointT *point, facetT *facet, int *goodvisible, int *goodhorizon) {
+  facetT *neighbor, **neighborp, *visible;
+  int numhorizon= 0, coplanar= 0;
+  realT dist;
+
+  trace1((qh ferr, 1040,"qh_findhorizon: find horizon for point p%d facet f%d\n",qh_pointid(point),facet->id));
+  *goodvisible= *goodhorizon= 0;
+  zinc_(Ztotvisible);
+  qh_removefacet(facet);  /* visible_list at end of qh facet_list */
+  qh_appendfacet(facet);
+  qh num_visible= 1;
+  if (facet->good)
+    (*goodvisible)++;
+  qh visible_list= facet;
+  facet->visible= True;
+  facet->f.replace= NULL;
+  if (qh IStracing >=4)
+    qh_errprint("visible", facet, NULL, NULL, NULL);
+  qh visit_id++;
+  FORALLvisible_facets {
+    if (visible->tricoplanar && !qh TRInormals) {
+      qh_fprintf(qh ferr, 6230, "Qhull internal error (qh_findhorizon): does not work for tricoplanar facets.  Use option 'Q11'\n");
+      qh_errexit(qh_ERRqhull, visible, NULL);
+    }
+    visible->visitid= qh visit_id;
+    FOREACHneighbor_(visible) {
+      if (neighbor->visitid == qh visit_id)
+        continue;
+      neighbor->visitid= qh visit_id;
+      zzinc_(Znumvisibility);
+      qh_distplane(point, neighbor, &dist);
+      if (dist > qh MINvisible) {
+        zinc_(Ztotvisible);
+        qh_removefacet(neighbor);  /* append to end of qh visible_list */
+        qh_appendfacet(neighbor);
+        neighbor->visible= True;
+        neighbor->f.replace= NULL;
+        qh num_visible++;
+        if (neighbor->good)
+          (*goodvisible)++;
+        if (qh IStracing >=4)
+          qh_errprint("visible", neighbor, NULL, NULL, NULL);
+      }else {
+        if (dist > - qh MAXcoplanar) {
+          neighbor->coplanar= True;
+          zzinc_(Zcoplanarhorizon);
+          qh_precision("coplanar horizon");
+          coplanar++;
+          if (qh MERGING) {
+            if (dist > 0) {
+              maximize_(qh max_outside, dist);
+              maximize_(qh max_vertex, dist);
+#if qh_MAXoutside
+              maximize_(neighbor->maxoutside, dist);
+#endif
+            }else
+              minimize_(qh min_vertex, dist);  /* due to merge later */
+          }
+          trace2((qh ferr, 2057, "qh_findhorizon: point p%d is coplanar to horizon f%d, dist=%2.7g < qh MINvisible(%2.7g)\n",
+              qh_pointid(point), neighbor->id, dist, qh MINvisible));
+        }else
+          neighbor->coplanar= False;
+        zinc_(Ztothorizon);
+        numhorizon++;
+        if (neighbor->good)
+          (*goodhorizon)++;
+        if (qh IStracing >=4)
+          qh_errprint("horizon", neighbor, NULL, NULL, NULL);
+      }
+    }
+  }
+  if (!numhorizon) {
+    qh_precision("empty horizon");
+    qh_fprintf(qh ferr, 6168, "qhull precision error (qh_findhorizon): empty horizon\n\
+QhullPoint p%d was above all facets.\n", qh_pointid(point));
+    qh_printfacetlist(qh facet_list, NULL, True);
+    qh_errexit(qh_ERRprec, NULL, NULL);
+  }
+  trace1((qh ferr, 1041, "qh_findhorizon: %d horizon facets(good %d), %d visible(good %d), %d coplanar\n",
+       numhorizon, *goodhorizon, qh num_visible, *goodvisible, coplanar));
+  if (qh IStracing >= 4 && qh num_facets < 50)
+    qh_printlists();
+} /* findhorizon */
+
+/*---------------------------------
+
+  qh_nextfurthest( visible )
+    returns next furthest point and visible facet for qh_addpoint()
+    starts search at qh.facet_next
+
+  returns:
+    removes furthest point from outside set
+    NULL if none available
+    advances qh.facet_next over facets with empty outside sets
+
+  design:
+    for each facet from qh.facet_next
+      if empty outside set
+        advance qh.facet_next
+      else if qh.NARROWhull
+        determine furthest outside point
+        if furthest point is not outside
+          advance qh.facet_next(point will be coplanar)
+    remove furthest point from outside set
+*/
+pointT *qh_nextfurthest(facetT **visible) {
+  facetT *facet;
+  int size, idx;
+  realT randr, dist;
+  pointT *furthest;
+
+  while ((facet= qh facet_next) != qh facet_tail) {
+    if (!facet->outsideset) {
+      qh facet_next= facet->next;
+      continue;
+    }
+    SETreturnsize_(facet->outsideset, size);
+    if (!size) {
+      qh_setfree(&facet->outsideset);
+      qh facet_next= facet->next;
+      continue;
+    }
+    if (qh NARROWhull) {
+      if (facet->notfurthest)
+        qh_furthestout(facet);
+      furthest= (pointT*)qh_setlast(facet->outsideset);
+#if qh_COMPUTEfurthest
+      qh_distplane(furthest, facet, &dist);
+      zinc_(Zcomputefurthest);
+#else
+      dist= facet->furthestdist;
+#endif
+      if (dist < qh MINoutside) { /* remainder of outside set is coplanar for qh_outcoplanar */
+        qh facet_next= facet->next;
+        continue;
+      }
+    }
+    if (!qh RANDOMoutside && !qh VIRTUALmemory) {
+      if (qh PICKfurthest) {
+        qh_furthestnext(/* qh facet_list */);
+        facet= qh facet_next;
+      }
+      *visible= facet;
+      return((pointT*)qh_setdellast(facet->outsideset));
+    }
+    if (qh RANDOMoutside) {
+      int outcoplanar = 0;
+      if (qh NARROWhull) {
+        FORALLfacets {
+          if (facet == qh facet_next)
+            break;
+          if (facet->outsideset)
+            outcoplanar += qh_setsize( facet->outsideset);
+        }
+      }
+      randr= qh_RANDOMint;
+      randr= randr/(qh_RANDOMmax+1);
+      idx= (int)floor((qh num_outside - outcoplanar) * randr);
+      FORALLfacet_(qh facet_next) {
+        if (facet->outsideset) {
+          SETreturnsize_(facet->outsideset, size);
+          if (!size)
+            qh_setfree(&facet->outsideset);
+          else if (size > idx) {
+            *visible= facet;
+            return((pointT*)qh_setdelnth(facet->outsideset, idx));
+          }else
+            idx -= size;
+        }
+      }
+      qh_fprintf(qh ferr, 6169, "qhull internal error (qh_nextfurthest): num_outside %d is too low\nby at least %d, or a random real %g >= 1.0\n",
+              qh num_outside, idx+1, randr);
+      qh_errexit(qh_ERRqhull, NULL, NULL);
+    }else { /* VIRTUALmemory */
+      facet= qh facet_tail->previous;
+      if (!(furthest= (pointT*)qh_setdellast(facet->outsideset))) {
+        if (facet->outsideset)
+          qh_setfree(&facet->outsideset);
+        qh_removefacet(facet);
+        qh_prependfacet(facet, &qh facet_list);
+        continue;
+      }
+      *visible= facet;
+      return furthest;
+    }
+  }
+  return NULL;
+} /* nextfurthest */
+
+/*---------------------------------
+
+  qh_partitionall( vertices, points, numpoints )
+    partitions all points in points/numpoints to the outsidesets of facets
+    vertices= vertices in qh.facet_list(!partitioned)
+
+  returns:
+    builds facet->outsideset
+    does not partition qh.GOODpoint
+    if qh.ONLYgood && !qh.MERGING,
+      does not partition qh.GOODvertex
+
+  notes:
+    faster if qh.facet_list sorted by anticipated size of outside set
+
+  design:
+    initialize pointset with all points
+    remove vertices from pointset
+    remove qh.GOODpointp from pointset (unless it's qh.STOPcone or qh.STOPpoint)
+    for all facets
+      for all remaining points in pointset
+        compute distance from point to facet
+        if point is outside facet
+          remove point from pointset (by not reappending)
+          update bestpoint
+          append point or old bestpoint to facet's outside set
+      append bestpoint to facet's outside set (furthest)
+    for all points remaining in pointset
+      partition point into facets' outside sets and coplanar sets
+*/
+void qh_partitionall(setT *vertices, pointT *points, int numpoints){
+  setT *pointset;
+  vertexT *vertex, **vertexp;
+  pointT *point, **pointp, *bestpoint;
+  int size, point_i, point_n, point_end, remaining, i, id;
+  facetT *facet;
+  realT bestdist= -REALmax, dist, distoutside;
+
+  trace1((qh ferr, 1042, "qh_partitionall: partition all points into outside sets\n"));
+  pointset= qh_settemp(numpoints);
+  qh num_outside= 0;
+  pointp= SETaddr_(pointset, pointT);
+  for (i=numpoints, point= points; i--; point += qh hull_dim)
+    *(pointp++)= point;
+  qh_settruncate(pointset, numpoints);
+  FOREACHvertex_(vertices) {
+    if ((id= qh_pointid(vertex->point)) >= 0)
+      SETelem_(pointset, id)= NULL;
+  }
+  id= qh_pointid(qh GOODpointp);
+  if (id >=0 && qh STOPcone-1 != id && -qh STOPpoint-1 != id)
+    SETelem_(pointset, id)= NULL;
+  if (qh GOODvertexp && qh ONLYgood && !qh MERGING) { /* matches qhull()*/
+    if ((id= qh_pointid(qh GOODvertexp)) >= 0)
+      SETelem_(pointset, id)= NULL;
+  }
+  if (!qh BESToutside) {  /* matches conditional for qh_partitionpoint below */
+    distoutside= qh_DISToutside; /* multiple of qh.MINoutside & qh.max_outside, see user.h */
+    zval_(Ztotpartition)= qh num_points - qh hull_dim - 1; /*misses GOOD... */
+    remaining= qh num_facets;
+    point_end= numpoints;
+    FORALLfacets {
+      size= point_end/(remaining--) + 100;
+      facet->outsideset= qh_setnew(size);
+      bestpoint= NULL;
+      point_end= 0;
+      FOREACHpoint_i_(pointset) {
+        if (point) {
+          zzinc_(Zpartitionall);
+          qh_distplane(point, facet, &dist);
+          if (dist < distoutside)
+            SETelem_(pointset, point_end++)= point;
+          else {
+            qh num_outside++;
+            if (!bestpoint) {
+              bestpoint= point;
+              bestdist= dist;
+            }else if (dist > bestdist) {
+              qh_setappend(&facet->outsideset, bestpoint);
+              bestpoint= point;
+              bestdist= dist;
+            }else
+              qh_setappend(&facet->outsideset, point);
+          }
+        }
+      }
+      if (bestpoint) {
+        qh_setappend(&facet->outsideset, bestpoint);
+#if !qh_COMPUTEfurthest
+        facet->furthestdist= bestdist;
+#endif
+      }else
+        qh_setfree(&facet->outsideset);
+      qh_settruncate(pointset, point_end);
+    }
+  }
+  /* if !qh BESToutside, pointset contains points not assigned to outsideset */
+  if (qh BESToutside || qh MERGING || qh KEEPcoplanar || qh KEEPinside) {
+    qh findbestnew= True;
+    FOREACHpoint_i_(pointset) {
+      if (point)
+        qh_partitionpoint(point, qh facet_list);
+    }
+    qh findbestnew= False;
+  }
+  zzadd_(Zpartitionall, zzval_(Zpartition));
+  zzval_(Zpartition)= 0;
+  qh_settempfree(&pointset);
+  if (qh IStracing >= 4)
+    qh_printfacetlist(qh facet_list, NULL, True);
+} /* partitionall */
+
+
+/*---------------------------------
+
+  qh_partitioncoplanar( point, facet, dist )
+    partition coplanar point to a facet
+    dist is distance from point to facet
+    if dist NULL,
+      searches for bestfacet and does nothing if inside
+    if qh.findbestnew set,
+      searches new facets instead of using qh_findbest()
+
+  returns:
+    qh.max_ouside updated
+    if qh.KEEPcoplanar or qh.KEEPinside
+      point assigned to best coplanarset
+
+  notes:
+    facet->maxoutside is updated at end by qh_check_maxout
+
+  design:
+    if dist undefined
+      find best facet for point
+      if point sufficiently below facet (depends on qh.NEARinside and qh.KEEPinside)
+        exit
+    if keeping coplanar/nearinside/inside points
+      if point is above furthest coplanar point
+        append point to coplanar set (it is the new furthest)
+        update qh.max_outside
+      else
+        append point one before end of coplanar set
+    else if point is clearly outside of qh.max_outside and bestfacet->coplanarset
+    and bestfacet is more than perpendicular to facet
+      repartition the point using qh_findbest() -- it may be put on an outsideset
+    else
+      update qh.max_outside
+*/
+void qh_partitioncoplanar(pointT *point, facetT *facet, realT *dist) {
+  facetT *bestfacet;
+  pointT *oldfurthest;
+  realT bestdist, dist2= 0, angle;
+  int numpart= 0, oldfindbest;
+  boolT isoutside;
+
+  qh WAScoplanar= True;
+  if (!dist) {
+    if (qh findbestnew)
+      bestfacet= qh_findbestnew(point, facet, &bestdist, qh_ALL, &isoutside, &numpart);
+    else
+      bestfacet= qh_findbest(point, facet, qh_ALL, !qh_ISnewfacets, qh DELAUNAY,
+                          &bestdist, &isoutside, &numpart);
+    zinc_(Ztotpartcoplanar);
+    zzadd_(Zpartcoplanar, numpart);
+    if (!qh DELAUNAY && !qh KEEPinside) { /*  for 'd', bestdist skips upperDelaunay facets */
+      if (qh KEEPnearinside) {
+        if (bestdist < -qh NEARinside) {
+          zinc_(Zcoplanarinside);
+          trace4((qh ferr, 4062, "qh_partitioncoplanar: point p%d is more than near-inside facet f%d dist %2.2g findbestnew %d\n",
+                  qh_pointid(point), bestfacet->id, bestdist, qh findbestnew));
+          return;
+        }
+      }else if (bestdist < -qh MAXcoplanar) {
+          trace4((qh ferr, 4063, "qh_partitioncoplanar: point p%d is inside facet f%d dist %2.2g findbestnew %d\n",
+                  qh_pointid(point), bestfacet->id, bestdist, qh findbestnew));
+        zinc_(Zcoplanarinside);
+        return;
+      }
+    }
+  }else {
+    bestfacet= facet;
+    bestdist= *dist;
+  }
+  if (bestdist > qh max_outside) {
+    if (!dist && facet != bestfacet) {
+      zinc_(Zpartangle);
+      angle= qh_getangle(facet->normal, bestfacet->normal);
+      if (angle < 0) {
+        /* typically due to deleted vertex and coplanar facets, e.g.,
+             RBOX 1000 s Z1 G1e-13 t1001185205 | QHULL Tv */
+        zinc_(Zpartflip);
+        trace2((qh ferr, 2058, "qh_partitioncoplanar: repartition point p%d from f%d.  It is above flipped facet f%d dist %2.2g\n",
+                qh_pointid(point), facet->id, bestfacet->id, bestdist));
+        oldfindbest= qh findbestnew;
+        qh findbestnew= False;
+        qh_partitionpoint(point, bestfacet);
+        qh findbestnew= oldfindbest;
+        return;
+      }
+    }
+    qh max_outside= bestdist;
+    if (bestdist > qh TRACEdist) {
+      qh_fprintf(qh ferr, 8122, "qh_partitioncoplanar: ====== p%d from f%d increases max_outside to %2.2g of f%d last p%d\n",
+                     qh_pointid(point), facet->id, bestdist, bestfacet->id, qh furthest_id);
+      qh_errprint("DISTANT", facet, bestfacet, NULL, NULL);
+    }
+  }
+  if (qh KEEPcoplanar + qh KEEPinside + qh KEEPnearinside) {
+    oldfurthest= (pointT*)qh_setlast(bestfacet->coplanarset);
+    if (oldfurthest) {
+      zinc_(Zcomputefurthest);
+      qh_distplane(oldfurthest, bestfacet, &dist2);
+    }
+    if (!oldfurthest || dist2 < bestdist)
+      qh_setappend(&bestfacet->coplanarset, point);
+    else
+      qh_setappend2ndlast(&bestfacet->coplanarset, point);
+  }
+  trace4((qh ferr, 4064, "qh_partitioncoplanar: point p%d is coplanar with facet f%d(or inside) dist %2.2g\n",
+          qh_pointid(point), bestfacet->id, bestdist));
+} /* partitioncoplanar */
+
+/*---------------------------------
+
+  qh_partitionpoint( point, facet )
+    assigns point to an outside set, coplanar set, or inside set (i.e., dropt)
+    if qh.findbestnew
+      uses qh_findbestnew() to search all new facets
+    else
+      uses qh_findbest()
+
+  notes:
+    after qh_distplane(), this and qh_findbest() are most expensive in 3-d
+
+  design:
+    find best facet for point
+      (either exhaustive search of new facets or directed search from facet)
+    if qh.NARROWhull
+      retain coplanar and nearinside points as outside points
+    if point is outside bestfacet
+      if point above furthest point for bestfacet
+        append point to outside set (it becomes the new furthest)
+        if outside set was empty
+          move bestfacet to end of qh.facet_list (i.e., after qh.facet_next)
+        update bestfacet->furthestdist
+      else
+        append point one before end of outside set
+    else if point is coplanar to bestfacet
+      if keeping coplanar points or need to update qh.max_outside
+        partition coplanar point into bestfacet
+    else if near-inside point
+      partition as coplanar point into bestfacet
+    else is an inside point
+      if keeping inside points
+        partition as coplanar point into bestfacet
+*/
+void qh_partitionpoint(pointT *point, facetT *facet) {
+  realT bestdist;
+  boolT isoutside;
+  facetT *bestfacet;
+  int numpart;
+#if qh_COMPUTEfurthest
+  realT dist;
+#endif
+
+  if (qh findbestnew)
+    bestfacet= qh_findbestnew(point, facet, &bestdist, qh BESToutside, &isoutside, &numpart);
+  else
+    bestfacet= qh_findbest(point, facet, qh BESToutside, qh_ISnewfacets, !qh_NOupper,
+                          &bestdist, &isoutside, &numpart);
+  zinc_(Ztotpartition);
+  zzadd_(Zpartition, numpart);
+  if (qh NARROWhull) {
+    if (qh DELAUNAY && !isoutside && bestdist >= -qh MAXcoplanar)
+      qh_precision("nearly incident point(narrow hull)");
+    if (qh KEEPnearinside) {
+      if (bestdist >= -qh NEARinside)
+        isoutside= True;
+    }else if (bestdist >= -qh MAXcoplanar)
+      isoutside= True;
+  }
+
+  if (isoutside) {
+    if (!bestfacet->outsideset
+    || !qh_setlast(bestfacet->outsideset)) {
+      qh_setappend(&(bestfacet->outsideset), point);
+      if (!bestfacet->newfacet) {
+        qh_removefacet(bestfacet);  /* make sure it's after qh facet_next */
+        qh_appendfacet(bestfacet);
+      }
+#if !qh_COMPUTEfurthest
+      bestfacet->furthestdist= bestdist;
+#endif
+    }else {
+#if qh_COMPUTEfurthest
+      zinc_(Zcomputefurthest);
+      qh_distplane(oldfurthest, bestfacet, &dist);
+      if (dist < bestdist)
+        qh_setappend(&(bestfacet->outsideset), point);
+      else
+        qh_setappend2ndlast(&(bestfacet->outsideset), point);
+#else
+      if (bestfacet->furthestdist < bestdist) {
+        qh_setappend(&(bestfacet->outsideset), point);
+        bestfacet->furthestdist= bestdist;
+      }else
+        qh_setappend2ndlast(&(bestfacet->outsideset), point);
+#endif
+    }
+    qh num_outside++;
+    trace4((qh ferr, 4065, "qh_partitionpoint: point p%d is outside facet f%d new? %d(or narrowhull)\n",
+          qh_pointid(point), bestfacet->id, bestfacet->newfacet));
+  }else if (qh DELAUNAY || bestdist >= -qh MAXcoplanar) { /* for 'd', bestdist skips upperDelaunay facets */
+    zzinc_(Zcoplanarpart);
+    if (qh DELAUNAY)
+      qh_precision("nearly incident point");
+    if ((qh KEEPcoplanar + qh KEEPnearinside) || bestdist > qh max_outside)
+      qh_partitioncoplanar(point, bestfacet, &bestdist);
+    else {
+      trace4((qh ferr, 4066, "qh_partitionpoint: point p%d is coplanar to facet f%d(dropped)\n",
+          qh_pointid(point), bestfacet->id));
+    }
+  }else if (qh KEEPnearinside && bestdist > -qh NEARinside) {
+    zinc_(Zpartnear);
+    qh_partitioncoplanar(point, bestfacet, &bestdist);
+  }else {
+    zinc_(Zpartinside);
+    trace4((qh ferr, 4067, "qh_partitionpoint: point p%d is inside all facets, closest to f%d dist %2.2g\n",
+          qh_pointid(point), bestfacet->id, bestdist));
+    if (qh KEEPinside)
+      qh_partitioncoplanar(point, bestfacet, &bestdist);
+  }
+} /* partitionpoint */
+
+/*---------------------------------
+
+  qh_partitionvisible( allpoints, numoutside )
+    partitions points in visible facets to qh.newfacet_list
+    qh.visible_list= visible facets
+    for visible facets
+      1st neighbor (if any) points to a horizon facet or a new facet
+    if allpoints(!used),
+      repartitions coplanar points
+
+  returns:
+    updates outside sets and coplanar sets of qh.newfacet_list
+    updates qh.num_outside (count of outside points)
+
+  notes:
+    qh.findbest_notsharp should be clear (extra work if set)
+
+  design:
+    for all visible facets with outside set or coplanar set
+      select a newfacet for visible facet
+      if outside set
+        partition outside set into new facets
+      if coplanar set and keeping coplanar/near-inside/inside points
+        if allpoints
+          partition coplanar set into new facets, may be assigned outside
+        else
+          partition coplanar set into coplanar sets of new facets
+    for each deleted vertex
+      if allpoints
+        partition vertex into new facets, may be assigned outside
+      else
+        partition vertex into coplanar sets of new facets
+*/
+void qh_partitionvisible(/*visible_list*/ boolT allpoints, int *numoutside) {
+  facetT *visible, *newfacet;
+  pointT *point, **pointp;
+  int coplanar=0, size;
+  unsigned count;
+  vertexT *vertex, **vertexp;
+
+  if (qh ONLYmax)
+    maximize_(qh MINoutside, qh max_vertex);
+  *numoutside= 0;
+  FORALLvisible_facets {
+    if (!visible->outsideset && !visible->coplanarset)
+      continue;
+    newfacet= visible->f.replace;
+    count= 0;
+    while (newfacet && newfacet->visible) {
+      newfacet= newfacet->f.replace;
+      if (count++ > qh facet_id)
+        qh_infiniteloop(visible);
+    }
+    if (!newfacet)
+      newfacet= qh newfacet_list;
+    if (newfacet == qh facet_tail) {
+      qh_fprintf(qh ferr, 6170, "qhull precision error (qh_partitionvisible): all new facets deleted as\n        degenerate facets. Can not continue.\n");
+      qh_errexit(qh_ERRprec, NULL, NULL);
+    }
+    if (visible->outsideset) {
+      size= qh_setsize(visible->outsideset);
+      *numoutside += size;
+      qh num_outside -= size;
+      FOREACHpoint_(visible->outsideset)
+        qh_partitionpoint(point, newfacet);
+    }
+    if (visible->coplanarset && (qh KEEPcoplanar + qh KEEPinside + qh KEEPnearinside)) {
+      size= qh_setsize(visible->coplanarset);
+      coplanar += size;
+      FOREACHpoint_(visible->coplanarset) {
+        if (allpoints) /* not used */
+          qh_partitionpoint(point, newfacet);
+        else
+          qh_partitioncoplanar(point, newfacet, NULL);
+      }
+    }
+  }
+  FOREACHvertex_(qh del_vertices) {
+    if (vertex->point) {
+      if (allpoints) /* not used */
+        qh_partitionpoint(vertex->point, qh newfacet_list);
+      else
+        qh_partitioncoplanar(vertex->point, qh newfacet_list, NULL);
+    }
+  }
+  trace1((qh ferr, 1043,"qh_partitionvisible: partitioned %d points from outsidesets and %d points from coplanarsets\n", *numoutside, coplanar));
+} /* partitionvisible */
+
+
+
+/*---------------------------------
+
+  qh_precision( reason )
+    restart on precision errors if not merging and if 'QJn'
+*/
+void qh_precision(const char *reason) {
+
+  if (qh ALLOWrestart && !qh PREmerge && !qh MERGEexact) {
+    if (qh JOGGLEmax < REALmax/2) {
+      trace0((qh ferr, 26, "qh_precision: qhull restart because of %s\n", reason));
+      longjmp(qh restartexit, qh_ERRprec);
+    }
+  }
+} /* qh_precision */
+
+/*---------------------------------
+
+  qh_printsummary( fp )
+    prints summary to fp
+
+  notes:
+    not in io.c so that user_eg.c can prevent io.c from loading
+    qh_printsummary and qh_countfacets must match counts
+
+  design:
+    determine number of points, vertices, and coplanar points
+    print summary
+*/
+void qh_printsummary(FILE *fp) {
+  realT ratio, outerplane, innerplane;
+  float cpu;
+  int size, id, nummerged, numvertices, numcoplanars= 0, nonsimplicial=0;
+  int goodused;
+  facetT *facet;
+  const char *s;
+  int numdel= zzval_(Zdelvertextot);
+  int numtricoplanars= 0;
+
+  size= qh num_points + qh_setsize(qh other_points);
+  numvertices= qh num_vertices - qh_setsize(qh del_vertices);
+  id= qh_pointid(qh GOODpointp);
+  FORALLfacets {
+    if (facet->coplanarset)
+      numcoplanars += qh_setsize( facet->coplanarset);
+    if (facet->good) {
+      if (facet->simplicial) {
+        if (facet->keepcentrum && facet->tricoplanar)
+          numtricoplanars++;
+      }else if (qh_setsize(facet->vertices) != qh hull_dim)
+        nonsimplicial++;
+    }
+  }
+  if (id >=0 && qh STOPcone-1 != id && -qh STOPpoint-1 != id)
+    size--;
+  if (qh STOPcone || qh STOPpoint)
+      qh_fprintf(fp, 9288, "\nAt a premature exit due to 'TVn', 'TCn', 'TRn', or precision error with 'QJn'.");
+  if (qh UPPERdelaunay)
+    goodused= qh GOODvertex + qh GOODpoint + qh SPLITthresholds;
+  else if (qh DELAUNAY)
+    goodused= qh GOODvertex + qh GOODpoint + qh GOODthreshold;
+  else
+    goodused= qh num_good;
+  nummerged= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
+  if (qh VORONOI) {
+    if (qh UPPERdelaunay)
+      qh_fprintf(fp, 9289, "\n\
+Furthest-site Voronoi vertices by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    else
+      qh_fprintf(fp, 9290, "\n\
+Voronoi diagram by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    qh_fprintf(fp, 9291, "  Number of Voronoi regions%s: %d\n",
+              qh ATinfinity ? " and at-infinity" : "", numvertices);
+    if (numdel)
+      qh_fprintf(fp, 9292, "  Total number of deleted points due to merging: %d\n", numdel);
+    if (numcoplanars - numdel > 0)
+      qh_fprintf(fp, 9293, "  Number of nearly incident points: %d\n", numcoplanars - numdel);
+    else if (size - numvertices - numdel > 0)
+      qh_fprintf(fp, 9294, "  Total number of nearly incident points: %d\n", size - numvertices - numdel);
+    qh_fprintf(fp, 9295, "  Number of%s Voronoi vertices: %d\n",
+              goodused ? " 'good'" : "", qh num_good);
+    if (nonsimplicial)
+      qh_fprintf(fp, 9296, "  Number of%s non-simplicial Voronoi vertices: %d\n",
+              goodused ? " 'good'" : "", nonsimplicial);
+  }else if (qh DELAUNAY) {
+    if (qh UPPERdelaunay)
+      qh_fprintf(fp, 9297, "\n\
+Furthest-site Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    else
+      qh_fprintf(fp, 9298, "\n\
+Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    qh_fprintf(fp, 9299, "  Number of input sites%s: %d\n",
+              qh ATinfinity ? " and at-infinity" : "", numvertices);
+    if (numdel)
+      qh_fprintf(fp, 9300, "  Total number of deleted points due to merging: %d\n", numdel);
+    if (numcoplanars - numdel > 0)
+      qh_fprintf(fp, 9301, "  Number of nearly incident points: %d\n", numcoplanars - numdel);
+    else if (size - numvertices - numdel > 0)
+      qh_fprintf(fp, 9302, "  Total number of nearly incident points: %d\n", size - numvertices - numdel);
+    qh_fprintf(fp, 9303, "  Number of%s Delaunay regions: %d\n",
+              goodused ? " 'good'" : "", qh num_good);
+    if (nonsimplicial)
+      qh_fprintf(fp, 9304, "  Number of%s non-simplicial Delaunay regions: %d\n",
+              goodused ? " 'good'" : "", nonsimplicial);
+  }else if (qh HALFspace) {
+    qh_fprintf(fp, 9305, "\n\
+Halfspace intersection by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    qh_fprintf(fp, 9306, "  Number of halfspaces: %d\n", size);
+    qh_fprintf(fp, 9307, "  Number of non-redundant halfspaces: %d\n", numvertices);
+    if (numcoplanars) {
+      if (qh KEEPinside && qh KEEPcoplanar)
+        s= "similar and redundant";
+      else if (qh KEEPinside)
+        s= "redundant";
+      else
+        s= "similar";
+      qh_fprintf(fp, 9308, "  Number of %s halfspaces: %d\n", s, numcoplanars);
+    }
+    qh_fprintf(fp, 9309, "  Number of intersection points: %d\n", qh num_facets - qh num_visible);
+    if (goodused)
+      qh_fprintf(fp, 9310, "  Number of 'good' intersection points: %d\n", qh num_good);
+    if (nonsimplicial)
+      qh_fprintf(fp, 9311, "  Number of%s non-simplicial intersection points: %d\n",
+              goodused ? " 'good'" : "", nonsimplicial);
+  }else {
+    qh_fprintf(fp, 9312, "\n\
+Convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
+    qh_fprintf(fp, 9313, "  Number of vertices: %d\n", numvertices);
+    if (numcoplanars) {
+      if (qh KEEPinside && qh KEEPcoplanar)
+        s= "coplanar and interior";
+      else if (qh KEEPinside)
+        s= "interior";
+      else
+        s= "coplanar";
+      qh_fprintf(fp, 9314, "  Number of %s points: %d\n", s, numcoplanars);
+    }
+    qh_fprintf(fp, 9315, "  Number of facets: %d\n", qh num_facets - qh num_visible);
+    if (goodused)
+      qh_fprintf(fp, 9316, "  Number of 'good' facets: %d\n", qh num_good);
+    if (nonsimplicial)
+      qh_fprintf(fp, 9317, "  Number of%s non-simplicial facets: %d\n",
+              goodused ? " 'good'" : "", nonsimplicial);
+  }
+  if (numtricoplanars)
+      qh_fprintf(fp, 9318, "  Number of triangulated facets: %d\n", numtricoplanars);
+  qh_fprintf(fp, 9319, "\nStatistics for: %s | %s",
+                      qh rbox_command, qh qhull_command);
+  if (qh ROTATErandom != INT_MIN)
+    qh_fprintf(fp, 9320, " QR%d\n\n", qh ROTATErandom);
+  else
+    qh_fprintf(fp, 9321, "\n\n");
+  qh_fprintf(fp, 9322, "  Number of points processed: %d\n", zzval_(Zprocessed));
+  qh_fprintf(fp, 9323, "  Number of hyperplanes created: %d\n", zzval_(Zsetplane));
+  if (qh DELAUNAY)
+    qh_fprintf(fp, 9324, "  Number of facets in hull: %d\n", qh num_facets - qh num_visible);
+  qh_fprintf(fp, 9325, "  Number of distance tests for qhull: %d\n", zzval_(Zpartition)+
+      zzval_(Zpartitionall)+zzval_(Znumvisibility)+zzval_(Zpartcoplanar));
+#if 0  /* NOTE: must print before printstatistics() */
+  {realT stddev, ave;
+  qh_fprintf(fp, 9326, "  average new facet balance: %2.2g\n",
+          wval_(Wnewbalance)/zval_(Zprocessed));
+  stddev= qh_stddev(zval_(Zprocessed), wval_(Wnewbalance),
+                                 wval_(Wnewbalance2), &ave);
+  qh_fprintf(fp, 9327, "  new facet standard deviation: %2.2g\n", stddev);
+  qh_fprintf(fp, 9328, "  average partition balance: %2.2g\n",
+          wval_(Wpbalance)/zval_(Zpbalance));
+  stddev= qh_stddev(zval_(Zpbalance), wval_(Wpbalance),
+                                 wval_(Wpbalance2), &ave);
+  qh_fprintf(fp, 9329, "  partition standard deviation: %2.2g\n", stddev);
+  }
+#endif
+  if (nummerged) {
+    qh_fprintf(fp, 9330,"  Number of distance tests for merging: %d\n",zzval_(Zbestdist)+
+          zzval_(Zcentrumtests)+zzval_(Zdistconvex)+zzval_(Zdistcheck)+
+          zzval_(Zdistzero));
+    qh_fprintf(fp, 9331,"  Number of distance tests for checking: %d\n",zzval_(Zcheckpart));
+    qh_fprintf(fp, 9332,"  Number of merged facets: %d\n", nummerged);
+  }
+  if (!qh RANDOMoutside && qh QHULLfinished) {
+    cpu= (float)qh hulltime;
+    cpu /= (float)qh_SECticks;
+    wval_(Wcpu)= cpu;
+    qh_fprintf(fp, 9333, "  CPU seconds to compute hull (after input): %2.4g\n", cpu);
+  }
+  if (qh RERUN) {
+    if (!qh PREmerge && !qh MERGEexact)
+      qh_fprintf(fp, 9334, "  Percentage of runs with precision errors: %4.1f\n",
+           zzval_(Zretry)*100.0/qh build_cnt);  /* careful of order */
+  }else if (qh JOGGLEmax < REALmax/2) {
+    if (zzval_(Zretry))
+      qh_fprintf(fp, 9335, "  After %d retries, input joggled by: %2.2g\n",
+         zzval_(Zretry), qh JOGGLEmax);
+    else
+      qh_fprintf(fp, 9336, "  Input joggled by: %2.2g\n", qh JOGGLEmax);
+  }
+  if (qh totarea != 0.0)
+    qh_fprintf(fp, 9337, "  %s facet area:   %2.8g\n",
+            zzval_(Ztotmerge) ? "Approximate" : "Total", qh totarea);
+  if (qh totvol != 0.0)
+    qh_fprintf(fp, 9338, "  %s volume:       %2.8g\n",
+            zzval_(Ztotmerge) ? "Approximate" : "Total", qh totvol);
+  if (qh MERGING) {
+    qh_outerinner(NULL, &outerplane, &innerplane);
+    if (outerplane > 2 * qh DISTround) {
+      qh_fprintf(fp, 9339, "  Maximum distance of %spoint above facet: %2.2g",
+            (qh QHULLfinished ? "" : "merged "), outerplane);
+      ratio= outerplane/(qh ONEmerge + qh DISTround);
+      /* don't report ratio if MINoutside is large */
+      if (ratio > 0.05 && 2* qh ONEmerge > qh MINoutside && qh JOGGLEmax > REALmax/2)
+        qh_fprintf(fp, 9340, " (%.1fx)\n", ratio);
+      else
+        qh_fprintf(fp, 9341, "\n");
+    }
+    if (innerplane < -2 * qh DISTround) {
+      qh_fprintf(fp, 9342, "  Maximum distance of %svertex below facet: %2.2g",
+            (qh QHULLfinished ? "" : "merged "), innerplane);
+      ratio= -innerplane/(qh ONEmerge+qh DISTround);
+      if (ratio > 0.05 && qh JOGGLEmax > REALmax/2)
+        qh_fprintf(fp, 9343, " (%.1fx)\n", ratio);
+      else
+        qh_fprintf(fp, 9344, "\n");
+    }
+  }
+  qh_fprintf(fp, 9345, "\n");
+} /* printsummary */
+
+

Copied: trunk/scipy/spatial/qhull/src/libqhull.h (from rev 6901, trunk/scipy/spatial/qhull/src/qhull.h)
===================================================================
--- trunk/scipy/spatial/qhull/src/libqhull.h	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/libqhull.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,1092 @@
+/*
  ---------------------------------
+
+   libqhull.h
+   user-level header file for using qhull.a library
+
+   see qh-qhull.htm, qhull_a.h
+
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/libqhull.h#9 $$Change: 1172 $
+   $DateTime: 2010/01/09 21:42:16 $$Author: bbarber $
+
+   NOTE: access to qh_qh is via the 'qh' macro.  This allows
+   qh_qh to be either a pointer or a structure.  An example
+   of using qh is "qh DROPdim" which accesses the DROPdim
+   field of qh_qh.  Similarly, access to qh_qhstat is via
+   the 'qhstat' macro.
+
+   includes function prototypes for libqhull.c, geom.c, global.c, io.c, user.c
+
+   use mem.h for mem.c
+   use qset.h for qset.c
+
+   see unix.c for an example of using libqhull.h
+
+   recompile qhull if you change this file
+*/
+
+#ifndef qhDEFlibqhull
+#define qhDEFlibqhull 1
+
+/*=========================== -included files ==============*/
+
+#include "user.h"      /* user definable constants (e.g., qh_QHpointer) */
+
+#include 
+#include 
+#include 
+#include 
+
+#if __MWERKS__ && __POWERPC__
+#include  
+#include  
+#include        
+#endif
+
+#ifndef __STDC__
+#ifndef __cplusplus
+#if     !_MSC_VER
+#error  Neither __STDC__ nor __cplusplus is defined.  Please use strict ANSI C or C++ to compile
+#error  Qhull.  You may need to turn off compiler extensions in your project configuration.  If
+#error  your compiler is a standard C compiler, you can delete this warning from libqhull.h
+#endif
+#endif
+#endif
+
+/*============ constants and basic types ====================*/
+
+extern const char *qh_version; /* defined in global.c */
+
+/*----------------------------------
+
+  coordT
+    coordinates and coefficients are stored as realT (i.e., double)
+
+  notes:
+    Qhull works well if realT is 'float'.  If so joggle (QJ) is not effective.
+
+    Could use 'float' for data and 'double' for calculations (realT vs. coordT)
+      This requires many type casts, and adjusted error bounds.
+      Also C compilers may do expressions in double anyway.
+*/
+#define coordT realT
+
+/*----------------------------------
+
+  pointT
+    a point is an array of coordinates, usually qh.hull_dim
+*/
+#define pointT coordT
+
+/*----------------------------------
+
+  flagT
+    Boolean flag as a bit
+*/
+#define flagT unsigned int
+
+/*----------------------------------
+
+  boolT
+    boolean value, either True or False
+
+  notes:
+    needed for portability
+*/
+#define boolT unsigned int
+#ifdef False
+#undef False
+#endif
+#ifdef True
+#undef True
+#endif
+#define False 0
+#define True 1
+
+/*----------------------------------
+
+  qh_CENTER
+    to distinguish facet->center
+*/
+typedef enum
+{
+    qh_ASnone = 0, qh_ASvoronoi, qh_AScentrum
+}
+qh_CENTER;
+
+/*----------------------------------
+
+  qh_PRINT
+    output formats for printing (qh.PRINTout).
+    'Fa' 'FV' 'Fc' 'FC'
+
+
+   notes:
+   some of these names are similar to qh names.  The similar names are only
+   used in switch statements in qh_printbegin() etc.
+*/
+typedef enum {qh_PRINTnone= 0,
+  qh_PRINTarea, qh_PRINTaverage,           /* 'Fa' 'FV' 'Fc' 'FC' */
+  qh_PRINTcoplanars, qh_PRINTcentrums,
+  qh_PRINTfacets, qh_PRINTfacets_xridge,   /* 'f' 'FF' 'G' 'FI' 'Fi' 'Fn' */
+  qh_PRINTgeom, qh_PRINTids, qh_PRINTinner, qh_PRINTneighbors,
+  qh_PRINTnormals, qh_PRINTouter, qh_PRINTmaple, /* 'n' 'Fo' 'i' 'm' 'Fm' 'FM', 'o' */
+  qh_PRINTincidences, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINToff,
+  qh_PRINToptions, qh_PRINTpointintersect, /* 'FO' 'Fp' 'FP' 'p' 'FQ' 'FS' */
+  qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize,
+  qh_PRINTsummary, qh_PRINTtriangles,      /* 'Fs' 'Ft' 'Fv' 'FN' 'Fx' */
+  qh_PRINTvertices, qh_PRINTvneighbors, qh_PRINTextremes,
+  qh_PRINTEND} qh_PRINT;
+
+/*----------------------------------
+
+  qh_ALL
+    argument flag for selecting everything
+*/
+#define qh_ALL      True
+#define qh_NOupper  True     /* argument for qh_findbest */
+#define qh_IScheckmax  True     /* argument for qh_findbesthorizon */
+#define qh_ISnewfacets  True     /* argument for qh_findbest */
+#define qh_RESETvisible  True     /* argument for qh_resetlists */
+
+/*----------------------------------
+
+  qh_ERR
+    Qhull exit codes, for indicating errors
+    See: MSG_ERROR and MSG_WARNING [user.h]
+*/
+#define qh_ERRnone  0    /* no error occurred during qhull */
+#define qh_ERRinput 1    /* input inconsistency */
+#define qh_ERRsingular 2 /* singular input data */
+#define qh_ERRprec  3    /* precision error */
+#define qh_ERRmem   4    /* insufficient memory, matches mem.h */
+#define qh_ERRqhull 5    /* internal error detected, matches mem.h */
+
+/*----------------------------------
+
+qh_FILEstderr
+Fake stderr to distinguish error output from normal output
+For C++ interface.  Must redefine qh_fprintf_qhull
+*/
+#define qh_FILEstderr (FILE*)1
+
+/* ============ -structures- ====================
+   each of the following structures is defined by a typedef
+   all realT and coordT fields occur at the beginning of a structure
+        (otherwise space may be wasted due to alignment)
+   define all flags together and pack into 32-bit number
+*/
+
+typedef struct vertexT vertexT;
+typedef struct ridgeT ridgeT;
+typedef struct facetT facetT;
+#ifndef DEFsetT
+#define DEFsetT 1
+typedef struct setT setT;          /* defined in qset.h */
+#endif
+
+#ifndef DEFqhstatT
+#define DEFqhstatT 1
+typedef struct qhstatT qhstatT;    /* defined in stat.h */
+#endif
+
+/*----------------------------------
+
+  facetT
+    defines a facet
+
+  notes:
+   qhull() generates the hull as a list of facets.
+
+  topological information:
+    f.previous,next     doubly-linked list of facets
+    f.vertices          set of vertices
+    f.ridges            set of ridges
+    f.neighbors         set of neighbors
+    f.toporient         True if facet has top-orientation (else bottom)
+
+  geometric information:
+    f.offset,normal     hyperplane equation
+    f.maxoutside        offset to outer plane -- all points inside
+    f.center            centrum for testing convexity
+    f.simplicial        True if facet is simplicial
+    f.flipped           True if facet does not include qh.interior_point
+
+  for constructing hull:
+    f.visible           True if facet on list of visible facets (will be deleted)
+    f.newfacet          True if facet on list of newly created facets
+    f.coplanarset       set of points coplanar with this facet
+                        (includes near-inside points for later testing)
+    f.outsideset        set of points outside of this facet
+    f.furthestdist      distance to furthest point of outside set
+    f.visitid           marks visited facets during a loop
+    f.replace           replacement facet for to-be-deleted, visible facets
+    f.samecycle,newcycle cycle of facets for merging into horizon facet
+
+  see below for other flags and fields
+*/
+struct facetT {
+#if !qh_COMPUTEfurthest
+  coordT   furthestdist;/* distance to furthest point of outsideset */
+#endif
+#if qh_MAXoutside
+  coordT   maxoutside;  /* max computed distance of point to facet
+                        Before QHULLfinished this is an approximation
+                        since maxdist not always set for mergefacet
+                        Actual outer plane is +DISTround and
+                        computed outer plane is +2*DISTround */
+#endif
+  coordT   offset;      /* exact offset of hyperplane from origin */
+  coordT  *normal;      /* normal of hyperplane, hull_dim coefficients */
+                        /*   if tricoplanar, shared with a neighbor */
+  union {               /* in order of testing */
+   realT   area;        /* area of facet, only in io.c if  ->isarea */
+   facetT *replace;     /*  replacement facet if ->visible and NEWfacets
+                             is NULL only if qh_mergedegen_redundant or interior */
+   facetT *samecycle;   /*  cycle of facets from the same visible/horizon intersection,
+                             if ->newfacet */
+   facetT *newcycle;    /*  in horizon facet, current samecycle of new facets */
+   facetT *trivisible;  /* visible facet for ->tricoplanar facets during qh_triangulate() */
+   facetT *triowner;    /* owner facet for ->tricoplanar, !isarea facets w/ ->keepcentrum */
+  }f;
+  coordT  *center;      /*  centrum for convexity, qh CENTERtype == qh_AScentrum */
+                        /*  Voronoi center, qh CENTERtype == qh_ASvoronoi */
+                        /*   if tricoplanar, shared with a neighbor */
+  facetT  *previous;    /* previous facet in the facet_list */
+  facetT  *next;        /* next facet in the facet_list */
+  setT    *vertices;    /* vertices for this facet, inverse sorted by ID
+                           if simplicial, 1st vertex was apex/furthest */
+  setT    *ridges;      /* explicit ridges for nonsimplicial facets.
+                           for simplicial facets, neighbors defines ridge */
+  setT    *neighbors;   /* neighbors of the facet.  If simplicial, the kth
+                           neighbor is opposite the kth vertex, and the first
+                           neighbor is the horizon facet for the first vertex*/
+  setT    *outsideset;  /* set of points outside this facet
+                           if non-empty, last point is furthest
+                           if NARROWhull, includes coplanars for partitioning*/
+  setT    *coplanarset; /* set of points coplanar with this facet
+                           > qh.min_vertex and <= facet->max_outside
+                           a point is assigned to the furthest facet
+                           if non-empty, last point is furthest away */
+  unsigned visitid;     /* visit_id, for visiting all neighbors,
+                           all uses are independent */
+  unsigned id;          /* unique identifier from qh facet_id */
+  unsigned nummerge:9;  /* number of merges */
+#define qh_MAXnummerge 511 /*     2^9-1, 32 flags total, see "flags:" in io.c */
+  flagT    tricoplanar:1; /* True if TRIangulate and simplicial and coplanar with a neighbor */
+                          /*   all tricoplanars share the same ->center, ->normal, ->offset, ->maxoutside */
+                          /*   all tricoplanars share the same apex */
+                          /*   if ->degenerate, does not span facet (one logical ridge) */
+                          /*   one tricoplanar has ->keepcentrum and ->coplanarset */
+                          /*   during qh_triangulate, f.trivisible points to original facet */
+  flagT    newfacet:1;  /* True if facet on qh newfacet_list (new or merged) */
+  flagT    visible:1;   /* True if visible facet (will be deleted) */
+  flagT    toporient:1; /* True if created with top orientation
+                           after merging, use ridge orientation */
+  flagT    simplicial:1;/* True if simplicial facet, ->ridges may be implicit */
+  flagT    seen:1;      /* used to perform operations only once, like visitid */
+  flagT    seen2:1;     /* used to perform operations only once, like visitid */
+  flagT    flipped:1;   /* True if facet is flipped */
+  flagT    upperdelaunay:1; /* True if facet is upper envelope of Delaunay triangulation */
+  flagT    notfurthest:1; /* True if last point of outsideset is not furthest*/
+
+/*-------- flags primarily for output ---------*/
+  flagT    good:1;      /* True if a facet marked good for output */
+  flagT    isarea:1;    /* True if facet->f.area is defined */
+
+/*-------- flags for merging ------------------*/
+  flagT    dupridge:1;  /* True if duplicate ridge in facet */
+  flagT    mergeridge:1; /* True if facet or neighbor contains a qh_MERGEridge
+                            ->normal defined (also defined for mergeridge2) */
+  flagT    mergeridge2:1; /* True if neighbor contains a qh_MERGEridge (mark_dupridges */
+  flagT    coplanar:1;  /* True if horizon facet is coplanar at last use */
+  flagT     mergehorizon:1; /* True if will merge into horizon (->coplanar) */
+  flagT     cycledone:1;/* True if mergecycle_all already done */
+  flagT    tested:1;    /* True if facet convexity has been tested (false after merge */
+  flagT    keepcentrum:1; /* True if keep old centrum after a merge, or marks owner for ->tricoplanar */
+  flagT    newmerge:1;  /* True if facet is newly merged for reducevertices */
+  flagT    degenerate:1; /* True if facet is degenerate (degen_mergeset or ->tricoplanar) */
+  flagT    redundant:1;  /* True if facet is redundant (degen_mergeset) */
+};
+
+
+/*----------------------------------
+
+  ridgeT
+    defines a ridge
+
+  notes:
+  a ridge is hull_dim-1 simplex between two neighboring facets.  If the
+  facets are non-simplicial, there may be more than one ridge between
+  two facets.  E.G. a 4-d hypercube has two triangles between each pair
+  of neighboring facets.
+
+  topological information:
+    vertices            a set of vertices
+    top,bottom          neighboring facets with orientation
+
+  geometric information:
+    tested              True if ridge is clearly convex
+    nonconvex           True if ridge is non-convex
+*/
+struct ridgeT {
+  setT    *vertices;    /* vertices belonging to this ridge, inverse sorted by ID
+                           NULL if a degen ridge (matchsame) */
+  facetT  *top;         /* top facet this ridge is part of */
+  facetT  *bottom;      /* bottom facet this ridge is part of */
+  unsigned id:24;       /* unique identifier, =>room for 8 flags, bit field matches qh.ridge_id */
+  flagT    seen:1;      /* used to perform operations only once */
+  flagT    tested:1;    /* True when ridge is tested for convexity */
+  flagT    nonconvex:1; /* True if getmergeset detected a non-convex neighbor
+                           only one ridge between neighbors may have nonconvex */
+};
+
+/*----------------------------------
+
+  vertexT
+     defines a vertex
+
+  topological information:
+    next,previous       doubly-linked list of all vertices
+    neighbors           set of adjacent facets (only if qh.VERTEXneighbors)
+
+  geometric information:
+    point               array of DIM3 coordinates
+*/
+struct vertexT {
+  vertexT *next;        /* next vertex in vertex_list */
+  vertexT *previous;    /* previous vertex in vertex_list */
+  pointT  *point;       /* hull_dim coordinates (coordT) */
+  setT    *neighbors;   /* neighboring facets of vertex, qh_vertexneighbors()
+                           inits in io.c or after first merge */
+  unsigned visitid:31;  /* for use with qh vertex_visit, size must match */
+  flagT    seen2:1;     /* another seen flag */
+  unsigned id:24;       /* unique identifier, bit field matches qh.vertex_id */
+  unsigned dim:4;       /* dimension of point if non-zero, used by cpp */
+                        /* =>room for 4 flags */
+  flagT    seen:1;      /* used to perform operations only once */
+  flagT    delridge:1;  /* vertex was part of a deleted ridge */
+  flagT    deleted:1;   /* true if vertex on qh del_vertices */
+  flagT    newlist:1;   /* true if vertex on qh newvertex_list */
+};
+
+#define MAX_vdim 15  /* Maximum size of vertex->dim */
+
+/*======= -global variables -qh ============================*/
+
+/*----------------------------------
+
+  qh
+   all global variables for qhull are in qh, qhmem, and qhstat
+
+  notes:
+   qhmem is defined in mem.h, qhstat is defined in stat.h, qhrbox is defined in rboxpoints.h
+   Access to qh_qh is via the "qh" macro.  See qh_QHpointer in user.h
+
+   All global variables for qhull are in qh, qhmem, and qhstat
+   qh must be unique for each instance of qhull
+   qhstat may be shared between qhull instances.
+   qhmem may be shared across multiple instances of Qhull.
+   Rbox uses global variables rbox_inuse and rbox, but does not persist data across calls.
+
+   notes:
+   Qhull is not multithreaded.  Global state could be stored in thread-local storage.
+*/
+
+extern int qhull_inuse;
+
+typedef struct qhT qhT;
+#if qh_QHpointer
+#define qh qh_qh->
+extern qhT *qh_qh;     /* allocated in global.c */
+#else
+#define qh qh_qh.
+extern qhT qh_qh;
+#endif
+
+struct qhT {
+
+/*----------------------------------
+
+  qh constants
+    configuration flags and constants for Qhull
+
+  notes:
+    The user configures Qhull by defining flags.  They are
+    copied into qh by qh_setflags().  qh-quick.htm#options defines the flags.
+*/
+  boolT ALLpoints;        /* true 'Qs' if search all points for initial simplex */
+  boolT ANGLEmerge;       /* true 'Qa' if sort potential merges by angle */
+  boolT APPROXhull;       /* true 'Wn' if MINoutside set */
+  realT   MINoutside;     /*   'Wn' min. distance for an outside point */
+  boolT ANNOTATEoutput;   /* true 'Ta' if annotate output with message codes */
+  boolT ATinfinity;       /* true 'Qz' if point num_points-1 is "at-infinity"
+                             for improving precision in Delaunay triangulations */
+  boolT AVOIDold;         /* true 'Q4' if avoid old->new merges */
+  boolT BESToutside;      /* true 'Qf' if partition points into best outsideset */
+  boolT CDDinput;         /* true 'Pc' if input uses CDD format (1.0/offset first) */
+  boolT CDDoutput;        /* true 'PC' if print normals in CDD format (offset first) */
+  boolT CHECKfrequently;  /* true 'Tc' if checking frequently */
+  realT premerge_cos;     /*   'A-n'   cos_max when pre merging */
+  realT postmerge_cos;    /*   'An'    cos_max when post merging */
+  boolT DELAUNAY;         /* true 'd' if computing DELAUNAY triangulation */
+  boolT DOintersections;  /* true 'Gh' if print hyperplane intersections */
+  int   DROPdim;          /* drops dim 'GDn' for 4-d -> 3-d output */
+  boolT FORCEoutput;      /* true 'Po' if forcing output despite degeneracies */
+  int   GOODpoint;        /* 1+n for 'QGn', good facet if visible/not(-) from point n*/
+  pointT *GOODpointp;     /*   the actual point */
+  boolT GOODthreshold;    /* true if qh lower_threshold/upper_threshold defined
+                             false if qh SPLITthreshold */
+  int   GOODvertex;       /* 1+n, good facet if vertex for point n */
+  pointT *GOODvertexp;     /*   the actual point */
+  boolT HALFspace;        /* true 'Hn,n,n' if halfspace intersection */
+  int   IStracing;        /* trace execution, 0=none, 1=least, 4=most, -1=events */
+  int   KEEParea;         /* 'PAn' number of largest facets to keep */
+  boolT KEEPcoplanar;     /* true 'Qc' if keeping nearest facet for coplanar points */
+  boolT KEEPinside;       /* true 'Qi' if keeping nearest facet for inside points
+                              set automatically if 'd Qc' */
+  int   KEEPmerge;        /* 'PMn' number of facets to keep with most merges */
+  realT KEEPminArea;      /* 'PFn' minimum facet area to keep */
+  realT MAXcoplanar;      /* 'Un' max distance below a facet to be coplanar*/
+  boolT MERGEexact;       /* true 'Qx' if exact merges (coplanar, degen, dupridge, flipped) */
+  boolT MERGEindependent; /* true 'Q2' if merging independent sets */
+  boolT MERGING;          /* true if exact-, pre- or post-merging, with angle and centrum tests */
+  realT   premerge_centrum;  /*   'C-n' centrum_radius when pre merging.  Default is round-off */
+  realT   postmerge_centrum; /*   'Cn' centrum_radius when post merging.  Default is round-off */
+  boolT MERGEvertices;    /* true 'Q3' if merging redundant vertices */
+  realT MINvisible;       /* 'Vn' min. distance for a facet to be visible */
+  boolT NOnarrow;         /* true 'Q10' if no special processing for narrow distributions */
+  boolT NOnearinside;     /* true 'Q8' if ignore near-inside points when partitioning */
+  boolT NOpremerge;       /* true 'Q0' if no defaults for C-0 or Qx */
+  boolT ONLYgood;         /* true 'Qg' if process points with good visible or horizon facets */
+  boolT ONLYmax;          /* true 'Qm' if only process points that increase max_outside */
+  boolT PICKfurthest;     /* true 'Q9' if process furthest of furthest points*/
+  boolT POSTmerge;        /* true if merging after buildhull (Cn or An) */
+  boolT PREmerge;         /* true if merging during buildhull (C-n or A-n) */
+                        /* NOTE: some of these names are similar to qh_PRINT names */
+  boolT PRINTcentrums;    /* true 'Gc' if printing centrums */
+  boolT PRINTcoplanar;    /* true 'Gp' if printing coplanar points */
+  int   PRINTdim;         /* print dimension for Geomview output */
+  boolT PRINTdots;        /* true 'Ga' if printing all points as dots */
+  boolT PRINTgood;        /* true 'Pg' if printing good facets */
+  boolT PRINTinner;       /* true 'Gi' if printing inner planes */
+  boolT PRINTneighbors;   /* true 'PG' if printing neighbors of good facets */
+  boolT PRINTnoplanes;    /* true 'Gn' if printing no planes */
+  boolT PRINToptions1st;  /* true 'FO' if printing options to stderr */
+  boolT PRINTouter;       /* true 'Go' if printing outer planes */
+  boolT PRINTprecision;   /* false 'Pp' if not reporting precision problems */
+  qh_PRINT PRINTout[qh_PRINTEND]; /* list of output formats to print */
+  boolT PRINTridges;      /* true 'Gr' if print ridges */
+  boolT PRINTspheres;     /* true 'Gv' if print vertices as spheres */
+  boolT PRINTstatistics;  /* true 'Ts' if printing statistics to stderr */
+  boolT PRINTsummary;     /* true 's' if printing summary to stderr */
+  boolT PRINTtransparent; /* true 'Gt' if print transparent outer ridges */
+  boolT PROJECTdelaunay;  /* true if DELAUNAY, no readpoints() and
+                             need projectinput() for Delaunay in qh_init_B */
+  int   PROJECTinput;     /* number of projected dimensions 'bn:0Bn:0' */
+  boolT QUICKhelp;        /* true if quick help message for degen input */
+  boolT RANDOMdist;       /* true if randomly change distplane and setfacetplane */
+  realT RANDOMfactor;     /*    maximum random perturbation */
+  realT RANDOMa;          /*    qh_randomfactor is randr * RANDOMa + RANDOMb */
+  realT RANDOMb;
+  boolT RANDOMoutside;    /* true if select a random outside point */
+  int   REPORTfreq;       /* buildtracing reports every n facets */
+  int   REPORTfreq2;      /* tracemerging reports every REPORTfreq/2 facets */
+  int   RERUN;            /* 'TRn' rerun qhull n times (qh.build_cnt) */
+  int   ROTATErandom;     /* 'QRn' seed, 0 time, >= rotate input */
+  boolT SCALEinput;       /* true 'Qbk' if scaling input */
+  boolT SCALElast;        /* true 'Qbb' if scale last coord to max prev coord */
+  boolT SETroundoff;      /* true 'E' if qh DISTround is predefined */
+  boolT SKIPcheckmax;     /* true 'Q5' if skip qh_check_maxout */
+  boolT SKIPconvex;       /* true 'Q6' if skip convexity testing during pre-merge */
+  boolT SPLITthresholds;  /* true if upper_/lower_threshold defines a region
+                               used only for printing (!for qh ONLYgood) */
+  int   STOPcone;         /* 'TCn' 1+n for stopping after cone for point n */
+                          /*       also used by qh_build_withresart for err exit*/
+  int   STOPpoint;        /* 'TVn' 'TV-n' 1+n for stopping after/before(-)
+                                        adding point n */
+  int   TESTpoints;       /* 'QTn' num of test points after qh.num_points.  Test points always coplanar. */
+  boolT TESTvneighbors;   /*  true 'Qv' if test vertex neighbors at end */
+  int   TRACElevel;       /* 'Tn' conditional IStracing level */
+  int   TRACElastrun;     /*  qh.TRACElevel applies to last qh.RERUN */
+  int   TRACEpoint;       /* 'TPn' start tracing when point n is a vertex */
+  realT TRACEdist;        /* 'TWn' start tracing when merge distance too big */
+  int   TRACEmerge;       /* 'TMn' start tracing before this merge */
+  boolT TRIangulate;      /* true 'Qt' if triangulate non-simplicial facets */
+  boolT TRInormals;       /* true 'Q11' if triangulate duplicates normals (sets Qt) */
+  boolT UPPERdelaunay;    /* true 'Qu' if computing furthest-site Delaunay */
+  boolT USEstdout;        /* true 'Tz' if using stdout instead of stderr */
+  boolT VERIFYoutput;     /* true 'Tv' if verify output at end of qhull */
+  boolT VIRTUALmemory;    /* true 'Q7' if depth-first processing in buildhull */
+  boolT VORONOI;          /* true 'v' if computing Voronoi diagram */
+
+  /*--------input constants ---------*/
+  realT AREAfactor;       /* 1/(hull_dim-1)! for converting det's to area */
+  boolT DOcheckmax;       /* true if calling qh_check_maxout (qh_initqhull_globals) */
+  char  *feasible_string;  /* feasible point 'Hn,n,n' for halfspace intersection */
+  coordT *feasible_point;  /*    as coordinates, both malloc'd */
+  boolT GETarea;          /* true 'Fa', 'FA', 'FS', 'PAn', 'PFn' if compute facet area/Voronoi volume in io.c */
+  boolT KEEPnearinside;   /* true if near-inside points in coplanarset */
+  int   hull_dim;         /* dimension of hull, set by initbuffers */
+  int   input_dim;        /* dimension of input, set by initbuffers */
+  int   num_points;       /* number of input points */
+  pointT *first_point;    /* array of input points, see POINTSmalloc */
+  boolT POINTSmalloc;     /*   true if qh first_point/num_points allocated */
+  pointT *input_points;   /* copy of original qh.first_point for input points for qh_joggleinput */
+  boolT input_malloc;     /* true if qh input_points malloc'd */
+  char  qhull_command[256];/* command line that invoked this program */
+  int   qhull_commandsiz2; /*    size of qhull_command at qh_clear_outputflags */
+  char  rbox_command[256]; /* command line that produced the input points */
+  char  qhull_options[512];/* descriptive list of options */
+  int   qhull_optionlen;  /*    length of last line */
+  int   qhull_optionsiz;  /*    size of qhull_options at qh_build_withrestart */
+  int   qhull_optionsiz2; /*    size of qhull_options at qh_clear_outputflags */
+  int   run_id;           /* non-zero, random identifier for this instance of qhull */
+  boolT VERTEXneighbors;  /* true if maintaining vertex neighbors */
+  boolT ZEROcentrum;      /* true if 'C-0' or 'C-0 Qx'.  sets ZEROall_ok */
+  realT *upper_threshold; /* don't print if facet->normal[k]>=upper_threshold[k]
+                             must set either GOODthreshold or SPLITthreshold
+                             if Delaunay, default is 0.0 for upper envelope */
+  realT *lower_threshold; /* don't print if facet->normal[k] <=lower_threshold[k] */
+  realT *upper_bound;     /* scale point[k] to new upper bound */
+  realT *lower_bound;     /* scale point[k] to new lower bound
+                             project if both upper_ and lower_bound == 0 */
+
+/*----------------------------------
+
+  qh precision constants
+    precision constants for Qhull
+
+  notes:
+    qh_detroundoff() computes the maximum roundoff error for distance
+    and other computations.  It also sets default values for the
+    qh constants above.
+*/
+  realT ANGLEround;       /* max round off error for angles */
+  realT centrum_radius;   /* max centrum radius for convexity (roundoff added) */
+  realT cos_max;          /* max cosine for convexity (roundoff added) */
+  realT DISTround;        /* max round off error for distances, 'E' overrides */
+  realT MAXabs_coord;     /* max absolute coordinate */
+  realT MAXlastcoord;     /* max last coordinate for qh_scalelast */
+  realT MAXsumcoord;      /* max sum of coordinates */
+  realT MAXwidth;         /* max rectilinear width of point coordinates */
+  realT MINdenom_1;       /* min. abs. value for 1/x */
+  realT MINdenom;         /*    use divzero if denominator < MINdenom */
+  realT MINdenom_1_2;     /* min. abs. val for 1/x that allows normalization */
+  realT MINdenom_2;       /*    use divzero if denominator < MINdenom_2 */
+  realT MINlastcoord;     /* min. last coordinate for qh_scalelast */
+  boolT NARROWhull;       /* set in qh_initialhull if angle < qh_MAXnarrow */
+  realT *NEARzero;        /* hull_dim array for near zero in gausselim */
+  realT NEARinside;       /* keep points for qh_check_maxout if close to facet */
+  realT ONEmerge;         /* max distance for merging simplicial facets */
+  realT outside_err;      /* application's epsilon for coplanar points
+                             qh_check_bestdist() qh_check_points() reports error if point outside */
+  realT WIDEfacet;        /* size of wide facet for skipping ridge in
+                             area computation and locking centrum */
+
+/*----------------------------------
+
+  qh internal constants
+    internal constants for Qhull
+*/
+  char qhull[sizeof("qhull")]; /* "qhull" for checking ownership while debugging */
+  jmp_buf errexit;        /* exit label for qh_errexit, defined by setjmp() */
+  char jmpXtra[40];       /* extra bytes in case jmp_buf is defined wrong by compiler */
+  jmp_buf restartexit;    /* restart label for qh_errexit, defined by setjmp() */
+  char jmpXtra2[40];      /* extra bytes in case jmp_buf is defined wrong by compiler*/
+  FILE *fin;              /* pointer to input file, init by qh_meminit */
+  FILE *fout;             /* pointer to output file */
+  FILE *ferr;             /* pointer to error file */
+  pointT *interior_point; /* center point of the initial simplex*/
+  int normal_size;     /* size in bytes for facet normals and point coords*/
+  int center_size;     /* size in bytes for Voronoi centers */
+  int   TEMPsize;         /* size for small, temporary sets (in quick mem) */
+
+/*----------------------------------
+
+  qh facet and vertex lists
+    defines lists of facets, new facets, visible facets, vertices, and
+    new vertices.  Includes counts, next ids, and trace ids.
+  see:
+    qh_resetlists()
+*/
+  facetT *facet_list;     /* first facet */
+  facetT  *facet_tail;     /* end of facet_list (dummy facet) */
+  facetT *facet_next;     /* next facet for buildhull()
+                             previous facets do not have outside sets
+                             NARROWhull: previous facets may have coplanar outside sets for qh_outcoplanar */
+  facetT *newfacet_list;  /* list of new facets to end of facet_list */
+  facetT *visible_list;   /* list of visible facets preceeding newfacet_list,
+                             facet->visible set */
+  int       num_visible;  /* current number of visible facets */
+  unsigned tracefacet_id;  /* set at init, then can print whenever */
+  facetT *tracefacet;     /*   set in newfacet/mergefacet, undone in delfacet*/
+  unsigned tracevertex_id;  /* set at buildtracing, can print whenever */
+  vertexT *tracevertex;     /*   set in newvertex, undone in delvertex*/
+  vertexT *vertex_list;     /* list of all vertices, to vertex_tail */
+  vertexT  *vertex_tail;    /*      end of vertex_list (dummy vertex) */
+  vertexT *newvertex_list; /* list of vertices in newfacet_list, to vertex_tail
+                             all vertices have 'newlist' set */
+  int   num_facets;       /* number of facets in facet_list
+                             includes visble faces (num_visible) */
+  int   num_vertices;     /* number of vertices in facet_list */
+  int   num_outside;      /* number of points in outsidesets (for tracing and RANDOMoutside)
+                               includes coplanar outsideset points for NARROWhull/qh_outcoplanar() */
+  int   num_good;         /* number of good facets (after findgood_all) */
+  unsigned facet_id;      /* ID of next, new facet from newfacet() */
+  unsigned ridge_id:24;   /* ID of next, new ridge from newridge() */
+  unsigned vertex_id:24;  /* ID of next, new vertex from newvertex() */
+
+/*----------------------------------
+
+  qh global variables
+    defines minimum and maximum distances, next visit ids, several flags,
+    and other global variables.
+    initialize in qh_initbuild or qh_maxmin if used in qh_buildhull
+*/
+  unsigned long hulltime; /* ignore time to set up input and randomize */
+                          /*   use unsigned to avoid wrap-around errors */
+  boolT ALLOWrestart;     /* true if qh_precision can use qh.restartexit */
+  int   build_cnt;        /* number of calls to qh_initbuild */
+  qh_CENTER CENTERtype;   /* current type of facet->center, qh_CENTER */
+  int   furthest_id;      /* pointid of furthest point, for tracing */
+  facetT *GOODclosest;    /* closest facet to GOODthreshold in qh_findgood */
+  boolT hasAreaVolume;    /* true if totarea, totvol was defined by qh_getarea */
+  boolT hasTriangulation; /* true if triangulation created by qh_triangulate */
+  realT JOGGLEmax;        /* set 'QJn' if randomly joggle input */
+  boolT maxoutdone;       /* set qh_check_maxout(), cleared by qh_addpoint() */
+  realT max_outside;      /* maximum distance from a point to a facet,
+                               before roundoff, not simplicial vertices
+                               actual outer plane is +DISTround and
+                               computed outer plane is +2*DISTround */
+  realT max_vertex;       /* maximum distance (>0) from vertex to a facet,
+                               before roundoff, due to a merge */
+  realT min_vertex;       /* minimum distance (<0) from vertex to a facet,
+                               before roundoff, due to a merge
+                               if qh.JOGGLEmax, qh_makenewplanes sets it
+                               recomputed if qh.DOcheckmax, default -qh.DISTround */
+  boolT NEWfacets;        /* true while visible facets invalid due to new or merge
+                              from makecone/attachnewfacets to deletevisible */
+  boolT findbestnew;      /* true if partitioning calls qh_findbestnew */
+  boolT findbest_notsharp; /* true if new facets are at least 90 degrees */
+  boolT NOerrexit;        /* true if qh.errexit is not available */
+  realT PRINTcradius;     /* radius for printing centrums */
+  realT PRINTradius;      /* radius for printing vertex spheres and points */
+  boolT POSTmerging;      /* true when post merging */
+  int   printoutvar;      /* temporary variable for qh_printbegin, etc. */
+  int   printoutnum;      /* number of facets printed */
+  boolT QHULLfinished;    /* True after qhull() is finished */
+  realT totarea;          /* 'FA': total facet area computed by qh_getarea, hasAreaVolume */
+  realT totvol;           /* 'FA': total volume computed by qh_getarea, hasAreaVolume */
+  unsigned int visit_id;  /* unique ID for searching neighborhoods, */
+  unsigned int vertex_visit:31; /* unique ID for searching vertices, reset with qh_buildtracing */
+  boolT ZEROall_ok;       /* True if qh_checkzero always succeeds */
+  boolT WAScoplanar;      /* True if qh_partitioncoplanar (qh_check_maxout) */
+
+/*----------------------------------
+
+  qh global sets
+    defines sets for merging, initial simplex, hashing, extra input points,
+    and deleted vertices
+*/
+  setT *facet_mergeset;   /* temporary set of merges to be done */
+  setT *degen_mergeset;   /* temporary set of degenerate and redundant merges */
+  setT *hash_table;       /* hash table for matching ridges in qh_matchfacets
+                             size is setsize() */
+  setT *other_points;     /* additional points */
+  setT *del_vertices;     /* vertices to partition and delete with visible
+                             facets.  Have deleted set for checkfacet */
+
+/*----------------------------------
+
+  qh global buffers
+    defines buffers for maxtrix operations, input, and error messages
+*/
+  coordT *gm_matrix;      /* (dim+1)Xdim matrix for geom.c */
+  coordT **gm_row;        /* array of gm_matrix rows */
+  char* line;             /* malloc'd input line of maxline+1 chars */
+  int maxline;
+  coordT *half_space;     /* malloc'd input array for halfspace (qh normal_size+coordT) */
+  coordT *temp_malloc;    /* malloc'd input array for points */
+
+/*----------------------------------
+
+  qh static variables
+    defines static variables for individual functions
+
+  notes:
+    do not use 'static' within a function.  Multiple instances of qhull
+    may exist.
+
+    do not assume zero initialization, 'QPn' may cause a restart
+*/
+  boolT ERREXITcalled;    /* true during qh_errexit (prevents duplicate calls */
+  boolT firstcentrum;     /* for qh_printcentrum */
+  boolT old_randomdist;   /* save RANDOMdist flag during io, tracing, or statistics */
+  setT *coplanarfacetset;  /* set of coplanar facets for searching qh_findbesthorizon() */
+  realT last_low;         /* qh_scalelast parameters for qh_setdelaunay */
+  realT last_high;
+  realT last_newhigh;
+  unsigned lastreport;    /* for qh_buildtracing */
+  int mergereport;        /* for qh_tracemerging */
+  qhstatT *old_qhstat;    /* for saving qh_qhstat in save_qhull() and UsingLibQhull.  Free with qh_free() */
+  setT *old_tempstack;    /* for saving qhmem.tempstack in save_qhull */
+  int   ridgeoutnum;      /* number of ridges for 4OFF output (qh_printbegin,etc) */
+};
+
+/*=========== -macros- =========================*/
+
+/*----------------------------------
+
+  otherfacet_(ridge, facet)
+    return neighboring facet for a ridge in facet
+*/
+#define otherfacet_(ridge, facet) \
+                        (((ridge)->top == (facet)) ? (ridge)->bottom : (ridge)->top)
+
+/*----------------------------------
+
+  getid_(p)
+    return int ID for facet, ridge, or vertex
+    return -1 if NULL
+*/
+#define getid_(p)       ((p) ? (int)((p)->id) : -1)
+
+/*============== FORALL macros ===================*/
+
+/*----------------------------------
+
+  FORALLfacets { ... }
+    assign 'facet' to each facet in qh.facet_list
+
+  notes:
+    uses 'facetT *facet;'
+    assumes last facet is a sentinel
+
+  see:
+    FORALLfacet_( facetlist )
+*/
+#define FORALLfacets for (facet=qh facet_list;facet && facet->next;facet=facet->next)
+
+/*----------------------------------
+
+  FORALLpoints { ... }
+    assign 'point' to each point in qh.first_point, qh.num_points
+
+  declare:
+    coordT *point, *pointtemp;
+*/
+#define FORALLpoints FORALLpoint_(qh first_point, qh num_points)
+
+/*----------------------------------
+
+  FORALLpoint_( points, num) { ... }
+    assign 'point' to each point in points array of num points
+
+  declare:
+    coordT *point, *pointtemp;
+*/
+#define FORALLpoint_(points, num) for (point= (points), \
+      pointtemp= (points)+qh hull_dim*(num); point < pointtemp; point += qh hull_dim)
+
+/*----------------------------------
+
+  FORALLvertices { ... }
+    assign 'vertex' to each vertex in qh.vertex_list
+
+  declare:
+    vertexT *vertex;
+
+  notes:
+    assumes qh.vertex_list terminated with a sentinel
+*/
+#define FORALLvertices for (vertex=qh vertex_list;vertex && vertex->next;vertex= vertex->next)
+
+/*----------------------------------
+
+  FOREACHfacet_( facets ) { ... }
+    assign 'facet' to each facet in facets
+
+  declare:
+    facetT *facet, **facetp;
+
+  see:
+    FOREACHsetelement_
+*/
+#define FOREACHfacet_(facets)    FOREACHsetelement_(facetT, facets, facet)
+
+/*----------------------------------
+
+  FOREACHneighbor_( facet ) { ... }
+    assign 'neighbor' to each neighbor in facet->neighbors
+
+  FOREACHneighbor_( vertex ) { ... }
+    assign 'neighbor' to each neighbor in vertex->neighbors
+
+  declare:
+    facetT *neighbor, **neighborp;
+
+  see:
+    FOREACHsetelement_
+*/
+#define FOREACHneighbor_(facet)  FOREACHsetelement_(facetT, facet->neighbors, neighbor)
+
+/*----------------------------------
+
+  FOREACHpoint_( points ) { ... }
+    assign 'point' to each point in points set
+
+  declare:
+    pointT *point, **pointp;
+
+  see:
+    FOREACHsetelement_
+*/
+#define FOREACHpoint_(points)    FOREACHsetelement_(pointT, points, point)
+
+/*----------------------------------
+
+  FOREACHridge_( ridges ) { ... }
+    assign 'ridge' to each ridge in ridges set
+
+  declare:
+    ridgeT *ridge, **ridgep;
+
+  see:
+    FOREACHsetelement_
+*/
+#define FOREACHridge_(ridges)    FOREACHsetelement_(ridgeT, ridges, ridge)
+
+/*----------------------------------
+
+  FOREACHvertex_( vertices ) { ... }
+    assign 'vertex' to each vertex in vertices set
+
+  declare:
+    vertexT *vertex, **vertexp;
+
+  see:
+    FOREACHsetelement_
+*/
+#define FOREACHvertex_(vertices) FOREACHsetelement_(vertexT, vertices,vertex)
+
+/*----------------------------------
+
+  FOREACHfacet_i_( facets ) { ... }
+    assign 'facet' and 'facet_i' for each facet in facets set
+
+  declare:
+    facetT *facet;
+    int     facet_n, facet_i;
+
+  see:
+    FOREACHsetelement_i_
+*/
+#define FOREACHfacet_i_(facets)    FOREACHsetelement_i_(facetT, facets, facet)
+
+/*----------------------------------
+
+  FOREACHneighbor_i_( facet ) { ... }
+    assign 'neighbor' and 'neighbor_i' for each neighbor in facet->neighbors
+
+  FOREACHneighbor_i_( vertex ) { ... }
+    assign 'neighbor' and 'neighbor_i' for each neighbor in vertex->neighbors
+
+  declare:
+    facetT *neighbor;
+    int     neighbor_n, neighbor_i;
+
+  see:
+    FOREACHsetelement_i_
+*/
+#define FOREACHneighbor_i_(facet)  FOREACHsetelement_i_(facetT, facet->neighbors, neighbor)
+
+/*----------------------------------
+
+  FOREACHpoint_i_( points ) { ... }
+    assign 'point' and 'point_i' for each point in points set
+
+  declare:
+    pointT *point;
+    int     point_n, point_i;
+
+  see:
+    FOREACHsetelement_i_
+*/
+#define FOREACHpoint_i_(points)    FOREACHsetelement_i_(pointT, points, point)
+
+/*----------------------------------
+
+  FOREACHridge_i_( ridges ) { ... }
+    assign 'ridge' and 'ridge_i' for each ridge in ridges set
+
+  declare:
+    ridgeT *ridge;
+    int     ridge_n, ridge_i;
+
+  see:
+    FOREACHsetelement_i_
+*/
+#define FOREACHridge_i_(ridges)    FOREACHsetelement_i_(ridgeT, ridges, ridge)
+
+/*----------------------------------
+
+  FOREACHvertex_i_( vertices ) { ... }
+    assign 'vertex' and 'vertex_i' for each vertex in vertices set
+
+  declare:
+    vertexT *vertex;
+    int     vertex_n, vertex_i;
+
+  see:
+    FOREACHsetelement_i_
+*/
+#define FOREACHvertex_i_(vertices) FOREACHsetelement_i_(vertexT, vertices,vertex)
+
+/********* -libqhull.c prototypes (duplicated from qhull_a.h) **********************/
+
+void    qh_qhull(void);
+boolT   qh_addpoint(pointT *furthest, facetT *facet, boolT checkdist);
+void    qh_printsummary(FILE *fp);
+
+/********* -user.c prototypes (alphabetical) **********************/
+
+void    qh_errexit(int exitcode, facetT *facet, ridgeT *ridge);
+void    qh_errprint(const char* string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex);
+int     qh_new_qhull(int dim, int numpoints, coordT *points, boolT ismalloc,
+                char *qhull_cmd, FILE *outfile, FILE *errfile);
+void    qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall);
+void    qh_printhelp_degenerate(FILE *fp);
+void    qh_printhelp_narrowhull(FILE *fp, realT minangle);
+void    qh_printhelp_singular(FILE *fp);
+void    qh_user_memsizes(void);
+
+/********* -usermem.c prototypes (alphabetical) **********************/
+void    qh_exit(int exitcode);
+void    qh_free(void *mem);
+void   *qh_malloc(size_t size);
+
+/********* -userprintf.c prototypes (alphabetical) **********************/
+void    qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... );
+void    qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... );
+
+/***** -geom.c/geom2.c/random.c prototypes (duplicated from geom.h, random.h) ****************/
+
+facetT *qh_findbest(pointT *point, facetT *startfacet,
+                     boolT bestoutside, boolT newfacets, boolT noupper,
+                     realT *dist, boolT *isoutside, int *numpart);
+facetT *qh_findbestnew(pointT *point, facetT *startfacet,
+                     realT *dist, boolT bestoutside, boolT *isoutside, int *numpart);
+boolT   qh_gram_schmidt(int dim, realT **rows);
+void    qh_outerinner(facetT *facet, realT *outerplane, realT *innerplane);
+void    qh_printsummary(FILE *fp);
+void    qh_projectinput(void);
+void    qh_randommatrix(realT *buffer, int dim, realT **row);
+void    qh_rotateinput(realT **rows);
+void    qh_scaleinput(void);
+void    qh_setdelaunay(int dim, int count, pointT *points);
+coordT  *qh_sethalfspace_all(int dim, int count, coordT *halfspaces, pointT *feasible);
+
+/***** -global.c prototypes (alphabetical) ***********************/
+
+unsigned long qh_clock(void);
+void    qh_checkflags(char *command, char *hiddenflags);
+void    qh_clear_outputflags(void);
+void    qh_freebuffers(void);
+void    qh_freeqhull(boolT allmem);
+void    qh_freeqhull2(boolT allmem);
+void    qh_init_A(FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]);
+void    qh_init_B(coordT *points, int numpoints, int dim, boolT ismalloc);
+void    qh_init_qhull_command(int argc, char *argv[]);
+void    qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
+void    qh_initflags(char *command);
+void    qh_initqhull_buffers(void);
+void    qh_initqhull_globals(coordT *points, int numpoints, int dim, boolT ismalloc);
+void    qh_initqhull_mem(void);
+void    qh_initqhull_outputflags(void);
+void    qh_initqhull_start(FILE *infile, FILE *outfile, FILE *errfile);
+void    qh_initqhull_start2(FILE *infile, FILE *outfile, FILE *errfile);
+void    qh_initthresholds(char *command);
+void    qh_option(const char *option, int *i, realT *r);
+#if qh_QHpointer
+void    qh_restore_qhull(qhT **oldqh);
+qhT    *qh_save_qhull(void);
+#endif
+
+/***** -io.c prototypes (duplicated from io.h) ***********************/
+
+void    dfacet( unsigned id);
+void    dvertex( unsigned id);
+void    qh_printneighborhood(FILE *fp, qh_PRINT format, facetT *facetA, facetT *facetB, boolT printall);
+void    qh_produce_output(void);
+coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);
+
+
+/********* -mem.c prototypes (duplicated from mem.h) **********************/
+
+void qh_meminit(FILE *ferr);
+void qh_memfreeshort(int *curlong, int *totlong);
+
+/********* -poly.c/poly2.c prototypes (duplicated from poly.h) **********************/
+
+void    qh_check_output(void);
+void    qh_check_points(void);
+setT   *qh_facetvertices(facetT *facetlist, setT *facets, boolT allfacets);
+facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
+           realT *bestdist, boolT *isoutside);
+vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp);
+pointT *qh_point(int id);
+setT   *qh_pointfacet(void /*qh.facet_list*/);
+int     qh_pointid(pointT *point);
+setT   *qh_pointvertex(void /*qh.facet_list*/);
+void    qh_setvoronoi_all(void);
+void    qh_triangulate(void /*qh facet_list*/);
+
+/********* -rboxpoints.c prototypes **********************/
+int     qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command);
+void    qh_errexit_rbox(int exitcode);
+
+/********* -stat.c prototypes (duplicated from stat.h) **********************/
+
+void    qh_collectstatistics(void);
+void    qh_printallstatistics(FILE *fp, const char *string);
+
+#endif /* qhDEFlibqhull */

Modified: trunk/scipy/spatial/qhull/src/mem.c
===================================================================
--- trunk/scipy/spatial/qhull/src/mem.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/mem.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,82 +1,94 @@
 /*
  ---------------------------------
 
-  mem.c 
+  mem.c
     memory management routines for qhull
 
   This is a standalone program.
-   
+
   To initialize memory:
 
-    qh_meminit (stderr);  
-    qh_meminitbuffers (qh IStracing, qh_MEMalign, 7, qh_MEMbufsize,qh_MEMinitbuf);
-    qh_memsize(sizeof(facetT));
-    qh_memsize(sizeof(facetT));
+    qh_meminit(stderr);
+    qh_meminitbuffers(qh IStracing, qh_MEMalign, 7, qh_MEMbufsize,qh_MEMinitbuf);
+    qh_memsize((int)sizeof(facetT));
+    qh_memsize((int)sizeof(facetT));
     ...
     qh_memsetup();
-    
+
   To free up all memory buffers:
-    qh_memfreeshort (&curlong, &totlong);
-         
-  if qh_NOmem, 
+    qh_memfreeshort(&curlong, &totlong);
+
+  if qh_NOmem,
     malloc/free is used instead of mem.c
 
-  notes: 
+  notes:
     uses Quickfit algorithm (freelists for commonly allocated sizes)
     assumes small sizes for freelists (it discards the tail of memory buffers)
-   
+
   see:
     qh-mem.htm and mem.h
-    global.c (qh_initbuffers) for an example of using mem.c 
-   
-  copyright (c) 1993-2003 The Geometry Center
+    global.c (qh_initbuffers) for an example of using mem.c
+
+  copyright (c) 1993-2010 The Geometry Center.
+  $Id: //product/qhull/main/rel/src/mem.c#32 $$Change: 1164 $
+  $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
+#include "mem.h"
+#include 
 #include 
 #include 
-#include 
-#include "mem.h"
 
-#ifndef qhDEFqhull
+#ifndef qhDEFlibqhull
 typedef struct ridgeT ridgeT;
 typedef struct facetT facetT;
+#ifdef _MSC_VER  /* Microsoft Visual C++ -- warning level 4 */
+#pragma warning( disable : 4127)  /* conditional expression is constant */
+#pragma warning( disable : 4706)  /* assignment within conditional function */
+#endif
 void    qh_errexit(int exitcode, facetT *, ridgeT *);
+void    qh_exit(int exitcode);
+void    qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... );
+void    qh_free(void *mem);
+void   *qh_malloc(size_t size);
 #endif
 
 /*============ -global data structure ==============
     see mem.h for definition
 */
 
-qhmemT qhmem= {0};     /* remove "= {0}" if this causes a compiler error */
+qhmemT qhmem= {0,0,0,0,0,0,0,0,0,0,0,
+               0,0,0,0,0,0,0,0,0,0,0,
+               0,0,0,0,0,0,0};     /* remove "= {0}" if this causes a compiler error */
 
 #ifndef qh_NOmem
 
 /*============= internal functions ==============*/
-  
+
 static int qh_intcompare(const void *i, const void *j);
 
 /*========== functions in alphabetical order ======== */
 
 /*---------------------------------
-  
+
   qh_intcompare( i, j )
     used by qsort and bsearch to compare two integers
 */
 static int qh_intcompare(const void *i, const void *j) {
-  return(*((int *)i) - *((int *)j));
+  return(*((const int *)i) - *((const int *)j));
 } /* intcompare */
 
 
 /*----------------------------------
-   
-  qh_memalloc( insize )  
+
+  qh_memalloc( insize )
     returns object of insize bytes
-    qhmem is the global memory structure 
-    
+    qhmem is the global memory structure
+
   returns:
-    pointer to allocated memory 
+    pointer to allocated memory
     errors if insufficient memory
 
   notes:
@@ -84,7 +96,7 @@
     actual object may be larger than insize
     use qh_memalloc_() for inline code for quick allocations
     logs allocations if 'T5'
-  
+
   design:
     if size < qhmem.LASTsize
       if qhmem.freelists[size] non-empty
@@ -94,72 +106,91 @@
         allocate new allocation buffer if necessary
         allocate object from allocation buffer
     else
-      allocate object with malloc()
+      allocate object with qh_malloc() in user.c
 */
 void *qh_memalloc(int insize) {
   void **freelistp, *newbuffer;
-  int index, size;
+  int idx, size, n;
   int outsize, bufsize;
   void *object;
 
-  if ((unsigned) insize <= (unsigned) qhmem.LASTsize) {
-    index= qhmem.indextable[insize];
-    freelistp= qhmem.freelists+index;
+  if (insize <= qhmem.LASTsize) {
+    idx= qhmem.indextable[insize];
+    outsize= qhmem.sizetable[idx];
+    qhmem.totshort += outsize;
+    freelistp= qhmem.freelists+idx;
     if ((object= *freelistp)) {
-      qhmem.cntquick++;  
+      qhmem.cntquick++;
+      qhmem.totfree -= outsize;
       *freelistp= *((void **)*freelistp);  /* replace freelist with next object */
-      return (object);
+#ifdef qh_TRACEshort
+      n= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
+      if (qhmem.IStracing >= 5)
+          qh_fprintf(qhmem.ferr, 8141, "qh_mem %p n %8d alloc quick: %d bytes (tot %d cnt %d)\n", object, n, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
+#endif
+      return(object);
     }else {
-      outsize= qhmem.sizetable[index];
       qhmem.cntshort++;
       if (outsize > qhmem .freesize) {
-	if (!qhmem.curbuffer)
-	  bufsize= qhmem.BUFinit;
+        qhmem .totdropped += qhmem .freesize;
+        if (!qhmem.curbuffer)
+          bufsize= qhmem.BUFinit;
         else
-	  bufsize= qhmem.BUFsize;
-        qhmem.totshort += bufsize;
-	if (!(newbuffer= malloc(bufsize))) {
-	  fprintf(qhmem.ferr, "qhull error (qh_memalloc): insufficient memory\n");
-	  qh_errexit(qhmem_ERRmem, NULL, NULL);
-	} 
-	*((void **)newbuffer)= qhmem.curbuffer;  /* prepend newbuffer to curbuffer 
-						    list */
-	qhmem.curbuffer= newbuffer;
+          bufsize= qhmem.BUFsize;
+        if (!(newbuffer= qh_malloc((size_t)bufsize))) {
+          qh_fprintf(qhmem.ferr, 6080, "qhull error (qh_memalloc): insufficient memory to allocate short memory buffer (%d bytes)\n", bufsize);
+          qh_errexit(qhmem_ERRmem, NULL, NULL);
+        }
+        *((void **)newbuffer)= qhmem.curbuffer;  /* prepend newbuffer to curbuffer
+                                                    list */
+        qhmem.curbuffer= newbuffer;
         size= (sizeof(void **) + qhmem.ALIGNmask) & ~qhmem.ALIGNmask;
-	qhmem.freemem= (void *)((char *)newbuffer+size);
-	qhmem.freesize= bufsize - size;
+        qhmem.freemem= (void *)((char *)newbuffer+size);
+        qhmem.freesize= bufsize - size;
+        qhmem.totbuffer += bufsize - size; /* easier to check */
+        /* Periodically test totbuffer.  It matches at beginning and exit of every call */
+        n = qhmem.totshort + qhmem.totfree + qhmem.totdropped + qhmem.freesize - outsize;
+        if (qhmem.totbuffer != n) {
+            qh_fprintf(qhmem.ferr, 6212, "qh_memalloc internal error: short totbuffer %d != totshort+totfree... %d\n", qhmem.totbuffer, n);
+            qh_errexit(qhmem_ERRmem, NULL, NULL);
+        }
       }
       object= qhmem.freemem;
       qhmem.freemem= (void *)((char *)qhmem.freemem + outsize);
       qhmem.freesize -= outsize;
+      qhmem.totunused += outsize - insize;
+#ifdef qh_TRACEshort
+      n= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
+      if (qhmem.IStracing >= 5)
+          qh_fprintf(qhmem.ferr, 8140, "qh_mem %p n %8d alloc short: %d bytes (tot %d cnt %d)\n", object, n, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
+#endif
       return object;
     }
   }else {                     /* long allocation */
     if (!qhmem.indextable) {
-      fprintf (qhmem.ferr, "qhull internal error (qh_memalloc): qhmem has not been initialized.\n");
+      qh_fprintf(qhmem.ferr, 6081, "qhull internal error (qh_memalloc): qhmem has not been initialized.\n");
       qh_errexit(qhmem_ERRqhull, NULL, NULL);
     }
     outsize= insize;
     qhmem .cntlong++;
-    qhmem .curlong++;
     qhmem .totlong += outsize;
     if (qhmem.maxlong < qhmem.totlong)
       qhmem.maxlong= qhmem.totlong;
-    if (!(object= malloc(outsize))) {
-      fprintf(qhmem.ferr, "qhull error (qh_memalloc): insufficient memory\n");
+    if (!(object= qh_malloc((size_t)outsize))) {
+      qh_fprintf(qhmem.ferr, 6082, "qhull error (qh_memalloc): insufficient memory to allocate %d bytes\n", outsize);
       qh_errexit(qhmem_ERRmem, NULL, NULL);
     }
     if (qhmem.IStracing >= 5)
-      fprintf (qhmem.ferr, "qh_memalloc long: %d bytes at %p\n", outsize, object);
+      qh_fprintf(qhmem.ferr, 8057, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, outsize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
   }
-  return (object);
+  return(object);
 } /* memalloc */
 
 
 /*----------------------------------
-   
-  qh_memfree( object, size ) 
+
+  qh_memfree( object, insize )
     free up an object of size bytes
     size is insize from qh_memalloc
 
@@ -167,83 +198,101 @@
     object may be NULL
     type checking warns if using (void **)object
     use qh_memfree_() for quick free's of small objects
- 
+
   design:
     if size <= qhmem.LASTsize
       append object to corresponding freelist
     else
-      call free(object)
+      call qh_free(object)
 */
-void qh_memfree(void *object, int size) {
+void qh_memfree(void *object, int insize) {
   void **freelistp;
+  int idx, outsize;
 
   if (!object)
     return;
-  if (size <= qhmem.LASTsize) {
+  if (insize <= qhmem.LASTsize) {
     qhmem .freeshort++;
-    freelistp= qhmem.freelists + qhmem.indextable[size];
+    idx= qhmem.indextable[insize];
+    outsize= qhmem.sizetable[idx];
+    qhmem .totfree += outsize;
+    qhmem .totshort -= outsize;
+    freelistp= qhmem.freelists + idx;
     *((void **)object)= *freelistp;
     *freelistp= object;
+#ifdef qh_TRACEshort
+    idx= qhmem.cntshort+qhmem.cntquick+qhmem.freeshort;
+    if (qhmem.IStracing >= 5)
+        qh_fprintf(qhmem.ferr, 8142, "qh_mem %p n %8d free short: %d bytes (tot %d cnt %d)\n", object, idx, outsize, qhmem.totshort, qhmem.cntshort+qhmem.cntquick-qhmem.freeshort);
+#endif
   }else {
     qhmem .freelong++;
-    qhmem .totlong -= size;
-    free (object);
+    qhmem .totlong -= insize;
+    qh_free(object);
     if (qhmem.IStracing >= 5)
-      fprintf (qhmem.ferr, "qh_memfree long: %d bytes at %p\n", size, object);
+      qh_fprintf(qhmem.ferr, 8058, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
   }
 } /* memfree */
 
 
 /*---------------------------------
-  
+
   qh_memfreeshort( curlong, totlong )
     frees up all short and qhmem memory allocations
 
   returns:
     number and size of current long allocations
+
+  see:
+    qh_freeqhull(allMem)
+    qh_memtotal(curlong, totlong, curshort, totshort, maxlong, totbuffer);
 */
-void qh_memfreeshort (int *curlong, int *totlong) {
+void qh_memfreeshort(int *curlong, int *totlong) {
   void *buffer, *nextbuffer;
   FILE *ferr;
 
   *curlong= qhmem .cntlong - qhmem .freelong;
   *totlong= qhmem .totlong;
-  for(buffer= qhmem.curbuffer; buffer; buffer= nextbuffer) {
+  for (buffer= qhmem.curbuffer; buffer; buffer= nextbuffer) {
     nextbuffer= *((void **) buffer);
-    free(buffer);
+    qh_free(buffer);
   }
   qhmem.curbuffer= NULL;
   if (qhmem .LASTsize) {
-    free (qhmem .indextable);
-    free (qhmem .freelists);
-    free (qhmem .sizetable);
+    qh_free(qhmem .indextable);
+    qh_free(qhmem .freelists);
+    qh_free(qhmem .sizetable);
   }
   ferr= qhmem.ferr;
-  memset((char *)&qhmem, 0, sizeof qhmem);  /* every field is 0, FALSE, NULL */
+  memset((char *)&qhmem, 0, sizeof(qhmem));  /* every field is 0, FALSE, NULL */
   qhmem.ferr= ferr;
 } /* memfreeshort */
 
 
 /*----------------------------------
-   
+
   qh_meminit( ferr )
     initialize qhmem and test sizeof( void*)
 */
-void qh_meminit (FILE *ferr) {
-  
-  memset((char *)&qhmem, 0, sizeof qhmem);  /* every field is 0, FALSE, NULL */
+void qh_meminit(FILE *ferr) {
+
+  memset((char *)&qhmem, 0, sizeof(qhmem));  /* every field is 0, FALSE, NULL */
   qhmem.ferr= ferr;
   if (sizeof(void*) < sizeof(int)) {
-    fprintf (ferr, "qhull internal error (qh_meminit): sizeof(void*) < sizeof(int).  qset.c will not work\n");
-    exit (1);  /* can not use qh_errexit() */
+    qh_fprintf(ferr, 6083, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d.  qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
+    qh_exit(qhmem_ERRqhull);  /* can not use qh_errexit() */
   }
+  if (sizeof(void*) > sizeof(ptr_intT)) {
+      qh_fprintf(ferr, 6084, "qhull internal error (qh_meminit): sizeof(void*) %d > sizeof(ptr_intT) %d. Change ptr_intT in mem.h to 'long long'\n", (int)sizeof(void*), (int)sizeof(ptr_intT));
+      qh_exit(qhmem_ERRqhull);  /* can not use qh_errexit() */
+  }
 } /* meminit */
 
 /*---------------------------------
-  
+
   qh_meminitbuffers( tracelevel, alignment, numsizes, bufsize, bufinit )
     initialize qhmem
     if tracelevel >= 5, trace memory allocations
@@ -252,7 +301,7 @@
     bufsize=  size of additional memory buffers for short allocations
     bufinit=  size of initial memory buffer for short allocations
 */
-void qh_meminitbuffers (int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
+void qh_meminitbuffers(int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
 
   qhmem.IStracing= tracelevel;
   qhmem.NUMsizes= numsizes;
@@ -260,43 +309,43 @@
   qhmem.BUFinit= bufinit;
   qhmem.ALIGNmask= alignment-1;
   if (qhmem.ALIGNmask & ~qhmem.ALIGNmask) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_meminit): memory alignment %d is not a power of 2\n", alignment);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6085, "qhull internal error (qh_meminit): memory alignment %d is not a power of 2\n", alignment);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
-  qhmem.sizetable= (int *) calloc (numsizes, sizeof(int));
-  qhmem.freelists= (void **) calloc (numsizes, sizeof(void *));
+  qhmem.sizetable= (int *) calloc((size_t)numsizes, sizeof(int));
+  qhmem.freelists= (void **) calloc((size_t)numsizes, sizeof(void *));
   if (!qhmem.sizetable || !qhmem.freelists) {
-    fprintf(qhmem.ferr, "qhull error (qh_meminit): insufficient memory\n");
-    qh_errexit (qhmem_ERRmem, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6086, "qhull error (qh_meminit): insufficient memory\n");
+    qh_errexit(qhmem_ERRmem, NULL, NULL);
   }
   if (qhmem.IStracing >= 1)
-    fprintf (qhmem.ferr, "qh_meminitbuffers: memory initialized with alignment %d\n", alignment);
+    qh_fprintf(qhmem.ferr, 8059, "qh_meminitbuffers: memory initialized with alignment %d\n", alignment);
 } /* meminitbuffers */
 
 /*---------------------------------
-  
+
   qh_memsetup()
     set up memory after running memsize()
 */
-void qh_memsetup (void) {
+void qh_memsetup(void) {
   int k,i;
 
-  qsort(qhmem.sizetable, qhmem.TABLEsize, sizeof(int), qh_intcompare);
+  qsort(qhmem.sizetable, (size_t)qhmem.TABLEsize, sizeof(int), qh_intcompare);
   qhmem.LASTsize= qhmem.sizetable[qhmem.TABLEsize-1];
   if (qhmem .LASTsize >= qhmem .BUFsize || qhmem.LASTsize >= qhmem .BUFinit) {
-    fprintf (qhmem.ferr, "qhull error (qh_memsetup): largest mem size %d is >= buffer size %d or initial buffer size %d\n",
+    qh_fprintf(qhmem.ferr, 6087, "qhull error (qh_memsetup): largest mem size %d is >= buffer size %d or initial buffer size %d\n",
             qhmem .LASTsize, qhmem .BUFsize, qhmem .BUFinit);
     qh_errexit(qhmem_ERRmem, NULL, NULL);
   }
-  if (!(qhmem.indextable= (int *)malloc((qhmem.LASTsize+1) * sizeof(int)))) {
-    fprintf(qhmem.ferr, "qhull error (qh_memsetup): insufficient memory\n");
+  if (!(qhmem.indextable= (int *)qh_malloc((qhmem.LASTsize+1) * sizeof(int)))) {
+    qh_fprintf(qhmem.ferr, 6088, "qhull error (qh_memsetup): insufficient memory\n");
     qh_errexit(qhmem_ERRmem, NULL, NULL);
   }
-  for(k=qhmem.LASTsize+1; k--; )
+  for (k=qhmem.LASTsize+1; k--; )
     qhmem.indextable[k]= k;
   i= 0;
-  for(k= 0; k <= qhmem.LASTsize; k++) {
+  for (k=0; k <= qhmem.LASTsize; k++) {
     if (qhmem.indextable[k] <= qhmem.sizetable[i])
       qhmem.indextable[k]= i;
     else
@@ -306,7 +355,7 @@
 
 /*---------------------------------
-  
+
   qh_memsize( size )
     define a free list for this size
 */
@@ -314,41 +363,44 @@
   int k;
 
   if (qhmem .LASTsize) {
-    fprintf (qhmem .ferr, "qhull error (qh_memsize): called after qhmem_setup\n");
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6089, "qhull error (qh_memsize): called after qhmem_setup\n");
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   size= (size + qhmem.ALIGNmask) & ~qhmem.ALIGNmask;
-  for(k= qhmem.TABLEsize; k--; ) {
+  for (k=qhmem.TABLEsize; k--; ) {
     if (qhmem.sizetable[k] == size)
       return;
   }
   if (qhmem.TABLEsize < qhmem.NUMsizes)
     qhmem.sizetable[qhmem.TABLEsize++]= size;
   else
-    fprintf(qhmem.ferr, "qhull warning (memsize): free list table has room for only %d sizes\n", qhmem.NUMsizes);
+    qh_fprintf(qhmem.ferr, 7060, "qhull warning (memsize): free list table has room for only %d sizes\n", qhmem.NUMsizes);
 } /* memsize */
 
 
 /*---------------------------------
-  
+
   qh_memstatistics( fp )
     print out memory statistics
 
-  notes:
-    does not account for wasted memory at the end of each block
+    Verifies that qhmem.totfree == sum of freelists
 */
-void qh_memstatistics (FILE *fp) {
+void qh_memstatistics(FILE *fp) {
   int i, count, totfree= 0;
   void *object;
-  
+
   for (i=0; i < qhmem.TABLEsize; i++) {
     count=0;
     for (object= qhmem .freelists[i]; object; object= *((void **)object))
       count++;
     totfree += qhmem.sizetable[i] * count;
   }
-  fprintf (fp, "\nmemory statistics:\n\
+  if (totfree != qhmem .totfree) {
+      qh_fprintf(qhmem.ferr, 6211, "qh_memstatistics internal error: totfree %d not equal to freelist total %d\n", qhmem.totfree, totfree);
+      qh_errexit(qhmem_ERRqhull, NULL, NULL);
+  }
+  qh_fprintf(fp, 9278, "\nmemory statistics:\n\
 %7d quick allocations\n\
 %7d short allocations\n\
 %7d long allocations\n\
@@ -356,86 +408,93 @@
 %7d long frees\n\
 %7d bytes of short memory in use\n\
 %7d bytes of short memory in freelists\n\
-%7d bytes of long memory allocated (except for input)\n\
+%7d bytes of dropped short memory\n\
+%7d bytes of unused short memory (estimated)\n\
+%7d bytes of long memory allocated (max, except for input)\n\
 %7d bytes of long memory in use (in %d pieces)\n\
-%7d bytes per memory buffer (initially %d bytes)\n",
-	   qhmem .cntquick, qhmem.cntshort, qhmem.cntlong,
-	   qhmem .freeshort, qhmem.freelong, 
-	   qhmem .totshort - qhmem .freesize - totfree,
-	   totfree,
-	   qhmem .maxlong, qhmem .totlong, qhmem .cntlong - qhmem .freelong,
-	   qhmem .BUFsize, qhmem .BUFinit);
+%7d bytes of short memory buffers (minus links)\n\
+%7d bytes per short memory buffer (initially %d bytes)\n",
+           qhmem .cntquick, qhmem .cntshort, qhmem .cntlong,
+           qhmem .freeshort, qhmem .freelong,
+           qhmem .totshort, qhmem .totfree,
+           qhmem .totdropped + qhmem .freesize, qhmem .totunused,
+           qhmem .maxlong, qhmem .totlong, qhmem .cntlong - qhmem .freelong,
+           qhmem .totbuffer, qhmem .BUFsize, qhmem .BUFinit);
   if (qhmem.cntlarger) {
-    fprintf (fp, "%7d calls to qh_setlarger\n%7.2g     average copy size\n",
-	   qhmem.cntlarger, ((float) qhmem.totlarger)/ qhmem.cntlarger);
-    fprintf (fp, "  freelists (bytes->count):");
+    qh_fprintf(fp, 9279, "%7d calls to qh_setlarger\n%7.2g     average copy size\n",
+           qhmem.cntlarger, ((float)qhmem.totlarger)/(float)qhmem.cntlarger);
+    qh_fprintf(fp, 9280, "  freelists(bytes->count):");
   }
   for (i=0; i < qhmem.TABLEsize; i++) {
     count=0;
     for (object= qhmem .freelists[i]; object; object= *((void **)object))
       count++;
-    fprintf (fp, " %d->%d", qhmem.sizetable[i], count);
+    qh_fprintf(fp, 9281, " %d->%d", qhmem.sizetable[i], count);
   }
-  fprintf (fp, "\n\n");
+  qh_fprintf(fp, 9282, "\n\n");
 } /* memstatistics */
 
 
 /*---------------------------------
-  
+
   qh_NOmem
     turn off quick-fit memory allocation
 
   notes:
-    uses malloc() and free() instead
+    uses qh_malloc() and qh_free() instead
 */
 #else /* qh_NOmem */
 
 void *qh_memalloc(int insize) {
   void *object;
 
-  if (!(object= malloc(insize))) {
-    fprintf(qhmem.ferr, "qhull error (qh_memalloc): insufficient memory\n");
+  if (!(object= qh_malloc((size_t)insize))) {
+    qh_fprintf(qhmem.ferr, 6090, "qhull error (qh_memalloc): insufficient memory\n");
     qh_errexit(qhmem_ERRmem, NULL, NULL);
   }
+  qhmem .cntlong++;
+  qhmem .totlong += insize;
+  if (qhmem.maxlong < qhmem.totlong)
+      qhmem.maxlong= qhmem.totlong;
   if (qhmem.IStracing >= 5)
-    fprintf (qhmem.ferr, "qh_memalloc long: %d bytes at %p\n", insize, object);
+    qh_fprintf(qhmem.ferr, 8060, "qh_mem %p n %8d alloc long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
   return object;
 }
 
-void qh_memfree(void *object, int size) {
+void qh_memfree(void *object, int insize) {
 
   if (!object)
     return;
-  free (object);
+  qh_free(object);
+  qhmem .freelong++;
+  qhmem .totlong -= insize;
   if (qhmem.IStracing >= 5)
-    fprintf (qhmem.ferr, "qh_memfree long: %d bytes at %p\n", size, object);
+    qh_fprintf(qhmem.ferr, 8061, "qh_mem %p n %8d free long: %d bytes (tot %d cnt %d)\n", object, qhmem.cntlong+qhmem.freelong, insize, qhmem.totlong, qhmem.cntlong-qhmem.freelong);
 }
 
-void qh_memfreeshort (int *curlong, int *totlong) {
-
-  memset((char *)&qhmem, 0, sizeof qhmem);  /* every field is 0, FALSE, NULL */
-  *curlong= 0;
-  *totlong= 0;
+void qh_memfreeshort(int *curlong, int *totlong) {
+  *totlong= qhmem .totlong;
+  *curlong= qhmem .cntlong - qhmem .freelong;
+  memset((char *)&qhmem, 0, sizeof(qhmem));  /* every field is 0, FALSE, NULL */
 }
 
-void qh_meminit (FILE *ferr) {
+void qh_meminit(FILE *ferr) {
 
-  memset((char *)&qhmem, 0, sizeof qhmem);  /* every field is 0, FALSE, NULL */
+  memset((char *)&qhmem, 0, sizeof(qhmem));  /* every field is 0, FALSE, NULL */
   qhmem.ferr= ferr;
   if (sizeof(void*) < sizeof(int)) {
-    fprintf (ferr, "qhull internal error (qh_meminit): sizeof(void*) < sizeof(int).  qset.c will not work\n");
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(ferr, 6091, "qhull internal error (qh_meminit): sizeof(void*) %d < sizeof(int) %d.  qset.c will not work\n", (int)sizeof(void*), (int)sizeof(int));
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
 }
 
-void qh_meminitbuffers (int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
+void qh_meminitbuffers(int tracelevel, int alignment, int numsizes, int bufsize, int bufinit) {
 
   qhmem.IStracing= tracelevel;
-
 }
 
-void qh_memsetup (void) {
+void qh_memsetup(void) {
 
 }
 
@@ -443,8 +502,38 @@
 
 }
 
-void qh_memstatistics (FILE *fp) {
+void qh_memstatistics(FILE *fp) {
 
+  qh_fprintf(fp, 9409, "\nmemory statistics:\n\
+%7d long allocations\n\
+%7d long frees\n\
+%7d bytes of long memory allocated (max, except for input)\n\
+%7d bytes of long memory in use (in %d pieces)\n",
+           qhmem .cntlong,
+           qhmem .freelong,
+           qhmem .maxlong, qhmem .totlong, qhmem .cntlong - qhmem .freelong);
 }
 
 #endif /* qh_NOmem */
+
+/*---------------------------------
+
+  qh_memtotal( totlong, curlong, totshort, curshort, maxlong, totbuffer )
+    Return the total, allocated long and short memory
+
+  returns:
+    Returns the total current bytes of long and short allocations
+    Returns the current count of long and short allocations
+    Returns the maximum long memory and total short buffer (minus one link per buffer)
+    Does not error (UsingLibQhull.cpp)
+*/
+void qh_memtotal(int *totlong, int *curlong, int *totshort, int *curshort, int *maxlong, int *totbuffer) {
+    *totlong= qhmem .totlong;
+    *curlong= qhmem .cntlong - qhmem .freelong;
+    *totshort= qhmem .totshort;
+    *curshort= qhmem .cntshort + qhmem .cntquick - qhmem .freeshort;
+    *maxlong= qhmem .maxlong;
+    *totbuffer= qhmem .totbuffer;
+} /* memtotlong */
+

Modified: trunk/scipy/spatial/qhull/src/mem.h
===================================================================
--- trunk/scipy/spatial/qhull/src/mem.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/mem.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,25 +1,29 @@
 /*
  ---------------------------------
 
-   mem.h 
+   mem.h
      prototypes for memory management functions
 
    see qh-mem.htm, mem.c and qset.h
 
    for error handling, writes message and calls
-     qh_errexit (qhmem_ERRmem, NULL, NULL) if insufficient memory
+     qh_errexit(qhmem_ERRmem, NULL, NULL) if insufficient memory
        and
-     qh_errexit (qhmem_ERRqhull, NULL, NULL) otherwise
+     qh_errexit(qhmem_ERRqhull, NULL, NULL) otherwise
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/mem.h#28 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFmem
-#define qhDEFmem
+#define qhDEFmem 1
 
+#include 
+
 /*---------------------------------
-  
+
   qh_NOmem
     turn off quick-fit memory allocation
 
@@ -32,47 +36,63 @@
    #define qh_NOmem
 */
 
+/*---------------------------------
+
+qh_TRACEshort
+Trace short and quick memory allocations at T5
+
+*/
+#define qh_TRACEshort
+
 /*-------------------------------------------
     to avoid bus errors, memory allocation must consider alignment requirements.
     malloc() automatically takes care of alignment.   Since mem.c manages
     its own memory, we need to explicitly specify alignment in
     qh_meminitbuffers().
 
-    A safe choice is sizeof(double).  sizeof(float) may be used if doubles 
+    A safe choice is sizeof(double).  sizeof(float) may be used if doubles
     do not occur in data structures and pointers are the same size.  Be careful
-    of machines (e.g., DEC Alpha) with large pointers.  If gcc is available, 
+    of machines (e.g., DEC Alpha) with large pointers.  If gcc is available,
     use __alignof__(double) or fmax_(__alignof__(float), __alignof__(void *)).
 
    see qh_MEMalign in user.h for qhull's alignment
 */
 
-#define qhmem_ERRmem 4    /* matches qh_ERRmem in qhull.h */
-#define qhmem_ERRqhull 5  /* matches qh_ERRqhull in qhull.h */
+#define qhmem_ERRmem 4    /* matches qh_ERRmem in libqhull.h */
+#define qhmem_ERRqhull 5  /* matches qh_ERRqhull in libqhull.h */
 
 /*----------------------------------
-  
+
   ptr_intT
-    for casting a void* to an integer-type
-  
+    for casting a void * to an integer-type that holds a pointer
+    Used for integer expressions (e.g., computing qh_gethash() in poly.c)
+
   notes:
-    On 64-bit machines, a pointer may be larger than an 'int'.  
-    qh_meminit() checks that 'long' holds a 'void*'
+    WARN64 -- these notes indicate 64-bit issues
+    On 64-bit machines, a pointer may be larger than an 'int'.
+    qh_meminit()/mem.c checks that 'ptr_intT' holds a 'void*'
+    ptr_intT is not defined as 'long long' for portability to older compilers
+    ptr_intT is typically a signed value, but not necessarily so
+    size_t is typically unsigned, but should match the parameter type
+    Qhull uses int instead of size_t except for system calls such as malloc, qsort, qh_malloc, etc.
+    This matches Qt convention and is easier to work with.  
 */
-typedef unsigned long ptr_intT;
+typedef long ptr_intT;
 
 /*----------------------------------
- 
+
   qhmemT
     global memory structure for mem.c
- 
+
  notes:
    users should ignore qhmem except for writing extensions
-   qhmem is allocated in mem.c 
-   
+   qhmem is allocated in mem.c
+
    qhmem could be swapable like qh and qhstat, but then
-   multiple qh's and qhmem's would need to keep in synch.  
+   multiple qh's and qhmem's would need to keep in synch.
    A swapable qhmem would also waste memory buffers.  As long
    as memory operations are atomic, there is no problem with
    multiple qh structures being active at the same time.
@@ -80,34 +100,43 @@
    contents of qhmem.
 */
 typedef struct qhmemT qhmemT;
-extern qhmemT qhmem; 
+extern qhmemT qhmem;
 
+#ifndef DEFsetT
+#define DEFsetT 1
+typedef struct setT setT;          /* defined in qset.h */
+#endif
+
+/* Update qhmem in mem.c if add or remove fields */
 struct qhmemT {               /* global memory management variables */
-  int      BUFsize;	      /* size of memory allocation buffer */
-  int      BUFinit;	      /* initial size of memory allocation buffer */
+  int      BUFsize;           /* size of memory allocation buffer */
+  int      BUFinit;           /* initial size of memory allocation buffer */
   int      TABLEsize;         /* actual number of sizes in free list table */
   int      NUMsizes;          /* maximum number of sizes in free list table */
   int      LASTsize;          /* last size in free list table */
   int      ALIGNmask;         /* worst-case alignment, must be 2^n-1 */
-  void	 **freelists;          /* free list table, linked by offset 0 */
+  void   **freelists;          /* free list table, linked by offset 0 */
   int     *sizetable;         /* size of each freelist */
   int     *indextable;        /* size->index table */
   void    *curbuffer;         /* current buffer, linked by offset 0 */
   void    *freemem;           /*   free memory in curbuffer */
-  int 	   freesize;          /*   size of free memory in bytes */
-  void 	  *tempstack;         /* stack of temporary memory, managed by users */
-  FILE    *ferr;              /* file for reporting errors */
+  int      freesize;          /*   size of freemem in bytes */
+  setT    *tempstack;         /* stack of temporary memory, managed by users */
+  FILE    *ferr;              /* file for reporting errors, only user is qh_fprintf() */
   int      IStracing;         /* =5 if tracing memory allocations */
   int      cntquick;          /* count of quick allocations */
-                              /* remove statistics doesn't effect speed */
+                              /* Note: removing statistics doesn't effect speed */
   int      cntshort;          /* count of short allocations */
   int      cntlong;           /* count of long allocations */
-  int      curlong;           /* current count of inuse, long allocations */
-  int      freeshort;	      /* count of short memfrees */
-  int      freelong;	      /* count of long memfrees */
-  int      totshort;          /* total size of short allocations */
-  int      totlong;           /* total size of long allocations */
-  int      maxlong;           /* maximum totlong */
+  int      freeshort;         /* count of short memfrees */
+  int      freelong;          /* count of long memfrees */
+  int      totbuffer;         /* total short memory buffers minus buffer links */
+  int      totdropped;        /* total dropped memory at end of short memory buffers (e.g., freesize) */
+  int      totfree;           /* total size of free, short memory on freelists */
+  int      totlong;           /* total size of long memory in use */
+  int      maxlong;           /*   maximum totlong */
+  int      totshort;          /* total size of short memory in use */
+  int      totunused;         /* total unused short memory (estimated, short size - request size of first allocations) */
   int      cntlarger;         /* count of setlarger's */
   int      totlarger;         /* total copied by setlarger */
 };
@@ -117,44 +146,56 @@
 
 /*----------------------------------
-   
-  qh_memalloc_(size, object, type)  
-    returns object of size bytes 
-	assumes size<=qhmem.LASTsize and void **freelistp is a temp
+
+  qh_memalloc_(insize, object, type)
+    returns object of size bytes
+        assumes size<=qhmem.LASTsize and void **freelistp is a temp
 */
 
-#ifdef qh_NOmem
-#define qh_memalloc_(size, freelistp, object, type) {\
-  object= (type*)qh_memalloc (size); }
+#if defined qh_NOmem
+#define qh_memalloc_(insize, freelistp, object, type) {\
+  object= (type*)qh_memalloc(insize); }
+#elif defined qh_TRACEshort
+#define qh_memalloc_(insize, freelistp, object, type) {\
+    freelistp= NULL; /* Avoid warnings */ \
+    object= (type*)qh_memalloc(insize); }
 #else /* !qh_NOmem */
 
-#define qh_memalloc_(size, freelistp, object, type) {\
-  freelistp= qhmem.freelists + qhmem.indextable[size];\
+#define qh_memalloc_(insize, freelistp, object, type) {\
+  freelistp= qhmem.freelists + qhmem.indextable[insize];\
   if ((object= (type*)*freelistp)) {\
+    qhmem.totshort += qhmem.sizetable[qhmem.indextable[insize]]; \
+    qhmem.totfree -= qhmem.sizetable[qhmem.indextable[insize]]; \
     qhmem.cntquick++;  \
     *freelistp= *((void **)*freelistp);\
-  }else object= (type*)qh_memalloc (size);}
+  }else object= (type*)qh_memalloc(insize);}
 #endif
 
 /*----------------------------------
-   
-  qh_memfree_(object, size) 
+
+  qh_memfree_(object, insize)
     free up an object
 
   notes:
     object may be NULL
     assumes size<=qhmem.LASTsize and void **freelistp is a temp
 */
-#ifdef qh_NOmem
-#define qh_memfree_(object, size, freelistp) {\
-  qh_memfree (object, size); }
+#if defined qh_NOmem
+#define qh_memfree_(object, insize, freelistp) {\
+  qh_memfree(object, insize); }
+#elif defined qh_TRACEshort
+#define qh_memfree_(object, insize, freelistp) {\
+    freelistp= NULL; /* Avoid warnings */ \
+    qh_memfree(object, insize); }
 #else /* !qh_NOmem */
 
-#define qh_memfree_(object, size, freelistp) {\
+#define qh_memfree_(object, insize, freelistp) {\
   if (object) { \
     qhmem .freeshort++;\
-    freelistp= qhmem.freelists + qhmem.indextable[size];\
+    freelistp= qhmem.freelists + qhmem.indextable[insize];\
+    qhmem.totshort -= qhmem.sizetable[qhmem.indextable[insize]]; \
+    qhmem.totfree += qhmem.sizetable[qhmem.indextable[insize]]; \
     *((void **)object)= *freelistp;\
     *freelistp= object;}}
 #endif
@@ -162,13 +203,14 @@
 /*=============== prototypes in alphabetical order ============*/
 
 void *qh_memalloc(int insize);
-void qh_memfree (void *object, int size);
-void qh_memfreeshort (int *curlong, int *totlong);
-void qh_meminit (FILE *ferr);
-void qh_meminitbuffers (int tracelevel, int alignment, int numsizes,
-			int bufsize, int bufinit);
-void qh_memsetup (void);
+void qh_memfree(void *object, int insize);
+void qh_memfreeshort(int *curlong, int *totlong);
+void qh_meminit(FILE *ferr);
+void qh_meminitbuffers(int tracelevel, int alignment, int numsizes,
+                        int bufsize, int bufinit);
+void qh_memsetup(void);
 void qh_memsize(int size);
-void qh_memstatistics (FILE *fp);
+void qh_memstatistics(FILE *fp);
+void qh_memtotal(int *totlong, int *curlong, int *totshort, int *curshort, int *maxlong, int *totbuffer);
 
 #endif /* qhDEFmem */

Modified: trunk/scipy/spatial/qhull/src/merge.c
===================================================================
--- trunk/scipy/spatial/qhull/src/merge.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/merge.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,7 +1,7 @@
 /*
  ---------------------------------
 
-   merge.c 
+   merge.c
    merges non-convex facets
 
    see qh-merge.htm and merge.h
@@ -10,28 +10,30 @@
 
    the user may call qh_postmerge() to perform additional merges.
 
-   To remove deleted facets and vertices (qhull() in qhull.c):
-     qh_partitionvisible (!qh_ALL, &numoutside);  // visible_list, newfacet_list
-     qh_deletevisible ();         // qh.visible_list
-     qh_resetlists (False, qh_RESETvisible);       // qh.visible_list newvertex_list newfacet_list 
+   To remove deleted facets and vertices (qhull() in libqhull.c):
+     qh_partitionvisible(!qh_ALL, &numoutside);  // visible_list, newfacet_list
+     qh_deletevisible();         // qh.visible_list
+     qh_resetlists(False, qh_RESETvisible);       // qh.visible_list newvertex_list newfacet_list
 
    assumes qh.CENTERtype= centrum
 
    merges occur in qh_mergefacet and in qh_mergecycle
    vertex->neighbors not set until the first merge occurs
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 C.B. Barber.
+   $Id: //product/qhull/main/rel/src/merge.c#27 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #include "qhull_a.h"
 
 #ifndef qh_NOmerge
 
-/*===== functions (alphabetical after premerge and postmerge) ======*/
+/*===== functions(alphabetical after premerge and postmerge) ======*/
 
 /*---------------------------------
-  
+
   qh_premerge( apex, maxcentrum )
     pre-merge nonconvex facets in qh.newfacet_list for apex
     maxcentrum defines coplanar and concave (qh_test_appendmerge)
@@ -51,56 +53,56 @@
     collect coplanar and concave facets
     merge concave, coplanar, degenerate, and redundant facets
 */
-void qh_premerge (vertexT *apex, realT maxcentrum, realT maxangle) {
+void qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle) {
   boolT othermerge= False;
   facetT *newfacet;
-  
+
   if (qh ZEROcentrum && qh_checkzero(!qh_ALL))
-    return;    
-  trace2((qh ferr, "qh_premerge: premerge centrum %2.2g angle %2.2g for apex v%d facetlist f%d\n",
-	    maxcentrum, maxangle, apex->id, getid_(qh newfacet_list)));
+    return;
+  trace2((qh ferr, 2008, "qh_premerge: premerge centrum %2.2g angle %2.2g for apex v%d facetlist f%d\n",
+            maxcentrum, maxangle, apex->id, getid_(qh newfacet_list)));
   if (qh IStracing >= 4 && qh num_facets < 50)
     qh_printlists();
   qh centrum_radius= maxcentrum;
   qh cos_max= maxangle;
-  qh degen_mergeset= qh_settemp (qh TEMPsize);
-  qh facet_mergeset= qh_settemp (qh TEMPsize);
-  if (qh hull_dim >=3) { 
-    qh_mark_dupridges (qh newfacet_list); /* facet_mergeset */
-    qh_mergecycle_all (qh newfacet_list, &othermerge);
-    qh_forcedmerges (&othermerge /* qh facet_mergeset */); 
+  qh degen_mergeset= qh_settemp(qh TEMPsize);
+  qh facet_mergeset= qh_settemp(qh TEMPsize);
+  if (qh hull_dim >=3) {
+    qh_mark_dupridges(qh newfacet_list); /* facet_mergeset */
+    qh_mergecycle_all(qh newfacet_list, &othermerge);
+    qh_forcedmerges(&othermerge /* qh facet_mergeset */);
     FORALLnew_facets {  /* test samecycle merges */
       if (!newfacet->simplicial && !newfacet->mergeridge)
-	qh_degen_redundant_neighbors (newfacet, NULL);
+        qh_degen_redundant_neighbors(newfacet, NULL);
     }
     if (qh_merge_degenredundant())
       othermerge= True;
   }else /* qh hull_dim == 2 */
-    qh_mergecycle_all (qh newfacet_list, &othermerge);
-  qh_flippedmerges (qh newfacet_list, &othermerge);
+    qh_mergecycle_all(qh newfacet_list, &othermerge);
+  qh_flippedmerges(qh newfacet_list, &othermerge);
   if (!qh MERGEexact || zzval_(Ztotmerge)) {
     zinc_(Zpremergetot);
     qh POSTmerging= False;
-    qh_getmergeset_initial (qh newfacet_list);
-    qh_all_merges (othermerge, False);
+    qh_getmergeset_initial(qh newfacet_list);
+    qh_all_merges(othermerge, False);
   }
   qh_settempfree(&qh facet_mergeset);
   qh_settempfree(&qh degen_mergeset);
 } /* premerge */
-  
+
 /*---------------------------------
-  
+
   qh_postmerge( reason, maxcentrum, maxangle, vneighbors )
     post-merge nonconvex facets as defined by maxcentrum and maxangle
     'reason' is for reporting progress
-    if vneighbors, 
-      calls qh_test_vneighbors at end of qh_all_merge 
-    if firstmerge, 
+    if vneighbors,
+      calls qh_test_vneighbors at end of qh_all_merge
+    if firstmerge,
       calls qh_reducevertices before qh_getmergeset
 
   returns:
-    if first call (qh.visible_list != qh.facet_list), 
+    if first call (qh.visible_list != qh.facet_list),
       builds qh.facet_newlist, qh.newvertex_list
     deleted facets added to qh.visible_list with facet->visible
     qh.visible_list == qh.facet_list
@@ -119,32 +121,32 @@
         set vertex->delridge {will retest the ridge}
         if qh.MERGEexact
           call qh_reducevertices()
-      if no pre-merging 
+      if no pre-merging
         merge flipped facets
     determine non-convex facets
     merge all non-convex facets
 */
-void qh_postmerge (char *reason, realT maxcentrum, realT maxangle, 
+void qh_postmerge(const char *reason, realT maxcentrum, realT maxangle,
                       boolT vneighbors) {
   facetT *newfacet;
   boolT othermerges= False;
   vertexT *vertex;
 
   if (qh REPORTfreq || qh IStracing) {
-    qh_buildtracing (NULL, NULL);
-    qh_printsummary (qh ferr);
-    if (qh PRINTstatistics) 
-      qh_printallstatistics (qh ferr, "reason");
-    fprintf (qh ferr, "\n%s with 'C%.2g' and 'A%.2g'\n", 
+    qh_buildtracing(NULL, NULL);
+    qh_printsummary(qh ferr);
+    if (qh PRINTstatistics)
+      qh_printallstatistics(qh ferr, "reason");
+    qh_fprintf(qh ferr, 8062, "\n%s with 'C%.2g' and 'A%.2g'\n",
         reason, maxcentrum, maxangle);
   }
-  trace2((qh ferr, "qh_postmerge: postmerge.  test vneighbors? %d\n",
-	    vneighbors));
+  trace2((qh ferr, 2009, "qh_postmerge: postmerge.  test vneighbors? %d\n",
+            vneighbors));
   qh centrum_radius= maxcentrum;
   qh cos_max= maxangle;
   qh POSTmerging= True;
-  qh degen_mergeset= qh_settemp (qh TEMPsize);
-  qh facet_mergeset= qh_settemp (qh TEMPsize);
+  qh degen_mergeset= qh_settemp(qh TEMPsize);
+  qh facet_mergeset= qh_settemp(qh TEMPsize);
   if (qh visible_list != qh facet_list) {  /* first call */
     qh NEWfacets= True;
     qh visible_list= qh newfacet_list= qh facet_list;
@@ -159,41 +161,41 @@
       vertex->newlist= True;
     if (qh VERTEXneighbors) { /* a merge has occurred */
       FORALLvertices
-	vertex->delridge= True; /* test for redundant, needed? */
+        vertex->delridge= True; /* test for redundant, needed? */
       if (qh MERGEexact) {
-	if (qh hull_dim <= qh_DIMreduceBuild)
-	  qh_reducevertices(); /* was skipped during pre-merging */
+        if (qh hull_dim <= qh_DIMreduceBuild)
+          qh_reducevertices(); /* was skipped during pre-merging */
       }
     }
-    if (!qh PREmerge && !qh MERGEexact) 
-      qh_flippedmerges (qh newfacet_list, &othermerges);
+    if (!qh PREmerge && !qh MERGEexact)
+      qh_flippedmerges(qh newfacet_list, &othermerges);
   }
-  qh_getmergeset_initial (qh newfacet_list);
-  qh_all_merges (False, vneighbors);
+  qh_getmergeset_initial(qh newfacet_list);
+  qh_all_merges(False, vneighbors);
   qh_settempfree(&qh facet_mergeset);
   qh_settempfree(&qh degen_mergeset);
 } /* post_merge */
 
 /*---------------------------------
-  
+
   qh_all_merges( othermerge, vneighbors )
     merge all non-convex facets
-    
+
     set othermerge if already merged facets (for qh_reducevertices)
     if vneighbors
       tests vertex neighbors for convexity at end
     qh.facet_mergeset lists the non-convex ridges in qh_newfacet_list
     qh.degen_mergeset is defined
-    if qh.MERGEexact && !qh.POSTmerging, 
+    if qh.MERGEexact && !qh.POSTmerging,
       does not merge coplanar facets
 
   returns:
     deleted facets added to qh.visible_list with facet->visible
     deleted vertices added qh.delvertex_list with vertex->delvertex
-  
+
   notes:
-    unless !qh.MERGEindependent, 
+    unless !qh.MERGEindependent,
       merges facets in independent sets
     uses qh.newfacet_list as argument since merges call qh_removefacet()
 
@@ -210,7 +212,7 @@
     if vneighbors ??
       tests vertex neighbors for convexity at end
 */
-void qh_all_merges (boolT othermerge, boolT vneighbors) {
+void qh_all_merges(boolT othermerge, boolT vneighbors) {
   facetT *facet1, *facet2;
   mergeT *merge;
   boolT wasmerge= True, isreduce;
@@ -218,80 +220,80 @@
   vertexT *vertex;
   mergeType mergetype;
   int numcoplanar=0, numconcave=0, numdegenredun= 0, numnewmerges= 0;
-  
-  trace2((qh ferr, "qh_all_merges: starting to merge facets beginning from f%d\n",
-	    getid_(qh newfacet_list)));
+
+  trace2((qh ferr, 2010, "qh_all_merges: starting to merge facets beginning from f%d\n",
+            getid_(qh newfacet_list)));
   while (True) {
     wasmerge= False;
-    while (qh_setsize (qh facet_mergeset)) {
+    while (qh_setsize(qh facet_mergeset)) {
       while ((merge= (mergeT*)qh_setdellast(qh facet_mergeset))) {
-	facet1= merge->facet1;
-	facet2= merge->facet2;
-	mergetype= merge->type;
-	qh_memfree_(merge, sizeof(mergeT), freelistp);
-	if (facet1->visible || facet2->visible) /*deleted facet*/
-	  continue;  
-	if ((facet1->newfacet && !facet1->tested)
-	        || (facet2->newfacet && !facet2->tested)) {
-	  if (qh MERGEindependent && mergetype <= MRGanglecoplanar)
-	    continue;      /* perform independent sets of merges */
-	}
-	qh_merge_nonconvex (facet1, facet2, mergetype);
+        facet1= merge->facet1;
+        facet2= merge->facet2;
+        mergetype= merge->type;
+        qh_memfree_(merge, (int)sizeof(mergeT), freelistp);
+        if (facet1->visible || facet2->visible) /*deleted facet*/
+          continue;
+        if ((facet1->newfacet && !facet1->tested)
+                || (facet2->newfacet && !facet2->tested)) {
+          if (qh MERGEindependent && mergetype <= MRGanglecoplanar)
+            continue;      /* perform independent sets of merges */
+        }
+        qh_merge_nonconvex(facet1, facet2, mergetype);
         numdegenredun += qh_merge_degenredundant();
         numnewmerges++;
         wasmerge= True;
-	if (mergetype == MRGconcave)
-	  numconcave++;
-	else /* MRGcoplanar or MRGanglecoplanar */
-	  numcoplanar++;
+        if (mergetype == MRGconcave)
+          numconcave++;
+        else /* MRGcoplanar or MRGanglecoplanar */
+          numcoplanar++;
       } /* while setdellast */
-      if (qh POSTmerging && qh hull_dim <= qh_DIMreduceBuild 
+      if (qh POSTmerging && qh hull_dim <= qh_DIMreduceBuild
       && numnewmerges > qh_MAXnewmerges) {
-	numnewmerges= 0;
-	qh_reducevertices();  /* otherwise large post merges too slow */
+        numnewmerges= 0;
+        qh_reducevertices();  /* otherwise large post merges too slow */
       }
-      qh_getmergeset (qh newfacet_list); /* facet_mergeset */
+      qh_getmergeset(qh newfacet_list); /* facet_mergeset */
     } /* while mergeset */
     if (qh VERTEXneighbors) {
       isreduce= False;
       if (qh hull_dim >=4 && qh POSTmerging) {
-	FORALLvertices  
-	  vertex->delridge= True;
-	isreduce= True;
+        FORALLvertices
+          vertex->delridge= True;
+        isreduce= True;
       }
-      if ((wasmerge || othermerge) && (!qh MERGEexact || qh POSTmerging) 
-	  && qh hull_dim <= qh_DIMreduceBuild) {
-	othermerge= False;
-	isreduce= True;
+      if ((wasmerge || othermerge) && (!qh MERGEexact || qh POSTmerging)
+          && qh hull_dim <= qh_DIMreduceBuild) {
+        othermerge= False;
+        isreduce= True;
       }
       if (isreduce) {
-	if (qh_reducevertices()) {
-	  qh_getmergeset (qh newfacet_list); /* facet_mergeset */
-	  continue;
-	}
+        if (qh_reducevertices()) {
+          qh_getmergeset(qh newfacet_list); /* facet_mergeset */
+          continue;
+        }
       }
     }
-    if (vneighbors && qh_test_vneighbors(/* qh newfacet_list */)) 
+    if (vneighbors && qh_test_vneighbors(/* qh newfacet_list */))
       continue;
     break;
   } /* while (True) */
   if (qh CHECKfrequently && !qh MERGEexact) {
     qh old_randomdist= qh RANDOMdist;
     qh RANDOMdist= False;
-    qh_checkconvex (qh newfacet_list, qh_ALGORITHMfault);
-    /* qh_checkconnect (); [this is slow and it changes the facet order] */
+    qh_checkconvex(qh newfacet_list, qh_ALGORITHMfault);
+    /* qh_checkconnect(); [this is slow and it changes the facet order] */
     qh RANDOMdist= qh old_randomdist;
   }
-  trace1((qh ferr, "qh_all_merges: merged %d coplanar facets %d concave facets and %d degen or redundant facets.\n",
+  trace1((qh ferr, 1009, "qh_all_merges: merged %d coplanar facets %d concave facets and %d degen or redundant facets.\n",
     numcoplanar, numconcave, numdegenredun));
   if (qh IStracing >= 4 && qh num_facets < 50)
-    qh_printlists ();
+    qh_printlists();
 } /* all_merges */
 
 
 /*---------------------------------
-  
+
   qh_appendmergeset( facet, neighbor, mergetype, angle )
     appends an entry to qh.facet_mergeset or qh.degen_mergeset
 
@@ -300,7 +302,7 @@
   returns:
     merge appended to facet_mergeset or degen_mergeset
       sets ->degenerate or ->redundant if degen_mergeset
-  
+
   see:
     qh_test_appendmerge()
 
@@ -309,11 +311,11 @@
     if regular merge
       append to qh.facet_mergeset
     else if degenerate merge and qh.facet_mergeset is all degenerate
-      append to qh.degen_mergeset 
+      append to qh.degen_mergeset
     else if degenerate merge
-      prepend to qh.degen_mergeset 
+      prepend to qh.degen_mergeset
     else if redundant merge
-      append to qh.degen_mergeset 
+      append to qh.degen_mergeset
 */
 void qh_appendmergeset(facetT *facet, facetT *neighbor, mergeType mergetype, realT *angle) {
   mergeT *merge, *lastmerge;
@@ -323,52 +325,52 @@
     return;
   if (facet->degenerate && mergetype == MRGdegen)
     return;
-  qh_memalloc_(sizeof(mergeT), freelistp, merge, mergeT);
+  qh_memalloc_((int)sizeof(mergeT), freelistp, merge, mergeT);
   merge->facet1= facet;
   merge->facet2= neighbor;
   merge->type= mergetype;
   if (angle && qh ANGLEmerge)
     merge->angle= *angle;
   if (mergetype < MRGdegen)
-    qh_setappend (&(qh facet_mergeset), merge);
+    qh_setappend(&(qh facet_mergeset), merge);
   else if (mergetype == MRGdegen) {
     facet->degenerate= True;
-    if (!(lastmerge= (mergeT*)qh_setlast (qh degen_mergeset)) 
+    if (!(lastmerge= (mergeT*)qh_setlast(qh degen_mergeset))
     || lastmerge->type == MRGdegen)
-      qh_setappend (&(qh degen_mergeset), merge);
+      qh_setappend(&(qh degen_mergeset), merge);
     else
-      qh_setaddnth (&(qh degen_mergeset), 0, merge);
+      qh_setaddnth(&(qh degen_mergeset), 0, merge);
   }else if (mergetype == MRGredundant) {
     facet->redundant= True;
-    qh_setappend (&(qh degen_mergeset), merge);
+    qh_setappend(&(qh degen_mergeset), merge);
   }else /* mergetype == MRGmirror */ {
     if (facet->redundant || neighbor->redundant) {
-      fprintf(qh ferr, "qhull error (qh_appendmergeset): facet f%d or f%d is already a mirrored facet\n",
-	   facet->id, neighbor->id);
+      qh_fprintf(qh ferr, 6092, "qhull error (qh_appendmergeset): facet f%d or f%d is already a mirrored facet\n",
+           facet->id, neighbor->id);
       qh_errexit2 (qh_ERRqhull, facet, neighbor);
     }
-    if (!qh_setequal (facet->vertices, neighbor->vertices)) {
-      fprintf(qh ferr, "qhull error (qh_appendmergeset): mirrored facets f%d and f%d do not have the same vertices\n",
-	   facet->id, neighbor->id);
+    if (!qh_setequal(facet->vertices, neighbor->vertices)) {
+      qh_fprintf(qh ferr, 6093, "qhull error (qh_appendmergeset): mirrored facets f%d and f%d do not have the same vertices\n",
+           facet->id, neighbor->id);
       qh_errexit2 (qh_ERRqhull, facet, neighbor);
     }
     facet->redundant= True;
     neighbor->redundant= True;
-    qh_setappend (&(qh degen_mergeset), merge);
+    qh_setappend(&(qh degen_mergeset), merge);
   }
 } /* appendmergeset */
 
 
 /*---------------------------------
-  
+
   qh_basevertices( samecycle )
     return temporary set of base vertices for samecycle
     samecycle is first facet in the cycle
     assumes apex is SETfirst_( samecycle->vertices )
 
   returns:
-    vertices (settemp)
+    vertices(settemp)
     all ->seen are cleared
 
   notes:
@@ -377,13 +379,13 @@
   design:
     for each facet in samecycle
       for each unseen vertex in facet->vertices
-        append to result  
+        append to result
 */
-setT *qh_basevertices (facetT *samecycle) {
+setT *qh_basevertices(facetT *samecycle) {
   facetT *same;
   vertexT *apex, *vertex, **vertexp;
-  setT *vertices= qh_settemp (qh TEMPsize);
-  
+  setT *vertices= qh_settemp(qh TEMPsize);
+
   apex= SETfirstt_(samecycle->vertices, vertexT);
   apex->visitid= ++qh vertex_visit;
   FORALLsame_cycle_(samecycle) {
@@ -391,24 +393,24 @@
       continue;
     FOREACHvertex_(same->vertices) {
       if (vertex->visitid != qh vertex_visit) {
-        qh_setappend (&vertices, vertex);
+        qh_setappend(&vertices, vertex);
         vertex->visitid= qh vertex_visit;
         vertex->seen= False;
       }
     }
   }
-  trace4((qh ferr, "qh_basevertices: found %d vertices\n", 
-         qh_setsize (vertices)));
+  trace4((qh ferr, 4019, "qh_basevertices: found %d vertices\n",
+         qh_setsize(vertices)));
   return vertices;
 } /* basevertices */
 
 /*---------------------------------
-  
+
   qh_checkconnect()
     check that new facets are connected
     new facets are on qh.newfacet_list
-    
+
   notes:
     this is slow and it changes the order of the facets
     uses qh.visit_id
@@ -420,18 +422,18 @@
     for all new facets
       report error if unvisited
 */
-void qh_checkconnect (void /* qh newfacet_list */) {
+void qh_checkconnect(void /* qh newfacet_list */) {
   facetT *facet, *newfacet, *errfacet= NULL, *neighbor, **neighborp;
 
   facet= qh newfacet_list;
-  qh_removefacet (facet);
-  qh_appendfacet (facet);
+  qh_removefacet(facet);
+  qh_appendfacet(facet);
   facet->visitid= ++qh visit_id;
   FORALLfacet_(facet) {
     FOREACHneighbor_(facet) {
       if (neighbor->visitid != qh visit_id) {
-        qh_removefacet (neighbor);
-        qh_appendfacet (neighbor);
+        qh_removefacet(neighbor);
+        qh_appendfacet(neighbor);
         neighbor->visitid= qh visit_id;
       }
     }
@@ -439,26 +441,26 @@
   FORALLnew_facets {
     if (newfacet->visitid == qh visit_id)
       break;
-    fprintf(qh ferr, "qhull error: f%d is not attached to the new facets\n",
+    qh_fprintf(qh ferr, 6094, "qhull error: f%d is not attached to the new facets\n",
          newfacet->id);
     errfacet= newfacet;
   }
   if (errfacet)
-    qh_errexit (qh_ERRqhull, errfacet, NULL);
+    qh_errexit(qh_ERRqhull, errfacet, NULL);
 } /* checkconnect */
 
 /*---------------------------------
-  
+
   qh_checkzero( testall )
     check that facets are clearly convex for qh.DISTround with qh.MERGEexact
 
-    if testall, 
+    if testall,
       test all facets for qh.MERGEexact post-merging
-    else 
+    else
       test qh.newfacet_list
-      
-    if qh.MERGEexact, 
+
+    if qh.MERGEexact,
       allows coplanar ridges
       skips convexity test while qh.ZEROall_ok
 
@@ -466,7 +468,7 @@
     True if all facets !flipped, !dupridge, normal
          if all horizon facets are simplicial
          if all vertices are clearly below neighbor
-         if all opposite vertices of horizon are below 
+         if all opposite vertices of horizon are below
     clears qh.ZEROall_ok if any problems or coplanar facets
 
   notes:
@@ -483,14 +485,14 @@
       if qh.newfacet_list
         test the other vertices in the facet's horizon facet
 */
-boolT qh_checkzero (boolT testall) {
+boolT qh_checkzero(boolT testall) {
   facetT *facet, *neighbor, **neighborp;
   facetT *horizon, *facetlist;
   int neighbor_i;
   vertexT *vertex, **vertexp;
   realT dist;
 
-  if (testall) 
+  if (testall)
     facetlist= qh facet_list;
   else {
     facetlist= qh newfacet_list;
@@ -502,7 +504,7 @@
         goto LABELproblem;
     }
     if (qh MERGEexact && qh ZEROall_ok) {
-      trace2((qh ferr, "qh_checkzero: skip convexity check until first pre-merge\n"));
+      trace2((qh ferr, 2011, "qh_checkzero: skip convexity check until first pre-merge\n"));
       return True;
     }
   }
@@ -513,13 +515,13 @@
     FOREACHneighbor_(facet) {
       if (!neighbor_i && !testall) {
         horizon= neighbor;
-	neighbor_i++;
+        neighbor_i++;
         continue; /* horizon facet tested in qh_findhorizon */
       }
       vertex= SETelemt_(facet->vertices, neighbor_i++, vertexT);
       vertex->visitid= qh vertex_visit;
       zzinc_(Zdistzero);
-      qh_distplane (vertex->point, neighbor, &dist);
+      qh_distplane(vertex->point, neighbor, &dist);
       if (dist >= -qh DISTround) {
         qh ZEROall_ok= False;
         if (!qh MERGEexact || testall || dist > qh DISTround)
@@ -528,75 +530,75 @@
     }
     if (!testall) {
       FOREACHvertex_(horizon->vertices) {
-	if (vertex->visitid != qh vertex_visit) {
-	  zzinc_(Zdistzero);
-	  qh_distplane (vertex->point, facet, &dist);
-	  if (dist >= -qh DISTround) {
-	    qh ZEROall_ok= False;
-	    if (!qh MERGEexact || dist > qh DISTround)
-	      goto LABELnonconvex;
-	  }
-	  break;
-	}
+        if (vertex->visitid != qh vertex_visit) {
+          zzinc_(Zdistzero);
+          qh_distplane(vertex->point, facet, &dist);
+          if (dist >= -qh DISTround) {
+            qh ZEROall_ok= False;
+            if (!qh MERGEexact || dist > qh DISTround)
+              goto LABELnonconvex;
+          }
+          break;
+        }
       }
     }
   }
-  trace2((qh ferr, "qh_checkzero: testall %d, facets are %s\n", testall,
-        (qh MERGEexact && !testall) ? 
+  trace2((qh ferr, 2012, "qh_checkzero: testall %d, facets are %s\n", testall,
+        (qh MERGEexact && !testall) ?
            "not concave, flipped, or duplicate ridged" : "clearly convex"));
   return True;
 
  LABELproblem:
   qh ZEROall_ok= False;
-  trace2((qh ferr, "qh_checkzero: facet f%d needs pre-merging\n",
+  trace2((qh ferr, 2013, "qh_checkzero: facet f%d needs pre-merging\n",
        facet->id));
   return False;
 
  LABELnonconvex:
-  trace2((qh ferr, "qh_checkzero: facet f%d and f%d are not clearly convex.  v%d dist %.2g\n",
+  trace2((qh ferr, 2014, "qh_checkzero: facet f%d and f%d are not clearly convex.  v%d dist %.2g\n",
          facet->id, neighbor->id, vertex->id, dist));
   return False;
 } /* checkzero */
 
 /*---------------------------------
-  
+
   qh_compareangle( angle1, angle2 )
     used by qsort() to order merges by angle
 */
 int qh_compareangle(const void *p1, const void *p2) {
-  mergeT *a= *((mergeT **)p1), *b= *((mergeT **)p2);
- 
-  return ((a->angle > b->angle) ? 1 : -1);
+  const mergeT *a= *((mergeT *const*)p1), *b= *((mergeT *const*)p2);
+
+  return((a->angle > b->angle) ? 1 : -1);
 } /* compareangle */
 
 /*---------------------------------
-  
+
   qh_comparemerge( merge1, merge2 )
     used by qsort() to order merges
 */
 int qh_comparemerge(const void *p1, const void *p2) {
-  mergeT *a= *((mergeT **)p1), *b= *((mergeT **)p2);
- 
-  return (a->type - b->type);
+  const mergeT *a= *((mergeT *const*)p1), *b= *((mergeT *const*)p2);
+
+  return(a->type - b->type);
 } /* comparemerge */
 
 /*---------------------------------
-  
+
   qh_comparevisit( vertex1, vertex2 )
     used by qsort() to order vertices by their visitid
 */
-int qh_comparevisit (const void *p1, const void *p2) {
-  vertexT *a= *((vertexT **)p1), *b= *((vertexT **)p2);
- 
-  return (a->visitid - b->visitid);
+int qh_comparevisit(const void *p1, const void *p2) {
+  const vertexT *a= *((vertexT *const*)p1), *b= *((vertexT *const*)p2);
+
+  return(a->visitid - b->visitid);
 } /* comparevisit */
 
 /*---------------------------------
-  
+
   qh_copynonconvex( atridge )
     set non-convex flag on other ridges (if any) between same neighbors
 
@@ -608,7 +610,7 @@
       if ridge shares the same neighbor
         set nonconvex flag
 */
-void qh_copynonconvex (ridgeT *atridge) {
+void qh_copynonconvex(ridgeT *atridge) {
   facetT *facet, *otherfacet;
   ridgeT *ridge, **ridgep;
 
@@ -617,8 +619,8 @@
   FOREACHridge_(facet->ridges) {
     if (otherfacet == otherfacet_(ridge, facet) && ridge != atridge) {
       ridge->nonconvex= True;
-      trace4((qh ferr, "qh_copynonconvex: moved nonconvex flag from r%d to r%d\n",
-	      atridge->id, ridge->id));
+      trace4((qh ferr, 4020, "qh_copynonconvex: moved nonconvex flag from r%d to r%d\n",
+              atridge->id, ridge->id));
       break;
     }
   }
@@ -626,7 +628,7 @@
 
 /*---------------------------------
-  
+
   qh_degen_redundant_facet( facet )
     check facet for degen. or redundancy
 
@@ -642,39 +644,39 @@
     test for redundant neighbor
     test for degenerate facet
 */
-void qh_degen_redundant_facet (facetT *facet) {
+void qh_degen_redundant_facet(facetT *facet) {
   vertexT *vertex, **vertexp;
   facetT *neighbor, **neighborp;
 
-  trace4((qh ferr, "qh_degen_redundant_facet: test facet f%d for degen/redundant\n",
-	  facet->id));
+  trace4((qh ferr, 4021, "qh_degen_redundant_facet: test facet f%d for degen/redundant\n",
+          facet->id));
   FOREACHneighbor_(facet) {
     qh vertex_visit++;
     FOREACHvertex_(neighbor->vertices)
       vertex->visitid= qh vertex_visit;
     FOREACHvertex_(facet->vertices) {
       if (vertex->visitid != qh vertex_visit)
-	break;
+        break;
     }
     if (!vertex) {
-      qh_appendmergeset (facet, neighbor, MRGredundant, NULL);
-      trace2((qh ferr, "qh_degen_redundant_facet: f%d is contained in f%d.  merge\n", facet->id, neighbor->id)); 
+      qh_appendmergeset(facet, neighbor, MRGredundant, NULL);
+      trace2((qh ferr, 2015, "qh_degen_redundant_facet: f%d is contained in f%d.  merge\n", facet->id, neighbor->id));
       return;
     }
   }
-  if (qh_setsize (facet->neighbors) < qh hull_dim) {
-    qh_appendmergeset (facet, facet, MRGdegen, NULL);
-    trace2((qh ferr, "qh_degen_redundant_neighbors: f%d is degenerate.\n", facet->id));
+  if (qh_setsize(facet->neighbors) < qh hull_dim) {
+    qh_appendmergeset(facet, facet, MRGdegen, NULL);
+    trace2((qh ferr, 2016, "qh_degen_redundant_neighbors: f%d is degenerate.\n", facet->id));
   }
 } /* degen_redundant_facet */
 
 
 /*---------------------------------
-  
+
   qh_degen_redundant_neighbors( facet, delfacet,  )
     append degenerate and redundant neighbors to facet_mergeset
-    if delfacet, 
+    if delfacet,
       only checks neighbors of both delfacet and facet
     also checks current facet for degeneracy
 
@@ -689,7 +691,7 @@
     a redundant facet's vertices is a subset of its neighbor's vertices
     tests for redundant merges first (appendmergeset is nop for others)
     in a merge, only needs to test neighbors of merged facet
-  
+
   see:
     qh_merge_degenredundant() and qh_degen_redundant_facet()
 
@@ -698,16 +700,16 @@
     test for redundant neighbor
     test for degenerate neighbor
 */
-void qh_degen_redundant_neighbors (facetT *facet, facetT *delfacet) {
+void qh_degen_redundant_neighbors(facetT *facet, facetT *delfacet) {
   vertexT *vertex, **vertexp;
   facetT *neighbor, **neighborp;
   int size;
 
-  trace4((qh ferr, "qh_degen_redundant_neighbors: test neighbors of f%d with delfacet f%d\n", 
-	  facet->id, getid_(delfacet)));
-  if ((size= qh_setsize (facet->neighbors)) < qh hull_dim) {
-    qh_appendmergeset (facet, facet, MRGdegen, NULL);
-    trace2((qh ferr, "qh_degen_redundant_neighbors: f%d is degenerate with %d neighbors.\n", facet->id, size));
+  trace4((qh ferr, 4022, "qh_degen_redundant_neighbors: test neighbors of f%d with delfacet f%d\n",
+          facet->id, getid_(delfacet)));
+  if ((size= qh_setsize(facet->neighbors)) < qh hull_dim) {
+    qh_appendmergeset(facet, facet, MRGdegen, NULL);
+    trace2((qh ferr, 2017, "qh_degen_redundant_neighbors: f%d is degenerate with %d neighbors.\n", facet->id, size));
   }
   if (!delfacet)
     delfacet= facet;
@@ -723,16 +725,16 @@
         break;
     }
     if (!vertex) {
-      qh_appendmergeset (neighbor, facet, MRGredundant, NULL);
-      trace2((qh ferr, "qh_degen_redundant_neighbors: f%d is contained in f%d.  merge\n", neighbor->id, facet->id)); 
+      qh_appendmergeset(neighbor, facet, MRGredundant, NULL);
+      trace2((qh ferr, 2018, "qh_degen_redundant_neighbors: f%d is contained in f%d.  merge\n", neighbor->id, facet->id));
     }
   }
   FOREACHneighbor_(delfacet) {   /* redundant merges occur first */
     if (neighbor == facet)
       continue;
-    if ((size= qh_setsize (neighbor->neighbors)) < qh hull_dim) {
-      qh_appendmergeset (neighbor, neighbor, MRGdegen, NULL);
-      trace2((qh ferr, "qh_degen_redundant_neighbors: f%d is degenerate with %d neighbors.  Neighbor of f%d.\n", neighbor->id, size, facet->id)); 
+    if ((size= qh_setsize(neighbor->neighbors)) < qh hull_dim) {
+      qh_appendmergeset(neighbor, neighbor, MRGdegen, NULL);
+      trace2((qh ferr, 2019, "qh_degen_redundant_neighbors: f%d is degenerate with %d neighbors.  Neighbor of f%d.\n", neighbor->id, size, facet->id));
     }
   }
 } /* degen_redundant_neighbors */
@@ -740,7 +742,7 @@
 
 /*---------------------------------
-  
+
   qh_find_newvertex( oldvertex, vertices, ridges )
     locate new vertex for renaming old vertex
     vertices is a set of possible new vertices
@@ -750,7 +752,7 @@
     newvertex or NULL
       each ridge includes both vertex and oldvertex
     vertices sorted by number of deleted ridges
-      
+
   notes:
     modifies vertex->visitid
     new vertex is in one of the ridges
@@ -761,14 +763,14 @@
   design:
     for each vertex in vertices
       set vertex->visitid to number of references in ridges
-    remove unvisited vertices 
+    remove unvisited vertices
     set qh.vertex_visit above all possible values
     sort vertices by number of references in ridges
     add each ridge to qh.hash_table
     for each vertex in vertices
       look for a vertex that would not cause a duplicate ridge after a rename
 */
-vertexT *qh_find_newvertex (vertexT *oldvertex, setT *vertices, setT *ridges) {
+vertexT *qh_find_newvertex(vertexT *oldvertex, setT *vertices, setT *ridges) {
   vertexT *vertex, **vertexp;
   setT *newridges;
   ridgeT *ridge, **ridgep;
@@ -777,85 +779,85 @@
 
 #ifndef qh_NOtrace
   if (qh IStracing >= 4) {
-    fprintf (qh ferr, "qh_find_newvertex: find new vertex for v%d from ",
-	     oldvertex->id);
-    FOREACHvertex_(vertices) 
-      fprintf (qh ferr, "v%d ", vertex->id);
+    qh_fprintf(qh ferr, 8063, "qh_find_newvertex: find new vertex for v%d from ",
+             oldvertex->id);
+    FOREACHvertex_(vertices)
+      qh_fprintf(qh ferr, 8064, "v%d ", vertex->id);
     FOREACHridge_(ridges)
-      fprintf (qh ferr, "r%d ", ridge->id);
-    fprintf (qh ferr, "\n");
+      qh_fprintf(qh ferr, 8065, "r%d ", ridge->id);
+    qh_fprintf(qh ferr, 8066, "\n");
   }
 #endif
-  FOREACHvertex_(vertices) 
+  FOREACHvertex_(vertices)
     vertex->visitid= 0;
   FOREACHridge_(ridges) {
-    FOREACHvertex_(ridge->vertices) 
+    FOREACHvertex_(ridge->vertices)
       vertex->visitid++;
   }
   FOREACHvertex_(vertices) {
     if (!vertex->visitid) {
-      qh_setdelnth (vertices, SETindex_(vertices,vertex));
+      qh_setdelnth(vertices, SETindex_(vertices,vertex));
       vertexp--; /* repeat since deleted this vertex */
     }
   }
-  qh vertex_visit += qh_setsize (ridges);
-  if (!qh_setsize (vertices)) {
-    trace4((qh ferr, "qh_find_newvertex: vertices not in ridges for v%d\n",
-	    oldvertex->id));
+  qh vertex_visit += (unsigned int)qh_setsize(ridges);
+  if (!qh_setsize(vertices)) {
+    trace4((qh ferr, 4023, "qh_find_newvertex: vertices not in ridges for v%d\n",
+            oldvertex->id));
     return NULL;
   }
-  qsort (SETaddr_(vertices, vertexT), qh_setsize (vertices),
-	        sizeof (vertexT *), qh_comparevisit);
+  qsort(SETaddr_(vertices, vertexT), (size_t)qh_setsize(vertices),
+                sizeof(vertexT *), qh_comparevisit);
   /* can now use qh vertex_visit */
   if (qh PRINTstatistics) {
-    size= qh_setsize (vertices);
+    size= qh_setsize(vertices);
     zinc_(Zintersect);
     zadd_(Zintersecttot, size);
     zmax_(Zintersectmax, size);
   }
-  hashsize= qh_newhashtable (qh_setsize (ridges));
+  hashsize= qh_newhashtable(qh_setsize(ridges));
   FOREACHridge_(ridges)
-    qh_hashridge (qh hash_table, hashsize, ridge, oldvertex);
+    qh_hashridge(qh hash_table, hashsize, ridge, oldvertex);
   FOREACHvertex_(vertices) {
-    newridges= qh_vertexridges (vertex);
+    newridges= qh_vertexridges(vertex);
     FOREACHridge_(newridges) {
-      if (qh_hashridge_find (qh hash_table, hashsize, ridge, vertex, oldvertex, &hash)) {
-	zinc_(Zdupridge);
-	break;
+      if (qh_hashridge_find(qh hash_table, hashsize, ridge, vertex, oldvertex, &hash)) {
+        zinc_(Zdupridge);
+        break;
       }
     }
-    qh_settempfree (&newridges);
+    qh_settempfree(&newridges);
     if (!ridge)
       break;  /* found a rename */
   }
   if (vertex) {
     /* counted in qh_renamevertex */
-    trace2((qh ferr, "qh_find_newvertex: found v%d for old v%d from %d vertices and %d ridges.\n",
-      vertex->id, oldvertex->id, qh_setsize (vertices), qh_setsize (ridges)));
+    trace2((qh ferr, 2020, "qh_find_newvertex: found v%d for old v%d from %d vertices and %d ridges.\n",
+      vertex->id, oldvertex->id, qh_setsize(vertices), qh_setsize(ridges)));
   }else {
     zinc_(Zfindfail);
-    trace0((qh ferr, "qh_find_newvertex: no vertex for renaming v%d (all duplicated ridges) during p%d\n",
+    trace0((qh ferr, 14, "qh_find_newvertex: no vertex for renaming v%d(all duplicated ridges) during p%d\n",
       oldvertex->id, qh furthest_id));
   }
-  qh_setfree (&qh hash_table);
+  qh_setfree(&qh hash_table);
   return vertex;
 } /* find_newvertex */
 
 /*---------------------------------
-  
+
   qh_findbest_test( testcentrum, facet, neighbor, bestfacet, dist, mindist, maxdist )
     test neighbor of facet for qh_findbestneighbor()
     if testcentrum,
       tests centrum (assumes it is defined)
-    else 
+    else
       tests vertices
 
   returns:
     if a better facet (i.e., vertices/centrum of facet closer to neighbor)
       updates bestfacet, dist, mindist, and maxdist
 */
-void qh_findbest_test (boolT testcentrum, facetT *facet, facetT *neighbor,
+void qh_findbest_test(boolT testcentrum, facetT *facet, facetT *neighbor,
       facetT **bestfacet, realT *distp, realT *mindistp, realT *maxdistp) {
   realT dist, mindist, maxdist;
 
@@ -867,10 +869,12 @@
       maxdist= 0;
       mindist= dist;
       dist= -dist;
-    }else
+    }else {
+      mindist= 0;
       maxdist= dist;
+    }
   }else
-    dist= qh_getdistance (facet, neighbor, &mindist, &maxdist);
+    dist= qh_getdistance(facet, neighbor, &mindist, &maxdist);
   if (dist < *distp) {
     *bestfacet= neighbor;
     *mindistp= mindist;
@@ -881,13 +885,13 @@
 
 /*---------------------------------
-  
+
   qh_findbestneighbor( facet, dist, mindist, maxdist )
     finds best neighbor (least dist) of a facet for merging
 
   returns:
     returns min and max distances and their max absolute value
-  
+
   notes:
     avoids merging old into new
     assumes ridge->nonconvex only set on one ridge between a pair of facets
@@ -909,38 +913,38 @@
   facetT *neighbor, **neighborp, *bestfacet= NULL;
   ridgeT *ridge, **ridgep;
   boolT nonconvex= True, testcentrum= False;
-  int size= qh_setsize (facet->vertices);
+  int size= qh_setsize(facet->vertices);
 
   *distp= REALmax;
   if (size > qh_BESTcentrum2 * qh hull_dim + qh_BESTcentrum) {
     testcentrum= True;
     zinc_(Zbestcentrum);
     if (!facet->center)
-       facet->center= qh_getcentrum (facet);
+       facet->center= qh_getcentrum(facet);
   }
   if (size > qh hull_dim + qh_BESTnonconvex) {
     FOREACHridge_(facet->ridges) {
       if (ridge->nonconvex) {
         neighbor= otherfacet_(ridge, facet);
-	qh_findbest_test (testcentrum, facet, neighbor,
-			  &bestfacet, distp, mindistp, maxdistp);
+        qh_findbest_test(testcentrum, facet, neighbor,
+                          &bestfacet, distp, mindistp, maxdistp);
       }
     }
   }
-  if (!bestfacet) {     
+  if (!bestfacet) {
     nonconvex= False;
     FOREACHneighbor_(facet)
-      qh_findbest_test (testcentrum, facet, neighbor,
-			&bestfacet, distp, mindistp, maxdistp);
+      qh_findbest_test(testcentrum, facet, neighbor,
+                        &bestfacet, distp, mindistp, maxdistp);
   }
   if (!bestfacet) {
-    fprintf (qh ferr, "qhull internal error (qh_findbestneighbor): no neighbors for f%d\n", facet->id);
-    
-    qh_errexit (qh_ERRqhull, facet, NULL);
+    qh_fprintf(qh ferr, 6095, "qhull internal error (qh_findbestneighbor): no neighbors for f%d\n", facet->id);
+
+    qh_errexit(qh_ERRqhull, facet, NULL);
   }
-  if (testcentrum) 
-    qh_getdistance (facet, bestfacet, mindistp, maxdistp);
-  trace3((qh ferr, "qh_findbestneighbor: f%d is best neighbor for f%d testcentrum? %d nonconvex? %d dist %2.2g min %2.2g max %2.2g\n",
+  if (testcentrum)
+    qh_getdistance(facet, bestfacet, mindistp, maxdistp);
+  trace3((qh ferr, 3002, "qh_findbestneighbor: f%d is best neighbor for f%d testcentrum? %d nonconvex? %d dist %2.2g min %2.2g max %2.2g\n",
      bestfacet->id, facet->id, testcentrum, nonconvex, *distp, *mindistp, *maxdistp));
   return(bestfacet);
 } /* findbestneighbor */
@@ -948,7 +952,7 @@
 
 /*---------------------------------
-  
+
   qh_flippedmerges( facetlist, wasmerge )
     merge flipped facets into best neighbor
     assumes qh.facet_mergeset at top of temporary stack
@@ -977,24 +981,24 @@
   setT *othermerges;
   int nummerge=0;
 
-  trace4((qh ferr, "qh_flippedmerges: begin\n"));
+  trace4((qh ferr, 4024, "qh_flippedmerges: begin\n"));
   FORALLfacet_(facetlist) {
-    if (facet->flipped && !facet->visible) 
-      qh_appendmergeset (facet, facet, MRGflip, NULL);
+    if (facet->flipped && !facet->visible)
+      qh_appendmergeset(facet, facet, MRGflip, NULL);
   }
   othermerges= qh_settemppop(); /* was facet_mergeset */
-  qh facet_mergeset= qh_settemp (qh TEMPsize);
-  qh_settemppush (othermerges);
+  qh facet_mergeset= qh_settemp(qh TEMPsize);
+  qh_settemppush(othermerges);
   FOREACHmerge_(othermerges) {
     facet1= merge->facet1;
-    if (merge->type != MRGflip || facet1->visible) 
+    if (merge->type != MRGflip || facet1->visible)
       continue;
     if (qh TRACEmerge-1 == zzval_(Ztotmerge))
       qhmem.IStracing= qh IStracing= qh TRACElevel;
-    neighbor= qh_findbestneighbor (facet1, &dist, &mindist, &maxdist);
-    trace0((qh ferr, "qh_flippedmerges: merge flipped f%d into f%d dist %2.2g during p%d\n",
+    neighbor= qh_findbestneighbor(facet1, &dist, &mindist, &maxdist);
+    trace0((qh ferr, 15, "qh_flippedmerges: merge flipped f%d into f%d dist %2.2g during p%d\n",
       facet1->id, neighbor->id, dist, qh furthest_id));
-    qh_mergefacet (facet1, neighbor, &mindist, &maxdist, !qh_MERGEapex);
+    qh_mergefacet(facet1, neighbor, &mindist, &maxdist, !qh_MERGEapex);
     nummerge++;
     if (qh PRINTstatistics) {
       zinc_(Zflipped);
@@ -1005,30 +1009,30 @@
   }
   FOREACHmerge_(othermerges) {
     if (merge->facet1->visible || merge->facet2->visible)
-      qh_memfree (merge, sizeof(mergeT));
+      qh_memfree(merge, (int)sizeof(mergeT));
     else
-      qh_setappend (&qh facet_mergeset, merge);
+      qh_setappend(&qh facet_mergeset, merge);
   }
-  qh_settempfree (&othermerges);
+  qh_settempfree(&othermerges);
   if (nummerge)
     *wasmerge= True;
-  trace1((qh ferr, "qh_flippedmerges: merged %d flipped facets into a good neighbor\n", nummerge));
+  trace1((qh ferr, 1010, "qh_flippedmerges: merged %d flipped facets into a good neighbor\n", nummerge));
 } /* flippedmerges */
 
 
 /*---------------------------------
-  
+
   qh_forcedmerges( wasmerge )
     merge duplicated ridges
 
   returns:
     removes all duplicate ridges on facet_mergeset
     wasmerge set if merge
-    qh.facet_mergeset may include non-forced merges (none for now)
+    qh.facet_mergeset may include non-forced merges(none for now)
     qh.degen_mergeset includes degen/redun merges
 
-  notes: 
+  notes:
     duplicate ridges occur when the horizon is pinched,
         i.e. a subridge occurs in more than two horizon ridges.
      could rename vertices that pinch the horizon
@@ -1052,36 +1056,36 @@
 
   if (qh TRACEmerge-1 == zzval_(Ztotmerge))
     qhmem.IStracing= qh IStracing= qh TRACElevel;
-  trace4((qh ferr, "qh_forcedmerges: begin\n"));  
+  trace4((qh ferr, 4025, "qh_forcedmerges: begin\n"));
   othermerges= qh_settemppop(); /* was facet_mergeset */
-  qh facet_mergeset= qh_settemp (qh TEMPsize);
-  qh_settemppush (othermerges);
+  qh facet_mergeset= qh_settemp(qh TEMPsize);
+  qh_settemppush(othermerges);
   FOREACHmerge_(othermerges) {
-    if (merge->type != MRGridge) 
-    	continue;
+    if (merge->type != MRGridge)
+        continue;
     facet1= merge->facet1;
     facet2= merge->facet2;
-    while (facet1->visible)    	 /* must exist, no qh_merge_degenredunant */
+    while (facet1->visible)      /* must exist, no qh_merge_degenredunant */
       facet1= facet1->f.replace; /* previously merged facet */
     while (facet2->visible)
       facet2= facet2->f.replace; /* previously merged facet */
     if (facet1 == facet2)
       continue;
-    if (!qh_setin (facet2->neighbors, facet1)) {
-      fprintf (qh ferr, "qhull internal error (qh_forcedmerges): f%d and f%d had a duplicate ridge but as f%d and f%d they are no longer neighbors\n",
-	       merge->facet1->id, merge->facet2->id, facet1->id, facet2->id);
+    if (!qh_setin(facet2->neighbors, facet1)) {
+      qh_fprintf(qh ferr, 6096, "qhull internal error (qh_forcedmerges): f%d and f%d had a duplicate ridge but as f%d and f%d they are no longer neighbors\n",
+               merge->facet1->id, merge->facet2->id, facet1->id, facet2->id);
       qh_errexit2 (qh_ERRqhull, facet1, facet2);
     }
     if (qh TRACEmerge-1 == zzval_(Ztotmerge))
       qhmem.IStracing= qh IStracing= qh TRACElevel;
-    dist1= qh_getdistance (facet1, facet2, &mindist1, &maxdist1);
-    dist2= qh_getdistance (facet2, facet1, &mindist2, &maxdist2);
-    trace0((qh ferr, "qh_forcedmerges: duplicate ridge between f%d and f%d, dist %2.2g and reverse dist %2.2g during p%d\n",
-	    facet1->id, facet2->id, dist1, dist2, qh furthest_id));
-    if (dist1 < dist2) 
-      qh_mergefacet (facet1, facet2, &mindist1, &maxdist1, !qh_MERGEapex);
+    dist1= qh_getdistance(facet1, facet2, &mindist1, &maxdist1);
+    dist2= qh_getdistance(facet2, facet1, &mindist2, &maxdist2);
+    trace0((qh ferr, 16, "qh_forcedmerges: duplicate ridge between f%d and f%d, dist %2.2g and reverse dist %2.2g during p%d\n",
+            facet1->id, facet2->id, dist1, dist2, qh furthest_id));
+    if (dist1 < dist2)
+      qh_mergefacet(facet1, facet2, &mindist1, &maxdist1, !qh_MERGEapex);
     else {
-      qh_mergefacet (facet2, facet1, &mindist2, &maxdist2, !qh_MERGEapex);
+      qh_mergefacet(facet2, facet1, &mindist2, &maxdist2, !qh_MERGEapex);
       dist1= dist2;
       facet1= facet2;
     }
@@ -1098,21 +1102,21 @@
   }
   FOREACHmerge_(othermerges) {
     if (merge->type == MRGridge)
-      qh_memfree (merge, sizeof(mergeT));
+      qh_memfree(merge, (int)sizeof(mergeT));
     else
-      qh_setappend (&qh facet_mergeset, merge);
+      qh_setappend(&qh facet_mergeset, merge);
   }
-  qh_settempfree (&othermerges);
+  qh_settempfree(&othermerges);
   if (nummerge)
     *wasmerge= True;
-  trace1((qh ferr, "qh_forcedmerges: merged %d facets and %d flipped facets across duplicated ridges\n", 
+  trace1((qh ferr, 1011, "qh_forcedmerges: merged %d facets and %d flipped facets across duplicated ridges\n",
                 nummerge, numflip));
 } /* forcedmerges */
 
 
 /*---------------------------------
-  
+
   qh_getmergeset( facetlist )
     determines nonconvex facets on facetlist
     tests !tested ridges and nonconvex ridges of !tested facets
@@ -1120,13 +1124,13 @@
   returns:
     returns sorted qh.facet_mergeset of facet-neighbor pairs to be merged
     all ridges tested
-  
+
   notes:
     assumes no nonconvex ridges with both facets tested
     uses facet->tested/ridge->tested to prevent duplicate tests
     can not limit tests to modified ridges since the centrum changed
     uses qh.visit_id
-  
+
   see:
     qh_getmergeset_initial()
 
@@ -1137,15 +1141,15 @@
           test ridge for convexity
           if non-convex
             append ridge to qh.facet_mergeset
-    sort qh.facet_mergeset by angle  
+    sort qh.facet_mergeset by angle
 */
 void qh_getmergeset(facetT *facetlist) {
   facetT *facet, *neighbor, **neighborp;
   ridgeT *ridge, **ridgep;
   int nummerges;
-  
-  nummerges= qh_setsize (qh facet_mergeset);
-  trace4((qh ferr, "qh_getmergeset: started.\n"));
+
+  nummerges= qh_setsize(qh facet_mergeset);
+  trace4((qh ferr, 4026, "qh_getmergeset: started.\n"));
   qh visit_id++;
   FORALLfacet_(facetlist) {
     if (facet->tested)
@@ -1156,39 +1160,39 @@
       neighbor->seen= False;
     FOREACHridge_(facet->ridges) {
       if (ridge->tested && !ridge->nonconvex)
-	continue;
+        continue;
       /* if tested & nonconvex, need to append merge */
       neighbor= otherfacet_(ridge, facet);
       if (neighbor->seen) {
-	ridge->tested= True;
-	ridge->nonconvex= False;
+        ridge->tested= True;
+        ridge->nonconvex= False;
       }else if (neighbor->visitid != qh visit_id) {
         ridge->tested= True;
         ridge->nonconvex= False;
-	neighbor->seen= True;      /* only one ridge is marked nonconvex */
-	if (qh_test_appendmerge (facet, neighbor))
-	  ridge->nonconvex= True;
+        neighbor->seen= True;      /* only one ridge is marked nonconvex */
+        if (qh_test_appendmerge(facet, neighbor))
+          ridge->nonconvex= True;
       }
     }
   }
-  nummerges= qh_setsize (qh facet_mergeset);
+  nummerges= qh_setsize(qh facet_mergeset);
   if (qh ANGLEmerge)
-    qsort(SETaddr_(qh facet_mergeset, mergeT), nummerges,sizeof(mergeT *),qh_compareangle);
+    qsort(SETaddr_(qh facet_mergeset, mergeT), (size_t)nummerges, sizeof(mergeT *), qh_compareangle);
   else
-    qsort(SETaddr_(qh facet_mergeset, mergeT), nummerges,sizeof(mergeT *),qh_comparemerge);
+    qsort(SETaddr_(qh facet_mergeset, mergeT), (size_t)nummerges, sizeof(mergeT *), qh_comparemerge);
   if (qh POSTmerging) {
     zadd_(Zmergesettot2, nummerges);
   }else {
     zadd_(Zmergesettot, nummerges);
     zmax_(Zmergesetmax, nummerges);
   }
-  trace2((qh ferr, "qh_getmergeset: %d merges found\n", nummerges));
+  trace2((qh ferr, 2021, "qh_getmergeset: %d merges found\n", nummerges));
 } /* getmergeset */
 
 
 /*---------------------------------
-  
+
   qh_getmergeset_initial( facetlist )
     determine initial qh.facet_mergeset for facets
     tests all facet/neighbor pairs on facetlist
@@ -1212,7 +1216,7 @@
           mark one of the ridges as nonconvex
     sort qh.facet_mergeset by angle
 */
-void qh_getmergeset_initial (facetT *facetlist) {
+void qh_getmergeset_initial(facetT *facetlist) {
   facetT *facet, *neighbor, **neighborp;
   ridgeT *ridge, **ridgep;
   int nummerges;
@@ -1223,11 +1227,11 @@
     facet->tested= True;
     FOREACHneighbor_(facet) {
       if (neighbor->visitid != qh visit_id) {
-        if (qh_test_appendmerge (facet, neighbor)) {
+        if (qh_test_appendmerge(facet, neighbor)) {
           FOREACHridge_(neighbor->ridges) {
             if (facet == otherfacet_(ridge, neighbor)) {
               ridge->nonconvex= True;
-              break;	/* only one ridge is marked nonconvex */
+              break;    /* only one ridge is marked nonconvex */
             }
           }
         }
@@ -1236,24 +1240,24 @@
     FOREACHridge_(facet->ridges)
       ridge->tested= True;
   }
-  nummerges= qh_setsize (qh facet_mergeset);
+  nummerges= qh_setsize(qh facet_mergeset);
   if (qh ANGLEmerge)
-    qsort(SETaddr_(qh facet_mergeset, mergeT), nummerges,sizeof(mergeT *),qh_compareangle);
+    qsort(SETaddr_(qh facet_mergeset, mergeT), (size_t)nummerges, sizeof(mergeT *), qh_compareangle);
   else
-    qsort(SETaddr_(qh facet_mergeset, mergeT), nummerges,sizeof(mergeT *),qh_comparemerge);
+    qsort(SETaddr_(qh facet_mergeset, mergeT), (size_t)nummerges, sizeof(mergeT *), qh_comparemerge);
   if (qh POSTmerging) {
     zadd_(Zmergeinittot2, nummerges);
   }else {
     zadd_(Zmergeinittot, nummerges);
     zmax_(Zmergeinitmax, nummerges);
   }
-  trace2((qh ferr, "qh_getmergeset_initial: %d merges found\n", nummerges));
+  trace2((qh ferr, 2022, "qh_getmergeset_initial: %d merges found\n", nummerges));
 } /* getmergeset_initial */
 
 
 /*---------------------------------
-  
+
   qh_hashridge( hashtable, hashsize, ridge, oldvertex )
     add ridge to hashtable without oldvertex
 
@@ -1264,11 +1268,11 @@
     determine hash value for ridge without oldvertex
     find next empty slot for ridge
 */
-void qh_hashridge (setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex) {
+void qh_hashridge(setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex) {
   int hash;
   ridgeT *ridgeA;
 
-  hash= (int)qh_gethash (hashsize, ridge->vertices, qh hull_dim-1, 0, oldvertex);
+  hash= qh_gethash(hashsize, ridge->vertices, qh hull_dim-1, 0, oldvertex);
   while (True) {
     if (!(ridgeA= SETelemt_(hashtable, hash, ridgeT))) {
       SETelem_(hashtable, hash)= ridge;
@@ -1283,21 +1287,21 @@
 
 /*---------------------------------
-  
+
   qh_hashridge_find( hashtable, hashsize, ridge, vertex, oldvertex, hashslot )
-    returns matching ridge without oldvertex in hashtable 
+    returns matching ridge without oldvertex in hashtable
       for ridge without vertex
-    if oldvertex is NULL 
+    if oldvertex is NULL
       matches with any one skip
 
   returns:
     matching ridge or NULL
     if no match,
       if ridge already in   table
-        hashslot= -1 
-      else 
+        hashslot= -1
+      else
         hashslot= next NULL index
-        
+
   notes:
     assumes hashtable is large enough
     can't match ridge to itself
@@ -1307,20 +1311,20 @@
     for each hashslot
       return match if ridge matches ridgeA without oldvertex
 */
-ridgeT *qh_hashridge_find (setT *hashtable, int hashsize, ridgeT *ridge, 
+ridgeT *qh_hashridge_find(setT *hashtable, int hashsize, ridgeT *ridge,
               vertexT *vertex, vertexT *oldvertex, int *hashslot) {
   int hash;
   ridgeT *ridgeA;
 
   *hashslot= 0;
   zinc_(Zhashridge);
-  hash= (int)qh_gethash (hashsize, ridge->vertices, qh hull_dim-1, 0, vertex);
+  hash= qh_gethash(hashsize, ridge->vertices, qh hull_dim-1, 0, vertex);
   while ((ridgeA= SETelemt_(hashtable, hash, ridgeT))) {
     if (ridgeA == ridge)
-      *hashslot= -1;      
+      *hashslot= -1;
     else {
       zinc_(Zhashridgetest);
-      if (qh_setequal_except (ridge->vertices, vertex, ridgeA->vertices, oldvertex))
+      if (qh_setequal_except(ridge->vertices, vertex, ridgeA->vertices, oldvertex))
         return ridgeA;
     }
     if (++hash == hashsize)
@@ -1334,14 +1338,14 @@
 
 /*---------------------------------
-  
+
   qh_makeridges( facet )
     creates explicit ridges between simplicial facets
 
   returns:
     facet with ridges and without qh_MERGEridge
     ->simplicial is False
-  
+
   notes:
     allows qh_MERGEridge flag
     uses existing ridges
@@ -1353,7 +1357,7 @@
   design:
     look for qh_MERGEridge neighbors
     mark neighbors that already have ridges
-    for each unprocessed neighbor of facet    
+    for each unprocessed neighbor of facet
       create a ridge for neighbor and facet
     if any qh_MERGEridge neighbors
       delete qh_MERGEridge flags (already handled by qh_mark_dupridges)
@@ -1363,10 +1367,10 @@
   ridgeT *ridge, **ridgep;
   int neighbor_i, neighbor_n;
   boolT toporient, mergeridge= False;
-  
+
   if (!facet->simplicial)
     return;
-  trace4((qh ferr, "qh_makeridges: make ridges for f%d\n", facet->id));
+  trace4((qh ferr, 4027, "qh_makeridges: make ridges for f%d\n", facet->id));
   facet->simplicial= False;
   FOREACHneighbor_(facet) {
     if (neighbor == qh_MERGEridge)
@@ -1381,8 +1385,8 @@
       continue;  /* fixed by qh_mark_dupridges */
     else if (!neighbor->seen) {  /* no current ridges */
       ridge= qh_newridge();
-      ridge->vertices= qh_setnew_delnthsorted (facet->vertices, qh hull_dim,
-					                  neighbor_i, 0);
+      ridge->vertices= qh_setnew_delnthsorted(facet->vertices, qh hull_dim,
+                                                          neighbor_i, 0);
       toporient= facet->toporient ^ (neighbor_i & 0x1);
       if (toporient) {
         ridge->top= facet;
@@ -1406,7 +1410,7 @@
     }
   }
   if (mergeridge) {
-    while (qh_setdel (facet->neighbors, qh_MERGEridge))
+    while (qh_setdel(facet->neighbors, qh_MERGEridge))
       ; /* delete each one */
   }
 } /* makeridges */
@@ -1414,7 +1418,7 @@
 
 /*---------------------------------
-  
+
   qh_mark_dupridges( facetlist )
     add duplicated ridges to qh.facet_mergeset
     facet->dupridge is true
@@ -1424,7 +1428,7 @@
     ->mergeridge/->mergeridge2 set
     duplicate ridges marked by qh_MERGEridge and both sides facet->dupridge
     no MERGEridges in neighbor sets
-    
+
   notes:
     duplicate ridges occur when the horizon is pinched,
         i.e. a subridge occurs in more than two horizon ridges.
@@ -1436,9 +1440,9 @@
       if facet contains a duplicate ridge
         for each neighbor of facet
           if neighbor marked qh_MERGEridge (one side of the merge)
-            set facet->mergeridge      
+            set facet->mergeridge
           else
-            if neighbor contains a duplicate ridge 
+            if neighbor contains a duplicate ridge
             and the back link is qh_MERGEridge
               append duplicate ridge to qh.facet_mergeset
    for each duplicate ridge
@@ -1452,52 +1456,52 @@
   facetT *facet, *neighbor, **neighborp;
   int nummerge=0;
   mergeT *merge, **mergep;
-  
 
-  trace4((qh ferr, "qh_mark_dupridges: identify duplicate ridges\n"));  
+
+  trace4((qh ferr, 4028, "qh_mark_dupridges: identify duplicate ridges\n"));
   FORALLfacet_(facetlist) {
     if (facet->dupridge) {
       FOREACHneighbor_(facet) {
         if (neighbor == qh_MERGEridge) {
-	  facet->mergeridge= True;
-	  continue;
-	}
+          facet->mergeridge= True;
+          continue;
+        }
         if (neighbor->dupridge
-	&& !qh_setin (neighbor->neighbors, facet)) { /* qh_MERGEridge */
-	  qh_appendmergeset (facet, neighbor, MRGridge, NULL);
-	  facet->mergeridge2= True;
-	  facet->mergeridge= True;
-	  nummerge++;
-	}
+        && !qh_setin(neighbor->neighbors, facet)) { /* qh_MERGEridge */
+          qh_appendmergeset(facet, neighbor, MRGridge, NULL);
+          facet->mergeridge2= True;
+          facet->mergeridge= True;
+          nummerge++;
+        }
       }
     }
   }
   if (!nummerge)
     return;
   FORALLfacet_(facetlist) {            /* gets rid of qh_MERGEridge */
-    if (facet->mergeridge && !facet->mergeridge2)   
-      qh_makeridges (facet);
+    if (facet->mergeridge && !facet->mergeridge2)
+      qh_makeridges(facet);
   }
   FOREACHmerge_(qh facet_mergeset) {   /* restore the missing neighbors */
     if (merge->type == MRGridge) {
-      qh_setappend (&merge->facet2->neighbors, merge->facet1);
-      qh_makeridges (merge->facet1);   /* and the missing ridges */
+      qh_setappend(&merge->facet2->neighbors, merge->facet1);
+      qh_makeridges(merge->facet1);   /* and the missing ridges */
     }
   }
-  trace1((qh ferr, "qh_mark_dupridges: found %d duplicated ridges\n", 
+  trace1((qh ferr, 1012, "qh_mark_dupridges: found %d duplicated ridges\n",
                 nummerge));
 } /* mark_dupridges */
 
 /*---------------------------------
-  
+
   qh_maydropneighbor( facet )
     drop neighbor relationship if no ridge between facet and neighbor
 
   returns:
     neighbor sets updated
     appends degenerate facets to qh.facet_mergeset
-  
+
   notes:
     won't cause redundant facets since vertex inclusion is the same
     may drop vertex and neighbor if no ridge
@@ -1512,44 +1516,44 @@
     if facet is degenerate
       append facet to qh.degen_mergeset
 */
-void qh_maydropneighbor (facetT *facet) {
+void qh_maydropneighbor(facetT *facet) {
   ridgeT *ridge, **ridgep;
   realT angledegen= qh_ANGLEdegen;
   facetT *neighbor, **neighborp;
 
   qh visit_id++;
-  trace4((qh ferr, "qh_maydropneighbor: test f%d for no ridges to a neighbor\n",
-	  facet->id));
+  trace4((qh ferr, 4029, "qh_maydropneighbor: test f%d for no ridges to a neighbor\n",
+          facet->id));
   FOREACHridge_(facet->ridges) {
     ridge->top->visitid= qh visit_id;
     ridge->bottom->visitid= qh visit_id;
   }
   FOREACHneighbor_(facet) {
     if (neighbor->visitid != qh visit_id) {
-      trace0((qh ferr, "qh_maydropneighbor: facets f%d and f%d are no longer neighbors during p%d\n",
-	    facet->id, neighbor->id, qh furthest_id));
+      trace0((qh ferr, 17, "qh_maydropneighbor: facets f%d and f%d are no longer neighbors during p%d\n",
+            facet->id, neighbor->id, qh furthest_id));
       zinc_(Zdropneighbor);
-      qh_setdel (facet->neighbors, neighbor);
+      qh_setdel(facet->neighbors, neighbor);
       neighborp--;  /* repeat, deleted a neighbor */
-      qh_setdel (neighbor->neighbors, facet);
-      if (qh_setsize (neighbor->neighbors) < qh hull_dim) {
+      qh_setdel(neighbor->neighbors, facet);
+      if (qh_setsize(neighbor->neighbors) < qh hull_dim) {
         zinc_(Zdropdegen);
-        qh_appendmergeset (neighbor, neighbor, MRGdegen, &angledegen);
-        trace2((qh ferr, "qh_maydropneighbors: f%d is degenerate.\n", neighbor->id));
+        qh_appendmergeset(neighbor, neighbor, MRGdegen, &angledegen);
+        trace2((qh ferr, 2023, "qh_maydropneighbors: f%d is degenerate.\n", neighbor->id));
       }
     }
   }
-  if (qh_setsize (facet->neighbors) < qh hull_dim) {
+  if (qh_setsize(facet->neighbors) < qh hull_dim) {
     zinc_(Zdropdegen);
-    qh_appendmergeset (facet, facet, MRGdegen, &angledegen);
-    trace2((qh ferr, "qh_maydropneighbors: f%d is degenerate.\n", facet->id));
+    qh_appendmergeset(facet, facet, MRGdegen, &angledegen);
+    trace2((qh ferr, 2024, "qh_maydropneighbors: f%d is degenerate.\n", facet->id));
   }
 } /* maydropneighbor */
 
 
 /*---------------------------------
-  
+
   qh_merge_degenredundant()
     merge all degenerate and redundant facets
     qh.degen_mergeset contains merges from qh_degen_redundant_neighbors()
@@ -1572,7 +1576,7 @@
         else
           merge redundant facet into other facet
 */
-int qh_merge_degenredundant (void) {
+int qh_merge_degenredundant(void) {
   int size;
   mergeT *merge;
   facetT *bestneighbor, *facet1, *facet2;
@@ -1581,64 +1585,64 @@
   int nummerges= 0;
   mergeType mergetype;
 
-  while ((merge= (mergeT*)qh_setdellast (qh degen_mergeset))) {
+  while ((merge= (mergeT*)qh_setdellast(qh degen_mergeset))) {
     facet1= merge->facet1;
     facet2= merge->facet2;
     mergetype= merge->type;
-    qh_memfree (merge, sizeof(mergeT));
+    qh_memfree(merge, (int)sizeof(mergeT));
     if (facet1->visible)
       continue;
-    facet1->degenerate= False; 
-    facet1->redundant= False; 
+    facet1->degenerate= False;
+    facet1->redundant= False;
     if (qh TRACEmerge-1 == zzval_(Ztotmerge))
       qhmem.IStracing= qh IStracing= qh TRACElevel;
     if (mergetype == MRGredundant) {
       zinc_(Zneighbor);
       while (facet2->visible) {
         if (!facet2->f.replace) {
-          fprintf (qh ferr, "qhull internal error (qh_merge_degenredunant): f%d redundant but f%d has no replacement\n",
-	       facet1->id, facet2->id);
+          qh_fprintf(qh ferr, 6097, "qhull internal error (qh_merge_degenredunant): f%d redundant but f%d has no replacement\n",
+               facet1->id, facet2->id);
           qh_errexit2 (qh_ERRqhull, facet1, facet2);
         }
         facet2= facet2->f.replace;
       }
       if (facet1 == facet2) {
-	qh_degen_redundant_facet (facet1); /* in case of others */
-	continue;
+        qh_degen_redundant_facet(facet1); /* in case of others */
+        continue;
       }
-      trace2((qh ferr, "qh_merge_degenredundant: facet f%d is contained in f%d, will merge\n",
-	    facet1->id, facet2->id));
+      trace2((qh ferr, 2025, "qh_merge_degenredundant: facet f%d is contained in f%d, will merge\n",
+            facet1->id, facet2->id));
       qh_mergefacet(facet1, facet2, NULL, NULL, !qh_MERGEapex);
       /* merge distance is already accounted for */
       nummerges++;
     }else {  /* mergetype == MRGdegen, other merges may have fixed */
-      if (!(size= qh_setsize (facet1->neighbors))) {
+      if (!(size= qh_setsize(facet1->neighbors))) {
         zinc_(Zdelfacetdup);
-        trace2((qh ferr, "qh_merge_degenredundant: facet f%d has no neighbors.  Deleted\n", facet1->id));
-        qh_willdelete (facet1, NULL);
+        trace2((qh ferr, 2026, "qh_merge_degenredundant: facet f%d has no neighbors.  Deleted\n", facet1->id));
+        qh_willdelete(facet1, NULL);
         FOREACHvertex_(facet1->vertices) {
-  	  qh_setdel (vertex->neighbors, facet1);
-	  if (!SETfirst_(vertex->neighbors)) {
-	    zinc_(Zdegenvertex);
-	    trace2((qh ferr, "qh_merge_degenredundant: deleted v%d because f%d has no neighbors\n",
-         	 vertex->id, facet1->id));
-	    vertex->deleted= True;
-	    qh_setappend (&qh del_vertices, vertex);
-	  }
+          qh_setdel(vertex->neighbors, facet1);
+          if (!SETfirst_(vertex->neighbors)) {
+            zinc_(Zdegenvertex);
+            trace2((qh ferr, 2027, "qh_merge_degenredundant: deleted v%d because f%d has no neighbors\n",
+                 vertex->id, facet1->id));
+            vertex->deleted= True;
+            qh_setappend(&qh del_vertices, vertex);
+          }
         }
         nummerges++;
       }else if (size < qh hull_dim) {
         bestneighbor= qh_findbestneighbor(facet1, &dist, &mindist, &maxdist);
-        trace2((qh ferr, "qh_merge_degenredundant: facet f%d has %d neighbors, merge into f%d dist %2.2g\n",
-	      facet1->id, size, bestneighbor->id, dist));
+        trace2((qh ferr, 2028, "qh_merge_degenredundant: facet f%d has %d neighbors, merge into f%d dist %2.2g\n",
+              facet1->id, size, bestneighbor->id, dist));
         qh_mergefacet(facet1, bestneighbor, &mindist, &maxdist, !qh_MERGEapex);
         nummerges++;
         if (qh PRINTstatistics) {
-	  zinc_(Zdegen);
-	  wadd_(Wdegentot, dist);
-	  wmax_(Wdegenmax, dist);
+          zinc_(Zdegen);
+          wadd_(Wdegentot, dist);
+          wmax_(Wdegenmax, dist);
         }
-      }	/* else, another merge fixed the degeneracy and redundancy tested */
+      } /* else, another merge fixed the degeneracy and redundancy tested */
     }
   }
   return nummerges;
@@ -1646,14 +1650,14 @@
 
 /*---------------------------------
-  
+
   qh_merge_nonconvex( facet1, facet2, mergetype )
-    remove non-convex ridge between facet1 into facet2 
+    remove non-convex ridge between facet1 into facet2
     mergetype gives why the facet's are non-convex
 
   returns:
     merges one of the facets into the best neighbor
-    
+
   design:
     if one of the facets is a new facet
       prefer merging new facet into old facet
@@ -1661,13 +1665,13 @@
     merge the nearest facet into its best neighbor
     update the statistics
 */
-void qh_merge_nonconvex (facetT *facet1, facetT *facet2, mergeType mergetype) {
+void qh_merge_nonconvex(facetT *facet1, facetT *facet2, mergeType mergetype) {
   facetT *bestfacet, *bestneighbor, *neighbor;
   realT dist, dist2, mindist, mindist2, maxdist, maxdist2;
 
   if (qh TRACEmerge-1 == zzval_(Ztotmerge))
     qhmem.IStracing= qh IStracing= qh TRACElevel;
-  trace3((qh ferr, "qh_merge_nonconvex: merge #%d for f%d and f%d type %d\n",
+  trace3((qh ferr, 3003, "qh_merge_nonconvex: merge #%d for f%d and f%d type %d\n",
       zzval_(Ztotmerge) + 1, facet1->id, facet2->id, mergetype));
   /* concave or coplanar */
   if (!facet1->newfacet) {
@@ -1686,7 +1690,7 @@
     zinc_(Zavoidold);
     wadd_(Wavoidoldtot, dist);
     wmax_(Wavoidoldmax, dist);
-    trace2((qh ferr, "qh_merge_nonconvex: avoid merging old facet f%d dist %2.2g.  Use f%d dist %2.2g instead\n",
+    trace2((qh ferr, 2029, "qh_merge_nonconvex: avoid merging old facet f%d dist %2.2g.  Use f%d dist %2.2g instead\n",
            facet2->id, dist2, facet1->id, dist2));
     qh_mergefacet(bestfacet, bestneighbor, &mindist, &maxdist, !qh_MERGEapex);
   }else {
@@ -1712,9 +1716,9 @@
 
 /*---------------------------------
-  
+
   qh_mergecycle( samecycle, newfacet )
-    merge a cycle of facets starting at samecycle into a newfacet 
+    merge a cycle of facets starting at samecycle into a newfacet
     newfacet is a horizon facet with ->normal
     samecycle facets are simplicial from an apex
 
@@ -1739,7 +1743,7 @@
       add its vertices to qh.newvertex_list
     delete samecycle facets a make newfacet a newfacet
 */
-void qh_mergecycle (facetT *samecycle, facetT *newfacet) {
+void qh_mergecycle(facetT *samecycle, facetT *newfacet) {
   int traceonce= False, tracerestore= 0;
   vertexT *apex;
 #ifndef qh_NOtrace
@@ -1748,8 +1752,8 @@
 
   if (newfacet->tricoplanar) {
     if (!qh TRInormals) {
-      fprintf (qh ferr, "qh_mergecycle: does not work for tricoplanar facets.  Use option 'Q11'\n");
-      qh_errexit (qh_ERRqhull, newfacet, NULL);
+      qh_fprintf(qh ferr, 6224, "Qhull internal error (qh_mergecycle): does not work for tricoplanar facets.  Use option 'Q11'\n");
+      qh_errexit(qh_ERRqhull, newfacet, NULL);
     }
     newfacet->tricoplanar= False;
     newfacet->keepcentrum= False;
@@ -1764,45 +1768,45 @@
 #ifndef qh_NOtrace
   if (qh TRACEmerge == zzval_(Ztotmerge))
     qhmem.IStracing= qh IStracing= qh TRACElevel;
-  trace2((qh ferr, "qh_mergecycle: merge #%d for facets from cycle f%d into coplanar horizon f%d\n", 
+  trace2((qh ferr, 2030, "qh_mergecycle: merge #%d for facets from cycle f%d into coplanar horizon f%d\n",
         zzval_(Ztotmerge), samecycle->id, newfacet->id));
   if (newfacet == qh tracefacet) {
     tracerestore= qh IStracing;
     qh IStracing= 4;
-    fprintf (qh ferr, "qh_mergecycle: ========= trace merge %d of samecycle %d into trace f%d, furthest is p%d\n",
-	       zzval_(Ztotmerge), samecycle->id, newfacet->id,  qh furthest_id);
+    qh_fprintf(qh ferr, 8068, "qh_mergecycle: ========= trace merge %d of samecycle %d into trace f%d, furthest is p%d\n",
+               zzval_(Ztotmerge), samecycle->id, newfacet->id,  qh furthest_id);
     traceonce= True;
   }
   if (qh IStracing >=4) {
-    fprintf (qh ferr, "  same cycle:");
+    qh_fprintf(qh ferr, 8069, "  same cycle:");
     FORALLsame_cycle_(samecycle)
-      fprintf(qh ferr, " f%d", same->id);
-    fprintf (qh ferr, "\n");
+      qh_fprintf(qh ferr, 8070, " f%d", same->id);
+    qh_fprintf(qh ferr, 8071, "\n");
   }
   if (qh IStracing >=4)
-    qh_errprint ("MERGING CYCLE", samecycle, newfacet, NULL, NULL);
+    qh_errprint("MERGING CYCLE", samecycle, newfacet, NULL, NULL);
 #endif /* !qh_NOtrace */
   apex= SETfirstt_(samecycle->vertices, vertexT);
-  qh_makeridges (newfacet);
-  qh_mergecycle_neighbors (samecycle, newfacet);
-  qh_mergecycle_ridges (samecycle, newfacet);
-  qh_mergecycle_vneighbors (samecycle, newfacet);
-  if (SETfirstt_(newfacet->vertices, vertexT) != apex) 
-    qh_setaddnth (&newfacet->vertices, 0, apex);  /* apex has last id */
+  qh_makeridges(newfacet);
+  qh_mergecycle_neighbors(samecycle, newfacet);
+  qh_mergecycle_ridges(samecycle, newfacet);
+  qh_mergecycle_vneighbors(samecycle, newfacet);
+  if (SETfirstt_(newfacet->vertices, vertexT) != apex)
+    qh_setaddnth(&newfacet->vertices, 0, apex);  /* apex has last id */
   if (!newfacet->newfacet)
-    qh_newvertices (newfacet->vertices);
-  qh_mergecycle_facets (samecycle, newfacet);
-  qh_tracemerge (samecycle, newfacet);
+    qh_newvertices(newfacet->vertices);
+  qh_mergecycle_facets(samecycle, newfacet);
+  qh_tracemerge(samecycle, newfacet);
   /* check for degen_redundant_neighbors after qh_forcedmerges() */
   if (traceonce) {
-    fprintf (qh ferr, "qh_mergecycle: end of trace facet\n");
+    qh_fprintf(qh ferr, 8072, "qh_mergecycle: end of trace facet\n");
     qh IStracing= tracerestore;
   }
 } /* mergecycle */
 
 /*---------------------------------
-  
+
   qh_mergecycle_all( facetlist, wasmerge )
     merge all samecycles of coplanar facets into horizon
     don't merge facets with ->mergeridge (these already have ->normal)
@@ -1822,65 +1826,65 @@
       skip facets with duplicate ridges and normals
       check that facet is in a samecycle (->mergehorizon)
       if facet only member of samecycle
-	sets vertex->delridge for all vertices except apex
+        sets vertex->delridge for all vertices except apex
         merge facet into horizon
       else
         mark all facets in samecycle
         remove facets with duplicate ridges from samecycle
         merge samecycle into horizon (deletes facets from facetlist)
 */
-void qh_mergecycle_all (facetT *facetlist, boolT *wasmerge) {
+void qh_mergecycle_all(facetT *facetlist, boolT *wasmerge) {
   facetT *facet, *same, *prev, *horizon;
   facetT *samecycle= NULL, *nextfacet, *nextsame;
   vertexT *apex, *vertex, **vertexp;
   int cycles=0, total=0, facets, nummerge;
 
-  trace2((qh ferr, "qh_mergecycle_all: begin\n"));
+  trace2((qh ferr, 2031, "qh_mergecycle_all: begin\n"));
   for (facet= facetlist; facet && (nextfacet= facet->next); facet= nextfacet) {
     if (facet->normal)
       continue;
     if (!facet->mergehorizon) {
-      fprintf (qh ferr, "qh_mergecycle_all: f%d without normal\n", facet->id);
-      qh_errexit (qh_ERRqhull, facet, NULL);
+      qh_fprintf(qh ferr, 6225, "Qhull internal error (qh_mergecycle_all): f%d without normal\n", facet->id);
+      qh_errexit(qh_ERRqhull, facet, NULL);
     }
     horizon= SETfirstt_(facet->neighbors, facetT);
     if (facet->f.samecycle == facet) {
-      zinc_(Zonehorizon);  
+      zinc_(Zonehorizon);
       /* merge distance done in qh_findhorizon */
       apex= SETfirstt_(facet->vertices, vertexT);
       FOREACHvertex_(facet->vertices) {
-	if (vertex != apex)
+        if (vertex != apex)
           vertex->delridge= True;
       }
       horizon->f.newcycle= NULL;
-      qh_mergefacet (facet, horizon, NULL, NULL, qh_MERGEapex);
+      qh_mergefacet(facet, horizon, NULL, NULL, qh_MERGEapex);
     }else {
       samecycle= facet;
       facets= 0;
       prev= facet;
       for (same= facet->f.samecycle; same;  /* FORALLsame_cycle_(facet) */
-	   same= (same == facet ? NULL :nextsame)) { /* ends at facet */
-	nextsame= same->f.samecycle;
+           same= (same == facet ? NULL :nextsame)) { /* ends at facet */
+        nextsame= same->f.samecycle;
         if (same->cycledone || same->visible)
-          qh_infiniteloop (same);
+          qh_infiniteloop(same);
         same->cycledone= True;
-        if (same->normal) { 
+        if (same->normal) {
           prev->f.samecycle= same->f.samecycle; /* unlink ->mergeridge */
-	  same->f.samecycle= NULL;
+          same->f.samecycle= NULL;
         }else {
           prev= same;
-	  facets++;
-	}
+          facets++;
+        }
       }
       while (nextfacet && nextfacet->cycledone)  /* will delete samecycle */
-	nextfacet= nextfacet->next;
+        nextfacet= nextfacet->next;
       horizon->f.newcycle= NULL;
-      qh_mergecycle (samecycle, horizon);
+      qh_mergecycle(samecycle, horizon);
       nummerge= horizon->nummerge + facets;
-      if (nummerge > qh_MAXnummerge) 
-      	horizon->nummerge= qh_MAXnummerge;
+      if (nummerge > qh_MAXnummerge)
+        horizon->nummerge= qh_MAXnummerge;
       else
-        horizon->nummerge= nummerge;
+        horizon->nummerge= (short unsigned int)nummerge;
       zzinc_(Zcyclehorizon);
       total += facets;
       zzadd_(Zcyclefacettot, facets);
@@ -1890,25 +1894,25 @@
   }
   if (cycles)
     *wasmerge= True;
-  trace1((qh ferr, "qh_mergecycle_all: merged %d same cycles or facets into coplanar horizons\n", cycles));
+  trace1((qh ferr, 1013, "qh_mergecycle_all: merged %d same cycles or facets into coplanar horizons\n", cycles));
 } /* mergecycle_all */
 
 /*---------------------------------
-  
+
   qh_mergecycle_facets( samecycle, newfacet )
     finish merge of samecycle into newfacet
 
   returns:
     samecycle prepended to visible_list for later deletion and partitioning
       each facet->f.replace == newfacet
-      
+
     newfacet moved to end of qh.facet_list
       makes newfacet a newfacet (get's facet1->id if it was old)
       sets newfacet->newmerge
       clears newfacet->center (unless merging into a large facet)
       clears newfacet->tested and ridge->tested for facet1
-      
+
     adds neighboring facets to facet_mergeset if redundant or degenerate
 
   design:
@@ -1917,32 +1921,32 @@
     unless newfacet is large
       remove its centrum
 */
-void qh_mergecycle_facets (facetT *samecycle, facetT *newfacet) {
+void qh_mergecycle_facets(facetT *samecycle, facetT *newfacet) {
   facetT *same, *next;
-  
-  trace4((qh ferr, "qh_mergecycle_facets: make newfacet new and samecycle deleted\n"));  
+
+  trace4((qh ferr, 4030, "qh_mergecycle_facets: make newfacet new and samecycle deleted\n"));
   qh_removefacet(newfacet);  /* append as a newfacet to end of qh facet_list */
   qh_appendfacet(newfacet);
   newfacet->newfacet= True;
   newfacet->simplicial= False;
   newfacet->newmerge= True;
-  
+
   for (same= samecycle->f.samecycle; same; same= (same == samecycle ?  NULL : next)) {
     next= same->f.samecycle;  /* reused by willdelete */
-    qh_willdelete (same, newfacet);
+    qh_willdelete(same, newfacet);
   }
-  if (newfacet->center 
-      && qh_setsize (newfacet->vertices) <= qh hull_dim + qh_MAXnewcentrum) {
-    qh_memfree (newfacet->center, qh normal_size);
+  if (newfacet->center
+      && qh_setsize(newfacet->vertices) <= qh hull_dim + qh_MAXnewcentrum) {
+    qh_memfree(newfacet->center, qh normal_size);
     newfacet->center= NULL;
   }
-  trace3((qh ferr, "qh_mergecycle_facets: merged facets from cycle f%d into f%d\n", 
+  trace3((qh ferr, 3004, "qh_mergecycle_facets: merged facets from cycle f%d into f%d\n",
              samecycle->id, newfacet->id));
 } /* mergecycle_facets */
 
 /*---------------------------------
-  
+
   qh_mergecycle_neighbors( samecycle, newfacet )
     add neighbors for samecycle facets to newfacet
 
@@ -1955,9 +1959,9 @@
 
   notes:
     assumes newfacet not in samecycle
-    usually, samecycle facets are new, simplicial facets without internal ridges 
+    usually, samecycle facets are new, simplicial facets without internal ridges
       not so if horizon facet is coplanar to two different samecycles
-  
+
   see:
     qh_mergeneighbors()
 
@@ -1984,11 +1988,11 @@
   samevisitid= ++qh visit_id;
   FORALLsame_cycle_(samecycle) {
     if (same->visitid == samevisitid || same->visible)
-      qh_infiniteloop (samecycle);
+      qh_infiniteloop(samecycle);
     same->visitid= samevisitid;
   }
   newfacet->visitid= ++qh visit_id;
-  trace4((qh ferr, "qh_mergecycle_neighbors: delete shared neighbors from newfacet\n"));  
+  trace4((qh ferr, 4031, "qh_mergecycle_neighbors: delete shared neighbors from newfacet\n"));
   FOREACHneighbor_(newfacet) {
     if (neighbor->visitid == samevisitid) {
       SETref_(neighbor)= NULL;  /* samecycle neighbors deleted */
@@ -1996,51 +2000,51 @@
     }else
       neighbor->visitid= qh visit_id;
   }
-  qh_setcompact (newfacet->neighbors);
+  qh_setcompact(newfacet->neighbors);
 
-  trace4((qh ferr, "qh_mergecycle_neighbors: update neighbors\n"));  
+  trace4((qh ferr, 4032, "qh_mergecycle_neighbors: update neighbors\n"));
   FORALLsame_cycle_(samecycle) {
     FOREACHneighbor_(same) {
       if (neighbor->visitid == samevisitid)
-	continue;
+        continue;
       if (neighbor->simplicial) {
-	if (neighbor->visitid != qh visit_id) {
-	  qh_setappend (&newfacet->neighbors, neighbor);
-	  qh_setreplace (neighbor->neighbors, same, newfacet);
-	  newneighbors++;
-	  neighbor->visitid= qh visit_id;
-	  FOREACHridge_(neighbor->ridges) { /* update ridge in case of qh_makeridges */
-	    if (ridge->top == same) {
-	      ridge->top= newfacet;
-	      break;
-	    }else if (ridge->bottom == same) {
-	      ridge->bottom= newfacet;
-	      break;
-	    }
-	  }
-	}else {
-	  qh_makeridges (neighbor);
-	  qh_setdel (neighbor->neighbors, same);
-	  /* same can't be horizon facet for neighbor */
-	}
+        if (neighbor->visitid != qh visit_id) {
+          qh_setappend(&newfacet->neighbors, neighbor);
+          qh_setreplace(neighbor->neighbors, same, newfacet);
+          newneighbors++;
+          neighbor->visitid= qh visit_id;
+          FOREACHridge_(neighbor->ridges) { /* update ridge in case of qh_makeridges */
+            if (ridge->top == same) {
+              ridge->top= newfacet;
+              break;
+            }else if (ridge->bottom == same) {
+              ridge->bottom= newfacet;
+              break;
+            }
+          }
+        }else {
+          qh_makeridges(neighbor);
+          qh_setdel(neighbor->neighbors, same);
+          /* same can't be horizon facet for neighbor */
+        }
       }else { /* non-simplicial neighbor */
-        qh_setdel (neighbor->neighbors, same);
+        qh_setdel(neighbor->neighbors, same);
         if (neighbor->visitid != qh visit_id) {
-          qh_setappend (&neighbor->neighbors, newfacet);
-          qh_setappend (&newfacet->neighbors, neighbor);
+          qh_setappend(&neighbor->neighbors, newfacet);
+          qh_setappend(&newfacet->neighbors, neighbor);
           neighbor->visitid= qh visit_id;
           newneighbors++;
-        } 
+        }
       }
     }
   }
-  trace2((qh ferr, "qh_mergecycle_neighbors: deleted %d neighbors and added %d\n", 
+  trace2((qh ferr, 2032, "qh_mergecycle_neighbors: deleted %d neighbors and added %d\n",
              delneighbors, newneighbors));
 } /* mergecycle_neighbors */
 
 /*---------------------------------
-  
+
   qh_mergecycle_ridges( samecycle, newfacet )
     add ridges/neighbors for facets in samecycle to newfacet
     all new/old neighbors of newfacet marked with qh.visit_id
@@ -2049,7 +2053,7 @@
 
   returns:
     newfacet has merged ridges
-  
+
   notes:
     ridge already updated for simplicial neighbors of samecycle with a ridge
 
@@ -2081,55 +2085,55 @@
   boolT toporient;
   void **freelistp; /* used !qh_NOmem */
 
-  trace4((qh ferr, "qh_mergecycle_ridges: delete shared ridges from newfacet\n"));  
+  trace4((qh ferr, 4033, "qh_mergecycle_ridges: delete shared ridges from newfacet\n"));
   samevisitid= qh visit_id -1;
   FOREACHridge_(newfacet->ridges) {
     neighbor= otherfacet_(ridge, newfacet);
     if (neighbor->visitid == samevisitid)
-      SETref_(ridge)= NULL; /* ridge free'd below */  
+      SETref_(ridge)= NULL; /* ridge free'd below */
   }
-  qh_setcompact (newfacet->ridges);
-  
-  trace4((qh ferr, "qh_mergecycle_ridges: add ridges to newfacet\n"));  
+  qh_setcompact(newfacet->ridges);
+
+  trace4((qh ferr, 4034, "qh_mergecycle_ridges: add ridges to newfacet\n"));
   FORALLsame_cycle_(samecycle) {
     FOREACHridge_(same->ridges) {
       if (ridge->top == same) {
         ridge->top= newfacet;
-	neighbor= ridge->bottom;
+        neighbor= ridge->bottom;
       }else if (ridge->bottom == same) {
-	ridge->bottom= newfacet;
-	neighbor= ridge->top;
+        ridge->bottom= newfacet;
+        neighbor= ridge->top;
       }else if (ridge->top == newfacet || ridge->bottom == newfacet) {
-        qh_setappend (&newfacet->ridges, ridge);
+        qh_setappend(&newfacet->ridges, ridge);
         numold++;  /* already set by qh_mergecycle_neighbors */
-	continue;  
+        continue;
       }else {
-	fprintf (qh ferr, "qhull internal error (qh_mergecycle_ridges): bad ridge r%d\n", ridge->id);
-	qh_errexit (qh_ERRqhull, NULL, ridge);
+        qh_fprintf(qh ferr, 6098, "qhull internal error (qh_mergecycle_ridges): bad ridge r%d\n", ridge->id);
+        qh_errexit(qh_ERRqhull, NULL, ridge);
       }
       if (neighbor == newfacet) {
-        qh_setfree(&(ridge->vertices)); 
-        qh_memfree_(ridge, sizeof(ridgeT), freelistp);
+        qh_setfree(&(ridge->vertices));
+        qh_memfree_(ridge, (int)sizeof(ridgeT), freelistp);
         numold++;
       }else if (neighbor->visitid == samevisitid) {
-	qh_setdel (neighbor->ridges, ridge);
-	qh_setfree(&(ridge->vertices)); 
-	qh_memfree_(ridge, sizeof(ridgeT), freelistp);
-	numold++;
+        qh_setdel(neighbor->ridges, ridge);
+        qh_setfree(&(ridge->vertices));
+        qh_memfree_(ridge, (int)sizeof(ridgeT), freelistp);
+        numold++;
       }else {
-        qh_setappend (&newfacet->ridges, ridge);
+        qh_setappend(&newfacet->ridges, ridge);
         numold++;
       }
     }
     if (same->ridges)
-      qh_settruncate (same->ridges, 0);
+      qh_settruncate(same->ridges, 0);
     if (!same->simplicial)
       continue;
     FOREACHneighbor_i_(same) {       /* note: !newfact->simplicial */
       if (neighbor->visitid != samevisitid && neighbor->simplicial) {
         ridge= qh_newridge();
-        ridge->vertices= qh_setnew_delnthsorted (same->vertices, qh hull_dim,
-  					                  neighbor_i, 0);
+        ridge->vertices= qh_setnew_delnthsorted(same->vertices, qh hull_dim,
+                                                          neighbor_i, 0);
         toporient= same->toporient ^ (neighbor_i & 0x1);
         if (toporient) {
           ridge->top= newfacet;
@@ -2145,13 +2149,13 @@
     }
   }
 
-  trace2((qh ferr, "qh_mergecycle_ridges: found %d old ridges and %d new ones\n", 
+  trace2((qh ferr, 2033, "qh_mergecycle_ridges: found %d old ridges and %d new ones\n",
              numold, numnew));
 } /* mergecycle_ridges */
 
 /*---------------------------------
-  
+
   qh_mergecycle_vneighbors( samecycle, newfacet )
     create vertex neighbors for newfacet from vertices of facets in samecycle
     samecycle marked with visitid == qh.visit_id - 1
@@ -2174,47 +2178,47 @@
         delete it from newfacet
         add it to qh.del_vertices for later deletion
 */
-void qh_mergecycle_vneighbors (facetT *samecycle, facetT *newfacet) {
+void qh_mergecycle_vneighbors(facetT *samecycle, facetT *newfacet) {
   facetT *neighbor, **neighborp;
   unsigned int mergeid;
   vertexT *vertex, **vertexp, *apex;
   setT *vertices;
-  
-  trace4((qh ferr, "qh_mergecycle_vneighbors: update vertex neighbors for newfacet\n"));  
+
+  trace4((qh ferr, 4035, "qh_mergecycle_vneighbors: update vertex neighbors for newfacet\n"));
   mergeid= qh visit_id - 1;
   newfacet->visitid= mergeid;
-  vertices= qh_basevertices (samecycle); /* temp */
+  vertices= qh_basevertices(samecycle); /* temp */
   apex= SETfirstt_(samecycle->vertices, vertexT);
-  qh_setappend (&vertices, apex);
+  qh_setappend(&vertices, apex);
   FOREACHvertex_(vertices) {
     vertex->delridge= True;
     FOREACHneighbor_(vertex) {
       if (neighbor->visitid == mergeid)
         SETref_(neighbor)= NULL;
     }
-    qh_setcompact (vertex->neighbors);
-    qh_setappend (&vertex->neighbors, newfacet);
+    qh_setcompact(vertex->neighbors);
+    qh_setappend(&vertex->neighbors, newfacet);
     if (!SETsecond_(vertex->neighbors)) {
       zinc_(Zcyclevertex);
-      trace2((qh ferr, "qh_mergecycle_vneighbors: deleted v%d when merging cycle f%d into f%d\n",
+      trace2((qh ferr, 2034, "qh_mergecycle_vneighbors: deleted v%d when merging cycle f%d into f%d\n",
         vertex->id, samecycle->id, newfacet->id));
-      qh_setdelsorted (newfacet->vertices, vertex);
+      qh_setdelsorted(newfacet->vertices, vertex);
       vertex->deleted= True;
-      qh_setappend (&qh del_vertices, vertex);
+      qh_setappend(&qh del_vertices, vertex);
     }
   }
-  qh_settempfree (&vertices);
-  trace3((qh ferr, "qh_mergecycle_vneighbors: merged vertices from cycle f%d into f%d\n", 
+  qh_settempfree(&vertices);
+  trace3((qh ferr, 3005, "qh_mergecycle_vneighbors: merged vertices from cycle f%d into f%d\n",
              samecycle->id, newfacet->id));
 } /* mergecycle_vneighbors */
 
 /*---------------------------------
-  
+
   qh_mergefacet( facet1, facet2, mindist, maxdist, mergeapex )
     merges facet1 into facet2
     mergeapex==qh_MERGEapex if merging new facet into coplanar horizon
-    
+
   returns:
     qh.max_outside and qh.min_vertex updated
     initializes vertex neighbors on first merge
@@ -2232,11 +2236,11 @@
 
     adds neighboring facets to facet_mergeset if redundant or degenerate
 
-  notes: 
-    mindist/maxdist may be NULL
+  notes:
+    mindist/maxdist may be NULL (only if both NULL)
     traces merge if fmax_(maxdist,-mindist) > TRACEdist
 
-  see: 
+  see:
     qh_mergecycle()
 
   design:
@@ -2266,7 +2270,7 @@
 
   if (facet1->tricoplanar || facet2->tricoplanar) {
     if (!qh TRInormals) {
-      fprintf (qh ferr, "qh_mergefacet: does not work for tricoplanar facets.  Use option 'Q11'\n");
+      qh_fprintf(qh ferr, 6226, "Qhull internal error (qh_mergefacet): does not work for tricoplanar facets.  Use option 'Q11'\n");
       qh_errexit2 (qh_ERRqhull, facet1, facet2);
     }
     if (facet2->tricoplanar) {
@@ -2285,40 +2289,40 @@
       tracerestore= 0;
       qh IStracing= qh TRACElevel;
       traceonce= True;
-      fprintf (qh ferr, "qh_mergefacet: ========= trace wide merge #%d (%2.2g) for f%d into f%d, last point was p%d\n", zzval_(Ztotmerge),
-	     fmax_(-*mindist, *maxdist), facet1->id, facet2->id, qh furthest_id);
+      qh_fprintf(qh ferr, 8075, "qh_mergefacet: ========= trace wide merge #%d(%2.2g) for f%d into f%d, last point was p%d\n", zzval_(Ztotmerge),
+             fmax_(-*mindist, *maxdist), facet1->id, facet2->id, qh furthest_id);
     }else if (facet1 == qh tracefacet || facet2 == qh tracefacet) {
       tracerestore= qh IStracing;
       qh IStracing= 4;
       traceonce= True;
-      fprintf (qh ferr, "qh_mergefacet: ========= trace merge #%d involving f%d, furthest is p%d\n",
-		 zzval_(Ztotmerge), qh tracefacet_id,  qh furthest_id);
+      qh_fprintf(qh ferr, 8076, "qh_mergefacet: ========= trace merge #%d involving f%d, furthest is p%d\n",
+                 zzval_(Ztotmerge), qh tracefacet_id,  qh furthest_id);
     }
   }
   if (qh IStracing >= 2) {
     realT mergemin= -2;
     realT mergemax= -2;
-    
+
     if (mindist) {
       mergemin= *mindist;
       mergemax= *maxdist;
     }
-    fprintf (qh ferr, "qh_mergefacet: #%d merge f%d into f%d, mindist= %2.2g, maxdist= %2.2g\n", 
+    qh_fprintf(qh ferr, 8077, "qh_mergefacet: #%d merge f%d into f%d, mindist= %2.2g, maxdist= %2.2g\n",
     zzval_(Ztotmerge), facet1->id, facet2->id, mergemin, mergemax);
   }
 #endif /* !qh_NOtrace */
   if (facet1 == facet2 || facet1->visible || facet2->visible) {
-    fprintf (qh ferr, "qhull internal error (qh_mergefacet): either f%d and f%d are the same or one is a visible facet\n",
-	     facet1->id, facet2->id);
+    qh_fprintf(qh ferr, 6099, "qhull internal error (qh_mergefacet): either f%d and f%d are the same or one is a visible facet\n",
+             facet1->id, facet2->id);
     qh_errexit2 (qh_ERRqhull, facet1, facet2);
   }
   if (qh num_facets - qh num_visible <= qh hull_dim + 1) {
-    fprintf(qh ferr, "\n\
+    qh_fprintf(qh ferr, 6227, "\n\
 qhull precision error: Only %d facets remain.  Can not merge another\n\
 pair.  The input is too degenerate or the convexity constraints are\n\
 too strong.\n", qh hull_dim+1);
     if (qh hull_dim >= 5 && !qh MERGEexact)
-      fprintf(qh ferr, "Option 'Qx' may avoid this problem.\n");
+      qh_fprintf(qh ferr, 8079, "Option 'Qx' may avoid this problem.\n");
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
   if (!qh VERTEXneighbors)
@@ -2326,7 +2330,7 @@
   qh_makeridges(facet1);
   qh_makeridges(facet2);
   if (qh IStracing >=4)
-    qh_errprint ("MERGING", facet1, facet2, NULL, NULL);
+    qh_errprint("MERGING", facet1, facet2, NULL, NULL);
   if (mindist) {
     maximize_(qh max_outside, *maxdist);
     maximize_(qh max_vertex, *maxdist);
@@ -2334,27 +2338,27 @@
     maximize_(facet2->maxoutside, *maxdist);
 #endif
     minimize_(qh min_vertex, *mindist);
-    if (!facet2->keepcentrum 
+    if (!facet2->keepcentrum
     && (*maxdist > qh WIDEfacet || *mindist < -qh WIDEfacet)) {
       facet2->keepcentrum= True;
       zinc_(Zwidefacet);
     }
   }
   nummerge= facet1->nummerge + facet2->nummerge + 1;
-  if (nummerge >= qh_MAXnummerge) 
+  if (nummerge >= qh_MAXnummerge)
     facet2->nummerge= qh_MAXnummerge;
   else
-    facet2->nummerge= nummerge;
+    facet2->nummerge= (short unsigned int)nummerge;
   facet2->newmerge= True;
   facet2->dupridge= False;
   qh_updatetested  (facet1, facet2);
-  if (qh hull_dim > 2 && qh_setsize (facet1->vertices) == qh hull_dim)
-    qh_mergesimplex (facet1, facet2, mergeapex);
+  if (qh hull_dim > 2 && qh_setsize(facet1->vertices) == qh hull_dim)
+    qh_mergesimplex(facet1, facet2, mergeapex);
   else {
     qh vertex_visit++;
     FOREACHvertex_(facet2->vertices)
       vertex->visitid= qh vertex_visit;
-    if (qh hull_dim == 2) 
+    if (qh hull_dim == 2)
       qh_mergefacet2d(facet1, facet2);
     else {
       qh_mergeneighbors(facet1, facet2);
@@ -2363,10 +2367,10 @@
     qh_mergeridges(facet1, facet2);
     qh_mergevertex_neighbors(facet1, facet2);
     if (!facet2->newfacet)
-      qh_newvertices (facet2->vertices);
+      qh_newvertices(facet2->vertices);
   }
   if (!mergeapex)
-    qh_degen_redundant_neighbors (facet2, facet1);
+    qh_degen_redundant_neighbors(facet2, facet1);
   if (facet2->coplanar || !facet2->newfacet) {
     zinc_(Zmergeintohorizon);
   }else if (!facet1->newfacet && facet2->newfacet) {
@@ -2374,14 +2378,14 @@
   }else {
     zinc_(Zmergenew);
   }
-  qh_willdelete (facet1, facet2);
+  qh_willdelete(facet1, facet2);
   qh_removefacet(facet2);  /* append as a newfacet to end of qh facet_list */
   qh_appendfacet(facet2);
   facet2->newfacet= True;
   facet2->tested= False;
-  qh_tracemerge (facet1, facet2);
+  qh_tracemerge(facet1, facet2);
   if (traceonce) {
-    fprintf (qh ferr, "qh_mergefacet: end of wide tracing\n");
+    qh_fprintf(qh ferr, 8080, "qh_mergefacet: end of wide tracing\n");
     qh IStracing= tracerestore;
   }
 } /* mergefacet */
@@ -2389,10 +2393,10 @@
 
 /*---------------------------------
-  
+
   qh_mergefacet2d( facet1, facet2 )
     in 2d, merges neighbors and vertices of facet1 into facet2
-    
+
   returns:
     build ridges for neighbors if necessary
     facet2 looks like a simplicial facet except for centrum, ridges
@@ -2403,14 +2407,14 @@
     qh_mergefacet() retains non-simplicial structures
       they are not needed in 2d, but later routines may use them
     preserves qh.vertex_visit for qh_mergevertex_neighbors()
-  
+
   design:
     get vertices and neighbors
     determine new vertices and neighbors
     set new vertices and neighbors and adjust orientation
     make ridges for new neighbor if needed
 */
-void qh_mergefacet2d (facetT *facet1, facetT *facet2) {
+void qh_mergefacet2d(facetT *facet1, facetT *facet2) {
   vertexT *vertex1A, *vertex1B, *vertex2A, *vertex2B, *vertexA, *vertexB;
   facetT *neighbor1A, *neighbor1B, *neighbor2A, *neighbor2B, *neighborA, *neighborB;
 
@@ -2459,20 +2463,20 @@
     SETfirst_(facet2->neighbors)= neighborB;
     SETsecond_(facet2->neighbors)= neighborA;
   }
-  qh_makeridges (neighborB);
+  qh_makeridges(neighborB);
   qh_setreplace(neighborB->neighbors, facet1, facet2);
-  trace4((qh ferr, "qh_mergefacet2d: merged v%d and neighbor f%d of f%d into f%d\n",
+  trace4((qh ferr, 4036, "qh_mergefacet2d: merged v%d and neighbor f%d of f%d into f%d\n",
        vertexA->id, neighborB->id, facet1->id, facet2->id));
 } /* mergefacet2d */
 
 
 /*---------------------------------
-  
+
   qh_mergeneighbors( facet1, facet2 )
     merges the neighbors of facet1 into facet2
 
-  see: 
+  see:
     qh_mergecycle_neighbors()
 
   design:
@@ -2488,8 +2492,8 @@
 void qh_mergeneighbors(facetT *facet1, facetT *facet2) {
   facetT *neighbor, **neighborp;
 
-  trace4((qh ferr, "qh_mergeneighbors: merge neighbors of f%d and f%d\n",
-	  facet1->id, facet2->id));
+  trace4((qh ferr, 4037, "qh_mergeneighbors: merge neighbors of f%d and f%d\n",
+          facet1->id, facet2->id));
   qh visit_id++;
   FOREACHneighbor_(facet2) {
     neighbor->visitid= qh visit_id;
@@ -2497,9 +2501,9 @@
   FOREACHneighbor_(facet1) {
     if (neighbor->visitid == qh visit_id) {
       if (neighbor->simplicial)    /* is degen, needs ridges */
-	qh_makeridges (neighbor);
+        qh_makeridges(neighbor);
       if (SETfirstt_(neighbor->neighbors, facetT) != facet1) /*keep newfacet->horizon*/
-	qh_setdel (neighbor->neighbors, facet1);
+        qh_setdel(neighbor->neighbors, facet1);
       else {
         qh_setdel(neighbor->neighbors, facet2);
         qh_setreplace(neighbor->neighbors, facet1, facet2);
@@ -2516,7 +2520,7 @@
 
 /*---------------------------------
-  
+
   qh_mergeridges( facet1, facet2 )
     merges the ridge set of facet1 into facet2
 
@@ -2529,16 +2533,16 @@
 
   design:
     delete ridges between facet1 and facet2
-      mark (delridge) vertices on these ridges for later testing   
+      mark (delridge) vertices on these ridges for later testing
     for each remaining ridge
-      rename facet1 to facet2  
+      rename facet1 to facet2
 */
 void qh_mergeridges(facetT *facet1, facetT *facet2) {
   ridgeT *ridge, **ridgep;
   vertexT *vertex, **vertexp;
 
-  trace4((qh ferr, "qh_mergeridges: merge ridges of f%d and f%d\n",
-	  facet1->id, facet2->id));
+  trace4((qh ferr, 4038, "qh_mergeridges: merge ridges of f%d and f%d\n",
+          facet1->id, facet2->id));
   FOREACHridge_(facet2->ridges) {
     if ((ridge->top == facet1) || (ridge->bottom == facet1)) {
       FOREACHvertex_(ridge->vertices)
@@ -2559,7 +2563,7 @@
 
 /*---------------------------------
-  
+
   qh_mergesimplex( facet1, facet2, mergeapex )
     merge simplicial facet1 into facet2
     mergeapex==qh_MERGEapex if merging samecycle into horizon facet
@@ -2572,7 +2576,7 @@
     updated neighbors for facet1's vertices
     facet1 not deleted
     sets vertex->delridge on deleted ridges
-  
+
   notes:
     special case code since this is the most common merge
     called from qh_mergefacet()
@@ -2609,10 +2613,10 @@
 
   if (mergeapex) {
     if (!facet2->newfacet)
-      qh_newvertices (facet2->vertices);  /* apex is new */
+      qh_newvertices(facet2->vertices);  /* apex is new */
     apex= SETfirstt_(facet1->vertices, vertexT);
-    if (SETfirstt_(facet2->vertices, vertexT) != apex) 
-      qh_setaddnth (&facet2->vertices, 0, apex);  /* apex has last id */
+    if (SETfirstt_(facet2->vertices, vertexT) != apex)
+      qh_setaddnth(&facet2->vertices, 0, apex);  /* apex has last id */
     else
       issubset= True;
   }else {
@@ -2621,110 +2625,110 @@
       vertex->seen= False;
     FOREACHridge_(facet1->ridges) {
       if (otherfacet_(ridge, facet1) == facet2) {
-	FOREACHvertex_(ridge->vertices) {
-	  vertex->seen= True;
-	  vertex->delridge= True;
-	}
-	break;
+        FOREACHvertex_(ridge->vertices) {
+          vertex->seen= True;
+          vertex->delridge= True;
+        }
+        break;
       }
     }
     FOREACHvertex_(facet1->vertices) {
       if (!vertex->seen)
-	break;  /* must occur */
+        break;  /* must occur */
     }
     apex= vertex;
-    trace4((qh ferr, "qh_mergesimplex: merge apex v%d of f%d into facet f%d\n",
-	  apex->id, facet1->id, facet2->id));
+    trace4((qh ferr, 4039, "qh_mergesimplex: merge apex v%d of f%d into facet f%d\n",
+          apex->id, facet1->id, facet2->id));
     FOREACHvertex_i_(facet2->vertices) {
       if (vertex->id < apex->id) {
-	break;
+        break;
       }else if (vertex->id == apex->id) {
-	issubset= True;
-	break;
+        issubset= True;
+        break;
       }
     }
     if (!issubset)
-      qh_setaddnth (&facet2->vertices, vertex_i, apex);
+      qh_setaddnth(&facet2->vertices, vertex_i, apex);
     if (!facet2->newfacet)
-      qh_newvertices (facet2->vertices);
+      qh_newvertices(facet2->vertices);
     else if (!apex->newlist) {
-      qh_removevertex (apex);
-      qh_appendvertex (apex);
+      qh_removevertex(apex);
+      qh_appendvertex(apex);
     }
   }
-  trace4((qh ferr, "qh_mergesimplex: update vertex neighbors of f%d\n",
-	  facet1->id));
+  trace4((qh ferr, 4040, "qh_mergesimplex: update vertex neighbors of f%d\n",
+          facet1->id));
   FOREACHvertex_(facet1->vertices) {
     if (vertex == apex && !issubset)
-      qh_setreplace (vertex->neighbors, facet1, facet2);
+      qh_setreplace(vertex->neighbors, facet1, facet2);
     else {
-      qh_setdel (vertex->neighbors, facet1);
+      qh_setdel(vertex->neighbors, facet1);
       if (!SETsecond_(vertex->neighbors))
-	qh_mergevertex_del (vertex, facet1, facet2);
+        qh_mergevertex_del(vertex, facet1, facet2);
     }
   }
-  trace4((qh ferr, "qh_mergesimplex: merge ridges and neighbors of f%d into f%d\n",
-	  facet1->id, facet2->id));
+  trace4((qh ferr, 4041, "qh_mergesimplex: merge ridges and neighbors of f%d into f%d\n",
+          facet1->id, facet2->id));
   qh visit_id++;
   FOREACHneighbor_(facet2)
     neighbor->visitid= qh visit_id;
   FOREACHridge_(facet1->ridges) {
     otherfacet= otherfacet_(ridge, facet1);
     if (otherfacet == facet2) {
-      qh_setdel (facet2->ridges, ridge);
-      qh_setfree(&(ridge->vertices)); 
-      qh_memfree (ridge, sizeof(ridgeT));
-      qh_setdel (facet2->neighbors, facet1);
+      qh_setdel(facet2->ridges, ridge);
+      qh_setfree(&(ridge->vertices));
+      qh_memfree(ridge, (int)sizeof(ridgeT));
+      qh_setdel(facet2->neighbors, facet1);
     }else {
-      qh_setappend (&facet2->ridges, ridge);
+      qh_setappend(&facet2->ridges, ridge);
       if (otherfacet->visitid != qh visit_id) {
-	qh_setappend (&facet2->neighbors, otherfacet);
-	qh_setreplace (otherfacet->neighbors, facet1, facet2);
-	otherfacet->visitid= qh visit_id;
+        qh_setappend(&facet2->neighbors, otherfacet);
+        qh_setreplace(otherfacet->neighbors, facet1, facet2);
+        otherfacet->visitid= qh visit_id;
       }else {
-	if (otherfacet->simplicial)    /* is degen, needs ridges */
-	  qh_makeridges (otherfacet);
-	if (SETfirstt_(otherfacet->neighbors, facetT) != facet1)
-	  qh_setdel (otherfacet->neighbors, facet1);
-	else {   /*keep newfacet->neighbors->horizon*/
-	  qh_setdel(otherfacet->neighbors, facet2);
-	  qh_setreplace(otherfacet->neighbors, facet1, facet2);
-	}
+        if (otherfacet->simplicial)    /* is degen, needs ridges */
+          qh_makeridges(otherfacet);
+        if (SETfirstt_(otherfacet->neighbors, facetT) != facet1)
+          qh_setdel(otherfacet->neighbors, facet1);
+        else {   /*keep newfacet->neighbors->horizon*/
+          qh_setdel(otherfacet->neighbors, facet2);
+          qh_setreplace(otherfacet->neighbors, facet1, facet2);
+        }
       }
       if (ridge->top == facet1) /* wait until after qh_makeridges */
-	ridge->top= facet2;
-      else 
-	ridge->bottom= facet2;
+        ridge->top= facet2;
+      else
+        ridge->bottom= facet2;
     }
   }
   SETfirst_(facet1->ridges)= NULL; /* it will be deleted */
-  trace3((qh ferr, "qh_mergesimplex: merged simplex f%d apex v%d into facet f%d\n",
-	  facet1->id, getid_(apex), facet2->id));
+  trace3((qh ferr, 3006, "qh_mergesimplex: merged simplex f%d apex v%d into facet f%d\n",
+          facet1->id, getid_(apex), facet2->id));
 } /* mergesimplex */
 
 /*---------------------------------
-  
+
   qh_mergevertex_del( vertex, facet1, facet2 )
     delete a vertex because of merging facet1 into facet2
 
   returns:
     deletes vertex from facet2
-    adds vertex to qh.del_vertices for later deletion 
+    adds vertex to qh.del_vertices for later deletion
 */
-void qh_mergevertex_del (vertexT *vertex, facetT *facet1, facetT *facet2) {
+void qh_mergevertex_del(vertexT *vertex, facetT *facet1, facetT *facet2) {
 
   zinc_(Zmergevertex);
-  trace2((qh ferr, "qh_mergevertex_del: deleted v%d when merging f%d into f%d\n",
+  trace2((qh ferr, 2035, "qh_mergevertex_del: deleted v%d when merging f%d into f%d\n",
           vertex->id, facet1->id, facet2->id));
-  qh_setdelsorted (facet2->vertices, vertex);
+  qh_setdelsorted(facet2->vertices, vertex);
   vertex->deleted= True;
-  qh_setappend (&qh del_vertices, vertex);
+  qh_setappend(&qh del_vertices, vertex);
 } /* mergevertex_del */
 
 /*---------------------------------
-  
+
   qh_mergevertex_neighbors( facet1, facet2 )
     merge the vertex neighbors of facet1 to facet2
 
@@ -2732,39 +2736,39 @@
     if vertex is current qh.vertex_visit
       deletes facet1 from vertex->neighbors
     else
-      renames facet1 to facet2 in vertex->neighbors 
+      renames facet1 to facet2 in vertex->neighbors
     deletes vertices if only one neighbor
-  
+
   notes:
     assumes vertex neighbor sets are good
 */
 void qh_mergevertex_neighbors(facetT *facet1, facetT *facet2) {
   vertexT *vertex, **vertexp;
 
-  trace4((qh ferr, "qh_mergevertex_neighbors: merge vertex neighbors of f%d and f%d\n",
-	  facet1->id, facet2->id));
+  trace4((qh ferr, 4042, "qh_mergevertex_neighbors: merge vertex neighbors of f%d and f%d\n",
+          facet1->id, facet2->id));
   if (qh tracevertex) {
-    fprintf (qh ferr, "qh_mergevertex_neighbors: of f%d and f%d at furthest p%d f0= %p\n",
-	     facet1->id, facet2->id, qh furthest_id, qh tracevertex->neighbors->e[0].p);
-    qh_errprint ("TRACE", NULL, NULL, NULL, qh tracevertex);
+    qh_fprintf(qh ferr, 8081, "qh_mergevertex_neighbors: of f%d and f%d at furthest p%d f0= %p\n",
+             facet1->id, facet2->id, qh furthest_id, qh tracevertex->neighbors->e[0].p);
+    qh_errprint("TRACE", NULL, NULL, NULL, qh tracevertex);
   }
   FOREACHvertex_(facet1->vertices) {
-    if (vertex->visitid != qh vertex_visit) 
+    if (vertex->visitid != qh vertex_visit)
       qh_setreplace(vertex->neighbors, facet1, facet2);
     else {
       qh_setdel(vertex->neighbors, facet1);
       if (!SETsecond_(vertex->neighbors))
-	qh_mergevertex_del (vertex, facet1, facet2);
+        qh_mergevertex_del(vertex, facet1, facet2);
     }
   }
-  if (qh tracevertex) 
-    qh_errprint ("TRACE", NULL, NULL, NULL, qh tracevertex);
+  if (qh tracevertex)
+    qh_errprint("TRACE", NULL, NULL, NULL, qh tracevertex);
 } /* mergevertex_neighbors */
 
 
 /*---------------------------------
-  
+
   qh_mergevertices( vertices1, vertices2 )
     merges the vertex set of facet1 into facet2
 
@@ -2781,34 +2785,34 @@
   setT *mergedvertices;
   vertexT *vertex, **vertexp, **vertex2= SETaddr_(*vertices2, vertexT);
 
-  mergedvertices= qh_settemp (newsize);
+  mergedvertices= qh_settemp(newsize);
   FOREACHvertex_(vertices1) {
     if (!*vertex2 || vertex->id > (*vertex2)->id)
-      qh_setappend (&mergedvertices, vertex);
+      qh_setappend(&mergedvertices, vertex);
     else {
       while (*vertex2 && (*vertex2)->id > vertex->id)
-	qh_setappend (&mergedvertices, *vertex2++);
+        qh_setappend(&mergedvertices, *vertex2++);
       if (!*vertex2 || (*vertex2)->id < vertex->id)
-	qh_setappend (&mergedvertices, vertex);
+        qh_setappend(&mergedvertices, vertex);
       else
-	qh_setappend (&mergedvertices, *vertex2++);
+        qh_setappend(&mergedvertices, *vertex2++);
     }
   }
   while (*vertex2)
-    qh_setappend (&mergedvertices, *vertex2++);
-  if (newsize < qh_setsize (mergedvertices)) {
-    fprintf (qh ferr, "qhull internal error (qh_mergevertices): facets did not share a ridge\n");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_setappend(&mergedvertices, *vertex2++);
+  if (newsize < qh_setsize(mergedvertices)) {
+    qh_fprintf(qh ferr, 6100, "qhull internal error (qh_mergevertices): facets did not share a ridge\n");
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   qh_setfree(vertices2);
   *vertices2= mergedvertices;
-  qh_settemppop ();
+  qh_settemppop();
 } /* mergevertices */
 
 
 /*---------------------------------
-  
+
   qh_neighbor_intersections( vertex )
     return intersection of all vertices in vertex->neighbors except for vertex
 
@@ -2817,7 +2821,7 @@
     does not include vertex
     NULL if a neighbor is simplicial
     NULL if empty set
-    
+
   notes:
     used for renaming vertices
 
@@ -2827,9 +2831,9 @@
     for each remaining neighbor
       intersect its vertex set with the intersection set
       return NULL if empty
-    return the intersection set  
+    return the intersection set
 */
-setT *qh_neighbor_intersections (vertexT *vertex) {
+setT *qh_neighbor_intersections(vertexT *vertex) {
   facetT *neighbor, **neighborp, *neighborA, *neighborB;
   setT *intersect;
   int neighbor_i, neighbor_n;
@@ -2844,30 +2848,30 @@
   if (!neighborA)
     return NULL;
   if (!neighborB)
-    intersect= qh_setcopy (neighborA->vertices, 0);
+    intersect= qh_setcopy(neighborA->vertices, 0);
   else
-    intersect= qh_vertexintersect_new (neighborA->vertices, neighborB->vertices);
-  qh_settemppush (intersect);
-  qh_setdelsorted (intersect, vertex);
+    intersect= qh_vertexintersect_new(neighborA->vertices, neighborB->vertices);
+  qh_settemppush(intersect);
+  qh_setdelsorted(intersect, vertex);
   FOREACHneighbor_i_(vertex) {
     if (neighbor_i >= 2) {
       zinc_(Zintersectnum);
-      qh_vertexintersect (&intersect, neighbor->vertices);
+      qh_vertexintersect(&intersect, neighbor->vertices);
       if (!SETfirst_(intersect)) {
         zinc_(Zintersectfail);
-        qh_settempfree (&intersect);
+        qh_settempfree(&intersect);
         return NULL;
       }
     }
   }
-  trace3((qh ferr, "qh_neighbor_intersections: %d vertices in neighbor intersection of v%d\n", 
-          qh_setsize (intersect), vertex->id));
+  trace3((qh ferr, 3007, "qh_neighbor_intersections: %d vertices in neighbor intersection of v%d\n",
+          qh_setsize(intersect), vertex->id));
   return intersect;
 } /* neighbor_intersections */
 
 /*---------------------------------
-  
+
   qh_newvertices( vertices )
     add vertices to end of qh.vertex_list (marks as new vertices)
 
@@ -2875,20 +2879,20 @@
     vertices on qh.newvertex_list
     vertex->newlist set
 */
-void qh_newvertices (setT *vertices) {
+void qh_newvertices(setT *vertices) {
   vertexT *vertex, **vertexp;
 
   FOREACHvertex_(vertices) {
     if (!vertex->newlist) {
-      qh_removevertex (vertex);
-      qh_appendvertex (vertex);
+      qh_removevertex(vertex);
+      qh_appendvertex(vertex);
     }
   }
 } /* newvertices */
 
 /*---------------------------------
-  
+
   qh_reducevertices()
     reduce extra vertices, shared vertices, and redundant vertices
     facet->newmerge is set if merged since last call
@@ -2913,22 +2917,22 @@
             rename vertex if it is shared
       remove delridge flag from new vertices
 */
-boolT qh_reducevertices (void) {
+boolT qh_reducevertices(void) {
   int numshare=0, numrename= 0;
   boolT degenredun= False;
   facetT *newfacet;
   vertexT *vertex, **vertexp;
 
-  if (qh hull_dim == 2) 
+  if (qh hull_dim == 2)
     return False;
   if (qh_merge_degenredundant())
     degenredun= True;
  LABELrestart:
   FORALLnew_facets {
-    if (newfacet->newmerge) { 
+    if (newfacet->newmerge) {
       if (!qh MERGEvertices)
         newfacet->newmerge= False;
-      qh_remove_extravertices (newfacet);
+      qh_remove_extravertices(newfacet);
     }
   }
   if (!qh MERGEvertices)
@@ -2937,11 +2941,11 @@
     if (newfacet->newmerge) {
       newfacet->newmerge= False;
       FOREACHvertex_(newfacet->vertices) {
-	if (vertex->delridge) {
-	  if (qh_rename_sharedvertex (vertex, newfacet)) {
-	    numshare++;
-	    vertexp--; /* repeat since deleted vertex */
-	  }
+        if (vertex->delridge) {
+          if (qh_rename_sharedvertex(vertex, newfacet)) {
+            numshare++;
+            vertexp--; /* repeat since deleted vertex */
+          }
         }
       }
     }
@@ -2949,31 +2953,31 @@
   FORALLvertex_(qh newvertex_list) {
     if (vertex->delridge && !vertex->deleted) {
       vertex->delridge= False;
-      if (qh hull_dim >= 4 && qh_redundant_vertex (vertex)) {
-	numrename++;
-	if (qh_merge_degenredundant()) {
-	  degenredun= True;
-	  goto LABELrestart;
-	}
+      if (qh hull_dim >= 4 && qh_redundant_vertex(vertex)) {
+        numrename++;
+        if (qh_merge_degenredundant()) {
+          degenredun= True;
+          goto LABELrestart;
+        }
       }
     }
   }
-  trace1((qh ferr, "qh_reducevertices: renamed %d shared vertices and %d redundant vertices. Degen? %d\n",
-	  numshare, numrename, degenredun));
+  trace1((qh ferr, 1014, "qh_reducevertices: renamed %d shared vertices and %d redundant vertices. Degen? %d\n",
+          numshare, numrename, degenredun));
   return degenredun;
 } /* reducevertices */
-      
+
 /*---------------------------------
-  
+
   qh_redundant_vertex( vertex )
     detect and rename a redundant vertex
-    vertices have full vertex->neighbors 
+    vertices have full vertex->neighbors
 
   returns:
     returns true if find a redundant vertex
-      deletes vertex (vertex->deleted)
-  
+      deletes vertex(vertex->deleted)
+
   notes:
     only needed if vertex->delridge and hull_dim >= 4
     may add degenerate facets to qh.facet_mergeset
@@ -2985,24 +2989,24 @@
     if find a new vertex for vertex amoung these ridges and vertices
       rename vertex to the new vertex
 */
-vertexT *qh_redundant_vertex (vertexT *vertex) {
+vertexT *qh_redundant_vertex(vertexT *vertex) {
   vertexT *newvertex= NULL;
   setT *vertices, *ridges;
 
-  trace3((qh ferr, "qh_redundant_vertex: check if v%d can be renamed\n", vertex->id));  
-  if ((vertices= qh_neighbor_intersections (vertex))) {
-    ridges= qh_vertexridges (vertex);
-    if ((newvertex= qh_find_newvertex (vertex, vertices, ridges)))
-      qh_renamevertex (vertex, newvertex, ridges, NULL, NULL);
-    qh_settempfree (&ridges);
-    qh_settempfree (&vertices);
+  trace3((qh ferr, 3008, "qh_redundant_vertex: check if v%d can be renamed\n", vertex->id));
+  if ((vertices= qh_neighbor_intersections(vertex))) {
+    ridges= qh_vertexridges(vertex);
+    if ((newvertex= qh_find_newvertex(vertex, vertices, ridges)))
+      qh_renamevertex(vertex, newvertex, ridges, NULL, NULL);
+    qh_settempfree(&ridges);
+    qh_settempfree(&vertices);
   }
   return newvertex;
 } /* redundant_vertex */
 
 /*---------------------------------
-  
+
   qh_remove_extravertices( facet )
     remove extra vertices from non-simplicial facets
 
@@ -3017,16 +3021,16 @@
         unless vertex in another facet
           add vertex to qh.del_vertices for later deletion
 */
-boolT qh_remove_extravertices (facetT *facet) {
+boolT qh_remove_extravertices(facetT *facet) {
   ridgeT *ridge, **ridgep;
   vertexT *vertex, **vertexp;
   boolT foundrem= False;
 
-  trace4((qh ferr, "qh_remove_extravertices: test f%d for extra vertices\n",
-	  facet->id));
+  trace4((qh ferr, 4043, "qh_remove_extravertices: test f%d for extra vertices\n",
+          facet->id));
   FOREACHvertex_(facet->vertices)
     vertex->seen= False;
-  FOREACHridge_(facet->ridges) { 
+  FOREACHridge_(facet->ridges) {
     FOREACHvertex_(ridge->vertices)
       vertex->seen= True;
   }
@@ -3034,15 +3038,15 @@
     if (!vertex->seen) {
       foundrem= True;
       zinc_(Zremvertex);
-      qh_setdelsorted (facet->vertices, vertex);
-      qh_setdel (vertex->neighbors, facet);
-      if (!qh_setsize (vertex->neighbors)) {
-	vertex->deleted= True;
-	qh_setappend (&qh del_vertices, vertex);
-	zinc_(Zremvertexdel);
-	trace2((qh ferr, "qh_remove_extravertices: v%d deleted because it's lost all ridges\n", vertex->id));
+      qh_setdelsorted(facet->vertices, vertex);
+      qh_setdel(vertex->neighbors, facet);
+      if (!qh_setsize(vertex->neighbors)) {
+        vertex->deleted= True;
+        qh_setappend(&qh del_vertices, vertex);
+        zinc_(Zremvertexdel);
+        trace2((qh ferr, 2036, "qh_remove_extravertices: v%d deleted because it's lost all ridges\n", vertex->id));
       }else
-	trace3((qh ferr, "qh_remove_extravertices: v%d removed from f%d because it's lost all ridges\n", vertex->id, facet->id));
+        trace3((qh ferr, 3009, "qh_remove_extravertices: v%d removed from f%d because it's lost all ridges\n", vertex->id, facet->id));
       vertexp--; /*repeat*/
     }
   }
@@ -3051,7 +3055,7 @@
 
 /*---------------------------------
-  
+
   qh_rename_sharedvertex( vertex, facet )
     detect and rename if shared vertex in facet
     vertices have full ->neighbors
@@ -3061,11 +3065,11 @@
     the vertex may still exist in other facets (i.e., a neighbor was pinched)
     does not change facet->neighbors
     updates vertex->neighbors
-  
+
   notes:
     a shared vertex for a facet is only in ridges to one neighbor
     this may undo a pinched facet
- 
+
     it does not catch pinches involving multiple facets.  These appear
       to be difficult to detect, since an exhaustive search is too expensive.
 
@@ -3076,12 +3080,12 @@
       if can find a new vertex in this set
         rename the vertex to the new vertex
 */
-vertexT *qh_rename_sharedvertex (vertexT *vertex, facetT *facet) {
+vertexT *qh_rename_sharedvertex(vertexT *vertex, facetT *facet) {
   facetT *neighbor, **neighborp, *neighborA= NULL;
   setT *vertices, *ridges;
   vertexT *newvertex;
 
-  if (qh_setsize (vertex->neighbors) == 2) {
+  if (qh_setsize(vertex->neighbors) == 2) {
     neighborA= SETfirstt_(vertex->neighbors, facetT);
     if (neighborA == facet)
       neighborA= SETsecondt_(vertex->neighbors, facetT);
@@ -3099,37 +3103,37 @@
       }
     }
     if (!neighborA) {
-      fprintf (qh ferr, "qhull internal error (qh_rename_sharedvertex): v%d's neighbors not in f%d\n",
+      qh_fprintf(qh ferr, 6101, "qhull internal error (qh_rename_sharedvertex): v%d's neighbors not in f%d\n",
         vertex->id, facet->id);
-      qh_errprint ("ERRONEOUS", facet, NULL, NULL, vertex);
-      qh_errexit (qh_ERRqhull, NULL, NULL);
+      qh_errprint("ERRONEOUS", facet, NULL, NULL, vertex);
+      qh_errexit(qh_ERRqhull, NULL, NULL);
     }
   }
   /* the vertex is shared by facet and neighborA */
-  ridges= qh_settemp (qh TEMPsize);
+  ridges= qh_settemp(qh TEMPsize);
   neighborA->visitid= ++qh visit_id;
-  qh_vertexridges_facet (vertex, facet, &ridges);
-  trace2((qh ferr, "qh_rename_sharedvertex: p%d (v%d) is shared by f%d (%d ridges) and f%d\n",
-    qh_pointid(vertex->point), vertex->id, facet->id, qh_setsize (ridges), neighborA->id));
+  qh_vertexridges_facet(vertex, facet, &ridges);
+  trace2((qh ferr, 2037, "qh_rename_sharedvertex: p%d(v%d) is shared by f%d(%d ridges) and f%d\n",
+    qh_pointid(vertex->point), vertex->id, facet->id, qh_setsize(ridges), neighborA->id));
   zinc_(Zintersectnum);
-  vertices= qh_vertexintersect_new (facet->vertices, neighborA->vertices);
-  qh_setdel (vertices, vertex);
-  qh_settemppush (vertices);
-  if ((newvertex= qh_find_newvertex (vertex, vertices, ridges))) 
-    qh_renamevertex (vertex, newvertex, ridges, facet, neighborA);
-  qh_settempfree (&vertices);
-  qh_settempfree (&ridges);
+  vertices= qh_vertexintersect_new(facet->vertices, neighborA->vertices);
+  qh_setdel(vertices, vertex);
+  qh_settemppush(vertices);
+  if ((newvertex= qh_find_newvertex(vertex, vertices, ridges)))
+    qh_renamevertex(vertex, newvertex, ridges, facet, neighborA);
+  qh_settempfree(&vertices);
+  qh_settempfree(&ridges);
   return newvertex;
 } /* rename_sharedvertex */
 
 /*---------------------------------
-  
+
   qh_renameridgevertex( ridge, oldvertex, newvertex )
     renames oldvertex as newvertex in ridge
 
   returns:
-  
+
   design:
     delete oldvertex from ridge
     if newvertex already in ridge
@@ -3144,15 +3148,15 @@
   facetT *temp;
   vertexT *vertex, **vertexp;
 
-  oldnth= qh_setindex (ridge->vertices, oldvertex);
-  qh_setdelnthsorted (ridge->vertices, oldnth);
+  oldnth= qh_setindex(ridge->vertices, oldvertex);
+  qh_setdelnthsorted(ridge->vertices, oldnth);
   FOREACHvertex_(ridge->vertices) {
     if (vertex == newvertex) {
       zinc_(Zdelridge);
       if (ridge->nonconvex) /* only one ridge has nonconvex set */
-	qh_copynonconvex (ridge);
-      qh_delridge (ridge);
-      trace2((qh ferr, "qh_renameridgevertex: ridge r%d deleted.  It contained both v%d and v%d\n",
+        qh_copynonconvex(ridge);
+      qh_delridge(ridge);
+      trace2((qh ferr, 2038, "qh_renameridgevertex: ridge r%d deleted.  It contained both v%d and v%d\n",
         ridge->id, oldvertex->id, newvertex->id));
       return;
     }
@@ -3162,8 +3166,8 @@
   }
   qh_setaddnth(&ridge->vertices, nth, newvertex);
   if (abs(oldnth - nth)%2) {
-    trace3((qh ferr, "qh_renameridgevertex: swapped the top and bottom of ridge r%d\n", 
-	    ridge->id));
+    trace3((qh ferr, 3010, "qh_renameridgevertex: swapped the top and bottom of ridge r%d\n",
+            ridge->id));
     temp= ridge->top;
     ridge->top= ridge->bottom;
     ridge->bottom= temp;
@@ -3173,15 +3177,15 @@
 
 /*---------------------------------
-  
+
   qh_renamevertex( oldvertex, newvertex, ridges, oldfacet, neighborA )
-    renames oldvertex as newvertex in ridges 
+    renames oldvertex as newvertex in ridges
     gives oldfacet/neighborA if oldvertex is shared between two facets
 
   returns:
     oldvertex may still exist afterwards
-    
 
+
   notes:
     can not change neighbors of newvertex (since it's a subset)
 
@@ -3207,53 +3211,53 @@
   boolT istrace= False;
 
   if (qh IStracing >= 2 || oldvertex->id == qh tracevertex_id ||
-	newvertex->id == qh tracevertex_id)
+        newvertex->id == qh tracevertex_id)
     istrace= True;
-  FOREACHridge_(ridges) 
-    qh_renameridgevertex (ridge, oldvertex, newvertex);
+  FOREACHridge_(ridges)
+    qh_renameridgevertex(ridge, oldvertex, newvertex);
   if (!oldfacet) {
     zinc_(Zrenameall);
     if (istrace)
-      fprintf (qh ferr, "qh_renamevertex: renamed v%d to v%d in several facets\n",
+      qh_fprintf(qh ferr, 8082, "qh_renamevertex: renamed v%d to v%d in several facets\n",
                oldvertex->id, newvertex->id);
     FOREACHneighbor_(oldvertex) {
-      qh_maydropneighbor (neighbor);
-      qh_setdelsorted (neighbor->vertices, oldvertex);
-      if (qh_remove_extravertices (neighbor))
+      qh_maydropneighbor(neighbor);
+      qh_setdelsorted(neighbor->vertices, oldvertex);
+      if (qh_remove_extravertices(neighbor))
         neighborp--; /* neighbor may be deleted */
     }
     if (!oldvertex->deleted) {
       oldvertex->deleted= True;
-      qh_setappend (&qh del_vertices, oldvertex);
+      qh_setappend(&qh del_vertices, oldvertex);
     }
-  }else if (qh_setsize (oldvertex->neighbors) == 2) {
+  }else if (qh_setsize(oldvertex->neighbors) == 2) {
     zinc_(Zrenameshare);
     if (istrace)
-      fprintf (qh ferr, "qh_renamevertex: renamed v%d to v%d in oldfacet f%d\n", 
+      qh_fprintf(qh ferr, 8083, "qh_renamevertex: renamed v%d to v%d in oldfacet f%d\n",
                oldvertex->id, newvertex->id, oldfacet->id);
     FOREACHneighbor_(oldvertex)
-      qh_setdelsorted (neighbor->vertices, oldvertex);
+      qh_setdelsorted(neighbor->vertices, oldvertex);
     oldvertex->deleted= True;
-    qh_setappend (&qh del_vertices, oldvertex);
+    qh_setappend(&qh del_vertices, oldvertex);
   }else {
     zinc_(Zrenamepinch);
     if (istrace || qh IStracing)
-      fprintf (qh ferr, "qh_renamevertex: renamed pinched v%d to v%d between f%d and f%d\n", 
+      qh_fprintf(qh ferr, 8084, "qh_renamevertex: renamed pinched v%d to v%d between f%d and f%d\n",
                oldvertex->id, newvertex->id, oldfacet->id, neighborA->id);
-    qh_setdelsorted (oldfacet->vertices, oldvertex);
-    qh_setdel (oldvertex->neighbors, oldfacet);
-    qh_remove_extravertices (neighborA);
+    qh_setdelsorted(oldfacet->vertices, oldvertex);
+    qh_setdel(oldvertex->neighbors, oldfacet);
+    qh_remove_extravertices(neighborA);
   }
 } /* renamevertex */
 
 
 /*---------------------------------
-  
+
   qh_test_appendmerge( facet, neighbor )
     tests facet/neighbor for convexity
     appends to mergeset if non-convex
-    if pre-merging, 
+    if pre-merging,
       nop if qh.SKIPconvex, or qh.MERGEexact and coplanar
 
   returns:
@@ -3281,7 +3285,7 @@
      get angle if needed
      append concave or coplanar merge to qh.mergeset
 */
-boolT qh_test_appendmerge (facetT *facet, facetT *neighbor) {
+boolT qh_test_appendmerge(facetT *facet, facetT *neighbor) {
   realT dist, dist2= -REALmax, angle= -REALmax;
   boolT isconcave= False, iscoplanar= False, okangle= False;
 
@@ -3293,14 +3297,14 @@
     if (angle > qh cos_max) {
       zinc_(Zcoplanarangle);
       qh_appendmergeset(facet, neighbor, MRGanglecoplanar, &angle);
-      trace2((qh ferr, "qh_test_appendmerge: coplanar angle %4.4g between f%d and f%d\n",
+      trace2((qh ferr, 2039, "qh_test_appendmerge: coplanar angle %4.4g between f%d and f%d\n",
          angle, facet->id, neighbor->id));
       return True;
     }else
       okangle= True;
   }
   if (!facet->center)
-    facet->center= qh_getcentrum (facet);
+    facet->center= qh_getcentrum(facet);
   zzinc_(Zcentrumtests);
   qh_distplane(facet->center, neighbor, &dist);
   if (dist > qh centrum_radius)
@@ -3309,7 +3313,7 @@
     if (dist > -qh centrum_radius)
       iscoplanar= True;
     if (!neighbor->center)
-      neighbor->center= qh_getcentrum (neighbor);
+      neighbor->center= qh_getcentrum(neighbor);
     zzinc_(Zcentrumtests);
     qh_distplane(neighbor->center, facet, &dist2);
     if (dist2 > qh centrum_radius)
@@ -3328,20 +3332,20 @@
     if (qh ANGLEmerge)
       angle += qh_ANGLEconcave + 0.5;
     qh_appendmergeset(facet, neighbor, MRGconcave, &angle);
-    trace0((qh ferr, "qh_test_appendmerge: concave f%d to f%d dist %4.4g and reverse dist %4.4g angle %4.4g during p%d\n",
-	   facet->id, neighbor->id, dist, dist2, angle, qh furthest_id));
+    trace0((qh ferr, 18, "qh_test_appendmerge: concave f%d to f%d dist %4.4g and reverse dist %4.4g angle %4.4g during p%d\n",
+           facet->id, neighbor->id, dist, dist2, angle, qh furthest_id));
   }else /* iscoplanar */ {
     zinc_(Zcoplanarcentrum);
     qh_appendmergeset(facet, neighbor, MRGcoplanar, &angle);
-    trace2((qh ferr, "qh_test_appendmerge: coplanar f%d to f%d dist %4.4g, reverse dist %4.4g angle %4.4g\n",
-	      facet->id, neighbor->id, dist, dist2, angle));
+    trace2((qh ferr, 2040, "qh_test_appendmerge: coplanar f%d to f%d dist %4.4g, reverse dist %4.4g angle %4.4g\n",
+              facet->id, neighbor->id, dist, dist2, angle));
   }
   return True;
 } /* test_appendmerge */
 
 /*---------------------------------
-  
+
   qh_test_vneighbors()
     test vertex neighbors for convexity
     tests all facets on qh.newfacet_list
@@ -3364,15 +3368,15 @@
         for each unvisited facet neighbor of the vertex
           test new facet and neighbor for convexity
 */
-boolT qh_test_vneighbors (void /* qh newfacet_list */) {
+boolT qh_test_vneighbors(void /* qh newfacet_list */) {
   facetT *newfacet, *neighbor, **neighborp;
   vertexT *vertex, **vertexp;
   int nummerges= 0;
 
-  trace1((qh ferr, "qh_test_vneighbors: testing vertex neighbors for convexity\n"));
+  trace1((qh ferr, 1015, "qh_test_vneighbors: testing vertex neighbors for convexity\n"));
   if (!qh VERTEXneighbors)
     qh_vertexneighbors();
-  FORALLnew_facets 
+  FORALLnew_facets
     newfacet->seen= False;
   FORALLnew_facets {
     newfacet->seen= True;
@@ -3381,54 +3385,54 @@
       newfacet->visitid= qh visit_id;
     FOREACHvertex_(newfacet->vertices) {
       FOREACHneighbor_(vertex) {
-      	if (neighbor->seen || neighbor->visitid == qh visit_id)
-      	  continue;
-      	if (qh_test_appendmerge (newfacet, neighbor))
+        if (neighbor->seen || neighbor->visitid == qh visit_id)
+          continue;
+        if (qh_test_appendmerge(newfacet, neighbor))
           nummerges++;
       }
     }
   }
   zadd_(Ztestvneighbor, nummerges);
-  trace1((qh ferr, "qh_test_vneighbors: found %d non-convex, vertex neighbors\n",
+  trace1((qh ferr, 1016, "qh_test_vneighbors: found %d non-convex, vertex neighbors\n",
            nummerges));
-  return (nummerges > 0);    
+  return (nummerges > 0);
 } /* test_vneighbors */
 
 /*---------------------------------
-  
+
   qh_tracemerge( facet1, facet2 )
     print trace message after merge
 */
-void qh_tracemerge (facetT *facet1, facetT *facet2) {
+void qh_tracemerge(facetT *facet1, facetT *facet2) {
   boolT waserror= False;
 
 #ifndef qh_NOtrace
-  if (qh IStracing >= 4) 
-    qh_errprint ("MERGED", facet2, NULL, NULL, NULL);
+  if (qh IStracing >= 4)
+    qh_errprint("MERGED", facet2, NULL, NULL, NULL);
   if (facet2 == qh tracefacet || (qh tracevertex && qh tracevertex->newlist)) {
-    fprintf (qh ferr, "qh_tracemerge: trace facet and vertex after merge of f%d and f%d, furthest p%d\n", facet1->id, facet2->id, qh furthest_id);
+    qh_fprintf(qh ferr, 8085, "qh_tracemerge: trace facet and vertex after merge of f%d and f%d, furthest p%d\n", facet1->id, facet2->id, qh furthest_id);
     if (facet2 != qh tracefacet)
-      qh_errprint ("TRACE", qh tracefacet, 
-        (qh tracevertex && qh tracevertex->neighbors) ? 
+      qh_errprint("TRACE", qh tracefacet,
+        (qh tracevertex && qh tracevertex->neighbors) ?
            SETfirstt_(qh tracevertex->neighbors, facetT) : NULL,
-        NULL, qh tracevertex);      
+        NULL, qh tracevertex);
   }
   if (qh tracevertex) {
     if (qh tracevertex->deleted)
-      fprintf (qh ferr, "qh_tracemerge: trace vertex deleted at furthest p%d\n",
-	    qh furthest_id);
+      qh_fprintf(qh ferr, 8086, "qh_tracemerge: trace vertex deleted at furthest p%d\n",
+            qh furthest_id);
     else
-      qh_checkvertex (qh tracevertex);
+      qh_checkvertex(qh tracevertex);
   }
   if (qh tracefacet) {
-    qh_checkfacet (qh tracefacet, True, &waserror);
+    qh_checkfacet(qh tracefacet, True, &waserror);
     if (waserror)
-      qh_errexit (qh_ERRqhull, qh tracefacet, NULL);
+      qh_errexit(qh_ERRqhull, qh tracefacet, NULL);
   }
 #endif /* !qh_NOtrace */
   if (qh CHECKfrequently || qh IStracing >= 4) { /* can't check polygon here */
-    qh_checkfacet (facet2, True, &waserror);
+    qh_checkfacet(facet2, True, &waserror);
     if (waserror)
       qh_errexit(qh_ERRqhull, NULL, NULL);
   }
@@ -3436,42 +3440,42 @@
 
 /*---------------------------------
-  
+
   qh_tracemerging()
     print trace message during POSTmerging
 
   returns:
     updates qh.mergereport
-  
+
   notes:
     called from qh_mergecycle() and qh_mergefacet()
-  
+
   see:
     qh_buildtracing()
 */
-void qh_tracemerging (void) {
+void qh_tracemerging(void) {
   realT cpu;
   int total;
   time_t timedata;
   struct tm *tp;
 
   qh mergereport= zzval_(Ztotmerge);
-  time (&timedata);
-  tp= localtime (&timedata);
+  time(&timedata);
+  tp= localtime(&timedata);
   cpu= qh_CPUclock;
   cpu /= qh_SECticks;
   total= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
-  fprintf (qh ferr, "\n\
+  qh_fprintf(qh ferr, 8087, "\n\
 At %d:%d:%d & %2.5g CPU secs, qhull has merged %d facets.  The hull\n\
   contains %d facets and %d vertices.\n",
       tp->tm_hour, tp->tm_min, tp->tm_sec, cpu,
       total, qh num_facets - qh num_visible,
-      qh num_vertices-qh_setsize (qh del_vertices));
+      qh num_vertices-qh_setsize(qh del_vertices));
 } /* tracemerging */
 
 /*---------------------------------
-  
+
   qh_updatetested( facet1, facet2 )
     clear facet2->tested and facet1->ridge->tested for merge
 
@@ -3484,23 +3488,23 @@
     clear ridge->tested for facet1's ridges
     if facet2 has a centrum
       if facet2 is large
-        set facet2->keepcentrum 
+        set facet2->keepcentrum
       else if facet2 has 3 vertices due to many merges, or not large and post merging
         clear facet2->keepcentrum
       unless facet2->keepcentrum
         clear facet2->center to recompute centrum later
         clear ridge->tested for facet2's ridges
 */
-void qh_updatetested (facetT *facet1, facetT *facet2) {
+void qh_updatetested(facetT *facet1, facetT *facet2) {
   ridgeT *ridge, **ridgep;
   int size;
-  
+
   facet2->tested= False;
   FOREACHridge_(facet1->ridges)
     ridge->tested= False;
   if (!facet2->center)
     return;
-  size= qh_setsize (facet2->vertices);
+  size= qh_setsize(facet2->vertices);
   if (!facet2->keepcentrum) {
     if (size > qh hull_dim + qh_MAXnewcentrum) {
       facet2->keepcentrum= True;
@@ -3512,7 +3516,7 @@
       facet2->keepcentrum= False; /* if many merges need to recompute centrum */
   }
   if (!facet2->keepcentrum) {
-    qh_memfree (facet2->center, qh normal_size);
+    qh_memfree(facet2->center, qh normal_size);
     facet2->center= NULL;
     FOREACHridge_(facet2->ridges)
       ridge->tested= False;
@@ -3521,7 +3525,7 @@
 
 /*---------------------------------
-  
+
   qh_vertexridges( vertex )
     return temporary set of ridges adjacent to a vertex
     vertex->neighbors defined
@@ -3532,11 +3536,11 @@
 
   design:
     for each neighbor of vertex
-      add ridges that include the vertex to ridges  
+      add ridges that include the vertex to ridges
 */
-setT *qh_vertexridges (vertexT *vertex) {
+setT *qh_vertexridges(vertexT *vertex) {
   facetT *neighbor, **neighborp;
-  setT *ridges= qh_settemp (qh TEMPsize);
+  setT *ridges= qh_settemp(qh TEMPsize);
   int size;
 
   qh visit_id++;
@@ -3544,14 +3548,14 @@
     neighbor->visitid= qh visit_id;
   FOREACHneighbor_(vertex) {
     if (*neighborp)   /* no new ridges in last neighbor */
-      qh_vertexridges_facet (vertex, neighbor, &ridges);
+      qh_vertexridges_facet(vertex, neighbor, &ridges);
   }
   if (qh PRINTstatistics || qh IStracing) {
-    size= qh_setsize (ridges);
+    size= qh_setsize(ridges);
     zinc_(Zvertexridge);
     zadd_(Zvertexridgetot, size);
     zmax_(Zvertexridgemax, size);
-    trace3((qh ferr, "qh_vertexridges: found %d ridges for v%d\n",
+    trace3((qh ferr, 3011, "qh_vertexridges: found %d ridges for v%d\n",
              size, vertex->id));
   }
   return ridges;
@@ -3559,7 +3563,7 @@
 
 /*---------------------------------
-  
+
   qh_vertexridges_facet( vertex, facet, ridges )
     add adjacent ridges for vertex in facet
     neighbor->visitid==qh.visit_id if it hasn't been visited
@@ -3575,22 +3579,22 @@
           append ridge to vertex
     mark facet processed
 */
-void qh_vertexridges_facet (vertexT *vertex, facetT *facet, setT **ridges) {
+void qh_vertexridges_facet(vertexT *vertex, facetT *facet, setT **ridges) {
   ridgeT *ridge, **ridgep;
   facetT *neighbor;
 
   FOREACHridge_(facet->ridges) {
     neighbor= otherfacet_(ridge, facet);
-    if (neighbor->visitid == qh visit_id 
-    && qh_setin (ridge->vertices, vertex))
-      qh_setappend (ridges, ridge);
+    if (neighbor->visitid == qh visit_id
+    && qh_setin(ridge->vertices, vertex))
+      qh_setappend(ridges, ridge);
   }
   facet->visitid= qh visit_id-1;
 } /* vertexridges_facet */
 
 /*---------------------------------
-  
+
   qh_willdelete( facet, replace )
     moves facet to visible list
     sets facet->f.replace to replace (may be NULL)
@@ -3598,22 +3602,22 @@
   returns:
     bumps qh.num_visible
 */
-void qh_willdelete (facetT *facet, facetT *replace) {
+void qh_willdelete(facetT *facet, facetT *replace) {
 
   qh_removefacet(facet);
-  qh_prependfacet (facet, &qh visible_list);
+  qh_prependfacet(facet, &qh visible_list);
   qh num_visible++;
   facet->visible= True;
   facet->f.replace= replace;
 } /* willdelete */
 
 #else /* qh_NOmerge */
-void qh_premerge (vertexT *apex, realT maxcentrum, realT maxangle) {
+void qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle) {
 }
-void qh_postmerge (char *reason, realT maxcentrum, realT maxangle, 
+void qh_postmerge(const char *reason, realT maxcentrum, realT maxangle,
                       boolT vneighbors) {
 }
-boolT qh_checkzero (boolT testall) {
+boolT qh_checkzero(boolT testall) {
    }
 #endif /* qh_NOmerge */
 

Modified: trunk/scipy/spatial/qhull/src/merge.h
===================================================================
--- trunk/scipy/spatial/qhull/src/merge.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/merge.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,18 +1,22 @@
 /*
  ---------------------------------
 
-   merge.h 
+   merge.h
    header file for merge.c
 
    see qh-merge.htm and merge.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 C.B. Barber.
+   $Id: //product/qhull/main/rel/src/merge.h#21 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFmerge
 #define qhDEFmerge 1
 
+#include "libqhull.h"
 
+
 /*============ -constants- ==============*/
 
 /*----------------------------------
-  
+
   qh_ANGLEdegen
     indicates degenerate facet in mergeT->angle
 */
@@ -33,10 +37,10 @@
 
 /*----------------------------------
-  
+
   qh_ANGLEconcave
     offset to indicate concave facets in mergeT->angle
-  
+
   notes:
     concave facets are assigned the range of [2,4] in mergeT->angle
     roundoff error may make the angle less than 2
@@ -45,31 +49,31 @@
 
 /*----------------------------------
-  
+
   MRG... (mergeType)
     indicates the type of a merge (mergeT->type)
 */
-typedef enum {	/* in sort order for facet_mergeset */
+typedef enum {  /* in sort order for facet_mergeset */
   MRGnone= 0,
-  MRGcoplanar,		/* centrum coplanar */
-  MRGanglecoplanar,	/* angle coplanar */
-  			/* could detect half concave ridges */
-  MRGconcave,		/* concave ridge */
-  MRGflip,		/* flipped facet. facet1 == facet2 */
-  MRGridge,		/* duplicate ridge (qh_MERGEridge) */
+  MRGcoplanar,          /* centrum coplanar */
+  MRGanglecoplanar,     /* angle coplanar */
+                        /* could detect half concave ridges */
+  MRGconcave,           /* concave ridge */
+  MRGflip,              /* flipped facet. facet1 == facet2 */
+  MRGridge,             /* duplicate ridge (qh_MERGEridge) */
                         /* degen and redundant go onto degen_mergeset */
-  MRGdegen,		/* degenerate facet (not enough neighbors) facet1 == facet2 */
-  MRGredundant,		/* redundant facet (vertex subset) */
-  			/* merge_degenredundant assumes degen < redundant */
-  MRGmirror,	        /* mirror facet from qh_triangulate */
+  MRGdegen,             /* degenerate facet (!enough neighbors) facet1 == facet2 */
+  MRGredundant,         /* redundant facet (vertex subset) */
+                        /* merge_degenredundant assumes degen < redundant */
+  MRGmirror,            /* mirror facet from qh_triangulate */
   ENDmrg
 } mergeType;
 
 /*----------------------------------
-  
+
   qh_MERGEapex
-    flag for qh_mergefacet() to indicate an apex merge  
+    flag for qh_mergefacet() to indicate an apex merge
 */
 #define qh_MERGEapex     True
 
@@ -77,15 +81,15 @@
 
 /*----------------------------------
-     
+
   mergeT
     structure used to merge facets
 */
 
 typedef struct mergeT mergeT;
-struct mergeT {		/* initialize in qh_appendmergeset */
+struct mergeT {         /* initialize in qh_appendmergeset */
   realT   angle;        /* angle between normals of facet1 and facet2 */
-  facetT *facet1; 	/* will merge facet1 into facet2 */
+  facetT *facet1;       /* will merge facet1 into facet2 */
   facetT *facet2;
   mergeType type;
 };
@@ -95,10 +99,10 @@
 
 /*----------------------------------
-     
+
   FOREACHmerge_( merges ) {...}
     assign 'merge' to each merge in merges
-       
+
   notes:
     uses 'mergeT *merge, **mergep;'
     if qh_mergefacet(),
@@ -109,66 +113,66 @@
 
 /*============ prototypes in alphabetical order after pre/postmerge =======*/
 
-void    qh_premerge (vertexT *apex, realT maxcentrum, realT maxangle);
-void    qh_postmerge (char *reason, realT maxcentrum, realT maxangle, 
+void    qh_premerge(vertexT *apex, realT maxcentrum, realT maxangle);
+void    qh_postmerge(const char *reason, realT maxcentrum, realT maxangle,
              boolT vneighbors);
-void    qh_all_merges (boolT othermerge, boolT vneighbors);
+void    qh_all_merges(boolT othermerge, boolT vneighbors);
 void    qh_appendmergeset(facetT *facet, facetT *neighbor, mergeType mergetype, realT *angle);
 setT   *qh_basevertices( facetT *samecycle);
-void    qh_checkconnect (void /* qh new_facets */);
-boolT   qh_checkzero (boolT testall);
+void    qh_checkconnect(void /* qh new_facets */);
+boolT   qh_checkzero(boolT testall);
 int     qh_compareangle(const void *p1, const void *p2);
 int     qh_comparemerge(const void *p1, const void *p2);
-int     qh_comparevisit (const void *p1, const void *p2);
-void    qh_copynonconvex (ridgeT *atridge);
-void    qh_degen_redundant_facet (facetT *facet);
-void   	qh_degen_redundant_neighbors (facetT *facet, facetT *delfacet);
-vertexT *qh_find_newvertex (vertexT *oldvertex, setT *vertices, setT *ridges);
-void    qh_findbest_test (boolT testcentrum, facetT *facet, facetT *neighbor,
+int     qh_comparevisit(const void *p1, const void *p2);
+void    qh_copynonconvex(ridgeT *atridge);
+void    qh_degen_redundant_facet(facetT *facet);
+void    qh_degen_redundant_neighbors(facetT *facet, facetT *delfacet);
+vertexT *qh_find_newvertex(vertexT *oldvertex, setT *vertices, setT *ridges);
+void    qh_findbest_test(boolT testcentrum, facetT *facet, facetT *neighbor,
            facetT **bestfacet, realT *distp, realT *mindistp, realT *maxdistp);
 facetT *qh_findbestneighbor(facetT *facet, realT *distp, realT *mindistp, realT *maxdistp);
-void 	qh_flippedmerges(facetT *facetlist, boolT *wasmerge);
-void 	qh_forcedmerges( boolT *wasmerge);
-void	qh_getmergeset(facetT *facetlist);
-void 	qh_getmergeset_initial (facetT *facetlist);
-void    qh_hashridge (setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex);
-ridgeT *qh_hashridge_find (setT *hashtable, int hashsize, ridgeT *ridge, 
+void    qh_flippedmerges(facetT *facetlist, boolT *wasmerge);
+void    qh_forcedmerges( boolT *wasmerge);
+void    qh_getmergeset(facetT *facetlist);
+void    qh_getmergeset_initial(facetT *facetlist);
+void    qh_hashridge(setT *hashtable, int hashsize, ridgeT *ridge, vertexT *oldvertex);
+ridgeT *qh_hashridge_find(setT *hashtable, int hashsize, ridgeT *ridge,
               vertexT *vertex, vertexT *oldvertex, int *hashslot);
-void 	qh_makeridges(facetT *facet);
+void    qh_makeridges(facetT *facet);
 void    qh_mark_dupridges(facetT *facetlist);
-void    qh_maydropneighbor (facetT *facet);
-int     qh_merge_degenredundant (void);
+void    qh_maydropneighbor(facetT *facet);
+int     qh_merge_degenredundant(void);
 void    qh_merge_nonconvex( facetT *facet1, facetT *facet2, mergeType mergetype);
-void    qh_mergecycle (facetT *samecycle, facetT *newfacet);
-void    qh_mergecycle_all (facetT *facetlist, boolT *wasmerge);
+void    qh_mergecycle(facetT *samecycle, facetT *newfacet);
+void    qh_mergecycle_all(facetT *facetlist, boolT *wasmerge);
 void    qh_mergecycle_facets( facetT *samecycle, facetT *newfacet);
 void    qh_mergecycle_neighbors(facetT *samecycle, facetT *newfacet);
 void    qh_mergecycle_ridges(facetT *samecycle, facetT *newfacet);
 void    qh_mergecycle_vneighbors( facetT *samecycle, facetT *newfacet);
-void 	qh_mergefacet(facetT *facet1, facetT *facet2, realT *mindist, realT *maxdist, boolT mergeapex);
-void    qh_mergefacet2d (facetT *facet1, facetT *facet2);
-void 	qh_mergeneighbors(facetT *facet1, facetT *facet2);
-void 	qh_mergeridges(facetT *facet1, facetT *facet2);
+void    qh_mergefacet(facetT *facet1, facetT *facet2, realT *mindist, realT *maxdist, boolT mergeapex);
+void    qh_mergefacet2d(facetT *facet1, facetT *facet2);
+void    qh_mergeneighbors(facetT *facet1, facetT *facet2);
+void    qh_mergeridges(facetT *facet1, facetT *facet2);
 void    qh_mergesimplex(facetT *facet1, facetT *facet2, boolT mergeapex);
-void    qh_mergevertex_del (vertexT *vertex, facetT *facet1, facetT *facet2);
+void    qh_mergevertex_del(vertexT *vertex, facetT *facet1, facetT *facet2);
 void    qh_mergevertex_neighbors(facetT *facet1, facetT *facet2);
-void	qh_mergevertices(setT *vertices1, setT **vertices);
-setT   *qh_neighbor_intersections (vertexT *vertex);
-void    qh_newvertices (setT *vertices);
-boolT   qh_reducevertices (void);
-vertexT *qh_redundant_vertex (vertexT *vertex);
-boolT   qh_remove_extravertices (facetT *facet);
-vertexT *qh_rename_sharedvertex (vertexT *vertex, facetT *facet);
-void	qh_renameridgevertex(ridgeT *ridge, vertexT *oldvertex, vertexT *newvertex);
+void    qh_mergevertices(setT *vertices1, setT **vertices);
+setT   *qh_neighbor_intersections(vertexT *vertex);
+void    qh_newvertices(setT *vertices);
+boolT   qh_reducevertices(void);
+vertexT *qh_redundant_vertex(vertexT *vertex);
+boolT   qh_remove_extravertices(facetT *facet);
+vertexT *qh_rename_sharedvertex(vertexT *vertex, facetT *facet);
+void    qh_renameridgevertex(ridgeT *ridge, vertexT *oldvertex, vertexT *newvertex);
 void    qh_renamevertex(vertexT *oldvertex, vertexT *newvertex, setT *ridges,
-			facetT *oldfacet, facetT *neighborA);
-boolT 	qh_test_appendmerge (facetT *facet, facetT *neighbor);
-boolT   qh_test_vneighbors (void /* qh newfacet_list */);
-void    qh_tracemerge (facetT *facet1, facetT *facet2);
-void    qh_tracemerging (void);
+                        facetT *oldfacet, facetT *neighborA);
+boolT   qh_test_appendmerge(facetT *facet, facetT *neighbor);
+boolT   qh_test_vneighbors(void /* qh newfacet_list */);
+void    qh_tracemerge(facetT *facet1, facetT *facet2);
+void    qh_tracemerging(void);
 void    qh_updatetested( facetT *facet1, facetT *facet2);
-setT   *qh_vertexridges (vertexT *vertex);
-void    qh_vertexridges_facet (vertexT *vertex, facetT *facet, setT **ridges);
-void    qh_willdelete (facetT *facet, facetT *replace);
+setT   *qh_vertexridges(vertexT *vertex);
+void    qh_vertexridges_facet(vertexT *vertex, facetT *facet, setT **ridges);
+void    qh_willdelete(facetT *facet, facetT *replace);
 
 #endif /* qhDEFmerge */

Modified: trunk/scipy/spatial/qhull/src/poly.c
===================================================================
--- trunk/scipy/spatial/qhull/src/poly.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/poly.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,15 +1,17 @@
 /*
  ---------------------------------
 
-   poly.c 
+   poly.c
    implements polygons and simplices
 
-   see qh-poly.htm, poly.h and qhull.h
+   see qh-poly.htm, poly.h and libqhull.h
 
-   infrequent code is in poly2.c 
+   infrequent code is in poly2.c
    (all but top 50 and their callers 12/3/95)
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/poly.c#26 $$Change: 1171 $
+   $DateTime: 2010/01/09 10:11:25 $$Author: bbarber $
 */
 
 #include "qhull_a.h"
@@ -18,14 +20,14 @@
 
 /*---------------------------------
-  
+
   qh_appendfacet( facet )
     appends facet to end of qh.facet_list,
 
   returns:
     updates qh.newfacet_list, facet_next, facet_list
     increments qh.numfacets
-  
+
   notes:
     assumes qh.facet_list/facet_tail is defined (createsimplex)
 
@@ -48,13 +50,13 @@
     qh facet_list= facet;
   tail->previous= facet;
   qh num_facets++;
-  trace4((qh ferr, "qh_appendfacet: append f%d to facet_list\n", facet->id));
+  trace4((qh ferr, 4044, "qh_appendfacet: append f%d to facet_list\n", facet->id));
 } /* appendfacet */
 
 
 /*---------------------------------
-  
+
   qh_appendvertex( vertex )
     appends vertex to end of qh.vertex_list,
 
@@ -67,7 +69,7 @@
     assumes qh.vertex_list/vertex_tail is defined (createsimplex)
 
 */
-void qh_appendvertex (vertexT *vertex) {
+void qh_appendvertex(vertexT *vertex) {
   vertexT *tail= qh vertex_tail;
 
   if (tail == qh newvertex_list)
@@ -81,13 +83,13 @@
     qh vertex_list= vertex;
   tail->previous= vertex;
   qh num_vertices++;
-  trace4((qh ferr, "qh_appendvertex: append v%d to vertex_list\n", vertex->id));
+  trace4((qh ferr, 4045, "qh_appendvertex: append v%d to vertex_list\n", vertex->id));
 } /* appendvertex */
 
 
 /*---------------------------------
-  
+
   qh_attachnewfacets( )
     attach horizon facets to new facets in qh.newfacet_list
     newfacets have neighbor and ridge links to horizon but not vice versa
@@ -95,7 +97,7 @@
 
   returns:
     set qh.NEWfacets
-    horizon facets linked to new facets 
+    horizon facets linked to new facets
       ridges changed from visible facets to new facets
       simplicial ridges deleted
     qh.visible_list, no ridges valid
@@ -124,83 +126,83 @@
           the first ridge of the new facet is the horizon ridge
           link the new facet into the horizon ridge
 */
-void qh_attachnewfacets (void ) {
+void qh_attachnewfacets(void ) {
   facetT *newfacet= NULL, *neighbor, **neighborp, *horizon, *visible;
   ridgeT *ridge, **ridgep;
 
   qh NEWfacets= True;
-  trace3((qh ferr, "qh_attachnewfacets: delete interior ridges\n"));
+  trace3((qh ferr, 3012, "qh_attachnewfacets: delete interior ridges\n"));
   qh visit_id++;
   FORALLvisible_facets {
     visible->visitid= qh visit_id;
     if (visible->ridges) {
       FOREACHridge_(visible->ridges) {
-	neighbor= otherfacet_(ridge, visible);
-	if (neighbor->visitid == qh visit_id
-	    || (!neighbor->visible && neighbor->simplicial)) {
-	  if (!neighbor->visible)  /* delete ridge for simplicial horizon */
-	    qh_setdel (neighbor->ridges, ridge);
-	  qh_setfree (&(ridge->vertices)); /* delete on 2nd visit */
-	  qh_memfree (ridge, sizeof(ridgeT));
-	}
+        neighbor= otherfacet_(ridge, visible);
+        if (neighbor->visitid == qh visit_id
+            || (!neighbor->visible && neighbor->simplicial)) {
+          if (!neighbor->visible)  /* delete ridge for simplicial horizon */
+            qh_setdel(neighbor->ridges, ridge);
+          qh_setfree(&(ridge->vertices)); /* delete on 2nd visit */
+          qh_memfree(ridge, (int)sizeof(ridgeT));
+        }
       }
       SETfirst_(visible->ridges)= NULL;
     }
     SETfirst_(visible->neighbors)= NULL;
   }
-  trace1((qh ferr, "qh_attachnewfacets: attach horizon facets to new facets\n"));
+  trace1((qh ferr, 1017, "qh_attachnewfacets: attach horizon facets to new facets\n"));
   FORALLnew_facets {
     horizon= SETfirstt_(newfacet->neighbors, facetT);
     if (horizon->simplicial) {
       visible= NULL;
       FOREACHneighbor_(horizon) {   /* may have more than one horizon ridge */
-	if (neighbor->visible) {
-	  if (visible) {
-	    if (qh_setequal_skip (newfacet->vertices, 0, horizon->vertices,
-				  SETindex_(horizon->neighbors, neighbor))) {
-	      visible= neighbor;
-	      break;
-	    }
-	  }else
-	    visible= neighbor;
-	}
+        if (neighbor->visible) {
+          if (visible) {
+            if (qh_setequal_skip(newfacet->vertices, 0, horizon->vertices,
+                                  SETindex_(horizon->neighbors, neighbor))) {
+              visible= neighbor;
+              break;
+            }
+          }else
+            visible= neighbor;
+        }
       }
       if (visible) {
-	visible->f.replace= newfacet;
-	qh_setreplace (horizon->neighbors, visible, newfacet);
+        visible->f.replace= newfacet;
+        qh_setreplace(horizon->neighbors, visible, newfacet);
       }else {
-	fprintf (qh ferr, "qhull internal error (qh_attachnewfacets): couldn't find visible facet for horizon f%d of newfacet f%d\n",
-		 horizon->id, newfacet->id);
-	qh_errexit2 (qh_ERRqhull, horizon, newfacet);
+        qh_fprintf(qh ferr, 6102, "qhull internal error (qh_attachnewfacets): couldn't find visible facet for horizon f%d of newfacet f%d\n",
+                 horizon->id, newfacet->id);
+        qh_errexit2 (qh_ERRqhull, horizon, newfacet);
       }
     }else { /* non-simplicial, with a ridge for newfacet */
       FOREACHneighbor_(horizon) {    /* may hold for many new facets */
-	if (neighbor->visible) {
-	  neighbor->f.replace= newfacet;
-	  qh_setdelnth (horizon->neighbors,
-			SETindex_(horizon->neighbors, neighbor));
-	  neighborp--; /* repeat */
-	}
+        if (neighbor->visible) {
+          neighbor->f.replace= newfacet;
+          qh_setdelnth(horizon->neighbors,
+                        SETindex_(horizon->neighbors, neighbor));
+          neighborp--; /* repeat */
+        }
       }
-      qh_setappend (&horizon->neighbors, newfacet);
+      qh_setappend(&horizon->neighbors, newfacet);
       ridge= SETfirstt_(newfacet->ridges, ridgeT);
       if (ridge->top == horizon)
-	ridge->bottom= newfacet;
+        ridge->bottom= newfacet;
       else
-	ridge->top= newfacet;
+        ridge->top= newfacet;
       }
   } /* newfacets */
   if (qh PRINTstatistics) {
     FORALLvisible_facets {
-      if (!visible->f.replace) 
-	zinc_(Zinsidevisible);
+      if (!visible->f.replace)
+        zinc_(Zinsidevisible);
     }
   }
 } /* attachnewfacets */
 
 /*---------------------------------
-  
+
   qh_checkflipped( facet, dist, allerror )
     checks facet orientation to interior point
 
@@ -213,7 +215,7 @@
     False if it flipped orientation (sets facet->flipped)
     distance if non-NULL
 */
-boolT qh_checkflipped (facetT *facet, realT *distp, boolT allerror) {
+boolT qh_checkflipped(facetT *facet, realT *distp, boolT allerror) {
   realT dist;
 
   if (facet->flipped && !distp)
@@ -225,9 +227,9 @@
   if ((allerror && dist > -qh DISTround)|| (!allerror && dist >= 0.0)) {
     facet->flipped= True;
     zzinc_(Zflippedfacets);
-    trace0((qh ferr, "qh_checkflipped: facet f%d is flipped, distance= %6.12g during p%d\n",
+    trace0((qh ferr, 19, "qh_checkflipped: facet f%d is flipped, distance= %6.12g during p%d\n",
               facet->id, dist, qh furthest_id));
-    qh_precision ("flipped facet");
+    qh_precision("flipped facet");
     return False;
   }
   return True;
@@ -235,7 +237,7 @@
 
 /*---------------------------------
-  
+
   qh_delfacet( facet )
     removes facet from facet_list and frees up its memory
 
@@ -245,7 +247,7 @@
 void qh_delfacet(facetT *facet) {
   void **freelistp; /* used !qh_NOmem */
 
-  trace4((qh ferr, "qh_delfacet: delete f%d\n", facet->id));
+  trace4((qh ferr, 4046, "qh_delfacet: delete f%d\n", facet->id));
   if (facet == qh tracefacet)
     qh tracefacet= NULL;
   if (facet == qh GOODclosest)
@@ -267,13 +269,13 @@
     qh_setfree(&(facet->outsideset));
   if (facet->coplanarset)
     qh_setfree(&(facet->coplanarset));
-  qh_memfree_(facet, sizeof(facetT), freelistp);
+  qh_memfree_(facet, (int)sizeof(facetT), freelistp);
 } /* delfacet */
 
 
 /*---------------------------------
-  
+
   qh_deletevisible()
     delete visible facets and vertices
 
@@ -287,48 +289,48 @@
     new facets in qh.newfacet_list
     uses   qh.visit_id;
 */
-void qh_deletevisible (void /*qh visible_list*/) {
+void qh_deletevisible(void /*qh visible_list*/) {
   facetT *visible, *nextfacet;
   vertexT *vertex, **vertexp;
   int numvisible= 0, numdel= qh_setsize(qh del_vertices);
 
-  trace1((qh ferr, "qh_deletevisible: delete %d visible facets and %d vertices\n",
+  trace1((qh ferr, 1018, "qh_deletevisible: delete %d visible facets and %d vertices\n",
          qh num_visible, numdel));
-  for (visible= qh visible_list; visible && visible->visible; 
+  for (visible= qh visible_list; visible && visible->visible;
                 visible= nextfacet) { /* deleting current */
-    nextfacet= visible->next;        
+    nextfacet= visible->next;
     numvisible++;
     qh_delfacet(visible);
   }
   if (numvisible != qh num_visible) {
-    fprintf (qh ferr, "qhull internal error (qh_deletevisible): qh num_visible %d is not number of visible facets %d\n",
+    qh_fprintf(qh ferr, 6103, "qhull internal error (qh_deletevisible): qh num_visible %d is not number of visible facets %d\n",
              qh num_visible, numvisible);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
   qh num_visible= 0;
   zadd_(Zvisfacettot, numvisible);
   zmax_(Zvisfacetmax, numvisible);
   zzadd_(Zdelvertextot, numdel);
   zmax_(Zdelvertexmax, numdel);
-  FOREACHvertex_(qh del_vertices) 
-    qh_delvertex (vertex);
-  qh_settruncate (qh del_vertices, 0);
+  FOREACHvertex_(qh del_vertices)
+    qh_delvertex(vertex);
+  qh_settruncate(qh del_vertices, 0);
 } /* deletevisible */
 
 /*---------------------------------
-  
+
   qh_facetintersect( facetA, facetB, skipa, skipB, prepend )
     return vertices for intersection of two simplicial facets
     may include 1 prepended entry (if more, need to settemppush)
-    
+
   returns:
     returns set of qh.hull_dim-1 + prepend vertices
     returns skipped index for each test and checks for exactly one
 
   notes:
     does not need settemp since set in quick memory
-  
+
   see also:
     qh_vertexintersect and qh_vertexintersect_new
     use qh_setnew_delnthsorted to get nth ridge (no skip information)
@@ -338,8 +340,8 @@
     locate skipped vertex by scanning facet B's neighbors
     intersect the vertex sets
 */
-setT *qh_facetintersect (facetT *facetA, facetT *facetB,
-			 int *skipA,int *skipB, int prepend) {
+setT *qh_facetintersect(facetT *facetA, facetT *facetB,
+                         int *skipA,int *skipB, int prepend) {
   setT *intersect;
   int dim= qh hull_dim, i, j;
   facetT **neighborsA, **neighborsB;
@@ -354,7 +356,7 @@
   else if (facetB == *neighborsA++)
     *skipA= 2;
   else {
-    for (i= 3; i < dim; i++) {
+    for (i=3; i < dim; i++) {
       if (facetB == *neighborsA++) {
         *skipA= i;
         break;
@@ -368,7 +370,7 @@
   else if (facetA == *neighborsB++)
     *skipB= 2;
   else {
-    for (j= 3; j < dim; j++) {
+    for (j=3; j < dim; j++) {
       if (facetA == *neighborsB++) {
         *skipB= j;
         break;
@@ -376,34 +378,39 @@
     }
   }
   if (i >= dim || j >= dim) {
-    fprintf (qh ferr, "qhull internal error (qh_facetintersect): f%d or f%d not in others neighbors\n",
+    qh_fprintf(qh ferr, 6104, "qhull internal error (qh_facetintersect): f%d or f%d not in others neighbors\n",
             facetA->id, facetB->id);
     qh_errexit2 (qh_ERRqhull, facetA, facetB);
   }
-  intersect= qh_setnew_delnthsorted (facetA->vertices, qh hull_dim, *skipA, prepend);
-  trace4((qh ferr, "qh_facetintersect: f%d skip %d matches f%d skip %d\n",
-	  facetA->id, *skipA, facetB->id, *skipB));
+  intersect= qh_setnew_delnthsorted(facetA->vertices, qh hull_dim, *skipA, prepend);
+  trace4((qh ferr, 4047, "qh_facetintersect: f%d skip %d matches f%d skip %d\n",
+          facetA->id, *skipA, facetB->id, *skipB));
   return(intersect);
 } /* facetintersect */
 
 /*---------------------------------
-  
+
   qh_gethash( hashsize, set, size, firstindex, skipelem )
     return hashvalue for a set with firstindex and skipelem
 
   notes:
+    returned hash is in [0,hashsize)
     assumes at least firstindex+1 elements
     assumes skipelem is NULL, in set, or part of hash
-    
+
     hashes memory addresses which may change over different runs of the same data
     using sum for hash does badly in high d
 */
-unsigned qh_gethash (int hashsize, setT *set, int size, int firstindex, void *skipelem) {
+int qh_gethash(int hashsize, setT *set, int size, int firstindex, void *skipelem) {
   void **elemp= SETelemaddr_(set, firstindex, void);
   ptr_intT hash = 0, elem;
+  unsigned result;
   int i;
-  unsigned result;
+#ifdef _MSC_VER                   /* Microsoft Visual C++ -- warn about 64-bit issues */
+#pragma warning( push)            /* WARN64 -- ptr_intT holds a 64-bit pointer */
+#pragma warning( disable : 4311)  /* 'type cast': pointer truncation from 'void*' to 'ptr_intT' */
+#endif
 
   switch (size-firstindex) {
   case 1:
@@ -435,22 +442,29 @@
     do {     /* this is about 10% in 10-d */
       if ((elem= (ptr_intT)*elemp++) != (ptr_intT)skipelem) {
         hash ^= (elem << i) + (elem >> (32-i));
-	i += 3;
-	if (i >= 32)
-	  i -= 32;
+        i += 3;
+        if (i >= 32)
+          i -= 32;
       }
-    }while(*elemp);
+    }while (*elemp);
     break;
   }
+  if (hashsize<0) {
+    qh_fprintf(qh ferr, 6232, "qhull internal error: negative hashsize %d passed to qh_gethash [poly.c]\n", hashsize);
+    qh_errexit2 (qh_ERRqhull, NULL, NULL);
+  }
   result= (unsigned)hash;
   result %= (unsigned)hashsize;
-  /* result= 0; for debugging purposes */
+  /* result= 0; for debugging */
   return result;
+#ifdef _MSC_VER
+#pragma warning( pop)
+#endif
 } /* gethash */
 
 /*---------------------------------
-  
+
   qh_makenewfacet( vertices, toporient, horizon )
     creates a toporient? facet from vertices
 
@@ -468,13 +482,13 @@
 
   FOREACHvertex_(vertices) {
     if (!vertex->newlist) {
-      qh_removevertex (vertex);
-      qh_appendvertex (vertex);
+      qh_removevertex(vertex);
+      qh_appendvertex(vertex);
     }
   }
   newfacet= qh_newfacet();
   newfacet->vertices= vertices;
-  newfacet->toporient= toporient;
+  newfacet->toporient= (unsigned char)toporient;
   if (horizon)
     qh_setappend(&(newfacet->neighbors), horizon);
   qh_appendfacet(newfacet);
@@ -484,7 +498,7 @@
 
 /*---------------------------------
-  
+
   qh_makenewplanes()
     make new hyperplanes for facets on qh.newfacet_list
 
@@ -496,23 +510,23 @@
   notes:
     facet->f.samecycle is defined for facet->mergehorizon facets
 */
-void qh_makenewplanes (void /* newfacet_list */) {
+void qh_makenewplanes(void /* newfacet_list */) {
   facetT *newfacet;
 
   FORALLnew_facets {
     if (!newfacet->mergehorizon)
-      qh_setfacetplane (newfacet);  
+      qh_setfacetplane(newfacet);
   }
-  if (qh JOGGLEmax < REALmax/2)  
+  if (qh JOGGLEmax < REALmax/2)
     minimize_(qh min_vertex, -wwval_(Wnewvertexmax));
 } /* makenewplanes */
 
 /*---------------------------------
-  
+
   qh_makenew_nonsimplicial( visible, apex, numnew )
     make new facets for ridges of a visible facet
-    
+
   returns:
     first newfacet, bumps numnew as needed
     attaches new facets if !qh.ONLYgood
@@ -521,13 +535,13 @@
       ridges on newfacet, horizon, and visible
     else
       ridge and neighbors between newfacet and   horizon
-      visible facet's ridges are deleted    
+      visible facet's ridges are deleted
 
   notes:
     qh.visit_id if visible has already been processed
     sets neighbor->seen for building f.samecycle
       assumes all 'seen' flags initially false
-    
+
   design:
     for each ridge of visible facet
       get neighbor of visible facet
@@ -537,16 +551,16 @@
         create a new facet
         if neighbor coplanar
           adds newfacet to f.samecycle for later merging
-        else 
+        else
           updates neighbor's neighbor set
           (checks for non-simplicial facet with multiple ridges to visible facet)
         updates neighbor's ridge set
         (checks for simplicial neighbor to non-simplicial visible facet)
-	(deletes ridge if neighbor is simplicial)
-          
+        (deletes ridge if neighbor is simplicial)
+
 */
 #ifndef qh_NOmerge
-facetT *qh_makenew_nonsimplicial (facetT *visible, vertexT *apex, int *numnew) {
+facetT *qh_makenew_nonsimplicial(facetT *visible, vertexT *apex, int *numnew) {
   void **freelistp; /* used !qh_NOmem */
   ridgeT *ridge, **ridgep;
   facetT *neighbor, *newfacet= NULL, *samecycle;
@@ -560,19 +574,19 @@
     if (neighbor->visible) {
       if (!qh ONLYgood) {
         if (neighbor->visitid == qh visit_id) {
-          qh_setfree (&(ridge->vertices));  /* delete on 2nd visit */
-	  qh_memfree_(ridge, sizeof(ridgeT), freelistp);
-	}
+          qh_setfree(&(ridge->vertices));  /* delete on 2nd visit */
+          qh_memfree_(ridge, (int)sizeof(ridgeT), freelistp);
+        }
       }
     }else {  /* neighbor is an horizon facet */
       toporient= (ridge->top == visible);
-      vertices= qh_setnew (qh hull_dim); /* makes sure this is quick */
-      qh_setappend (&vertices, apex);
-      qh_setappend_set (&vertices, ridge->vertices);
+      vertices= qh_setnew(qh hull_dim); /* makes sure this is quick */
+      qh_setappend(&vertices, apex);
+      qh_setappend_set(&vertices, ridge->vertices);
       newfacet= qh_makenewfacet(vertices, toporient, neighbor);
       (*numnew)++;
       if (neighbor->coplanar) {
-	newfacet->mergehorizon= True;
+        newfacet->mergehorizon= True;
         if (!neighbor->seen) {
           newfacet->f.samecycle= newfacet;
           neighbor->f.newcycle= newfacet;
@@ -580,51 +594,51 @@
           samecycle= neighbor->f.newcycle;
           newfacet->f.samecycle= samecycle->f.samecycle;
           samecycle->f.samecycle= newfacet;
-	}
+        }
       }
       if (qh ONLYgood) {
         if (!neighbor->simplicial)
- 	  qh_setappend(&(newfacet->ridges), ridge);
+          qh_setappend(&(newfacet->ridges), ridge);
       }else {  /* qh_attachnewfacets */
         if (neighbor->seen) {
-	  if (neighbor->simplicial) {
-	    fprintf (qh ferr, "qhull internal error (qh_makenew_nonsimplicial): simplicial f%d sharing two ridges with f%d\n", 
-	           neighbor->id, visible->id);
-	    qh_errexit2 (qh_ERRqhull, neighbor, visible);
-	  }
-	  qh_setappend (&(neighbor->neighbors), newfacet);
-	}else
-          qh_setreplace (neighbor->neighbors, visible, newfacet);
+          if (neighbor->simplicial) {
+            qh_fprintf(qh ferr, 6105, "qhull internal error (qh_makenew_nonsimplicial): simplicial f%d sharing two ridges with f%d\n",
+                   neighbor->id, visible->id);
+            qh_errexit2 (qh_ERRqhull, neighbor, visible);
+          }
+          qh_setappend(&(neighbor->neighbors), newfacet);
+        }else
+          qh_setreplace(neighbor->neighbors, visible, newfacet);
         if (neighbor->simplicial) {
-          qh_setdel (neighbor->ridges, ridge);
-          qh_setfree (&(ridge->vertices)); 
-	  qh_memfree (ridge, sizeof(ridgeT));
-	}else {
- 	  qh_setappend(&(newfacet->ridges), ridge);
- 	  if (toporient)
- 	    ridge->top= newfacet;
- 	  else
- 	    ridge->bottom= newfacet;
- 	}
-      trace4((qh ferr, "qh_makenew_nonsimplicial: created facet f%d from v%d and r%d of horizon f%d\n",
-	    newfacet->id, apex->id, ridgeid, neighbor->id));
+          qh_setdel(neighbor->ridges, ridge);
+          qh_setfree(&(ridge->vertices));
+          qh_memfree(ridge, (int)sizeof(ridgeT));
+        }else {
+          qh_setappend(&(newfacet->ridges), ridge);
+          if (toporient)
+            ridge->top= newfacet;
+          else
+            ridge->bottom= newfacet;
+        }
+      trace4((qh ferr, 4048, "qh_makenew_nonsimplicial: created facet f%d from v%d and r%d of horizon f%d\n",
+            newfacet->id, apex->id, ridgeid, neighbor->id));
       }
     }
-    neighbor->seen= True;        
+    neighbor->seen= True;
   } /* for each ridge */
   if (!qh ONLYgood)
     SETfirst_(visible->ridges)= NULL;
   return newfacet;
 } /* makenew_nonsimplicial */
 #else /* qh_NOmerge */
-facetT *qh_makenew_nonsimplicial (facetT *visible, vertexT *apex, int *numnew) {
+facetT *qh_makenew_nonsimplicial(facetT *visible, vertexT *apex, int *numnew) {
   return NULL;
 }
 #endif /* qh_NOmerge */
 
 /*---------------------------------
-  
+
   qh_makenew_simplicial( visible, apex, numnew )
     make new facets for simplicial visible facet and apex
 
@@ -633,7 +647,7 @@
       neighbors between newfacet and horizon
 
   notes:
-    nop if neighbor->seen or neighbor->visible (see qh_makenew_nonsimplicial)
+    nop if neighbor->seen or neighbor->visible(see qh_makenew_nonsimplicial)
 
   design:
     locate neighboring horizon facet for visible facet
@@ -641,9 +655,9 @@
     create new facet
     if coplanar,
       add new facet to f.samecycle
-    update horizon facet's neighbor list        
+    update horizon facet's neighbor list
 */
-facetT *qh_makenew_simplicial (facetT *visible, vertexT *apex, int *numnew) {
+facetT *qh_makenew_simplicial(facetT *visible, vertexT *apex, int *numnew) {
   facetT *neighbor, **neighborp, *newfacet= NULL;
   setT *vertices;
   boolT flip, toporient;
@@ -654,23 +668,23 @@
       vertices= qh_facetintersect(neighbor,visible, &horizonskip, &visibleskip, 1);
       SETfirst_(vertices)= apex;
       flip= ((horizonskip & 0x1) ^ (visibleskip & 0x1));
-      if (neighbor->toporient)         
-	toporient= horizonskip & 0x1;
+      if (neighbor->toporient)
+        toporient= horizonskip & 0x1;
       else
-	toporient= (horizonskip & 0x1) ^ 0x1;
+        toporient= (horizonskip & 0x1) ^ 0x1;
       newfacet= qh_makenewfacet(vertices, toporient, neighbor);
       (*numnew)++;
       if (neighbor->coplanar && (qh PREmerge || qh MERGEexact)) {
 #ifndef qh_NOmerge
-	newfacet->f.samecycle= newfacet;
-	newfacet->mergehorizon= True;
+        newfacet->f.samecycle= newfacet;
+        newfacet->mergehorizon= True;
 #endif
       }
       if (!qh ONLYgood)
         SETelem_(neighbor->neighbors, horizonskip)= newfacet;
-      trace4((qh ferr, "qh_makenew_simplicial: create facet f%d top %d from v%d and horizon f%d skip %d top %d and visible f%d skip %d, flip? %d\n",
-	    newfacet->id, toporient, apex->id, neighbor->id, horizonskip,
-	      neighbor->toporient, visible->id, visibleskip, flip));
+      trace4((qh ferr, 4049, "qh_makenew_simplicial: create facet f%d top %d from v%d and horizon f%d skip %d top %d and visible f%d skip %d, flip? %d\n",
+            newfacet->id, toporient, apex->id, neighbor->id, horizonskip,
+              neighbor->toporient, visible->id, visibleskip, flip));
     }
   }
   return newfacet;
@@ -678,7 +692,7 @@
 
 /*---------------------------------
-  
+
   qh_matchneighbor( newfacet, newskip, hashsize, hashcount )
     either match subridge of newfacet with neighbor or add to hash_table
 
@@ -689,7 +703,7 @@
     ridge is newfacet->vertices w/o newskip vertex
     do not allocate memory (need to free hash_table cleanly)
     uses linear hash chains
-  
+
   see also:
     qh_matchduplicates
 
@@ -707,97 +721,97 @@
             mark both facets with a duplicate ridge
             add other facet (if defined) to hash table
 */
-void qh_matchneighbor (facetT *newfacet, int newskip, int hashsize, int *hashcount) {
+void qh_matchneighbor(facetT *newfacet, int newskip, int hashsize, int *hashcount) {
   boolT newfound= False;   /* True, if new facet is already in hash chain */
   boolT same, ismatch;
   int hash, scan;
   facetT *facet, *matchfacet;
   int skip, matchskip;
 
-  hash= (int)qh_gethash (hashsize, newfacet->vertices, qh hull_dim, 1, 
+  hash= qh_gethash(hashsize, newfacet->vertices, qh hull_dim, 1,
                      SETelem_(newfacet->vertices, newskip));
-  trace4((qh ferr, "qh_matchneighbor: newfacet f%d skip %d hash %d hashcount %d\n",
-	  newfacet->id, newskip, hash, *hashcount));
+  trace4((qh ferr, 4050, "qh_matchneighbor: newfacet f%d skip %d hash %d hashcount %d\n",
+          newfacet->id, newskip, hash, *hashcount));
   zinc_(Zhashlookup);
-  for (scan= hash; (facet= SETelemt_(qh hash_table, scan, facetT)); 
+  for (scan= hash; (facet= SETelemt_(qh hash_table, scan, facetT));
        scan= (++scan >= hashsize ? 0 : scan)) {
     if (facet == newfacet) {
       newfound= True;
       continue;
     }
     zinc_(Zhashtests);
-    if (qh_matchvertices (1, newfacet->vertices, newskip, facet->vertices, &skip, &same)) {
-      if (SETelem_(newfacet->vertices, newskip) == 
+    if (qh_matchvertices(1, newfacet->vertices, newskip, facet->vertices, &skip, &same)) {
+      if (SETelem_(newfacet->vertices, newskip) ==
           SETelem_(facet->vertices, skip)) {
-        qh_precision ("two facets with the same vertices");
-        fprintf (qh ferr, "qhull precision error: Vertex sets are the same for f%d and f%d.  Can not force output.\n",
+        qh_precision("two facets with the same vertices");
+        qh_fprintf(qh ferr, 6106, "qhull precision error: Vertex sets are the same for f%d and f%d.  Can not force output.\n",
           facet->id, newfacet->id);
         qh_errexit2 (qh_ERRprec, facet, newfacet);
       }
-      ismatch= (same == (newfacet->toporient ^ facet->toporient));
+      ismatch= (same == (boolT)((newfacet->toporient ^ facet->toporient)));
       matchfacet= SETelemt_(facet->neighbors, skip, facetT);
       if (ismatch && !matchfacet) {
         SETelem_(facet->neighbors, skip)= newfacet;
         SETelem_(newfacet->neighbors, newskip)= facet;
         (*hashcount)--;
-        trace4((qh ferr, "qh_matchneighbor: f%d skip %d matched with new f%d skip %d\n",
+        trace4((qh ferr, 4051, "qh_matchneighbor: f%d skip %d matched with new f%d skip %d\n",
            facet->id, skip, newfacet->id, newskip));
         return;
       }
       if (!qh PREmerge && !qh MERGEexact) {
-        qh_precision ("a ridge with more than two neighbors");
-	fprintf (qh ferr, "qhull precision error: facets f%d, f%d and f%d meet at a ridge with more than 2 neighbors.  Can not continue.\n",
-		 facet->id, newfacet->id, getid_(matchfacet));
-	qh_errexit2 (qh_ERRprec, facet, newfacet);
+        qh_precision("a ridge with more than two neighbors");
+        qh_fprintf(qh ferr, 6107, "qhull precision error: facets f%d, f%d and f%d meet at a ridge with more than 2 neighbors.  Can not continue.\n",
+                 facet->id, newfacet->id, getid_(matchfacet));
+        qh_errexit2 (qh_ERRprec, facet, newfacet);
       }
       SETelem_(newfacet->neighbors, newskip)= qh_DUPLICATEridge;
       newfacet->dupridge= True;
       if (!newfacet->normal)
-	qh_setfacetplane (newfacet);
-      qh_addhash (newfacet, qh hash_table, hashsize, hash);
+        qh_setfacetplane(newfacet);
+      qh_addhash(newfacet, qh hash_table, hashsize, hash);
       (*hashcount)++;
       if (!facet->normal)
-	qh_setfacetplane (facet);
+        qh_setfacetplane(facet);
       if (matchfacet != qh_DUPLICATEridge) {
-	SETelem_(facet->neighbors, skip)= qh_DUPLICATEridge;
-	facet->dupridge= True;
-	if (!facet->normal)
-	  qh_setfacetplane (facet);
-	if (matchfacet) {
-	  matchskip= qh_setindex (matchfacet->neighbors, facet);
-	  SETelem_(matchfacet->neighbors, matchskip)= qh_DUPLICATEridge;
-	  matchfacet->dupridge= True;
-	  if (!matchfacet->normal)
-	    qh_setfacetplane (matchfacet);
-	  qh_addhash (matchfacet, qh hash_table, hashsize, hash);
-	  *hashcount += 2;
-	}
+        SETelem_(facet->neighbors, skip)= qh_DUPLICATEridge;
+        facet->dupridge= True;
+        if (!facet->normal)
+          qh_setfacetplane(facet);
+        if (matchfacet) {
+          matchskip= qh_setindex(matchfacet->neighbors, facet);
+          SETelem_(matchfacet->neighbors, matchskip)= qh_DUPLICATEridge;
+          matchfacet->dupridge= True;
+          if (!matchfacet->normal)
+            qh_setfacetplane(matchfacet);
+          qh_addhash(matchfacet, qh hash_table, hashsize, hash);
+          *hashcount += 2;
+        }
       }
-      trace4((qh ferr, "qh_matchneighbor: new f%d skip %d duplicates ridge for f%d skip %d matching f%d ismatch %d at hash %d\n",
-	   newfacet->id, newskip, facet->id, skip, 
-	   (matchfacet == qh_DUPLICATEridge ? -2 : getid_(matchfacet)), 
-	   ismatch, hash));
+      trace4((qh ferr, 4052, "qh_matchneighbor: new f%d skip %d duplicates ridge for f%d skip %d matching f%d ismatch %d at hash %d\n",
+           newfacet->id, newskip, facet->id, skip,
+           (matchfacet == qh_DUPLICATEridge ? -2 : getid_(matchfacet)),
+           ismatch, hash));
       return; /* end of duplicate ridge */
     }
   }
-  if (!newfound) 
+  if (!newfound)
     SETelem_(qh hash_table, scan)= newfacet;  /* same as qh_addhash */
   (*hashcount)++;
-  trace4((qh ferr, "qh_matchneighbor: no match for f%d skip %d at hash %d\n",
+  trace4((qh ferr, 4053, "qh_matchneighbor: no match for f%d skip %d at hash %d\n",
            newfacet->id, newskip, hash));
 } /* matchneighbor */
 
 
 /*---------------------------------
-  
+
   qh_matchnewfacets()
     match newfacets in qh.newfacet_list to their newfacet neighbors
 
   returns:
     qh.newfacet_list with full neighbor sets
       get vertices with nth neighbor by deleting nth vertex
-    if qh.PREmerge/MERGEexact or qh.FORCEoutput 
+    if qh.PREmerge/MERGEexact or qh.FORCEoutput
       sets facet->flippped if flipped normal (also prevents point partitioning)
     if duplicate ridges and qh.PREmerge/MERGEexact
       sets facet->dupridge
@@ -819,7 +833,7 @@
         match it with a facet
     check for flipped facets
 */
-void qh_matchnewfacets (void /* qh newfacet_list */) {
+void qh_matchnewfacets(void /* qh newfacet_list */) {
   int numnew=0, hashcount=0, newskip;
   facetT *newfacet, *neighbor;
   int dim= qh hull_dim, hashsize, neighbor_i, neighbor_n;
@@ -828,22 +842,22 @@
   int facet_i, facet_n, numfree= 0;
   facetT *facet;
 #endif
-  
-  trace1((qh ferr, "qh_matchnewfacets: match neighbors for new facets.\n"));
+
+  trace1((qh ferr, 1019, "qh_matchnewfacets: match neighbors for new facets.\n"));
   FORALLnew_facets {
     numnew++;
-    {  /* inline qh_setzero (newfacet->neighbors, 1, qh hull_dim); */
+    {  /* inline qh_setzero(newfacet->neighbors, 1, qh hull_dim); */
       neighbors= newfacet->neighbors;
       neighbors->e[neighbors->maxsize].i= dim+1; /*may be overwritten*/
-      memset ((char *)SETelemaddr_(neighbors, 1, void), 0, dim * SETelemsize);
-    }    
+      memset((char *)SETelemaddr_(neighbors, 1, void), 0, dim * SETelemsize);
+    }
   }
-  qh_newhashtable (numnew*(qh hull_dim-1)); /* twice what is normally needed,
+  qh_newhashtable(numnew*(qh hull_dim-1)); /* twice what is normally needed,
                                      but every ridge could be DUPLICATEridge */
-  hashsize= qh_setsize (qh hash_table);
+  hashsize= qh_setsize(qh hash_table);
   FORALLnew_facets {
     for (newskip=1; newskipneighbors, k, facetT);
-	  if (!neighbor || neighbor == qh_DUPLICATEridge)
-	    count++;
-	}
-	if (facet == newfacet)
-	  break;
+        for (k=1; k < qh hull_dim; k++) {
+          neighbor= SETelemt_(facet->neighbors, k, facetT);
+          if (!neighbor || neighbor == qh_DUPLICATEridge)
+            count++;
+        }
+        if (facet == newfacet)
+          break;
       }
       if (count != hashcount) {
-	fprintf (qh ferr, "qh_matchnewfacets: after adding facet %d, hashcount %d != count %d\n",
-		 newfacet->id, hashcount, count);
-	qh_errexit (qh_ERRqhull, newfacet, NULL);
+        qh_fprintf(qh ferr, 8088, "qh_matchnewfacets: after adding facet %d, hashcount %d != count %d\n",
+                 newfacet->id, hashcount, count);
+        qh_errexit(qh_ERRqhull, newfacet, NULL);
       }
     }
 #endif  /* end of trap code */
@@ -872,18 +886,18 @@
       if (newfacet->dupridge) {
         FOREACHneighbor_i_(newfacet) {
           if (neighbor == qh_DUPLICATEridge) {
-            qh_matchduplicates (newfacet, neighbor_i, hashsize, &hashcount);
-         	    /* this may report MERGEfacet */
-	  }
+            qh_matchduplicates(newfacet, neighbor_i, hashsize, &hashcount);
+                    /* this may report MERGEfacet */
+          }
         }
       }
     }
   }
   if (hashcount) {
-    fprintf (qh ferr, "qhull internal error (qh_matchnewfacets): %d neighbors did not match up\n",
+    qh_fprintf(qh ferr, 6108, "qhull internal error (qh_matchnewfacets): %d neighbors did not match up\n",
         hashcount);
-    qh_printhashtable (qh ferr);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_printhashtable(qh ferr);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }
 #ifndef qh_NOtrace
   if (qh IStracing >= 2) {
@@ -891,26 +905,26 @@
       if (!facet)
         numfree++;
     }
-    fprintf (qh ferr, "qh_matchnewfacets: %d new facets, %d unused hash entries .  hashsize %d\n",
-	     numnew, numfree, qh_setsize (qh hash_table));
+    qh_fprintf(qh ferr, 8089, "qh_matchnewfacets: %d new facets, %d unused hash entries .  hashsize %d\n",
+             numnew, numfree, qh_setsize(qh hash_table));
   }
 #endif /* !qh_NOtrace */
-  qh_setfree (&qh hash_table);
+  qh_setfree(&qh hash_table);
   if (qh PREmerge || qh MERGEexact) {
     if (qh IStracing >= 4)
-      qh_printfacetlist (qh newfacet_list, NULL, qh_ALL);
+      qh_printfacetlist(qh newfacet_list, NULL, qh_ALL);
     FORALLnew_facets {
       if (newfacet->normal)
-	qh_checkflipped (newfacet, NULL, qh_ALL);
+        qh_checkflipped(newfacet, NULL, qh_ALL);
     }
   }else if (qh FORCEoutput)
-    qh_checkflipped_all (qh newfacet_list);  /* prints warnings for flipped */
+    qh_checkflipped_all(qh newfacet_list);  /* prints warnings for flipped */
 } /* matchnewfacets */
 
-    
+
 /*---------------------------------
-  
+
   qh_matchvertices( firstindex, verticesA, skipA, verticesB, skipB, same )
     tests whether vertices match with a single skip
     starts match at firstindex since all new facets have a common vertex
@@ -928,7 +942,7 @@
     scan both sets checking for a match
     test orientation
 */
-boolT qh_matchvertices (int firstindex, setT *verticesA, int skipA, 
+boolT qh_matchvertices(int firstindex, setT *verticesA, int skipA,
        setT *verticesB, int *skipB, boolT *same) {
   vertexT **elemAp, **elemBp, **skipBp=NULL, **skipAp;
 
@@ -941,21 +955,21 @@
         return False;
       skipBp= elemBp;  /* one extra like FOREACH */
     }
-  }while(*(++elemAp));
+  }while (*(++elemAp));
   if (!skipBp)
     skipBp= ++elemBp;
-  *skipB= SETindex_(verticesB, skipB);
-  *same= !(((ptr_intT)skipA & 0x1) ^ ((ptr_intT)*skipB & 0x1));
-  trace4((qh ferr, "qh_matchvertices: matched by skip %d (v%d) and skip %d (v%d) same? %d\n",
-	  skipA, (*skipAp)->id, *skipB, (*(skipBp-1))->id, *same));
-  return (True);
+  *skipB= SETindex_(verticesB, skipB); /* i.e., skipBp - verticesB */
+  *same= !((skipA & 0x1) ^ (*skipB & 0x1)); /* result is 0 or 1 */
+  trace4((qh ferr, 4054, "qh_matchvertices: matched by skip %d(v%d) and skip %d(v%d) same? %d\n",
+          skipA, (*skipAp)->id, *skipB, (*(skipBp-1))->id, *same));
+  return(True);
 } /* matchvertices */
 
 /*---------------------------------
-  
+
   qh_newfacet()
-    return a new facet 
+    return a new facet
 
   returns:
     all fields initialized or cleared   (NULL)
@@ -964,9 +978,9 @@
 facetT *qh_newfacet(void) {
   facetT *facet;
   void **freelistp; /* used !qh_NOmem */
-  
-  qh_memalloc_(sizeof(facetT), freelistp, facet, facetT);
-  memset ((char *)facet, 0, sizeof(facetT));
+
+  qh_memalloc_((int)sizeof(facetT), freelistp, facet, facetT);
+  memset((char *)facet, (size_t)0, sizeof(facetT));
   if (qh facet_id == qh tracefacet_id)
     qh tracefacet= facet;
   facet->id= qh facet_id++;
@@ -983,14 +997,14 @@
   facet->simplicial= True;
   facet->good= True;
   facet->newfacet= True;
-  trace4((qh ferr, "qh_newfacet: created facet f%d\n", facet->id));
-  return (facet);
+  trace4((qh ferr, 4055, "qh_newfacet: created facet f%d\n", facet->id));
+  return(facet);
 } /* newfacet */
 
 
 /*---------------------------------
-  
+
   qh_newridge()
     return a new ridge
 */
@@ -998,25 +1012,25 @@
   ridgeT *ridge;
   void **freelistp;   /* used !qh_NOmem */
 
-  qh_memalloc_(sizeof(ridgeT), freelistp, ridge, ridgeT);
-  memset ((char *)ridge, 0, sizeof(ridgeT));
+  qh_memalloc_((int)sizeof(ridgeT), freelistp, ridge, ridgeT);
+  memset((char *)ridge, (size_t)0, sizeof(ridgeT));
   zinc_(Ztotridges);
   if (qh ridge_id == 0xFFFFFF) {
-    fprintf(qh ferr, "\
+    qh_fprintf(qh ferr, 7074, "\
 qhull warning: more than %d ridges.  ID field overflows and two ridges\n\
 may have the same identifier.  Otherwise output ok.\n", 0xFFFFFF);
   }
-  ridge->id= qh ridge_id++;     
-  trace4((qh ferr, "qh_newridge: created ridge r%d\n", ridge->id));
-  return (ridge);
+  ridge->id= qh ridge_id++;
+  trace4((qh ferr, 4056, "qh_newridge: created ridge r%d\n", ridge->id));
+  return(ridge);
 } /* newridge */
 
 
 /*---------------------------------
-  
+
   qh_pointid(  )
-    return id for a point, 
+    return id for a point,
     returns -3 if null, -2 if interior, or -1 if not known
 
   alternative code:
@@ -1024,30 +1038,32 @@
     id= ((unsigned long)point - (unsigned long)qh.first_point)/qh.normal_size;
 
   notes:
+    WARN64 -- id truncated to 32-bits, at most 2G points
+    NOerrors returned (QhullPoint::id)
     if point not in point array
       the code does a comparison of unrelated pointers.
 */
-int qh_pointid (pointT *point) {
-  long offset, id;
+int qh_pointid(pointT *point) {
+  ptr_intT offset, id;
 
   if (!point)
-    id= -3;
+    return -3;
   else if (point == qh interior_point)
-    id= -2;
+    return -2;
   else if (point >= qh first_point
   && point < qh first_point + qh num_points * qh hull_dim) {
-    offset= point - qh first_point;
+    offset= (ptr_intT)(point - qh first_point);
     id= offset / qh hull_dim;
-  }else if ((id= qh_setindex (qh other_points, point)) != -1)
+  }else if ((id= qh_setindex(qh other_points, point)) != -1)
     id += qh num_points;
   else
-    id= -1;
-  return (int) id;
+    return -1;
+  return (int)id;
 } /* pointid */
-  
+
 /*---------------------------------
-  
+
   qh_removefacet( facet )
     unlinks facet from qh.facet_list,
 
@@ -1060,13 +1076,13 @@
 */
 void qh_removefacet(facetT *facet) {
   facetT *next= facet->next, *previous= facet->previous;
-  
+
   if (facet == qh newfacet_list)
     qh newfacet_list= next;
   if (facet == qh facet_next)
     qh facet_next= next;
   if (facet == qh visible_list)
-    qh visible_list= next; 
+    qh visible_list= next;
   if (previous) {
     previous->next= next;
     next->previous= previous;
@@ -1075,23 +1091,23 @@
     qh facet_list->previous= NULL;
   }
   qh num_facets--;
-  trace4((qh ferr, "qh_removefacet: remove f%d from facet_list\n", facet->id));
+  trace4((qh ferr, 4057, "qh_removefacet: remove f%d from facet_list\n", facet->id));
 } /* removefacet */
 
 
 /*---------------------------------
-  
+
   qh_removevertex( vertex )
     unlinks vertex from qh.vertex_list,
 
   returns:
-    updates qh.vertex_list .newvertex_list 
+    updates qh.vertex_list .newvertex_list
     decrements qh.num_vertices
 */
 void qh_removevertex(vertexT *vertex) {
   vertexT *next= vertex->next, *previous= vertex->previous;
-  
+
   if (vertex == qh newvertex_list)
     qh newvertex_list= next;
   if (previous) {
@@ -1102,19 +1118,19 @@
     qh vertex_list->previous= NULL;
   }
   qh num_vertices--;
-  trace4((qh ferr, "qh_removevertex: remove v%d from vertex_list\n", vertex->id));
+  trace4((qh ferr, 4058, "qh_removevertex: remove v%d from vertex_list\n", vertex->id));
 } /* removevertex */
 
 
 /*---------------------------------
-  
+
   qh_updatevertices()
     update vertex neighbors and delete interior vertices
 
   returns:
     if qh.VERTEXneighbors, updates neighbors for each vertex
-      if qh.newvertex_list, 
+      if qh.newvertex_list,
          removes visible neighbors  from vertex neighbors
       if qh.newfacet_list
          adds new facets to vertex neighbors
@@ -1129,38 +1145,38 @@
         removes visible facets from neighbor lists
         marks unused vertices for deletion
 */
-void qh_updatevertices (void /*qh newvertex_list, newfacet_list, visible_list*/) {
+void qh_updatevertices(void /*qh newvertex_list, newfacet_list, visible_list*/) {
   facetT *newfacet= NULL, *neighbor, **neighborp, *visible;
   vertexT *vertex, **vertexp;
 
-  trace3((qh ferr, "qh_updatevertices: delete interior vertices and update vertex->neighbors\n"));
+  trace3((qh ferr, 3013, "qh_updatevertices: delete interior vertices and update vertex->neighbors\n"));
   if (qh VERTEXneighbors) {
     FORALLvertex_(qh newvertex_list) {
       FOREACHneighbor_(vertex) {
-	if (neighbor->visible) 
-	  SETref_(neighbor)= NULL;
+        if (neighbor->visible)
+          SETref_(neighbor)= NULL;
       }
-      qh_setcompact (vertex->neighbors);
+      qh_setcompact(vertex->neighbors);
     }
     FORALLnew_facets {
       FOREACHvertex_(newfacet->vertices)
-        qh_setappend (&vertex->neighbors, newfacet);
+        qh_setappend(&vertex->neighbors, newfacet);
     }
     FORALLvisible_facets {
       FOREACHvertex_(visible->vertices) {
         if (!vertex->newlist && !vertex->deleted) {
-  	  FOREACHneighbor_(vertex) { /* this can happen under merging */
-	    if (!neighbor->visible)
-	      break;
-	  }
-	  if (neighbor)
-	    qh_setdel (vertex->neighbors, visible);
-	  else {
-	    vertex->deleted= True;
-	    qh_setappend (&qh del_vertices, vertex);
-	    trace2((qh ferr, "qh_updatevertices: delete vertex p%d (v%d) in f%d\n",
-		  qh_pointid(vertex->point), vertex->id, visible->id));
-  	  }
+          FOREACHneighbor_(vertex) { /* this can happen under merging */
+            if (!neighbor->visible)
+              break;
+          }
+          if (neighbor)
+            qh_setdel(vertex->neighbors, visible);
+          else {
+            vertex->deleted= True;
+            qh_setappend(&qh del_vertices, vertex);
+            trace2((qh ferr, 2041, "qh_updatevertices: delete vertex p%d(v%d) in f%d\n",
+                  qh_pointid(vertex->point), vertex->id, visible->id));
+          }
         }
       }
     }
@@ -1169,10 +1185,10 @@
       FOREACHvertex_(visible->vertices) {
         if (!vertex->newlist && !vertex->deleted) {
           vertex->deleted= True;
-	  qh_setappend (&qh del_vertices, vertex);
-	  trace2((qh ferr, "qh_updatevertices: delete vertex p%d (v%d) in f%d\n",
-		  qh_pointid(vertex->point), vertex->id, visible->id));
-  	}
+          qh_setappend(&qh del_vertices, vertex);
+          trace2((qh ferr, 2042, "qh_updatevertices: delete vertex p%d(v%d) in f%d\n",
+                  qh_pointid(vertex->point), vertex->id, visible->id));
+        }
       }
     }
   }

Modified: trunk/scipy/spatial/qhull/src/poly.h
===================================================================
--- trunk/scipy/spatial/qhull/src/poly.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/poly.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,56 +1,60 @@
 /*
  ---------------------------------
 
-   poly.h 
+   poly.h
    header file for poly.c and poly2.c
 
-   see qh-poly.htm, qhull.h and poly.c
+   see qh-poly.htm, libqhull.h and poly.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/poly.h#22 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFpoly
 #define qhDEFpoly 1
 
+#include "libqhull.h"
+
 /*===============   constants ========================== */
 
 /*----------------------------------
-  
-  ALGORITHMfault   
+
+  ALGORITHMfault
     use as argument to checkconvex() to report errors during buildhull
 */
 #define qh_ALGORITHMfault 0
 
 /*----------------------------------
-  
-  DATAfault        
+
+  DATAfault
     use as argument to checkconvex() to report errors during initialhull
 */
 #define qh_DATAfault 1
 
 /*----------------------------------
-  
+
   DUPLICATEridge
     special value for facet->neighbor to indicate a duplicate ridge
-  
+
   notes:
     set by matchneighbor, used by matchmatch and mark_dupridge
 */
-#define qh_DUPLICATEridge ( facetT * ) 1L
+#define qh_DUPLICATEridge (facetT *)1L
 
 /*----------------------------------
-  
+
   MERGEridge       flag in facet
     special value for facet->neighbor to indicate a merged ridge
-  
+
   notes:
     set by matchneighbor, used by matchmatch and mark_dupridge
 */
-#define qh_MERGEridge ( facetT * ) 2L
+#define qh_MERGEridge (facetT *)2L
 
 
 /*============ -structures- ====================*/
@@ -59,49 +63,49 @@
 
 /*----------------------------------
-  
+
   FORALLfacet_( facetlist ) { ... }
     assign 'facet' to each facet in facetlist
-    
+
   notes:
     uses 'facetT *facet;'
     assumes last facet is a sentinel
-    
+
   see:
     FORALLfacets
 */
-#define FORALLfacet_( facetlist ) if ( facetlist ) for( facet=( facetlist );facet && facet->next;facet=facet->next )
+#define FORALLfacet_( facetlist ) if (facetlist ) for ( facet=( facetlist ); facet && facet->next; facet= facet->next )
 
 /*----------------------------------
-  
-  FORALLnew_facets { ... } 
+
+  FORALLnew_facets { ... }
     assign 'newfacet' to each facet in qh.newfacet_list
-    
+
   notes:
     uses 'facetT *newfacet;'
     at exit, newfacet==NULL
 */
-#define FORALLnew_facets for( newfacet=qh newfacet_list;newfacet && newfacet->next;newfacet=newfacet->next )
+#define FORALLnew_facets for ( newfacet=qh newfacet_list;newfacet && newfacet->next;newfacet=newfacet->next )
 
 /*----------------------------------
-  
+
   FORALLvertex_( vertexlist ) { ... }
     assign 'vertex' to each vertex in vertexlist
-    
+
   notes:
     uses 'vertexT *vertex;'
     at exit, vertex==NULL
 */
-#define FORALLvertex_( vertexlist ) for ( vertex=( vertexlist );vertex && vertex->next;vertex= vertex->next )
+#define FORALLvertex_( vertexlist ) for (vertex=( vertexlist );vertex && vertex->next;vertex= vertex->next )
 
 /*----------------------------------
-  
+
   FORALLvisible_facets { ... }
     assign 'visible' to each visible facet in qh.visible_list
-    
+
   notes:
     uses 'vacetT *visible;'
     at exit, visible==NULL
@@ -110,10 +114,10 @@
 
 /*----------------------------------
-  
-  FORALLsame_( newfacet ) { ... } 
+
+  FORALLsame_( newfacet ) { ... }
     assign 'same' to each facet in newfacet->f.samecycle
-    
+
   notes:
     uses 'facetT *same;'
     stops when it returns to newfacet
@@ -122,10 +126,10 @@
 
 /*----------------------------------
-  
-  FORALLsame_cycle_( newfacet ) { ... } 
+
+  FORALLsame_cycle_( newfacet ) { ... }
     assign 'same' to each facet in newfacet->f.samecycle
-    
+
   notes:
     uses 'facetT *same;'
     at exit, same == NULL
@@ -136,13 +140,13 @@
 
 /*----------------------------------
-  
+
   FOREACHneighborA_( facet ) { ... }
     assign 'neighborA' to each neighbor in facet->neighbors
-  
+
   FOREACHneighborA_( vertex ) { ... }
     assign 'neighborA' to each neighbor in vertex->neighbors
-  
+
   declare:
     facetT *neighborA, **neighborAp;
 
@@ -153,10 +157,10 @@
 
 /*----------------------------------
-  
-  FOREACHvisible_( facets ) { ... } 
+
+  FOREACHvisible_( facets ) { ... }
     assign 'visible' to each facet in facets
-    
+
   notes:
     uses 'facetT *facet, *facetp;'
     see FOREACHsetelement_
@@ -165,10 +169,10 @@
 
 /*----------------------------------
-  
-  FOREACHnewfacet_( facets ) { ... } 
+
+  FOREACHnewfacet_( facets ) { ... }
     assign 'newfacet' to each facet in facets
-    
+
   notes:
     uses 'facetT *newfacet, *newfacetp;'
     see FOREACHsetelement_
@@ -177,10 +181,10 @@
 
 /*----------------------------------
-  
-  FOREACHvertexA_( vertices ) { ... } 
+
+  FOREACHvertexA_( vertices ) { ... }
     assign 'vertexA' to each vertex in vertices
-    
+
   notes:
     uses 'vertexT *vertexA, *vertexAp;'
     see FOREACHsetelement_
@@ -189,11 +193,11 @@
 
 /*----------------------------------
-  
-  FOREACHvertexreverse12_( vertices ) { ... } 
+
+  FOREACHvertexreverse12_( vertices ) { ... }
     assign 'vertex' to each vertex in vertices
     reverse order of first two vertices
-    
+
   notes:
     uses 'vertexT *vertex, *vertexp;'
     see FOREACHsetelement_
@@ -205,87 +209,87 @@
 
 void    qh_appendfacet(facetT *facet);
 void    qh_appendvertex(vertexT *vertex);
-void 	qh_attachnewfacets (void);
-boolT   qh_checkflipped (facetT *facet, realT *dist, boolT allerror);
-void	qh_delfacet(facetT *facet);
-void 	qh_deletevisible(void /*qh visible_list, qh horizon_list*/);
-setT   *qh_facetintersect (facetT *facetA, facetT *facetB, int *skipAp,int *skipBp, int extra);
-unsigned qh_gethash (int hashsize, setT *set, int size, int firstindex, void *skipelem);
+void    qh_attachnewfacets(void);
+boolT   qh_checkflipped(facetT *facet, realT *dist, boolT allerror);
+void    qh_delfacet(facetT *facet);
+void    qh_deletevisible(void /*qh visible_list, qh horizon_list*/);
+setT   *qh_facetintersect(facetT *facetA, facetT *facetB, int *skipAp,int *skipBp, int extra);
+int     qh_gethash(int hashsize, setT *set, int size, int firstindex, void *skipelem);
 facetT *qh_makenewfacet(setT *vertices, boolT toporient, facetT *facet);
-void    qh_makenewplanes ( void /* newfacet_list */);
-facetT *qh_makenew_nonsimplicial (facetT *visible, vertexT *apex, int *numnew);
-facetT *qh_makenew_simplicial (facetT *visible, vertexT *apex, int *numnew);
-void    qh_matchneighbor (facetT *newfacet, int newskip, int hashsize,
-			  int *hashcount);
-void	qh_matchnewfacets (void);
-boolT   qh_matchvertices (int firstindex, setT *verticesA, int skipA, 
-			  setT *verticesB, int *skipB, boolT *same);
+void    qh_makenewplanes(void /* newfacet_list */);
+facetT *qh_makenew_nonsimplicial(facetT *visible, vertexT *apex, int *numnew);
+facetT *qh_makenew_simplicial(facetT *visible, vertexT *apex, int *numnew);
+void    qh_matchneighbor(facetT *newfacet, int newskip, int hashsize,
+                          int *hashcount);
+void    qh_matchnewfacets(void);
+boolT   qh_matchvertices(int firstindex, setT *verticesA, int skipA,
+                          setT *verticesB, int *skipB, boolT *same);
 facetT *qh_newfacet(void);
 ridgeT *qh_newridge(void);
-int     qh_pointid (pointT *point);
-void 	qh_removefacet(facetT *facet);
-void 	qh_removevertex(vertexT *vertex);
-void    qh_updatevertices (void);
+int     qh_pointid(pointT *point);
+void    qh_removefacet(facetT *facet);
+void    qh_removevertex(vertexT *vertex);
+void    qh_updatevertices(void);
 
 
 /*========== -prototypes poly2.c in alphabetical order ===========*/
 
-void    qh_addhash (void* newelem, setT *hashtable, int hashsize, unsigned hash);
-void 	qh_check_bestdist (void);
-void    qh_check_maxout (void);
-void    qh_check_output (void);
-void    qh_check_point (pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2);
-void   	qh_check_points(void);
-void 	qh_checkconvex(facetT *facetlist, int fault);
+void    qh_addhash(void* newelem, setT *hashtable, int hashsize, int hash);
+void    qh_check_bestdist(void);
+void    qh_check_maxout(void);
+void    qh_check_output(void);
+void    qh_check_point(pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2);
+void    qh_check_points(void);
+void    qh_checkconvex(facetT *facetlist, int fault);
 void    qh_checkfacet(facetT *facet, boolT newmerge, boolT *waserrorp);
-void 	qh_checkflipped_all (facetT *facetlist);
-void 	qh_checkpolygon(facetT *facetlist);
-void    qh_checkvertex (vertexT *vertex);
-void 	qh_clearcenters (qh_CENTER type);
-void 	qh_createsimplex(setT *vertices);
-void 	qh_delridge(ridgeT *ridge);
-void    qh_delvertex (vertexT *vertex);
-setT   *qh_facet3vertex (facetT *facet);
-facetT *qh_findbestfacet (pointT *point, boolT bestoutside,
+void    qh_checkflipped_all(facetT *facetlist);
+void    qh_checkpolygon(facetT *facetlist);
+void    qh_checkvertex(vertexT *vertex);
+void    qh_clearcenters(qh_CENTER type);
+void    qh_createsimplex(setT *vertices);
+void    qh_delridge(ridgeT *ridge);
+void    qh_delvertex(vertexT *vertex);
+setT   *qh_facet3vertex(facetT *facet);
+facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
            realT *bestdist, boolT *isoutside);
-facetT *qh_findbestlower (facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart);
-facetT *qh_findfacet_all (pointT *point, realT *bestdist, boolT *isoutside,
-			  int *numpart);
-int 	qh_findgood (facetT *facetlist, int goodhorizon);
-void 	qh_findgood_all (facetT *facetlist);
-void    qh_furthestnext (void /* qh facet_list */);
-void    qh_furthestout (facetT *facet);
-void    qh_infiniteloop (facetT *facet);
-void 	qh_initbuild(void);
-void 	qh_initialhull(setT *vertices);
+facetT *qh_findbestlower(facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart);
+facetT *qh_findfacet_all(pointT *point, realT *bestdist, boolT *isoutside,
+                          int *numpart);
+int     qh_findgood(facetT *facetlist, int goodhorizon);
+void    qh_findgood_all(facetT *facetlist);
+void    qh_furthestnext(void /* qh facet_list */);
+void    qh_furthestout(facetT *facet);
+void    qh_infiniteloop(facetT *facet);
+void    qh_initbuild(void);
+void    qh_initialhull(setT *vertices);
 setT   *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints);
-vertexT *qh_isvertex (pointT *point, setT *vertices);
-vertexT *qh_makenewfacets (pointT *point /*horizon_list, visible_list*/);
-void    qh_matchduplicates (facetT *atfacet, int atskip, int hashsize, int *hashcount);
-void    qh_nearcoplanar ( void /* qh.facet_list */);
-vertexT *qh_nearvertex (facetT *facet, pointT *point, realT *bestdistp);
-int 	qh_newhashtable(int newsize);
+vertexT *qh_isvertex(pointT *point, setT *vertices);
+vertexT *qh_makenewfacets(pointT *point /*horizon_list, visible_list*/);
+void    qh_matchduplicates(facetT *atfacet, int atskip, int hashsize, int *hashcount);
+void    qh_nearcoplanar(void /* qh.facet_list */);
+vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp);
+int     qh_newhashtable(int newsize);
 vertexT *qh_newvertex(pointT *point);
-ridgeT *qh_nextridge3d (ridgeT *atridge, facetT *facet, vertexT **vertexp);
-void    qh_outcoplanar (void /* facet_list */);
-pointT *qh_point (int id);
-void 	qh_point_add (setT *set, pointT *point, void *elem);
-setT   *qh_pointfacet (void /*qh facet_list*/);
-setT   *qh_pointvertex (void /*qh facet_list*/);
-void 	qh_prependfacet(facetT *facet, facetT **facetlist);
-void	qh_printhashtable(FILE *fp);
-void    qh_printlists (void);
-void    qh_resetlists (boolT stats, boolT resetVisible /*qh newvertex_list newfacet_list visible_list*/);
-void    qh_setvoronoi_all (void);
-void	qh_triangulate (void /*qh facet_list*/);
-void    qh_triangulate_facet (facetT *facetA, vertexT **first_vertex);
-void    qh_triangulate_link (facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB);
-void	qh_triangulate_mirror (facetT *facetA, facetT *facetB);
-void    qh_triangulate_null (facetT *facetA);
+ridgeT *qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp);
+void    qh_outcoplanar(void /* facet_list */);
+pointT *qh_point(int id);
+void    qh_point_add(setT *set, pointT *point, void *elem);
+setT   *qh_pointfacet(void /*qh facet_list*/);
+setT   *qh_pointvertex(void /*qh facet_list*/);
+void    qh_prependfacet(facetT *facet, facetT **facetlist);
+void    qh_printhashtable(FILE *fp);
+void    qh_printlists(void);
+void    qh_resetlists(boolT stats, boolT resetVisible /*qh newvertex_list newfacet_list visible_list*/);
+void    qh_setvoronoi_all(void);
+void    qh_triangulate(void /*qh facet_list*/);
+void    qh_triangulate_facet(facetT *facetA, vertexT **first_vertex);
+void    qh_triangulate_link(facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB);
+void    qh_triangulate_mirror(facetT *facetA, facetT *facetB);
+void    qh_triangulate_null(facetT *facetA);
 void    qh_vertexintersect(setT **vertexsetA,setT *vertexsetB);
 setT   *qh_vertexintersect_new(setT *vertexsetA,setT *vertexsetB);
-void    qh_vertexneighbors (void /*qh facet_list*/);
-boolT 	qh_vertexsubset(setT *vertexsetA, setT *vertexsetB);
+void    qh_vertexneighbors(void /*qh facet_list*/);
+boolT   qh_vertexsubset(setT *vertexsetA, setT *vertexsetB);
 
 
 #endif /* qhDEFpoly */

Modified: trunk/scipy/spatial/qhull/src/poly2.c
===================================================================
--- trunk/scipy/spatial/qhull/src/poly2.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/poly2.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,14 +1,16 @@
 /*
  ---------------------------------
 
-   poly2.c 
+   poly2.c
    implements polygons and simplices
 
-   see qh-poly.htm, poly.h and qhull.h
+   see qh-poly.htm, poly.h and libqhull.h
 
    frequently used code is in poly.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/poly2.c#40 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #include "qhull_a.h"
@@ -17,15 +19,15 @@
 
 /*---------------------------------
-  
+
   qh_addhash( newelem, hashtable, hashsize, hash )
     add newelem to linear hash table at hash if not already there
 */
-void qh_addhash (void* newelem, setT *hashtable, int hashsize, unsigned hash) {
+void qh_addhash(void* newelem, setT *hashtable, int hashsize, int hash) {
   int scan;
   void *elem;
 
-  for (scan= (int)hash; (elem= SETelem_(hashtable, scan)); 
+  for (scan= (int)hash; (elem= SETelem_(hashtable, scan));
        scan= (++scan >= hashsize ? 0 : scan)) {
     if (elem == newelem)
       break;
@@ -37,13 +39,13 @@
 
 /*---------------------------------
-  
+
   qh_check_bestdist()
     check that all points are within max_outside of the nearest facet
     if qh.ONLYgood,
       ignores !good facets
 
-  see: 
+  see:
     qh_check_maxout(), qh_outerinner()
 
   notes:
@@ -61,27 +63,27 @@
       find the best facet for the point and check all coplanar facets
       error if point is outside of facet
 */
-void qh_check_bestdist (void) {
+void qh_check_bestdist(void) {
   boolT waserror= False, unassigned;
   facetT *facet, *bestfacet, *errfacet1= NULL, *errfacet2= NULL;
-  facetT *facetlist; 
+  facetT *facetlist;
   realT dist, maxoutside, maxdist= -REALmax;
   pointT *point;
   int numpart= 0, facet_i, facet_n, notgood= 0, notverified= 0;
   setT *facets;
 
-  trace1((qh ferr, "qh_check_bestdist: check points below nearest facet.  Facet_list f%d\n",
+  trace1((qh ferr, 1020, "qh_check_bestdist: check points below nearest facet.  Facet_list f%d\n",
       qh facet_list->id));
   maxoutside= qh_maxouter();
   maxoutside += qh DISTround;
   /* one more qh.DISTround for check computation */
-  trace1((qh ferr, "qh_check_bestdist: check that all points are within %2.2g of best facet\n", maxoutside));
-  facets= qh_pointfacet (/*qh facet_list*/);
+  trace1((qh ferr, 1021, "qh_check_bestdist: check that all points are within %2.2g of best facet\n", maxoutside));
+  facets= qh_pointfacet(/*qh facet_list*/);
   if (!qh_QUICKhelp && qh PRINTprecision)
-    fprintf (qh ferr, "\n\
+    qh_fprintf(qh ferr, 8091, "\n\
 qhull output completed.  Verifying that %d points are\n\
 below %2.2g of the nearest %sfacet.\n",
-	     qh_setsize(facets), maxoutside, (qh ONLYgood ?  "good " : ""));
+             qh_setsize(facets), maxoutside, (qh ONLYgood ?  "good " : ""));
   FOREACHfacet_i_(facets) {  /* for each point with facet assignment */
     if (facet)
       unassigned= False;
@@ -94,45 +96,44 @@
       continue;
     qh_distplane(point, facet, &dist);
     numpart++;
-    bestfacet= qh_findbesthorizon (!qh_IScheckmax, point, facet, qh_NOupper, &dist, &numpart);
+    bestfacet= qh_findbesthorizon(!qh_IScheckmax, point, facet, qh_NOupper, &dist, &numpart);
     /* occurs after statistics reported */
     maximize_(maxdist, dist);
     if (dist > maxoutside) {
-      if (qh ONLYgood && !bestfacet->good 
-	  && !((bestfacet= qh_findgooddist (point, bestfacet, &dist, &facetlist))
-	       && dist > maxoutside))
-	notgood++;
+      if (qh ONLYgood && !bestfacet->good
+          && !((bestfacet= qh_findgooddist(point, bestfacet, &dist, &facetlist))
+               && dist > maxoutside))
+        notgood++;
       else {
-	waserror= True;
-	fprintf(qh ferr, "qhull precision error: point p%d is outside facet f%d, distance= %6.8g maxoutside= %6.8g\n", 
-		facet_i, bestfacet->id, dist, maxoutside);
-	if (errfacet1 != bestfacet) {
-	  errfacet2= errfacet1;
-	  errfacet1= bestfacet;
-	}
+        waserror= True;
+        qh_fprintf(qh ferr, 6109, "qhull precision error: point p%d is outside facet f%d, distance= %6.8g maxoutside= %6.8g\n",
+                facet_i, bestfacet->id, dist, maxoutside);
+        if (errfacet1 != bestfacet) {
+          errfacet2= errfacet1;
+          errfacet1= bestfacet;
+        }
       }
     }else if (unassigned && dist < -qh MAXcoplanar)
       notverified++;
   }
-  qh_settempfree (&facets);
-  if (notverified && !qh DELAUNAY && !qh_QUICKhelp && qh PRINTprecision) 
-    fprintf(qh ferr, "\n%d points were well inside the hull.  If the hull contains\n\
+  qh_settempfree(&facets);
+  if (notverified && !qh DELAUNAY && !qh_QUICKhelp && qh PRINTprecision)
+    qh_fprintf(qh ferr, 8092, "\n%d points were well inside the hull.  If the hull contains\n\
 a lens-shaped component, these points were not verified.  Use\n\
-options 'Qci Tv' to verify all points.\n", notverified); 
+options 'Qci Tv' to verify all points.\n", notverified);
   if (maxdist > qh outside_err) {
-    fprintf( qh ferr, "qhull precision error (qh_check_bestdist): a coplanar point is %6.2g from convex hull.  The maximum value (qh.outside_err) is %6.2g\n",
+    qh_fprintf(qh ferr, 6110, "qhull precision error (qh_check_bestdist): a coplanar point is %6.2g from convex hull.  The maximum value(qh.outside_err) is %6.2g\n",
               maxdist, qh outside_err);
     qh_errexit2 (qh_ERRprec, errfacet1, errfacet2);
   }else if (waserror && qh outside_err > REALmax/2)
     qh_errexit2 (qh_ERRprec, errfacet1, errfacet2);
-  else if (waserror)
-    ;                       /* the error was logged to qh.ferr but does not effect the output */
-  trace0((qh ferr, "qh_check_bestdist: max distance outside %2.2g\n", maxdist));
+  /* else if waserror, the error was logged to qh.ferr but does not effect the output */
+  trace0((qh ferr, 20, "qh_check_bestdist: max distance outside %2.2g\n", maxdist));
 } /* check_bestdist */
 
 /*---------------------------------
-  
+
   qh_check_maxout()
     updates qh.max_outside by checking all points against bestfacet
     if qh.ONLYgood, ignores !good facets
@@ -140,13 +141,13 @@
   returns:
     updates facet->maxoutside via qh_findbesthorizon()
     sets qh.maxoutdone
-    if printing qh.min_vertex (qh_outerinner), 
+    if printing qh.min_vertex (qh_outerinner),
       it is updated to the current vertices
     removes inside/coplanar points from coplanarset as needed
 
   notes:
-    defines coplanar as min_vertex instead of MAXcoplanar 
-    may not need to check near-inside points because of qh.MAXcoplanar 
+    defines coplanar as min_vertex instead of MAXcoplanar
+    may not need to check near-inside points because of qh.MAXcoplanar
       and qh.KEEPnearinside (before it was -DISTround)
 
   see also:
@@ -163,7 +164,7 @@
     remove near-inside points from coplanar sets
 */
 #ifndef qh_NOmerge
-void qh_check_maxout (void) {
+void qh_check_maxout(void) {
   facetT *facet, *bestfacet, *neighbor, **neighborp, *facetlist;
   realT dist, maxoutside, minvertex, old_maxoutside;
   pointT *point;
@@ -171,94 +172,94 @@
   setT *facets, *vertices;
   vertexT *vertex;
 
-  trace1((qh ferr, "qh_check_maxout: check and update maxoutside for each facet.\n"));
+  trace1((qh ferr, 1022, "qh_check_maxout: check and update maxoutside for each facet.\n"));
   maxoutside= minvertex= 0;
-  if (qh VERTEXneighbors 
-  && (qh PRINTsummary || qh KEEPinside || qh KEEPcoplanar 
-	|| qh TRACElevel || qh PRINTstatistics
-	|| qh PRINTout[0] == qh_PRINTsummary || qh PRINTout[0] == qh_PRINTnone)) { 
-    trace1((qh ferr, "qh_check_maxout: determine actual maxoutside and minvertex\n"));
-    vertices= qh_pointvertex (/*qh facet_list*/);
+  if (qh VERTEXneighbors
+  && (qh PRINTsummary || qh KEEPinside || qh KEEPcoplanar
+        || qh TRACElevel || qh PRINTstatistics
+        || qh PRINTout[0] == qh_PRINTsummary || qh PRINTout[0] == qh_PRINTnone)) {
+    trace1((qh ferr, 1023, "qh_check_maxout: determine actual maxoutside and minvertex\n"));
+    vertices= qh_pointvertex(/*qh facet_list*/);
     FORALLvertices {
       FOREACHneighbor_(vertex) {
         zinc_(Zdistvertex);  /* distance also computed by main loop below */
-	qh_distplane (vertex->point, neighbor, &dist);
-	minimize_(minvertex, dist);
-	if (-dist > qh TRACEdist || dist > qh TRACEdist 
-	|| neighbor == qh tracefacet || vertex == qh tracevertex)
-	  fprintf (qh ferr, "qh_check_maxout: p%d (v%d) is %.2g from f%d\n",
-		    qh_pointid (vertex->point), vertex->id, dist, neighbor->id);
+        qh_distplane(vertex->point, neighbor, &dist);
+        minimize_(minvertex, dist);
+        if (-dist > qh TRACEdist || dist > qh TRACEdist
+        || neighbor == qh tracefacet || vertex == qh tracevertex)
+          qh_fprintf(qh ferr, 8093, "qh_check_maxout: p%d(v%d) is %.2g from f%d\n",
+                    qh_pointid(vertex->point), vertex->id, dist, neighbor->id);
       }
     }
     if (qh MERGING) {
       wmin_(Wminvertex, qh min_vertex);
     }
     qh min_vertex= minvertex;
-    qh_settempfree (&vertices);  
+    qh_settempfree(&vertices);
   }
-  facets= qh_pointfacet (/*qh facet_list*/);
+  facets= qh_pointfacet(/*qh facet_list*/);
   do {
     old_maxoutside= fmax_(qh max_outside, maxoutside);
     FOREACHfacet_i_(facets) {     /* for each point with facet assignment */
-      if (facet) { 
-	point= qh_point(facet_i);
-	if (point == qh GOODpointp)
-	  continue;
-	zinc_(Ztotcheck);
-	qh_distplane(point, facet, &dist);
-	numpart++;
-	bestfacet= qh_findbesthorizon (qh_IScheckmax, point, facet, !qh_NOupper, &dist, &numpart);
-	if (bestfacet && dist > maxoutside) {
-	  if (qh ONLYgood && !bestfacet->good 
-	  && !((bestfacet= qh_findgooddist (point, bestfacet, &dist, &facetlist))
-	       && dist > maxoutside))
-	    notgood++;
-	  else
-	    maxoutside= dist;
-	}
-	if (dist > qh TRACEdist || (bestfacet && bestfacet == qh tracefacet))
-	  fprintf (qh ferr, "qh_check_maxout: p%d is %.2g above f%d\n",
-		     qh_pointid (point), dist, bestfacet->id);
+      if (facet) {
+        point= qh_point(facet_i);
+        if (point == qh GOODpointp)
+          continue;
+        zzinc_(Ztotcheck);
+        qh_distplane(point, facet, &dist);
+        numpart++;
+        bestfacet= qh_findbesthorizon(qh_IScheckmax, point, facet, !qh_NOupper, &dist, &numpart);
+        if (bestfacet && dist > maxoutside) {
+          if (qh ONLYgood && !bestfacet->good
+          && !((bestfacet= qh_findgooddist(point, bestfacet, &dist, &facetlist))
+               && dist > maxoutside))
+            notgood++;
+          else
+            maxoutside= dist;
+        }
+        if (dist > qh TRACEdist || (bestfacet && bestfacet == qh tracefacet))
+          qh_fprintf(qh ferr, 8094, "qh_check_maxout: p%d is %.2g above f%d\n",
+                     qh_pointid(point), dist, bestfacet->id);
       }
     }
-  }while 
+  }while
     (maxoutside > 2*old_maxoutside);
-    /* if qh.maxoutside increases substantially, qh_SEARCHdist is not valid 
+    /* if qh.maxoutside increases substantially, qh_SEARCHdist is not valid
           e.g., RBOX 5000 s Z1 G1e-13 t1001200614 | qhull */
   zzadd_(Zcheckpart, numpart);
-  qh_settempfree (&facets);
+  qh_settempfree(&facets);
   wval_(Wmaxout)= maxoutside - qh max_outside;
   wmax_(Wmaxoutside, qh max_outside);
   qh max_outside= maxoutside;
-  qh_nearcoplanar (/*qh.facet_list*/);
+  qh_nearcoplanar(/*qh.facet_list*/);
   qh maxoutdone= True;
-  trace1((qh ferr, "qh_check_maxout: maxoutside %2.2g, min_vertex %2.2g, outside of not good %d\n",
+  trace1((qh ferr, 1024, "qh_check_maxout: maxoutside %2.2g, min_vertex %2.2g, outside of not good %d\n",
        maxoutside, qh min_vertex, notgood));
 } /* check_maxout */
 #else /* qh_NOmerge */
-void qh_check_maxout (void) {
+void qh_check_maxout(void) {
 }
 #endif
 
 /*---------------------------------
-  
+
   qh_check_output()
     performs the checks at the end of qhull algorithm
     Maybe called after voronoi output.  Will recompute otherwise centrums are Voronoi centers instead
 */
-void qh_check_output (void) {
+void qh_check_output(void) {
   int i;
 
   if (qh STOPcone)
     return;
   if (qh VERIFYoutput | qh IStracing | qh CHECKfrequently) {
-    qh_checkpolygon (qh facet_list);
-    qh_checkflipped_all (qh facet_list);
-    qh_checkconvex (qh facet_list, qh_ALGORITHMfault);
-  }else if (!qh MERGING && qh_newstats (qhstat precision, &i)) {
-    qh_checkflipped_all (qh facet_list);
-    qh_checkconvex (qh facet_list, qh_ALGORITHMfault);
+    qh_checkpolygon(qh facet_list);
+    qh_checkflipped_all(qh facet_list);
+    qh_checkconvex(qh facet_list, qh_ALGORITHMfault);
+  }else if (!qh MERGING && qh_newstats(qhstat precision, &i)) {
+    qh_checkflipped_all(qh facet_list);
+    qh_checkconvex(qh facet_list, qh_ALGORITHMfault);
   }
 } /* check_output */
 
@@ -266,11 +267,11 @@
 
 /*---------------------------------
-  
+
   qh_check_point( point, facet, maxoutside, maxdist, errfacet1, errfacet2 )
     check that point is less than maxoutside from facet
 */
-void qh_check_point (pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2) {
+void qh_check_point(pointT *point, facetT *facet, realT *maxoutside, realT *maxdist, facetT **errfacet1, facetT **errfacet2) {
   realT dist;
 
   /* occurs after statistics reported */
@@ -280,8 +281,8 @@
       *errfacet2= *errfacet1;
       *errfacet1= facet;
     }
-    fprintf(qh ferr, "qhull precision error: point p%d is outside facet f%d, distance= %6.8g maxoutside= %6.8g\n", 
-	      qh_pointid(point), facet->id, dist, *maxoutside);
+    qh_fprintf(qh ferr, 6111, "qhull precision error: point p%d is outside facet f%d, distance= %6.8g maxoutside= %6.8g\n",
+              qh_pointid(point), facet->id, dist, *maxoutside);
   }
   maximize_(*maxdist, dist);
 } /* qh_check_point */
@@ -289,12 +290,12 @@
 
 /*---------------------------------
-  
+
   qh_check_points()
     checks that all points are inside all facets
 
   notes:
-    if many points and qh_check_maxout not called (i.e., !qh.MERGING), 
+    if many points and qh_check_maxout not called (i.e., !qh.MERGING),
        calls qh_findbesthorizon (seldom done).
     ignores flipped facets
     maxoutside includes 2 qh.DISTrounds
@@ -310,7 +311,7 @@
         for all points
           check that point is inside facet
 */
-void qh_check_points (void) {
+void qh_check_points(void) {
   facetT *facet, *errfacet1= NULL, *errfacet2= NULL;
   realT total, maxoutside, maxdist= -REALmax;
   pointT *point, **pointp, *pointtemp;
@@ -319,16 +320,15 @@
   maxoutside= qh_maxouter();
   maxoutside += qh DISTround;
   /* one more qh.DISTround for check computation */
-  trace1((qh ferr, "qh_check_points: check all points below %2.2g of all facet planes\n",
-	  maxoutside));
+  trace1((qh ferr, 1025, "qh_check_points: check all points below %2.2g of all facet planes\n",
+          maxoutside));
   if (qh num_good)   /* miss counts other_points and !good facets */
-     total= (float) qh num_good * qh num_points;
+     total= (float)qh num_good * (float)qh num_points;
   else
-     total= (float) qh num_facets * qh num_points;
+     total= (float)qh num_facets * (float)qh num_points;
   if (total >= qh_VERIFYdirect && !qh maxoutdone) {
     if (!qh_QUICKhelp && qh SKIPcheckmax && qh MERGING)
-      fprintf (qh ferr, "\n\
-qhull input warning: merging without checking outer planes ('Q5' or 'Po').\n\
+      qh_fprintf(qh ferr, 7075, "qhull input warning: merging without checking outer planes('Q5' or 'Po').\n\
 Verify may report that a point is outside of a facet.\n");
     qh_check_bestdist();
   }else {
@@ -338,26 +338,24 @@
       testouter= False;
     if (!qh_QUICKhelp) {
       if (qh MERGEexact)
-	fprintf (qh ferr, "\n\
-qhull input warning: exact merge ('Qx').  Verify may report that a point\n\
+        qh_fprintf(qh ferr, 7076, "qhull input warning: exact merge ('Qx').  Verify may report that a point\n\
 is outside of a facet.  See qh-optq.htm#Qx\n");
       else if (qh SKIPcheckmax || qh NOnearinside)
-	fprintf (qh ferr, "\n\
-qhull input warning: no outer plane check ('Q5') or no processing of\n\
+        qh_fprintf(qh ferr, 7077, "qhull input warning: no outer plane check ('Q5') or no processing of\n\
 near-inside points ('Q8').  Verify may report that a point is outside\n\
 of a facet.\n");
     }
     if (qh PRINTprecision) {
       if (testouter)
-	fprintf (qh ferr, "\n\
+        qh_fprintf(qh ferr, 8098, "\n\
 Output completed.  Verifying that all points are below outer planes of\n\
-all %sfacets.  Will make %2.0f distance computations.\n", 
-	      (qh ONLYgood ?  "good " : ""), total);
+all %sfacets.  Will make %2.0f distance computations.\n",
+              (qh ONLYgood ?  "good " : ""), total);
       else
-	fprintf (qh ferr, "\n\
+        qh_fprintf(qh ferr, 8099, "\n\
 Output completed.  Verifying that all points are below %2.2g of\n\
-all %sfacets.  Will make %2.0f distance computations.\n", 
-	      maxoutside, (qh ONLYgood ?  "good " : ""), total);
+all %sfacets.  Will make %2.0f distance computations.\n",
+              maxoutside, (qh ONLYgood ?  "good " : ""), total);
     }
     FORALLfacets {
       if (!facet->good && qh ONLYgood)
@@ -365,40 +363,39 @@
       if (facet->flipped)
         continue;
       if (!facet->normal) {
-	fprintf( qh ferr, "qhull warning (qh_check_points): missing normal for facet f%d\n", facet->id);
+        qh_fprintf(qh ferr, 7061, "qhull warning (qh_check_points): missing normal for facet f%d\n", facet->id);
         continue;
       }
       if (testouter) {
 #if qh_MAXoutside
-	maxoutside= facet->maxoutside + 2* qh DISTround;
-	/* one DISTround to actual point and another to computed point */
+        maxoutside= facet->maxoutside + 2* qh DISTround;
+        /* one DISTround to actual point and another to computed point */
 #endif
       }
       FORALLpoints {
-	if (point != qh GOODpointp)
-	  qh_check_point (point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
+        if (point != qh GOODpointp)
+          qh_check_point(point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
       }
       FOREACHpoint_(qh other_points) {
-	if (point != qh GOODpointp)
-	  qh_check_point (point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
+        if (point != qh GOODpointp)
+          qh_check_point(point, facet, &maxoutside, &maxdist, &errfacet1, &errfacet2);
       }
     }
     if (maxdist > qh outside_err) {
-      fprintf( qh ferr, "qhull precision error (qh_check_points): a coplanar point is %6.2g from convex hull.  The maximum value (qh.outside_err) is %6.2g\n",
+      qh_fprintf(qh ferr, 6112, "qhull precision error (qh_check_points): a coplanar point is %6.2g from convex hull.  The maximum value(qh.outside_err) is %6.2g\n",
                 maxdist, qh outside_err );
       qh_errexit2( qh_ERRprec, errfacet1, errfacet2 );
     }else if (errfacet1 && qh outside_err > REALmax/2)
         qh_errexit2( qh_ERRprec, errfacet1, errfacet2 );
-    else if (errfacet1)
-        ;  /* the error was logged to qh.ferr but does not effect the output */
-    trace0((qh ferr, "qh_check_points: max distance outside %2.2g\n", maxdist));
+    /* else if errfacet1, the error was logged to qh.ferr but does not effect the output */
+    trace0((qh ferr, 21, "qh_check_points: max distance outside %2.2g\n", maxdist));
   }
 } /* check_points */
 
 
 /*---------------------------------
-  
+
   qh_checkconvex( facetlist, fault )
     check that each ridge in facetlist is convex
     fault = qh_DATAfault if reporting errors
@@ -409,11 +406,11 @@
     errors if concaveridge or if merging an coplanar ridge
 
   note:
-    if not merging, 
+    if not merging,
       tests vertices for neighboring simplicial facets
-    else if ZEROcentrum, 
+    else if ZEROcentrum,
       tests vertices for neighboring simplicial   facets
-    else 
+    else
       tests centrums of neighboring facets
 
   design:
@@ -422,7 +419,7 @@
       if ZEROcentrum and simplicial neighbors
         test vertices for neighboring simplicial facets
       else
-        test centrum against all neighbors 
+        test centrum against all neighbors
 */
 void qh_checkconvex(facetT *facetlist, int fault) {
   facetT *facet, *neighbor, **neighborp, *errfacet1=NULL, *errfacet2=NULL;
@@ -432,16 +429,16 @@
   boolT waserror= False, centrum_warning= False, tempcentrum= False, allsimplicial;
   int neighbor_i;
 
-  trace1((qh ferr, "qh_checkconvex: check all ridges are convex\n"));
+  trace1((qh ferr, 1026, "qh_checkconvex: check all ridges are convex\n"));
   if (!qh RERUN) {
     zzval_(Zconcaveridges)= 0;
     zzval_(Zcoplanarridges)= 0;
   }
   FORALLfacet_(facetlist) {
     if (facet->flipped) {
-      qh_precision ("flipped facet");
-      fprintf (qh ferr, "qhull precision error: f%d is flipped (interior point is outside)\n",
-	       facet->id);
+      qh_precision("flipped facet");
+      qh_fprintf(qh ferr, 6113, "qhull precision error: f%d is flipped(interior point is outside)\n",
+               facet->id);
       errfacet1= facet;
       waserror= True;
       continue;
@@ -453,39 +450,39 @@
       neighbor_i= 0;
       FOREACHneighbor_(facet) {
         vertex= SETelemt_(facet->vertices, neighbor_i++, vertexT);
-	if (!neighbor->simplicial || neighbor->tricoplanar) {
-	  allsimplicial= False;
-	  continue;
-	}
-        qh_distplane (vertex->point, neighbor, &dist);
+        if (!neighbor->simplicial || neighbor->tricoplanar) {
+          allsimplicial= False;
+          continue;
+        }
+        qh_distplane(vertex->point, neighbor, &dist);
         if (dist > -qh DISTround) {
-	  if (fault == qh_DATAfault) {
-            qh_precision ("coplanar or concave ridge");
-	    fprintf (qh ferr, "qhull precision error: initial simplex is not convex. Distance=%.2g\n", dist);
-	    qh_errexit(qh_ERRsingular, NULL, NULL);
-	  }
+          if (fault == qh_DATAfault) {
+            qh_precision("coplanar or concave ridge");
+            qh_fprintf(qh ferr, 6114, "qhull precision error: initial simplex is not convex. Distance=%.2g\n", dist);
+            qh_errexit(qh_ERRsingular, NULL, NULL);
+          }
           if (dist > qh DISTround) {
             zzinc_(Zconcaveridges);
-            qh_precision ("concave ridge");
-            fprintf (qh ferr, "qhull precision error: f%d is concave to f%d, since p%d (v%d) is %6.4g above\n",
+            qh_precision("concave ridge");
+            qh_fprintf(qh ferr, 6115, "qhull precision error: f%d is concave to f%d, since p%d(v%d) is %6.4g above\n",
               facet->id, neighbor->id, qh_pointid(vertex->point), vertex->id, dist);
             errfacet1= facet;
             errfacet2= neighbor;
             waserror= True;
           }else if (qh ZEROcentrum) {
             if (dist > 0) {     /* qh_checkzero checks that dist < - qh DISTround */
-              zzinc_(Zcoplanarridges); 
-              qh_precision ("coplanar ridge");
-              fprintf (qh ferr, "qhull precision error: f%d is clearly not convex to f%d, since p%d (v%d) is %6.4g above\n",
+              zzinc_(Zcoplanarridges);
+              qh_precision("coplanar ridge");
+              qh_fprintf(qh ferr, 6116, "qhull precision error: f%d is clearly not convex to f%d, since p%d(v%d) is %6.4g above\n",
                 facet->id, neighbor->id, qh_pointid(vertex->point), vertex->id, dist);
               errfacet1= facet;
               errfacet2= neighbor;
               waserror= True;
-	    }
-	  }else {              
+            }
+          }else {
             zzinc_(Zcoplanarridges);
-            qh_precision ("coplanar ridge");
-            trace0((qh ferr, "qhull precision error: f%d may be coplanar to f%d, since p%d (v%d) is within %6.4g during p%d\n",
+            qh_precision("coplanar ridge");
+            trace0((qh ferr, 22, "qhull precision error: f%d may be coplanar to f%d, since p%d(v%d) is within %6.4g during p%d\n",
               facet->id, neighbor->id, qh_pointid(vertex->point), vertex->id, dist, qh furthest_id));
           }
         }
@@ -494,40 +491,40 @@
     if (!allsimplicial) {
       if (qh CENTERtype == qh_AScentrum) {
         if (!facet->center)
-          facet->center= qh_getcentrum (facet);
+          facet->center= qh_getcentrum(facet);
         centrum= facet->center;
       }else {
-	if (!centrum_warning && (!facet->simplicial || facet->tricoplanar)) {
-	   centrum_warning= True;
-	   fprintf (qh ferr, "qhull note: recomputing centrums for convexity test.  This may lead to false, precision errors.\n");
-	}
+        if (!centrum_warning && (!facet->simplicial || facet->tricoplanar)) {
+           centrum_warning= True;
+           qh_fprintf(qh ferr, 7062, "qhull warning: recomputing centrums for convexity test.  This may lead to false, precision errors.\n");
+        }
         centrum= qh_getcentrum(facet);
         tempcentrum= True;
       }
       FOREACHneighbor_(facet) {
-	if (qh ZEROcentrum && facet->simplicial && neighbor->simplicial)
-	  continue;
-	if (facet->tricoplanar || neighbor->tricoplanar)
-	  continue;
+        if (qh ZEROcentrum && facet->simplicial && neighbor->simplicial)
+          continue;
+        if (facet->tricoplanar || neighbor->tricoplanar)
+          continue;
         zzinc_(Zdistconvex);
-        qh_distplane (centrum, neighbor, &dist);
+        qh_distplane(centrum, neighbor, &dist);
         if (dist > qh DISTround) {
           zzinc_(Zconcaveridges);
-          qh_precision ("concave ridge");
-          fprintf (qh ferr, "qhull precision error: f%d is concave to f%d.  Centrum of f%d is %6.4g above f%d\n",
+          qh_precision("concave ridge");
+          qh_fprintf(qh ferr, 6117, "qhull precision error: f%d is concave to f%d.  Centrum of f%d is %6.4g above f%d\n",
             facet->id, neighbor->id, facet->id, dist, neighbor->id);
           errfacet1= facet;
           errfacet2= neighbor;
           waserror= True;
-	}else if (dist >= 0.0) {   /* if arithmetic always rounds the same,
-				     can test against centrum radius instead */
+        }else if (dist >= 0.0) {   /* if arithmetic always rounds the same,
+                                     can test against centrum radius instead */
           zzinc_(Zcoplanarridges);
-          qh_precision ("coplanar ridge");
-          fprintf (qh ferr, "qhull precision error: f%d is coplanar or concave to f%d.  Centrum of f%d is %6.4g above f%d\n",
+          qh_precision("coplanar ridge");
+          qh_fprintf(qh ferr, 6118, "qhull precision error: f%d is coplanar or concave to f%d.  Centrum of f%d is %6.4g above f%d\n",
             facet->id, neighbor->id, facet->id, dist, neighbor->id);
-	  errfacet1= facet;
-	  errfacet2= neighbor;
-	  waserror= True;
+          errfacet1= facet;
+          errfacet2= neighbor;
+          waserror= True;
         }
       }
       if (tempcentrum)
@@ -541,7 +538,7 @@
 
 /*---------------------------------
-  
+
   qh_checkfacet( facet, newmerge, waserror )
     checks for consistency errors in facet
     newmerge set if from merge.c
@@ -560,11 +557,11 @@
     neighbors are reciprocated
     ridge neighbors are facet neighbors and a ridge for every neighbor
     simplicial neighbors match facetintersect
-    vertex intersection matches vertices of common ridges 
+    vertex intersection matches vertices of common ridges
     vertex neighbors and facet vertices agree
     all ridges have distinct vertex sets
 
-  notes:  
+  notes:
     uses neighbor->seen
 
   design:
@@ -587,28 +584,28 @@
   setT *intersection;
 
   if (facet->visible) {
-    fprintf (qh ferr, "qhull internal error (qh_checkfacet): facet f%d is on the visible_list\n",
+    qh_fprintf(qh ferr, 6119, "qhull internal error (qh_checkfacet): facet f%d is on the visible_list\n",
       facet->id);
-    qh_errexit (qh_ERRqhull, facet, NULL);
+    qh_errexit(qh_ERRqhull, facet, NULL);
   }
   if (!facet->normal) {
-    fprintf (qh ferr, "qhull internal error (qh_checkfacet): facet f%d does not have  a normal\n",
+    qh_fprintf(qh ferr, 6120, "qhull internal error (qh_checkfacet): facet f%d does not have  a normal\n",
       facet->id);
     waserror= True;
   }
-  qh_setcheck (facet->vertices, "vertices for f", facet->id);
-  qh_setcheck (facet->ridges, "ridges for f", facet->id);
-  qh_setcheck (facet->outsideset, "outsideset for f", facet->id);
-  qh_setcheck (facet->coplanarset, "coplanarset for f", facet->id);
-  qh_setcheck (facet->neighbors, "neighbors for f", facet->id);
+  qh_setcheck(facet->vertices, "vertices for f", facet->id);
+  qh_setcheck(facet->ridges, "ridges for f", facet->id);
+  qh_setcheck(facet->outsideset, "outsideset for f", facet->id);
+  qh_setcheck(facet->coplanarset, "coplanarset for f", facet->id);
+  qh_setcheck(facet->neighbors, "neighbors for f", facet->id);
   FOREACHvertex_(facet->vertices) {
     if (vertex->deleted) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): deleted vertex v%d in f%d\n", vertex->id, facet->id);
-      qh_errprint ("ERRONEOUS", NULL, NULL, NULL, vertex);
+      qh_fprintf(qh ferr, 6121, "qhull internal error (qh_checkfacet): deleted vertex v%d in f%d\n", vertex->id, facet->id);
+      qh_errprint("ERRONEOUS", NULL, NULL, NULL, vertex);
       waserror= True;
     }
     if (vertex->id >= previousid) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): vertices of f%d are not in descending id order at v%d\n", facet->id, vertex->id);
+      qh_fprintf(qh ferr, 6122, "qhull internal error (qh_checkfacet): vertices of f%d are not in descending id order at v%d\n", facet->id, vertex->id);
       waserror= True;
       break;
     }
@@ -618,18 +615,18 @@
   numvertices= qh_setsize(facet->vertices);
   numridges= qh_setsize(facet->ridges);
   if (facet->simplicial) {
-    if (numvertices+numneighbors != 2*qh hull_dim 
+    if (numvertices+numneighbors != 2*qh hull_dim
     && !facet->degenerate && !facet->redundant) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): for simplicial facet f%d, #vertices %d + #neighbors %d != 2*qh hull_dim\n", 
+      qh_fprintf(qh ferr, 6123, "qhull internal error (qh_checkfacet): for simplicial facet f%d, #vertices %d + #neighbors %d != 2*qh hull_dim\n",
                 facet->id, numvertices, numneighbors);
-      qh_setprint (qh ferr, "", facet->neighbors);
+      qh_setprint(qh ferr, "", facet->neighbors);
       waserror= True;
     }
   }else { /* non-simplicial */
-    if (!newmerge 
+    if (!newmerge
     &&(numvertices < qh hull_dim || numneighbors < qh hull_dim)
     && !facet->degenerate && !facet->redundant) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): for facet f%d, #vertices %d or #neighbors %d < qh hull_dim\n",
+      qh_fprintf(qh ferr, 6124, "qhull internal error (qh_checkfacet): for facet f%d, #vertices %d or #neighbors %d < qh hull_dim\n",
          facet->id, numvertices, numneighbors);
        waserror= True;
     }
@@ -638,49 +635,49 @@
     ||(qh hull_dim == 3 && numvertices > numridges && !qh NEWfacets)
     ||(qh hull_dim == 2 && numridges + numvertices + numneighbors != 6)) {
       if (!facet->degenerate && !facet->redundant) {
-	fprintf(qh ferr, "qhull internal error (qh_checkfacet): for facet f%d, #ridges %d < #neighbors %d or (3-d) > #vertices %d or (2-d) not all 2\n",
-	    facet->id, numridges, numneighbors, numvertices);
-	waserror= True;
+        qh_fprintf(qh ferr, 6125, "qhull internal error (qh_checkfacet): for facet f%d, #ridges %d < #neighbors %d or(3-d) > #vertices %d or(2-d) not all 2\n",
+            facet->id, numridges, numneighbors, numvertices);
+        waserror= True;
       }
     }
   }
   FOREACHneighbor_(facet) {
     if (neighbor == qh_MERGEridge || neighbor == qh_DUPLICATEridge) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): facet f%d still has a MERGE or DUP neighbor\n", facet->id);
-      qh_errexit (qh_ERRqhull, facet, NULL);
+      qh_fprintf(qh ferr, 6126, "qhull internal error (qh_checkfacet): facet f%d still has a MERGE or DUP neighbor\n", facet->id);
+      qh_errexit(qh_ERRqhull, facet, NULL);
     }
     neighbor->seen= True;
   }
   FOREACHneighbor_(facet) {
     if (!qh_setin(neighbor->neighbors, facet)) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): facet f%d has neighbor f%d, but f%d does not have neighbor f%d\n",
-	      facet->id, neighbor->id, neighbor->id, facet->id);
+      qh_fprintf(qh ferr, 6127, "qhull internal error (qh_checkfacet): facet f%d has neighbor f%d, but f%d does not have neighbor f%d\n",
+              facet->id, neighbor->id, neighbor->id, facet->id);
       errother= neighbor;
       waserror= True;
     }
     if (!neighbor->seen) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): facet f%d has a duplicate neighbor f%d\n",
-	      facet->id, neighbor->id);
+      qh_fprintf(qh ferr, 6128, "qhull internal error (qh_checkfacet): facet f%d has a duplicate neighbor f%d\n",
+              facet->id, neighbor->id);
       errother= neighbor;
       waserror= True;
-    }    
+    }
     neighbor->seen= False;
   }
   FOREACHridge_(facet->ridges) {
-    qh_setcheck (ridge->vertices, "vertices for r", ridge->id);
+    qh_setcheck(ridge->vertices, "vertices for r", ridge->id);
     ridge->seen= False;
   }
   FOREACHridge_(facet->ridges) {
     if (ridge->seen) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): facet f%d has a duplicate ridge r%d\n",
-	      facet->id, ridge->id);
+      qh_fprintf(qh ferr, 6129, "qhull internal error (qh_checkfacet): facet f%d has a duplicate ridge r%d\n",
+              facet->id, ridge->id);
       errridge= ridge;
       waserror= True;
-    }    
+    }
     ridge->seen= True;
     numRvertices= qh_setsize(ridge->vertices);
     if (numRvertices != qh hull_dim - 1) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): ridge between f%d and f%d has %d vertices\n", 
+      qh_fprintf(qh ferr, 6130, "qhull internal error (qh_checkfacet): ridge between f%d and f%d has %d vertices\n",
                 ridge->top->id, ridge->bottom->id, numRvertices);
       errridge= ridge;
       waserror= True;
@@ -688,7 +685,7 @@
     neighbor= otherfacet_(ridge, facet);
     neighbor->seen= True;
     if (!qh_setin(facet->neighbors, neighbor)) {
-      fprintf(qh ferr, "qhull internal error (qh_checkfacet): for facet f%d, neighbor f%d of ridge r%d not in facet\n",
+      qh_fprintf(qh ferr, 6131, "qhull internal error (qh_checkfacet): for facet f%d, neighbor f%d of ridge r%d not in facet\n",
            facet->id, neighbor->id, ridge->id);
       errridge= ridge;
       waserror= True;
@@ -697,73 +694,73 @@
   if (!facet->simplicial) {
     FOREACHneighbor_(facet) {
       if (!neighbor->seen) {
-        fprintf(qh ferr, "qhull internal error (qh_checkfacet): facet f%d does not have a ridge for neighbor f%d\n",
-	      facet->id, neighbor->id);
-	errother= neighbor;
+        qh_fprintf(qh ferr, 6132, "qhull internal error (qh_checkfacet): facet f%d does not have a ridge for neighbor f%d\n",
+              facet->id, neighbor->id);
+        errother= neighbor;
         waserror= True;
       }
       intersection= qh_vertexintersect_new(facet->vertices, neighbor->vertices);
-      qh_settemppush (intersection);
+      qh_settemppush(intersection);
       FOREACHvertex_(facet->vertices) {
-	vertex->seen= False;
-	vertex->seen2= False;
+        vertex->seen= False;
+        vertex->seen2= False;
       }
       FOREACHvertex_(intersection)
-	vertex->seen= True;
+        vertex->seen= True;
       FOREACHridge_(facet->ridges) {
-	if (neighbor != otherfacet_(ridge, facet))
-	    continue;
-	FOREACHvertex_(ridge->vertices) {
-	  if (!vertex->seen) {
-	    fprintf (qh ferr, "qhull internal error (qh_checkfacet): vertex v%d in r%d not in f%d intersect f%d\n",
-  	          vertex->id, ridge->id, facet->id, neighbor->id);
-	    qh_errexit (qh_ERRqhull, facet, ridge);
-	  }
-	  vertex->seen2= True;
-	}
+        if (neighbor != otherfacet_(ridge, facet))
+            continue;
+        FOREACHvertex_(ridge->vertices) {
+          if (!vertex->seen) {
+            qh_fprintf(qh ferr, 6133, "qhull internal error (qh_checkfacet): vertex v%d in r%d not in f%d intersect f%d\n",
+                  vertex->id, ridge->id, facet->id, neighbor->id);
+            qh_errexit(qh_ERRqhull, facet, ridge);
+          }
+          vertex->seen2= True;
+        }
       }
       if (!newmerge) {
-	FOREACHvertex_(intersection) {
-	  if (!vertex->seen2) {
-	    if (qh IStracing >=3 || !qh MERGING) {
-	      fprintf (qh ferr, "qhull precision error (qh_checkfacet): vertex v%d in f%d intersect f%d but\n\
+        FOREACHvertex_(intersection) {
+          if (!vertex->seen2) {
+            if (qh IStracing >=3 || !qh MERGING) {
+              qh_fprintf(qh ferr, 6134, "qhull precision error (qh_checkfacet): vertex v%d in f%d intersect f%d but\n\
  not in a ridge.  This is ok under merging.  Last point was p%d\n",
-		     vertex->id, facet->id, neighbor->id, qh furthest_id);
-	      if (!qh FORCEoutput && !qh MERGING) {
-		qh_errprint ("ERRONEOUS", facet, neighbor, NULL, vertex);
-		if (!qh MERGING)
-		  qh_errexit (qh_ERRqhull, NULL, NULL);
-	      }
-	    }
-	  }
-	}
-      }      
-      qh_settempfree (&intersection);
+                     vertex->id, facet->id, neighbor->id, qh furthest_id);
+              if (!qh FORCEoutput && !qh MERGING) {
+                qh_errprint("ERRONEOUS", facet, neighbor, NULL, vertex);
+                if (!qh MERGING)
+                  qh_errexit(qh_ERRqhull, NULL, NULL);
+              }
+            }
+          }
+        }
+      }
+      qh_settempfree(&intersection);
     }
   }else { /* simplicial */
     FOREACHneighbor_(facet) {
-      if (neighbor->simplicial) {    
-	skipA= SETindex_(facet->neighbors, neighbor);
-	skipB= qh_setindex (neighbor->neighbors, facet);
-	if (!qh_setequal_skip (facet->vertices, skipA, neighbor->vertices, skipB)) {
-	  fprintf (qh ferr, "qhull internal error (qh_checkfacet): facet f%d skip %d and neighbor f%d skip %d do not match \n",
-		   facet->id, skipA, neighbor->id, skipB);
-	  errother= neighbor;
-	  waserror= True;
-	}
+      if (neighbor->simplicial) {
+        skipA= SETindex_(facet->neighbors, neighbor);
+        skipB= qh_setindex(neighbor->neighbors, facet);
+        if (!qh_setequal_skip(facet->vertices, skipA, neighbor->vertices, skipB)) {
+          qh_fprintf(qh ferr, 6135, "qhull internal error (qh_checkfacet): facet f%d skip %d and neighbor f%d skip %d do not match \n",
+                   facet->id, skipA, neighbor->id, skipB);
+          errother= neighbor;
+          waserror= True;
+        }
       }
     }
   }
   if (qh hull_dim < 5 && (qh IStracing > 2 || qh CHECKfrequently)) {
     FOREACHridge_i_(facet->ridges) {           /* expensive */
-      for (i= ridge_i+1; i < ridge_n; i++) {
-	ridge2= SETelemt_(facet->ridges, i, ridgeT);
-	if (qh_setequal (ridge->vertices, ridge2->vertices)) {
-	  fprintf (qh ferr, "qh_checkfacet: ridges r%d and r%d have the same vertices\n",
-		  ridge->id, ridge2->id);
-	  errridge= ridge;
-	  waserror= True;
-	}
+      for (i=ridge_i+1; i < ridge_n; i++) {
+        ridge2= SETelemt_(facet->ridges, i, ridgeT);
+        if (qh_setequal(ridge->vertices, ridge2->vertices)) {
+          qh_fprintf(qh ferr, 6227, "Qhull internal error (qh_checkfacet): ridges r%d and r%d have the same vertices\n",
+                  ridge->id, ridge2->id);
+          errridge= ridge;
+          waserror= True;
+        }
       }
     }
   }
@@ -776,11 +773,11 @@
 
 /*---------------------------------
-  
+
   qh_checkflipped_all( facetlist )
     checks orientation of facets in list against interior point
 */
-void qh_checkflipped_all (facetT *facetlist) {
+void qh_checkflipped_all(facetT *facetlist) {
   facetT *facet;
   boolT waserror= False;
   realT dist;
@@ -788,17 +785,17 @@
   if (facetlist == qh facet_list)
     zzval_(Zflippedfacets)= 0;
   FORALLfacet_(facetlist) {
-    if (facet->normal && !qh_checkflipped (facet, &dist, !qh_ALL)) {
-      fprintf(qh ferr, "qhull precision error: facet f%d is flipped, distance= %6.12g\n",
-	      facet->id, dist);
+    if (facet->normal && !qh_checkflipped(facet, &dist, !qh_ALL)) {
+      qh_fprintf(qh ferr, 6136, "qhull precision error: facet f%d is flipped, distance= %6.12g\n",
+              facet->id, dist);
       if (!qh FORCEoutput) {
-	qh_errprint("ERRONEOUS", facet, NULL, NULL, NULL);
-	waserror= True;
+        qh_errprint("ERRONEOUS", facet, NULL, NULL, NULL);
+        waserror= True;
       }
     }
   }
   if (waserror) {
-    fprintf (qh ferr, "\n\
+    qh_fprintf(qh ferr, 8101, "\n\
 A flipped facet occurs when its distance to the interior point is\n\
 greater than %2.2g, the maximum roundoff error.\n", -qh DISTround);
     qh_errexit(qh_ERRprec, NULL, NULL);
@@ -807,7 +804,7 @@
 
 /*---------------------------------
-  
+
   qh_checkpolygon( facetlist )
     checks the correctness of the structure
 
@@ -821,7 +818,7 @@
     initializes vertexlist
     for each facet
       checks vertex set
-    if checking all facets (qh.facetlist)
+    if checking all facets(qh.facetlist)
       check facet count
       if qh.VERTEXneighbors
         check vertex neighbors and count
@@ -833,8 +830,8 @@
   int numfacets= 0, numvertices= 0, numridges= 0;
   int totvneighbors= 0, totvertices= 0;
   boolT waserror= False, nextseen= False, visibleseen= False;
-  
-  trace1((qh ferr, "qh_checkpolygon: check all facets from f%d\n", facetlist->id));
+
+  trace1((qh ferr, 1027, "qh_checkpolygon: check all facets from f%d\n", facetlist->id));
   if (facetlist != qh facet_list || qh ONLYgood)
     nextseen= True;
   FORALLfacet_(facetlist) {
@@ -842,28 +839,28 @@
       visibleseen= True;
     if (!facet->visible) {
       if (!nextseen) {
-	if (facet == qh facet_next)
-	  nextseen= True;
-	else if (qh_setsize (facet->outsideset)) {
-	  if (!qh NARROWhull
+        if (facet == qh facet_next)
+          nextseen= True;
+        else if (qh_setsize(facet->outsideset)) {
+          if (!qh NARROWhull
 #if !qh_COMPUTEfurthest
-	       || facet->furthestdist >= qh MINoutside
+               || facet->furthestdist >= qh MINoutside
 #endif
-			) {
-	    fprintf (qh ferr, "qhull internal error (qh_checkpolygon): f%d has outside points before qh facet_next\n",
-		     facet->id);
-	    qh_errexit (qh_ERRqhull, facet, NULL);
-	  }
-	}
+                        ) {
+            qh_fprintf(qh ferr, 6137, "qhull internal error (qh_checkpolygon): f%d has outside points before qh facet_next\n",
+                     facet->id);
+            qh_errexit(qh_ERRqhull, facet, NULL);
+          }
+        }
       }
       numfacets++;
       qh_checkfacet(facet, False, &waserror);
     }
   }
   if (qh visible_list && !visibleseen && facetlist == qh facet_list) {
-    fprintf (qh ferr, "qhull internal error (qh_checkpolygon): visible list f%d no longer on facet list\n", qh visible_list->id);
+    qh_fprintf(qh ferr, 6138, "qhull internal error (qh_checkpolygon): visible list f%d no longer on facet list\n", qh visible_list->id);
     qh_printlists();
-    qh_errexit (qh_ERRqhull, qh visible_list, NULL);
+    qh_errexit(qh_ERRqhull, qh visible_list, NULL);
   }
   if (facetlist == qh facet_list)
     vertexlist= qh vertex_list;
@@ -874,75 +871,75 @@
   FORALLvertex_(vertexlist) {
     vertex->seen= False;
     vertex->visitid= 0;
-  }  
+  }
   FORALLfacet_(facetlist) {
     if (facet->visible)
       continue;
     if (facet->simplicial)
       numridges += qh hull_dim;
     else
-      numridges += qh_setsize (facet->ridges);
+      numridges += qh_setsize(facet->ridges);
     FOREACHvertex_(facet->vertices) {
       vertex->visitid++;
       if (!vertex->seen) {
-	vertex->seen= True;
-	numvertices++;
-	if (qh_pointid (vertex->point) == -1) {
-	  fprintf (qh ferr, "qhull internal error (qh_checkpolygon): unknown point %p for vertex v%d first_point %p\n",
-		   vertex->point, vertex->id, qh first_point);
-	  waserror= True;
-	}
+        vertex->seen= True;
+        numvertices++;
+        if (qh_pointid(vertex->point) == -1) {
+          qh_fprintf(qh ferr, 6139, "qhull internal error (qh_checkpolygon): unknown point %p for vertex v%d first_point %p\n",
+                   vertex->point, vertex->id, qh first_point);
+          waserror= True;
+        }
       }
     }
   }
-  qh vertex_visit += numfacets;
+  qh vertex_visit += (unsigned int)numfacets;
   if (facetlist == qh facet_list) {
     if (numfacets != qh num_facets - qh num_visible) {
-      fprintf(qh ferr, "qhull internal error (qh_checkpolygon): actual number of facets is %d, cumulative facet count is %d - %d visible facets\n",
-	      numfacets, qh num_facets, qh num_visible);
+      qh_fprintf(qh ferr, 6140, "qhull internal error (qh_checkpolygon): actual number of facets is %d, cumulative facet count is %d - %d visible facets\n",
+              numfacets, qh num_facets, qh num_visible);
       waserror= True;
     }
     qh vertex_visit++;
     if (qh VERTEXneighbors) {
       FORALLvertices {
-	qh_setcheck (vertex->neighbors, "neighbors for v", vertex->id);
-	if (vertex->deleted)
-	  continue;
-	totvneighbors += qh_setsize (vertex->neighbors);
+        qh_setcheck(vertex->neighbors, "neighbors for v", vertex->id);
+        if (vertex->deleted)
+          continue;
+        totvneighbors += qh_setsize(vertex->neighbors);
       }
       FORALLfacet_(facetlist)
-	totvertices += qh_setsize (facet->vertices);
+        totvertices += qh_setsize(facet->vertices);
       if (totvneighbors != totvertices) {
-	fprintf(qh ferr, "qhull internal error (qh_checkpolygon): vertex neighbors inconsistent.  Totvneighbors %d, totvertices %d\n",
-		totvneighbors, totvertices);
-	waserror= True;
+        qh_fprintf(qh ferr, 6141, "qhull internal error (qh_checkpolygon): vertex neighbors inconsistent.  Totvneighbors %d, totvertices %d\n",
+                totvneighbors, totvertices);
+        waserror= True;
       }
     }
     if (numvertices != qh num_vertices - qh_setsize(qh del_vertices)) {
-      fprintf(qh ferr, "qhull internal error (qh_checkpolygon): actual number of vertices is %d, cumulative vertex count is %d\n",
-	      numvertices, qh num_vertices - qh_setsize(qh del_vertices));
+      qh_fprintf(qh ferr, 6142, "qhull internal error (qh_checkpolygon): actual number of vertices is %d, cumulative vertex count is %d\n",
+              numvertices, qh num_vertices - qh_setsize(qh del_vertices));
       waserror= True;
     }
     if (qh hull_dim == 2 && numvertices != numfacets) {
-      fprintf (qh ferr, "qhull internal error (qh_checkpolygon): #vertices %d != #facets %d\n",
+      qh_fprintf(qh ferr, 6143, "qhull internal error (qh_checkpolygon): #vertices %d != #facets %d\n",
         numvertices, numfacets);
       waserror= True;
     }
     if (qh hull_dim == 3 && numvertices + numfacets - numridges/2 != 2) {
-      fprintf (qh ferr, "qhull warning: #vertices %d + #facets %d - #edges %d != 2\n\
-	A vertex appears twice in a edge list.  May occur during merging.",
+      qh_fprintf(qh ferr, 7063, "qhull warning: #vertices %d + #facets %d - #edges %d != 2\n\
+        A vertex appears twice in a edge list.  May occur during merging.",
         numvertices, numfacets, numridges/2);
       /* occurs if lots of merging and a vertex ends up twice in an edge list.  e.g., RBOX 1000 s W1e-13 t995849315 D2 | QHULL d Tc Tv */
     }
   }
-  if (waserror) 
+  if (waserror)
     qh_errexit(qh_ERRqhull, NULL, NULL);
 } /* checkpolygon */
 
 
 /*---------------------------------
-  
+
   qh_checkvertex( vertex )
     check vertex for consistency
     checks vertex->neighbors
@@ -950,38 +947,38 @@
   notes:
     neighbors checked efficiently in checkpolygon
 */
-void qh_checkvertex (vertexT *vertex) {
+void qh_checkvertex(vertexT *vertex) {
   boolT waserror= False;
   facetT *neighbor, **neighborp, *errfacet=NULL;
 
-  if (qh_pointid (vertex->point) == -1) {
-    fprintf (qh ferr, "qhull internal error (qh_checkvertex): unknown point id %p\n", vertex->point);
+  if (qh_pointid(vertex->point) == -1) {
+    qh_fprintf(qh ferr, 6144, "qhull internal error (qh_checkvertex): unknown point id %p\n", vertex->point);
     waserror= True;
   }
   if (vertex->id >= qh vertex_id) {
-    fprintf (qh ferr, "qhull internal error (qh_checkvertex): unknown vertex id %d\n", vertex->id);
+    qh_fprintf(qh ferr, 6145, "qhull internal error (qh_checkvertex): unknown vertex id %d\n", vertex->id);
     waserror= True;
   }
   if (!waserror && !vertex->deleted) {
-    if (qh_setsize (vertex->neighbors)) {
+    if (qh_setsize(vertex->neighbors)) {
       FOREACHneighbor_(vertex) {
-        if (!qh_setin (neighbor->vertices, vertex)) {
-          fprintf (qh ferr, "qhull internal error (qh_checkvertex): neighbor f%d does not contain v%d\n", neighbor->id, vertex->id);
-	  errfacet= neighbor;
-	  waserror= True;
-	}
+        if (!qh_setin(neighbor->vertices, vertex)) {
+          qh_fprintf(qh ferr, 6146, "qhull internal error (qh_checkvertex): neighbor f%d does not contain v%d\n", neighbor->id, vertex->id);
+          errfacet= neighbor;
+          waserror= True;
+        }
       }
     }
   }
   if (waserror) {
-    qh_errprint ("ERRONEOUS", NULL, NULL, NULL, vertex);
-    qh_errexit (qh_ERRqhull, errfacet, NULL);
+    qh_errprint("ERRONEOUS", NULL, NULL, NULL, vertex);
+    qh_errexit(qh_ERRqhull, errfacet, NULL);
   }
 } /* checkvertex */
-  
+
 /*---------------------------------
-  
+
   qh_clearcenters( type )
     clear old data from facet->center
 
@@ -989,31 +986,33 @@
     sets new centertype
     nop if CENTERtype is the same
 */
-void qh_clearcenters (qh_CENTER type) {
+void qh_clearcenters(qh_CENTER type) {
   facetT *facet;
-  
+
   if (qh CENTERtype != type) {
     FORALLfacets {
-      if (qh CENTERtype == qh_ASvoronoi){
+      if (facet->tricoplanar && !facet->keepcentrum)
+          facet->center= NULL;
+      else if (qh CENTERtype == qh_ASvoronoi){
         if (facet->center) {
-          qh_memfree (facet->center, qh center_size);
+          qh_memfree(facet->center, qh center_size);
           facet->center= NULL;
         }
       }else /* qh CENTERtype == qh_AScentrum */ {
         if (facet->center) {
-          qh_memfree (facet->center, qh normal_size);
-	  facet->center= NULL;
+          qh_memfree(facet->center, qh normal_size);
+          facet->center= NULL;
         }
       }
     }
     qh CENTERtype= type;
   }
-  trace2((qh ferr, "qh_clearcenters: switched to center type %d\n", type));
+  trace2((qh ferr, 2043, "qh_clearcenters: switched to center type %d\n", type));
 } /* clearcenters */
 
 /*---------------------------------
-  
+
   qh_createsimplex( vertices )
     creates a simplex from a set of vertices
 
@@ -1033,38 +1032,38 @@
   facetT *facet= NULL, *newfacet;
   boolT toporient= True;
   int vertex_i, vertex_n, nth;
-  setT *newfacets= qh_settemp (qh hull_dim+1);
+  setT *newfacets= qh_settemp(qh hull_dim+1);
   vertexT *vertex;
-  
+
   qh facet_list= qh newfacet_list= qh facet_tail= qh_newfacet();
   qh num_facets= qh num_vertices= qh num_visible= 0;
   qh vertex_list= qh newvertex_list= qh vertex_tail= qh_newvertex(NULL);
   FOREACHvertex_i_(vertices) {
     newfacet= qh_newfacet();
-    newfacet->vertices= qh_setnew_delnthsorted (vertices, vertex_n,
-						vertex_i, 0);
-    newfacet->toporient= toporient;
+    newfacet->vertices= qh_setnew_delnthsorted(vertices, vertex_n,
+                                                vertex_i, 0);
+    newfacet->toporient= (unsigned char)toporient;
     qh_appendfacet(newfacet);
     newfacet->newfacet= True;
-    qh_appendvertex (vertex);
-    qh_setappend (&newfacets, newfacet);
+    qh_appendvertex(vertex);
+    qh_setappend(&newfacets, newfacet);
     toporient ^= True;
   }
   FORALLnew_facets {
     nth= 0;
     FORALLfacet_(qh newfacet_list) {
-      if (facet != newfacet) 
+      if (facet != newfacet)
         SETelem_(newfacet->neighbors, nth++)= facet;
     }
-    qh_settruncate (newfacet->neighbors, qh hull_dim);
+    qh_settruncate(newfacet->neighbors, qh hull_dim);
   }
-  qh_settempfree (&newfacets);
-  trace1((qh ferr, "qh_createsimplex: created simplex\n"));
+  qh_settempfree(&newfacets);
+  trace1((qh ferr, 1028, "qh_createsimplex: created simplex\n"));
 } /* createsimplex */
 
 /*---------------------------------
-  
+
   qh_delridge( ridge )
     deletes ridge from data structures it belongs to
     frees up its memory
@@ -1075,17 +1074,17 @@
 */
 void qh_delridge(ridgeT *ridge) {
   void **freelistp; /* used !qh_NOmem */
-  
+
   qh_setdel(ridge->top->ridges, ridge);
   qh_setdel(ridge->bottom->ridges, ridge);
   qh_setfree(&(ridge->vertices));
-  qh_memfree_(ridge, sizeof(ridgeT), freelistp);
+  qh_memfree_(ridge, (int)sizeof(ridgeT), freelistp);
 } /* delridge */
 
 
 /*---------------------------------
-  
+
   qh_delvertex( vertex )
     deletes a vertex and frees its memory
 
@@ -1093,19 +1092,19 @@
     assumes vertex->adjacencies have been updated if needed
     unlinks from vertex_list
 */
-void qh_delvertex (vertexT *vertex) {
+void qh_delvertex(vertexT *vertex) {
 
   if (vertex == qh tracevertex)
     qh tracevertex= NULL;
-  qh_removevertex (vertex);
-  qh_setfree (&vertex->neighbors);
-  qh_memfree(vertex, sizeof(vertexT));
+  qh_removevertex(vertex);
+  qh_setfree(&vertex->neighbors);
+  qh_memfree(vertex, (int)sizeof(vertexT));
 } /* delvertex */
 
 
 /*---------------------------------
-  
+
   qh_facet3vertex(  )
     return temporary set of 3-d vertices in qh_ORIENTclock order
 
@@ -1116,35 +1115,35 @@
       for each ridge in order
         build set from ridge's vertices
 */
-setT *qh_facet3vertex (facetT *facet) {
+setT *qh_facet3vertex(facetT *facet) {
   ridgeT *ridge, *firstridge;
   vertexT *vertex;
   int cntvertices, cntprojected=0;
   setT *vertices;
 
   cntvertices= qh_setsize(facet->vertices);
-  vertices= qh_settemp (cntvertices);
+  vertices= qh_settemp(cntvertices);
   if (facet->simplicial) {
     if (cntvertices != 3) {
-      fprintf (qh ferr, "qhull internal error (qh_facet3vertex): only %d vertices for simplicial facet f%d\n", 
+      qh_fprintf(qh ferr, 6147, "qhull internal error (qh_facet3vertex): only %d vertices for simplicial facet f%d\n",
                   cntvertices, facet->id);
       qh_errexit(qh_ERRqhull, facet, NULL);
     }
-    qh_setappend (&vertices, SETfirst_(facet->vertices));
+    qh_setappend(&vertices, SETfirst_(facet->vertices));
     if (facet->toporient ^ qh_ORIENTclock)
-      qh_setappend (&vertices, SETsecond_(facet->vertices));
+      qh_setappend(&vertices, SETsecond_(facet->vertices));
     else
-      qh_setaddnth (&vertices, 0, SETsecond_(facet->vertices));
-    qh_setappend (&vertices, SETelem_(facet->vertices, 2));
+      qh_setaddnth(&vertices, 0, SETsecond_(facet->vertices));
+    qh_setappend(&vertices, SETelem_(facet->vertices, 2));
   }else {
     ridge= firstridge= SETfirstt_(facet->ridges, ridgeT);   /* no infinite */
-    while ((ridge= qh_nextridge3d (ridge, facet, &vertex))) {
-      qh_setappend (&vertices, vertex);
+    while ((ridge= qh_nextridge3d(ridge, facet, &vertex))) {
+      qh_setappend(&vertices, vertex);
       if (++cntprojected > cntvertices || ridge == firstridge)
         break;
     }
     if (!ridge || cntprojected != cntvertices) {
-      fprintf (qh ferr, "qhull internal error (qh_facet3vertex): ridges for facet %d don't match up.  got at least %d\n", 
+      qh_fprintf(qh ferr, 6148, "qhull internal error (qh_facet3vertex): ridges for facet %d don't match up.  got at least %d\n",
                   facet->id, cntprojected);
       qh_errexit(qh_ERRqhull, facet, ridge);
     }
@@ -1154,13 +1153,13 @@
 
 /*---------------------------------
-  
+
   qh_findbestfacet( point, bestoutside, bestdist, isoutside )
-    find facet that is furthest below a point 
+    find facet that is furthest below a point
 
-    for Delaunay triangulations, 
+    for Delaunay triangulations,
       Use qh_setdelaunay() to lift point to paraboloid and scale by 'Qbb' if needed
-      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates. 
+      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates.
 
   returns:
     if bestoutside is set (e.g., qh_ALL)
@@ -1171,51 +1170,51 @@
       if point is inside, returns nearest, !upperdelaunay facet
     distance to facet
     isoutside set if outside of facet
-    
+
   notes:
-    For tricoplanar facets, this finds one of the tricoplanar facets closest 
-    to the point.  For Delaunay triangulations, the point may be inside a 
-    different tricoplanar facet. See locate a facet with qh_findbestfacet()
-    
+    For tricoplanar facets, this finds one of the tricoplanar facets closest
+    to the point.  For Delaunay triangulations, the point may be inside a
+    different tricoplanar facet. See locate a facet with qh_findbestfacet()
+
     If inside, qh_findbestfacet performs an exhaustive search
        this may be too conservative.  Sometimes it is clearly required.
 
     qh_findbestfacet is not used by qhull.
     uses qh.visit_id and qh.coplanarset
-    
+
   see:
     qh_findbest
 */
-facetT *qh_findbestfacet (pointT *point, boolT bestoutside,
+facetT *qh_findbestfacet(pointT *point, boolT bestoutside,
            realT *bestdist, boolT *isoutside) {
   facetT *bestfacet= NULL;
   int numpart, totpart= 0;
-  
-  bestfacet= qh_findbest (point, qh facet_list, 
-			    bestoutside, !qh_ISnewfacets, bestoutside /* qh_NOupper */,
-			    bestdist, isoutside, &totpart);
+
+  bestfacet= qh_findbest(point, qh facet_list,
+                            bestoutside, !qh_ISnewfacets, bestoutside /* qh_NOupper */,
+                            bestdist, isoutside, &totpart);
   if (*bestdist < -qh DISTround) {
-    bestfacet= qh_findfacet_all (point, bestdist, isoutside, &numpart);
+    bestfacet= qh_findfacet_all(point, bestdist, isoutside, &numpart);
     totpart += numpart;
     if ((isoutside && bestoutside)
     || (!isoutside && bestfacet->upperdelaunay)) {
-      bestfacet= qh_findbest (point, bestfacet, 
-			    bestoutside, False, bestoutside,
-			    bestdist, isoutside, &totpart);
+      bestfacet= qh_findbest(point, bestfacet,
+                            bestoutside, False, bestoutside,
+                            bestdist, isoutside, &totpart);
       totpart += numpart;
     }
   }
-  trace3((qh ferr, "qh_findbestfacet: f%d dist %2.2g isoutside %d totpart %d\n",
-	  bestfacet->id, *bestdist, *isoutside, totpart));
+  trace3((qh ferr, 3014, "qh_findbestfacet: f%d dist %2.2g isoutside %d totpart %d\n",
+          bestfacet->id, *bestdist, *isoutside, totpart));
   return bestfacet;
-} /* findbestfacet */ 
+} /* findbestfacet */
 
 /*---------------------------------
-  
+
   qh_findbestlower( facet, point, bestdist, numpart )
     returns best non-upper, non-flipped neighbor of facet for point
-    if needed, searches vertex neighbors 
+    if needed, searches vertex neighbors
 
   returns:
     returns bestdist and updates numpart
@@ -1225,7 +1224,7 @@
     called by qh_findbest() for points above an upperdelaunay facet
 
 */
-facetT *qh_findbestlower (facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart) {
+facetT *qh_findbestlower(facetT *upperfacet, pointT *point, realT *bestdistp, int *numpart) {
   facetT *neighbor, **neighborp, *bestfacet= NULL;
   realT bestdist= -REALmax/2 /* avoid underflow */;
   realT dist;
@@ -1236,7 +1235,7 @@
     if (neighbor->upperdelaunay || neighbor->flipped)
       continue;
     (*numpart)++;
-    qh_distplane (point, neighbor, &dist);
+    qh_distplane(point, neighbor, &dist);
     if (dist > bestdist) {
       bestfacet= neighbor;
       bestdist= dist;
@@ -1245,63 +1244,66 @@
   if (!bestfacet) {
     zinc_(Zbestlowerv);
     /* rarely called, numpart does not count nearvertex computations */
-    vertex= qh_nearvertex (upperfacet, point, &dist);
+    vertex= qh_nearvertex(upperfacet, point, &dist);
     qh_vertexneighbors();
     FOREACHneighbor_(vertex) {
       if (neighbor->upperdelaunay || neighbor->flipped)
-	continue;
+        continue;
       (*numpart)++;
-      qh_distplane (point, neighbor, &dist);
+      qh_distplane(point, neighbor, &dist);
       if (dist > bestdist) {
-	bestfacet= neighbor;
-	bestdist= dist;
+        bestfacet= neighbor;
+        bestdist= dist;
       }
     }
   }
   if (!bestfacet) {
-    fprintf(qh ferr, "\n\
-qh_findbestlower: all neighbors of facet %d are flipped or upper Delaunay.\n\
+    qh_fprintf(qh ferr, 6228, "\n\
+Qhull internal error (qh_findbestlower): all neighbors of facet %d are flipped or upper Delaunay.\n\
 Please report this error to qhull_bug at qhull.org with the input and all of the output.\n",
        upperfacet->id);
-    qh_errexit (qh_ERRqhull, upperfacet, NULL);
+    qh_errexit(qh_ERRqhull, upperfacet, NULL);
   }
   *bestdistp= bestdist;
-  trace3((qh ferr, "qh_findbestlower: f%d dist %2.2g for f%d p%d\n",
-	  bestfacet->id, bestdist, upperfacet->id, qh_pointid(point)));
+  trace3((qh ferr, 3015, "qh_findbestlower: f%d dist %2.2g for f%d p%d\n",
+          bestfacet->id, bestdist, upperfacet->id, qh_pointid(point)));
   return bestfacet;
 } /* findbestlower */
 
 /*---------------------------------
-  
+
   qh_findfacet_all( point, bestdist, isoutside, numpart )
-    exhaustive search for facet below a point 
+    exhaustive search for facet below a point
 
-    for Delaunay triangulations, 
+    for Delaunay triangulations,
       Use qh_setdelaunay() to lift point to paraboloid and scale by 'Qbb' if needed
-      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates. 
+      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates.
 
   returns:
     returns first facet below point
-    if point is inside, 
+    if point is inside,
       returns nearest facet
     distance to facet
     isoutside if point is outside of the hull
     number of distance tests
+
+  notes:
+    for library users, not used by Qhull
 */
-facetT *qh_findfacet_all (pointT *point, realT *bestdist, boolT *isoutside,
-			  int *numpart) {
+facetT *qh_findfacet_all(pointT *point, realT *bestdist, boolT *isoutside,
+                          int *numpart) {
   facetT *bestfacet= NULL, *facet;
   realT dist;
   int totpart= 0;
-  
-  *bestdist= REALmin;
+
+  *bestdist= -REALmax;
   *isoutside= False;
   FORALLfacets {
     if (facet->flipped || !facet->normal)
       continue;
     totpart++;
-    qh_distplane (point, facet, &dist);
+    qh_distplane(point, facet, &dist);
     if (dist > *bestdist) {
       *bestdist= dist;
       bestfacet= facet;
@@ -1312,14 +1314,14 @@
     }
   }
   *numpart= totpart;
-  trace3((qh ferr, "qh_findfacet_all: f%d dist %2.2g isoutside %d totpart %d\n",
-	  getid_(bestfacet), *bestdist, *isoutside, totpart));
+  trace3((qh ferr, 3016, "qh_findfacet_all: f%d dist %2.2g isoutside %d totpart %d\n",
+          getid_(bestfacet), *bestdist, *isoutside, totpart));
   return bestfacet;
-} /* findfacet_all */ 
- 
+} /* findfacet_all */
+
 /*---------------------------------
-  
+
   qh_findgood( facetlist, goodhorizon )
     identify good facets for qh.PRINTgood
     if qh.GOODvertex>0
@@ -1327,29 +1329,29 @@
       if !match, returns goodhorizon
       inactive if qh.MERGING
     if qh.GOODpoint
-      facet is visible or coplanar (>0) or not visible (<0) 
+      facet is visible or coplanar (>0) or not visible (<0)
     if qh.GOODthreshold
       facet->normal matches threshold
-    if !goodhorizon and !match, 
+    if !goodhorizon and !match,
       selects facet with closest angle
       sets GOODclosest
-      
+
   returns:
     number of new, good facets found
     determines facet->good
     may update qh.GOODclosest
-    
+
   notes:
     qh_findgood_all further reduces the good region
 
   design:
     count good facets
-    mark good facets for qh.GOODpoint  
+    mark good facets for qh.GOODpoint
     mark good facets for qh.GOODthreshold
     if necessary
-      update qh.GOODclosest  
+      update qh.GOODclosest
 */
-int qh_findgood (facetT *facetlist, int goodhorizon) {
+int qh_findgood(facetT *facetlist, int goodhorizon) {
   facetT *facet, *bestfacet= NULL;
   realT angle, bestangle= REALmax, dist;
   int  numgood=0;
@@ -1360,7 +1362,7 @@
   }
   if (qh GOODvertex>0 && !qh MERGING) {
     FORALLfacet_(facetlist) {
-      if (!qh_isvertex (qh GOODvertexp, facet->vertices)) {
+      if (!qh_isvertex(qh GOODvertexp, facet->vertices)) {
         facet->good= False;
         numgood--;
       }
@@ -1370,7 +1372,7 @@
     FORALLfacet_(facetlist) {
       if (facet->good && facet->normal) {
         zinc_(Zdistgood);
-        qh_distplane (qh GOODpointp, facet, &dist);
+        qh_distplane(qh GOODpointp, facet, &dist);
         if ((qh GOODpoint > 0) ^ (dist > 0.0)) {
           facet->good= False;
           numgood--;
@@ -1381,7 +1383,7 @@
   if (qh GOODthreshold && (numgood || goodhorizon || qh GOODclosest)) {
     FORALLfacet_(facetlist) {
       if (facet->good && facet->normal) {
-        if (!qh_inthresholds (facet->normal, &angle)) {
+        if (!qh_inthresholds(facet->normal, &angle)) {
           facet->good= False;
           numgood--;
           if (angle < bestangle) {
@@ -1393,23 +1395,23 @@
     }
     if (!numgood && (!goodhorizon || qh GOODclosest)) {
       if (qh GOODclosest) {
-	if (qh GOODclosest->visible)
-	  qh GOODclosest= NULL;
-	else {
-	  qh_inthresholds (qh GOODclosest->normal, &angle);
-	  if (angle < bestangle)
-	    bestfacet= qh GOODclosest;
-	}
+        if (qh GOODclosest->visible)
+          qh GOODclosest= NULL;
+        else {
+          qh_inthresholds(qh GOODclosest->normal, &angle);
+          if (angle < bestangle)
+            bestfacet= qh GOODclosest;
+        }
       }
       if (bestfacet && bestfacet != qh GOODclosest) {
-	if (qh GOODclosest)
-	  qh GOODclosest->good= False;
-	qh GOODclosest= bestfacet;
-	bestfacet->good= True;
-	numgood++;
-	trace2((qh ferr, "qh_findgood: f%d is closest (%2.2g) to thresholds\n", 
+        if (qh GOODclosest)
+          qh GOODclosest->good= False;
+        qh GOODclosest= bestfacet;
+        bestfacet->good= True;
+        numgood++;
+        trace2((qh ferr, 2044, "qh_findgood: f%d is closest(%2.2g) to thresholds\n",
            bestfacet->id, bestangle));
-	return numgood;
+        return numgood;
       }
     }else if (qh GOODclosest) { /* numgood > 0 */
       qh GOODclosest->good= False;
@@ -1417,19 +1419,19 @@
     }
   }
   zadd_(Zgoodfacet, numgood);
-  trace2((qh ferr, "qh_findgood: found %d good facets with %d good horizon\n",
+  trace2((qh ferr, 2045, "qh_findgood: found %d good facets with %d good horizon\n",
                numgood, goodhorizon));
-  if (!numgood && qh GOODvertex>0 && !qh MERGING) 
+  if (!numgood && qh GOODvertex>0 && !qh MERGING)
     return goodhorizon;
   return numgood;
 } /* findgood */
 
 /*---------------------------------
-  
+
   qh_findgood_all( facetlist )
     apply other constraints for good facets (used by qh.PRINTgood)
-    if qh.GOODvertex 
+    if qh.GOODvertex
       facet includes (>0) or doesn't include (<0) point as vertex
       if last good facet and ONLYgood, prints warning and continues
     if qh.SPLITthresholds
@@ -1447,36 +1449,36 @@
   design:
     uses qh_findgood to mark good facets
     marks facets for qh.GOODvertex
-    marks facets for qh.SPLITthreholds  
+    marks facets for qh.SPLITthreholds
 */
-void qh_findgood_all (facetT *facetlist) {
+void qh_findgood_all(facetT *facetlist) {
   facetT *facet, *bestfacet=NULL;
   realT angle, bestangle= REALmax;
   int  numgood=0, startgood;
 
-  if (!qh GOODvertex && !qh GOODthreshold && !qh GOODpoint 
+  if (!qh GOODvertex && !qh GOODthreshold && !qh GOODpoint
   && !qh SPLITthresholds)
     return;
   if (!qh ONLYgood)
-    qh_findgood (qh facet_list, 0);
+    qh_findgood(qh facet_list, 0);
   FORALLfacet_(facetlist) {
     if (facet->good)
       numgood++;
   }
   if (qh GOODvertex <0 || (qh GOODvertex > 0 && qh MERGING)) {
     FORALLfacet_(facetlist) {
-      if (facet->good && ((qh GOODvertex > 0) ^ !!qh_isvertex (qh GOODvertexp, facet->vertices))) {
+      if (facet->good && ((qh GOODvertex > 0) ^ !!qh_isvertex(qh GOODvertexp, facet->vertices))) {
         if (!--numgood) {
-	  if (qh ONLYgood) {
-            fprintf (qh ferr, "qhull warning: good vertex p%d does not match last good facet f%d.  Ignored.\n",
+          if (qh ONLYgood) {
+            qh_fprintf(qh ferr, 7064, "qhull warning: good vertex p%d does not match last good facet f%d.  Ignored.\n",
                qh_pointid(qh GOODvertexp), facet->id);
-	    return;
-	  }else if (qh GOODvertex > 0)
-            fprintf (qh ferr, "qhull warning: point p%d is not a vertex ('QV%d').\n",
-		qh GOODvertex-1, qh GOODvertex-1);
-	  else
-            fprintf (qh ferr, "qhull warning: point p%d is a vertex for every facet ('QV-%d').\n",
-	        -qh GOODvertex - 1, -qh GOODvertex - 1);
+            return;
+          }else if (qh GOODvertex > 0)
+            qh_fprintf(qh ferr, 7065, "qhull warning: point p%d is not a vertex('QV%d').\n",
+                qh GOODvertex-1, qh GOODvertex-1);
+          else
+            qh_fprintf(qh ferr, 7066, "qhull warning: point p%d is a vertex for every facet('QV-%d').\n",
+                -qh GOODvertex - 1, -qh GOODvertex - 1);
         }
         facet->good= False;
       }
@@ -1486,7 +1488,7 @@
   if (qh SPLITthresholds) {
     FORALLfacet_(facetlist) {
       if (facet->good) {
-        if (!qh_inthresholds (facet->normal, &angle)) {
+        if (!qh_inthresholds(facet->normal, &angle)) {
           facet->good= False;
           numgood--;
           if (angle < bestangle) {
@@ -1499,19 +1501,19 @@
     if (!numgood && bestfacet) {
       bestfacet->good= True;
       numgood++;
-      trace0((qh ferr, "qh_findgood_all: f%d is closest (%2.2g) to thresholds\n", 
+      trace0((qh ferr, 23, "qh_findgood_all: f%d is closest(%2.2g) to thresholds\n",
            bestfacet->id, bestangle));
       return;
     }
   }
   qh num_good= numgood;
-  trace0((qh ferr, "qh_findgood_all: %d good facets remain out of %d facets\n",
+  trace0((qh ferr, 24, "qh_findgood_all: %d good facets remain out of %d facets\n",
         numgood, startgood));
 } /* findgood_all */
 
 /*---------------------------------
-  
+
   qh_furthestnext()
     set qh.facet_next to facet with furthest of all furthest points
     searches all facets on qh.facet_list
@@ -1519,7 +1521,7 @@
   notes:
     this may help avoid precision problems
 */
-void qh_furthestnext (void /* qh facet_list */) {
+void qh_furthestnext(void /* qh facet_list */) {
   facetT *facet, *bestfacet= NULL;
   realT dist, bestdist= -REALmax;
 
@@ -1527,29 +1529,29 @@
     if (facet->outsideset) {
 #if qh_COMPUTEfurthest
       pointT *furthest;
-      furthest= (pointT*)qh_setlast (facet->outsideset);
+      furthest= (pointT*)qh_setlast(facet->outsideset);
       zinc_(Zcomputefurthest);
-      qh_distplane (furthest, facet, &dist);
+      qh_distplane(furthest, facet, &dist);
 #else
       dist= facet->furthestdist;
 #endif
       if (dist > bestdist) {
-	bestfacet= facet;
-	bestdist= dist;
+        bestfacet= facet;
+        bestdist= dist;
       }
     }
   }
   if (bestfacet) {
-    qh_removefacet (bestfacet);
-    qh_prependfacet (bestfacet, &qh facet_next);
-    trace1((qh ferr, "qh_furthestnext: made f%d next facet (dist %.2g)\n",
-	    bestfacet->id, bestdist));
+    qh_removefacet(bestfacet);
+    qh_prependfacet(bestfacet, &qh facet_next);
+    trace1((qh ferr, 1029, "qh_furthestnext: made f%d next facet(dist %.2g)\n",
+            bestfacet->id, bestdist));
   }
 } /* furthestnext */
 
 /*---------------------------------
-  
+
   qh_furthestout( facet )
     make furthest outside point the last point of outsideset
 
@@ -1562,12 +1564,12 @@
     determine best point of outsideset
     make it the last point of outsideset
 */
-void qh_furthestout (facetT *facet) {
+void qh_furthestout(facetT *facet) {
   pointT *point, **pointp, *bestpoint= NULL;
   realT dist, bestdist= -REALmax;
 
   FOREACHpoint_(facet->outsideset) {
-    qh_distplane (point, facet, &dist);
+    qh_distplane(point, facet, &dist);
     zinc_(Zcomputefurthest);
     if (dist > bestdist) {
       bestpoint= point;
@@ -1575,33 +1577,33 @@
     }
   }
   if (bestpoint) {
-    qh_setdel (facet->outsideset, point);
-    qh_setappend (&facet->outsideset, point);
+    qh_setdel(facet->outsideset, point);
+    qh_setappend(&facet->outsideset, point);
 #if !qh_COMPUTEfurthest
     facet->furthestdist= bestdist;
 #endif
   }
   facet->notfurthest= False;
-  trace3((qh ferr, "qh_furthestout: p%d is furthest outside point of f%d\n",
-	  qh_pointid (point), facet->id));
+  trace3((qh ferr, 3017, "qh_furthestout: p%d is furthest outside point of f%d\n",
+          qh_pointid(point), facet->id));
 } /* furthestout */
 
 
 /*---------------------------------
-  
+
   qh_infiniteloop( facet )
     report infinite loop error due to facet
 */
-void qh_infiniteloop (facetT *facet) {
+void qh_infiniteloop(facetT *facet) {
 
-  fprintf (qh ferr, "qhull internal error (qh_infiniteloop): potential infinite loop detected\n");
-  qh_errexit (qh_ERRqhull, facet, NULL);
+  qh_fprintf(qh ferr, 6149, "qhull internal error (qh_infiniteloop): potential infinite loop detected\n");
+  qh_errexit(qh_ERRqhull, facet, NULL);
 } /* qh_infiniteloop */
 
 /*---------------------------------
-  
+
   qh_initbuild()
     initialize hull and outside sets with point array
     qh.FIRSTpoint/qh.NUMpoints is point array
@@ -1616,12 +1618,12 @@
   design:
     initialize global variables used during qh_buildhull
     determine precision constants and points with max/min coordinate values
-      if qh.SCALElast, scale last coordinate (for 'd')
+      if qh.SCALElast, scale last coordinate(for 'd')
     build initial simplex
     partition input points into facets of initial simplex
     set up lists
     if qh.ONLYgood
-      check consistency  
+      check consistency
       add qh.GOODvertex if defined
 */
 void qh_initbuild( void) {
@@ -1637,101 +1639,101 @@
   qh visit_id= qh vertex_visit= 0;
   qh maxoutdone= False;
 
-  if (qh GOODpoint > 0) 
-    qh GOODpointp= qh_point (qh GOODpoint-1);
-  else if (qh GOODpoint < 0) 
-    qh GOODpointp= qh_point (-qh GOODpoint-1);
+  if (qh GOODpoint > 0)
+    qh GOODpointp= qh_point(qh GOODpoint-1);
+  else if (qh GOODpoint < 0)
+    qh GOODpointp= qh_point(-qh GOODpoint-1);
   if (qh GOODvertex > 0)
-    qh GOODvertexp= qh_point (qh GOODvertex-1);
-  else if (qh GOODvertex < 0) 
-    qh GOODvertexp= qh_point (-qh GOODvertex-1);
-  if ((qh GOODpoint  
+    qh GOODvertexp= qh_point(qh GOODvertex-1);
+  else if (qh GOODvertex < 0)
+    qh GOODvertexp= qh_point(-qh GOODvertex-1);
+  if ((qh GOODpoint
        && (qh GOODpointp < qh first_point  /* also catches !GOODpointp */
-	   || qh GOODpointp > qh_point (qh num_points-1)))
+           || qh GOODpointp > qh_point(qh num_points-1)))
     || (qh GOODvertex
-	&& (qh GOODvertexp < qh first_point  /* also catches !GOODvertexp */
-	    || qh GOODvertexp > qh_point (qh num_points-1)))) {
-    fprintf (qh ferr, "qhull input error: either QGn or QVn point is > p%d\n",
-	     qh num_points-1);
-    qh_errexit (qh_ERRinput, NULL, NULL);
+        && (qh GOODvertexp < qh first_point  /* also catches !GOODvertexp */
+            || qh GOODvertexp > qh_point(qh num_points-1)))) {
+    qh_fprintf(qh ferr, 6150, "qhull input error: either QGn or QVn point is > p%d\n",
+             qh num_points-1);
+    qh_errexit(qh_ERRinput, NULL, NULL);
   }
   maxpoints= qh_maxmin(qh first_point, qh num_points, qh hull_dim);
   if (qh SCALElast)
-    qh_scalelast (qh first_point, qh num_points, qh hull_dim,
+    qh_scalelast(qh first_point, qh num_points, qh hull_dim,
                qh MINlastcoord, qh MAXlastcoord, qh MAXwidth);
   qh_detroundoff();
   if (qh DELAUNAY && qh upper_threshold[qh hull_dim-1] > REALmax/2
                   && qh lower_threshold[qh hull_dim-1] < -REALmax/2) {
-    for (i= qh_PRINTEND; i--; ) {
-      if (qh PRINTout[i] == qh_PRINTgeom && qh DROPdim < 0 
- 	  && !qh GOODthreshold && !qh SPLITthresholds)
-	break;  /* in this case, don't set upper_threshold */
+    for (i=qh_PRINTEND; i--; ) {
+      if (qh PRINTout[i] == qh_PRINTgeom && qh DROPdim < 0
+          && !qh GOODthreshold && !qh SPLITthresholds)
+        break;  /* in this case, don't set upper_threshold */
     }
     if (i < 0) {
       if (qh UPPERdelaunay) { /* matches qh.upperdelaunay in qh_setfacetplane */
-	qh lower_threshold[qh hull_dim-1]= qh ANGLEround * qh_ZEROdelaunay;
-	qh GOODthreshold= True;
-      }else { 
-	qh upper_threshold[qh hull_dim-1]= -qh ANGLEround * qh_ZEROdelaunay;
-        if (!qh GOODthreshold) 
-	  qh SPLITthresholds= True; /* build upper-convex hull even if Qg */
+        qh lower_threshold[qh hull_dim-1]= qh ANGLEround * qh_ZEROdelaunay;
+        qh GOODthreshold= True;
+      }else {
+        qh upper_threshold[qh hull_dim-1]= -qh ANGLEround * qh_ZEROdelaunay;
+        if (!qh GOODthreshold)
+          qh SPLITthresholds= True; /* build upper-convex hull even if Qg */
           /* qh_initqhull_globals errors if Qg without Pdk/etc. */
       }
     }
   }
-  vertices= qh_initialvertices(qh hull_dim, maxpoints, qh first_point, qh num_points); 
-  qh_initialhull (vertices);  /* initial qh facet_list */
-  qh_partitionall (vertices, qh first_point, qh num_points);
+  vertices= qh_initialvertices(qh hull_dim, maxpoints, qh first_point, qh num_points);
+  qh_initialhull(vertices);  /* initial qh facet_list */
+  qh_partitionall(vertices, qh first_point, qh num_points);
   if (qh PRINToptions1st || qh TRACElevel || qh IStracing) {
     if (qh TRACElevel || qh IStracing)
-      fprintf (qh ferr, "\nTrace level %d for %s | %s\n", 
+      qh_fprintf(qh ferr, 8103, "\nTrace level %d for %s | %s\n",
          qh IStracing ? qh IStracing : qh TRACElevel, qh rbox_command, qh qhull_command);
-    fprintf (qh ferr, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
+    qh_fprintf(qh ferr, 8104, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
   }
-  qh_resetlists (False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
+  qh_resetlists(False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
   qh facet_next= qh facet_list;
-  qh_furthestnext (/* qh facet_list */);
+  qh_furthestnext(/* qh facet_list */);
   if (qh PREmerge) {
     qh cos_max= qh premerge_cos;
     qh centrum_radius= qh premerge_centrum;
   }
   if (qh ONLYgood) {
     if (qh GOODvertex > 0 && qh MERGING) {
-      fprintf (qh ferr, "qhull input error: 'Qg QVn' (only good vertex) does not work with merging.\nUse 'QJ' to joggle the input or 'Q0' to turn off merging.\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6151, "qhull input error: 'Qg QVn' (only good vertex) does not work with merging.\nUse 'QJ' to joggle the input or 'Q0' to turn off merging.\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     if (!(qh GOODthreshold || qh GOODpoint
          || (!qh MERGEexact && !qh PREmerge && qh GOODvertexp))) {
-      fprintf (qh ferr, "qhull input error: 'Qg' (ONLYgood) needs a good threshold ('Pd0D0'), a\n\
-good point (QGn or QG-n), or a good vertex with 'QJ' or 'Q0' (QVn).\n");
-      qh_errexit (qh_ERRinput, NULL, NULL);
+      qh_fprintf(qh ferr, 6152, "qhull input error: 'Qg' (ONLYgood) needs a good threshold('Pd0D0'), a\n\
+good point(QGn or QG-n), or a good vertex with 'QJ' or 'Q0' (QVn).\n");
+      qh_errexit(qh_ERRinput, NULL, NULL);
     }
     if (qh GOODvertex > 0  && !qh MERGING  /* matches qh_partitionall */
-	&& !qh_isvertex (qh GOODvertexp, vertices)) {
-      facet= qh_findbestnew (qh GOODvertexp, qh facet_list, 
-			  &dist, !qh_ALL, &isoutside, &numpart);
+        && !qh_isvertex(qh GOODvertexp, vertices)) {
+      facet= qh_findbestnew(qh GOODvertexp, qh facet_list,
+                          &dist, !qh_ALL, &isoutside, &numpart);
       zadd_(Zdistgood, numpart);
       if (!isoutside) {
-        fprintf (qh ferr, "qhull input error: point for QV%d is inside initial simplex.  It can not be made a vertex.\n",
-	       qh_pointid(qh GOODvertexp));
-        qh_errexit (qh_ERRinput, NULL, NULL);
+        qh_fprintf(qh ferr, 6153, "qhull input error: point for QV%d is inside initial simplex.  It can not be made a vertex.\n",
+               qh_pointid(qh GOODvertexp));
+        qh_errexit(qh_ERRinput, NULL, NULL);
       }
-      if (!qh_addpoint (qh GOODvertexp, facet, False)) {
-	qh_settempfree(&vertices);
-	qh_settempfree(&maxpoints);
-	return;
+      if (!qh_addpoint(qh GOODvertexp, facet, False)) {
+        qh_settempfree(&vertices);
+        qh_settempfree(&maxpoints);
+        return;
       }
     }
-    qh_findgood (qh facet_list, 0);
+    qh_findgood(qh facet_list, 0);
   }
   qh_settempfree(&vertices);
   qh_settempfree(&maxpoints);
-  trace1((qh ferr, "qh_initbuild: initial hull created and points partitioned\n"));
+  trace1((qh ferr, 1030, "qh_initbuild: initial hull created and points partitioned\n"));
 } /* initbuild */
 
 /*---------------------------------
-  
+
   qh_initialhull( vertices )
     constructs the initial hull as a DIM3 simplex of vertices
 
@@ -1741,7 +1743,7 @@
     sets hyperplanes for facets
     doubles checks orientation (in case of axis-parallel facets with Gaussian elimination)
     checks for flipped facets and qh.NARROWhull
-    checks the result   
+    checks the result
 */
 void qh_initialhull(setT *vertices) {
   facetT *facet, *firstfacet, *neighbor, **neighborp;
@@ -1751,71 +1753,66 @@
 #endif
 
   qh_createsimplex(vertices);  /* qh facet_list */
-  qh_resetlists (False, qh_RESETvisible);
+  qh_resetlists(False, qh_RESETvisible);
   qh facet_next= qh facet_list;      /* advance facet when processed */
   qh interior_point= qh_getcenter(vertices);
   firstfacet= qh facet_list;
   qh_setfacetplane(firstfacet);
   zinc_(Znumvisibility); /* needs to be in printsummary */
   qh_distplane(qh interior_point, firstfacet, &dist);
-  if (dist > 0) {  
+  if (dist > 0) {
     FORALLfacets
-      facet->toporient ^= True;
+      facet->toporient ^= (unsigned char)True;
   }
   FORALLfacets
     qh_setfacetplane(facet);
   FORALLfacets {
-    if (!qh_checkflipped (facet, NULL, qh_ALL)) {/* due to axis-parallel facet */
-      trace1((qh ferr, "qh_initialhull: initial orientation incorrect.  Correct all facets\n"));
+    if (!qh_checkflipped(facet, NULL, qh_ALL)) {/* due to axis-parallel facet */
+      trace1((qh ferr, 1031, "qh_initialhull: initial orientation incorrect.  Correct all facets\n"));
       facet->flipped= False;
       FORALLfacets {
-	facet->toporient ^= True;
-	qh_orientoutside (facet);
+        facet->toporient ^= (unsigned char)True;
+        qh_orientoutside(facet);
       }
       break;
     }
   }
   FORALLfacets {
-    if (!qh_checkflipped (facet, NULL, !qh_ALL)) {  /* can happen with 'R0.1' */
-      qh_precision ("initial facet is coplanar with interior point");
-      fprintf (qh ferr, "qhull precision error: initial facet %d is coplanar with the interior point\n",
+    if (!qh_checkflipped(facet, NULL, !qh_ALL)) {  /* can happen with 'R0.1' */
+      qh_precision("initial facet is coplanar with interior point");
+      qh_fprintf(qh ferr, 6154, "qhull precision error: initial facet %d is coplanar with the interior point\n",
                    facet->id);
-      qh_errexit (qh_ERRsingular, facet, NULL);
+      qh_errexit(qh_ERRsingular, facet, NULL);
     }
     FOREACHneighbor_(facet) {
-      angle= qh_getangle (facet->normal, neighbor->normal);
+      angle= qh_getangle(facet->normal, neighbor->normal);
       minimize_( minangle, angle);
     }
   }
-  if (minangle < qh_MAXnarrow && !qh NOnarrow) { 
+  if (minangle < qh_MAXnarrow && !qh NOnarrow) {
     realT diff= 1.0 + minangle;
 
     qh NARROWhull= True;
-    qh_option ("_narrow-hull", NULL, &diff);
+    qh_option("_narrow-hull", NULL, &diff);
     if (minangle < qh_WARNnarrow && !qh RERUN && qh PRINTprecision)
-      fprintf (qh ferr, "qhull precision warning: \n\
-The initial hull is narrow (cosine of min. angle is %.16f).\n\
-A coplanar point may lead to a wide facet.  Options 'QbB' (scale to unit box)\n\
-or 'Qbb' (scale last coordinate) may remove this warning.  Use 'Pp' to skip\n\
-this warning.  See 'Limitations' in qh-impre.htm.\n",
-          -minangle);   /* convert from angle between normals to angle between facets */
+      qh_printhelp_narrowhull(qh ferr, minangle);
   }
   zzval_(Zprocessed)= qh hull_dim+1;
-  qh_checkpolygon (qh facet_list);
+  qh_checkpolygon(qh facet_list);
   qh_checkconvex(qh facet_list,   qh_DATAfault);
 #ifndef qh_NOtrace
   if (qh IStracing >= 1) {
-    fprintf(qh ferr, "qh_initialhull: simplex constructed, interior point:");
-    for (k=0; k < qh hull_dim; k++) 
-      fprintf (qh ferr, " %6.4g", qh interior_point[k]);
-    fprintf (qh ferr, "\n");
+    qh_fprintf(qh ferr, 8105, "qh_initialhull: simplex constructed, interior point:");
+    for (k=0; k < qh hull_dim; k++)
+      qh_fprintf(qh ferr, 8106, " %6.4g", qh interior_point[k]);
+    qh_fprintf(qh ferr, 8107, "\n");
   }
 #endif
 } /* initialhull */
 
 /*---------------------------------
-  
+
   qh_initialvertices( dim, maxpoints, points, numpoints )
     determines a non-singular set of initial vertices
     maxpoints may include duplicate points
@@ -1824,97 +1821,97 @@
     temporary set of dim+1 vertices in descending order by vertex id
     if qh.RANDOMoutside && !qh.ALLpoints
       picks random points
-    if dim >= qh_INITIALmax, 
+    if dim >= qh_INITIALmax,
       uses min/max x and max points with non-zero determinants
 
   notes:
-    unless qh.ALLpoints, 
+    unless qh.ALLpoints,
       uses maxpoints as long as determinate is non-zero
 */
 setT *qh_initialvertices(int dim, setT *maxpoints, pointT *points, int numpoints) {
   pointT *point, **pointp;
   setT *vertices, *simplex, *tested;
   realT randr;
-  int index, point_i, point_n, k;
+  int idx, point_i, point_n, k;
   boolT nearzero= False;
-  
-  vertices= qh_settemp (dim + 1);
-  simplex= qh_settemp (dim+1);
-  if (qh ALLpoints) 
-    qh_maxsimplex (dim, NULL, points, numpoints, &simplex);
+
+  vertices= qh_settemp(dim + 1);
+  simplex= qh_settemp(dim+1);
+  if (qh ALLpoints)
+    qh_maxsimplex(dim, NULL, points, numpoints, &simplex);
   else if (qh RANDOMoutside) {
-    while (qh_setsize (simplex) != dim+1) {
+    while (qh_setsize(simplex) != dim+1) {
       randr= qh_RANDOMint;
       randr= randr/(qh_RANDOMmax+1);
-      index= (int)floor(qh num_points * randr);
-      while (qh_setin (simplex, qh_point (index))) {
-	index++; /* in case qh_RANDOMint always returns the same value */
-        index= index < qh num_points ? index : 0;
+      idx= (int)floor(qh num_points * randr);
+      while (qh_setin(simplex, qh_point(idx))) {
+            idx++; /* in case qh_RANDOMint always returns the same value */
+        idx= idx < qh num_points ? idx : 0;
       }
-      qh_setappend (&simplex, qh_point (index));
+      qh_setappend(&simplex, qh_point(idx));
     }
   }else if (qh hull_dim >= qh_INITIALmax) {
-    tested= qh_settemp (dim+1);
-    qh_setappend (&simplex, SETfirst_(maxpoints));   /* max and min X coord */
-    qh_setappend (&simplex, SETsecond_(maxpoints));
-    qh_maxsimplex (fmin_(qh_INITIALsearch, dim), maxpoints, points, numpoints, &simplex);
-    k= qh_setsize (simplex);
-    FOREACHpoint_i_(maxpoints) { 
+    tested= qh_settemp(dim+1);
+    qh_setappend(&simplex, SETfirst_(maxpoints));   /* max and min X coord */
+    qh_setappend(&simplex, SETsecond_(maxpoints));
+    qh_maxsimplex(fmin_(qh_INITIALsearch, dim), maxpoints, points, numpoints, &simplex);
+    k= qh_setsize(simplex);
+    FOREACHpoint_i_(maxpoints) {
       if (point_i & 0x1) {     /* first pick up max. coord. points */
-      	if (!qh_setin (simplex, point) && !qh_setin (tested, point)){
-	  qh_detsimplex(point, simplex, k, &nearzero);
+        if (!qh_setin(simplex, point) && !qh_setin(tested, point)){
+          qh_detsimplex(point, simplex, k, &nearzero);
           if (nearzero)
-            qh_setappend (&tested, point);
+            qh_setappend(&tested, point);
           else {
-            qh_setappend (&simplex, point);
+            qh_setappend(&simplex, point);
             if (++k == dim)  /* use search for last point */
-	      break;
-	  }
-	}
+              break;
+          }
+        }
       }
     }
-    while (k != dim && (point= (pointT*)qh_setdellast (maxpoints))) {
-      if (!qh_setin (simplex, point) && !qh_setin (tested, point)){
-        qh_detsimplex (point, simplex, k, &nearzero);
+    while (k != dim && (point= (pointT*)qh_setdellast(maxpoints))) {
+      if (!qh_setin(simplex, point) && !qh_setin(tested, point)){
+        qh_detsimplex(point, simplex, k, &nearzero);
         if (nearzero)
-          qh_setappend (&tested, point);
+          qh_setappend(&tested, point);
         else {
-          qh_setappend (&simplex, point);
+          qh_setappend(&simplex, point);
           k++;
-	}
+        }
       }
     }
-    index= 0;
-    while (k != dim && (point= qh_point (index++))) {
-      if (!qh_setin (simplex, point) && !qh_setin (tested, point)){
-        qh_detsimplex (point, simplex, k, &nearzero);
+    idx= 0;
+    while (k != dim && (point= qh_point(idx++))) {
+      if (!qh_setin(simplex, point) && !qh_setin(tested, point)){
+        qh_detsimplex(point, simplex, k, &nearzero);
         if (!nearzero){
-          qh_setappend (&simplex, point);
+          qh_setappend(&simplex, point);
           k++;
-	}
+        }
       }
     }
-    qh_settempfree (&tested);
-    qh_maxsimplex (dim, maxpoints, points, numpoints, &simplex);
+    qh_settempfree(&tested);
+    qh_maxsimplex(dim, maxpoints, points, numpoints, &simplex);
   }else
-    qh_maxsimplex (dim, maxpoints, points, numpoints, &simplex);
-  FOREACHpoint_(simplex) 
-    qh_setaddnth (&vertices, 0, qh_newvertex(point)); /* descending order */
-  qh_settempfree (&simplex);
+    qh_maxsimplex(dim, maxpoints, points, numpoints, &simplex);
+  FOREACHpoint_(simplex)
+    qh_setaddnth(&vertices, 0, qh_newvertex(point)); /* descending order */
+  qh_settempfree(&simplex);
   return vertices;
 } /* initialvertices */
 
 
 /*---------------------------------
-  
+
   qh_isvertex(  )
     returns vertex if point is in vertex set, else returns NULL
 
   notes:
     for qh.GOODvertex
 */
-vertexT *qh_isvertex (pointT *point, setT *vertices) {
+vertexT *qh_isvertex(pointT *point, setT *vertices) {
   vertexT *vertex, **vertexp;
 
   FOREACHvertex_(vertices) {
@@ -1926,14 +1923,14 @@
 
 /*---------------------------------
-  
+
   qh_makenewfacets( point )
     make new facets from point and qh.visible_list
 
   returns:
     qh.newfacet_list= list of new facets with hyperplanes and ->newfacet
     qh.newvertex_list= list of vertices in new facets with ->newlist set
-    
+
     if (qh.ONLYgood)
       newfacets reference horizon facets, but not vice versa
       ridges reference non-simplicial horizon ridges, but not vice versa
@@ -1941,12 +1938,12 @@
     else
       sets qh.NEWfacets
       new facets attached to horizon facets and ridges
-      for visible facets, 
+      for visible facets,
         visible->r.replace is corresponding new facet
 
-  see also: 
+  see also:
     qh_makenewplanes() -- make hyperplanes for facets
-    qh_attachnewfacets() -- attachnewfacets if not done here (qh ONLYgood)
+    qh_attachnewfacets() -- attachnewfacets if not done here(qh ONLYgood)
     qh_matchnewfacets() -- match up neighbors
     qh_updatevertices() -- update vertex neighbors and delvertices
     qh_deletevisible() -- delete visible facets
@@ -1956,10 +1953,10 @@
   design:
     for each visible facet
       make new facets to its horizon facets
-      update its f.replace 
+      update its f.replace
       clear its neighbor set
 */
-vertexT *qh_makenewfacets (pointT *point /*visible_list*/) {
+vertexT *qh_makenewfacets(pointT *point /*visible_list*/) {
   facetT *visible, *newfacet= NULL, *newfacet2= NULL, *neighbor, **neighborp;
   vertexT *apex;
   int numnew=0;
@@ -1967,39 +1964,39 @@
   qh newfacet_list= qh facet_tail;
   qh newvertex_list= qh vertex_tail;
   apex= qh_newvertex(point);
-  qh_appendvertex (apex);  
+  qh_appendvertex(apex);
   qh visit_id++;
   if (!qh ONLYgood)
     qh NEWfacets= True;
   FORALLvisible_facets {
-    FOREACHneighbor_(visible) 
+    FOREACHneighbor_(visible)
       neighbor->seen= False;
     if (visible->ridges) {
       visible->visitid= qh visit_id;
-      newfacet2= qh_makenew_nonsimplicial (visible, apex, &numnew);
+      newfacet2= qh_makenew_nonsimplicial(visible, apex, &numnew);
     }
     if (visible->simplicial)
-      newfacet= qh_makenew_simplicial (visible, apex, &numnew);
+      newfacet= qh_makenew_simplicial(visible, apex, &numnew);
     if (!qh ONLYgood) {
       if (newfacet2)  /* newfacet is null if all ridges defined */
         newfacet= newfacet2;
       if (newfacet)
-      	visible->f.replace= newfacet;
+        visible->f.replace= newfacet;
       else
         zinc_(Zinsidevisible);
       SETfirst_(visible->neighbors)= NULL;
     }
   }
-  trace1((qh ferr, "qh_makenewfacets: created %d new facets from point p%d to horizon\n",
-	  numnew, qh_pointid(point)));
+  trace1((qh ferr, 1032, "qh_makenewfacets: created %d new facets from point p%d to horizon\n",
+          numnew, qh_pointid(point)));
   if (qh IStracing >= 4)
-    qh_printfacetlist (qh newfacet_list, NULL, qh_ALL);
+    qh_printfacetlist(qh newfacet_list, NULL, qh_ALL);
   return apex;
 } /* makenewfacets */
 
 /*---------------------------------
-  
+
   qh_matchduplicates( atfacet, atskip, hashsize, hashcount )
     match duplicate ridges in qh.hash_table for atfacet/atskip
     duplicates marked with ->dupridge and qh_DUPLICATEridge
@@ -2007,7 +2004,7 @@
   returns:
     picks match with worst merge (min distance apart)
     updates hashcount
-  
+
   see also:
     qh_matchneighbor
 
@@ -2018,8 +2015,8 @@
     repeat twice -- once to make best matches, once to match the rest
       for each possible facet in qh.hash_table
         if it is a matching facet and pass 2
-          make match 
-	  unless tricoplanar, mark match for merging (qh_MERGEridge)
+          make match
+          unless tricoplanar, mark match for merging (qh_MERGEridge)
           [e.g., tricoplanar RBOX s 1000 t993602376 | QHULL C-1e-3 d Qbb FA Qt]
         if it is a matching facet and pass 1
           test if this is a better match
@@ -2027,96 +2024,96 @@
         make best match (it will not be merged)
 */
 #ifndef qh_NOmerge
-void qh_matchduplicates (facetT *atfacet, int atskip, int hashsize, int *hashcount) {
+void qh_matchduplicates(facetT *atfacet, int atskip, int hashsize, int *hashcount) {
   boolT same, ismatch;
   int hash, scan;
   facetT *facet, *newfacet, *maxmatch= NULL, *maxmatch2= NULL, *nextfacet;
   int skip, newskip, nextskip= 0, maxskip= 0, maxskip2= 0, makematch;
   realT maxdist= -REALmax, mindist, dist2, low, high;
 
-  hash= (int)qh_gethash (hashsize, atfacet->vertices, qh hull_dim, 1, 
+  hash= qh_gethash(hashsize, atfacet->vertices, qh hull_dim, 1,
                      SETelem_(atfacet->vertices, atskip));
-  trace2((qh ferr, "qh_matchduplicates: find duplicate matches for f%d skip %d hash %d hashcount %d\n",
-	  atfacet->id, atskip, hash, *hashcount));
+  trace2((qh ferr, 2046, "qh_matchduplicates: find duplicate matches for f%d skip %d hash %d hashcount %d\n",
+          atfacet->id, atskip, hash, *hashcount));
   for (makematch= 0; makematch < 2; makematch++) {
     qh visit_id++;
     for (newfacet= atfacet, newskip= atskip; newfacet; newfacet= nextfacet, newskip= nextskip) {
       zinc_(Zhashlookup);
       nextfacet= NULL;
       newfacet->visitid= qh visit_id;
-      for (scan= hash; (facet= SETelemt_(qh hash_table, scan, facetT)); 
-	   scan= (++scan >= hashsize ? 0 : scan)) {
-	if (!facet->dupridge || facet->visitid == qh visit_id)
-	  continue;
-	zinc_(Zhashtests);
-	if (qh_matchvertices (1, newfacet->vertices, newskip, facet->vertices, &skip, &same)) {
-	  ismatch= (same == (newfacet->toporient ^ facet->toporient));
-	  if (SETelemt_(facet->neighbors, skip, facetT) != qh_DUPLICATEridge) {
-	    if (!makematch) {
-	      fprintf (qh ferr, "qhull internal error (qh_matchduplicates): missing dupridge at f%d skip %d for new f%d skip %d hash %d\n",
-		     facet->id, skip, newfacet->id, newskip, hash);
-	      qh_errexit2 (qh_ERRqhull, facet, newfacet);
-	    }
-	  }else if (ismatch && makematch) {
-	    if (SETelemt_(newfacet->neighbors, newskip, facetT) == qh_DUPLICATEridge) {
-	      SETelem_(facet->neighbors, skip)= newfacet;
-	      if (newfacet->tricoplanar)
-  		SETelem_(newfacet->neighbors, newskip)= facet;
-	      else
-		SETelem_(newfacet->neighbors, newskip)= qh_MERGEridge;
-	      *hashcount -= 2; /* removed two unmatched facets */
-	      trace4((qh ferr, "qh_matchduplicates: duplicate f%d skip %d matched with new f%d skip %d merge\n",
-		    facet->id, skip, newfacet->id, newskip));
-	    }
-	  }else if (ismatch) {
-	    mindist= qh_getdistance (facet, newfacet, &low, &high);
-	    dist2= qh_getdistance (newfacet, facet, &low, &high);
-	    minimize_(mindist, dist2);
-	    if (mindist > maxdist) {
-	      maxdist= mindist;
-	      maxmatch= facet;
-	      maxskip= skip;
-	      maxmatch2= newfacet;
-	      maxskip2= newskip;
-	    }
-	    trace3((qh ferr, "qh_matchduplicates: duplicate f%d skip %d new f%d skip %d at dist %2.2g, max is now f%d f%d\n",
-		    facet->id, skip, newfacet->id, newskip, mindist, 
-		    maxmatch->id, maxmatch2->id));
-	  }else { /* !ismatch */
-	    nextfacet= facet;
-	    nextskip= skip;
-	  }
-	}
-	if (makematch && !facet 
+      for (scan= hash; (facet= SETelemt_(qh hash_table, scan, facetT));
+           scan= (++scan >= hashsize ? 0 : scan)) {
+        if (!facet->dupridge || facet->visitid == qh visit_id)
+          continue;
+        zinc_(Zhashtests);
+        if (qh_matchvertices(1, newfacet->vertices, newskip, facet->vertices, &skip, &same)) {
+          ismatch= (same == (boolT)(newfacet->toporient ^ facet->toporient));
+          if (SETelemt_(facet->neighbors, skip, facetT) != qh_DUPLICATEridge) {
+            if (!makematch) {
+              qh_fprintf(qh ferr, 6155, "qhull internal error (qh_matchduplicates): missing dupridge at f%d skip %d for new f%d skip %d hash %d\n",
+                     facet->id, skip, newfacet->id, newskip, hash);
+              qh_errexit2 (qh_ERRqhull, facet, newfacet);
+            }
+          }else if (ismatch && makematch) {
+            if (SETelemt_(newfacet->neighbors, newskip, facetT) == qh_DUPLICATEridge) {
+              SETelem_(facet->neighbors, skip)= newfacet;
+              if (newfacet->tricoplanar)
+                SETelem_(newfacet->neighbors, newskip)= facet;
+              else
+                SETelem_(newfacet->neighbors, newskip)= qh_MERGEridge;
+              *hashcount -= 2; /* removed two unmatched facets */
+              trace4((qh ferr, 4059, "qh_matchduplicates: duplicate f%d skip %d matched with new f%d skip %d merge\n",
+                    facet->id, skip, newfacet->id, newskip));
+            }
+          }else if (ismatch) {
+            mindist= qh_getdistance(facet, newfacet, &low, &high);
+            dist2= qh_getdistance(newfacet, facet, &low, &high);
+            minimize_(mindist, dist2);
+            if (mindist > maxdist) {
+              maxdist= mindist;
+              maxmatch= facet;
+              maxskip= skip;
+              maxmatch2= newfacet;
+              maxskip2= newskip;
+            }
+            trace3((qh ferr, 3018, "qh_matchduplicates: duplicate f%d skip %d new f%d skip %d at dist %2.2g, max is now f%d f%d\n",
+                    facet->id, skip, newfacet->id, newskip, mindist,
+                    maxmatch->id, maxmatch2->id));
+          }else { /* !ismatch */
+            nextfacet= facet;
+            nextskip= skip;
+          }
+        }
+        if (makematch && !facet
         && SETelemt_(facet->neighbors, skip, facetT) == qh_DUPLICATEridge) {
-	  fprintf (qh ferr, "qhull internal error (qh_matchduplicates): no MERGEridge match for duplicate f%d skip %d at hash %d\n",
-		     newfacet->id, newskip, hash);
-	  qh_errexit (qh_ERRqhull, newfacet, NULL);
-	}
+          qh_fprintf(qh ferr, 6156, "qhull internal error (qh_matchduplicates): no MERGEridge match for duplicate f%d skip %d at hash %d\n",
+                     newfacet->id, newskip, hash);
+          qh_errexit(qh_ERRqhull, newfacet, NULL);
+        }
       }
     } /* end of for each new facet at hash */
     if (!makematch) {
       if (!maxmatch) {
-	fprintf (qh ferr, "qhull internal error (qh_matchduplicates): no maximum match at duplicate f%d skip %d at hash %d\n",
-		     atfacet->id, atskip, hash);
-	qh_errexit (qh_ERRqhull, atfacet, NULL);
+        qh_fprintf(qh ferr, 6157, "qhull internal error (qh_matchduplicates): no maximum match at duplicate f%d skip %d at hash %d\n",
+                     atfacet->id, atskip, hash);
+        qh_errexit(qh_ERRqhull, atfacet, NULL);
       }
       SETelem_(maxmatch->neighbors, maxskip)= maxmatch2;
       SETelem_(maxmatch2->neighbors, maxskip2)= maxmatch;
       *hashcount -= 2; /* removed two unmatched facets */
       zzinc_(Zmultiridge);
-      trace0((qh ferr, "qh_matchduplicates: duplicate f%d skip %d matched with new f%d skip %d keep\n",
-	      maxmatch->id, maxskip, maxmatch2->id, maxskip2));
-      qh_precision ("ridge with multiple neighbors");
+      trace0((qh ferr, 25, "qh_matchduplicates: duplicate f%d skip %d matched with new f%d skip %d keep\n",
+              maxmatch->id, maxskip, maxmatch2->id, maxskip2));
+      qh_precision("ridge with multiple neighbors");
       if (qh IStracing >= 4)
-	qh_errprint ("DUPLICATED/MATCH", maxmatch, maxmatch2, NULL, NULL);
+        qh_errprint("DUPLICATED/MATCH", maxmatch, maxmatch2, NULL, NULL);
     }
   }
 } /* matchduplicates */
 
 /*---------------------------------
-  
+
   qh_nearcoplanar()
     for all facets, remove near-inside points from facet->coplanarset
     coplanar points defined by innerplane from qh_outerinner()
@@ -2127,7 +2124,7 @@
     if qh.JOGGLEmax
       drops inner plane by another qh.JOGGLEmax diagonal since a
         vertex could shift out while a coplanar point shifts in
-  
+
   notes:
     used for qh.PREmerge and qh.JOGGLEmax
     must agree with computation of qh.NEARcoplanar in qh_detroundoff()
@@ -2137,7 +2134,7 @@
     else if not keeping both coplanar and inside points
       remove !coplanar or !inside points from coplanar sets
 */
-void qh_nearcoplanar ( void /* qh.facet_list */) {
+void qh_nearcoplanar(void /* qh.facet_list */) {
   facetT *facet;
   pointT *point, **pointp;
   int numpart;
@@ -2145,26 +2142,26 @@
 
   if (!qh KEEPcoplanar && !qh KEEPinside) {
     FORALLfacets {
-      if (facet->coplanarset) 
+      if (facet->coplanarset)
         qh_setfree( &facet->coplanarset);
     }
   }else if (!qh KEEPcoplanar || !qh KEEPinside) {
-    qh_outerinner (NULL, NULL, &innerplane);
+    qh_outerinner(NULL, NULL, &innerplane);
     if (qh JOGGLEmax < REALmax/2)
-      innerplane -= qh JOGGLEmax * sqrt (qh hull_dim);
+      innerplane -= qh JOGGLEmax * sqrt((realT)qh hull_dim);
     numpart= 0;
-    FORALLfacets { 
+    FORALLfacets {
       if (facet->coplanarset) {
         FOREACHpoint_(facet->coplanarset) {
           numpart++;
-	  qh_distplane (point, facet, &dist); 
-  	  if (dist < innerplane) {
-	    if (!qh KEEPinside)
+          qh_distplane(point, facet, &dist);
+          if (dist < innerplane) {
+            if (!qh KEEPinside)
               SETref_(point)= NULL;
           }else if (!qh KEEPcoplanar)
             SETref_(point)= NULL;
         }
-	qh_setcompact (facet->coplanarset);
+        qh_setcompact(facet->coplanarset);
       }
     }
     zzadd_(Zcheckpart, numpart);
@@ -2173,13 +2170,13 @@
 
 /*---------------------------------
-  
+
   qh_nearvertex( facet, point, bestdist )
     return nearest vertex in facet to point
 
   returns:
     vertex and its distance
-    
+
   notes:
     if qh.DELAUNAY
       distance is measured in the input set
@@ -2187,7 +2184,7 @@
       Slow implementation.  Recomputes vertex set for each point.
     The vertex set could be stored in the qh.keepcentrum facet.
 */
-vertexT *qh_nearvertex (facetT *facet, pointT *point, realT *bestdistp) {
+vertexT *qh_nearvertex(facetT *facet, pointT *point, realT *bestdistp) {
   realT bestdist= REALmax, dist;
   vertexT *bestvertex= NULL, *vertex, **vertexp, *apex;
   coordT *center;
@@ -2199,38 +2196,38 @@
     dim--;
   if (facet->tricoplanar) {
     if (!qh VERTEXneighbors || !facet->center) {
-      fprintf(qh ferr, "qhull internal error (qh_nearvertex): qh.VERTEXneighbors and facet->center required for tricoplanar facets\n");
+      qh_fprintf(qh ferr, 6158, "qhull internal error (qh_nearvertex): qh.VERTEXneighbors and facet->center required for tricoplanar facets\n");
       qh_errexit(qh_ERRqhull, facet, NULL);
     }
-    vertices= qh_settemp (qh TEMPsize);
-    apex= SETfirst_(facet->vertices);
+    vertices= qh_settemp(qh TEMPsize);
+    apex= SETfirstt_(facet->vertices, vertexT);
     center= facet->center;
     FOREACHneighbor_(apex) {
       if (neighbor->center == center) {
-	FOREACHvertex_(neighbor->vertices) 
-	  qh_setappend(&vertices, vertex);
+        FOREACHvertex_(neighbor->vertices)
+          qh_setappend(&vertices, vertex);
       }
     }
-  }else 
+  }else
     vertices= facet->vertices;
   FOREACHvertex_(vertices) {
-    dist= qh_pointdist (vertex->point, point, -dim);
+    dist= qh_pointdist(vertex->point, point, -dim);
     if (dist < bestdist) {
       bestdist= dist;
       bestvertex= vertex;
     }
   }
   if (facet->tricoplanar)
-    qh_settempfree (&vertices);
-  *bestdistp= sqrt (bestdist);
-  trace3((qh ferr, "qh_nearvertex: v%d dist %2.2g for f%d p%d\n", 
+    qh_settempfree(&vertices);
+  *bestdistp= sqrt(bestdist);
+  trace3((qh ferr, 3019, "qh_nearvertex: v%d dist %2.2g for f%d p%d\n",
         bestvertex->id, *bestdistp, facet->id, qh_pointid(point)));
   return bestvertex;
 } /* nearvertex */
 
 /*---------------------------------
-  
+
   qh_newhashtable( newsize )
     returns size of qh.hash_table of at least newsize slots
 
@@ -2243,20 +2240,20 @@
   int size;
 
   size= ((newsize+1)*qh_HASHfactor) | 0x1;  /* odd number */
-  while (True) { 
+  while (True) {
     if ((size%3) && (size%5))
       break;
     size += 2;
     /* loop terminates because there is an infinite number of primes */
   }
-  qh hash_table= qh_setnew (size);
-  qh_setzero (qh hash_table, 0, size);
+  qh hash_table= qh_setnew(size);
+  qh_setzero(qh hash_table, 0, size);
   return size;
 } /* newhashtable */
 
 /*---------------------------------
-  
+
   qh_newvertex( point )
     returns a new vertex for point
 */
@@ -2264,10 +2261,10 @@
   vertexT *vertex;
 
   zinc_(Ztotvertices);
-  vertex= (vertexT *)qh_memalloc(sizeof(vertexT));
-  memset ((char *) vertex, 0, sizeof (vertexT));
+  vertex= (vertexT *)qh_memalloc((int)sizeof(vertexT));
+  memset((char *) vertex, (size_t)0, sizeof(vertexT));
   if (qh vertex_id == 0xFFFFFF) {
-    fprintf(qh ferr, "qhull input error: more than %d vertices.  ID field overflows and two vertices\n\
+    qh_fprintf(qh ferr, 6159, "qhull input error: more than %d vertices.  ID field overflows and two vertices\n\
 may have the same identifier.  Vertices not sorted correctly.\n", 0xFFFFFF);
     qh_errexit(qh_ERRinput, NULL, NULL);
   }
@@ -2275,27 +2272,32 @@
     qh tracevertex= vertex;
   vertex->id= qh vertex_id++;
   vertex->point= point;
-  trace4((qh ferr, "qh_newvertex: vertex p%d (v%d) created\n", qh_pointid(vertex->point), 
-	  vertex->id));
-  return (vertex);
+  vertex->dim= (unsigned char)(qh hull_dim <= MAX_vdim ? qh hull_dim : 0);
+  trace4((qh ferr, 4060, "qh_newvertex: vertex p%d(v%d) created\n", qh_pointid(vertex->point),
+          vertex->id));
+  return(vertex);
 } /* newvertex */
 
 /*---------------------------------
-  
+
   qh_nextridge3d( atridge, facet, vertex )
     return next ridge and vertex for a 3d facet
+    returns NULL on error
+    [for QhullFacet::nextRidge3d] Does not call qh_errexit nor access qh_qh.
 
   notes:
     in qh_ORIENTclock order
     this is a O(n^2) implementation to trace all ridges
     be sure to stop on any 2nd visit
-  
+    same as QhullRidge::nextRidge3d
+    does not use qh_qh or qh_errexit [QhullFacet.cpp]
+
   design:
     for each ridge
       exit if it is the ridge after atridge
 */
-ridgeT *qh_nextridge3d (ridgeT *atridge, facetT *facet, vertexT **vertexp) {
+ridgeT *qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp) {
   vertexT *atvertex, *vertex, *othervertex;
   ridgeT *ridge, **ridgep;
 
@@ -2322,17 +2324,17 @@
   return NULL;
 } /* nextridge3d */
 #else /* qh_NOmerge */
-void qh_matchduplicates (facetT *atfacet, int atskip, int hashsize, int *hashcount) {
+void qh_matchduplicates(facetT *atfacet, int atskip, int hashsize, int *hashcount) {
 }
-ridgeT *qh_nextridge3d (ridgeT *atridge, facetT *facet, vertexT **vertexp) {
+ridgeT *qh_nextridge3d(ridgeT *atridge, facetT *facet, vertexT **vertexp) {
 
   return NULL;
 }
 #endif /* qh_NOmerge */
-  
+
 /*---------------------------------
-  
+
   qh_outcoplanar()
     move points from all facets' outsidesets to their coplanarsets
 
@@ -2344,70 +2346,70 @@
       for each outside point for facet
         partition point into coplanar set
 */
-void qh_outcoplanar (void /* facet_list */) {
+void qh_outcoplanar(void /* facet_list */) {
   pointT *point, **pointp;
   facetT *facet;
   realT dist;
 
-  trace1((qh ferr, "qh_outcoplanar: move outsideset to coplanarset for qh NARROWhull\n"));
+  trace1((qh ferr, 1033, "qh_outcoplanar: move outsideset to coplanarset for qh NARROWhull\n"));
   FORALLfacets {
     FOREACHpoint_(facet->outsideset) {
       qh num_outside--;
       if (qh KEEPcoplanar || qh KEEPnearinside) {
-	qh_distplane (point, facet, &dist);
+        qh_distplane(point, facet, &dist);
         zinc_(Zpartition);
-	qh_partitioncoplanar (point, facet, &dist);
+        qh_partitioncoplanar(point, facet, &dist);
       }
     }
-    qh_setfree (&facet->outsideset);
+    qh_setfree(&facet->outsideset);
   }
 } /* outcoplanar */
 
 /*---------------------------------
-  
+
   qh_point( id )
     return point for a point id, or NULL if unknown
 
   alternative code:
-    return ((pointT *)((unsigned   long)qh.first_point
+    return((pointT *)((unsigned   long)qh.first_point
            + (unsigned long)((id)*qh.normal_size)));
 */
-pointT *qh_point (int id) {
+pointT *qh_point(int id) {
 
   if (id < 0)
     return NULL;
   if (id < qh num_points)
     return qh first_point + id * qh hull_dim;
   id -= qh num_points;
-  if (id < qh_setsize (qh other_points))
+  if (id < qh_setsize(qh other_points))
     return SETelemt_(qh other_points, id, pointT);
   return NULL;
 } /* point */
-  
+
 /*---------------------------------
-  
+
   qh_point_add( set, point, elem )
     stores elem at set[point.id]
-  
+
   returns:
     access function for qh_pointfacet and qh_pointvertex
 
   notes:
     checks point.id
 */
-void qh_point_add (setT *set, pointT *point, void *elem) {
+void qh_point_add(setT *set, pointT *point, void *elem) {
   int id, size;
 
   SETreturnsize_(set, size);
   if ((id= qh_pointid(point)) < 0)
-    fprintf (qh ferr, "qhull internal warning (point_add): unknown point %p id %d\n", 
+    qh_fprintf(qh ferr, 7067, "qhull internal warning (point_add): unknown point %p id %d\n",
       point, id);
   else if (id >= size) {
-    fprintf (qh ferr, "qhull internal errror (point_add): point p%d is out of bounds (%d)\n",
-	     id, size);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
+    qh_fprintf(qh ferr, 6160, "qhull internal errror(point_add): point p%d is out of bounds(%d)\n",
+             id, size);
+    qh_errexit(qh_ERRqhull, NULL, NULL);
   }else
     SETelem_(set, id)= elem;
 } /* point_add */
@@ -2415,7 +2417,7 @@
 
 /*---------------------------------
-  
+
   qh_pointfacet()
     return temporary set of facet for each point
     the set is indexed by point id
@@ -2430,41 +2432,41 @@
   access:
     FOREACHfacet_i_(facets) { ... }
     SETelem_(facets, i)
-  
+
   design:
     for each facet
       add each vertex
       add each coplanar point
       add each outside point
 */
-setT *qh_pointfacet (void /*qh facet_list*/) {
-  int numpoints= qh num_points + qh_setsize (qh other_points);
+setT *qh_pointfacet(void /*qh facet_list*/) {
+  int numpoints= qh num_points + qh_setsize(qh other_points);
   setT *facets;
   facetT *facet;
   vertexT *vertex, **vertexp;
   pointT *point, **pointp;
-  
-  facets= qh_settemp (numpoints);
-  qh_setzero (facets, 0, numpoints);
+
+  facets= qh_settemp(numpoints);
+  qh_setzero(facets, 0, numpoints);
   qh vertex_visit++;
   FORALLfacets {
     FOREACHvertex_(facet->vertices) {
       if (vertex->visitid != qh vertex_visit) {
         vertex->visitid= qh vertex_visit;
-        qh_point_add (facets, vertex->point, facet);
+        qh_point_add(facets, vertex->point, facet);
       }
     }
-    FOREACHpoint_(facet->coplanarset) 
-      qh_point_add (facets, point, facet);
-    FOREACHpoint_(facet->outsideset) 
-      qh_point_add (facets, point, facet);
+    FOREACHpoint_(facet->coplanarset)
+      qh_point_add(facets, point, facet);
+    FOREACHpoint_(facet->outsideset)
+      qh_point_add(facets, point, facet);
   }
   return facets;
 } /* pointfacet */
 
 /*---------------------------------
-  
+
   qh_pointvertex(  )
     return temporary set of vertices indexed by point id
     entry is NULL if no vertex for a point
@@ -2474,39 +2476,39 @@
     FOREACHvertex_i_(vertices) { ... }
     SETelem_(vertices, i)
 */
-setT *qh_pointvertex (void /*qh facet_list*/) {
-  int numpoints= qh num_points + qh_setsize (qh other_points);
+setT *qh_pointvertex(void /*qh facet_list*/) {
+  int numpoints= qh num_points + qh_setsize(qh other_points);
   setT *vertices;
   vertexT *vertex;
-  
-  vertices= qh_settemp (numpoints);
-  qh_setzero (vertices, 0, numpoints);
-  FORALLvertices 
-    qh_point_add (vertices, vertex->point, vertex);
+
+  vertices= qh_settemp(numpoints);
+  qh_setzero(vertices, 0, numpoints);
+  FORALLvertices
+    qh_point_add(vertices, vertex->point, vertex);
   return vertices;
 } /* pointvertex */
 
 
 /*---------------------------------
-  
+
   qh_prependfacet( facet, facetlist )
     prepend facet to the start of a facetlist
 
   returns:
     increments qh.numfacets
     updates facetlist, qh.facet_list, facet_next
-  
+
   notes:
     be careful of prepending since it can lose a pointer.
       e.g., can lose _next by deleting and then prepending before _next
 */
 void qh_prependfacet(facetT *facet, facetT **facetlist) {
   facetT *prevfacet, *list;
-  
 
-  trace4((qh ferr, "qh_prependfacet: prepend f%d before f%d\n",
-	  facet->id, getid_(*facetlist)));
+
+  trace4((qh ferr, 4061, "qh_prependfacet: prepend f%d before f%d\n",
+          facet->id, getid_(*facetlist)));
   if (!*facetlist)
     (*facetlist)= qh facet_tail;
   list= *facetlist;
@@ -2527,13 +2529,13 @@
 
 /*---------------------------------
-  
+
   qh_printhashtable( fp )
     print hash table to fp
 
   notes:
     not in I/O to avoid bringing io.c in
-  
+
   design:
     for each hash entry
       if defined
@@ -2548,79 +2550,79 @@
   FOREACHfacet_i_(qh hash_table) {
     if (facet) {
       FOREACHneighbor_i_(facet) {
-        if (!neighbor || neighbor == qh_MERGEridge || neighbor == qh_DUPLICATEridge) 
+        if (!neighbor || neighbor == qh_MERGEridge || neighbor == qh_DUPLICATEridge)
           break;
       }
       if (neighbor_i == neighbor_n)
         continue;
-      fprintf (fp, "hash %d f%d ", facet_i, facet->id);
+      qh_fprintf(fp, 9283, "hash %d f%d ", facet_i, facet->id);
       FOREACHvertex_(facet->vertices)
-        fprintf (fp, "v%d ", vertex->id);
-      fprintf (fp, "\n neighbors:");
+        qh_fprintf(fp, 9284, "v%d ", vertex->id);
+      qh_fprintf(fp, 9285, "\n neighbors:");
       FOREACHneighbor_i_(facet) {
-	if (neighbor == qh_MERGEridge)
-	  id= -3;
-	else if (neighbor == qh_DUPLICATEridge)
-	  id= -2;
-	else
-	  id= getid_(neighbor);
-        fprintf (fp, " %d", id);
+        if (neighbor == qh_MERGEridge)
+          id= -3;
+        else if (neighbor == qh_DUPLICATEridge)
+          id= -2;
+        else
+          id= getid_(neighbor);
+        qh_fprintf(fp, 9286, " %d", id);
       }
-      fprintf (fp, "\n");
+      qh_fprintf(fp, 9287, "\n");
     }
   }
 } /* printhashtable */
-     
 
+
 /*---------------------------------
-  
+
   qh_printlists( fp )
     print out facet and vertex list for debugging (without 'f/v' tags)
 */
-void qh_printlists (void) {
+void qh_printlists(void) {
   facetT *facet;
   vertexT *vertex;
   int count= 0;
-  
-  fprintf (qh ferr, "qh_printlists: facets:");
+
+  qh_fprintf(qh ferr, 8108, "qh_printlists: facets:");
   FORALLfacets {
     if (++count % 100 == 0)
-      fprintf (qh ferr, "\n     ");
-    fprintf (qh ferr, " %d", facet->id);
+      qh_fprintf(qh ferr, 8109, "\n     ");
+    qh_fprintf(qh ferr, 8110, " %d", facet->id);
   }
-  fprintf (qh ferr, "\n  new facets %d visible facets %d next facet for qh_addpoint %d\n  vertices (new %d):",
+  qh_fprintf(qh ferr, 8111, "\n  new facets %d visible facets %d next facet for qh_addpoint %d\n  vertices(new %d):",
      getid_(qh newfacet_list), getid_(qh visible_list), getid_(qh facet_next),
      getid_(qh newvertex_list));
   count = 0;
   FORALLvertices {
     if (++count % 100 == 0)
-      fprintf (qh ferr, "\n     ");
-    fprintf (qh ferr, " %d", vertex->id);
+      qh_fprintf(qh ferr, 8112, "\n     ");
+    qh_fprintf(qh ferr, 8113, " %d", vertex->id);
   }
-  fprintf (qh ferr, "\n");
+  qh_fprintf(qh ferr, 8114, "\n");
 } /* printlists */
-  
+
 /*---------------------------------
-  
+
   qh_resetlists( stats, qh_RESETvisible )
     reset newvertex_list, newfacet_list, visible_list
-    if stats, 
+    if stats,
       maintains statistics
 
   returns:
     visible_list is empty if qh_deletevisible was called
 */
-void qh_resetlists (boolT stats, boolT resetVisible /*qh newvertex_list newfacet_list visible_list*/) {
+void qh_resetlists(boolT stats, boolT resetVisible /*qh newvertex_list newfacet_list visible_list*/) {
   vertexT *vertex;
   facetT *newfacet, *visible;
   int totnew=0, totver=0;
-  
+
   if (stats) {
     FORALLvertex_(qh newvertex_list)
       totver++;
-    FORALLnew_facets 
+    FORALLnew_facets
       totnew++;
     zadd_(Zvisvertextot, totver);
     zmax_(Zvisvertexmax, totver);
@@ -2646,32 +2648,32 @@
 
 /*---------------------------------
-  
+
   qh_setvoronoi_all()
     compute Voronoi centers for all facets
     includes upperDelaunay facets if qh.UPPERdelaunay ('Qu')
 
   returns:
     facet->center is the Voronoi center
-    
+
   notes:
     this is unused/untested code
       please email bradb at shore.net if this works ok for you
-  
+
   use:
-    FORALLvertices {...} to locate the vertex for a point.  
+    FORALLvertices {...} to locate the vertex for a point.
     FOREACHneighbor_(vertex) {...} to visit the Voronoi centers for a Voronoi cell.
 */
-void qh_setvoronoi_all (void) {
+void qh_setvoronoi_all(void) {
   facetT *facet;
 
-  qh_clearcenters (qh_ASvoronoi);
+  qh_clearcenters(qh_ASvoronoi);
   qh_vertexneighbors();
-  
+
   FORALLfacets {
     if (!facet->normal || !facet->upperdelaunay || qh UPPERdelaunay) {
       if (!facet->center)
-        facet->center= qh_facetcenter (facet->vertices);
+        facet->center= qh_facetcenter(facet->vertices);
     }
   }
 } /* setvoronoi_all */
@@ -2680,10 +2682,11 @@
 
 /*---------------------------------
-  
+
   qh_triangulate()
-    triangulate non-simplicial facets on qh.facet_list, 
-    if qh.CENTERtype=qh_ASvoronoi, sets Voronoi centers of non-simplicial facets
+    triangulate non-simplicial facets on qh.facet_list,
+    if qh VORONOI, sets Voronoi centers of non-simplicial facets
+    nop if hasTriangulation
 
   returns:
     all facets simplicial
@@ -2693,27 +2696,29 @@
     call after qh_check_output since may switch to Voronoi centers
     Output may overwrite ->f.triowner with ->f.area
 */
-void qh_triangulate (void /*qh facet_list*/) {
+void qh_triangulate(void /*qh facet_list*/) {
   facetT *facet, *nextfacet, *owner;
   int onlygood= qh ONLYgood;
   facetT *neighbor, *visible= NULL, *facet1, *facet2, *new_facet_list= NULL;
   facetT *orig_neighbor= NULL, *otherfacet;
   vertexT *new_vertex_list= NULL;
-  mergeT *merge; 
+  mergeT *merge;
   mergeType mergetype;
   int neighbor_i, neighbor_n;
 
-  trace1((qh ferr, "qh_triangulate: triangulate non-simplicial facets\n"));
+  if (qh hasTriangulation)
+      return;
+  trace1((qh ferr, 1034, "qh_triangulate: triangulate non-simplicial facets\n"));
   if (qh hull_dim == 2)
     return;
   if (qh VORONOI) {  /* otherwise lose Voronoi centers [could rebuild vertex set from tricoplanar] */
-    qh_clearcenters (qh_ASvoronoi);
+    qh_clearcenters(qh_ASvoronoi);
     qh_vertexneighbors();
   }
   qh ONLYgood= False; /* for makenew_nonsimplicial */
   qh visit_id++;
   qh NEWfacets= True;
-  qh degen_mergeset= qh_settemp (qh TEMPsize);
+  qh degen_mergeset= qh_settemp(qh TEMPsize);
   qh newvertex_list= qh vertex_tail;
   for (facet= qh facet_list; facet && facet->next; facet= nextfacet) { /* non-simplicial facets moved to end */
     nextfacet= facet->next;
@@ -2722,130 +2727,131 @@
     /* triangulate all non-simplicial facets, otherwise merging does not work, e.g., RBOX c P-0.1 P+0.1 P+0.1 D3 | QHULL d Qt Tv */
     if (!new_facet_list)
       new_facet_list= facet;  /* will be moved to end */
-    qh_triangulate_facet (facet, &new_vertex_list);
+    qh_triangulate_facet(facet, &new_vertex_list);
   }
-  trace2((qh ferr, "qh_triangulate: delete null facets from f%d -- apex same as second vertex\n", getid_(new_facet_list)));
+  trace2((qh ferr, 2047, "qh_triangulate: delete null facets from f%d -- apex same as second vertex\n", getid_(new_facet_list)));
   for (facet= new_facet_list; facet && facet->next; facet= nextfacet) { /* null facets moved to end */
     nextfacet= facet->next;
-    if (facet->visible) 
+    if (facet->visible)
       continue;
     if (facet->ridges) {
       if (qh_setsize(facet->ridges) > 0) {
-	fprintf( qh ferr, "qhull error (qh_triangulate): ridges still defined for f%d\n", facet->id);
-	qh_errexit (qh_ERRqhull, facet, NULL);
+        qh_fprintf(qh ferr, 6161, "qhull error (qh_triangulate): ridges still defined for f%d\n", facet->id);
+        qh_errexit(qh_ERRqhull, facet, NULL);
       }
-      qh_setfree (&facet->ridges);
+      qh_setfree(&facet->ridges);
     }
     if (SETfirst_(facet->vertices) == SETsecond_(facet->vertices)) {
       zinc_(Ztrinull);
-      qh_triangulate_null (facet);
+      qh_triangulate_null(facet);
     }
   }
-  trace2((qh ferr, "qh_triangulate: delete %d or more mirror facets -- same vertices and neighbors\n", qh_setsize(qh degen_mergeset)));
+  trace2((qh ferr, 2048, "qh_triangulate: delete %d or more mirror facets -- same vertices and neighbors\n", qh_setsize(qh degen_mergeset)));
   qh visible_list= qh facet_tail;
-  while ((merge= (mergeT*)qh_setdellast (qh degen_mergeset))) {
+  while ((merge= (mergeT*)qh_setdellast(qh degen_mergeset))) {
     facet1= merge->facet1;
     facet2= merge->facet2;
     mergetype= merge->type;
-    qh_memfree (merge, sizeof(mergeT));
+    qh_memfree(merge, (int)sizeof(mergeT));
     if (mergetype == MRGmirror) {
       zinc_(Ztrimirror);
-      qh_triangulate_mirror (facet1, facet2);
+      qh_triangulate_mirror(facet1, facet2);
     }
   }
   qh_settempfree(&qh degen_mergeset);
-  trace2((qh ferr, "qh_triangulate: update neighbor lists for vertices from v%d\n", getid_(new_vertex_list)));
+  trace2((qh ferr, 2049, "qh_triangulate: update neighbor lists for vertices from v%d\n", getid_(new_vertex_list)));
   qh newvertex_list= new_vertex_list;  /* all vertices of new facets */
   qh visible_list= NULL;
   qh_updatevertices(/*qh newvertex_list, empty newfacet_list and visible_list*/);
-  qh_resetlists (False, !qh_RESETvisible /*qh newvertex_list, empty newfacet_list and visible_list*/);
+  qh_resetlists(False, !qh_RESETvisible /*qh newvertex_list, empty newfacet_list and visible_list*/);
 
-  trace2((qh ferr, "qh_triangulate: identify degenerate tricoplanar facets from f%d\n", getid_(new_facet_list)));
-  trace2((qh ferr, "qh_triangulate: and replace facet->f.triowner with tricoplanar facets that own center, normal, etc.\n"));
+  trace2((qh ferr, 2050, "qh_triangulate: identify degenerate tricoplanar facets from f%d\n", getid_(new_facet_list)));
+  trace2((qh ferr, 2051, "qh_triangulate: and replace facet->f.triowner with tricoplanar facets that own center, normal, etc.\n"));
   FORALLfacet_(new_facet_list) {
     if (facet->tricoplanar && !facet->visible) {
       FOREACHneighbor_i_(facet) {
-	if (neighbor_i == 0) {  /* first iteration */
-	  if (neighbor->tricoplanar)
+        if (neighbor_i == 0) {  /* first iteration */
+          if (neighbor->tricoplanar)
             orig_neighbor= neighbor->f.triowner;
-	  else
-	    orig_neighbor= neighbor;
-	}else {
-	  if (neighbor->tricoplanar)
-  	    otherfacet= neighbor->f.triowner;
-	  else
-	    otherfacet= neighbor;
-	  if (orig_neighbor == otherfacet) {
-	    zinc_(Ztridegen);
-	    facet->degenerate= True;
-	    break;
-	  }
-	}
+          else
+            orig_neighbor= neighbor;
+        }else {
+          if (neighbor->tricoplanar)
+            otherfacet= neighbor->f.triowner;
+          else
+            otherfacet= neighbor;
+          if (orig_neighbor == otherfacet) {
+            zinc_(Ztridegen);
+            facet->degenerate= True;
+            break;
+          }
+        }
       }
     }
   }
 
-  trace2((qh ferr, "qh_triangulate: delete visible facets -- non-simplicial, null, and mirrored facets\n"));
+  trace2((qh ferr, 2052, "qh_triangulate: delete visible facets -- non-simplicial, null, and mirrored facets\n"));
   owner= NULL;
   visible= NULL;
   for (facet= new_facet_list; facet && facet->next; facet= nextfacet) { /* may delete facet */
     nextfacet= facet->next;
     if (facet->visible) {
       if (facet->tricoplanar) { /* a null or mirrored facet */
-	qh_delfacet(facet);
-	qh num_visible--;
+        qh_delfacet(facet);
+        qh num_visible--;
       }else {  /* a non-simplicial facet followed by its tricoplanars */
-	if (visible && !owner) {
-	  /*  RBOX 200 s D5 t1001471447 | QHULL Qt C-0.01 Qx Qc Tv Qt -- f4483 had 6 vertices/neighbors and 8 ridges */
-	  trace2((qh ferr, "qh_triangulate: all tricoplanar facets degenerate for non-simplicial facet f%d\n",
-		       visible->id));
-	  qh_delfacet(visible);
-	  qh num_visible--;
-	}
-	visible= facet;
-	owner= NULL;
+        if (visible && !owner) {
+          /*  RBOX 200 s D5 t1001471447 | QHULL Qt C-0.01 Qx Qc Tv Qt -- f4483 had 6 vertices/neighbors and 8 ridges */
+          trace2((qh ferr, 2053, "qh_triangulate: all tricoplanar facets degenerate for non-simplicial facet f%d\n",
+                       visible->id));
+          qh_delfacet(visible);
+          qh num_visible--;
+        }
+        visible= facet;
+        owner= NULL;
       }
     }else if (facet->tricoplanar) {
-      if (facet->f.triowner != visible) { 
-	fprintf( qh ferr, "qhull error (qh_triangulate): tricoplanar facet f%d not owned by its visible, non-simplicial facet f%d\n", facet->id, getid_(visible));
-	qh_errexit2 (qh_ERRqhull, facet, visible);
+      if (facet->f.triowner != visible) {
+        qh_fprintf(qh ferr, 6162, "qhull error (qh_triangulate): tricoplanar facet f%d not owned by its visible, non-simplicial facet f%d\n", facet->id, getid_(visible));
+        qh_errexit2 (qh_ERRqhull, facet, visible);
       }
-      if (owner) 
-	facet->f.triowner= owner;
+      if (owner)
+        facet->f.triowner= owner;
       else if (!facet->degenerate) {
-	owner= facet;
-	nextfacet= visible->next; /* rescan tricoplanar facets with owner */
-	facet->keepcentrum= True;  /* one facet owns ->normal, etc. */
-	facet->coplanarset= visible->coplanarset;
-	facet->outsideset= visible->outsideset;
-  	visible->coplanarset= NULL;
-	visible->outsideset= NULL;
+        owner= facet;
+        nextfacet= visible->next; /* rescan tricoplanar facets with owner */
+        facet->keepcentrum= True;  /* one facet owns ->normal, etc. */
+        facet->coplanarset= visible->coplanarset;
+        facet->outsideset= visible->outsideset;
+        visible->coplanarset= NULL;
+        visible->outsideset= NULL;
         if (!qh TRInormals) { /* center and normal copied to tricoplanar facets */
-	  visible->center= NULL;
-	  visible->normal= NULL;
-	}
-	qh_delfacet(visible);
-	qh num_visible--;
+          visible->center= NULL;
+          visible->normal= NULL;
+        }
+        qh_delfacet(visible);
+        qh num_visible--;
       }
     }
   }
   if (visible && !owner) {
-    trace2((qh ferr, "qh_triangulate: all tricoplanar facets degenerate for last non-simplicial facet f%d\n",
-	         visible->id));
+    trace2((qh ferr, 2054, "qh_triangulate: all tricoplanar facets degenerate for last non-simplicial facet f%d\n",
+                 visible->id));
     qh_delfacet(visible);
     qh num_visible--;
   }
   qh NEWfacets= False;
   qh ONLYgood= onlygood; /* restore value */
-  if (qh CHECKfrequently) 
-    qh_checkpolygon (qh facet_list);
+  if (qh CHECKfrequently)
+    qh_checkpolygon(qh facet_list);
+  qh hasTriangulation= True;
 } /* triangulate */
 
 
 /*---------------------------------
-  
-  qh_triangulate_facet (facetA)
+
+  qh_triangulate_facet(facetA)
     triangulate a non-simplicial facet
       if qh.CENTERtype=qh_ASvoronoi, sets its Voronoi center
   returns:
@@ -2854,7 +2860,7 @@
       facet->degenerate set if duplicated apex
       facet->f.trivisible set to facetA
       facet->center copied from facetA (created if qh_ASvoronoi)
-	qh_eachvoronoi, qh_detvridge, qh_detvridge3 assume centers copied
+        qh_eachvoronoi, qh_detvridge, qh_detvridge3 assume centers copied
       facet->normal,offset,maxoutside copied from facetA
 
   notes:
@@ -2865,36 +2871,36 @@
       qh_makenewfacets() -- construct a cone of facets for a new vertex
 
   design:
-      if qh_ASvoronoi, 
-	 compute Voronoi center (facet->center)
+      if qh_ASvoronoi,
+         compute Voronoi center (facet->center)
       select first vertex (highest ID to preserve ID ordering of ->vertices)
       triangulate from vertex to ridges
       copy facet->center, normal, offset
       update vertex neighbors
 */
-void qh_triangulate_facet (facetT *facetA, vertexT **first_vertex) {
+void qh_triangulate_facet(facetT *facetA, vertexT **first_vertex) {
   facetT *newfacet;
   facetT *neighbor, **neighborp;
   vertexT *apex;
   int numnew=0;
 
-  trace3((qh ferr, "qh_triangulate_facet: triangulate facet f%d\n", facetA->id));
+  trace3((qh ferr, 3020, "qh_triangulate_facet: triangulate facet f%d\n", facetA->id));
 
   if (qh IStracing >= 4)
-    qh_printfacet (qh ferr, facetA);
+    qh_printfacet(qh ferr, facetA);
   FOREACHneighbor_(facetA) {
     neighbor->seen= False;
     neighbor->coplanar= False;
   }
   if (qh CENTERtype == qh_ASvoronoi && !facetA->center  /* matches upperdelaunay in qh_setfacetplane() */
         && fabs_(facetA->normal[qh hull_dim -1]) >= qh ANGLEround * qh_ZEROdelaunay) {
-    facetA->center= qh_facetcenter (facetA->vertices);
+    facetA->center= qh_facetcenter(facetA->vertices);
   }
-  qh_willdelete (facetA, NULL);
+  qh_willdelete(facetA, NULL);
   qh newfacet_list= qh facet_tail;
   facetA->visitid= qh visit_id;
-  apex= SETfirst_(facetA->vertices);
-  qh_makenew_nonsimplicial (facetA, apex, &numnew);
+  apex= SETfirstt_(facetA->vertices, vertexT);
+  qh_makenew_nonsimplicial(facetA, apex, &numnew);
   SETfirst_(facetA->neighbors)= NULL;
   FORALLnew_facets {
     newfacet->tricoplanar= True;
@@ -2902,13 +2908,13 @@
     newfacet->degenerate= False;
     newfacet->upperdelaunay= facetA->upperdelaunay;
     newfacet->good= facetA->good;
-    if (qh TRInormals) { 
+    if (qh TRInormals) {
       newfacet->keepcentrum= True;
-      newfacet->normal= qh_copypoints (facetA->normal, 1, qh hull_dim);
-      if (qh CENTERtype == qh_AScentrum) 
-	newfacet->center= qh_getcentrum (newfacet);
+      newfacet->normal= qh_copypoints(facetA->normal, 1, qh hull_dim);
+      if (qh CENTERtype == qh_AScentrum)
+        newfacet->center= qh_getcentrum(newfacet);
       else
-	newfacet->center= qh_copypoints (facetA->center, 1, qh hull_dim);
+        newfacet->center= qh_copypoints(facetA->center, 1, qh hull_dim);
     }else {
       newfacet->keepcentrum= False;
       newfacet->normal= facetA->normal;
@@ -2928,70 +2934,70 @@
     (*first_vertex)= qh newvertex_list;
   qh newvertex_list= NULL;
   qh_updatevertices(/*qh newfacet_list, empty visible_list and newvertex_list*/);
-  qh_resetlists (False, !qh_RESETvisible /*qh newfacet_list, empty visible_list and newvertex_list*/);
+  qh_resetlists(False, !qh_RESETvisible /*qh newfacet_list, empty visible_list and newvertex_list*/);
 } /* triangulate_facet */
 
 /*---------------------------------
-  
-  qh_triangulate_link (oldfacetA, facetA, oldfacetB, facetB)
+
+  qh_triangulate_link(oldfacetA, facetA, oldfacetB, facetB)
     relink facetA to facetB via oldfacets
   returns:
     adds mirror facets to qh degen_mergeset (4-d and up only)
   design:
     if they are already neighbors, the opposing neighbors become MRGmirror facets
 */
-void qh_triangulate_link (facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB) {
+void qh_triangulate_link(facetT *oldfacetA, facetT *facetA, facetT *oldfacetB, facetT *facetB) {
   int errmirror= False;
 
-  trace3((qh ferr, "qh_triangulate_link: relink old facets f%d and f%d between neighbors f%d and f%d\n", 
+  trace3((qh ferr, 3021, "qh_triangulate_link: relink old facets f%d and f%d between neighbors f%d and f%d\n",
          oldfacetA->id, oldfacetB->id, facetA->id, facetB->id));
-  if (qh_setin (facetA->neighbors, facetB)) {
-    if (!qh_setin (facetB->neighbors, facetA)) 
+  if (qh_setin(facetA->neighbors, facetB)) {
+    if (!qh_setin(facetB->neighbors, facetA))
       errmirror= True;
     else
-      qh_appendmergeset (facetA, facetB, MRGmirror, NULL);
-  }else if (qh_setin (facetB->neighbors, facetA)) 
+      qh_appendmergeset(facetA, facetB, MRGmirror, NULL);
+  }else if (qh_setin(facetB->neighbors, facetA))
     errmirror= True;
   if (errmirror) {
-    fprintf( qh ferr, "qhull error (qh_triangulate_link): mirror facets f%d and f%d do not match for old facets f%d and f%d\n",
+    qh_fprintf(qh ferr, 6163, "qhull error (qh_triangulate_link): mirror facets f%d and f%d do not match for old facets f%d and f%d\n",
        facetA->id, facetB->id, oldfacetA->id, oldfacetB->id);
     qh_errexit2 (qh_ERRqhull, facetA, facetB);
   }
-  qh_setreplace (facetB->neighbors, oldfacetB, facetA);
-  qh_setreplace (facetA->neighbors, oldfacetA, facetB);
+  qh_setreplace(facetB->neighbors, oldfacetB, facetA);
+  qh_setreplace(facetA->neighbors, oldfacetA, facetB);
 } /* triangulate_link */
 
 /*---------------------------------
-  
-  qh_triangulate_mirror (facetA, facetB)
+
+  qh_triangulate_mirror(facetA, facetB)
     delete mirrored facets from qh_triangulate_null() and qh_triangulate_mirror
       a mirrored facet shares the same vertices of a logical ridge
   design:
     since a null facet duplicates the first two vertices, the opposing neighbors absorb the null facet
     if they are already neighbors, the opposing neighbors become MRGmirror facets
 */
-void qh_triangulate_mirror (facetT *facetA, facetT *facetB) {
+void qh_triangulate_mirror(facetT *facetA, facetT *facetB) {
   facetT *neighbor, *neighborB;
   int neighbor_i, neighbor_n;
 
-  trace3((qh ferr, "qh_triangulate_mirror: delete mirrored facets f%d and f%d\n", 
+  trace3((qh ferr, 3022, "qh_triangulate_mirror: delete mirrored facets f%d and f%d\n",
          facetA->id, facetB->id));
   FOREACHneighbor_i_(facetA) {
     neighborB= SETelemt_(facetB->neighbors, neighbor_i, facetT);
     if (neighbor == neighborB)
       continue; /* occurs twice */
-    qh_triangulate_link (facetA, neighbor, facetB, neighborB);
+    qh_triangulate_link(facetA, neighbor, facetB, neighborB);
   }
-  qh_willdelete (facetA, NULL);
-  qh_willdelete (facetB, NULL);
+  qh_willdelete(facetA, NULL);
+  qh_willdelete(facetB, NULL);
 } /* triangulate_mirror */
 
 /*---------------------------------
-  
-  qh_triangulate_null (facetA)
+
+  qh_triangulate_null(facetA)
     remove null facetA from qh_triangulate_facet()
       a null facet has vertex #1 (apex) == vertex #2
   returns:
@@ -3001,56 +3007,56 @@
     since a null facet duplicates the first two vertices, the opposing neighbors absorb the null facet
     if they are already neighbors, the opposing neighbors become MRGmirror facets
 */
-void qh_triangulate_null (facetT *facetA) {
+void qh_triangulate_null(facetT *facetA) {
   facetT *neighbor, *otherfacet;
 
-  trace3((qh ferr, "qh_triangulate_null: delete null facet f%d\n", facetA->id));
-  neighbor= SETfirst_(facetA->neighbors);
-  otherfacet= SETsecond_(facetA->neighbors);
-  qh_triangulate_link (facetA, neighbor, facetA, otherfacet);
-  qh_willdelete (facetA, NULL);
+  trace3((qh ferr, 3023, "qh_triangulate_null: delete null facet f%d\n", facetA->id));
+  neighbor= SETfirstt_(facetA->neighbors, facetT);
+  otherfacet= SETsecondt_(facetA->neighbors, facetT);
+  qh_triangulate_link(facetA, neighbor, facetA, otherfacet);
+  qh_willdelete(facetA, NULL);
 } /* triangulate_null */
 
 #else /* qh_NOmerge */
-void qh_triangulate (void) {
+void qh_triangulate(void) {
 }
 #endif /* qh_NOmerge */
 
    /*---------------------------------
-  
+
   qh_vertexintersect( vertexsetA, vertexsetB )
     intersects two vertex sets (inverse id ordered)
     vertexsetA is a temporary set at the top of qhmem.tempstack
 
   returns:
     replaces vertexsetA with the intersection
-  
+
   notes:
     could overwrite vertexsetA if currently too slow
 */
 void qh_vertexintersect(setT **vertexsetA,setT *vertexsetB) {
   setT *intersection;
 
-  intersection= qh_vertexintersect_new (*vertexsetA, vertexsetB);
-  qh_settempfree (vertexsetA);
+  intersection= qh_vertexintersect_new(*vertexsetA, vertexsetB);
+  qh_settempfree(vertexsetA);
   *vertexsetA= intersection;
-  qh_settemppush (intersection);
+  qh_settemppush(intersection);
 } /* vertexintersect */
 
 /*---------------------------------
-  
+
   qh_vertexintersect_new(  )
     intersects two vertex sets (inverse id ordered)
 
   returns:
     a new set
 */
-setT *qh_vertexintersect_new (setT *vertexsetA,setT *vertexsetB) {
-  setT *intersection= qh_setnew (qh hull_dim - 1);
-  vertexT **vertexA= SETaddr_(vertexsetA, vertexT); 
-  vertexT **vertexB= SETaddr_(vertexsetB, vertexT); 
+setT *qh_vertexintersect_new(setT *vertexsetA,setT *vertexsetB) {
+  setT *intersection= qh_setnew(qh hull_dim - 1);
+  vertexT **vertexA= SETaddr_(vertexsetA, vertexT);
+  vertexT **vertexB= SETaddr_(vertexsetB, vertexT);
 
   while (*vertexA && *vertexB) {
     if (*vertexA  == *vertexB) {
@@ -3068,10 +3074,10 @@
 
 /*---------------------------------
-  
+
   qh_vertexneighbors()
-    for each vertex in qh.facet_list, 
-      determine its neighboring facets 
+    for each vertex in qh.facet_list,
+      determine its neighboring facets
 
   returns:
     sets qh.VERTEXneighbors
@@ -3086,13 +3092,13 @@
       for each vertex
         append facet to vertex->neighbors
 */
-void qh_vertexneighbors (void /*qh facet_list*/) {
+void qh_vertexneighbors(void /*qh facet_list*/) {
   facetT *facet;
   vertexT *vertex, **vertexp;
 
   if (qh VERTEXneighbors)
     return;
-  trace1((qh ferr, "qh_vertexneighbors: determing neighboring facets for each vertex\n"));
+  trace1((qh ferr, 1035, "qh_vertexneighbors: determing neighboring facets for each vertex\n"));
   qh vertex_visit++;
   FORALLfacets {
     if (facet->visible)
@@ -3100,9 +3106,9 @@
     FOREACHvertex_(facet->vertices) {
       if (vertex->visitid != qh vertex_visit) {
         vertex->visitid= qh vertex_visit;
-        vertex->neighbors= qh_setnew (qh hull_dim);
+        vertex->neighbors= qh_setnew(qh hull_dim);
       }
-      qh_setappend (&vertex->neighbors, facet);
+      qh_setappend(&vertex->neighbors, facet);
     }
   }
   qh VERTEXneighbors= True;
@@ -3110,12 +3116,12 @@
 
 /*---------------------------------
-  
+
   qh_vertexsubset( vertexsetA, vertexsetB )
     returns True if vertexsetA is a subset of vertexsetB
     assumes vertexsets are sorted
 
-  note:    
+  note:
     empty set is a subset of any other set
 */
 boolT qh_vertexsubset(setT *vertexsetA, setT *vertexsetB) {
@@ -3131,7 +3137,7 @@
       return False;
     if (*vertexA  == *vertexB)
       vertexA++;
-    vertexB++; 
+    vertexB++;
   }
   return False; /* avoid warnings */
 } /* vertexsubset */

Deleted: trunk/scipy/spatial/qhull/src/qconvex.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qconvex.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qconvex.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,334 +0,0 @@
-/*
  ---------------------------------
-
-   qconvex.c
-      compute convex hulls using qhull
-
-   see unix.c for full interface
-
-   copyright (c) 1993-2003, The Geometry Center
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-
-#elif __cplusplus
-extern "C" {
-  int isatty (int);
-}
-
-#elif _MSC_VER
-#include 
-#define isatty _isatty
-
-#else
-int isatty (int);  /* returns 1 if stdin is a tty
-		   if "Undefined symbol" this can be deleted along with call in main() */
-#endif
-
-/*---------------------------------
-
-  qh_prompt
-    long prompt for qconvex
-    
-  notes:
-    restricted version of qhull.c
-
-  see:
-    concise prompt below
-*/  
-
-/* duplicated in qconvex.htm */
-char hidden_options[]=" d v H Qbb Qf Qg Qm Qr Qu Qv Qx Qz TR E V Fp Gt Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 ";
-	       
-char qh_prompta[]= "\n\
-qconvex- compute the convex hull\n\
-    http://www.qhull.org  %s\n\
-\n\
-input (stdin):\n\
-    first lines: dimension and number of points (or vice-versa).\n\
-    other lines: point coordinates, best if one point per line\n\
-    comments:    start with a non-numeric character\n\
-\n\
-options:\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Qc   - keep coplanar points with nearest facet\n\
-    Qi   - keep interior points with nearest facet\n\
-\n\
-Qhull control options:\n\
-    Qbk:n   - scale coord k so that low bound is n\n\
-      QBk:n - scale coord k so that upper bound is n (QBk is %2.2g)\n\
-    QbB  - scale input to unit cube centered at the origin\n\
-    Qbk:0Bk:0 - remove k-th coordinate from input\n\
-    QJn  - randomly joggle input in range [-n,n]\n\
-    QRn  - random rotation (n=seed, n=0 time, n=-1 time/no rotate)\n\
-%s%s%s%s";  /* split up qh_prompt for Visual C++ */
-char qh_promptb[]= "\
-    Qs   - search all points for the initial simplex\n\
-    QGn  - good facet if visible from point n, -n for not visible\n\
-    QVn  - good facet if it includes point n, -n if not\n\
-\n\
-";
-char qh_promptc[]= "\
-Trace options:\n\
-    T4   - trace at level n, 4=all, 5=mem/gauss, -1= events\n\
-    Tc   - check frequently during execution\n\
-    Ts   - print statistics\n\
-    Tv   - verify result: structure, convexity, and point inclusion\n\
-    Tz   - send all output to stdout\n\
-    TFn  - report summary when n or more facets created\n\
-    TI file - input data from file, no spaces or single quotes\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-    TPn  - turn on tracing when point n added to hull\n\
-     TMn - turn on tracing at merge n\n\
-     TWn - trace merge facets when width > n\n\
-    TVn  - stop qhull after adding point n, -n for before (see TCn)\n\
-     TCn - stop qhull after building cone for point n (see TVn)\n\
-\n\
-Precision options:\n\
-    Cn   - radius of centrum (roundoff added).  Merge facets if non-convex\n\
-     An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex\n\
-           C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\
-    Rn   - randomly perturb computations by a factor of [1-n,1+n]\n\
-    Un   - max distance below plane for a new, coplanar point\n\
-    Wn   - min facet width for outside point (before roundoff)\n\
-\n\
-Output formats (may be combined; if none, produces a summary to stdout):\n\
-    f    - facet dump\n\
-    G    - Geomview output (see below)\n\
-    i    - vertices incident to each facet\n\
-    m    - Mathematica output (2-d and 3-d)\n\
-    n    - normals with offsets\n\
-    o    - OFF file format (dim, points and facets; Voronoi regions)\n\
-    p    - point coordinates \n\
-    s    - summary (stderr)\n\
-\n\
-";
-char qh_promptd[]= "\
-More formats:\n\
-    Fa   - area for each facet\n\
-    FA   - compute total area and volume for option 's'\n\
-    Fc   - count plus coplanar points for each facet\n\
-           use 'Qc' (default) for coplanar and 'Qi' for interior\n\
-    FC   - centrum for each facet\n\
-    Fd   - use cdd format for input (homogeneous with offset first)\n\
-    FD   - use cdd format for numeric output (offset first)\n\
-    FF   - facet dump without ridges\n\
-    Fi   - inner plane for each facet\n\
-    FI   - ID for each facet\n\
-    Fm   - merge count for each facet (511 max)\n\
-    Fn   - count plus neighboring facets for each facet\n\
-    FN   - count plus neighboring facets for each point\n\
-    Fo   - outer plane (or max_outside) for each facet\n\
-    FO   - options and precision constants\n\
-    FP   - nearest vertex for each coplanar point\n\
-    FQ   - command used for qconvex\n\
-    Fs   - summary: #int (8), dimension, #points, tot vertices, tot facets,\n\
-                      for output: #vertices, #facets,\n\
-                                  #coplanar points, #non-simplicial facets\n\
-                    #real (2), max outer plane, min vertex\n\
-    FS   - sizes:   #int (0) \n\
-                    #real(2) tot area, tot volume\n\
-    Ft   - triangulation with centrums for non-simplicial facets (OFF format)\n\
-    Fv   - count plus vertices for each facet\n\
-    FV   - average of vertices (a feasible point for 'H')\n\
-    Fx   - extreme points (in order for 2-d)\n\
-\n\
-";
-char qh_prompte[]= "\
-Geomview output (2-d, 3-d, and 4-d)\n\
-    Ga   - all points as dots\n\
-     Gp  -  coplanar points and vertices as radii\n\
-     Gv  -  vertices as spheres\n\
-    Gi   - inner planes only\n\
-     Gn  -  no planes\n\
-     Go  -  outer planes only\n\
-    Gc   - centrums\n\
-    Gh   - hyperplane intersections\n\
-    Gr   - ridges\n\
-    GDn  - drop dimension n in 3-d and 4-d output\n\
-\n\
-Print options:\n\
-    PAn  - keep n largest facets by area\n\
-    Pdk:n - drop facet if normal[k] <= n (default 0.0)\n\
-    PDk:n - drop facet if normal[k] >= n\n\
-    Pg   - print good facets (needs 'QGn' or 'QVn')\n\
-    PFn  - keep facets whose area is at least n\n\
-    PG   - print neighbors of good facets\n\
-    PMn  - keep n facets with most merges\n\
-    Po   - force output.  If error, output neighborhood of facet\n\
-    Pp   - do not report precision problems\n\
-\n\
-    .    - list of all options\n\
-    -    - one line descriptions of all options\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt2
-    synopsis for qhull 
-*/  
-char qh_prompt2[]= "\n\
-qconvex- compute the convex hull.  Qhull %s\n\
-    input (stdin): dimension, number of points, point coordinates\n\
-    comments start with a non-numeric character\n\
-\n\
-options (qconvex.htm):\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Tv   - verify result: structure, convexity, and point inclusion\n\
-    .    - concise list of all options\n\
-    -    - one-line description of all options\n\
-\n\
-output options (subset):\n\
-    s    - summary of results (default)\n\
-    i    - vertices incident to each facet\n\
-    n    - normals with offsets\n\
-    p    - vertex coordinates (includes coplanar points if 'Qc')\n\
-    Fx   - extreme points (convex hull vertices)\n\
-    FA   - compute total area and volume\n\
-    o    - OFF format (dim, n, points, facets)\n\
-    G    - Geomview output (2-d, 3-d, and 4-d)\n\
-    m    - Mathematica output (2-d and 3-d)\n\
-    QVn  - print facets that include point n, -n if not\n\
-    TO file- output results to file, may be enclosed in single quotes\n\
-\n\
-examples:\n\
-    rbox c D2 | qconvex s n                    rbox c D2 | qconvex i\n\
-    rbox c D2 | qconvex o                      rbox 1000 s | qconvex s Tv FA\n\
-    rbox c d D2 | qconvex s Qc Fx              rbox y 1000 W0 | qconvex s n\n\
-    rbox y 1000 W0 | qconvex s QJ              rbox d G1 D12 | qconvex QR0 FA Pp\n\
-    rbox c D7 | qconvex FA TF1000\n\
-\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt3
-    concise prompt for qhull 
-*/  
-char qh_prompt3[]= "\n\
-Qhull %s.\n\
-Except for 'F.' and 'PG', upper-case options take an argument.\n\
-\n\
- incidences     mathematica    normals        OFF_format     points\n\
- summary        facet_dump\n\
-\n\
- Farea          FArea_total    Fcoplanars     FCentrums      Fd_cdd_in\n\
- FD_cdd_out     FFacet_xridge  Finner         FIDs           Fmerges\n\
- Fneighbors     FNeigh_vertex  Fouter         FOptions       FPoint_near\n\
- FQhull         Fsummary       FSize          Fvertices      FVertex_ave\n\
- Fxtremes       FMaple\n\
-\n\
- Gvertices      Gpoints        Gall_points    Gno_planes     Ginner\n\
- Gcentrums      Ghyperplanes   Gridges        Gouter         GDrop_dim\n\
-\n\
- PArea_keep     Pdrop d0:0D0   PFacet_area_keep Pgood        PGood_neighbors\n\
- PMerge_keep    Poutput_forced Pprecision_not\n\
-\n\
- QbBound 0:0.5  QbB_scale_box  Qcoplanar      QGood_point    Qinterior\n\
- QJoggle        Qrandom        QRotate        Qsearch_1st    Qtriangulate\n\
- QVertex_good\n\
-\n\
- T4_trace       Tcheck_often   Tstatistics    Tverify        Tz_stdout\n\
- TFacet_log     TInput_file    TPoint_trace   TMerge_trace   TOutput_file\n\
- TWide_trace    TVertex_stop   TCone_stop\n\
-\n\
- Angle_max      Centrum_size   Random_dist    Ucoplanar_max  Wide_outside\n\
-";
-
-/*---------------------------------
-  
-  main( argc, argv )
-    processes the command line, calls qhull() to do the work, and exits
-  
-  design:
-    initializes data structures
-    reads points
-    finishes initialization
-    computes convex hull and other structures
-    checks the result
-    writes the output
-    frees memory
-*/
-int main(int argc, char *argv[]) {
-  int curlong, totlong; /* used !qh_NOmem */
-  int exitcode, numpoints, dim;
-  coordT *points;
-  boolT ismalloc;
-
-#if __MWERKS__ && __POWERPC__
-  char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-  SIOUXSettings.showstatusline= false;
-  SIOUXSettings.tabspaces= 1;
-  SIOUXSettings.rows= 40;
-  if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-  || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-  || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0)) 
-    fprintf (stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-  argc= ccommand(&argv);
-#endif
-
-  if ((argc == 1) && isatty( 0 /*stdin*/)) {      
-    fprintf(stdout, qh_prompt2, qh_version);
-    exit(qh_ERRnone);
-  }
-  if (argc > 1 && *argv[1] == '-' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompta, qh_version, qh_DEFAULTbox, 
-		qh_promptb, qh_promptc, qh_promptd, qh_prompte);
-    exit(qh_ERRnone);
-  }
-  if (argc >1 && *argv[1] == '.' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompt3, qh_version);
-    exit(qh_ERRnone);
-  }
-  qh_init_A (stdin, stdout, stderr, argc, argv);  /* sets qh qhull_command */
-  exitcode= setjmp (qh errexit); /* simple statement for CRAY J916 */
-  if (!exitcode) {
-    qh_checkflags (qh qhull_command, hidden_options);
-    qh_initflags (qh qhull_command);
-    points= qh_readpoints (&numpoints, &dim, &ismalloc);
-    if (dim >= 5) {
-      qh_option ("Qxact_merge", NULL, NULL);
-      qh MERGEexact= True; /* 'Qx' always */
-    }
-    qh_init_B (points, numpoints, dim, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();
-    if (qh VERIFYoutput && !qh FORCEoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points();
-    exitcode= qh_ERRnone;
-  }
-  qh NOerrexit= True;  /* no more setjmp */
-#ifdef qh_NOmem
-  qh_freeqhull( True);
-#else
-  qh_freeqhull( False);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong) 
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-#endif
-  return exitcode;
-} /* main */
-

Deleted: trunk/scipy/spatial/qhull/src/qdelaun.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qdelaun.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qdelaun.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,324 +0,0 @@
-/*
  ---------------------------------
-
-   qdelaun.c
-     compute Delaunay triangulations and furthest-point Delaunay
-     triangulations using qhull
-
-   see unix.c for full interface
-
-   copyright (c) 1993-2003, The Geometry Center
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-
-#elif __cplusplus
-extern "C" {
-  int isatty (int);
-}
-
-#elif _MSC_VER
-#include 
-#define isatty _isatty
-
-#else
-int isatty (int);  /* returns 1 if stdin is a tty
-		   if "Undefined symbol" this can be deleted along with call in main() */
-#endif
-
-/*---------------------------------
-
-  qh_prompt 
-    long prompt for qhull
-    
-  notes:
-    restricted version of qhull.c
- 
-  see:
-    concise prompt below
-*/  
-
-/* duplicated in qdelau_f.htm and qdelaun.htm */
-char hidden_options[]=" d n v H U Qb QB Qc Qf Qg Qi Qm Qr QR Qv Qx TR E V FC Fi Fo Ft Fp FV Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 ";
-
-char qh_prompta[]= "\n\
-qdelaunay- compute the Delaunay triangulation\n\
-    http://www.qhull.org  %s\n\
-\n\
-input (stdin):\n\
-    first lines: dimension and number of points (or vice-versa).\n\
-    other lines: point coordinates, best if one point per line\n\
-    comments:    start with a non-numeric character\n\
-\n\
-options:\n\
-    Qu   - compute furthest-site Delaunay triangulation\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-\n\
-Qhull control options:\n\
-    QJn  - randomly joggle input in range [-n,n]\n\
-%s%s%s%s";  /* split up qh_prompt for Visual C++ */
-char qh_promptb[]= "\
-    Qs   - search all points for the initial simplex\n\
-    Qz   - add point-at-infinity to Delaunay triangulation\n\
-    QGn  - print Delaunay region if visible from point n, -n if not\n\
-    QVn  - print Delaunay regions that include point n, -n if not\n\
-\n\
-";
-char qh_promptc[]= "\
-Trace options:\n\
-    T4   - trace at level n, 4=all, 5=mem/gauss, -1= events\n\
-    Tc   - check frequently during execution\n\
-    Ts   - print statistics\n\
-    Tv   - verify result: structure, convexity, and in-circle test\n\
-    Tz   - send all output to stdout\n\
-    TFn  - report summary when n or more facets created\n\
-    TI file - input data from file, no spaces or single quotes\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-    TPn  - turn on tracing when point n added to hull\n\
-     TMn - turn on tracing at merge n\n\
-     TWn - trace merge facets when width > n\n\
-    TVn  - stop qhull after adding point n, -n for before (see TCn)\n\
-     TCn - stop qhull after building cone for point n (see TVn)\n\
-\n\
-Precision options:\n\
-    Cn   - radius of centrum (roundoff added).  Merge facets if non-convex\n\
-     An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex\n\
-           C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\
-    Rn   - randomly perturb computations by a factor of [1-n,1+n]\n\
-    Wn   - min facet width for outside point (before roundoff)\n\
-\n\
-Output formats (may be combined; if none, produces a summary to stdout):\n\
-    f    - facet dump\n\
-    G    - Geomview output (see below)\n\
-    i    - vertices incident to each Delaunay region\n\
-    m    - Mathematica output (2-d only, lifted to a paraboloid)\n\
-    o    - OFF format (dim, points, and facets as a paraboloid)\n\
-    p    - point coordinates (lifted to a paraboloid)\n\
-    s    - summary (stderr)\n\
-\n\
-";
-char qh_promptd[]= "\
-More formats:\n\
-    Fa   - area for each Delaunay region\n\
-    FA   - compute total area for option 's'\n\
-    Fc   - count plus coincident points for each Delaunay region\n\
-    Fd   - use cdd format for input (homogeneous with offset first)\n\
-    FD   - use cdd format for numeric output (offset first)\n\
-    FF   - facet dump without ridges\n\
-    FI   - ID of each Delaunay region\n\
-    Fm   - merge count for each Delaunay region (511 max)\n\
-    FM   - Maple output (2-d only, lifted to a paraboloid)\n\
-    Fn   - count plus neighboring region for each Delaunay region\n\
-    FN   - count plus neighboring region for each point\n\
-    FO   - options and precision constants\n\
-    FP   - nearest point and distance for each coincident point\n\
-    FQ   - command used for qdelaunay\n\
-    Fs   - summary: #int (8), dimension, #points, tot vertices, tot facets,\n\
-                    for output: #vertices, #Delaunay regions,\n\
-                                #coincident points, #non-simplicial regions\n\
-                    #real (2), max outer plane, min vertex\n\
-    FS   - sizes:   #int (0)\n\
-                    #real(2) tot area, 0\n\
-    Fv   - count plus vertices for each Delaunay region\n\
-    Fx   - extreme points of Delaunay triangulation (on convex hull)\n\
-\n\
-";
-char qh_prompte[]= "\
-Geomview options (2-d and 3-d)\n\
-    Ga   - all points as dots\n\
-     Gp  -  coplanar points and vertices as radii\n\
-     Gv  -  vertices as spheres\n\
-    Gi   - inner planes only\n\
-     Gn  -  no planes\n\
-     Go  -  outer planes only\n\
-    Gc	   - centrums\n\
-    Gh   - hyperplane intersections\n\
-    Gr   - ridges\n\
-    GDn  - drop dimension n in 3-d and 4-d output\n\
-    Gt   - transparent outer ridges to view 3-d Delaunay\n\
-\n\
-Print options:\n\
-    PAn  - keep n largest Delaunay regions by area\n\
-    Pdk:n - drop facet if normal[k] <= n (default 0.0)\n\
-    PDk:n - drop facet if normal[k] >= n\n\
-    Pg   - print good Delaunay regions (needs 'QGn' or 'QVn')\n\
-    PFn  - keep Delaunay regions whose area is at least n\n\
-    PG   - print neighbors of good regions (needs 'QGn' or 'QVn')\n\
-    PMn  - keep n Delaunay regions with most merges\n\
-    Po   - force output.  If error, output neighborhood of facet\n\
-    Pp   - do not report precision problems\n\
-\n\
-    .    - list of all options\n\
-    -    - one line descriptions of all options\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt2
-    synopsis for qhull 
-*/  
-char qh_prompt2[]= "\n\
-qdelaunay- compute the Delaunay triangulation.  Qhull %s\n\
-    input (stdin): dimension, number of points, point coordinates\n\
-    comments start with a non-numeric character\n\
-\n\
-options (qdelaun.htm):\n\
-    Qu   - furthest-site Delaunay triangulation\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Tv   - verify result: structure, convexity, and in-circle test\n\
-    .    - concise list of all options\n\
-    -    - one-line description of all options\n\
-\n\
-output options (subset):\n\
-    s    - summary of results (default)\n\
-    i    - vertices incident to each Delaunay region\n\
-    Fx   - extreme points (vertices of the convex hull)\n\
-    o    - OFF format (shows the points lifted to a paraboloid)\n\
-    G    - Geomview output (2-d and 3-d points lifted to a paraboloid)\n\
-    m    - Mathematica output (2-d inputs lifted to a paraboloid)\n\
-    QVn  - print Delaunay regions that include point n, -n if not\n\
-    TO file- output results to file, may be enclosed in single quotes\n\
-\n\
-examples:\n\
-    rbox c P0 D2 | qdelaunay s o          rbox c P0 D2 | qdelaunay i\n\
-    rbox c P0 D2 | qdelaunay Fv           rbox c P0 D2 | qdelaunay s Qu Fv\n\
-    rbox c G1 d D2 | qdelaunay s i        rbox c G1 d D2 | qdelaunay Qt\n\
-    rbox M3,4 z 100 D2 | qdelaunay s      rbox M3,4 z 100 D2 | qdelaunay s Qt\n\
-\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt3
-    concise prompt for qhull 
-*/  
-char qh_prompt3[]= "\n\
-Qhull %s.\n\
-Except for 'F.' and 'PG', upper-case options take an argument.\n\
-\n\
- incidences     mathematica    OFF_format     points_lifted  summary\n\
- facet_dump\n\
-\n\
- Farea          FArea_total    Fcoincident    Fd_cdd_in      FD_cdd_out\n\
- FF_dump_xridge FIDs           Fmerges        Fneighbors     FNeigh_vertex\n\
- FOptions       FPoint_near    FQdelaun       Fsummary       FSize\n\
- Fvertices      Fxtremes       FMaple\n\
-\n\
- Gvertices      Gpoints        Gall_points    Gno_planes     Ginner\n\
- Gcentrums      Ghyperplanes   Gridges        Gouter         GDrop_dim\n\
- Gtransparent\n\
-\n\
- PArea_keep     Pdrop d0:0D0   Pgood          PFacet_area_keep\n\
- PGood_neighbors PMerge_keep   Poutput_forced Pprecision_not\n\
-\n\
- QGood_point    QJoggle        Qsearch_1st    Qtriangulate   QupperDelaunay\n\
- QVertex_good   Qzinfinite\n\
-\n\
- T4_trace       Tcheck_often   Tstatistics    Tverify        Tz_stdout\n\
- TFacet_log     TInput_file    TPoint_trace   TMerge_trace   TOutput_file\n\
- TWide_trace    TVertex_stop   TCone_stop\n\
-\n\
- Angle_max      Centrum_size   Random_dist    Wide_outside\n\
-";
-
-/*---------------------------------
-  
-  main( argc, argv )
-    processes the command line, calls qhull() to do the work, and exits
-  
-  design:
-    initializes data structures
-    reads points
-    finishes initialization
-    computes convex hull and other structures
-    checks the result
-    writes the output
-    frees memory
-*/
-int main(int argc, char *argv[]) {
-  int curlong, totlong; /* used !qh_NOmem */
-  int exitcode, numpoints, dim;
-  coordT *points;
-  boolT ismalloc;
-
-#if __MWERKS__ && __POWERPC__
-  char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-  SIOUXSettings.showstatusline= false;
-  SIOUXSettings.tabspaces= 1;
-  SIOUXSettings.rows= 40;
-  if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-  || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-  || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0)) 
-    fprintf (stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-  argc= ccommand(&argv);
-#endif
-
-  if ((argc == 1) && isatty( 0 /*stdin*/)) {      
-    fprintf(stdout, qh_prompt2, qh_version);
-    exit(qh_ERRnone);
-  }
-  if (argc > 1 && *argv[1] == '-' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompta, qh_version,
-		qh_promptb, qh_promptc, qh_promptd, qh_prompte);
-    exit(qh_ERRnone);
-  }
-  if (argc >1 && *argv[1] == '.' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompt3, qh_version);
-    exit(qh_ERRnone);
-  }
-  qh_init_A (stdin, stdout, stderr, argc, argv);  /* sets qh qhull_command */
-  exitcode= setjmp (qh errexit); /* simple statement for CRAY J916 */
-  if (!exitcode) {
-    qh_option ("delaunay  Qbbound-last", NULL, NULL);
-    qh DELAUNAY= True;     /* 'd'   */
-    qh SCALElast= True;    /* 'Qbb' */
-    qh KEEPcoplanar= True; /* 'Qc', to keep coplanars in 'p' */
-    qh_checkflags (qh qhull_command, hidden_options);
-    qh_initflags (qh qhull_command);
-    points= qh_readpoints (&numpoints, &dim, &ismalloc);
-    if (dim >= 5) {
-      qh_option ("Qxact_merge", NULL, NULL);
-      qh MERGEexact= True; /* 'Qx' always */
-    }
-    qh_init_B (points, numpoints, dim, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();
-    if (qh VERIFYoutput && !qh FORCEoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points();
-    exitcode= qh_ERRnone;
-  }
-  qh NOerrexit= True;  /* no more setjmp */
-#ifdef qh_NOmem
-  qh_freeqhull( True);
-#else
-  qh_freeqhull( False);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong) 
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-#endif
-  return exitcode;
-} /* main */
-

Deleted: trunk/scipy/spatial/qhull/src/qhalf.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qhalf.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qhalf.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,325 +0,0 @@
-/*
  ---------------------------------
-
-   qhalf.c
-     compute the intersection of halfspaces about a point
-
-   see unix.c for full interface
-
-   copyright (c) 1993-2003, The Geometry Center
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-
-#elif __cplusplus
-extern "C" {
-  int isatty (int);
-}
-
-#elif _MSC_VER
-#include 
-#define isatty _isatty
-
-#else
-int isatty (int);  /* returns 1 if stdin is a tty
-		   if "Undefined symbol" this can be deleted along with call in main() */
-#endif
-
-/*---------------------------------
-
-  qh_prompt 
-    long prompt for qhull
-    
-  notes:
-    restricted version of qhull.c
- 
-  see:
-    concise prompt below
-*/  
-
-/* duplicated in qhalf.htm */
-char hidden_options[]=" d n v Qbb QbB Qf Qg Qm Qr QR Qv Qx Qz TR E V Fa FA FC FD FS Ft FV Gt Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 ";
-
-char qh_prompta[]= "\n\
-qhalf- compute the intersection of halfspaces about a point\n\
-    http://www.qhull.org  %s\n\
-\n\
-input (stdin):\n\
-    optional interior point: dimension, 1, coordinates\n\
-    first lines: dimension+1 and number of halfspaces\n\
-    other lines: halfspace coefficients followed by offset\n\
-    comments:    start with a non-numeric character\n\
-\n\
-options:\n\
-    Hn,n - specify coordinates of interior point\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Qc   - keep coplanar halfspaces\n\
-    Qi   - keep other redundant halfspaces\n\
-\n\
-Qhull control options:\n\
-    QJn  - randomly joggle input in range [-n,n]\n\
-%s%s%s%s";  /* split up qh_prompt for Visual C++ */
-char qh_promptb[]= "\
-    Qbk:0Bk:0 - remove k-th coordinate from input\n\
-    Qs   - search all halfspaces for the initial simplex\n\
-    QGn  - print intersection if visible to halfspace n, -n for not\n\
-    QVn  - print intersections for halfspace n, -n if not\n\
-\n\
-";
-char qh_promptc[]= "\
-Trace options:\n\
-    T4   - trace at level n, 4=all, 5=mem/gauss, -1= events\n\
-    Tc   - check frequently during execution\n\
-    Ts   - print statistics\n\
-    Tv   - verify result: structure, convexity, and redundancy\n\
-    Tz   - send all output to stdout\n\
-    TFn  - report summary when n or more facets created\n\
-    TI file - input data from file, no spaces or single quotes\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-    TPn  - turn on tracing when halfspace n added to intersection\n\
-    TMn  - turn on tracing at merge n\n\
-    TWn  - trace merge facets when width > n\n\
-    TVn  - stop qhull after adding halfspace n, -n for before (see TCn)\n\
-    TCn  - stop qhull after building cone for halfspace n (see TVn)\n\
-\n\
-Precision options:\n\
-    Cn   - radius of centrum (roundoff added).  Merge facets if non-convex\n\
-     An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex\n\
-           C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\
-    Rn   - randomly perturb computations by a factor of [1-n,1+n]\n\
-    Un   - max distance below plane for a new, coplanar halfspace\n\
-    Wn   - min facet width for outside halfspace (before roundoff)\n\
-\n\
-Output formats (may be combined; if none, produces a summary to stdout):\n\
-    f    - facet dump\n\
-    G    - Geomview output (dual convex hull)\n\
-    i    - non-redundant halfspaces incident to each intersection\n\
-    m    - Mathematica output (dual convex hull)\n\
-    o    - OFF format (dual convex hull: dimension, points, and facets)\n\
-    p    - vertex coordinates of dual convex hull (coplanars if 'Qc' or 'Qi')\n\
-    s    - summary (stderr)\n\
-\n\
-";
-char qh_promptd[]= "\
-More formats:\n\
-    Fc   - count plus redundant halfspaces for each intersection\n\
-         -   Qc (default) for coplanar and Qi for other redundant\n\
-    Fd   - use cdd format for input (homogeneous with offset first)\n\
-    FF   - facet dump without ridges\n\
-    FI   - ID of each intersection\n\
-    Fm   - merge count for each intersection (511 max)\n\
-    FM   - Maple output (dual convex hull)\n\
-    Fn   - count plus neighboring intersections for each intersection\n\
-    FN   - count plus intersections for each non-redundant halfspace\n\
-    FO   - options and precision constants\n\
-    Fp   - dim, count, and intersection coordinates\n\
-    FP   - nearest halfspace and distance for each redundant halfspace\n\
-    FQ   - command used for qhalf\n\
-    Fs   - summary: #int (8), dim, #halfspaces, #non-redundant, #intersections\n\
-                      for output: #non-redundant, #intersections, #coplanar\n\
-                                  halfspaces, #non-simplicial intersections\n\
-                    #real (2), max outer plane, min vertex\n\
-    Fv   - count plus non-redundant halfspaces for each intersection\n\
-    Fx   - non-redundant halfspaces\n\
-\n\
-";
-char qh_prompte[]= "\
-Geomview output (2-d, 3-d and 4-d; dual convex hull)\n\
-    Ga   - all points (i.e., transformed halfspaces) as dots\n\
-     Gp  -  coplanar points and vertices as radii\n\
-     Gv  -  vertices (i.e., non-redundant halfspaces) as spheres\n\
-    Gi   - inner planes (i.e., halfspace intersections) only\n\
-     Gn  -  no planes\n\
-     Go  -  outer planes only\n\
-    Gc	 - centrums\n\
-    Gh   - hyperplane intersections\n\
-    Gr   - ridges\n\
-    GDn  - drop dimension n in 3-d and 4-d output\n\
-\n\
-Print options:\n\
-    PAn  - keep n largest facets (i.e., intersections) by area\n\
-    Pdk:n- drop facet if normal[k] <= n (default 0.0)\n\
-    PDk:n- drop facet if normal[k] >= n\n\
-    Pg   - print good facets (needs 'QGn' or 'QVn')\n\
-    PFn  - keep facets whose area is at least n\n\
-    PG   - print neighbors of good facets\n\
-    PMn  - keep n facets with most merges\n\
-    Po   - force output.  If error, output neighborhood of facet\n\
-    Pp   - do not report precision problems\n\
-\n\
-    .    - list of all options\n\
-    -    - one line descriptions of all options\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt2
-    synopsis for qhull 
-*/  
-char qh_prompt2[]= "\n\
-qhalf- halfspace intersection about a point.  Qhull %s\n\
-    input (stdin): [dim, 1, interior point], dim+1, n, coefficients+offset\n\
-    comments start with a non-numeric character\n\
-\n\
-options (qhalf.htm):\n\
-    Hn,n - specify coordinates of interior point\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Tv   - verify result: structure, convexity, and redundancy\n\
-    .    - concise list of all options\n\
-    -    - one-line description of all options\n\
-\n\
-output options (subset):\n\
-    s    - summary of results (default)\n\
-    Fp   - intersection coordinates\n\
-    Fv   - non-redundant halfspaces incident to each intersection\n\
-    Fx   - non-redundant halfspaces\n\
-    o    - OFF file format (dual convex hull)\n\
-    G    - Geomview output (dual convex hull)\n\
-    m    - Mathematica output (dual convex hull)\n\
-    QVn  - print intersections for halfspace n, -n if not\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-\n\
-examples:\n\
-    rbox d | qconvex FQ n | qhalf s H0,0,0 Fp\n\
-    rbox c | qconvex FQ FV n | qhalf s i\n\
-    rbox c | qconvex FQ FV n | qhalf s o\n\
-\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt3
-    concise prompt for qhull 
-*/  
-char qh_prompt3[]= "\n\
-Qhull %s.\n\
-Except for 'F.' and 'PG', upper_case options take an argument.\n\
-\n\
- incidences     Geomview       mathematica    OFF_format     point_dual\n\
- summary        facet_dump\n\
-\n\
- Fc_redundant   Fd_cdd_in      FF_dump_xridge FIDs           Fmerges\n\
- Fneighbors     FN_intersect   FOptions       Fp_coordinates FP_nearest\n\
- FQhalf         Fsummary       Fv_halfspace   FMaple         Fx_non_redundant\n\
-\n\
- Gvertices      Gpoints        Gall_points    Gno_planes     Ginner\n\
- Gcentrums      Ghyperplanes   Gridges        Gouter         GDrop_dim\n\
-\n\
- PArea_keep     Pdrop d0:0D0   Pgood          PFacet_area_keep\n\
- PGood_neighbors PMerge_keep   Poutput_forced Pprecision_not\n\
-\n\
- Qbk:0Bk:0_drop Qcoplanar      QG_half_good   Qi_redundant   QJoggle\n\
- Qsearch_1st    Qtriangulate   QVertex_good\n\
-\n\
- T4_trace       Tcheck_often   Tstatistics    Tverify        Tz_stdout\n\
- TFacet_log     TInput_file    TPoint_trace   TMerge_trace   TOutput_file\n\
- TWide_trace    TVertex_stop   TCone_stop\n\
-\n\
- Angle_max      Centrum_size   Random_dist    Ucoplanar_max  Wide_outside\n\
-";
-
-/*---------------------------------
-  
-  main( argc, argv )
-    processes the command line, calls qhull() to do the work, and exits
-  
-  design:
-    initializes data structures
-    reads points
-    finishes initialization
-    computes convex hull and other structures
-    checks the result
-    writes the output
-    frees memory
-*/
-int main(int argc, char *argv[]) {
-  int curlong, totlong; /* used !qh_NOmem */
-  int exitcode, numpoints, dim;
-  coordT *points;
-  boolT ismalloc;
-
-#if __MWERKS__ && __POWERPC__
-  char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-  SIOUXSettings.showstatusline= false;
-  SIOUXSettings.tabspaces= 1;
-  SIOUXSettings.rows= 40;
-  if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-  || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-  || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0)) 
-    fprintf (stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-  argc= ccommand(&argv);
-#endif
-
-  if ((argc == 1) && isatty( 0 /*stdin*/)) {      
-    fprintf(stdout, qh_prompt2, qh_version);
-    exit(qh_ERRnone);
-  }
-  if (argc > 1 && *argv[1] == '-' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompta, qh_version, 
-        qh_promptb, qh_promptc, qh_promptd, qh_prompte);
-    exit(qh_ERRnone);
-  }
-  if (argc >1 && *argv[1] == '.' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompt3, qh_version);
-    exit(qh_ERRnone);
-  }
-  qh_init_A (stdin, stdout, stderr, argc, argv);  /* sets qh qhull_command */
-  exitcode= setjmp (qh errexit); /* simple statement for CRAY J916 */
-  if (!exitcode) {
-    qh_option ("Halfspace", NULL, NULL);
-    qh HALFspace= True;    /* 'H'   */
-    qh_checkflags (qh qhull_command, hidden_options);
-    qh_initflags (qh qhull_command);
-    if (qh SCALEinput) {
-      fprintf(qh ferr, "\
-qhull error: options 'Qbk:n' and 'QBk:n' are not used with qhalf.\n\
-             Use 'Qbk:0Bk:0 to drop dimension k.\n");
-      qh_errexit(qh_ERRinput, NULL, NULL);
-    }
-    points= qh_readpoints (&numpoints, &dim, &ismalloc);
-    if (dim >= 5) {
-      qh_option ("Qxact_merge", NULL, NULL);
-      qh MERGEexact= True; /* 'Qx' always */
-    }
-    qh_init_B (points, numpoints, dim, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();
-    if (qh VERIFYoutput && !qh FORCEoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points();
-    exitcode= qh_ERRnone;
-  }
-  qh NOerrexit= True;  /* no more setjmp */
-#ifdef qh_NOmem
-  qh_freeqhull( True);
-#else
-  qh_freeqhull( False);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong) 
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-#endif
-  return exitcode;
-} /* main */
-

Deleted: trunk/scipy/spatial/qhull/src/qhull.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qhull.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qhull.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,1396 +0,0 @@
-/*
  ---------------------------------
-
-   qhull.c
-   Quickhull algorithm for convex hulls
-
-   qhull() and top-level routines
-
-   see qh-qhull.htm, qhull.h, unix.c
-
-   see qhull_a.h for internal functions
-
-   copyright (c) 1993-2003 The Geometry Center        
-*/
-
-#include "qhull_a.h" 
-
-/*============= functions in alphabetic order after qhull() =======*/
-
-/*---------------------------------
-  
-  qh_qhull()
-    compute DIM3 convex hull of qh.num_points starting at qh.first_point
-    qh contains all global options and variables
-
-  returns:
-    returns polyhedron
-      qh.facet_list, qh.num_facets, qh.vertex_list, qh.num_vertices,
-    
-    returns global variables
-      qh.hulltime, qh.max_outside, qh.interior_point, qh.max_vertex, qh.min_vertex
-    
-    returns precision constants
-      qh.ANGLEround, centrum_radius, cos_max, DISTround, MAXabs_coord, ONEmerge
-
-  notes:
-    unless needed for output
-      qh.max_vertex and qh.min_vertex are max/min due to merges
-      
-  see:
-    to add individual points to either qh.num_points
-      use qh_addpoint()
-      
-    if qh.GETarea
-      qh_produceoutput() returns qh.totarea and qh.totvol via qh_getarea()
-
-  design:
-    record starting time
-    initialize hull and partition points
-    build convex hull
-    unless early termination
-      update facet->maxoutside for vertices, coplanar, and near-inside points
-    error if temporary sets exist
-    record end time
-*/
-
-void qh_qhull (void) {
-  int numoutside;
-
-  qh hulltime= qh_CPUclock;
-  if (qh RERUN || qh JOGGLEmax < REALmax/2) 
-    qh_build_withrestart();
-  else {
-    qh_initbuild();
-    qh_buildhull();
-  }
-  if (!qh STOPpoint && !qh STOPcone) {
-    if (qh ZEROall_ok && !qh TESTvneighbors && qh MERGEexact)
-      qh_checkzero( qh_ALL);
-    if (qh ZEROall_ok && !qh TESTvneighbors && !qh WAScoplanar) {
-      trace2((qh ferr, "qh_qhull: all facets are clearly convex and no coplanar points.  Post-merging and check of maxout not needed.\n"));
-      qh DOcheckmax= False;
-    }else {
-      if (qh MERGEexact || (qh hull_dim > qh_DIMreduceBuild && qh PREmerge))
-        qh_postmerge ("First post-merge", qh premerge_centrum, qh premerge_cos, 
-             (qh POSTmerge ? False : qh TESTvneighbors));
-      else if (!qh POSTmerge && qh TESTvneighbors) 
-        qh_postmerge ("For testing vertex neighbors", qh premerge_centrum,
-             qh premerge_cos, True); 
-      if (qh POSTmerge)
-        qh_postmerge ("For post-merging", qh postmerge_centrum, 
-             qh postmerge_cos, qh TESTvneighbors);
-      if (qh visible_list == qh facet_list) { /* i.e., merging done */
-        qh findbestnew= True;
-        qh_partitionvisible (/*visible_list, newfacet_list*/ !qh_ALL, &numoutside);
-        qh findbestnew= False;
-        qh_deletevisible (/*qh visible_list*/);
-        qh_resetlists (False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
-      }
-    }
-    if (qh DOcheckmax){
-      if (qh REPORTfreq) {
-	qh_buildtracing (NULL, NULL); 
-	fprintf (qh ferr, "\nTesting all coplanar points.\n");
-      }
-      qh_check_maxout();
-    }
-    if (qh KEEPnearinside && !qh maxoutdone)  
-      qh_nearcoplanar();
-  }
-  if (qh_setsize ((setT*)qhmem.tempstack) != 0) {
-    fprintf (qh ferr, "qhull internal error (qh_qhull): temporary sets not empty (%d)\n",
-	     qh_setsize ((setT*)qhmem.tempstack));
-    qh_errexit (qh_ERRqhull, NULL, NULL);
-  }
-  qh hulltime= qh_CPUclock - qh hulltime;
-  qh QHULLfinished= True;
-  trace1((qh ferr, "qh_qhull: algorithm completed\n"));
-} /* qhull */
-
-/*---------------------------------
-  
-  qh_addpoint( furthest, facet, checkdist )
-    add point (usually furthest point) above facet to hull 
-    if checkdist, 
-      check that point is above facet.
-      if point is not outside of the hull, uses qh_partitioncoplanar()
-      assumes that facet is defined by qh_findbestfacet()
-    else if facet specified,
-      assumes that point is above facet (major damage if below)
-    for Delaunay triangulations, 
-      Use qh_setdelaunay() to lift point to paraboloid and scale by 'Qbb' if needed
-      Do not use options 'Qbk', 'QBk', or 'QbB' since they scale the coordinates. 
-
-  returns:
-    returns False if user requested an early termination
-     qh.visible_list, newfacet_list, delvertex_list, NEWfacets may be defined
-    updates qh.facet_list, qh.num_facets, qh.vertex_list, qh.num_vertices
-    clear qh.maxoutdone (will need to call qh_check_maxout() for facet->maxoutside)
-    if unknown point, adds a pointer to qh.other_points
-      do not deallocate the point's coordinates
-  
-  notes:
-    assumes point is near its best facet and not at a local minimum of a lens
-      distributions.  Use qh_findbestfacet to avoid this case.
-    uses qh.visible_list, qh.newfacet_list, qh.delvertex_list, qh.NEWfacets
-
-  see also:
-    qh_triangulate() -- triangulate non-simplicial facets
-
-  design:
-    check point in qh.first_point/.num_points
-    if checkdist
-      if point not above facet
-        partition coplanar point 
-        exit
-    exit if pre STOPpoint requested
-    find horizon and visible facets for point
-    make new facets for point to horizon
-    make hyperplanes for point
-    compute balance statistics
-    match neighboring new facets
-    update vertex neighbors and delete interior vertices
-    exit if STOPcone requested
-    merge non-convex new facets
-    if merge found, many merges, or 'Qf'
-       use qh_findbestnew() instead of qh_findbest()
-    partition outside points from visible facets
-    delete visible facets
-    check polyhedron if requested
-    exit if post STOPpoint requested
-    reset working lists of facets and vertices
-*/
-boolT qh_addpoint (pointT *furthest, facetT *facet, boolT checkdist) {
-  int goodvisible, goodhorizon;
-  vertexT *vertex;
-  facetT *newfacet;
-  realT dist, newbalance, pbalance;
-  boolT isoutside= False;
-  int numpart, numpoints, numnew, firstnew;
-
-  qh maxoutdone= False;
-  if (qh_pointid (furthest) == -1)
-    qh_setappend (&qh other_points, furthest);
-  if (!facet) {
-    fprintf (qh ferr, "qh_addpoint: NULL facet.  Need to call qh_findbestfacet first\n");
-    qh_errexit (qh_ERRqhull, NULL, NULL);
-  }
-  if (checkdist) {
-    facet= qh_findbest (furthest, facet, !qh_ALL, !qh_ISnewfacets, !qh_NOupper,
-			&dist, &isoutside, &numpart);
-    zzadd_(Zpartition, numpart);
-    if (!isoutside) {
-      zinc_(Znotmax);  /* last point of outsideset is no longer furthest. */
-      facet->notfurthest= True;
-      qh_partitioncoplanar (furthest, facet, &dist);
-      return True;
-    }
-  }
-  qh_buildtracing (furthest, facet);
-  if (qh STOPpoint < 0 && qh furthest_id == -qh STOPpoint-1) {
-    facet->notfurthest= True;
-    return False;
-  }
-  qh_findhorizon (furthest, facet, &goodvisible, &goodhorizon); 
-  if (qh ONLYgood && !(goodvisible+goodhorizon) && !qh GOODclosest) {
-    zinc_(Znotgood);  
-    facet->notfurthest= True;
-    /* last point of outsideset is no longer furthest.  This is ok
-       since all points of the outside are likely to be bad */
-    qh_resetlists (False, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
-    return True;
-  }
-  zzinc_(Zprocessed);
-  firstnew= qh facet_id;
-  vertex= qh_makenewfacets (furthest /*visible_list, attaches if !ONLYgood */);
-  qh_makenewplanes (/* newfacet_list */);
-  numnew= qh facet_id - firstnew;
-  newbalance= numnew - (realT) (qh num_facets-qh num_visible)
-                         * qh hull_dim/qh num_vertices;
-  wadd_(Wnewbalance, newbalance);
-  wadd_(Wnewbalance2, newbalance * newbalance);
-  if (qh ONLYgood 
-  && !qh_findgood (qh newfacet_list, goodhorizon) && !qh GOODclosest) {
-    FORALLnew_facets 
-      qh_delfacet (newfacet);
-    qh_delvertex (vertex);
-    qh_resetlists (True, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
-    zinc_(Znotgoodnew);
-    facet->notfurthest= True;
-    return True;
-  }
-  if (qh ONLYgood)
-    qh_attachnewfacets(/*visible_list*/);
-  qh_matchnewfacets();
-  qh_updatevertices();
-  if (qh STOPcone && qh furthest_id == qh STOPcone-1) {
-    facet->notfurthest= True;
-    return False;  /* visible_list etc. still defined */
-  }
-  qh findbestnew= False;
-  if (qh PREmerge || qh MERGEexact) {
-    qh_premerge (vertex, qh premerge_centrum, qh premerge_cos);
-    if (qh_USEfindbestnew)
-      qh findbestnew= True;
-    else {
-      FORALLnew_facets {
-	if (!newfacet->simplicial) {
-	  qh findbestnew= True;  /* use qh_findbestnew instead of qh_findbest*/
-	  break;
-	}
-      }
-    }
-  }else if (qh BESToutside)
-    qh findbestnew= True;
-  qh_partitionvisible (/*visible_list, newfacet_list*/ !qh_ALL, &numpoints);
-  qh findbestnew= False;
-  qh findbest_notsharp= False;
-  zinc_(Zpbalance);
-  pbalance= numpoints - (realT) qh hull_dim /* assumes all points extreme */
-                * (qh num_points - qh num_vertices)/qh num_vertices;
-  wadd_(Wpbalance, pbalance);
-  wadd_(Wpbalance2, pbalance * pbalance);
-  qh_deletevisible (/*qh visible_list*/);
-  zmax_(Zmaxvertex, qh num_vertices);
-  qh NEWfacets= False;
-  if (qh IStracing >= 4) {
-    if (qh num_facets < 2000)
-      qh_printlists();
-    qh_printfacetlist (qh newfacet_list, NULL, True);
-    qh_checkpolygon (qh facet_list);
-  }else if (qh CHECKfrequently) {
-    if (qh num_facets < 50)
-      qh_checkpolygon (qh facet_list);
-    else
-      qh_checkpolygon (qh newfacet_list);
-  }
-  if (qh STOPpoint > 0 && qh furthest_id == qh STOPpoint-1) 
-    return False; 
-  qh_resetlists (True, qh_RESETvisible /*qh visible_list newvertex_list newfacet_list */);
-  /* qh_triangulate(); to test qh.TRInormals */
-  trace2((qh ferr, "qh_addpoint: added p%d new facets %d new balance %2.2g point balance %2.2g\n",
-    qh_pointid (furthest), numnew, newbalance, pbalance));
-  return True;
-} /* addpoint */
-
-/*---------------------------------
-  
-  qh_build_withrestart()
-    allow restarts due to qh.JOGGLEmax while calling qh_buildhull()
-    qh.FIRSTpoint/qh.NUMpoints is point array
-        it may be moved by qh_joggleinput()
-*/
-void qh_build_withrestart (void) {
-  int restart;
-
-  qh ALLOWrestart= True;
-  while (True) {
-    restart= setjmp (qh restartexit); /* simple statement for CRAY J916 */
-    if (restart) {       /* only from qh_precision() */
-      zzinc_(Zretry);
-      wmax_(Wretrymax, qh JOGGLEmax);
-      qh ERREXITcalled= False;
-      qh STOPcone= True; /* if break, prevents normal output */
-    }
-    if (!qh RERUN && qh JOGGLEmax < REALmax/2) {
-      if (qh build_cnt > qh_JOGGLEmaxretry) {
-	fprintf(qh ferr, "\n\
-qhull precision error: %d attempts to construct a convex hull\n\
-        with joggled input.  Increase joggle above 'QJ%2.2g'\n\
-	or modify qh_JOGGLE... parameters in user.h\n",
-	   qh build_cnt, qh JOGGLEmax);
-	qh_errexit (qh_ERRqhull, NULL, NULL);
-      }
-      if (qh build_cnt && !restart)
-	break;
-    }else if (qh build_cnt && qh build_cnt >= qh RERUN)
-      break;
-    qh STOPcone= False;
-    qh_freebuild (True);  /* first call is a nop */
-    qh build_cnt++;
-    if (!qh qhull_optionsiz)
-      qh qhull_optionsiz= strlen (qh qhull_options);
-    else { 
-      qh qhull_options [qh qhull_optionsiz]= '\0';
-      qh qhull_optionlen= 80;
-    }
-    qh_option("_run", &qh build_cnt, NULL);
-    if (qh build_cnt == qh RERUN) {
-      qh IStracing= qh TRACElastrun;  /* duplicated from qh_initqhull_globals */
-      if (qh TRACEpoint != -1 || qh TRACEdist < REALmax/2 || qh TRACEmerge) {
-        qh TRACElevel= (qh IStracing? qh IStracing : 3);
-        qh IStracing= 0;
-      }
-      qhmem.IStracing= qh IStracing;
-    }
-    if (qh JOGGLEmax < REALmax/2)
-      qh_joggleinput();
-    qh_initbuild();
-    qh_buildhull();
-    if (qh JOGGLEmax < REALmax/2 && !qh MERGING)
-      qh_checkconvex (qh facet_list, qh_ALGORITHMfault);
-  }
-  qh ALLOWrestart= False;
-} /* qh_build_withrestart */
-
-/*---------------------------------
-  
-  qh_buildhull()
-    construct a convex hull by adding outside points one at a time
-
-  returns:
-  
-  notes:
-    may be called multiple times
-    checks facet and vertex lists for incorrect flags
-    to recover from STOPcone, call qh_deletevisible and qh_resetlists
-
-  design:
-    check visible facet and newfacet flags
-    check newlist vertex flags and qh.STOPcone/STOPpoint
-    for each facet with a furthest outside point
-      add point to facet
-      exit if qh.STOPcone or qh.STOPpoint requested
-    if qh.NARROWhull for initial simplex
-      partition remaining outside points to coplanar sets
-*/
-void qh_buildhull(void) {
-  facetT *facet;
-  pointT *furthest;
-  vertexT *vertex;
-  int id;
-  
-  trace1((qh ferr, "qh_buildhull: start build hull\n"));
-  FORALLfacets {
-    if (facet->visible || facet->newfacet) {
-      fprintf (qh ferr, "qhull internal error (qh_buildhull): visible or new facet f%d in facet list\n",
-                   facet->id);    
-      qh_errexit (qh_ERRqhull, facet, NULL);
-    }
-  }
-  FORALLvertices {
-    if (vertex->newlist) {
-      fprintf (qh ferr, "qhull internal error (qh_buildhull): new vertex f%d in vertex list\n",
-                   vertex->id);
-      qh_errprint ("ERRONEOUS", NULL, NULL, NULL, vertex);
-      qh_errexit (qh_ERRqhull, NULL, NULL);
-    }
-    id= qh_pointid (vertex->point);
-    if ((qh STOPpoint>0 && id == qh STOPpoint-1) ||
-	(qh STOPpoint<0 && id == -qh STOPpoint-1) ||
-	(qh STOPcone>0 && id == qh STOPcone-1)) {
-      trace1((qh ferr,"qh_buildhull: stop point or cone P%d in initial hull\n", id));
-      return;
-    }
-  }
-  qh facet_next= qh facet_list;      /* advance facet when processed */
-  while ((furthest= qh_nextfurthest (&facet))) {
-    qh num_outside--;  /* if ONLYmax, furthest may not be outside */
-    if (!qh_addpoint (furthest, facet, qh ONLYmax))
-      break;
-  }
-  if (qh NARROWhull) /* move points from outsideset to coplanarset */
-    qh_outcoplanar( /* facet_list */ );
-  if (qh num_outside && !furthest) {
-    fprintf (qh ferr, "qhull internal error (qh_buildhull): %d outside points were never processed.\n", qh num_outside);
-    qh_errexit (qh_ERRqhull, NULL, NULL);
-  }
-  trace1((qh ferr, "qh_buildhull: completed the hull construction\n"));
-} /* buildhull */
-  
-
-/*---------------------------------
-  
-  qh_buildtracing( furthest, facet )
-    trace an iteration of qh_buildhull() for furthest point and facet
-    if !furthest, prints progress message
-
-  returns:
-    tracks progress with qh.lastreport
-    updates qh.furthest_id (-3 if furthest is NULL)
-    also resets visit_id, vertext_visit on wrap around
-
-  see:
-    qh_tracemerging()
-
-  design:
-    if !furthest
-      print progress message
-      exit
-    if 'TFn' iteration
-      print progress message
-    else if tracing
-      trace furthest point and facet
-    reset qh.visit_id and qh.vertex_visit if overflow may occur
-    set qh.furthest_id for tracing
-*/
-void qh_buildtracing (pointT *furthest, facetT *facet) {
-  realT dist= 0;
-  float cpu;
-  int total, furthestid;
-  time_t timedata;
-  struct tm *tp;
-  vertexT *vertex;
-
-  qh old_randomdist= qh RANDOMdist;
-  qh RANDOMdist= False;
-  if (!furthest) {
-    time (&timedata);
-    tp= localtime (&timedata);
-    cpu= qh_CPUclock - qh hulltime;
-    cpu /= qh_SECticks;
-    total= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
-    fprintf (qh ferr, "\n\
-At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\
- The current hull contains %d facets and %d vertices.  Last point was p%d\n",
-      tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh facet_id -1,
-      total, qh num_facets, qh num_vertices, qh furthest_id);
-    return;
-  }
-  furthestid= qh_pointid (furthest);
-  if (qh TRACEpoint == furthestid) {
-    qh IStracing= qh TRACElevel;
-    qhmem.IStracing= qh TRACElevel;
-  }else if (qh TRACEpoint != -1 && qh TRACEdist < REALmax/2) {
-    qh IStracing= 0;
-    qhmem.IStracing= 0;
-  }
-  if (qh REPORTfreq && (qh facet_id-1 > qh lastreport+qh REPORTfreq)) {
-    qh lastreport= qh facet_id-1;
-    time (&timedata);
-    tp= localtime (&timedata);
-    cpu= qh_CPUclock - qh hulltime;
-    cpu /= qh_SECticks;
-    total= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
-    zinc_(Zdistio);
-    qh_distplane (furthest, facet, &dist);
-    fprintf (qh ferr, "\n\
-At %02d:%02d:%02d & %2.5g CPU secs, qhull has created %d facets and merged %d.\n\
- The current hull contains %d facets and %d vertices.  There are %d\n\
- outside points.  Next is point p%d (v%d), %2.2g above f%d.\n",
-      tp->tm_hour, tp->tm_min, tp->tm_sec, cpu, qh facet_id -1,
-      total, qh num_facets, qh num_vertices, qh num_outside+1,
-      furthestid, qh vertex_id, dist, getid_(facet));
-  }else if (qh IStracing >=1) {
-    cpu= qh_CPUclock - qh hulltime;
-    cpu /= qh_SECticks;
-    qh_distplane (furthest, facet, &dist);
-    fprintf (qh ferr, "qh_addpoint: add p%d (v%d) to hull of %d facets (%2.2g above f%d) and %d outside at %4.4g CPU secs.  Previous was p%d.\n",
-      furthestid, qh vertex_id, qh num_facets, dist,
-      getid_(facet), qh num_outside+1, cpu, qh furthest_id);
-  }
-  if (qh visit_id > (unsigned) INT_MAX) {
-    qh visit_id= 0;
-    FORALLfacets
-      facet->visitid= qh visit_id;
-  }
-  if (qh vertex_visit > (unsigned) INT_MAX) {
-    qh vertex_visit= 0;
-    FORALLvertices
-      vertex->visitid= qh vertex_visit;
-  }
-  qh furthest_id= furthestid;
-  qh RANDOMdist= qh old_randomdist;
-} /* buildtracing */
-
-/*---------------------------------
-  
-  qh_errexit2( exitcode, facet, otherfacet )
-    return exitcode to system after an error
-    report two facets
-
-  returns:
-    assumes exitcode non-zero
-
-  see:
-    normally use qh_errexit() in user.c (reports a facet and a ridge)
-*/
-void qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet) {
-  
-  qh_errprint("ERRONEOUS", facet, otherfacet, NULL, NULL);
-  qh_errexit (exitcode, NULL, NULL);
-} /* errexit2 */
-
-
-/*---------------------------------
-  
-  qh_findhorizon( point, facet, goodvisible, goodhorizon )
-    given a visible facet, find the point's horizon and visible facets
-    for all facets, !facet-visible
-
-  returns:
-    returns qh.visible_list/num_visible with all visible facets 
-      marks visible facets with ->visible 
-    updates count of good visible and good horizon facets
-    updates qh.max_outside, qh.max_vertex, facet->maxoutside
-
-  see:
-    similar to qh_delpoint()
-
-  design:
-    move facet to qh.visible_list at end of qh.facet_list
-    for all visible facets
-     for each unvisited neighbor of a visible facet
-       compute distance of point to neighbor
-       if point above neighbor
-         move neighbor to end of qh.visible_list
-       else if point is coplanar with neighbor
-         update qh.max_outside, qh.max_vertex, neighbor->maxoutside
-         mark neighbor coplanar (will create a samecycle later)
-         update horizon statistics         
-*/
-void qh_findhorizon(pointT *point, facetT *facet, int *goodvisible, int *goodhorizon) {
-  facetT *neighbor, **neighborp, *visible;
-  int numhorizon= 0, coplanar= 0;
-  realT dist;
-  
-  trace1((qh ferr,"qh_findhorizon: find horizon for point p%d facet f%d\n",qh_pointid(point),facet->id));
-  *goodvisible= *goodhorizon= 0;
-  zinc_(Ztotvisible);
-  qh_removefacet(facet);  /* visible_list at end of qh facet_list */
-  qh_appendfacet(facet);
-  qh num_visible= 1;
-  if (facet->good)
-    (*goodvisible)++;
-  qh visible_list= facet;
-  facet->visible= True;
-  facet->f.replace= NULL;
-  if (qh IStracing >=4)
-    qh_errprint ("visible", facet, NULL, NULL, NULL);
-  qh visit_id++;
-  FORALLvisible_facets {
-    if (visible->tricoplanar && !qh TRInormals) {
-      fprintf (qh ferr, "qh_findhorizon: does not work for tricoplanar facets.  Use option 'Q11'\n");
-      qh_errexit (qh_ERRqhull, visible, NULL);
-    }
-    visible->visitid= qh visit_id;
-    FOREACHneighbor_(visible) {
-      if (neighbor->visitid == qh visit_id) 
-        continue;
-      neighbor->visitid= qh visit_id;
-      zzinc_(Znumvisibility);
-      qh_distplane(point, neighbor, &dist);
-      if (dist > qh MINvisible) {
-        zinc_(Ztotvisible);
-	qh_removefacet(neighbor);  /* append to end of qh visible_list */
-	qh_appendfacet(neighbor);
-	neighbor->visible= True;
-        neighbor->f.replace= NULL;
-	qh num_visible++;
-	if (neighbor->good)
-	  (*goodvisible)++;
-        if (qh IStracing >=4)
-          qh_errprint ("visible", neighbor, NULL, NULL, NULL);
-      }else {
- 	if (dist > - qh MAXcoplanar) {
-    	  neighbor->coplanar= True;
-          zzinc_(Zcoplanarhorizon);
-          qh_precision ("coplanar horizon");
-	  coplanar++;
-	  if (qh MERGING) {
-	    if (dist > 0) {
-	      maximize_(qh max_outside, dist);
-	      maximize_(qh max_vertex, dist);
-#if qh_MAXoutside
-	      maximize_(neighbor->maxoutside, dist);
-#endif
-	    }else
-	      minimize_(qh min_vertex, dist);  /* due to merge later */
-	  }
-      	  trace2((qh ferr, "qh_findhorizon: point p%d is coplanar to horizon f%d, dist=%2.7g < qh MINvisible (%2.7g)\n",
-	      qh_pointid(point), neighbor->id, dist, qh MINvisible));
-	}else
-    	  neighbor->coplanar= False;
-    	zinc_(Ztothorizon);
-        numhorizon++;
-	if (neighbor->good)
-	  (*goodhorizon)++;
-        if (qh IStracing >=4)
-          qh_errprint ("horizon", neighbor, NULL, NULL, NULL);
-      }
-    }
-  }
-  if (!numhorizon) {
-    qh_precision ("empty horizon");
-    fprintf(qh ferr, "qhull precision error (qh_findhorizon): empty horizon\n\
-Point p%d was above all facets.\n", qh_pointid(point));
-    qh_printfacetlist (qh facet_list, NULL, True);
-    qh_errexit(qh_ERRprec, NULL, NULL);
-  }
-  trace1((qh ferr, "qh_findhorizon: %d horizon facets (good %d), %d visible (good %d), %d coplanar\n", 
-       numhorizon, *goodhorizon, qh num_visible, *goodvisible, coplanar));
-  if (qh IStracing >= 4 && qh num_facets < 50) 
-    qh_printlists ();
-} /* findhorizon */
-
-/*---------------------------------
-  
-  qh_nextfurthest( visible )
-    returns next furthest point and visible facet for qh_addpoint()
-    starts search at qh.facet_next
-
-  returns:
-    removes furthest point from outside set
-    NULL if none available
-    advances qh.facet_next over facets with empty outside sets  
-
-  design:
-    for each facet from qh.facet_next
-      if empty outside set
-        advance qh.facet_next
-      else if qh.NARROWhull
-        determine furthest outside point
-        if furthest point is not outside
-          advance qh.facet_next (point will be coplanar)
-    remove furthest point from outside set
-*/
-pointT *qh_nextfurthest (facetT **visible) {
-  facetT *facet;
-  int size, index;
-  realT randr, dist;
-  pointT *furthest;
-
-  while ((facet= qh facet_next) != qh facet_tail) {
-    if (!facet->outsideset) {
-      qh facet_next= facet->next;
-      continue;
-    }
-    SETreturnsize_(facet->outsideset, size);
-    if (!size) {
-      qh_setfree (&facet->outsideset);
-      qh facet_next= facet->next;
-      continue;
-    }
-    if (qh NARROWhull) {
-      if (facet->notfurthest) 
-	qh_furthestout (facet);
-      furthest= (pointT*)qh_setlast (facet->outsideset);
-#if qh_COMPUTEfurthest
-      qh_distplane (furthest, facet, &dist);
-      zinc_(Zcomputefurthest);
-#else
-      dist= facet->furthestdist;
-#endif
-      if (dist < qh MINoutside) { /* remainder of outside set is coplanar for qh_outcoplanar */
-	qh facet_next= facet->next;
-	continue;
-      }
-    }
-    if (!qh RANDOMoutside && !qh VIRTUALmemory) {
-      if (qh PICKfurthest) {
-	qh_furthestnext (/* qh facet_list */);
-	facet= qh facet_next;
-      }
-      *visible= facet;
-      return ((pointT*)qh_setdellast (facet->outsideset));
-    }
-    if (qh RANDOMoutside) {
-      int outcoplanar = 0;
-      if (qh NARROWhull) {
-        FORALLfacets {
-	  if (facet == qh facet_next)
-	    break;
-	  if (facet->outsideset)
-  	    outcoplanar += qh_setsize( facet->outsideset);
-	}
-      }
-      randr= qh_RANDOMint;
-      randr= randr/(qh_RANDOMmax+1);
-      index= (int)floor((qh num_outside - outcoplanar) * randr);
-      FORALLfacet_(qh facet_next) {
-        if (facet->outsideset) {
-          SETreturnsize_(facet->outsideset, size);
-          if (!size)
-            qh_setfree (&facet->outsideset);
-          else if (size > index) {
-            *visible= facet;
-            return ((pointT*)qh_setdelnth (facet->outsideset, index));
-          }else
-            index -= size;
-        }
-      }
-      fprintf (qh ferr, "qhull internal error (qh_nextfurthest): num_outside %d is too low\nby at least %d, or a random real %g >= 1.0\n",
-              qh num_outside, index+1, randr);
-      qh_errexit (qh_ERRqhull, NULL, NULL);
-    }else { /* VIRTUALmemory */
-      facet= qh facet_tail->previous;
-      if (!(furthest= (pointT*)qh_setdellast(facet->outsideset))) {
-        if (facet->outsideset)
-          qh_setfree (&facet->outsideset);
-        qh_removefacet (facet);
-        qh_prependfacet (facet, &qh facet_list);
-        continue;
-      }
-      *visible= facet;
-      return furthest;
-    }
-  }
-  return NULL;
-} /* nextfurthest */
-
-/*---------------------------------
-  
-  qh_partitionall( vertices, points, numpoints )
-    partitions all points in points/numpoints to the outsidesets of facets
-    vertices= vertices in qh.facet_list (not partitioned)
-
-  returns:
-    builds facet->outsideset
-    does not partition qh.GOODpoint
-    if qh.ONLYgood && !qh.MERGING, 
-      does not partition qh.GOODvertex
-
-  notes:
-    faster if qh.facet_list sorted by anticipated size of outside set
-
-  design:
-    initialize pointset with all points
-    remove vertices from pointset
-    remove qh.GOODpointp from pointset (unless it's qh.STOPcone or qh.STOPpoint)
-    for all facets
-      for all remaining points in pointset
-        compute distance from point to facet
-        if point is outside facet
-          remove point from pointset (by not reappending)
-          update bestpoint
-          append point or old bestpoint to facet's outside set
-      append bestpoint to facet's outside set (furthest)
-    for all points remaining in pointset
-      partition point into facets' outside sets and coplanar sets
-*/
-void qh_partitionall(setT *vertices, pointT *points, int numpoints){
-  setT *pointset;
-  vertexT *vertex, **vertexp;
-  pointT *point, **pointp, *bestpoint;
-  int size, point_i, point_n, point_end, remaining, i, id;
-  facetT *facet;
-  realT bestdist= -REALmax, dist, distoutside;
-    
-  trace1((qh ferr, "qh_partitionall: partition all points into outside sets\n"));
-  pointset= qh_settemp (numpoints);
-  qh num_outside= 0;
-  pointp= SETaddr_(pointset, pointT);
-  for (i=numpoints, point= points; i--; point += qh hull_dim)
-    *(pointp++)= point;
-  qh_settruncate (pointset, numpoints);
-  FOREACHvertex_(vertices) {
-    if ((id= qh_pointid(vertex->point)) >= 0)
-      SETelem_(pointset, id)= NULL;
-  }
-  id= qh_pointid (qh GOODpointp);
-  if (id >=0 && qh STOPcone-1 != id && -qh STOPpoint-1 != id)
-    SETelem_(pointset, id)= NULL;
-  if (qh GOODvertexp && qh ONLYgood && !qh MERGING) { /* matches qhull()*/
-    if ((id= qh_pointid(qh GOODvertexp)) >= 0)
-      SETelem_(pointset, id)= NULL;
-  }
-  if (!qh BESToutside) {  /* matches conditional for qh_partitionpoint below */
-    distoutside= qh_DISToutside; /* multiple of qh.MINoutside & qh.max_outside, see user.h */
-    zval_(Ztotpartition)= qh num_points - qh hull_dim - 1; /*misses GOOD... */
-    remaining= qh num_facets;
-    point_end= numpoints;
-    FORALLfacets {
-      size= point_end/(remaining--) + 100;
-      facet->outsideset= qh_setnew (size);
-      bestpoint= NULL;
-      point_end= 0;
-      FOREACHpoint_i_(pointset) {
-        if (point) {
-          zzinc_(Zpartitionall);
-          qh_distplane (point, facet, &dist);
-          if (dist < distoutside)
-            SETelem_(pointset, point_end++)= point;
-          else {
-	    qh num_outside++;
-            if (!bestpoint) {
-              bestpoint= point;
-              bestdist= dist;
-            }else if (dist > bestdist) {
-              qh_setappend (&facet->outsideset, bestpoint);
-              bestpoint= point;
-              bestdist= dist;
-            }else 
-              qh_setappend (&facet->outsideset, point);
-          }
-        }
-      }
-      if (bestpoint) {
-        qh_setappend (&facet->outsideset, bestpoint);
-#if !qh_COMPUTEfurthest
-	facet->furthestdist= bestdist;
-#endif
-      }else
-        qh_setfree (&facet->outsideset);
-      qh_settruncate (pointset, point_end);
-    }
-  }
-  /* if !qh BESToutside, pointset contains points not assigned to outsideset */
-  if (qh BESToutside || qh MERGING || qh KEEPcoplanar || qh KEEPinside) {
-    qh findbestnew= True;
-    FOREACHpoint_i_(pointset) { 
-      if (point)
-        qh_partitionpoint(point, qh facet_list);
-    }
-    qh findbestnew= False;
-  }
-  zzadd_(Zpartitionall, zzval_(Zpartition));
-  zzval_(Zpartition)= 0;
-  qh_settempfree(&pointset);
-  if (qh IStracing >= 4)
-    qh_printfacetlist (qh facet_list, NULL, True);
-} /* partitionall */
-
-
-/*---------------------------------
-  
-  qh_partitioncoplanar( point, facet, dist )
-    partition coplanar point to a facet
-    dist is distance from point to facet
-    if dist NULL, 
-      searches for bestfacet and does nothing if inside
-    if qh.findbestnew set, 
-      searches new facets instead of using qh_findbest()
-
-  returns:
-    qh.max_ouside updated
-    if qh.KEEPcoplanar or qh.KEEPinside
-      point assigned to best coplanarset
-  
-  notes:
-    facet->maxoutside is updated at end by qh_check_maxout
-
-  design:
-    if dist undefined
-      find best facet for point
-      if point sufficiently below facet (depends on qh.NEARinside and qh.KEEPinside)
-        exit
-    if keeping coplanar/nearinside/inside points
-      if point is above furthest coplanar point
-        append point to coplanar set (it is the new furthest)
-        update qh.max_outside
-      else
-        append point one before end of coplanar set
-    else if point is clearly outside of qh.max_outside and bestfacet->coplanarset
-    and bestfacet is more than perpendicular to facet
-      repartition the point using qh_findbest() -- it may be put on an outsideset
-    else
-      update qh.max_outside
-*/
-void qh_partitioncoplanar (pointT *point, facetT *facet, realT *dist) {
-  facetT *bestfacet;
-  pointT *oldfurthest;
-  realT bestdist, dist2, angle;
-  int numpart= 0, oldfindbest;
-  boolT isoutside;
-
-  qh WAScoplanar= True;
-  if (!dist) {
-    if (qh findbestnew)
-      bestfacet= qh_findbestnew (point, facet, &bestdist, qh_ALL, &isoutside, &numpart);
-    else
-      bestfacet= qh_findbest (point, facet, qh_ALL, !qh_ISnewfacets, qh DELAUNAY, 
-                          &bestdist, &isoutside, &numpart);
-    zinc_(Ztotpartcoplanar);
-    zzadd_(Zpartcoplanar, numpart);
-    if (!qh DELAUNAY && !qh KEEPinside) { /*  for 'd', bestdist skips upperDelaunay facets */
-      if (qh KEEPnearinside) {
-        if (bestdist < -qh NEARinside) { 
-          zinc_(Zcoplanarinside);
-	  trace4((qh ferr, "qh_partitioncoplanar: point p%d is more than near-inside facet f%d dist %2.2g findbestnew %d\n",
-		  qh_pointid(point), bestfacet->id, bestdist, qh findbestnew));
-          return;
-        }
-      }else if (bestdist < -qh MAXcoplanar) {
-	  trace4((qh ferr, "qh_partitioncoplanar: point p%d is inside facet f%d dist %2.2g findbestnew %d\n",
-		  qh_pointid(point), bestfacet->id, bestdist, qh findbestnew));
-        zinc_(Zcoplanarinside);
-        return;
-      }
-    }
-  }else {
-    bestfacet= facet;
-    bestdist= *dist;
-  }
-  if (bestdist > qh max_outside) {
-    if (!dist && facet != bestfacet) { 
-      zinc_(Zpartangle);
-      angle= qh_getangle(facet->normal, bestfacet->normal);
-      if (angle < 0) {
-	/* typically due to deleted vertex and coplanar facets, e.g.,
-	     RBOX 1000 s Z1 G1e-13 t1001185205 | QHULL Tv */
-	zinc_(Zpartflip);
-	trace2((qh ferr, "qh_partitioncoplanar: repartition point p%d from f%d.  It is above flipped facet f%d dist %2.2g\n",
-		qh_pointid(point), facet->id, bestfacet->id, bestdist));
-	oldfindbest= qh findbestnew;
-        qh findbestnew= False;
-	qh_partitionpoint(point, bestfacet);
-        qh findbestnew= oldfindbest;
-	return;
-      }
-    }
-    qh max_outside= bestdist;
-    if (bestdist > qh TRACEdist) {
-      fprintf (qh ferr, "qh_partitioncoplanar: ====== p%d from f%d increases max_outside to %2.2g of f%d last p%d\n",
-		     qh_pointid(point), facet->id, bestdist, bestfacet->id, qh furthest_id);
-      qh_errprint ("DISTANT", facet, bestfacet, NULL, NULL);
-    }
-  }
-  if (qh KEEPcoplanar + qh KEEPinside + qh KEEPnearinside) {
-    oldfurthest= (pointT*)qh_setlast (bestfacet->coplanarset);
-    if (oldfurthest) {
-      zinc_(Zcomputefurthest);
-      qh_distplane (oldfurthest, bestfacet, &dist2);
-    }
-    if (!oldfurthest || dist2 < bestdist) 
-      qh_setappend(&bestfacet->coplanarset, point);
-    else 
-      qh_setappend2ndlast(&bestfacet->coplanarset, point);
-  }
-  trace4((qh ferr, "qh_partitioncoplanar: point p%d is coplanar with facet f%d (or inside) dist %2.2g\n",
-	  qh_pointid(point), bestfacet->id, bestdist));
-} /* partitioncoplanar */
-
-/*---------------------------------
-  
-  qh_partitionpoint( point, facet )
-    assigns point to an outside set, coplanar set, or inside set (i.e., dropt)
-    if qh.findbestnew
-      uses qh_findbestnew() to search all new facets
-    else
-      uses qh_findbest()
-  
-  notes:
-    after qh_distplane(), this and qh_findbest() are most expensive in 3-d
-
-  design:
-    find best facet for point 
-      (either exhaustive search of new facets or directed search from facet)
-    if qh.NARROWhull
-      retain coplanar and nearinside points as outside points
-    if point is outside bestfacet
-      if point above furthest point for bestfacet
-        append point to outside set (it becomes the new furthest)
-        if outside set was empty
-          move bestfacet to end of qh.facet_list (i.e., after qh.facet_next)
-        update bestfacet->furthestdist
-      else
-        append point one before end of outside set
-    else if point is coplanar to bestfacet
-      if keeping coplanar points or need to update qh.max_outside
-        partition coplanar point into bestfacet
-    else if near-inside point        
-      partition as coplanar point into bestfacet
-    else is an inside point
-      if keeping inside points 
-        partition as coplanar point into bestfacet
-*/
-void qh_partitionpoint (pointT *point, facetT *facet) {
-  realT bestdist;
-  boolT isoutside;
-  facetT *bestfacet;
-  int numpart;
-#if qh_COMPUTEfurthest
-  realT dist;
-#endif
-
-  if (qh findbestnew)
-    bestfacet= qh_findbestnew (point, facet, &bestdist, qh BESToutside, &isoutside, &numpart);
-  else
-    bestfacet= qh_findbest (point, facet, qh BESToutside, qh_ISnewfacets, !qh_NOupper,
-			  &bestdist, &isoutside, &numpart);
-  zinc_(Ztotpartition);
-  zzadd_(Zpartition, numpart);
-  if (qh NARROWhull) {
-    if (qh DELAUNAY && !isoutside && bestdist >= -qh MAXcoplanar)
-      qh_precision ("nearly incident point (narrow hull)");
-    if (qh KEEPnearinside) {
-      if (bestdist >= -qh NEARinside)
-	isoutside= True;
-    }else if (bestdist >= -qh MAXcoplanar)
-      isoutside= True;
-  }
-
-  if (isoutside) {
-    if (!bestfacet->outsideset 
-    || !qh_setlast (bestfacet->outsideset)) {
-      qh_setappend(&(bestfacet->outsideset), point);
-      if (!bestfacet->newfacet) {
-        qh_removefacet (bestfacet);  /* make sure it's after qh facet_next */
-        qh_appendfacet (bestfacet);
-      }
-#if !qh_COMPUTEfurthest
-      bestfacet->furthestdist= bestdist;
-#endif
-    }else {
-#if qh_COMPUTEfurthest
-      zinc_(Zcomputefurthest);
-      qh_distplane (oldfurthest, bestfacet, &dist);
-      if (dist < bestdist) 
-	qh_setappend(&(bestfacet->outsideset), point);
-      else
-	qh_setappend2ndlast(&(bestfacet->outsideset), point);
-#else
-      if (bestfacet->furthestdist < bestdist) {
-	qh_setappend(&(bestfacet->outsideset), point);
-	bestfacet->furthestdist= bestdist;
-      }else
-	qh_setappend2ndlast(&(bestfacet->outsideset), point);
-#endif
-    }
-    qh num_outside++;
-    trace4((qh ferr, "qh_partitionpoint: point p%d is outside facet f%d new? %d(or narrowhull)\n",
-	  qh_pointid(point), bestfacet->id, bestfacet->newfacet));
-  }else if (qh DELAUNAY || bestdist >= -qh MAXcoplanar) { /* for 'd', bestdist skips upperDelaunay facets */
-    zzinc_(Zcoplanarpart);
-    if (qh DELAUNAY)
-      qh_precision ("nearly incident point");
-    if ((qh KEEPcoplanar + qh KEEPnearinside) || bestdist > qh max_outside) 
-      qh_partitioncoplanar (point, bestfacet, &bestdist);
-    else {
-      trace4((qh ferr, "qh_partitionpoint: point p%d is coplanar to facet f%d (dropped)\n",
-	  qh_pointid(point), bestfacet->id));
-    }
-  }else if (qh KEEPnearinside && bestdist > -qh NEARinside) {
-    zinc_(Zpartnear);
-    qh_partitioncoplanar (point, bestfacet, &bestdist);
-  }else {
-    zinc_(Zpartinside);
-    trace4((qh ferr, "qh_partitionpoint: point p%d is inside all facets, closest to f%d dist %2.2g\n",
-	  qh_pointid(point), bestfacet->id, bestdist));
-    if (qh KEEPinside)
-      qh_partitioncoplanar (point, bestfacet, &bestdist);
-  }
-} /* partitionpoint */
-
-/*---------------------------------
-  
-  qh_partitionvisible( allpoints, numoutside )
-    partitions points in visible facets to qh.newfacet_list
-    qh.visible_list= visible facets
-    for visible facets
-      1st neighbor (if any) points to a horizon facet or a new facet
-    if allpoints (not used),
-      repartitions coplanar points
-
-  returns:
-    updates outside sets and coplanar sets of qh.newfacet_list
-    updates qh.num_outside (count of outside points)
-  
-  notes:
-    qh.findbest_notsharp should be clear (extra work if set)
-
-  design:
-    for all visible facets with outside set or coplanar set
-      select a newfacet for visible facet
-      if outside set
-        partition outside set into new facets
-      if coplanar set and keeping coplanar/near-inside/inside points
-        if allpoints
-          partition coplanar set into new facets, may be assigned outside
-        else
-          partition coplanar set into coplanar sets of new facets
-    for each deleted vertex
-      if allpoints
-        partition vertex into new facets, may be assigned outside
-      else
-        partition vertex into coplanar sets of new facets
-*/
-void qh_partitionvisible(/*visible_list*/ boolT allpoints, int *numoutside) {
-  facetT *visible, *newfacet;
-  pointT *point, **pointp;
-  int coplanar=0, size;
-  unsigned count;
-  vertexT *vertex, **vertexp;
-  
-  if (qh ONLYmax)
-    maximize_(qh MINoutside, qh max_vertex);
-  *numoutside= 0;
-  FORALLvisible_facets {
-    if (!visible->outsideset && !visible->coplanarset)
-      continue;
-    newfacet= visible->f.replace;
-    count= 0;
-    while (newfacet && newfacet->visible) {
-      newfacet= newfacet->f.replace;
-      if (count++ > qh facet_id)
-	qh_infiniteloop (visible);
-    }
-    if (!newfacet)
-      newfacet= qh newfacet_list;
-    if (newfacet == qh facet_tail) {
-      fprintf (qh ferr, "qhull precision error (qh_partitionvisible): all new facets deleted as\n        degenerate facets. Can not continue.\n");
-      qh_errexit (qh_ERRprec, NULL, NULL);
-    }
-    if (visible->outsideset) {
-      size= qh_setsize (visible->outsideset);
-      *numoutside += size;
-      qh num_outside -= size;
-      FOREACHpoint_(visible->outsideset) 
-        qh_partitionpoint (point, newfacet);
-    }
-    if (visible->coplanarset && (qh KEEPcoplanar + qh KEEPinside + qh KEEPnearinside)) {
-      size= qh_setsize (visible->coplanarset);
-      coplanar += size;
-      FOREACHpoint_(visible->coplanarset) {
-        if (allpoints) /* not used */
-          qh_partitionpoint (point, newfacet);
-        else
-          qh_partitioncoplanar (point, newfacet, NULL);
-      }
-    }
-  }
-  FOREACHvertex_(qh del_vertices) {
-    if (vertex->point) {
-      if (allpoints) /* not used */
-        qh_partitionpoint (vertex->point, qh newfacet_list);
-      else
-        qh_partitioncoplanar (vertex->point, qh newfacet_list, NULL);
-    }
-  }
-  trace1((qh ferr,"qh_partitionvisible: partitioned %d points from outsidesets and %d points from coplanarsets\n", *numoutside, coplanar));
-} /* partitionvisible */
-
-
-
-/*---------------------------------
-  
-  qh_precision( reason )
-    restart on precision errors if not merging and if 'QJn'
-*/
-void qh_precision (char *reason) {
-
-  if (qh ALLOWrestart && !qh PREmerge && !qh MERGEexact) {
-    if (qh JOGGLEmax < REALmax/2) {
-      trace0((qh ferr, "qh_precision: qhull restart because of %s\n", reason));
-      longjmp(qh restartexit, qh_ERRprec);
-    }
-  }
-} /* qh_precision */
-
-/*---------------------------------
-  
-  qh_printsummary( fp )
-    prints summary to fp
-
-  notes:
-    not in io.c so that user_eg.c can prevent io.c from loading
-    qh_printsummary and qh_countfacets must match counts
-
-  design:
-    determine number of points, vertices, and coplanar points
-    print summary
-*/
-void qh_printsummary(FILE *fp) {
-  realT ratio, outerplane, innerplane;
-  float cpu;
-  int size, id, nummerged, numvertices, numcoplanars= 0, nonsimplicial=0;
-  int goodused;
-  facetT *facet;
-  char *s;
-  int numdel= zzval_(Zdelvertextot);
-  int numtricoplanars= 0;
-
-  size= qh num_points + qh_setsize (qh other_points);
-  numvertices= qh num_vertices - qh_setsize (qh del_vertices);
-  id= qh_pointid (qh GOODpointp);
-  FORALLfacets {
-    if (facet->coplanarset)
-      numcoplanars += qh_setsize( facet->coplanarset);
-    if (facet->good) {
-      if (facet->simplicial) {
-	if (facet->keepcentrum && facet->tricoplanar)
-	  numtricoplanars++;
-      }else if (qh_setsize(facet->vertices) != qh hull_dim)
-	nonsimplicial++;
-    }
-  }
-  if (id >=0 && qh STOPcone-1 != id && -qh STOPpoint-1 != id)
-    size--;
-  if (qh STOPcone || qh STOPpoint)
-      fprintf (fp, "\nAt a premature exit due to 'TVn', 'TCn', 'TRn', or precision error.");
-  if (qh UPPERdelaunay)
-    goodused= qh GOODvertex + qh GOODpoint + qh SPLITthresholds;
-  else if (qh DELAUNAY)
-    goodused= qh GOODvertex + qh GOODpoint + qh GOODthreshold;
-  else
-    goodused= qh num_good;
-  nummerged= zzval_(Ztotmerge) - zzval_(Zcyclehorizon) + zzval_(Zcyclefacettot);
-  if (qh VORONOI) {
-    if (qh UPPERdelaunay)
-      fprintf (fp, "\n\
-Furthest-site Voronoi vertices by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    else
-      fprintf (fp, "\n\
-Voronoi diagram by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    fprintf(fp, "  Number of Voronoi regions%s: %d\n",
-              qh ATinfinity ? " and at-infinity" : "", numvertices);
-    if (numdel)
-      fprintf(fp, "  Total number of deleted points due to merging: %d\n", numdel); 
-    if (numcoplanars - numdel > 0) 
-      fprintf(fp, "  Number of nearly incident points: %d\n", numcoplanars - numdel); 
-    else if (size - numvertices - numdel > 0) 
-      fprintf(fp, "  Total number of nearly incident points: %d\n", size - numvertices - numdel); 
-    fprintf(fp, "  Number of%s Voronoi vertices: %d\n", 
-              goodused ? " 'good'" : "", qh num_good);
-    if (nonsimplicial) 
-      fprintf(fp, "  Number of%s non-simplicial Voronoi vertices: %d\n", 
-              goodused ? " 'good'" : "", nonsimplicial);
-  }else if (qh DELAUNAY) {
-    if (qh UPPERdelaunay)
-      fprintf (fp, "\n\
-Furthest-site Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    else
-      fprintf (fp, "\n\
-Delaunay triangulation by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    fprintf(fp, "  Number of input sites%s: %d\n", 
-              qh ATinfinity ? " and at-infinity" : "", numvertices);
-    if (numdel)
-      fprintf(fp, "  Total number of deleted points due to merging: %d\n", numdel); 
-    if (numcoplanars - numdel > 0) 
-      fprintf(fp, "  Number of nearly incident points: %d\n", numcoplanars - numdel); 
-    else if (size - numvertices - numdel > 0)
-      fprintf(fp, "  Total number of nearly incident points: %d\n", size - numvertices - numdel); 
-    fprintf(fp, "  Number of%s Delaunay regions: %d\n", 
-              goodused ? " 'good'" : "", qh num_good);
-    if (nonsimplicial) 
-      fprintf(fp, "  Number of%s non-simplicial Delaunay regions: %d\n", 
-              goodused ? " 'good'" : "", nonsimplicial);
-  }else if (qh HALFspace) {
-    fprintf (fp, "\n\
-Halfspace intersection by the convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    fprintf(fp, "  Number of halfspaces: %d\n", size);
-    fprintf(fp, "  Number of non-redundant halfspaces: %d\n", numvertices);
-    if (numcoplanars) {
-      if (qh KEEPinside && qh KEEPcoplanar)
-      	s= "similar and redundant";
-      else if (qh KEEPinside)
-        s= "redundant";
-      else
-        s= "similar"; 
-      fprintf(fp, "  Number of %s halfspaces: %d\n", s, numcoplanars);
-    } 
-    fprintf(fp, "  Number of intersection points: %d\n", qh num_facets - qh num_visible);
-    if (goodused)
-      fprintf(fp, "  Number of 'good' intersection points: %d\n", qh num_good);
-    if (nonsimplicial) 
-      fprintf(fp, "  Number of%s non-simplicial intersection points: %d\n", 
-              goodused ? " 'good'" : "", nonsimplicial);
-  }else {
-    fprintf (fp, "\n\
-Convex hull of %d points in %d-d:\n\n", size, qh hull_dim);
-    fprintf(fp, "  Number of vertices: %d\n", numvertices);
-    if (numcoplanars) {
-      if (qh KEEPinside && qh KEEPcoplanar)
-      	s= "coplanar and interior";
-      else if (qh KEEPinside)
-        s= "interior";
-      else
-        s= "coplanar"; 
-      fprintf(fp, "  Number of %s points: %d\n", s, numcoplanars);
-    } 
-    fprintf(fp, "  Number of facets: %d\n", qh num_facets - qh num_visible);
-    if (goodused)
-      fprintf(fp, "  Number of 'good' facets: %d\n", qh num_good);
-    if (nonsimplicial) 
-      fprintf(fp, "  Number of%s non-simplicial facets: %d\n", 
-              goodused ? " 'good'" : "", nonsimplicial);
-  }
-  if (numtricoplanars)
-      fprintf(fp, "  Number of triangulated facets: %d\n", numtricoplanars);
-  fprintf(fp, "\nStatistics for: %s | %s", 
-                      qh rbox_command, qh qhull_command);
-  if (qh ROTATErandom != INT_MIN)
-    fprintf(fp, " QR%d\n\n", qh ROTATErandom);
-  else
-    fprintf(fp, "\n\n");
-  fprintf(fp, "  Number of points processed: %d\n", zzval_(Zprocessed));
-  fprintf(fp, "  Number of hyperplanes created: %d\n", zzval_(Zsetplane));
-  if (qh DELAUNAY)
-    fprintf(fp, "  Number of facets in hull: %d\n", qh num_facets - qh num_visible);
-  fprintf(fp, "  Number of distance tests for qhull: %d\n", zzval_(Zpartition)+
-      zzval_(Zpartitionall)+zzval_(Znumvisibility)+zzval_(Zpartcoplanar));
-#if 0  /* NOTE: must print before printstatistics() */
-  {realT stddev, ave;
-  fprintf(fp, "  average new facet balance: %2.2g\n",
-	  wval_(Wnewbalance)/zval_(Zprocessed));
-  stddev= qh_stddev (zval_(Zprocessed), wval_(Wnewbalance), 
-                                 wval_(Wnewbalance2), &ave);
-  fprintf(fp, "  new facet standard deviation: %2.2g\n", stddev);
-  fprintf(fp, "  average partition balance: %2.2g\n",
-	  wval_(Wpbalance)/zval_(Zpbalance));
-  stddev= qh_stddev (zval_(Zpbalance), wval_(Wpbalance), 
-                                 wval_(Wpbalance2), &ave);
-  fprintf(fp, "  partition standard deviation: %2.2g\n", stddev);
-  }
-#endif
-  if (nummerged) {
-    fprintf(fp,"  Number of distance tests for merging: %d\n",zzval_(Zbestdist)+
-          zzval_(Zcentrumtests)+zzval_(Zdistconvex)+zzval_(Zdistcheck)+
-          zzval_(Zdistzero));
-    fprintf(fp,"  Number of distance tests for checking: %d\n",zzval_(Zcheckpart));
-    fprintf(fp,"  Number of merged facets: %d\n", nummerged);
-  }
-  if (!qh RANDOMoutside && qh QHULLfinished) {
-    cpu= qh hulltime;
-    cpu /= qh_SECticks;
-    wval_(Wcpu)= cpu;
-    fprintf (fp, "  CPU seconds to compute hull (after input): %2.4g\n", cpu);
-  }
-  if (qh RERUN) {
-    if (!qh PREmerge && !qh MERGEexact)
-      fprintf(fp, "  Percentage of runs with precision errors: %4.1f\n",
-	   zzval_(Zretry)*100.0/qh build_cnt);  /* careful of order */
-  }else if (qh JOGGLEmax < REALmax/2) {
-    if (zzval_(Zretry))
-      fprintf(fp, "  After %d retries, input joggled by: %2.2g\n",
-         zzval_(Zretry), qh JOGGLEmax);
-    else
-      fprintf(fp, "  Input joggled by: %2.2g\n", qh JOGGLEmax);
-  }
-  if (qh totarea != 0.0) 
-    fprintf(fp, "  %s facet area:   %2.8g\n", 
-	    zzval_(Ztotmerge) ? "Approximate" : "Total", qh totarea);
-  if (qh totvol != 0.0) 
-    fprintf(fp, "  %s volume:       %2.8g\n", 
-	    zzval_(Ztotmerge) ? "Approximate" : "Total", qh totvol);
-  if (qh MERGING) {
-    qh_outerinner (NULL, &outerplane, &innerplane);
-    if (outerplane > 2 * qh DISTround) {
-      fprintf(fp, "  Maximum distance of %spoint above facet: %2.2g", 
-	    (qh QHULLfinished ? "" : "merged "), outerplane);
-      ratio= outerplane/(qh ONEmerge + qh DISTround);
-      /* don't report ratio if MINoutside is large */
-      if (ratio > 0.05 && 2* qh ONEmerge > qh MINoutside && qh JOGGLEmax > REALmax/2)
-        fprintf (fp, " (%.1fx)\n", ratio);
-      else
-        fprintf (fp, "\n");
-    }
-    if (innerplane < -2 * qh DISTround) {
-      fprintf(fp, "  Maximum distance of %svertex below facet: %2.2g", 
-	    (qh QHULLfinished ? "" : "merged "), innerplane);
-      ratio= -innerplane/(qh ONEmerge+qh DISTround);
-      if (ratio > 0.05 && qh JOGGLEmax > REALmax/2)
-        fprintf (fp, " (%.1fx)\n", ratio);
-      else
-        fprintf (fp, "\n");
-    }
-  }
-  fprintf(fp, "\n");
-} /* printsummary */
-
-

Modified: trunk/scipy/spatial/qhull/src/qhull.h
===================================================================
--- trunk/scipy/spatial/qhull/src/qhull.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qhull.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -2,1029 +2,17 @@
   >--------------------------------
 
    qhull.h
-   user-level header file for using qhull.a library
 
-   see qh-qhull.htm, qhull_a.h
+   Proxy for libqhull.h for backwards compatability
 
-   copyright (c) 1993-2003, The Geometry Center
-
-   NOTE: access to qh_qh is via the 'qh' macro.  This allows
-   qh_qh to be either a pointer or a structure.  An example
-   of using qh is "qh DROPdim" which accesses the DROPdim
-   field of qh_qh.  Similarly, access to qh_qhstat is via
-   the 'qhstat' macro.
-
-   includes function prototypes for qhull.c, geom.c, global.c, io.c, user.c
-
-   use mem.h for mem.c
-   use qset.h for qset.c
-
-   see unix.c for an example of using qhull.h
-
-   recompile qhull if you change this file
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/qhull.h#51 $$Change: 1188 $
+   $DateTime: 2010/01/14 22:35:43 $$Author: bbarber $
 */
 
 #ifndef qhDEFqhull
 #define qhDEFqhull 1
 
-/*=========================== -included files ==============*/
+#include "libqhull.h"
 
-#include 
-#include 
-#include 
-
-#if __MWERKS__ && __POWERPC__
-#include  
-#include  
-#include	
-#endif
-
-#ifndef __STDC__
-#ifndef __cplusplus
-#if     !_MSC_VER
-#error  Neither __STDC__ nor __cplusplus is defined.  Please use strict ANSI C or C++ to compile
-#error  Qhull.  You may need to turn off compiler extensions in your project configuration.  If
-#error  your compiler is a standard C compiler, you can delete this warning from qhull.h
-#endif
-#endif
-#endif
-
-#include "user.h"      /* user defineable constants */
-
-/*============ constants and basic types ====================*/
-
-extern char *qh_version; /* defined in global.c */
-
-/*----------------------------------
-
-  coordT
-    coordinates and coefficients are stored as realT (i.e., double)
-
-  notes:
-    could use 'float' for data and 'double' for calculations (realT vs. coordT)
-      This requires many type casts, and adjusted error bounds.
-      Also C compilers may do expressions in double anyway.
-*/
-#define coordT realT
-
-/*----------------------------------
-
-  pointT
-    a point is an array of DIM3 coordinates
-*/
-#define pointT coordT
-
-/*----------------------------------
-
-  flagT
-    Boolean flag as a bit
-*/
-#define flagT unsigned int
-
-/*----------------------------------
-
-  boolT
-    boolean value, either True or False
-
-  notes:
-    needed for portability
-*/
-#define boolT unsigned int
-#ifdef False
-#undef False
-#endif
-#ifdef True
-#undef True
-#endif
-#define False 0
-#define True 1
-
-/*----------------------------------
-
-  qh_CENTER
-    to distinguish facet->center
-*/
-typedef enum
-{
-    qh_ASnone = 0, qh_ASvoronoi, qh_AScentrum
-}
-qh_CENTER;
-
-/*----------------------------------
-
-  qh_PRINT
-    output formats for printing (qh.PRINTout).
-    'Fa' 'FV' 'Fc' 'FC' 
-       
-
-   notes:
-   some of these names are similar to qh names.  The similar names are only
-   used in switch statements in qh_printbegin() etc.
-*/
-typedef enum {qh_PRINTnone= 0, 
-  qh_PRINTarea, qh_PRINTaverage,           /* 'Fa' 'FV' 'Fc' 'FC' */
-  qh_PRINTcoplanars, qh_PRINTcentrums, 
-  qh_PRINTfacets, qh_PRINTfacets_xridge,   /* 'f' 'FF' 'G' 'FI' 'Fi' 'Fn' */
-  qh_PRINTgeom, qh_PRINTids, qh_PRINTinner, qh_PRINTneighbors, 
-  qh_PRINTnormals, qh_PRINTouter, qh_PRINTmaple, /* 'n' 'Fo' 'i' 'm' 'Fm' 'FM', 'o' */
-  qh_PRINTincidences, qh_PRINTmathematica, qh_PRINTmerges, qh_PRINToff, 
-  qh_PRINToptions, qh_PRINTpointintersect, /* 'FO' 'Fp' 'FP' 'p' 'FQ' 'FS' */
-  qh_PRINTpointnearest, qh_PRINTpoints, qh_PRINTqhull, qh_PRINTsize, 
-  qh_PRINTsummary, qh_PRINTtriangles,      /* 'Fs' 'Ft' 'Fv' 'FN' 'Fx' */
-  qh_PRINTvertices, qh_PRINTvneighbors, qh_PRINTextremes,
-  qh_PRINTEND} qh_PRINT;
-
-/*----------------------------------
-
-  qh_ALL
-    argument flag for selecting everything
-*/
-#define qh_ALL      True
-#define qh_NOupper  True     /* argument for qh_findbest */
-#define qh_IScheckmax  True     /* argument for qh_findbesthorizon */
-#define qh_ISnewfacets  True     /* argument for qh_findbest */
-#define qh_RESETvisible  True     /* argument for qh_resetlists */
-
-/*----------------------------------
-
-  qh_ERR
-    Qhull exit codes, for indicating errors
-*/
-#define qh_ERRnone  0    /* no error occurred during qhull */
-#define qh_ERRinput 1    /* input inconsistency */
-#define qh_ERRsingular 2 /* singular input data */
-#define qh_ERRprec  3    /* precision error */
-#define qh_ERRmem   4    /* insufficient memory, matches mem.h */
-#define qh_ERRqhull 5    /* internal error detected, matches mem.h */
-
-/* ============ -structures- ====================
-   each of the following structures is defined by a typedef
-   all realT and coordT fields occur at the beginning of a structure
-        (otherwise space may be wasted due to alignment)
-   define all flags together and pack into 32-bit number
-*/
-
-typedef struct vertexT vertexT;
-typedef struct ridgeT ridgeT;
-typedef struct facetT facetT;
-#ifndef DEFsetT
-#define DEFsetT 1
-typedef struct setT setT;          /* defined in qset.h */
-#endif
-
-/*----------------------------------
-
-  facetT
-    defines a facet
-
-  notes:
-   qhull() generates the hull as a list of facets.
-
-  topological information:
-    f.previous,next     doubly-linked list of facets
-    f.vertices          set of vertices
-    f.ridges            set of ridges
-    f.neighbors         set of neighbors
-    f.toporient         True if facet has top-orientation (else bottom)
-
-  geometric information:
-    f.offset,normal     hyperplane equation
-    f.maxoutside        offset to outer plane -- all points inside
-    f.center            centrum for testing convexity
-    f.simplicial        True if facet is simplicial
-    f.flipped           True if facet does not include qh.interior_point
-
-  for constructing hull:
-    f.visible           True if facet on list of visible facets (will be deleted)
-    f.newfacet          True if facet on list of newly created facets
-    f.coplanarset       set of points coplanar with this facet
-                        (includes near-inside points for later testing)
-    f.outsideset        set of points outside of this facet
-    f.furthestdist      distance to furthest point of outside set
-    f.visitid           marks visited facets during a loop
-    f.replace           replacement facet for to-be-deleted, visible facets
-    f.samecycle,newcycle cycle of facets for merging into horizon facet
-
-  see below for other flags and fields
-*/
-struct facetT {
-#if !qh_COMPUTEfurthest
-  coordT   furthestdist;/* distance to furthest point of outsideset */
-#endif
-#if qh_MAXoutside
-  coordT   maxoutside;  /* max computed distance of point to facet
-  			Before QHULLfinished this is an approximation
-  			since maxdist not always set for mergefacet
-			Actual outer plane is +DISTround and
-			computed outer plane is +2*DISTround */
-#endif
-  coordT   offset;      /* exact offset of hyperplane from origin */
-  coordT  *normal;      /* normal of hyperplane, hull_dim coefficients */
-			/*   if tricoplanar, shared with a neighbor */
-  union {               /* in order of testing */
-   realT   area;        /* area of facet, only in io.c if  ->isarea */
-   facetT *replace;	/*  replacement facet if ->visible and NEWfacets
-  			     is NULL only if qh_mergedegen_redundant or interior */
-   facetT *samecycle;   /*  cycle of facets from the same visible/horizon intersection,
-   			     if ->newfacet */
-   facetT *newcycle;    /*  in horizon facet, current samecycle of new facets */ 
-   facetT *trivisible;  /* visible facet for ->tricoplanar facets during qh_triangulate() */
-   facetT *triowner;    /* owner facet for ->tricoplanar, !isarea facets w/ ->keepcentrum */
-  }f;
-  coordT  *center;      /*  centrum for convexity, qh CENTERtype == qh_AScentrum */
-      			/*  Voronoi center, qh CENTERtype == qh_ASvoronoi */
-			/*   if tricoplanar, shared with a neighbor */
-  facetT  *previous;    /* previous facet in the facet_list */
-  facetT  *next;        /* next facet in the facet_list */
-  setT    *vertices;    /* vertices for this facet, inverse sorted by ID 
-                           if simplicial, 1st vertex was apex/furthest */
-  setT    *ridges;      /* explicit ridges for nonsimplicial facets.
-  			   for simplicial facets, neighbors defines ridge */
-  setT    *neighbors;   /* neighbors of the facet.  If simplicial, the kth
-			   neighbor is opposite the kth vertex, and the first
-			   neighbor is the horizon facet for the first vertex*/
-  setT    *outsideset;  /* set of points outside this facet
-		           if non-empty, last point is furthest
-			   if NARROWhull, includes coplanars for partitioning*/
-  setT    *coplanarset; /* set of points coplanar with this facet
-  			   > qh.min_vertex and <= facet->max_outside
-                           a point is assigned to the furthest facet
-		           if non-empty, last point is furthest away */
-  unsigned visitid;     /* visit_id, for visiting all neighbors,
-			   all uses are independent */
-  unsigned id;	        /* unique identifier from qh facet_id */
-  unsigned nummerge:9;  /* number of merges */
-#define qh_MAXnummerge 511 /*     2^9-1, 32 flags total, see "flags:" in io.c */
-  flagT    tricoplanar:1; /* True if TRIangulate and simplicial and coplanar with a neighbor */
-			  /*   all tricoplanars share the same ->center, ->normal, ->offset, ->maxoutside */
-			  /*   all tricoplanars share the same apex */
-                          /*   if ->degenerate, does not span facet (one logical ridge) */
-                          /*   one tricoplanar has ->keepcentrum and ->coplanarset */
-                          /*   during qh_triangulate, f.trivisible points to original facet */
-  flagT	   newfacet:1;  /* True if facet on qh newfacet_list (new or merged) */
-  flagT	   visible:1;   /* True if visible facet (will be deleted) */
-  flagT    toporient:1; /* True if created with top orientation
-			   after merging, use ridge orientation */
-  flagT    simplicial:1;/* True if simplicial facet, ->ridges may be implicit */
-  flagT    seen:1;      /* used to perform operations only once, like visitid */
-  flagT    seen2:1;     /* used to perform operations only once, like visitid */
-  flagT	   flipped:1;   /* True if facet is flipped */
-  flagT    upperdelaunay:1; /* True if facet is upper envelope of Delaunay triangulation */
-  flagT    notfurthest:1; /* True if last point of outsideset is not furthest*/
-
-/*-------- flags primarily for output ---------*/
-  flagT	   good:1;      /* True if a facet marked good for output */
-  flagT    isarea:1;    /* True if facet->f.area is defined */
-
-/*-------- flags for merging ------------------*/
-  flagT    dupridge:1;  /* True if duplicate ridge in facet */
-  flagT    mergeridge:1; /* True if facet or neighbor contains a qh_MERGEridge
-                            ->normal defined (also defined for mergeridge2) */
-  flagT    mergeridge2:1; /* True if neighbor contains a qh_MERGEridge (mark_dupridges */
-  flagT    coplanar:1;  /* True if horizon facet is coplanar at last use */
-  flagT     mergehorizon:1; /* True if will merge into horizon (->coplanar) */
-  flagT	    cycledone:1;/* True if mergecycle_all already done */
-  flagT    tested:1;    /* True if facet convexity has been tested (false after merge */
-  flagT    keepcentrum:1; /* True if keep old centrum after a merge, or marks owner for ->tricoplanar */
-  flagT	   newmerge:1;  /* True if facet is newly merged for reducevertices */
-  flagT	   degenerate:1; /* True if facet is degenerate (degen_mergeset or ->tricoplanar) */
-  flagT	   redundant:1;  /* True if facet is redundant (degen_mergeset) */
-};
-
-
-/*----------------------------------
-
-  ridgeT
-    defines a ridge
-
-  notes:
-  a ridge is DIM3-1 simplex between two neighboring facets.  If the
-  facets are non-simplicial, there may be more than one ridge between
-  two facets.  E.G. a 4-d hypercube has two triangles between each pair
-  of neighboring facets.
-
-  topological information:
-    vertices            a set of vertices
-    top,bottom          neighboring facets with orientation
-
-  geometric information:
-    tested              True if ridge is clearly convex
-    nonconvex           True if ridge is non-convex
-*/
-struct ridgeT {
-  setT    *vertices;    /* vertices belonging to this ridge, inverse sorted by ID 
-                           NULL if a degen ridge (matchsame) */
-  facetT  *top;         /* top facet this ridge is part of */
-  facetT  *bottom;      /* bottom facet this ridge is part of */
-  unsigned id:24;       /* unique identifier, =>room for 8 flags */
-  flagT    seen:1;      /* used to perform operations only once */
-  flagT    tested:1;    /* True when ridge is tested for convexity */
-  flagT    nonconvex:1; /* True if getmergeset detected a non-convex neighbor
-			   only one ridge between neighbors may have nonconvex */
-};
-
-/*----------------------------------
-
-  vertexT
-     defines a vertex
-
-  topological information:
-    next,previous       doubly-linked list of all vertices
-    neighbors           set of adjacent facets (only if qh.VERTEXneighbors)
-
-  geometric information:
-    point               array of DIM3 coordinates
-*/
-struct vertexT {
-  vertexT *next;        /* next vertex in vertex_list */
-  vertexT *previous;    /* previous vertex in vertex_list */
-  pointT  *point;       /* hull_dim coordinates (coordT) */
-  setT    *neighbors;   /* neighboring facets of vertex, qh_vertexneighbors()
-			   inits in io.c or after first merge */
-  unsigned visitid; /* for use with qh vertex_visit */
-  unsigned id:24;   /* unique identifier, =>room for 8 flags */
-  flagT    seen:1;      /* used to perform operations only once */
-  flagT    seen2:1;     /* another seen flag */
-  flagT    delridge:1;  /* vertex was part of a deleted ridge */
-  flagT	   deleted:1;   /* true if vertex on qh del_vertices */
-  flagT    newlist:1;   /* true if vertex on qh newvertex_list */
-};
-
-/*======= -global variables -qh ============================*/
-
-/*----------------------------------
-
-  qh
-   all global variables for qhull are in qh, qhmem, and qhstat
-
-  notes:
-   qhmem is defined in mem.h and qhstat is defined in stat.h
-   Access to qh_qh is via the "qh" macro.  See qh_QHpointer in user.h
-*/
-typedef struct qhT qhT;
-#if qh_QHpointer
-#define qh qh_qh->
-extern qhT *qh_qh;     /* allocated in global.c */
-#else
-#define qh qh_qh.
-extern qhT qh_qh;
-#endif
-
-struct qhT {
-
-/*----------------------------------
-
-  qh constants
-    configuration flags and constants for Qhull
-
-  notes:
-    The user configures Qhull by defining flags.  They are
-    copied into qh by qh_setflags().  qh-quick.htm#options defines the flags.
-*/
-  boolT ALLpoints;        /* true 'Qs' if search all points for initial simplex */
-  boolT ANGLEmerge;	  /* true 'Qa' if sort potential merges by angle */
-  boolT APPROXhull;       /* true 'Wn' if MINoutside set */
-  realT MINoutside;       /*   'Wn' min. distance for an outside point */
-  boolT ATinfinity;       /* true 'Qz' if point num_points-1 is "at-infinity"
-                             for improving precision in Delaunay triangulations */
-  boolT AVOIDold;         /* true 'Q4' if avoid old->new merges */
-  boolT BESToutside;      /* true 'Qf' if partition points into best outsideset */
-  boolT CDDinput;         /* true 'Pc' if input uses CDD format (1.0/offset first) */
-  boolT CDDoutput;        /* true 'PC' if print normals in CDD format (offset first) */
-  boolT CHECKfrequently;  /* true 'Tc' if checking frequently */
-  realT premerge_cos;     /*   'A-n'   cos_max when pre merging */
-  realT postmerge_cos;    /*   'An'    cos_max when post merging */
-  boolT DELAUNAY;         /* true 'd' if computing DELAUNAY triangulation */
-  boolT DOintersections;  /* true 'Gh' if print hyperplane intersections */
-  int   DROPdim;          /* drops dim 'GDn' for 4-d -> 3-d output */
-  boolT FORCEoutput;      /* true 'Po' if forcing output despite degeneracies */
-  int   GOODpoint;        /* 1+n for 'QGn', good facet if visible/not(-) from point n*/
-  pointT *GOODpointp;     /*   the actual point */
-  boolT GOODthreshold;    /* true if qh lower_threshold/upper_threshold defined
-  			     false if qh SPLITthreshold */
-  int   GOODvertex;       /* 1+n, good facet if vertex for point n */
-  pointT *GOODvertexp;     /*   the actual point */
-  boolT HALFspace;        /* true 'Hn,n,n' if halfspace intersection */
-  int   IStracing;        /* trace execution, 0=none, 1=least, 4=most, -1=events */
-  int   KEEParea;         /* 'PAn' number of largest facets to keep */
-  boolT KEEPcoplanar;     /* true 'Qc' if keeping nearest facet for coplanar points */
-  boolT KEEPinside;       /* true 'Qi' if keeping nearest facet for inside points
-			      set automatically if 'd Qc' */
-  int   KEEPmerge;        /* 'PMn' number of facets to keep with most merges */
-  realT KEEPminArea;      /* 'PFn' minimum facet area to keep */
-  realT MAXcoplanar;      /* 'Un' max distance below a facet to be coplanar*/
-  boolT MERGEexact;	  /* true 'Qx' if exact merges (coplanar, degen, dupridge, flipped) */
-  boolT MERGEindependent; /* true 'Q2' if merging independent sets */
-  boolT MERGING;          /* true if exact-, pre- or post-merging, with angle and centrum tests */
-  realT   premerge_centrum;  /*   'C-n' centrum_radius when pre merging.  Default is round-off */
-  realT   postmerge_centrum; /*   'Cn' centrum_radius when post merging.  Default is round-off */
-  boolT MERGEvertices;	  /* true 'Q3' if merging redundant vertices */
-  realT MINvisible;       /* 'Vn' min. distance for a facet to be visible */
-  boolT NOnarrow;         /* true 'Q10' if no special processing for narrow distributions */
-  boolT NOnearinside;     /* true 'Q8' if ignore near-inside points when partitioning */
-  boolT NOpremerge;       /* true 'Q0' if no defaults for C-0 or Qx */
-  boolT ONLYgood; 	  /* true 'Qg' if process points with good visible or horizon facets */
-  boolT ONLYmax; 	  /* true 'Qm' if only process points that increase max_outside */
-  boolT PICKfurthest;     /* true 'Q9' if process furthest of furthest points*/
-  boolT POSTmerge;        /* true if merging after buildhull (Cn or An) */
-  boolT PREmerge;         /* true if merging during buildhull (C-n or A-n) */
-  			/* NOTE: some of these names are similar to qh_PRINT names */
-  boolT PRINTcentrums;	  /* true 'Gc' if printing centrums */
-  boolT PRINTcoplanar;    /* true 'Gp' if printing coplanar points */
-  int	PRINTdim;      	  /* print dimension for Geomview output */
-  boolT PRINTdots;        /* true 'Ga' if printing all points as dots */
-  boolT PRINTgood;        /* true 'Pg' if printing good facets */
-  boolT PRINTinner;	  /* true 'Gi' if printing inner planes */
-  boolT PRINTneighbors;	  /* true 'PG' if printing neighbors of good facets */
-  boolT PRINTnoplanes;	  /* true 'Gn' if printing no planes */
-  boolT PRINToptions1st;  /* true 'FO' if printing options to stderr */
-  boolT PRINTouter;	  /* true 'Go' if printing outer planes */
-  boolT PRINTprecision;   /* false 'Pp' if not reporting precision problems */
-  qh_PRINT PRINTout[qh_PRINTEND]; /* list of output formats to print */
-  boolT PRINTridges;      /* true 'Gr' if print ridges */
-  boolT PRINTspheres;     /* true 'Gv' if print vertices as spheres */
-  boolT PRINTstatistics;  /* true 'Ts' if printing statistics to stderr */
-  boolT PRINTsummary;     /* true 's' if printing summary to stderr */
-  boolT PRINTtransparent; /* true 'Gt' if print transparent outer ridges */
-  boolT PROJECTdelaunay;  /* true if DELAUNAY, no readpoints() and
-			     need projectinput() for Delaunay in qh_init_B */
-  int   PROJECTinput;     /* number of projected dimensions 'bn:0Bn:0' */
-  boolT QUICKhelp;	  /* true if quick help message for degen input */
-  boolT RANDOMdist;       /* true if randomly change distplane and setfacetplane */
-  realT RANDOMfactor;     /*    maximum random perturbation */
-  realT RANDOMa;         /*  qh_randomfactor is randr * RANDOMa + RANDOMb */
-  realT RANDOMb;
-  boolT RANDOMoutside;    /* true if select a random outside point */
-  int	REPORTfreq;       /* buildtracing reports every n facets */
-  int   REPORTfreq2;	  /* tracemerging reports every REPORTfreq/2 facets */
-  int	RERUN;            /* 'TRn' rerun qhull n times (qh.build_cnt) */
-  int	ROTATErandom;	  /* 'QRn' seed, 0 time, >= rotate input */
-  boolT SCALEinput;       /* true 'Qbk' if scaling input */
-  boolT SCALElast;        /* true 'Qbb' if scale last coord to max prev coord */
-  boolT SETroundoff;      /* true 'E' if qh DISTround is predefined */
-  boolT SKIPcheckmax;	  /* true 'Q5' if skip qh_check_maxout */
-  boolT SKIPconvex;       /* true 'Q6' if skip convexity testing during pre-merge */
-  boolT SPLITthresholds;  /* true if upper_/lower_threshold defines a region
-                               used only for printing (not for qh ONLYgood) */
-  int	STOPcone;         /* 'TCn' 1+n for stopping after cone for point n*/
-			  /*       also used by qh_build_withresart for err exit*/
-  int	STOPpoint;        /* 'TVn' 'TV-n' 1+n for stopping after/before(-)
-			                adding point n */
-  int	TESTpoints;	  /* 'QTn' num of test points after qh.num_points.  Test points always coplanar. */
-  boolT TESTvneighbors;   /*  true 'Qv' if test vertex neighbors at end */
-  int   TRACElevel;       /* 'Tn' conditional IStracing level */
-  int	TRACElastrun;	  /*  qh.TRACElevel applies to last qh.RERUN */
-  int   TRACEpoint;       /* 'TPn' start tracing when point n is a vertex */
-  realT TRACEdist;        /* 'TWn' start tracing when merge distance too big */
-  int   TRACEmerge;       /* 'TMn' start tracing before this merge */
-  boolT TRIangulate;	  /* true 'Qt' if triangulate non-simplicial facets */
-  boolT TRInormals;	  /* true 'Q11' if triangulate duplicates normals (sets Qt) */
-  boolT UPPERdelaunay;    /* true 'Qu' if computing furthest-site Delaunay */
-  boolT VERIFYoutput;     /* true 'Tv' if verify output at end of qhull */
-  boolT VIRTUALmemory;    /* true 'Q7' if depth-first processing in buildhull */
-  boolT VORONOI;	  /* true 'v' if computing Voronoi diagram */
-
-  /*--------input constants ---------*/
-  realT AREAfactor;       /* 1/(hull_dim-1)! for converting det's to area */
-  boolT DOcheckmax;       /* true if calling qh_check_maxout (qh_initqhull_globals) */
-  char	*feasible_string;  /* feasible point 'Hn,n,n' for halfspace intersection */
-  coordT *feasible_point;  /*    as coordinates, both malloc'd */
-  boolT GETarea;          /* true 'Fa', 'FA', 'FS', 'PAn', 'PFn' if compute facet area/Voronoi volume in io.c */
-  boolT KEEPnearinside;   /* true if near-inside points in coplanarset */
-  int 	hull_dim;         /* dimension of hull, set by initbuffers */
-  int 	input_dim;	  /* dimension of input, set by initbuffers */
-  int 	num_points;       /* number of input points */
-  pointT *first_point;    /* array of input points, see POINTSmalloc */
-  boolT POINTSmalloc;     /*   true if qh first_point/num_points allocated */
-  pointT *input_points;   /* copy of original qh.first_point for input points for qh_joggleinput */
-  boolT input_malloc;     /* true if qh input_points malloc'd */
-  char 	qhull_command[256];/* command line that invoked this program */
-  char 	rbox_command[256]; /* command line that produced the input points */
-  char  qhull_options[512];/* descriptive list of options */
-  int   qhull_optionlen;  /*    length of last line */
-  int   qhull_optionsiz;  /*     size of qhull_options before qh_initbuild */
-  boolT VERTEXneighbors;  /* true if maintaining vertex neighbors */
-  boolT ZEROcentrum;      /* true if 'C-0' or 'C-0 Qx'.  sets ZEROall_ok */
-  realT *upper_threshold; /* don't print if facet->normal[k]>=upper_threshold[k]
-                             must set either GOODthreshold or SPLITthreshold
-  			     if Delaunay, default is 0.0 for upper envelope */
-  realT *lower_threshold; /* don't print if facet->normal[k] <=lower_threshold[k] */
-  realT *upper_bound;     /* scale point[k] to new upper bound */
-  realT *lower_bound;     /* scale point[k] to new lower bound
-  			     project if both upper_ and lower_bound == 0 */
-
-/*----------------------------------
-
-  qh precision constants
-    precision constants for Qhull
-
-  notes:
-    qh_detroundoff() computes the maximum roundoff error for distance
-    and other computations.  It also sets default values for the
-    qh constants above.
-*/
-  realT ANGLEround;       /* max round off error for angles */
-  realT centrum_radius;   /* max centrum radius for convexity (roundoff added) */
-  realT cos_max;	  /* max cosine for convexity (roundoff added) */
-  realT DISTround;        /* max round off error for distances, 'E' overrides */
-  realT MAXabs_coord;     /* max absolute coordinate */
-  realT MAXlastcoord;     /* max last coordinate for qh_scalelast */
-  realT MAXsumcoord;      /* max sum of coordinates */
-  realT MAXwidth;         /* max rectilinear width of point coordinates */
-  realT MINdenom_1;       /* min. abs. value for 1/x */
-  realT MINdenom;         /*    use divzero if denominator < MINdenom */
-  realT MINdenom_1_2;     /* min. abs. val for 1/x that allows normalization */
-  realT MINdenom_2;       /*    use divzero if denominator < MINdenom_2 */
-  realT MINlastcoord;     /* min. last coordinate for qh_scalelast */
-  boolT NARROWhull;       /* set in qh_initialhull if angle < qh_MAXnarrow */
-  realT *NEARzero;        /* hull_dim array for near zero in gausselim */
-  realT NEARinside;       /* keep points for qh_check_maxout if close to facet */
-  realT ONEmerge;         /* max distance for merging simplicial facets */
-  realT outside_err;      /* application's epsilon for coplanar points
-                             qh_check_bestdist() qh_check_points() reports error if point outside */
-  realT WIDEfacet;        /* size of wide facet for skipping ridge in
-			     area computation and locking centrum */
-  
-/*----------------------------------
-
-  qh internal constants
-    internal constants for Qhull
-*/
-  char qhull[sizeof("qhull")]; /* for checking ownership */
-  void *old_stat;         /* pointer to saved qh_qhstat, qh_save_qhull */
-  jmp_buf errexit;        /* exit label for qh_errexit, defined by setjmp() */
-  char jmpXtra[40];       /* extra bytes in case jmp_buf is defined wrong by compiler */
-  jmp_buf restartexit;    /* restart label for qh_errexit, defined by setjmp() */
-  char jmpXtra2[40];      /* extra bytes in case jmp_buf is defined wrong by compiler*/
-  FILE *fin;              /* pointer to input file, init by qh_meminit */
-  FILE *fout;             /* pointer to output file */
-  FILE *ferr;             /* pointer to error file */
-  pointT *interior_point; /* center point of the initial simplex*/
-  int   normal_size;      /* size in bytes for facet normals and point coords*/
-  int   center_size;      /* size in bytes for Voronoi centers */
-  int   TEMPsize;         /* size for small, temporary sets (in quick mem) */
-
-/*----------------------------------
-
-  qh facet and vertex lists
-    defines lists of facets, new facets, visible facets, vertices, and
-    new vertices.  Includes counts, next ids, and trace ids.
-  see:
-    qh_resetlists()
-*/
-  facetT *facet_list;     /* first facet */
-  facetT  *facet_tail;     /* end of facet_list (dummy facet) */
-  facetT *facet_next;     /* next facet for buildhull()
-    			     previous facets do not have outside sets
-                             NARROWhull: previous facets may have coplanar outside sets for qh_outcoplanar */
-  facetT *newfacet_list;  /* list of new facets to end of facet_list */
-  facetT *visible_list;   /* list of visible facets preceeding newfacet_list,
-                             facet->visible set */
-  int       num_visible;  /* current number of visible facets */
-  unsigned tracefacet_id;  /* set at init, then can print whenever */
-  facetT *tracefacet;     /*   set in newfacet/mergefacet, undone in delfacet*/
-  unsigned tracevertex_id;  /* set at buildtracing, can print whenever */
-  vertexT *tracevertex;     /*   set in newvertex, undone in delvertex*/
-  vertexT *vertex_list;     /* list of all vertices, to vertex_tail */
-  vertexT  *vertex_tail;    /*      end of vertex_list (dummy vertex) */
-  vertexT *newvertex_list; /* list of vertices in newfacet_list, to vertex_tail
-                             all vertices have 'newlist' set */
-  int 	num_facets;	  /* number of facets in facet_list
-			     includes visble faces (num_visible) */
-  int 	num_vertices;     /* number of vertices in facet_list */
-  int   num_outside;      /* number of points in outsidesets (for tracing and RANDOMoutside)
-                               includes coplanar outsideset points for NARROWhull/qh_outcoplanar() */
-  int   num_good;         /* number of good facets (after findgood_all) */
-  unsigned facet_id;      /* ID of next, new facet from newfacet() */
-  unsigned ridge_id;      /* ID of next, new ridge from newridge() */
-  unsigned vertex_id;     /* ID of next, new vertex from newvertex() */
-
-/*----------------------------------
-
-  qh global variables
-    defines minimum and maximum distances, next visit ids, several flags,
-    and other global variables.
-    initialize in qh_initbuild or qh_maxmin if used in qh_buildhull
-*/
-  unsigned long hulltime; /* ignore time to set up input and randomize */
-                          /*   use unsigned to avoid wrap-around errors */
-  boolT ALLOWrestart;     /* true if qh_precision can use qh.restartexit */
-  int   build_cnt;        /* number of calls to qh_initbuild */
-  qh_CENTER CENTERtype;   /* current type of facet->center, qh_CENTER */
-  int 	furthest_id;      /* pointid of furthest point, for tracing */
-  facetT *GOODclosest;    /* closest facet to GOODthreshold in qh_findgood */
-  realT JOGGLEmax;        /* set 'QJn' if randomly joggle input */
-  boolT maxoutdone;       /* set qh_check_maxout(), cleared by qh_addpoint() */
-  realT max_outside;      /* maximum distance from a point to a facet,
-			       before roundoff, not simplicial vertices
-			       actual outer plane is +DISTround and
-			       computed outer plane is +2*DISTround */
-  realT max_vertex;       /* maximum distance (>0) from vertex to a facet,
-			       before roundoff, due to a merge */
-  realT min_vertex;       /* minimum distance (<0) from vertex to a facet,
-			       before roundoff, due to a merge
-			       if qh.JOGGLEmax, qh_makenewplanes sets it
-  			       recomputed if qh.DOcheckmax, default -qh.DISTround */
-  boolT NEWfacets;        /* true while visible facets invalid due to new or merge
-			      from makecone/attachnewfacets to deletevisible */
-  boolT findbestnew;	  /* true if partitioning calls qh_findbestnew */
-  boolT findbest_notsharp; /* true if new facets are at least 90 degrees */
-  boolT NOerrexit;        /* true if qh.errexit is not available */
-  realT PRINTcradius;     /* radius for printing centrums */
-  realT PRINTradius;      /* radius for printing vertex spheres and points */
-  boolT POSTmerging;      /* true when post merging */
-  int 	printoutvar;	  /* temporary variable for qh_printbegin, etc. */
-  int 	printoutnum;	  /* number of facets printed */
-  boolT QHULLfinished;    /* True after qhull() is finished */
-  realT totarea;          /* 'FA': total facet area computed by qh_getarea */
-  realT totvol;           /* 'FA': total volume computed by qh_getarea */
-  unsigned int visit_id;  /* unique ID for searching neighborhoods, */
-  unsigned int vertex_visit; /* unique ID for searching vertices */
-  boolT ZEROall_ok;       /* True if qh_checkzero always succeeds */
-  boolT WAScoplanar;      /* True if qh_partitioncoplanar (qh_check_maxout) */
-  
-/*----------------------------------
-
-  qh global sets
-    defines sets for merging, initial simplex, hashing, extra input points,
-    and deleted vertices
-*/
-  setT *facet_mergeset;   /* temporary set of merges to be done */
-  setT *degen_mergeset;   /* temporary set of degenerate and redundant merges */
-  setT *hash_table;	  /* hash table for matching ridges in qh_matchfacets
-                             size is setsize() */
-  setT *other_points;     /* additional points (first is qh interior_point) */
-  setT *del_vertices;     /* vertices to partition and delete with visible
-                             facets.  Have deleted set for checkfacet */
-
-/*----------------------------------
-
-  qh global buffers
-    defines buffers for maxtrix operations, input, and error messages
-*/
-  coordT *gm_matrix;      /* (dim+1)Xdim matrix for geom.c */
-  coordT **gm_row;        /* array of gm_matrix rows */
-  char* line;             /* malloc'd input line of maxline+1 chars */
-  int maxline;
-  coordT *half_space;     /* malloc'd input array for halfspace (qh normal_size+coordT) */
-  coordT *temp_malloc;    /* malloc'd input array for points */
-  
-/*----------------------------------
-
-  qh static variables
-    defines static variables for individual functions
-
-  notes:
-    do not use 'static' within a function.  Multiple instances of qhull
-    may exist.
-
-    do not assume zero initialization, 'QPn' may cause a restart
-*/
-  boolT ERREXITcalled;    /* true during errexit (prevents duplicate calls */
-  boolT firstcentrum; 	  /* for qh_printcentrum */
-  realT last_low;         /* qh_scalelast parameters for qh_setdelaunay */
-  realT last_high;
-  realT last_newhigh;
-  unsigned lastreport;    /* for qh_buildtracing */
-  int mergereport;        /* for qh_tracemerging */
-  boolT old_randomdist;   /* save RANDOMdist when io, tracing, or statistics */
-  int   ridgeoutnum;      /* number of ridges in 4OFF output */
-  void *old_qhstat;       /* for saving qh_qhstat in save_qhull() */
-  setT *old_tempstack;     /* for saving qhmem.tempstack in save_qhull */
-  setT *coplanarset;      /* set of coplanar facets for searching qh_findbesthorizon() */
-};
-
-/*=========== -macros- =========================*/
-
-/*----------------------------------
-
-  otherfacet_(ridge, facet)
-    return neighboring facet for a ridge in facet
-*/
-#define otherfacet_(ridge, facet) \
-                        (((ridge)->top == (facet)) ? (ridge)->bottom : (ridge)->top)
-
-/*----------------------------------
-
-  getid_(p)
-    return ID for facet, ridge, or vertex
-    return MAXINT if NULL (-1 causes type conversion error )
-*/
-#define getid_(p)       ((p) ? (p)->id : -1)
-
-/*============== FORALL macros ===================*/
-
-/*----------------------------------
-
-  FORALLfacets { ... }
-    assign 'facet' to each facet in qh.facet_list
-
-  notes:
-    uses 'facetT *facet;'
-    assumes last facet is a sentinel
-
-  see:
-    FORALLfacet_( facetlist )
-*/
-#define FORALLfacets for (facet=qh facet_list;facet && facet->next;facet=facet->next)
-
-/*----------------------------------
-
-  FORALLpoints { ... }
-    assign 'point' to each point in qh.first_point, qh.num_points
-
-  declare:
-    coordT *point, *pointtemp;
-*/
-#define FORALLpoints FORALLpoint_(qh first_point, qh num_points)
-
-/*----------------------------------
-
-  FORALLpoint_( points, num) { ... }
-    assign 'point' to each point in points array of num points
-
-  declare:
-    coordT *point, *pointtemp;
-*/
-#define FORALLpoint_(points, num) for(point= (points), \
-      pointtemp= (points)+qh hull_dim*(num); point < pointtemp; point += qh hull_dim)
-
-/*----------------------------------
-
-  FORALLvertices { ... }
-    assign 'vertex' to each vertex in qh.vertex_list
-
-  declare:
-    vertexT *vertex;
-
-  notes:
-    assumes qh.vertex_list terminated with a sentinel
-*/
-#define FORALLvertices for (vertex=qh vertex_list;vertex && vertex->next;vertex= vertex->next)
-
-/*----------------------------------
-
-  FOREACHfacet_( facets ) { ... }
-    assign 'facet' to each facet in facets
-
-  declare:
-    facetT *facet, **facetp;
-
-  see:
-    FOREACHsetelement_
-*/
-#define FOREACHfacet_(facets)    FOREACHsetelement_(facetT, facets, facet)
-
-/*----------------------------------
-
-  FOREACHneighbor_( facet ) { ... }
-    assign 'neighbor' to each neighbor in facet->neighbors
-
-  FOREACHneighbor_( vertex ) { ... }
-    assign 'neighbor' to each neighbor in vertex->neighbors
-
-  declare:
-    facetT *neighbor, **neighborp;
-
-  see:
-    FOREACHsetelement_
-*/
-#define FOREACHneighbor_(facet)  FOREACHsetelement_(facetT, facet->neighbors, neighbor)
-
-/*----------------------------------
-
-  FOREACHpoint_( points ) { ... }
-    assign 'point' to each point in points set
-
-  declare:
-    pointT *point, **pointp;
-
-  see:
-    FOREACHsetelement_
-*/
-#define FOREACHpoint_(points)    FOREACHsetelement_(pointT, points, point)
-
-/*----------------------------------
-
-  FOREACHridge_( ridges ) { ... }
-    assign 'ridge' to each ridge in ridges set
-
-  declare:
-    ridgeT *ridge, **ridgep;
-
-  see:
-    FOREACHsetelement_
-*/
-#define FOREACHridge_(ridges)    FOREACHsetelement_(ridgeT, ridges, ridge)
-
-/*----------------------------------
-
-  FOREACHvertex_( vertices ) { ... }
-    assign 'vertex' to each vertex in vertices set
-
-  declare:
-    vertexT *vertex, **vertexp;
-
-  see:
-    FOREACHsetelement_
-*/
-#define FOREACHvertex_(vertices) FOREACHsetelement_(vertexT, vertices,vertex)
-
-/*----------------------------------
-
-  FOREACHfacet_i_( facets ) { ... }
-    assign 'facet' and 'facet_i' for each facet in facets set
-
-  declare:
-    facetT *facet;
-    int     facet_n, facet_i;
-
-  see:
-    FOREACHsetelement_i_
-*/
-#define FOREACHfacet_i_(facets)    FOREACHsetelement_i_(facetT, facets, facet)
-
-/*----------------------------------
-
-  FOREACHneighbor_i_( facet ) { ... }
-    assign 'neighbor' and 'neighbor_i' for each neighbor in facet->neighbors
-
-  FOREACHneighbor_i_( vertex ) { ... }
-    assign 'neighbor' and 'neighbor_i' for each neighbor in vertex->neighbors
-
-  declare:
-    facetT *neighbor;
-    int     neighbor_n, neighbor_i;
-
-  see:
-    FOREACHsetelement_i_
-*/
-#define FOREACHneighbor_i_(facet)  FOREACHsetelement_i_(facetT, facet->neighbors, neighbor)
-
-/*----------------------------------
-
-  FOREACHpoint_i_( points ) { ... }
-    assign 'point' and 'point_i' for each point in points set
-
-  declare:
-    pointT *point;
-    int     point_n, point_i;
-
-  see:
-    FOREACHsetelement_i_
-*/
-#define FOREACHpoint_i_(points)    FOREACHsetelement_i_(pointT, points, point)
-
-/*----------------------------------
-
-  FOREACHridge_i_( ridges ) { ... }
-    assign 'ridge' and 'ridge_i' for each ridge in ridges set
-
-  declare:
-    ridgeT *ridge;
-    int     ridge_n, ridge_i;
-
-  see:
-    FOREACHsetelement_i_
-*/
-#define FOREACHridge_i_(ridges)    FOREACHsetelement_i_(ridgeT, ridges, ridge)
-
-/*----------------------------------
-
-  FOREACHvertex_i_( vertices ) { ... }
-    assign 'vertex' and 'vertex_i' for each vertex in vertices set
-
-  declare:
-    vertexT *vertex;
-    int     vertex_n, vertex_i;
-
-  see:
-    FOREACHsetelement_i_
- */
-#define FOREACHvertex_i_(vertices) FOREACHsetelement_i_(vertexT, vertices,vertex)
-
-/********* -qhull.c prototypes (duplicated from qhull_a.h) **********************/
-
-void    qh_qhull (void);
-boolT   qh_addpoint (pointT *furthest, facetT *facet, boolT checkdist);
-void	qh_printsummary(FILE *fp);
-
-/********* -user.c prototypes (alphabetical) **********************/
-
-void 	qh_errexit(int exitcode, facetT *facet, ridgeT *ridge);
-void 	qh_errprint(char* string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex);
-int     qh_new_qhull (int dim, int numpoints, coordT *points, boolT ismalloc,
-		char *qhull_cmd, FILE *outfile, FILE *errfile);
-void    qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall);
-void 	qh_user_memsizes (void);
-
-/***** -geom.c/geom2.c prototypes (duplicated from geom.h) ****************/
-
-facetT *qh_findbest (pointT *point, facetT *startfacet,
-		     boolT bestoutside, boolT newfacets, boolT noupper,
-		     realT *dist, boolT *isoutside, int *numpart);
-facetT *qh_findbestnew (pointT *point, facetT *startfacet,
-                     realT *dist, boolT bestoutside, boolT *isoutside, int *numpart);
-boolT   qh_gram_schmidt(int dim, realT **rows);
-void    qh_outerinner (facetT *facet, realT *outerplane, realT *innerplane);
-void	qh_printsummary(FILE *fp);
-void    qh_projectinput (void);
-void    qh_randommatrix (realT *buffer, int dim, realT **row);
-void    qh_rotateinput (realT **rows);
-void    qh_scaleinput (void);
-void    qh_setdelaunay (int dim, int count, pointT *points);
-coordT  *qh_sethalfspace_all (int dim, int count, coordT *halfspaces, pointT *feasible);
-
-/***** -global.c prototypes (alphabetical) ***********************/
-
-unsigned long qh_clock (void);
-void 	qh_checkflags (char *command, char *hiddenflags);
-void 	qh_freebuffers (void);
-void    qh_freeqhull (boolT allmem);
-void    qh_init_A (FILE *infile, FILE *outfile, FILE *errfile, int argc, char *argv[]);
-void    qh_init_B (coordT *points, int numpoints, int dim, boolT ismalloc);
-void 	qh_init_qhull_command (int argc, char *argv[]);
-void    qh_initbuffers (coordT *points, int numpoints, int dim, boolT ismalloc);
-void 	qh_initflags (char *command);
-void 	qh_initqhull_buffers (void);
-void 	qh_initqhull_globals (coordT *points, int numpoints, int dim, boolT ismalloc);
-void    qh_initqhull_mem (void);
-void 	qh_initqhull_start (FILE *infile, FILE *outfile, FILE *errfile);
-void 	qh_initthresholds (char *command);
-void    qh_option (char *option, int *i, realT *r);
-#if qh_QHpointer
-void 	qh_restore_qhull (qhT **oldqh);
-qhT    *qh_save_qhull (void);
-#endif
-
-/***** -io.c prototypes (duplicated from io.h) ***********************/
-
-void    dfacet( unsigned id);
-void    dvertex( unsigned id);
-void	qh_printneighborhood (FILE *fp, int format, facetT *facetA, facetT *facetB, boolT printall);
-void	qh_produce_output(void);
-coordT *qh_readpoints(int *numpoints, int *dimension, boolT *ismalloc);
-
-
-/********* -mem.c prototypes (duplicated from mem.h) **********************/
-
-void qh_meminit (FILE *ferr);
-void qh_memfreeshort (int *curlong, int *totlong);
-
-/********* -poly.c/poly2.c prototypes (duplicated from poly.h) **********************/
-
-void    qh_check_output (void);
-void    qh_check_points (void);
-setT   *qh_facetvertices (facetT *facetlist, setT *facets, boolT allfacets);
-facetT *qh_findbestfacet (pointT *point, boolT bestoutside,
-           realT *bestdist, boolT *isoutside);
-vertexT *qh_nearvertex (facetT *facet, pointT *point, realT *bestdistp);
-pointT *qh_point (int id);
-setT   *qh_pointfacet (void /*qh.facet_list*/);
-int     qh_pointid (pointT *point);
-setT   *qh_pointvertex (void /*qh.facet_list*/);
-void    qh_setvoronoi_all (void);
-void	qh_triangulate (void /*qh facet_list*/);
-
-/********* -stat.c prototypes (duplicated from stat.h) **********************/
-
-void    qh_collectstatistics (void);
-void    qh_printallstatistics (FILE *fp, char *string);
-
 #endif /* qhDEFqhull */

Modified: trunk/scipy/spatial/qhull/src/qhull_a.h
===================================================================
--- trunk/scipy/spatial/qhull/src/qhull_a.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qhull_a.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,29 +1,40 @@
 /*
  ---------------------------------
 
-   qhull_a.h 
+   qhull_a.h
    all header files for compiling qhull
 
    see qh-qhull.htm
 
-   see qhull.h for user-level definitions
-   
+   see libqhull.h for user-level definitions
+
    see user.h for user-defineable constants
-   
-   defines internal functions for qhull.c global.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   defines internal functions for libqhull.c global.c
 
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/qhull_a.h#27 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
+
    Notes:  grep for ((" and (" to catch fprintf("lkasdjf");
            full parens around (x?y:z)
-	   use '#include qhull/qhull_a.h' to avoid name clashes
+           use '#include qhull/qhull_a.h' to avoid name clashes
 */
 
 #ifndef qhDEFqhulla
-#define qhDEFqhulla
+#define qhDEFqhulla 1
 
-#include 
-#include 
+#include "libqhull.h"  /* Defines data types */
+
+#include "stat.h"
+#include "random.h"
+#include "mem.h"
+#include "qset.h"
+#include "geom.h"
+#include "merge.h"
+#include "poly.h"
+#include "io.h"
+
 #include 
 #include 
 #include 
@@ -31,50 +42,46 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 /*** uncomment here and qset.c
      if string.h does not define memcpy()
 #include 
 */
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-#include "geom.h"
-#include "merge.h"
-#include "poly.h"
-#include "io.h"
-#include "stat.h"
 
-#if qh_CLOCKtype == 2  /* defined in user.h from qhull.h */
+#if qh_CLOCKtype == 2  /* defined in user.h from libqhull.h */
 #include 
 #include 
 #include 
 #endif
 
-#ifdef _MSC_VER  /* Microsoft Visual C++ */
-#pragma warning( disable : 4056)  /* float constant expression.  Looks like a compiler bug */
-#pragma warning( disable : 4146)  /* unary minus applied to unsigned type */
-#pragma warning( disable : 4244)  /* conversion from 'unsigned long' to 'real' */
-#pragma warning( disable : 4305)  /* conversion from 'const double' to 'float' */
+#ifdef _MSC_VER  /* Microsoft Visual C++ -- warning level 4 */
+#pragma warning( disable : 4100)  /* unreferenced formal parameter */
+#pragma warning( disable : 4127)  /* conditional expression is constant */
+#pragma warning( disable : 4706)  /* assignment within conditional function */
+#pragma warning( disable : 4996)  /* function was declared deprecated(strcpy, localtime, etc.) */
 #endif
 
 /* ======= -macros- =========== */
 
 /*----------------------------------
-  
-  traceN((fp.ferr, "format\n", vars));  
-    calls fprintf if qh.IStracing >= N
-  
+
+  traceN((qh ferr, 0Nnnn, "format\n", vars));
+    calls qh_fprintf if qh.IStracing >= N
+
+    Add debugging traps to the end of qh_fprintf
+
   notes:
     removing tracing reduces code size but doesn't change execution speed
 */
 #ifndef qh_NOtrace
-#define trace0(args) {if (qh IStracing) fprintf args;}
-#define trace1(args) {if (qh IStracing >= 1) fprintf args;}
-#define trace2(args) {if (qh IStracing >= 2) fprintf args;}
-#define trace3(args) {if (qh IStracing >= 3) fprintf args;}
-#define trace4(args) {if (qh IStracing >= 4) fprintf args;}
-#define trace5(args) {if (qh IStracing >= 5) fprintf args;}
+#define trace0(args) {if (qh IStracing) qh_fprintf args;}
+#define trace1(args) {if (qh IStracing >= 1) qh_fprintf args;}
+#define trace2(args) {if (qh IStracing >= 2) qh_fprintf args;}
+#define trace3(args) {if (qh IStracing >= 3) qh_fprintf args;}
+#define trace4(args) {if (qh IStracing >= 4) qh_fprintf args;}
+#define trace5(args) {if (qh IStracing >= 5) qh_fprintf args;}
 #else /* qh_NOtrace */
 #define trace0(args) {}
 #define trace1(args) {}
@@ -84,44 +91,61 @@
 #define trace5(args) {}
 #endif /* qh_NOtrace */
 
-/***** -qhull.c prototypes (alphabetical after qhull) ********************/
+/*----------------------------------
 
-void 	qh_qhull (void);
-boolT   qh_addpoint (pointT *furthest, facetT *facet, boolT checkdist);
-void 	qh_buildhull(void);
-void    qh_buildtracing (pointT *furthest, facetT *facet);
-void    qh_build_withrestart (void);
-void 	qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet);
+*/
+
+/* See Qt's qglobal.h */
+#if !defined(SAG_COM) && (defined(WIN64) || defined(_WIN64) || defined(__WIN64__) || defined(WIN32) || defined(_WIN32) || defined(__WIN32__) || defined(__NT__))
+#   define QHULL_OS_WIN
+#elif defined(__MWERKS__) && defined(__INTEL__)
+#   define QHULL_OS_WIN
+#endif
+#if defined(__INTEL_COMPILER) && !defined(QHULL_OS_WIN)
+template 
+inline void qhullUnused(T &x) { (void)x; }
+#  define QHULL_UNUSED(x) qhullUnused(x);
+#else
+#  define QHULL_UNUSED(x) (void)x;
+#endif
+
+/***** -libqhull.c prototypes (alphabetical after qhull) ********************/
+
+void    qh_qhull(void);
+boolT   qh_addpoint(pointT *furthest, facetT *facet, boolT checkdist);
+void    qh_buildhull(void);
+void    qh_buildtracing(pointT *furthest, facetT *facet);
+void    qh_build_withrestart(void);
+void    qh_errexit2(int exitcode, facetT *facet, facetT *otherfacet);
 void    qh_findhorizon(pointT *point, facetT *facet, int *goodvisible,int *goodhorizon);
-pointT *qh_nextfurthest (facetT **visible);
-void 	qh_partitionall(setT *vertices, pointT *points,int npoints);
-void    qh_partitioncoplanar (pointT *point, facetT *facet, realT *dist);
-void    qh_partitionpoint (pointT *point, facetT *facet);
-void 	qh_partitionvisible(boolT allpoints, int *numpoints);
-void    qh_precision (char *reason);
-void	qh_printsummary(FILE *fp);
+pointT *qh_nextfurthest(facetT **visible);
+void    qh_partitionall(setT *vertices, pointT *points,int npoints);
+void    qh_partitioncoplanar(pointT *point, facetT *facet, realT *dist);
+void    qh_partitionpoint(pointT *point, facetT *facet);
+void    qh_partitionvisible(boolT allpoints, int *numpoints);
+void    qh_precision(const char *reason);
+void    qh_printsummary(FILE *fp);
 
 /***** -global.c internal prototypes (alphabetical) ***********************/
 
-void    qh_appendprint (qh_PRINT format);
-void 	qh_freebuild (boolT allmem);
-void 	qh_freebuffers (void);
-void    qh_initbuffers (coordT *points, int numpoints, int dim, boolT ismalloc);
-int     qh_strtol (const char *s, char **endp);
-double  qh_strtod (const char *s, char **endp);
+void    qh_appendprint(qh_PRINT format);
+void    qh_freebuild(boolT allmem);
+void    qh_freebuffers(void);
+void    qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
 
 /***** -stat.c internal prototypes (alphabetical) ***********************/
 
-void	qh_allstatA (void);
-void	qh_allstatB (void);
-void	qh_allstatC (void);
-void	qh_allstatD (void);
-void	qh_allstatE (void);
-void	qh_allstatE2 (void);
-void	qh_allstatF (void);
-void	qh_allstatG (void);
-void	qh_allstatH (void);
-void 	qh_freebuffers (void);
-void    qh_initbuffers (coordT *points, int numpoints, int dim, boolT ismalloc);
+void    qh_allstatA(void);
+void    qh_allstatB(void);
+void    qh_allstatC(void);
+void    qh_allstatD(void);
+void    qh_allstatE(void);
+void    qh_allstatE2 (void);
+void    qh_allstatF(void);
+void    qh_allstatG(void);
+void    qh_allstatH(void);
+void    qh_freebuffers(void);
+void    qh_initbuffers(coordT *points, int numpoints, int dim, boolT ismalloc);
 
 #endif /* qhDEFqhulla */

Deleted: trunk/scipy/spatial/qhull/src/qhull_interface.cpp
===================================================================
--- trunk/scipy/spatial/qhull/src/qhull_interface.cpp	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qhull_interface.cpp	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,96 +0,0 @@
-/*
  ---------------------------------
-*/
-
-#include 
-#include 
-
-//--- Include qhull, so it works from with in a C++ source file
-//---
-//--- In MVC one cannot just do:
-//---
-//---    extern "C"
-//---    {
-//---      #include "qhull_a.h"
-//---    }
-//---
-//--- Because qhull_a.h includes math.h, which can not appear
-//--- inside a extern "C" declaration.
-//---
-//--- Maybe that why Numerical recipes in C avoid this problem, by removing
-//--- standard include headers from its header files and add them in the
-//--- respective source files instead.
-//---
-//--- [K. Erleben]
-
-#if defined(__cplusplus)
-extern "C"
-{
-#endif
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#if defined(__cplusplus)
-}
-#endif
-
-/*********************************************************************/
-/*                                                                   */
-/*                                                                   */
-/*                                                                   */
-/*                                                                   */
-/*********************************************************************/
-
-void compute_convex_hull(void)
-{  
-	int dim;  	              /* dimension of points */
-	int numpoints;            /* number of points */
-	coordT *points;           /* array of coordinates for each point */ 
-	boolT ismalloc;           /* True if qhull should free points in qh_freeqhull() or reallocation */ 
-	char flags[]= "qhull Tv"; /* option flags for qhull, see qh_opt.htm */
-	FILE *outfile= stdout;    /* output from qh_produce_output()			
-	                             use NULL to skip qh_produce_output() */ 
-	FILE *errfile= stderr;    /* error messages from qhull code */ 
-	int exitcode;             /* 0 if no error from qhull */
-	facetT *facet;	          /* set by FORALLfacets */
-	int curlong, totlong;	  /* memory remaining after qh_memfreeshort */
-
-   	/* initialize dim, numpoints, points[], ismalloc here */
-	exitcode= qh_new_qhull (dim, numpoints, points, ismalloc,
-							flags, outfile, errfile);
-	if (!exitcode) { /* if no error */ 
-		/* 'qh facet_list' contains the convex hull */
-		FORALLfacets {
-			/* ... your code ... */ 
-		}
-	}
-	qh_freeqhull(!qh_ALL);  
-	qh_memfreeshort (&curlong, &totlong);
-	if (curlong || totlong)
-		fprintf (errfile, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n", 
-		             totlong, curlong);
-};
-
-/*********************************************************************/
-/*                                                                   */
-/*                                                                   */
-/*                                                                   */
-/*                                                                   */
-/*********************************************************************/
-
-void main() 
-{ 
-	cout << "Hello world" << endl;
-	
-	cout << "Press any key..." << endl;  
-	
-	while(!_kbhit());
-
-};

Modified: trunk/scipy/spatial/qhull/src/qset.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qset.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qset.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,56 +1,52 @@
 /*
  ---------------------------------
 
-   qset.c 
-   implements set manipulations needed for quickhull 
+   qset.c
+   implements set manipulations needed for quickhull
 
    see qh-set.htm and qset.h
 
-   copyright (c) 1993-2003 The Geometry Center        
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/qset.c#29 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
+#include "qset.h"
+#include "mem.h"
 #include 
 #include 
-/*** uncomment here and qhull_a.h 
+/*** uncomment here and qhull_a.h
      if string.h does not define memcpy()
 #include 
 */
-#include "qset.h"
-#include "mem.h"
 
-#ifndef qhDEFqhull
+#ifndef qhDEFlibqhull
 typedef struct ridgeT ridgeT;
 typedef struct facetT facetT;
 void    qh_errexit(int exitcode, facetT *, ridgeT *);
+void    qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... );
+#  ifdef _MSC_VER  /* Microsoft Visual C++ -- warning level 4 */
+#  pragma warning( disable : 4127)  /* conditional expression is constant */
+#  pragma warning( disable : 4706)  /* assignment within conditional function */
+#  endif
 #endif
 
 /*=============== internal macros ===========================*/
 
-/*---------------------------------
-   
-  SETsizeaddr_(set) 
-    return pointer to actual size+1 of set (set CANNOT be NULL!!)
-      
-  notes:
-    *SETsizeaddr==NULL or e[*SETsizeaddr-1].p==NULL
-*/
-#define SETsizeaddr_(set) (&((set)->e[(set)->maxsize].i))
-
 /*============ functions in alphabetical order ===================*/
-  
+
 /*----------------------------------
-   
+
   qh_setaddnth( setp, nth, newelem)
     adds newelem as n'th element of sorted or unsorted *setp
-      
+
   notes:
     *setp and newelem must be defined
     *setp may be a temp set
     nth=0 is first element
     errors if nth is out of bounds
-   
+
   design:
     expand *setp if empty or full
     move tail of *setp up one
@@ -66,14 +62,14 @@
   }
   oldsize= *sizep - 1;
   if (nth < 0 || nth > oldsize) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
-    qh_setprint (qhmem.ferr, "", *setp);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6171, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
+    qh_setprint(qhmem.ferr, "", *setp);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   (*sizep)++;
   oldp= SETelemaddr_(*setp, oldsize, void);   /* NULL */
   newp= oldp+1;
-  for (i= oldsize-nth+1; i--; )  /* move at least NULL  */
+  for (i=oldsize-nth+1; i--; )  /* move at least NULL  */
     *(newp--)= *(oldp--);       /* may overwrite *sizep */
   *newp= newelem;
 } /* setaddnth */
@@ -81,15 +77,15 @@
 
 /*----------------------------------
-   
+
   setaddsorted( setp, newelem )
     adds an newelem into sorted *setp
-      
+
   notes:
     *setp and newelem must be defined
     *setp may be a temp set
     nop if newelem already in set
-  
+
   design:
     find newelem's position in *setp
     insert newelem
@@ -112,7 +108,7 @@
 
 /*---------------------------------
-  
+
   qh_setappend( setp, newelem)
     append newelem to *setp
 
@@ -123,11 +119,10 @@
   design:
     expand *setp if empty or full
     append newelem to *setp
-    
+
 */
 void qh_setappend(setT **setp, void *newelem) {
-  int *sizep;
-  void **endp;
+  int *sizep, end_idx;
 
   if (!newelem)
     return;
@@ -135,14 +130,15 @@
     qh_setlarger(setp);
     sizep= SETsizeaddr_(*setp);
   }
-  *(endp= &((*setp)->e[(*sizep)++ - 1].p))= newelem;
-  *(++endp)= NULL;
+  end_idx = (*sizep)++ - 1;
+  (*setp)->e[end_idx].p = newelem;
+  (*setp)->e[end_idx + 1].p = NULL;
 } /* setappend */
 
 /*---------------------------------
-  
-  qh_setappend_set( setp, setA) 
+
+  qh_setappend_set( setp, setA)
     appends setA to *setp
 
   notes:
@@ -152,7 +148,7 @@
   design:
     setup for copy
     expand *setp if it is too small
-    append all elements of setA to *setp 
+    append all elements of setA to *setp
 */
 void qh_setappend_set(setT **setp, setT *setA) {
   int *sizep, sizeA, size;
@@ -162,7 +158,7 @@
     return;
   SETreturnsize_(setA, sizeA);
   if (!*setp)
-    *setp= qh_setnew (sizeA);
+    *setp= qh_setnew(sizeA);
   sizep= SETsizeaddr_(*setp);
   if (!(size= *sizep))
     size= (*setp)->maxsize;
@@ -170,19 +166,19 @@
     size--;
   if (size + sizeA > (*setp)->maxsize) {
     oldset= *setp;
-    *setp= qh_setcopy (oldset, sizeA);
-    qh_setfree (&oldset);
+    *setp= qh_setcopy(oldset, sizeA);
+    qh_setfree(&oldset);
     sizep= SETsizeaddr_(*setp);
   }
   *sizep= size+sizeA+1;   /* memcpy may overwrite */
-  if (sizeA > 0) 
-    memcpy((char *)&((*setp)->e[size].p), (char *)&(setA->e[0].p), SETelemsize *(sizeA+1));
+  if (sizeA > 0)
+    memcpy((char *)&((*setp)->e[size].p), (char *)&(setA->e[0].p), (size_t)(sizeA+1) * SETelemsize);
 } /* setappend_set */
 
 
 /*---------------------------------
-  
+
   qh_setappend2ndlast( setp, newelem )
     makes newelem the next to the last element in *setp
 
@@ -199,7 +195,7 @@
 void qh_setappend2ndlast(setT **setp, void *newelem) {
   int *sizep;
   void **endp, **lastp;
-  
+
   if (!*setp || !*(sizep= SETsizeaddr_(*setp))) {
     qh_setlarger(setp);
     sizep= SETsizeaddr_(*setp);
@@ -214,15 +210,15 @@
 
 /*---------------------------------
-  
-  qh_setcheck( set, typename, id ) 
+
+  qh_setcheck( set, typename, id )
     check set for validity
     report errors with typename and id
 
   design:
     checks that maxsize, actual size, and NULL terminator agree
 */
-void qh_setcheck(setT *set, char *tname, int id) {
+void qh_setcheck(setT *set, const char *tname, unsigned id) {
   int maxsize, size;
   int waserr= 0;
 
@@ -231,24 +227,24 @@
   SETreturnsize_(set, size);
   maxsize= set->maxsize;
   if (size > maxsize || !maxsize) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setcheck): actual size %d of %s%d is greater than max size %d\n",
-	     size, tname, id, maxsize);
+    qh_fprintf(qhmem.ferr, 6172, "qhull internal error (qh_setcheck): actual size %d of %s%d is greater than max size %d\n",
+             size, tname, id, maxsize);
     waserr= 1;
   }else if (set->e[size].p) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setcheck): %s%d (size %d max %d) is not null terminated.\n",
-	     tname, id, maxsize, size-1);
+    qh_fprintf(qhmem.ferr, 6173, "qhull internal error (qh_setcheck): %s%d(size %d max %d) is not null terminated.\n",
+             tname, id, maxsize, size-1);
     waserr= 1;
   }
   if (waserr) {
-    qh_setprint (qhmem.ferr, "ERRONEOUS", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_setprint(qhmem.ferr, "ERRONEOUS", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
 } /* setcheck */
 
 
 /*---------------------------------
-  
+
   qh_setcompact( set )
     remove internal NULLs from an unsorted set
 
@@ -261,7 +257,7 @@
 
   design:
     setup pointers into set
-    skip NULLs while copying elements to start of set 
+    skip NULLs while copying elements to start of set
     update the actual size
 */
 void qh_setcompact(setT *set) {
@@ -277,16 +273,16 @@
     if (!(*destp++ = *elemp++)) {
       destp--;
       if (elemp > endp)
-	break;
+        break;
     }
   }
-  qh_settruncate (set, destp-firstp);
+  qh_settruncate(set, (int)(destp-firstp));   /* WARN64 */
 } /* setcompact */
 
 
 /*---------------------------------
-  
+
   qh_setcopy( set, extra )
     make a copy of a sorted or unsorted set with extra slots
 
@@ -296,7 +292,7 @@
   design:
     create a newset with extra slots
     copy the elements to the newset
-    
+
 */
 setT *qh_setcopy(setT *set, int extra) {
   setT *newset;
@@ -307,26 +303,26 @@
   SETreturnsize_(set, size);
   newset= qh_setnew(size+extra);
   *SETsizeaddr_(newset)= size+1;    /* memcpy may overwrite */
-  memcpy((char *)&(newset->e[0].p), (char *)&(set->e[0].p), SETelemsize *(size+1));
-  return (newset);
+  memcpy((char *)&(newset->e[0].p), (char *)&(set->e[0].p), (size_t)(size+1) * SETelemsize);
+  return(newset);
 } /* setcopy */
 
 
 /*---------------------------------
-  
+
   qh_setdel( set, oldelem )
     delete oldelem from an unsorted set
 
   returns:
     returns oldelem if found
     returns NULL otherwise
-    
+
   notes:
     set may be NULL
     oldelem must not be NULL;
     only deletes one copy of oldelem in set
-     
+
   design:
     locate oldelem
     update actual size if it was full
@@ -356,8 +352,8 @@
 
 /*---------------------------------
-  
-  qh_setdellast( set) 
+
+  qh_setdellast( set)
     return last element of set or NULL
 
   notes:
@@ -369,14 +365,14 @@
     if full set
       delete last element and set actual size
     else
-      delete last element and update actual size 
+      delete last element and update actual size
 */
 void *qh_setdellast(setT *set) {
   int setsize;  /* actually, actual_size + 1 */
   int maxsize;
   int *sizep;
   void *returnvalue;
-  
+
   if (!set || !(set->e[0].p))
     return NULL;
   sizep= SETsizeaddr_(set);
@@ -396,9 +392,9 @@
 
 /*---------------------------------
-  
+
   qh_setdelnth( set, nth )
-    deletes nth element from unsorted set 
+    deletes nth element from unsorted set
     0 is first element
 
   returns:
@@ -421,9 +417,9 @@
   if (!(*sizep)--)         /*  if was a full set */
     *sizep= set->maxsize;  /*     *sizep= (maxsize-1)+ 1 */
   if (nth < 0 || nth >= *sizep) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6174, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   lastp= SETelemaddr_(set, *sizep-1, void);
   elem= *elemp;
@@ -434,23 +430,23 @@
 
 /*---------------------------------
-  
+
   qh_setdelnthsorted( set, nth )
     deletes nth element from sorted set
 
   returns:
     returns the element (use type conversion)
-  
+
   notes:
     errors if nth invalid
-    
-  see also: 
+
+  see also:
     setnew_delnthsorted
 
   design:
     setup points and check nth
     copy remaining elements down one
-    update actual size  
+    update actual size
 */
 void *qh_setdelnthsorted(setT *set, int nth) {
   void **newp, **oldp, *elem;
@@ -458,9 +454,9 @@
 
   sizep= SETsizeaddr_(set);
   if (nth < 0 || (*sizep && nth >= *sizep-1) || nth >= set->maxsize) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6175, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   newp= SETelemaddr_(set, nth, void);
   elem= *newp;
@@ -475,20 +471,20 @@
 
 /*---------------------------------
-  
+
   qh_setdelsorted( set, oldelem )
     deletes oldelem from sorted set
 
   returns:
     returns oldelem if it was deleted
-  
+
   notes:
     set may be NULL
 
   design:
     locate oldelem in set
     copy remaining elements down one
-    update actual size  
+    update actual size
 */
 void *qh_setdelsorted(setT *set, void *oldelem) {
   void **newp, **oldp;
@@ -497,7 +493,7 @@
   if (!set)
     return NULL;
   newp= SETaddr_(set, void);
-  while(*newp != oldelem && *newp)
+  while (*newp != oldelem && *newp)
     newp++;
   if (*newp) {
     oldp= newp+1;
@@ -514,7 +510,7 @@
 
 /*---------------------------------
-  
+
   qh_setduplicate( set, elemsize )
     duplicate a set of elemsize elements
 
@@ -527,18 +523,18 @@
       create a newelem
       append newelem to newset
 */
-setT *qh_setduplicate (setT *set, int elemsize) {
-  void		*elem, **elemp, *newElem;
-  setT		*newSet;
-  int		size;
-  
-  if (!(size= qh_setsize (set)))
+setT *qh_setduplicate(setT *set, int elemsize) {
+  void          *elem, **elemp, *newElem;
+  setT          *newSet;
+  int           size;
+
+  if (!(size= qh_setsize(set)))
     return NULL;
-  newSet= qh_setnew (size);
+  newSet= qh_setnew(size);
   FOREACHelem_(set) {
-    newElem= qh_memalloc (elemsize);
-    memcpy (newElem, elem, elemsize);
-    qh_setappend (&newSet, newElem);
+    newElem= qh_memalloc(elemsize);
+    memcpy(newElem, elem, (size_t)elemsize);
+    qh_setappend(&newSet, newElem);
   }
   return newSet;
 } /* setduplicate */
@@ -546,7 +542,7 @@
 
 /*---------------------------------
-  
+
   qh_setequal(  )
     returns 1 if two sorted sets are equal, otherwise returns 0
 
@@ -561,7 +557,7 @@
 int qh_setequal(setT *setA, setT *setB) {
   void **elemAp, **elemBp;
   int sizeA, sizeB;
-  
+
   SETreturnsize_(setA, sizeA);
   SETreturnsize_(setB, sizeB);
   if (sizeA != sizeB)
@@ -578,17 +574,17 @@
 
 /*---------------------------------
-  
+
   qh_setequal_except( setA, skipelemA, setB, skipelemB )
     returns 1 if sorted setA and setB are equal except for skipelemA & B
 
   returns:
     false if either skipelemA or skipelemB are missing
-  
+
   notes:
     neither set may be NULL
 
-    if skipelemB is NULL, 
+    if skipelemB is NULL,
       can skip any one element of setB
 
   design:
@@ -596,7 +592,7 @@
     search for skipelemA, skipelemB, and mismatches
     check results
 */
-int qh_setequal_except (setT *setA, void *skipelemA, setT *setB, void *skipelemB) {
+int qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB) {
   void **elemA, **elemB;
   int skip=0;
 
@@ -619,18 +615,18 @@
     }
     if (!*elemA)
       break;
-    if (*elemA++ != *elemB++) 
+    if (*elemA++ != *elemB++)
       return 0;
   }
   if (skip != 2 || *elemB)
     return 0;
   return 1;
 } /* setequal_except */
-  
 
+
 /*---------------------------------
-  
+
   qh_setequal_skip( setA, skipA, setB, skipB )
     returns 1 if sorted setA and setB are equal except for elements skipA & B
 
@@ -644,7 +640,7 @@
     setup pointers
     search for mismatches while skipping skipA and skipB
 */
-int qh_setequal_skip (setT *setA, int skipA, setT *setB, int skipB) {
+int qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB) {
   void **elemA, **elemB, **skipAp, **skipBp;
 
   elemA= SETaddr_(setA, void);
@@ -658,24 +654,24 @@
       elemB++;
     if (!*elemA)
       break;
-    if (*elemA++ != *elemB++) 
+    if (*elemA++ != *elemB++)
       return 0;
   }
   if (*elemB)
     return 0;
   return 1;
 } /* setequal_skip */
-  
 
+
 /*---------------------------------
-  
+
   qh_setfree( setp )
     frees the space occupied by a sorted or unsorted set
 
   returns:
     sets setp to NULL
-    
+
   notes:
     set may be NULL
 
@@ -686,13 +682,13 @@
 void qh_setfree(setT **setp) {
   int size;
   void **freelistp;  /* used !qh_NOmem */
-  
+
   if (*setp) {
-    size= sizeof(setT) + ((*setp)->maxsize)*SETelemsize; 
+    size= sizeof(setT) + ((*setp)->maxsize)*SETelemsize;
     if (size <= qhmem.LASTsize) {
       qh_memfree_(*setp, size, freelistp);
     }else
-      qh_memfree (*setp, size);
+      qh_memfree(*setp, size);
     *setp= NULL;
   }
 } /* setfree */
@@ -700,7 +696,7 @@
 
 /*---------------------------------
-  
+
   qh_setfree2( setp, elemsize )
     frees the space occupied by a set and its elements
 
@@ -709,41 +705,41 @@
 
   design:
     free each element
-    free set 
+    free set
 */
 void qh_setfree2 (setT **setp, int elemsize) {
-  void		*elem, **elemp;
-  
+  void          *elem, **elemp;
+
   FOREACHelem_(*setp)
-    qh_memfree (elem, elemsize);
-  qh_setfree (setp);
+    qh_memfree(elem, elemsize);
+  qh_setfree(setp);
 } /* setfree2 */
 
 
-      
+
 /*---------------------------------
-  
+
   qh_setfreelong( setp )
     frees a set only if it's in long memory
 
   returns:
     sets setp to NULL if it is freed
-    
+
   notes:
     set may be NULL
 
   design:
     if set is large
-      free it    
+      free it
 */
 void qh_setfreelong(setT **setp) {
   int size;
-  
+
   if (*setp) {
-    size= sizeof(setT) + ((*setp)->maxsize)*SETelemsize; 
+    size= sizeof(setT) + ((*setp)->maxsize)*SETelemsize;
     if (size > qhmem.LASTsize) {
-      qh_memfree (*setp, size);
+      qh_memfree(*setp, size);
       *setp= NULL;
     }
   }
@@ -752,7 +748,7 @@
 
 /*---------------------------------
-  
+
   qh_setin( set, setelem )
     returns 1 if setelem is in a set, 0 otherwise
 
@@ -775,13 +771,14 @@
 
 /*---------------------------------
-  
+
   qh_setindex( set, atelem )
-    returns the index of atelem in set.   
+    returns the index of atelem in set.
     returns -1, if not in set or maxsize wrong
 
   notes:
     set may be NULL and may contain nulls.
+    NOerrors returned (qh_pointid, QhullPoint::id)
 
   design:
     checks maxsize
@@ -805,7 +802,7 @@
 
 /*---------------------------------
-  
+
   qh_setlarger( oldsetp )
     returns a larger set that contains all elements of *oldsetp
 
@@ -832,15 +829,15 @@
     newset= qh_setnew(2 * size);
     oldp= SETaddr_(oldset, void);
     newp= SETaddr_(newset, void);
-    memcpy((char *)newp, (char *)oldp, (size+1) * SETelemsize);
+    memcpy((char *)newp, (char *)oldp, (size_t)(size+1) * SETelemsize);
     sizep= SETsizeaddr_(newset);
     *sizep= size+1;
-    FOREACHset_((setT *)qhmem.tempstack) {
+    FOREACHset_(qhmem.tempstack) {
       if (set == oldset)
-	*(setp-1)= newset;
+        *(setp-1)= newset;
     }
     qh_setfree(oldsetp);
-  }else 
+  }else
     newset= qh_setnew(3);
   *oldsetp= newset;
 } /* setlarger */
@@ -848,7 +845,7 @@
 
 /*---------------------------------
-  
+
   qh_setlast(  )
     return last element of set or NULL (use type conversion)
 
@@ -856,14 +853,14 @@
     set may be NULL
 
   design:
-    return last element  
+    return last element
 */
 void *qh_setlast(setT *set) {
   int size;
 
   if (set) {
     size= *SETsizeaddr_(set);
-    if (!size) 
+    if (!size)
       return SETelem_(set, set->maxsize - 1);
     else if (size > 1)
       return SETelem_(set, size - 2);
@@ -874,12 +871,12 @@
 
 /*---------------------------------
-  
+
   qh_setnew( setsize )
     creates and allocates space for a set
 
   notes:
-    setsize means the number of elements (NOT including the NULL terminator)
+    setsize means the number of elements (!including the NULL terminator)
     use qh_settemp/qh_setfreetemp if set is temporary
 
   design:
@@ -896,25 +893,25 @@
   if (!setsize)
     setsize++;
   size= sizeof(setT) + setsize * SETelemsize;
-  if ((unsigned) size <= (unsigned) qhmem.LASTsize) {
+  if (size <= qhmem.LASTsize) {
     qh_memalloc_(size, freelistp, set, setT);
 #ifndef qh_NOmem
     sizereceived= qhmem.sizetable[ qhmem.indextable[size]];
-    if (sizereceived > size) 
+    if (sizereceived > size)
       setsize += (sizereceived - size)/SETelemsize;
 #endif
   }else
-    set= (setT*)qh_memalloc (size);
+    set= (setT*)qh_memalloc(size);
   set->maxsize= setsize;
   set->e[setsize].i= 1;
   set->e[0].p= NULL;
-  return (set);
+  return(set);
 } /* setnew */
 
 
 /*---------------------------------
-  
+
   qh_setnew_delnthsorted( set, size, nth, prepend )
     creates a sorted set not containing nth element
     if prepend, the first prepend elements are undefined
@@ -936,9 +933,9 @@
   int tailsize= size - nth -1, newsize;
 
   if (tailsize < 0) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6176, "qhull internal error (qh_setaddnth): nth %d is out-of-bounds for set:\n", nth);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   newsize= size-1 + prepend;
   newset= qh_setnew(newsize);
@@ -967,7 +964,7 @@
     *(newp++)= *oldp++;
     break;
   default:
-    memcpy((char *)newp, (char *)oldp, nth * SETelemsize);
+    memcpy((char *)newp, (char *)oldp, (size_t)nth * SETelemsize);
     newp += nth;
     oldp += nth;
     break;
@@ -995,7 +992,7 @@
     *(newp++)= *oldp++;
     break;
   default:
-    memcpy((char *)newp, (char *)oldp, tailsize * SETelemsize);
+    memcpy((char *)newp, (char *)oldp, (size_t)tailsize * SETelemsize);
     newp += tailsize;
   }
   *newp= NULL;
@@ -1005,33 +1002,33 @@
 
 /*---------------------------------
-  
+
   qh_setprint( fp, string, set )
     print set elements to fp with identifying string
 
   notes:
     never errors
 */
-void qh_setprint(FILE *fp, char* string, setT *set) {
+void qh_setprint(FILE *fp, const char* string, setT *set) {
   int size, k;
 
   if (!set)
-    fprintf (fp, "%s set is null\n", string);
+    qh_fprintf(fp, 9346, "%s set is null\n", string);
   else {
     SETreturnsize_(set, size);
-    fprintf (fp, "%s set=%p maxsize=%d size=%d elems=",
-	     string, set, set->maxsize, size);
+    qh_fprintf(fp, 9347, "%s set=%p maxsize=%d size=%d elems=",
+             string, set, set->maxsize, size);
     if (size > set->maxsize)
       size= set->maxsize+1;
     for (k=0; k < size; k++)
-      fprintf(fp, " %p", set->e[k].p);
-    fprintf(fp, "\n");
+      qh_fprintf(fp, 9348, " %p", set->e[k].p);
+    qh_fprintf(fp, 9349, "\n");
   }
 } /* setprint */
 
 /*---------------------------------
-  
+
   qh_setreplace( set, oldelem, newelem )
     replaces oldelem in set with newelem
 
@@ -1045,47 +1042,48 @@
 */
 void qh_setreplace(setT *set, void *oldelem, void *newelem) {
   void **elemp;
-  
+
   elemp= SETaddr_(set, void);
-  while(*elemp != oldelem && *elemp)
+  while (*elemp != oldelem && *elemp)
     elemp++;
   if (*elemp)
     *elemp= newelem;
   else {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setreplace): elem %p not found in set\n",
+    qh_fprintf(qhmem.ferr, 6177, "qhull internal error (qh_setreplace): elem %p not found in set\n",
        oldelem);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
 } /* setreplace */
 
 
 /*---------------------------------
-  
+
   qh_setsize( set )
     returns the size of a set
 
   notes:
     errors if set's maxsize is incorrect
     same as SETreturnsize_(set)
+    same code for qh_setsize [qset.c] and QhullSetBase::count
 
   design:
     determine actual size of set from maxsize
 */
 int qh_setsize(setT *set) {
   int size, *sizep;
-  
+
   if (!set)
-    return (0);
+    return(0);
   sizep= SETsizeaddr_(set);
   if ((size= *sizep)) {
     size--;
     if (size > set->maxsize) {
-      fprintf (qhmem.ferr, "qhull internal error (qh_setsize): current set size %d is greater than maximum size %d\n",
-	       size, set->maxsize);
-      qh_setprint (qhmem.ferr, "set: ", set);
-      qh_errexit (qhmem_ERRqhull, NULL, NULL);
+      qh_fprintf(qhmem.ferr, 6178, "qhull internal error (qh_setsize): current set size %d is greater than maximum size %d\n",
+               size, set->maxsize);
+      qh_setprint(qhmem.ferr, "set: ", set);
+      qh_errexit(qhmem_ERRqhull, NULL, NULL);
     }
   }else
     size= set->maxsize;
@@ -1094,7 +1092,7 @@
 
 /*---------------------------------
-  
+
   qh_settemp( setsize )
     return a stacked, temporary set of upto setsize elements
 
@@ -1105,29 +1103,29 @@
   design:
     allocate set
     append to qhmem.tempstack
-    
+
 */
 setT *qh_settemp(int setsize) {
   setT *newset;
-  
-  newset= qh_setnew (setsize);
-  qh_setappend ((setT **)&qhmem.tempstack, newset);
+
+  newset= qh_setnew(setsize);
+  qh_setappend(&qhmem.tempstack, newset);
   if (qhmem.IStracing >= 5)
-    fprintf (qhmem.ferr, "qh_settemp: temp set %p of %d elements, depth %d\n",
-       newset, newset->maxsize, qh_setsize ((setT*)qhmem.tempstack));
+    qh_fprintf(qhmem.ferr, 8123, "qh_settemp: temp set %p of %d elements, depth %d\n",
+       newset, newset->maxsize, qh_setsize(qhmem.tempstack));
   return newset;
 } /* settemp */
 
 /*---------------------------------
-  
+
   qh_settempfree( set )
     free temporary set at top of qhmem.tempstack
 
   notes:
     nop if set is NULL
     errors if set not from previous   qh_settemp
-  
+
   to locate errors:
     use 'T2' to find source and then find mis-matching qh_settemp
 
@@ -1140,20 +1138,20 @@
 
   if (!*set)
     return;
-  stackedset= qh_settemppop ();
+  stackedset= qh_settemppop();
   if (stackedset != *set) {
     qh_settemppush(stackedset);
-    fprintf (qhmem.ferr, "qhull internal error (qh_settempfree): set %p (size %d) was not last temporary allocated (depth %d, set %p, size %d)\n",
-	     *set, qh_setsize(*set), qh_setsize((setT*)qhmem.tempstack)+1,
-	     stackedset, qh_setsize(stackedset));
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6179, "qhull internal error (qh_settempfree): set %p(size %d) was not last temporary allocated(depth %d, set %p, size %d)\n",
+             *set, qh_setsize(*set), qh_setsize(qhmem.tempstack)+1,
+             stackedset, qh_setsize(stackedset));
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
-  qh_setfree (set);
+  qh_setfree(set);
 } /* settempfree */
 
 /*---------------------------------
-  
+
   qh_settempfree_all(  )
     free all temporary sets in qhmem.tempstack
 
@@ -1165,40 +1163,40 @@
 void qh_settempfree_all(void) {
   setT *set, **setp;
 
-  FOREACHset_((setT *)qhmem.tempstack) 
+  FOREACHset_(qhmem.tempstack)
     qh_setfree(&set);
-  qh_setfree((setT **)&qhmem.tempstack);
+  qh_setfree(&qhmem.tempstack);
 } /* settempfree_all */
 
 /*---------------------------------
-  
+
   qh_settemppop(  )
-    pop and return temporary set from qhmem.tempstack 
+    pop and return temporary set from qhmem.tempstack
 
   notes:
     the returned set is permanent
-    
+
   design:
     pop and check top of qhmem.tempstack
 */
 setT *qh_settemppop(void) {
   setT *stackedset;
-  
-  stackedset= (setT*)qh_setdellast((setT *)qhmem.tempstack);
+
+  stackedset= (setT*)qh_setdellast(qhmem.tempstack);
   if (!stackedset) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_settemppop): pop from empty temporary stack\n");
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6180, "qhull internal error (qh_settemppop): pop from empty temporary stack\n");
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   if (qhmem.IStracing >= 5)
-    fprintf (qhmem.ferr, "qh_settemppop: depth %d temp set %p of %d elements\n",
-       qh_setsize((setT*)qhmem.tempstack)+1, stackedset, qh_setsize(stackedset));
+    qh_fprintf(qhmem.ferr, 8124, "qh_settemppop: depth %d temp set %p of %d elements\n",
+       qh_setsize(qhmem.tempstack)+1, stackedset, qh_setsize(stackedset));
   return stackedset;
 } /* settemppop */
 
 /*---------------------------------
-  
+
   qh_settemppush( set )
     push temporary set unto qhmem.tempstack (makes it temporary)
 
@@ -1206,26 +1204,26 @@
     duplicates settemp() for tracing
 
   design:
-    append set to tempstack  
+    append set to tempstack
 */
 void qh_settemppush(setT *set) {
-  
-  qh_setappend ((setT**)&qhmem.tempstack, set);
+
+  qh_setappend(&qhmem.tempstack, set);
   if (qhmem.IStracing >= 5)
-    fprintf (qhmem.ferr, "qh_settemppush: depth %d temp set %p of %d elements\n",
-    qh_setsize((setT*)qhmem.tempstack), set, qh_setsize(set));
+    qh_fprintf(qhmem.ferr, 8125, "qh_settemppush: depth %d temp set %p of %d elements\n",
+      qh_setsize(qhmem.tempstack), set, qh_setsize(set));
 } /* settemppush */
 
- 
+
 /*---------------------------------
-  
+
   qh_settruncate( set, size )
     truncate set to size elements
 
   notes:
     set must be defined
-  
+
   see:
     SETtruncate_
 
@@ -1233,20 +1231,20 @@
     check size
     update actual size of set
 */
-void qh_settruncate (setT *set, int size) {
+void qh_settruncate(setT *set, int size) {
 
   if (size < 0 || size > set->maxsize) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_settruncate): size %d out of bounds for set:\n", size);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+    qh_fprintf(qhmem.ferr, 6181, "qhull internal error (qh_settruncate): size %d out of bounds for set:\n", size);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   set->e[set->maxsize].i= size+1;   /* maybe overwritten */
   set->e[size].p= NULL;
 } /* settruncate */
-    
+
 /*---------------------------------
-  
+
   qh_setunique( set, elem )
     add elem to unsorted set unless it is already in set
 
@@ -1257,18 +1255,18 @@
     if elem not in set
       append elem to set
 */
-int qh_setunique (setT **set, void *elem) {
+int qh_setunique(setT **set, void *elem) {
 
-  if (!qh_setin (*set, elem)) {
-    qh_setappend (set, elem);
+  if (!qh_setin(*set, elem)) {
+    qh_setappend(set, elem);
     return 1;
   }
   return 0;
 } /* setunique */
-    
+
 /*---------------------------------
-  
+
   qh_setzero( set, index, size )
     zero elements from index on
     set actual size of set to size
@@ -1276,26 +1274,26 @@
   notes:
     set must be defined
     the set becomes an indexed set (can not use FOREACH...)
-  
+
   see also:
     qh_settruncate
-    
+
   design:
     check index and size
     update actual size
-    zero elements starting at e[index]   
+    zero elements starting at e[index]
 */
-void qh_setzero (setT *set, int index, int size) {
+void qh_setzero(setT *set, int idx, int size) {
   int count;
 
-  if (index < 0 || index >= size || size > set->maxsize) {
-    fprintf (qhmem.ferr, "qhull internal error (qh_setzero): index %d or size %d out of bounds for set:\n", index, size);
-    qh_setprint (qhmem.ferr, "", set);
-    qh_errexit (qhmem_ERRqhull, NULL, NULL);
+  if (idx < 0 || idx >= size || size > set->maxsize) {
+    qh_fprintf(qhmem.ferr, 6182, "qhull internal error (qh_setzero): index %d or size %d out of bounds for set:\n", idx, size);
+    qh_setprint(qhmem.ferr, "", set);
+    qh_errexit(qhmem_ERRqhull, NULL, NULL);
   }
   set->e[set->maxsize].i=  size+1;  /* may be overwritten */
-  count= size - index + 1;   /* +1 for NULL terminator */
-  memset ((char *)SETelemaddr_(set, index, void), 0, count * SETelemsize);
+  count= size - idx + 1;   /* +1 for NULL terminator */
+  memset((char *)SETelemaddr_(set, idx, void), 0, (size_t)count * SETelemsize);
 } /* setzero */
 
-    
+

Modified: trunk/scipy/spatial/qhull/src/qset.h
===================================================================
--- trunk/scipy/spatial/qhull/src/qset.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qset.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -5,23 +5,27 @@
      header file for qset.c that implements set
 
    see qh-set.htm and qset.c
-   
+
    only uses mem.c, malloc/free
 
    for error handling, writes message and calls
-      qh_errexit (qhmem_ERRqhull, NULL, NULL);
-   
+      qh_errexit(qhmem_ERRqhull, NULL, NULL);
+
    set operations satisfy the following properties:
     - sets have a max size, the actual size (if different) is stored at the end
     - every set is NULL terminated
     - sets may be sorted or unsorted, the caller must distinguish this
-   
-   copyright (c) 1993-2003, The Geometry Center
+
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/qset.h#20 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #ifndef qhDEFset
 #define qhDEFset 1
 
+#include 
+
 /*================= -structures- ===============*/
 
 #ifndef DEFsetT
@@ -31,39 +35,39 @@
 
 /*------------------------------------------
-   
+
 setT
   a set or list of pointers with maximum size and actual size.
 
 variations:
   unsorted, unique   -- a list of unique pointers with NULL terminator
-  			   user guarantees uniqueness
-  sorted	     -- a sorted list of unique pointers with NULL terminator
-  			   qset.c guarantees uniqueness
+                           user guarantees uniqueness
+  sorted             -- a sorted list of unique pointers with NULL terminator
+                           qset.c guarantees uniqueness
   unsorted           -- a list of pointers terminated with NULL
-  indexed  	     -- an array of pointers with NULL elements 
+  indexed            -- an array of pointers with NULL elements
 
 structure for set of n elements:
 
-	--------------
-	|  maxsize 
-	--------------
-	|  e[0] - a pointer, may be NULL for indexed sets
-	--------------
-	|  e[1]
-	
-	--------------
-	|  ...
-	--------------
-	|  e[n-1]
-	--------------
-	|  e[n] = NULL
-	--------------
-	|  ...
-	--------------
-	|  e[maxsize] - n+1 or NULL (determines actual size of set)
-	--------------
+        --------------
+        |  maxsize
+        --------------
+        |  e[0] - a pointer, may be NULL for indexed sets
+        --------------
+        |  e[1]
 
+        --------------
+        |  ...
+        --------------
+        |  e[n-1]
+        --------------
+        |  e[n] = NULL
+        --------------
+        |  ...
+        --------------
+        |  e[maxsize] - n+1 or NULL (determines actual size of set)
+        --------------
+
 */
 
 /*-- setelemT -- internal type to allow both pointers and indices
@@ -77,38 +81,38 @@
 struct setT {
   int maxsize;          /* maximum number of elements (except NULL) */
   setelemT e[1];        /* array of pointers, tail is NULL */
-                        /* last slot (unless NULL) is actual size+1 
+                        /* last slot (unless NULL) is actual size+1
                            e[maxsize]==NULL or e[e[maxsize]-1]==NULL */
                         /* this may generate a warning since e[] contains
-			   maxsize elements */
+                           maxsize elements */
 };
 
 /*=========== -constants- =========================*/
 
 /*-------------------------------------
-   
+
   SETelemsize
     size of a set element in bytes
 */
-#define SETelemsize sizeof(setelemT) 
+#define SETelemsize ((int)sizeof(setelemT))
 
 
 /*=========== -macros- =========================*/
 
 /*-------------------------------------
-   
+
    FOREACHsetelement_(type, set, variable)
      define FOREACH iterator
 
-   declare:  
+   declare:
      assumes *variable and **variablep are declared
      no space in "variable)" [DEC Alpha cc compiler]
 
    each iteration:
      variable is set element
-     variablep is one beyond variable.  
+     variablep is one beyond variable.
 
    to repeat an element:
      variablep--; / *repeat* /
@@ -116,22 +120,22 @@
    at exit:
      variable is NULL at end of loop
 
-   example:  
+   example:
      #define FOREACHfacet_( facets ) FOREACHsetelement_( facetT, facets, facet )
 
    notes:
      use FOREACHsetelement_i_() if need index or include NULLs
 
-   WARNING: 
+   WARNING:
      nested loops can't use the same variable (define another FOREACH)
-   
+
      needs braces if nested inside another FOREACH
      this includes intervening blocks, e.g. FOREACH...{ if () FOREACH...} )
 */
 #define FOREACHsetelement_(type, set, variable) \
-        if (((variable= NULL), set)) for(\
+        if (((variable= NULL), set)) for (\
           variable##p= (type **)&((set)->e[0].p); \
-	  (variable= *variable##p++);)
+          (variable= *variable##p++);)
 
 /*------------------------------------------
@@ -139,7 +143,7 @@
    FOREACHsetelement_i_(type, set, variable)
      define indexed FOREACH iterator
 
-   declare:  
+   declare:
      type *variable, variable_n, variable_i;
 
    each iteration:
@@ -154,10 +158,10 @@
 
    example:
      #define FOREACHfacet_i_( facets ) FOREACHsetelement_i_( facetT, facets, facet )
-   
-   WARNING: 
+
+   WARNING:
      nested loops can't use the same variable (define another FOREACH)
-   
+
      needs braces if nested inside another FOREACH
      this includes intervening blocks, e.g. FOREACH...{ if () FOREACH...} )
 */
@@ -171,10 +175,10 @@
 /*----------------------------------------
 
-   FOREACHsetelementreverse_(type, set, variable)- 
+   FOREACHsetelementreverse_(type, set, variable)-
      define FOREACH iterator in reverse order
 
-   declare:  
+   declare:
      assumes *variable and **variablep are declared
      also declare 'int variabletemp'
 
@@ -189,36 +193,36 @@
 
    example:
      #define FOREACHvertexreverse_( vertices ) FOREACHsetelementreverse_( vertexT, vertices, vertex )
-  
+
    notes:
      use FOREACHsetelementreverse12_() to reverse first two elements
      WARNING: needs braces if nested inside another FOREACH
 */
 #define FOREACHsetelementreverse_(type, set, variable) \
-        if (((variable= NULL), set)) for(\
-	   variable##temp= qh_setsize(set)-1, variable= qh_setlast(set);\
-	   variable; variable= \
-	   ((--variable##temp >= 0) ? SETelemt_(set, variable##temp, type) : NULL))
+        if (((variable= NULL), set)) for (\
+           variable##temp= qh_setsize(set)-1, variable= qh_setlast(set);\
+           variable; variable= \
+           ((--variable##temp >= 0) ? SETelemt_(set, variable##temp, type) : NULL))
 
 /*-------------------------------------
 
-   FOREACHsetelementreverse12_(type, set, variable)- 
+   FOREACHsetelementreverse12_(type, set, variable)-
      define FOREACH iterator with e[1] and e[0] reversed
 
-   declare:  
+   declare:
      assumes *variable and **variablep are declared
 
    each iteration:
      variable is set element
-     variablep is one after variable.  
+     variablep is one after variable.
 
    to repeat an element:
      variablep--; / *repeat* /
 
    at exit:
      variable is NULL at end of loop
-  
+
    example
      #define FOREACHvertexreverse12_( vertices ) FOREACHsetelementreverse12_( vertexT, vertices, vertex )
 
@@ -226,19 +230,19 @@
      WARNING: needs braces if nested inside another FOREACH
 */
 #define FOREACHsetelementreverse12_(type, set, variable) \
-        if (((variable= NULL), set)) for(\
+        if (((variable= NULL), set)) for (\
           variable##p= (type **)&((set)->e[1].p); \
-	  (variable= *variable##p); \
+          (variable= *variable##p); \
           variable##p == ((type **)&((set)->e[0].p))?variable##p += 2: \
-	      (variable##p == ((type **)&((set)->e[1].p))?variable##p--:variable##p++))
+              (variable##p == ((type **)&((set)->e[1].p))?variable##p--:variable##p++))
 
 /*-------------------------------------
 
-   FOREACHelem_( set )- 
+   FOREACHelem_( set )-
      iterate elements in a set
 
-   declare:  
+   declare:
      void *elem, *elemp;
 
    each iteration:
@@ -250,10 +254,10 @@
 
    at exit:
      elem == NULL at end of loop
-  
+
    example:
      FOREACHelem_(set) {
-     
+
    notes:
      WARNING: needs braces if nested inside another FOREACH
 */
@@ -262,10 +266,10 @@
 /*-------------------------------------
 
-   FOREACHset_( set )- 
+   FOREACHset_( set )-
      iterate a set of sets
 
-   declare:  
+   declare:
      setT *set, **setp;
 
    each iteration:
@@ -277,10 +281,10 @@
 
    at exit:
      set == NULL at end of loop
-  
+
    example
      FOREACHset_(sets) {
-     
+
    notes:
      WARNING: needs braces if nested inside another FOREACH
 */
@@ -292,13 +296,14 @@
    SETindex_( set, elem )
      return index of elem in set
 
-   notes:   
+   notes:
      for use with FOREACH iteration
+     WARN64 -- Maximum set size is 2G
 
    example:
      i= SETindex_(ridges, ridge)
 */
-#define SETindex_(set, elem) ((void **)elem##p - (void **)&(set)->e[1].p)
+#define SETindex_(set, elem) ((int)((void **)elem##p - (void **)&(set)->e[1].p))
 
 /*-----------------------------------------
@@ -316,7 +321,7 @@
 
    SETelem_(set, n)
      return the n'th element of set
-   
+
    notes:
       assumes that n is valid [0..size] and that set is defined
       use SETelemt_() for type cast
@@ -328,7 +333,7 @@
 
    SETelemt_(set, n, type)
      return the n'th element of set as a type
-   
+
    notes:
       assumes that n is valid [0..size] and that set is defined
 */
@@ -339,9 +344,9 @@
 
    SETelemaddr_(set, n, type)
      return address of the n'th element of a set
-   
+
    notes:
-      assumes that n is valid [0..size] and set is defined 
+      assumes that n is valid [0..size] and set is defined
 */
 #define SETelemaddr_(set, n, type) ((type **)(&((set)->e[n].p)))
 
@@ -350,7 +355,7 @@
 
    SETfirst_(set)
      return first element of set
-   
+
 */
 #define SETfirst_(set)             ((set)->e[0].p)
 
@@ -359,7 +364,7 @@
 
    SETfirstt_(set, type)
      return first element of set as a type
-   
+
 */
 #define SETfirstt_(set, type)      ((type*)((set)->e[0].p))
 
@@ -368,7 +373,7 @@
 
    SETsecond_(set)
      return second element of set
-   
+
 */
 #define SETsecond_(set)            ((set)->e[1].p)
 
@@ -386,14 +391,14 @@
    SETaddr_(set, type)
        return address of set's elements
 */
-#define SETaddr_(set,type)	   ((type **)(&((set)->e[0].p)))
+#define SETaddr_(set,type)         ((type **)(&((set)->e[0].p)))
 
 /*-----------------------------------------
 
-   SETreturnsize_(set, size) 
+   SETreturnsize_(set, size)
      return size of a set
-   
+
    notes:
       set must be defined
       use qh_setsize(set) unless speed is critical
@@ -403,14 +408,25 @@
 /*-----------------------------------------
 
-   SETempty_(set) 
-     return true (1) if set is empty
-   
+   SETempty_(set)
+     return true(1) if set is empty
+
    notes:
       set may be NULL
 */
-#define SETempty_(set) 	          (!set || (SETfirst_(set) ? 0:1))
+#define SETempty_(set)            (!set || (SETfirst_(set) ? 0 : 1))
 
+/*---------------------------------
+
+  SETsizeaddr_(set)
+    return pointer to 'actual size+1' of set (set CANNOT be NULL!!)
+
+  notes:
+    *SETsizeaddr==NULL or e[*SETsizeaddr-1].p==NULL
+*/
+#define SETsizeaddr_(set) (&((set)->e[(set)->maxsize].i))
+
 /*-----------------------------------------
 
@@ -419,7 +435,7 @@
 
    see:
      qh_settruncate()
-   
+
 */
 #define SETtruncate_(set, size) {set->e[set->maxsize].i= size+1; /* maybe overwritten */ \
       set->e[size].p= NULL;}
@@ -431,7 +447,7 @@
 void  qh_setappend(setT **setp, void *elem);
 void  qh_setappend_set(setT **setp, setT *setA);
 void  qh_setappend2ndlast(setT **setp, void *elem);
-void  qh_setcheck(setT *set, char *tname, int id);
+void  qh_setcheck(setT *set, const char *tname, unsigned id);
 void  qh_setcompact(setT *set);
 setT *qh_setcopy(setT *set, int extra);
 void *qh_setdel(setT *set, void *elem);
@@ -441,8 +457,8 @@
 void *qh_setdelsorted(setT *set, void *newelem);
 setT *qh_setduplicate( setT *set, int elemsize);
 int   qh_setequal(setT *setA, setT *setB);
-int   qh_setequal_except (setT *setA, void *skipelemA, setT *setB, void *skipelemB);
-int   qh_setequal_skip (setT *setA, int skipA, setT *setB, int skipB);
+int   qh_setequal_except(setT *setA, void *skipelemA, setT *setB, void *skipelemB);
+int   qh_setequal_skip(setT *setA, int skipA, setT *setB, int skipB);
 void  qh_setfree(setT **set);
 void  qh_setfree2( setT **setp, int elemsize);
 void  qh_setfreelong(setT **set);
@@ -452,7 +468,7 @@
 void *qh_setlast(setT *set);
 setT *qh_setnew(int size);
 setT *qh_setnew_delnthsorted(setT *set, int size, int nth, int prepend);
-void  qh_setprint(FILE *fp, char* string, setT *set);
+void  qh_setprint(FILE *fp, const char* string, setT *set);
 void  qh_setreplace(setT *set, void *oldelem, void *newelem);
 int   qh_setsize(setT *set);
 setT *qh_settemp(int setsize);
@@ -460,9 +476,9 @@
 void  qh_settempfree_all(void);
 setT *qh_settemppop(void);
 void  qh_settemppush(setT *set);
-void  qh_settruncate (setT *set, int size);
-int   qh_setunique (setT **set, void *elem);
-void  qh_setzero (setT *set, int index, int size);
+void  qh_settruncate(setT *set, int size);
+int   qh_setunique(setT **set, void *elem);
+void  qh_setzero(setT *set, int idx, int size);
 
 
 #endif /* qhDEFset */

Deleted: trunk/scipy/spatial/qhull/src/qvoronoi.c
===================================================================
--- trunk/scipy/spatial/qhull/src/qvoronoi.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/qvoronoi.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,318 +0,0 @@
-/*
  ---------------------------------
-
-   qvoronoi.c
-     compute Voronoi diagrams and furthest-point Voronoi
-     diagrams using qhull
-
-   see unix.c for full interface
-
-   copyright (c) 1993-2003, The Geometry Center
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-
-#elif __cplusplus
-extern "C" {
-  int isatty (int);
-}
-
-#elif _MSC_VER
-#include 
-#define isatty _isatty
-
-#else
-int isatty (int);  /* returns 1 if stdin is a tty
-		   if "Undefined symbol" this can be deleted along with call in main() */
-#endif
-
-/*---------------------------------
-
-  qh_prompt 
-    long prompt for qhull
-    
-  notes:
-    restricted version of qhull.c
- 
-  see:
-    concise prompt below
-*/  
-
-/* duplicated in qvoron_f.htm and qvoronoi.htm */
-char hidden_options[]=" d n m v H U Qb QB Qc Qf Qg Qi Qm Qr QR Qv Qx TR E V Fa FA FC Fp FS Ft FV Pv Gt Q0 Q1 Q2 Q3 Q4 Q5 Q6 Q7 Q8 Q9 ";
-
-char qh_prompta[]= "\n\
-qvoronoi- compute the Voronoi diagram\n\
-    http://www.qhull.org  %s\n\
-\n\
-input (stdin):\n\
-    first lines: dimension and number of points (or vice-versa).\n\
-    other lines: point coordinates, best if one point per line\n\
-    comments:    start with a non-numeric character\n\
-\n\
-options:\n\
-    Qu   - compute furthest-site Voronoi diagram\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-\n\
-Qhull control options:\n\
-    Qz   - add point-at-infinity to Voronoi diagram\n\
-    QJn  - randomly joggle input in range [-n,n]\n\
-%s%s%s%s";  /* split up qh_prompt for Visual C++ */
-char qh_promptb[]= "\
-    Qs   - search all points for the initial simplex\n\
-    QGn  - Voronoi vertices if visible from point n, -n if not\n\
-    QVn  - Voronoi vertices for input point n, -n if not\n\
-\n\
-";
-char qh_promptc[]= "\
-Trace options:\n\
-    T4   - trace at level n, 4=all, 5=mem/gauss, -1= events\n\
-    Tc   - check frequently during execution\n\
-    Ts   - statistics\n\
-    Tv   - verify result: structure, convexity, and in-circle test\n\
-    Tz   - send all output to stdout\n\
-    TFn  - report summary when n or more facets created\n\
-    TI file - input data from file, no spaces or single quotes\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-    TPn  - turn on tracing when point n added to hull\n\
-     TMn - turn on tracing at merge n\n\
-     TWn - trace merge facets when width > n\n\
-    TVn  - stop qhull after adding point n, -n for before (see TCn)\n\
-     TCn - stop qhull after building cone for point n (see TVn)\n\
-\n\
-Precision options:\n\
-    Cn   - radius of centrum (roundoff added).  Merge facets if non-convex\n\
-     An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex\n\
-           C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\
-    Rn   - randomly perturb computations by a factor of [1-n,1+n]\n\
-    Wn   - min facet width for non-coincident point (before roundoff)\n\
-\n\
-Output formats (may be combined; if none, produces a summary to stdout):\n\
-    s    - summary to stderr\n\
-    p    - Voronoi vertices\n\
-    o    - OFF format (dim, Voronoi vertices, and Voronoi regions)\n\
-    i    - Delaunay regions (use 'Pp' to avoid warning)\n\
-    f    - facet dump\n\
-\n\
-";
-char qh_promptd[]= "\
-More formats:\n\
-    Fc   - count plus coincident points (by Voronoi vertex)\n\
-    Fd   - use cdd format for input (homogeneous with offset first)\n\
-    FD   - use cdd format for output (offset first)\n\
-    FF   - facet dump without ridges\n\
-    Fi   - separating hyperplanes for bounded Voronoi regions\n\
-    FI   - ID for each Voronoi vertex\n\
-    Fm   - merge count for each Voronoi vertex (511 max)\n\
-    Fn   - count plus neighboring Voronoi vertices for each Voronoi vertex\n\
-    FN   - count and Voronoi vertices for each Voronoi region\n\
-    Fo   - separating hyperplanes for unbounded Voronoi regions\n\
-    FO   - options and precision constants\n\
-    FP   - nearest point and distance for each coincident point\n\
-    FQ   - command used for qvoronoi\n\
-    Fs   - summary: #int (8), dimension, #points, tot vertices, tot facets,\n\
-                    for output: #Voronoi regions, #Voronoi vertices,\n\
-                                #coincident points, #non-simplicial regions\n\
-                    #real (2), max outer plane and min vertex\n\
-    Fv   - Voronoi diagram as Voronoi vertices between adjacent input sites\n\
-    Fx   - extreme points of Delaunay triangulation (on convex hull)\n\
-\n\
-";
-char qh_prompte[]= "\
-Geomview options (2-d only)\n\
-    Ga   - all points as dots\n\
-     Gp  -  coplanar points and vertices as radii\n\
-     Gv  -  vertices as spheres\n\
-    Gi   - inner planes only\n\
-     Gn  -  no planes\n\
-     Go  -  outer planes only\n\
-    Gc	 - centrums\n\
-    Gh   - hyperplane intersections\n\
-    Gr   - ridges\n\
-    GDn  - drop dimension n in 3-d and 4-d output\n\
-\n\
-Print options:\n\
-    PAn  - keep n largest Voronoi vertices by 'area'\n\
-    Pdk:n - drop facet if normal[k] <= n (default 0.0)\n\
-    PDk:n - drop facet if normal[k] >= n\n\
-    Pg   - print good Voronoi vertices (needs 'QGn' or 'QVn')\n\
-    PFn  - keep Voronoi vertices whose 'area' is at least n\n\
-    PG   - print neighbors of good Voronoi vertices\n\
-    PMn  - keep n Voronoi vertices with most merges\n\
-    Po   - force output.  If error, output neighborhood of facet\n\
-    Pp   - do not report precision problems\n\
-\n\
-    .    - list of all options\n\
-    -    - one line descriptions of all options\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt2
-    synopsis for qhull 
-*/  
-char qh_prompt2[]= "\n\
-qvoronoi- compute the Voronoi diagram.  Qhull %s\n\
-    input (stdin): dimension, number of points, point coordinates\n\
-    comments start with a non-numeric character\n\
-\n\
-options (qvoronoi.htm):\n\
-    Qu   - compute furthest-site Voronoi diagram\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Tv   - verify result: structure, convexity, and in-circle test\n\
-    .    - concise list of all options\n\
-    -    - one-line description of all options\n\
-\n\
-output options (subset):\n\
-    s    - summary of results (default)\n\
-    p    - Voronoi vertices\n\
-    o    - OFF file format (dim, Voronoi vertices, and Voronoi regions)\n\
-    FN   - count and Voronoi vertices for each Voronoi region\n\
-    Fv   - Voronoi diagram as Voronoi vertices between adjacent input sites\n\
-    Fi   - separating hyperplanes for bounded regions, 'Fo' for unbounded\n\
-    G    - Geomview output (2-d only)\n\
-    QVn  - Voronoi vertices for input point n, -n if not\n\
-    TO file- output results to file, may be enclosed in single quotes\n\
-\n\
-examples:\n\
-rbox c P0 D2 | qvoronoi s o         rbox c P0 D2 | qvoronoi Fi\n\
-rbox c P0 D2 | qvoronoi Fo          rbox c P0 D2 | qvoronoi Fv\n\
-rbox c P0 D2 | qvoronoi s Qu Fv     rbox c P0 D2 | qvoronoi Qu Fo\n\
-rbox c G1 d D2 | qvoronoi s p       rbox c G1 d D2 | qvoronoi QJ s p\n\
-rbox c P0 D2 | qvoronoi s Fv QV0\n\
-\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt3
-    concise prompt for qhull 
-*/  
-char qh_prompt3[]= "\n\
-Qhull %s.\n\
-Except for 'F.' and 'PG', upper-case options take an argument.\n\
-\n\
- OFF_format     p_vertices     i_delaunay     summary        facet_dump\n\
-\n\
- Fcoincident    Fd_cdd_in      FD_cdd_out     FF-dump-xridge Fi_bounded\n\
- Fxtremes       Fmerges        Fneighbors     FNeigh_region  FOptions\n\
- Fo_unbounded   FPoint_near    FQvoronoi      Fsummary       Fvoronoi\n\
- FIDs\n\
-\n\
- Gvertices      Gpoints        Gall_points    Gno_planes     Ginner\n\
- Gcentrums      Ghyperplanes   Gridges        Gouter         GDrop_dim\n\
-\n\
- PArea_keep     Pdrop d0:0D0   Pgood          PFacet_area_keep\n\
- PGood_neighbors PMerge_keep   Poutput_forced Pprecision_not\n\
-\n\
- QG_vertex_good QJoggle        Qsearch_1st    Qtriangulate   Qupper_voronoi\n\
- QV_point_good  Qzinfinite\n\
-\n\
- T4_trace       Tcheck_often   Tstatistics    Tverify        Tz_stdout\n\
- TFacet_log     TInput_file    TPoint_trace   TMerge_trace   TOutput_file\n\
- TWide_trace    TVertex_stop   TCone_stop\n\
-\n\
- Angle_max      Centrum_size   Random_dist    Wide_outside\n\
-";
-
-/*---------------------------------
-  
-  main( argc, argv )
-    processes the command line, calls qhull() to do the work, and exits
-  
-  design:
-    initializes data structures
-    reads points
-    finishes initialization
-    computes convex hull and other structures
-    checks the result
-    writes the output
-    frees memory
-*/
-int main(int argc, char *argv[]) {
-  int curlong, totlong; /* used !qh_NOmem */
-  int exitcode, numpoints, dim;
-  coordT *points;
-  boolT ismalloc;
-
-#if __MWERKS__ && __POWERPC__
-  char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-  SIOUXSettings.showstatusline= false;
-  SIOUXSettings.tabspaces= 1;
-  SIOUXSettings.rows= 40;
-  if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-  || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-  || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0)) 
-    fprintf (stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-  argc= ccommand(&argv);
-#endif
-
-  if ((argc == 1) && isatty( 0 /*stdin*/)) {      
-    fprintf(stdout, qh_prompt2, qh_version);
-    exit(qh_ERRnone);
-  }
-  if (argc > 1 && *argv[1] == '-' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompta, qh_version,
-		qh_promptb, qh_promptc, qh_promptd, qh_prompte);
-    exit(qh_ERRnone);
-  }
-  if (argc >1 && *argv[1] == '.' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompt3, qh_version);
-    exit(qh_ERRnone);
-  }
-  qh_init_A (stdin, stdout, stderr, argc, argv);  /* sets qh qhull_command */
-  exitcode= setjmp (qh errexit); /* simple statement for CRAY J916 */
-  if (!exitcode) {
-    qh_option ("voronoi  _bbound-last  _coplanar-keep", NULL, NULL);
-    qh DELAUNAY= True;     /* 'v'   */
-    qh VORONOI= True; 
-    qh SCALElast= True;    /* 'Qbb' */
-    qh_checkflags (qh qhull_command, hidden_options);
-    qh_initflags (qh qhull_command);
-    points= qh_readpoints (&numpoints, &dim, &ismalloc);
-    if (dim >= 5) {
-      qh_option ("_merge-exact", NULL, NULL);
-      qh MERGEexact= True; /* 'Qx' always */
-    }
-    qh_init_B (points, numpoints, dim, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();
-    if (qh VERIFYoutput && !qh FORCEoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points();
-    exitcode= qh_ERRnone;
-  }
-  qh NOerrexit= True;  /* no more setjmp */
-#ifdef qh_NOmem
-  qh_freeqhull( True);
-#else
-  qh_freeqhull( False);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong) 
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-#endif
-  return exitcode;
-} /* main */
-

Added: trunk/scipy/spatial/qhull/src/random.c
===================================================================
--- trunk/scipy/spatial/qhull/src/random.c	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/random.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,243 @@
+/*
  ---------------------------------
+
+   random.c -- utilities
+     Park & Miller's minimimal standard random number generator
+     argc/argv conversion
+*/
+
+#include "libqhull.h"
+#include 
+#include 
+#include 
+
+#ifdef _MSC_VER  /* Microsoft Visual C++ -- warning level 4 */
+#pragma warning( disable : 4706)  /* assignment within conditional function */
+#pragma warning( disable : 4996)  /* function was declared deprecated(strcpy, localtime, etc.) */
+#endif
+
+/*---------------------------------
+
+ qh_argv_to_command( argc, argv, command, max_size )
+
+    build command from argc/argv
+    max_size is at least
+
+ returns:
+    a space-delimited string of options (just as typed)
+    returns false if max_size is too short
+
+ notes:
+    silently removes
+    makes option string easy to input and output
+    matches qh_argv_to_command_size()
+
+    argc may be 0
+*/
+int qh_argv_to_command(int argc, char *argv[], char* command, int max_size) {
+  int i, remaining;
+  char *s;
+  *command= '\0';  /* max_size > 0 */
+
+  if (argc) {
+    if ((s= strrchr( argv[0], '\\')) /* get filename w/o .exe extension */
+    || (s= strrchr( argv[0], '/')))
+        s++;
+    else
+        s= argv[0];
+    if ((int)strlen(s) < max_size)   /* WARN64 */
+        strcpy(command, s);
+    else
+        goto error_argv;
+    if ((s= strstr(command, ".EXE"))
+    ||  (s= strstr(command, ".exe")))
+        *s= '\0';
+  }
+  for (i=1; i < argc; i++) {
+    s= argv[i];
+    remaining= max_size - (int)strlen(command) - (int)strlen(s) - 2;   /* WARN64 */
+    if (!*s || strchr(s, ' ')) {
+      char *t= command + strlen(command);
+      remaining -= 2;
+      if (remaining < 0) {
+        goto error_argv;
+      }
+      *t++= ' ';
+      *t++= '"';
+      while (*s) {
+        if (*s == '"') {
+          if (--remaining < 0)
+            goto error_argv;
+          *t++= '\\';
+        }
+        *t++= *s++;
+      }
+      *t++= '"';
+      *t= '\0';
+    }else if (remaining < 0) {
+      goto error_argv;
+    }else
+      strcat(command, " ");
+      strcat(command, s);
+  }
+  return 1;
+
+error_argv:
+  qh_fprintf(qh ferr, 6033, "qhull input error: more than %d characters in command line\n",
+      max_size);
+  return 0;
+} /* argv_to_command */
+
+/*---------------------------------
+
+qh_argv_to_command_size( argc, argv )
+
+    return size to allocate for qh_argv_to_command()
+
+notes:
+    argc may be 0
+    actual size is usually shorter
+*/
+int qh_argv_to_command_size(int argc, char *argv[]) {
+    unsigned int count= 1; /* null-terminator if argc==0 */
+    int i;
+    char *s;
+
+    for (i=0; i0 && strchr(argv[i], ' ')) {
+        count += 2;  /* quote delimiters */
+        for (s=argv[i]; *s; s++) {
+          if (*s == '"') {
+            count++;
+          }
+        }
+      }
+    }
+    return count;
+} /* argv_to_command_size */
+
+/*---------------------------------
+
+  qh_rand()
+  qh_srand( seed )
+    generate pseudo-random number between 1 and 2^31 -2
+
+  notes:
+    For qhull and rbox, called from qh_RANDOMint(),etc. [user.h]
+
+    From Park & Miller's minimal standard random number generator
+      Communications of the ACM, 31:1192-1201, 1988.
+    Does not use 0 or 2^31 -1
+      this is silently enforced by qh_srand()
+    Can make 'Rn' much faster by moving qh_rand to qh_distplane
+*/
+
+/* Global variables and constants */
+
+int qh_rand_seed= 1;  /* define as global variable instead of using qh */
+
+#define qh_rand_a 16807
+#define qh_rand_m 2147483647
+#define qh_rand_q 127773  /* m div a */
+#define qh_rand_r 2836    /* m mod a */
+
+int qh_rand( void) {
+    int lo, hi, test;
+    int seed = qh_rand_seed;
+
+    hi = seed / qh_rand_q;  /* seed div q */
+    lo = seed % qh_rand_q;  /* seed mod q */
+    test = qh_rand_a * lo - qh_rand_r * hi;
+    if (test > 0)
+        seed= test;
+    else
+        seed= test + qh_rand_m;
+    qh_rand_seed= seed;
+    /* seed = seed < qh_RANDOMmax/2 ? 0 : qh_RANDOMmax;  for testing */
+    /* seed = qh_RANDOMmax;  for testing */
+    return seed;
+} /* rand */
+
+void qh_srand( int seed) {
+    if (seed < 1)
+        qh_rand_seed= 1;
+    else if (seed >= qh_rand_m)
+        qh_rand_seed= qh_rand_m - 1;
+    else
+        qh_rand_seed= seed;
+} /* qh_srand */
+
+/*---------------------------------
+
+qh_randomfactor( scale, offset )
+return a random factor r * scale + offset
+
+notes:
+qh.RANDOMa/b are defined in global.c
+*/
+realT qh_randomfactor(realT scale, realT offset) {
+    realT randr;
+
+    randr= qh_RANDOMint;
+    return randr * scale + offset;
+} /* randomfactor */
+
+/*---------------------------------
+
+qh_randommatrix( buffer, dim, rows )
+generate a random dim X dim matrix in range [-1,1]
+assumes buffer is [dim+1, dim]
+
+returns:
+sets buffer to random numbers
+sets rows to rows of buffer
+sets row[dim] as scratch row
+*/
+void qh_randommatrix(realT *buffer, int dim, realT **rows) {
+    int i, k;
+    realT **rowi, *coord, realr;
+
+    coord= buffer;
+    rowi= rows;
+    for (i=0; i < dim; i++) {
+        *(rowi++)= coord;
+        for (k=0; k < dim; k++) {
+            realr= qh_RANDOMint;
+            *(coord++)= 2.0 * realr/(qh_RANDOMmax+1) - 1.0;
+        }
+    }
+    *rowi= coord;
+} /* randommatrix */
+
+/*---------------------------------
+
+  qh_strtol( s, endp) qh_strtod( s, endp)
+    internal versions of strtol() and strtod()
+    does not skip trailing spaces
+  notes:
+    some implementations of strtol()/strtod() skip trailing spaces
+*/
+double qh_strtod(const char *s, char **endp) {
+  double result;
+
+  result= strtod(s, endp);
+  if (s < (*endp) && (*endp)[-1] == ' ')
+    (*endp)--;
+  return result;
+} /* strtod */
+
+int qh_strtol(const char *s, char **endp) {
+  int result;
+
+  result= (int) strtol(s, endp, 10);     /* WARN64 */
+  if (s< (*endp) && (*endp)[-1] == ' ')
+    (*endp)--;
+  return result;
+} /* strtol */

Added: trunk/scipy/spatial/qhull/src/random.h
===================================================================
--- trunk/scipy/spatial/qhull/src/random.h	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/random.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,34 @@
+/*
  ---------------------------------
+
+  random.h
+    header file for random routines
+
+   see qh-geom.htm and random.c
+
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/random.h#11 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
+*/
+
+#ifndef qhDEFrandom
+#define qhDEFrandom 1
+
+#include "libqhull.h"
+
+/*============= prototypes in alphabetical order ======= */
+
+
+int     qh_argv_to_command(int argc, char *argv[], char* command, int max_size);
+int     qh_argv_to_command_size(int argc, char *argv[]);
+int     qh_rand( void);
+void    qh_srand( int seed);
+realT   qh_randomfactor(realT scale, realT offset);
+void    qh_randommatrix(realT *buffer, int dim, realT **row);
+int     qh_strtol(const char *s, char **endp);
+double  qh_strtod(const char *s, char **endp);
+
+#endif /* qhDEFrandom */
+
+
+

Deleted: trunk/scipy/spatial/qhull/src/rbox.c
===================================================================
--- trunk/scipy/spatial/qhull/src/rbox.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/rbox.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,788 +0,0 @@
-/*
  ---------------------------------
-
-   rbox.c
-     Generate input points for qhull.
-   
-   notes:
-     50 points generated for 'rbox D4'
-
-     This code needs a full rewrite.  It needs separate procedures for each 
-     distribution with common, helper procedures.
-   
-   WARNING: 
-     incorrect range if qh_RANDOMmax is defined wrong (user.h)
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-
-#include "user.h"
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-#endif
-
-#ifdef _MSC_VER  /* Microsoft Visual C++ */
-#pragma warning( disable : 4244)  /* conversion from double to int */
-#endif
-
-#define MINVALUE 0.8
-#define MAXdim 200
-#define PI 3.1415926535897932384
-#define DEFAULTzbox 1e6
-
-char prompt[]= "\n\
--rbox- generate various point distributions.  Default is random in cube.\n\
-\n\
-args (any order, space separated):                    Version: 2001/06/24\n\
-  3000    number of random points in cube, lens, spiral, sphere or grid\n\
-  D3      dimension 3-d\n\
-  c       add a unit cube to the output ('c G2.0' sets size)\n\
-  d       add a unit diamond to the output ('d G2.0' sets size)\n\
-  l       generate a regular 3-d spiral\n\
-  r       generate a regular polygon, ('r s Z1 G0.1' makes a cone)\n\
-  s       generate cospherical points\n\
-  x       generate random points in simplex, may use 'r' or 'Wn'\n\
-  y       same as 'x', plus simplex\n\
-  Pn,m,r  add point [n,m,r] first, pads with 0\n\
-\n\
-  Ln      lens distribution of radius n.  Also 's', 'r', 'G', 'W'.\n\
-  Mn,m,r  lattice (Mesh) rotated by [n,-m,0], [m,n,0], [0,0,r], ...\n\
-          '27 M1,0,1' is {0,1,2} x {0,1,2} x {0,1,2}.  Try 'M3,4 z'.\n\
-  W0.1    random distribution within 0.1 of the cube's or sphere's surface\n\
-  Z0.5 s  random points in a 0.5 disk projected to a sphere\n\
-  Z0.5 s G0.6 same as Z0.5 within a 0.6 gap\n\
-\n\
-  Bn      bounding box coordinates, default %2.2g\n\
-  h       output as homogeneous coordinates for cdd\n\
-  n       remove command line from the first line of output\n\
-  On      offset coordinates by n\n\
-  t       use time as the random number seed (default is command line)\n\
-  tn      use n as the random number seed\n\
-  z       print integer coordinates, default 'Bn' is %2.2g\n\
-";
-
-/* ------------------------------ prototypes ----------------*/
-int roundi( double a);
-void out1( double a);
-void out2n( double a, double b);
-void out3n( double a, double b, double c);
-int     qh_rand( void);
-void    qh_srand( int seed);
-
-
-/* ------------------------------ globals -------------------*/
-
-    FILE *fp;
-    int isinteger= 0;
-    double out_offset= 0.0;
-
-
-/*--------------------------------------------
--rbox-  main procedure of rbox application
-*/
-int main(int argc, char **argv) {
-    int i,j,k;
-    int gendim;
-    int cubesize, diamondsize, seed=0, count, apex;
-    int dim=3 , numpoints= 0, totpoints, addpoints=0;
-    int issphere=0, isaxis=0,  iscdd= 0, islens= 0, isregular=0, iswidth=0, addcube=0;
-    int isgap=0, isspiral=0, NOcommand= 0, adddiamond=0, istime=0;
-    int isbox=0, issimplex=0, issimplex2=0, ismesh=0;
-    double width=0.0, gap=0.0, radius= 0.0;
-    double coord[MAXdim], offset, meshm=3.0, meshn=4.0, meshr=5.0;
-    double *simplex, *simplexp;
-    int nthroot, mult[MAXdim];
-    double norm, factor, randr, rangap, lensangle= 0, lensbase= 1;
-    double anglediff, angle, x, y, cube= 0.0, diamond= 0.0;
-    double box= qh_DEFAULTbox; /* scale all numbers before output */
-    double randmax= qh_RANDOMmax;
-    char command[200], *s, seedbuf[200];    
-    time_t timedata;
-
-#if __MWERKS__ && __POWERPC__
-    char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-    SIOUXSettings.showstatusline= False;
-    SIOUXSettings.tabspaces= 1;
-    SIOUXSettings.rows= 40;
-    if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-    || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-    || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0)) 
-      	fprintf ( stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-    argc= ccommand(&argv);
-#endif
-    if (argc == 1) {
- 	printf (prompt, box, DEFAULTzbox);
-    	exit(1);
-    }
-    if ((s = strrchr( argv[0], '\\'))) /* Borland gives full path */
-      strcpy (command, s+1);
-    else
-      strcpy (command, argv[0]);
-    if ((s= strstr (command, ".EXE"))
-    ||  (s= strstr (command, ".exe")))
-      *s= '\0';
-    /* ============= read flags =============== */
-    for (i=1; i < argc; i++) {
-  	if (strlen (command) + strlen(argv[i]) + 1 < sizeof(command) ) {
-	    strcat (command, " ");
-	    strcat (command, argv[i]);
-	}
-        if (isdigit (argv[i][0])) {
-      	    numpoints= atoi (argv[i]);
-      	    continue;
-	}
-	if (argv[i][0] == '-')
-	  (argv[i])++;
-        switch (argv[i][0]) {
-	  case 'c':
-	    addcube= 1;
-	    if (i+1 < argc && argv[i+1][0] == 'G')
-	      cube= (double) atof (&argv[++i][1]);
-	    break;
-	  case 'd':
-	    adddiamond= 1;
-	    if (i+1 < argc && argv[i+1][0] == 'G')
-	      diamond= (double) atof (&argv[++i][1]);
-	    break;
-	  case 'h':
-	    iscdd= 1;
-            break;
-	  case 'l':
-	    isspiral= 1;
-            break;
-	  case 'n':
-	    NOcommand= 1;
-	    break;
-	  case 'r':
-	    isregular= 1;
-	    break;
-	  case 's':
-	    issphere= 1;
-            break;
-	  case 't':
-	    istime= 1;
-	    if (isdigit (argv[i][1]))
-	      seed= atoi (&argv[i][1]);
-	    else {
-	      seed= time (&timedata);
-	      sprintf (seedbuf, "%d", seed);
-	      strcat (command, seedbuf);
-	    }
-            break;
-	  case 'x':
-	    issimplex= 1;
-	    break;
-	  case 'y':
-	    issimplex2= 1;
-	    break;
-	  case 'z':
-	    isinteger= 1;
-	    break;
-	  case 'B':
-	    box= (double) atof (&argv[i][1]);
-	    isbox= 1;
-	    break;
-	  case 'D':
-	    dim= atoi (&argv[i][1]);
-	    if (dim < 1
-	    || dim > MAXdim) {
-		fprintf (stderr, "rbox error: dim %d too large or too small\n", dim);
-		exit (1);
-	    }
-            break;
-	  case 'G':
-	    if (argv[i][1])
-	      gap= (double) atof (&argv[i][1]);
-	    else
-	      gap= 0.5;
-	    isgap= 1;
-	    break;
-	  case 'L':
-	    if (argv[i][1])
-	      radius= (double) atof (&argv[i][1]);
-	    else
-	      radius= 10;
-	    islens= 1;
-	    break;
-	  case 'M':
-	    ismesh= 1;
-    	    s= argv[i]+1;
-	    if (*s)
-	      meshn= strtod (s, &s);
-	    if (*s == ',')
-	      meshm= strtod (++s, &s);
-	    else
-	      meshm= 0.0;
-	    if (*s == ',')
-	      meshr= strtod (++s, &s);
-	    else
-	      meshr= sqrt (meshn*meshn + meshm*meshm);
-	    if (*s) {
-	      fprintf (stderr, "rbox warning: assuming 'M3,4,5' since mesh args are not integers or reals\n");
-	      meshn= 3.0, meshm=4.0, meshr=5.0;
-	    }
-	    break;
-	  case 'O':
-	    out_offset= (double) atof (&argv[i][1]);
-	    break;
-	  case 'P':
-	    addpoints++;
-	    break;
-	  case 'W':
-	    width= (double) atof (&argv[i][1]);
-	    iswidth= 1;
-	    break;
-	  case 'Z':
-	    if (argv[i][1])
-	      radius= (double) atof (&argv[i][1]);
-	    else
-	      radius= 1.0;
-	    isaxis= 1;
-	    break;
-	  default:
-            fprintf (stderr, "rbox warning: unknown flag %s.\nExecute 'rbox' without arguments for documentation.\n", argv[i]);
-	}
-    }
-    /* ============= defaults, constants, and sizes =============== */
-    if (isinteger && !isbox)
-      box= DEFAULTzbox;
-    if (addcube) {
-      cubesize= floor(ldexp(1.0,dim)+0.5);
-      if (cube == 0.0)
-        cube= box;
-    }else
-      cubesize= 0;
-    if (adddiamond) {
-      diamondsize= 2*dim;
-      if (diamond == 0.0)
-        diamond= box;
-    }else
-      diamondsize= 0;
-    if (islens) {
-      if (isaxis) {
-  	fprintf (stderr, "rbox error: can not combine 'Ln' with 'Zn'\n");
-  	exit(1);
-      }
-      if (radius <= 1.0) {
-  	fprintf (stderr, "rbox error: lens radius %.2g should be greater than 1.0\n",
-  	       radius);
-  	exit(1);
-      }
-      lensangle= asin (1.0/radius);
-      lensbase= radius * cos (lensangle);
-    }
-    if (!numpoints) {
-      if (issimplex2)
-	; /* ok */
-      else if (isregular + issimplex + islens + issphere + isaxis + isspiral + iswidth + ismesh) {
-	fprintf (stderr, "rbox error: missing count\n");
-	exit(1);
-      }else if (adddiamond + addcube + addpoints)
-	; /* ok */
-      else { 
-	numpoints= 50;  /* ./rbox D4 is the test case */
-	issphere= 1;
-      }
-    }
-    if ((issimplex + islens + isspiral + ismesh > 1) 
-    || (issimplex + issphere + isspiral + ismesh > 1)) {
-      fprintf (stderr, "rbox error: can only specify one of 'l', 's', 'x', 'Ln', or 'Mn,m,r' ('Ln s' is ok).\n");
-      exit(1);
-    }
-    fp= stdout;
-    /* ============= print header with total points =============== */
-    if (issimplex || ismesh)
-      totpoints= numpoints;
-    else if (issimplex2)
-      totpoints= numpoints+dim+1;
-    else if (isregular) {
-      totpoints= numpoints;
-      if (dim == 2) {
-      	if (islens)
-      	  totpoints += numpoints - 2;
-      }else if (dim == 3) {
-      	if (islens)
-      	  totpoints += 2 * numpoints;
-        else if (isgap)
-          totpoints += 1 + numpoints;
-        else
-          totpoints += 2;
-      }
-    }else
-      totpoints= numpoints + isaxis;
-    totpoints += cubesize + diamondsize + addpoints;
-    if (iscdd) 
-      fprintf(fp, "%s\nbegin\n        %d %d %s\n", 
-            NOcommand ? "" : command, 
-            totpoints, dim+1,
-            isinteger ? "integer" : "real");
-    else if (NOcommand)
-      fprintf(fp,  "%d\n%d\n", dim, totpoints);
-    else
-      fprintf(fp,  "%d %s\n%d\n", dim, command, totpoints);
-    /* ============= seed randoms =============== */
-    if (istime == 0) {
-      for (s=command; *s; s++) {
-	if (issimplex2 && *s == 'y') /* make 'y' same seed as 'x' */
-	  i= 'x';
-	else
-	  i= *s;
-	seed= 11*seed + i;
-      }
-    } /* else, seed explicitly set to n or to time */
-    qh_RANDOMseed_(seed);
-    /* ============= explicit points =============== */
-    for (i=1; i < argc; i++) {
-      if (argv[i][0] == 'P') {
-	s= argv[i]+1;
-	count= 0;
-	if (iscdd)
-	  out1( 1.0);
-	while (*s) {
-	  out1( strtod (s, &s));
-	  count++;
-	  if (*s) { 
-	    if (*s++ != ',') {
-	      fprintf (stderr, "rbox error: missing comma after coordinate in %s\n\n", argv[i]);
-	      exit (1);
-	    }
-          }
-	}
-	if (count < dim) {
-	  for (k= dim-count; k--; )
-	    out1( 0.0);
-	}else if (count > dim) {
-	  fprintf (stderr, "rbox error: %d coordinates instead of %d coordinates in %s\n\n", 
-                 count, dim, argv[i]);
-	  exit (1);
-	}
-	fprintf (fp, "\n");
-      }
-    }
-    /* ============= simplex distribution =============== */
-    if (issimplex+issimplex2) {
-      if (!(simplex= malloc( dim * (dim+1) * sizeof(double)))) {
-	fprintf (stderr, "insufficient memory for simplex\n");
-	exit(0);
-      }
-      simplexp= simplex;
-      if (isregular) {
-        for (i= 0; i randmax/2)
-	    coord[dim-1]= -coord[dim-1];
-	/* ============= project 'Wn' point toward boundary =============== */
-	}else if (iswidth && !issphere) {
-	  j= qh_RANDOMint % gendim;
-	  if (coord[j] < 0)
-	    coord[j]= -1.0 - coord[j] * width;
-	  else
-	    coord[j]= 1.0 - coord[j] * width;
-	}
-	/* ============= write point =============== */
-	if (iscdd)
-	  out1( 1.0);
-	for (k=0; k < dim; k++) 
-	  out1( coord[k] * box);
-	fprintf (fp, "\n");
-      }
-    }
-    /* ============= write cube vertices =============== */
-    if (addcube) {
-      for (j=0; j=0; k--) {
-	  if (j & ( 1 << k))
-	    out1( cube);
-	  else
-	    out1( -cube);
-	}
-	fprintf (fp, "\n");
-      }
-    }
-    /* ============= write diamond vertices =============== */
-    if (adddiamond) {
-      for (j=0; j=0; k--) {
-	  if (j/2 != k)
-	    out1( 0.0);
-	  else if (j & 0x1)
-	    out1( diamond);
-	  else
-	    out1( -diamond);
-	}
-	fprintf (fp, "\n");
-      }
-    }
-    if (iscdd)
-      fprintf (fp, "end\nhull\n");
-    return 0;
-  } /* rbox */
-
-/*------------------------------------------------
--outxxx - output functions
-*/
-int roundi( double a) {
-  if (a < 0.0) {
-    if (a - 0.5 < INT_MIN) {
-      fprintf(stderr, "rbox input error: coordinate %2.2g is too large.  Reduce 'Bn'\n", a);
-      exit (1);
-    }
-    return a - 0.5;
-  }else {
-    if (a + 0.5 > INT_MAX) {
-      fprintf(stderr, "rbox input error: coordinate %2.2g is too large.  Reduce 'Bn'\n", a);
-      exit (1);
-    }
-    return a + 0.5;
-  }
-} /* roundi */
-
-void out1(double a) {
-
-  if (isinteger) 
-    fprintf(fp, "%d ", roundi( a+out_offset));
-  else
-    fprintf(fp, qh_REAL_1, a+out_offset);
-} /* out1 */
-
-void out2n( double a, double b) {
-
-  if (isinteger)
-    fprintf(fp, "%d %d\n", roundi(a+out_offset), roundi(b+out_offset));
-  else
-    fprintf(fp, qh_REAL_2n, a+out_offset, b+out_offset);
-} /* out2n */
-
-void out3n( double a, double b, double c) { 
-
-  if (isinteger)
-    fprintf(fp, "%d %d %d\n", roundi(a+out_offset), roundi(b+out_offset), roundi(c+out_offset));
-  else
-    fprintf(fp, qh_REAL_3n, a+out_offset, b+out_offset, c+out_offset);
-} /* out3n */
-
-/*-------------------------------------------------
--rand & srand- generate pseudo-random number between 1 and 2^31 -2
-  from Park & Miller's minimimal standard random number generator
-  Communications of the ACM, 31:1192-1201, 1988.
-notes:
-  does not use 0 or 2^31 -1
-  this is silently enforced by qh_srand()
-  copied from geom2.c
-*/
-static int seed = 1;  /* global static */
-
-int qh_rand( void) {
-#define qh_rand_a 16807
-#define qh_rand_m 2147483647
-#define qh_rand_q 127773  /* m div a */
-#define qh_rand_r 2836    /* m mod a */
-  int lo, hi, test;
-
-  hi = seed / qh_rand_q;  /* seed div q */
-  lo = seed % qh_rand_q;  /* seed mod q */
-  test = qh_rand_a * lo - qh_rand_r * hi;
-  if (test > 0)
-    seed= test;
-  else
-    seed= test + qh_rand_m;
-  return seed;
-} /* rand */
-
-void qh_srand( int newseed) {
-  if (newseed < 1)
-    seed= 1;
-  else if (newseed >= qh_rand_m)
-    seed= qh_rand_m - 1;
-  else
-    seed= newseed;
-} /* qh_srand */
-

Added: trunk/scipy/spatial/qhull/src/rboxlib.c
===================================================================
--- trunk/scipy/spatial/qhull/src/rboxlib.c	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/rboxlib.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,794 @@
+/*
  ---------------------------------
+
+   rboxlib.c
+     Generate input points
+
+   notes:
+     For documentation, see prompt[] of rbox.c
+     50 points generated for 'rbox D4'
+
+   WARNING:
+     incorrect range if qh_RANDOMmax is defined wrong (user.h)
+*/
+
+#include "random.h"
+#include "libqhull.h"
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#ifdef _MSC_VER  /* Microsoft Visual C++ */
+#pragma warning( disable : 4706)  /* assignment within conditional expression. */
+#pragma warning( disable : 4996)  /* this function (strncat) or variable may be unsafe. */
+#endif
+
+#define MAXdim 200
+#define PI 3.1415926535897932384
+
+/* ------------------------------ prototypes ----------------*/
+int roundi( double a);
+void out1( double a);
+void out2n( double a, double b);
+void out3n( double a, double b, double c);
+
+void    qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... );
+void    qh_free(void *mem);
+void   *qh_malloc(size_t size);
+int     qh_rand( void);
+void    qh_srand( int seed);
+
+
+/* ------------------------------ globals -------------------*/
+
+/* No state is carried between rbox requests */
+typedef struct rboxT rboxT;
+struct rboxT {
+  FILE *fout;
+  FILE *ferr;
+  int isinteger;
+  double out_offset;
+  jmp_buf errexit;        /* exit label for rboxpoints, defined by setjmp(), called by qh_errexit_rbox() */
+};
+
+
+int rbox_inuse= 0;
+rboxT rbox;
+
+/*---------------------------------
+
+  qh_rboxpoints( fout, ferr, rbox_command )
+    Generate points to fout according to rbox options
+    Report errors on ferr
+
+  returns:
+    0 (qh_ERRnone) on success
+    1 (qh_ERRinput) on input error
+    4 (qh_ERRmem) on memory error
+    5 (qh_ERRqhull) on internal error
+
+  notes:
+    To avoid stdio, redefine qh_malloc, qh_free, and qh_fprintf_rbox (user.c)
+
+  design:
+    Straight line code (consider defining a struct and functions):
+
+    Parse arguments into variables
+    Determine the number of points
+    Generate the points
+*/
+int qh_rboxpoints(FILE* fout, FILE* ferr, char* rbox_command) {
+  int i,j,k;
+  int gendim;
+  int cubesize, diamondsize, seed=0, count, apex;
+  int dim=3 , numpoints= 0, totpoints, addpoints=0;
+  int issphere=0, isaxis=0,  iscdd= 0, islens= 0, isregular=0, iswidth=0, addcube=0;
+  int isgap=0, isspiral=0, NOcommand= 0, adddiamond=0;
+  int israndom=0, istime=0;
+  int isbox=0, issimplex=0, issimplex2=0, ismesh=0;
+  double width=0.0, gap=0.0, radius= 0.0;
+  double coord[MAXdim], offset, meshm=3.0, meshn=4.0, meshr=5.0;
+  double *simplex= NULL, *simplexp;
+  int nthroot, mult[MAXdim];
+  double norm, factor, randr, rangap, lensangle= 0, lensbase= 1;
+  double anglediff, angle, x, y, cube= 0.0, diamond= 0.0;
+  double box= qh_DEFAULTbox; /* scale all numbers before output */
+  double randmax= qh_RANDOMmax;
+  char command[200], seedbuf[200];
+  char *s= command, *t, *first_point= NULL;
+  time_t timedata;
+  int exitcode;
+
+  if (rbox_inuse) {
+    qh_fprintf_rbox(rbox.ferr, 6188, "rbox error: rbox in use by another process.  Please lock calls to rbox.\n");
+    return qh_ERRqhull;
+  }
+  rbox_inuse= True;
+  rbox.ferr= ferr;
+  rbox.fout= fout;
+
+  exitcode= setjmp(rbox.errexit);
+  if (exitcode) {
+    /* same code for error exit and normal return */
+    if (simplex)
+        qh_free(simplex);
+    rbox_inuse= False;
+    return exitcode;
+  }
+
+  *command= '\0';
+  strncat(command, rbox_command, sizeof(command));
+
+  while (*s && !isspace(*s))  /* skip program name */
+    s++;
+  while (*s) {
+    while (*s && isspace(*s))
+      s++;
+    if (*s == '-')
+      s++;
+    if (!*s)
+      break;
+    if (isdigit(*s)) {
+      numpoints= qh_strtol(s, &s);
+      continue;
+    }
+    /* ============= read flags =============== */
+    switch (*s++) {
+    case 'c':
+      addcube= 1;
+      t= s;
+      while (isspace(*t))
+        t++;
+      if (*t == 'G')
+        cube= qh_strtod(++t, &s);
+      break;
+    case 'd':
+      adddiamond= 1;
+      t= s;
+      while (isspace(*t))
+        t++;
+      if (*t == 'G')
+        diamond= qh_strtod(++t, &s);
+      break;
+    case 'h':
+      iscdd= 1;
+      break;
+    case 'l':
+      isspiral= 1;
+      break;
+    case 'n':
+      NOcommand= 1;
+      break;
+    case 'r':
+      isregular= 1;
+      break;
+    case 's':
+      issphere= 1;
+      break;
+    case 't':
+      istime= 1;
+      if (isdigit(*s)) {
+        seed= qh_strtol(s, &s);
+        israndom= 0;
+      }else
+        israndom= 1;
+      break;
+    case 'x':
+      issimplex= 1;
+      break;
+    case 'y':
+      issimplex2= 1;
+      break;
+    case 'z':
+      rbox.isinteger= 1;
+      break;
+    case 'B':
+      box= qh_strtod(s, &s);
+      isbox= 1;
+      break;
+    case 'D':
+      dim= qh_strtol(s, &s);
+      if (dim < 1
+      || dim > MAXdim) {
+        qh_fprintf_rbox(rbox.ferr, 6189, "rbox error: dimension, D%d, out of bounds (>=%d or <=0)", dim, MAXdim);
+        qh_errexit_rbox(qh_ERRinput);
+      }
+      break;
+    case 'G':
+      if (isdigit(*s))
+        gap= qh_strtod(s, &s);
+      else
+        gap= 0.5;
+      isgap= 1;
+      break;
+    case 'L':
+      if (isdigit(*s))
+        radius= qh_strtod(s, &s);
+      else
+        radius= 10;
+      islens= 1;
+      break;
+    case 'M':
+      ismesh= 1;
+      if (*s)
+        meshn= qh_strtod(s, &s);
+      if (*s == ',') {
+        ++s;
+        meshm= qh_strtod(s, &s);
+      }else
+        meshm= 0.0;
+      if (*s == ',') {
+        ++s;
+        meshr= qh_strtod(s, &s);
+      }else
+        meshr= sqrt(meshn*meshn + meshm*meshm);
+      if (*s && !isspace(*s)) {
+        qh_fprintf_rbox(rbox.ferr, 7069, "rbox warning: assuming 'M3,4,5' since mesh args are not integers or reals\n");
+        meshn= 3.0, meshm=4.0, meshr=5.0;
+      }
+      break;
+    case 'O':
+      rbox.out_offset= qh_strtod(s, &s);
+      break;
+    case 'P':
+      if (!first_point)
+        first_point= s-1;
+      addpoints++;
+      while (*s && !isspace(*s))   /* read points later */
+        s++;
+      break;
+    case 'W':
+      width= qh_strtod(s, &s);
+      iswidth= 1;
+      break;
+    case 'Z':
+      if (isdigit(*s))
+        radius= qh_strtod(s, &s);
+      else
+        radius= 1.0;
+      isaxis= 1;
+      break;
+    default:
+      qh_fprintf_rbox(rbox.ferr, 7070, "rbox error: unknown flag at %s.\nExecute 'rbox' without arguments for documentation.\n", s);
+      qh_errexit_rbox(qh_ERRinput);
+    }
+    if (*s && !isspace(*s)) {
+      qh_fprintf_rbox(rbox.ferr, 7071, "rbox error: missing space between flags at %s.\n", s);
+      qh_errexit_rbox(qh_ERRinput);
+    }
+  }
+
+  /* ============= defaults, constants, and sizes =============== */
+  if (rbox.isinteger && !isbox)
+    box= qh_DEFAULTzbox;
+  if (addcube) {
+    cubesize= (int)floor(ldexp(1.0,dim)+0.5);
+    if (cube == 0.0)
+      cube= box;
+  }else
+    cubesize= 0;
+  if (adddiamond) {
+    diamondsize= 2*dim;
+    if (diamond == 0.0)
+      diamond= box;
+  }else
+    diamondsize= 0;
+  if (islens) {
+    if (isaxis) {
+        qh_fprintf_rbox(rbox.ferr, 6190, "rbox error: can not combine 'Ln' with 'Zn'\n");
+        qh_errexit_rbox(qh_ERRinput);
+    }
+    if (radius <= 1.0) {
+        qh_fprintf_rbox(rbox.ferr, 6191, "rbox error: lens radius %.2g should be greater than 1.0\n",
+               radius);
+        qh_errexit_rbox(qh_ERRinput);
+    }
+    lensangle= asin(1.0/radius);
+    lensbase= radius * cos(lensangle);
+  }
+
+  if (!numpoints) {
+    if (issimplex2)
+        ; /* ok */
+    else if (isregular + issimplex + islens + issphere + isaxis + isspiral + iswidth + ismesh) {
+        qh_fprintf_rbox(rbox.ferr, 6192, "rbox error: missing count\n");
+        qh_errexit_rbox(qh_ERRinput);
+    }else if (adddiamond + addcube + addpoints)
+        ; /* ok */
+    else {
+        numpoints= 50;  /* ./rbox D4 is the test case */
+        issphere= 1;
+    }
+  }
+  if ((issimplex + islens + isspiral + ismesh > 1)
+  || (issimplex + issphere + isspiral + ismesh > 1)) {
+    qh_fprintf_rbox(rbox.ferr, 6193, "rbox error: can only specify one of 'l', 's', 'x', 'Ln', or 'Mn,m,r' ('Ln s' is ok).\n");
+    qh_errexit_rbox(qh_ERRinput);
+  }
+
+  /* ============= print header with total points =============== */
+  if (issimplex || ismesh)
+    totpoints= numpoints;
+  else if (issimplex2)
+    totpoints= numpoints+dim+1;
+  else if (isregular) {
+    totpoints= numpoints;
+    if (dim == 2) {
+        if (islens)
+          totpoints += numpoints - 2;
+    }else if (dim == 3) {
+        if (islens)
+          totpoints += 2 * numpoints;
+      else if (isgap)
+        totpoints += 1 + numpoints;
+      else
+        totpoints += 2;
+    }
+  }else
+    totpoints= numpoints + isaxis;
+  totpoints += cubesize + diamondsize + addpoints;
+
+  /* ============= seed randoms =============== */
+  if (istime == 0) {
+    for (s=command; *s; s++) {
+      if (issimplex2 && *s == 'y') /* make 'y' same seed as 'x' */
+        i= 'x';
+      else
+        i= *s;
+      seed= 11*seed + i;
+    }
+  }else if (israndom) {
+    seed= (int)time(&timedata);
+    sprintf(seedbuf, " t%d", seed);  /* appends an extra t, not worth removing */
+    strncat(command, seedbuf, sizeof(command));
+    t= strstr(command, " t ");
+    if (t)
+      strcpy(t+1, t+3); /* remove " t " */
+  } /* else, seed explicitly set to n */
+  qh_RANDOMseed_(seed);
+
+  /* ============= print header =============== */
+
+  if (iscdd)
+      qh_fprintf_rbox(rbox.fout, 9391, "%s\nbegin\n        %d %d %s\n",
+      NOcommand ? "" : command,
+      totpoints, dim+1,
+      rbox.isinteger ? "integer" : "real");
+  else if (NOcommand)
+      qh_fprintf_rbox(rbox.fout, 9392, "%d\n%d\n", dim, totpoints);
+  else
+      qh_fprintf_rbox(rbox.fout, 9393, "%d %s\n%d\n", dim, command, totpoints);
+
+  /* ============= explicit points =============== */
+  if ((s= first_point)) {
+    while (s && *s) { /* 'P' */
+      count= 0;
+      if (iscdd)
+        out1( 1.0);
+      while (*++s) {
+        out1( qh_strtod(s, &s));
+        count++;
+        if (isspace(*s) || !*s)
+          break;
+        if (*s != ',') {
+          qh_fprintf_rbox(rbox.ferr, 6194, "rbox error: missing comma after coordinate in %s\n\n", s);
+          qh_errexit_rbox(qh_ERRinput);
+        }
+      }
+      if (count < dim) {
+        for (k=dim-count; k--; )
+          out1( 0.0);
+      }else if (count > dim) {
+        qh_fprintf_rbox(rbox.ferr, 6195, "rbox error: %d coordinates instead of %d coordinates in %s\n\n",
+                  count, dim, s);
+        qh_errexit_rbox(qh_ERRinput);
+      }
+      qh_fprintf_rbox(rbox.fout, 9394, "\n");
+      while ((s= strchr(s, 'P'))) {
+        if (isspace(s[-1]))
+          break;
+      }
+    }
+  }
+
+  /* ============= simplex distribution =============== */
+  if (issimplex+issimplex2) {
+    if (!(simplex= (double*)qh_malloc( dim * (dim+1) * sizeof(double)))) {
+      qh_fprintf_rbox(rbox.ferr, 6196, "rbox error: insufficient memory for simplex\n");
+      qh_errexit_rbox(qh_ERRmem); /* qh_ERRmem */
+    }
+    simplexp= simplex;
+    if (isregular) {
+      for (i=0; i randmax/2)
+          coord[dim-1]= -coord[dim-1];
+      /* ============= project 'Wn' point toward boundary =============== */
+      }else if (iswidth && !issphere) {
+        j= qh_RANDOMint % gendim;
+        if (coord[j] < 0)
+          coord[j]= -1.0 - coord[j] * width;
+        else
+          coord[j]= 1.0 - coord[j] * width;
+      }
+      /* ============= write point =============== */
+      if (iscdd)
+        out1( 1.0);
+      for (k=0; k < dim; k++)
+        out1( coord[k] * box);
+      qh_fprintf_rbox(rbox.fout, 9399, "\n");
+    }
+  }
+
+  /* ============= write cube vertices =============== */
+  if (addcube) {
+    for (j=0; j=0; k--) {
+        if (j & ( 1 << k))
+          out1( cube);
+        else
+          out1( -cube);
+      }
+      qh_fprintf_rbox(rbox.fout, 9400, "\n");
+    }
+  }
+
+  /* ============= write diamond vertices =============== */
+  if (adddiamond) {
+    for (j=0; j=0; k--) {
+        if (j/2 != k)
+          out1( 0.0);
+        else if (j & 0x1)
+          out1( diamond);
+        else
+          out1( -diamond);
+      }
+      qh_fprintf_rbox(rbox.fout, 9401, "\n");
+    }
+  }
+
+  if (iscdd)
+    qh_fprintf_rbox(rbox.fout, 9402, "end\nhull\n");
+
+  /* same code for error exit and normal return */
+  if (simplex)
+    qh_free(simplex);
+  rbox_inuse= False;
+  return qh_ERRnone;
+} /* rboxpoints */
+
+/*------------------------------------------------
+outxxx - output functions
+*/
+int roundi( double a) {
+  if (a < 0.0) {
+    if (a - 0.5 < INT_MIN) {
+      qh_fprintf_rbox(rbox.ferr, 6200, "rbox input error: negative coordinate %2.2g is too large.  Reduce 'Bn'\n", a);
+      qh_errexit_rbox(qh_ERRinput);
+    }
+    return (int)(a - 0.5);
+  }else {
+    if (a + 0.5 > INT_MAX) {
+      qh_fprintf_rbox(rbox.ferr, 6201, "rbox input error: coordinate %2.2g is too large.  Reduce 'Bn'\n", a);
+      qh_errexit_rbox(qh_ERRinput);
+    }
+    return (int)(a + 0.5);
+  }
+} /* roundi */
+
+void out1(double a) {
+
+  if (rbox.isinteger)
+    qh_fprintf_rbox(rbox.fout, 9403, "%d ", roundi( a+rbox.out_offset));
+  else
+    qh_fprintf_rbox(rbox.fout, 9404, qh_REAL_1, a+rbox.out_offset);
+} /* out1 */
+
+void out2n( double a, double b) {
+
+  if (rbox.isinteger)
+    qh_fprintf_rbox(rbox.fout, 9405, "%d %d\n", roundi(a+rbox.out_offset), roundi(b+rbox.out_offset));
+  else
+    qh_fprintf_rbox(rbox.fout, 9406, qh_REAL_2n, a+rbox.out_offset, b+rbox.out_offset);
+} /* out2n */
+
+void out3n( double a, double b, double c) {
+
+  if (rbox.isinteger)
+    qh_fprintf_rbox(rbox.fout, 9407, "%d %d %d\n", roundi(a+rbox.out_offset), roundi(b+rbox.out_offset), roundi(c+rbox.out_offset));
+  else
+    qh_fprintf_rbox(rbox.fout, 9408, qh_REAL_3n, a+rbox.out_offset, b+rbox.out_offset, c+rbox.out_offset);
+} /* out3n */
+
+void qh_errexit_rbox(int exitcode)
+{
+    longjmp(rbox.errexit, exitcode);
+} /* rbox_errexit */
+

Modified: trunk/scipy/spatial/qhull/src/stat.c
===================================================================
--- trunk/scipy/spatial/qhull/src/stat.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/stat.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,12 +1,14 @@
 /*
  ---------------------------------
 
-   stat.c 
+   stat.c
    contains all statistics that are collected for qhull
 
    see qh-stat.htm and stat.h
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/stat.c#28 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 */
 
 #include "qhull_a.h"
@@ -23,7 +25,7 @@
 
 /*---------------------------------
-  
+
   qh_allstatA()
     define statistics in groups of 20
 
@@ -31,12 +33,12 @@
     (otherwise, 'gcc -O2' uses too much memory)
     uses qhstat.next
 */
-void qh_allstatA (void) {
-  
+void qh_allstatA(void) {
+
    /* zdef_(type,name,doc,average) */
   zzdef_(zdoc, Zdoc2, "precision statistics", -1);
   zdef_(zinc, Znewvertex, NULL, -1);
-  zdef_(wadd, Wnewvertex, "ave. distance of a new vertex to a facet (not 0s)", Znewvertex);
+  zdef_(wadd, Wnewvertex, "ave. distance of a new vertex to a facet(!0s)", Znewvertex);
   zzdef_(wmax, Wnewvertexmax, "max. distance of a new vertex to a facet", -1);
   zdef_(wmax, Wvertexmax, "max. distance of an output vertex to a facet", -1);
   zdef_(wmin, Wvertexmin, "min. distance of an output vertex to a facet", -1);
@@ -55,7 +57,7 @@
   zzdef_(zinc, Zgauss0, "zero divisors during gaussian elimination", -1);
   zzdef_(zinc, Zmultiridge, "ridges with multiple neighbors", -1);
 }
-void qh_allstatB (void) {
+void qh_allstatB(void) {
   zzdef_(zdoc, Zdoc1, "summary information", -1);
   zdef_(zinc, Zvertices, "number of vertices in output", -1);
   zdef_(zinc, Znumfacets, "number of facets in output", -1);
@@ -75,17 +77,17 @@
   zzdef_(zinc, Zsetplane, "facets created altogether", -1);
   zdef_(zinc, Ztotridges, "ridges created altogether", -1);
   zdef_(zinc, Zpostfacets, "facets before post merge", -1);
-  zdef_(zadd, Znummergetot, "average merges per facet (at most 511)", Znumfacets);
-  zdef_(zmax, Znummergemax, "  maximum merges for a facet (at most 511)", -1);
+  zdef_(zadd, Znummergetot, "average merges per facet(at most 511)", Znumfacets);
+  zdef_(zmax, Znummergemax, "  maximum merges for a facet(at most 511)", -1);
   zdef_(zinc, Zangle, NULL, -1);
-  zdef_(wadd, Wangle, "average angle (cosine) of facet normals for all ridges", Zangle);
-  zdef_(wmax, Wanglemax, "  maximum angle (cosine) of facet normals across a ridge", -1);
-  zdef_(wmin, Wanglemin, "  minimum angle (cosine) of facet normals across a ridge", -1);
+  zdef_(wadd, Wangle, "average angle(cosine) of facet normals for all ridges", Zangle);
+  zdef_(wmax, Wanglemax, "  maximum angle(cosine) of facet normals across a ridge", -1);
+  zdef_(wmin, Wanglemin, "  minimum angle(cosine) of facet normals across a ridge", -1);
   zdef_(wadd, Wareatot, "total area of facets", -1);
   zdef_(wmax, Wareamax, "  maximum facet area", -1);
   zdef_(wmin, Wareamin, "  minimum facet area", -1);
-}  
-void qh_allstatC (void) {
+}
+void qh_allstatC(void) {
   zdef_(zdoc, Zdoc9, "build hull statistics", -1);
   zzdef_(zinc, Zprocessed, "points processed", -1);
   zzdef_(zinc, Zretry, "retries due to precision problems", -1);
@@ -99,26 +101,31 @@
   zdef_(zmax, Zvisvertexmax, "    maximum", -1);
   zdef_(zinc, Ztothorizon, "ave. horizon facets per iteration", Zprocessed);
   zdef_(zadd, Znewfacettot,  "ave. new or merged facets per iteration", Zprocessed);
-  zdef_(zmax, Znewfacetmax,  "    maximum (includes initial simplex)", -1);
+  zdef_(zmax, Znewfacetmax,  "    maximum(includes initial simplex)", -1);
   zdef_(wadd, Wnewbalance, "average new facet balance", Zprocessed);
   zdef_(wadd, Wnewbalance2, "  standard deviation", -1);
   zdef_(wadd, Wpbalance, "average partition balance", Zpbalance);
   zdef_(wadd, Wpbalance2, "  standard deviation", -1);
   zdef_(zinc, Zpbalance, "  number of trials", -1);
   zdef_(zinc, Zsearchpoints, "searches of all points for initial simplex", -1);
-  zdef_(zinc, Zdetsimplex, "determinants computed (area & initial hull)", -1);
+  zdef_(zinc, Zdetsimplex, "determinants computed(area & initial hull)", -1);
   zdef_(zinc, Znoarea, "determinants not computed because vertex too low", -1);
-  zdef_(zinc, Znotmax, "points ignored (not above max_outside)", -1);
-  zdef_(zinc, Znotgood, "points ignored (not above a good facet)", -1);
-  zdef_(zinc, Znotgoodnew, "points ignored (didn't create a good new facet)", -1);
+  zdef_(zinc, Znotmax, "points ignored(!above max_outside)", -1);
+  zdef_(zinc, Znotgood, "points ignored(!above a good facet)", -1);
+  zdef_(zinc, Znotgoodnew, "points ignored(didn't create a good new facet)", -1);
   zdef_(zinc, Zgoodfacet, "good facets found", -1);
   zzdef_(zinc, Znumvisibility, "distance tests for facet visibility", -1);
   zdef_(zinc, Zdistvertex, "distance tests to report minimum vertex", -1);
-  zdef_(zinc, Ztotcheck, "points checked for facets' outer planes", -1);
+  zzdef_(zinc, Ztotcheck, "points checked for facets' outer planes", -1);
   zzdef_(zinc, Zcheckpart, "  ave. distance tests per check", Ztotcheck);
 }
 void qh_allstatD(void) {
-  zdef_(zdoc, Zdoc4, "partitioning statistics (see previous for outer planes)", -1);
+  zdef_(zinc, Zvisit, "resets of visit_id", -1);
+  zdef_(zinc, Zvvisit, "  resets of vertex_visit", -1);
+  zdef_(zmax, Zvisit2max, "  max visit_id/2", -1);
+  zdef_(zmax, Zvvisit2max, "  max vertex_visit/2", -1);
+
+  zdef_(zdoc, Zdoc4, "partitioning statistics(see previous for outer planes)", -1);
   zzdef_(zadd, Zdelvertextot, "total vertices deleted", -1);
   zdef_(zmax, Zdelvertexmax, "    maximum vertices deleted per iteration", -1);
   zdef_(zinc, Zfindbest, "calls to findbest", -1);
@@ -148,11 +155,11 @@
   zzdef_(zinc, Zpartitionall, "distance tests for initial partition", -1);
   zdef_(zinc, Ztotpartition, "partitions of a point", -1);
   zzdef_(zinc, Zpartition, "distance tests for partitioning", -1);
-  zzdef_(zinc, Zdistcheck, "distance tests for checking flipped facets", -1); 
-  zzdef_(zinc, Zdistconvex, "distance tests for checking convexity", -1); 
-  zdef_(zinc, Zdistgood, "distance tests for checking good point", -1); 
-  zdef_(zinc, Zdistio, "distance tests for output", -1); 
-  zdef_(zinc, Zdiststat, "distance tests for statistics", -1); 
+  zzdef_(zinc, Zdistcheck, "distance tests for checking flipped facets", -1);
+  zzdef_(zinc, Zdistconvex, "distance tests for checking convexity", -1);
+  zdef_(zinc, Zdistgood, "distance tests for checking good point", -1);
+  zdef_(zinc, Zdistio, "distance tests for output", -1);
+  zdef_(zinc, Zdiststat, "distance tests for statistics", -1);
   zdef_(zinc, Zdistplane, "total number of distance tests", -1);
   zdef_(zinc, Ztotpartcoplanar, "partitions of coplanar points or deleted vertices", -1);
   zzdef_(zinc, Zpartcoplanar, "   distance tests for these partitions", -1);
@@ -162,7 +169,7 @@
   zdef_(zdoc, Zdoc5, "statistics for matching ridges", -1);
   zdef_(zinc, Zhashlookup, "total lookups for matching ridges of new facets", -1);
   zdef_(zinc, Zhashtests, "average number of tests to match a ridge", Zhashlookup);
-  zdef_(zinc, Zhashridge, "total lookups of subridges (duplicates and boundary)", -1);
+  zdef_(zinc, Zhashridge, "total lookups of subridges(duplicates and boundary)", -1);
   zdef_(zinc, Zhashridgetest, "average number of tests per subridge", Zhashridge);
   zdef_(zinc, Zdupsame, "duplicated ridges in same merge cycle", -1);
   zdef_(zinc, Zdupflip, "duplicated ridges with flipped facets", -1);
@@ -186,8 +193,8 @@
   zdef_(zadd, Zmergesetmax, "  maximum additional in one pass", -1);
   zdef_(zadd, Zmergeinittot2, "initial non-convex ridges for post merging", -1);
   zdef_(zadd, Zmergesettot2, "  additional non-convex ridges", -1);
-  zdef_(wmax, Wmaxoutside, "max distance of vertex or coplanar point above facet (w/roundoff)", -1);
-  zdef_(wmin, Wminvertex, "max distance of merged vertex below facet (or roundoff)", -1);
+  zdef_(wmax, Wmaxoutside, "max distance of vertex or coplanar point above facet(w/roundoff)", -1);
+  zdef_(wmin, Wminvertex, "max distance of merged vertex below facet(or roundoff)", -1);
   zdef_(zinc, Zwidefacet, "centrums frozen due to a wide merge", -1);
   zdef_(zinc, Zwidevertices, "centrums frozen due to extra vertices", -1);
   zzdef_(zinc, Ztotmerge, "total number of facets or cycles of facets merged", -1);
@@ -204,7 +211,7 @@
   zdef_(zinc, Zdegenvertex, "vertices deleted by degenerate facet", -1);
   zdef_(zinc, Zmergeflipdup, "merges due to flipped facets in duplicated ridge", -1);
   zdef_(zinc, Zneighbor, "merges due to redundant neighbors", -1);
-  zdef_(zadd, Ztestvneighbor, "non-convex vertex neighbors", -1); 
+  zdef_(zadd, Ztestvneighbor, "non-convex vertex neighbors", -1);
 }
 void qh_allstatG(void) {
   zdef_(zinc, Zacoplanar, "merges due to angle coplanar facets", -1);
@@ -251,7 +258,7 @@
   zdef_(zadd, Zvertexridgetot, "  ave. number of ridges per tested vertex", Zvertexridge);
   zdef_(zmax, Zvertexridgemax, "  max. number of ridges per tested vertex", -1);
 
-  zdef_(zdoc, Zdoc10, "memory usage statistics (in bytes)", -1);
+  zdef_(zdoc, Zdoc10, "memory usage statistics(in bytes)", -1);
   zdef_(zadd, Zmemfacets, "for facets and their normals, neighbor and vertex sets", -1);
   zdef_(zadd, Zmemvertices, "for vertices and their neighbor sets", -1);
   zdef_(zadd, Zmempoints, "for input points and outside and coplanar sets",-1);
@@ -274,46 +281,46 @@
   zzdef_(wadd, Wridge0, "  ave. angle to ridge", Zridge0);
   zzdef_(wmax, Wridge0max, "  max. angle to ridge", -1);
 
-  zdef_(zdoc, Zdoc12, "Triangulation statistics (Qt)", -1);
+  zdef_(zdoc, Zdoc12, "Triangulation statistics(Qt)", -1);
   zdef_(zinc, Ztricoplanar, "non-simplicial facets triangulated", -1);
-  zdef_(zadd, Ztricoplanartot, "  ave. new facets created (may be deleted)", Ztricoplanar);
+  zdef_(zadd, Ztricoplanartot, "  ave. new facets created(may be deleted)", Ztricoplanar);
   zdef_(zmax, Ztricoplanarmax, "  max. new facets created", -1);
-  zdef_(zinc, Ztrinull, "null new facets deleted (duplicated vertex)", -1);
-  zdef_(zinc, Ztrimirror, "mirrored pairs of new facets deleted (same vertices)", -1);
-  zdef_(zinc, Ztridegen, "degenerate new facets in output (same ridge)", -1);
+  zdef_(zinc, Ztrinull, "null new facets deleted(duplicated vertex)", -1);
+  zdef_(zinc, Ztrimirror, "mirrored pairs of new facets deleted(same vertices)", -1);
+  zdef_(zinc, Ztridegen, "degenerate new facets in output(same ridge)", -1);
 } /* allstat */
 
 /*---------------------------------
-  
+
   qh_allstatistics()
     reset printed flag for all statistics
 */
-void qh_allstatistics (void) {
+void qh_allstatistics(void) {
   int i;
-  
-  for (i=ZEND; i--; ) 
+
+  for(i=ZEND; i--; )
     qhstat printed[i]= False;
 } /* allstatistics */
 
 #if qh_KEEPstatistics
 /*---------------------------------
-  
+
   qh_collectstatistics()
     collect statistics for qh.facet_list
 
 */
-void qh_collectstatistics (void) {
+void qh_collectstatistics(void) {
   facetT *facet, *neighbor, **neighborp;
   vertexT *vertex, **vertexp;
   realT dotproduct, dist;
   int sizneighbors, sizridges, sizvertices, i;
-  
+
   qh old_randomdist= qh RANDOMdist;
   qh RANDOMdist= False;
-  zval_(Zmempoints)= qh num_points * qh normal_size + 
-                             sizeof (qhT) + sizeof (qhstatT);
+  zval_(Zmempoints)= qh num_points * qh normal_size +
+                             sizeof(qhT) + sizeof(qhstatT);
   zval_(Zmemfacets)= 0;
   zval_(Zmemridges)= 0;
   zval_(Zmemvertices)= 0;
@@ -326,7 +333,7 @@
   zval_(Znumvneighbors)= 0;
   zval_(Znummergetot)= 0;
   zval_(Znummergemax)= 0;
-  zval_(Zvertices)= qh num_vertices - qh_setsize (qh del_vertices);
+  zval_(Zvertices)= qh num_vertices - qh_setsize(qh del_vertices);
   if (qh MERGING || qh APPROXhull || qh JOGGLEmax < REALmax/2)
     wmax_(Wmaxoutside, qh max_outside);
   if (qh MERGING)
@@ -342,9 +349,9 @@
   FORALLfacets {
     if (facet->visible && qh NEWfacets)
       continue;
-    sizvertices= qh_setsize (facet->vertices);
-    sizneighbors= qh_setsize (facet->neighbors);
-    sizridges= qh_setsize (facet->ridges);
+    sizvertices= qh_setsize(facet->vertices);
+    sizneighbors= qh_setsize(facet->neighbors);
+    sizridges= qh_setsize(facet->ridges);
     zinc_(Znumfacets);
     zadd_(Znumvertices, sizvertices);
     zmax_(Zmaxvertices, sizvertices);
@@ -352,10 +359,10 @@
     zmax_(Zmaxneighbors, sizneighbors);
     zadd_(Znummergetot, facet->nummerge);
     i= facet->nummerge; /* avoid warnings */
-    zmax_(Znummergemax, i); 
+    zmax_(Znummergemax, i);
     if (!facet->simplicial) {
       if (sizvertices == qh hull_dim) {
-	zinc_(Znowsimplicial);
+        zinc_(Znowsimplicial);
       }else {
         zinc_(Znonsimplicial);
       }
@@ -364,24 +371,24 @@
       zadd_(Znumridges, sizridges);
       zmax_(Zmaxridges, sizridges);
     }
-    zadd_(Zmemfacets, sizeof (facetT) + qh normal_size + 2*sizeof (setT) 
+    zadd_(Zmemfacets, sizeof(facetT) + qh normal_size + 2*sizeof(setT)
        + SETelemsize * (sizneighbors + sizvertices));
     if (facet->ridges) {
       zadd_(Zmemridges,
-	 sizeof (setT) + SETelemsize * sizridges + sizridges * 
-         (sizeof (ridgeT) + sizeof (setT) + SETelemsize * (qh hull_dim-1))/2);
+         sizeof(setT) + SETelemsize * sizridges + sizridges *
+         (sizeof(ridgeT) + sizeof(setT) + SETelemsize * (qh hull_dim-1))/2);
     }
     if (facet->outsideset)
-      zadd_(Zmempoints, sizeof (setT) + SETelemsize * qh_setsize (facet->outsideset));
+      zadd_(Zmempoints, sizeof(setT) + SETelemsize * qh_setsize(facet->outsideset));
     if (facet->coplanarset)
-      zadd_(Zmempoints, sizeof (setT) + SETelemsize * qh_setsize (facet->coplanarset));
+      zadd_(Zmempoints, sizeof(setT) + SETelemsize * qh_setsize(facet->coplanarset));
     if (facet->seen) /* Delaunay upper envelope */
       continue;
     facet->seen= True;
     FOREACHneighbor_(facet) {
       if (neighbor == qh_DUPLICATEridge || neighbor == qh_MERGEridge
-	  || neighbor->seen || !facet->normal || !neighbor->normal)
-	continue;
+          || neighbor->seen || !facet->normal || !neighbor->normal)
+        continue;
       dotproduct= qh_getangle(facet->normal, neighbor->normal);
       zinc_(Zangle);
       wadd_(Wangle, dotproduct);
@@ -400,12 +407,12 @@
   FORALLvertices {
     if (vertex->deleted)
       continue;
-    zadd_(Zmemvertices, sizeof (vertexT));
+    zadd_(Zmemvertices, sizeof(vertexT));
     if (vertex->neighbors) {
-      sizneighbors= qh_setsize (vertex->neighbors);
+      sizneighbors= qh_setsize(vertex->neighbors);
       zadd_(Znumvneighbors, sizneighbors);
       zmax_(Zmaxvneighbors, sizneighbors);
-      zadd_(Zmemvertices, sizeof (vertexT) + SETelemsize * sizneighbors);
+      zadd_(Zmemvertices, sizeof(vertexT) + SETelemsize * sizneighbors);
     }
   }
   qh RANDOMdist= qh old_randomdist;
@@ -414,39 +421,44 @@
 
 /*---------------------------------
-  
+
   qh_freestatistics(  )
     free memory used for statistics
 */
-void qh_freestatistics (void) {
+void qh_freestatistics(void) {
 
 #if qh_QHpointer
-  free (qh_qhstat);
+  qh_free(qh_qhstat);
   qh_qhstat= NULL;
 #endif
 } /* freestatistics */
 
 /*---------------------------------
-  
+
   qh_initstatistics(  )
     allocate and initialize statistics
 
   notes:
-    uses malloc() instead of qh_memalloc() since mem.c not set up yet
+    uses qh_malloc() instead of qh_memalloc() since mem.c not set up yet
+    NOerrors -- qh_initstatistics can not use qh_errexit().  One first call, qh_memalloc is not initialized.  Also invoked by QhullQh().
 */
-void qh_initstatistics (void) {
+void qh_initstatistics(void) {
   int i;
   realT realx;
   int intx;
 
 #if qh_QHpointer
-  if (!(qh_qhstat= (qhstatT *)malloc (sizeof(qhstatT)))) {
-    fprintf (qhmem.ferr, "qhull error (qh_initstatistics): insufficient memory\n");
-    exit (1);  /* can not use qh_errexit() */
+  if(qh_qhstat){  /* qh_initstatistics may be called from Qhull::resetStatistics() */
+      qh_free(qh_qhstat);
+      qh_qhstat= 0;
   }
+  if (!(qh_qhstat= (qhstatT *)qh_malloc(sizeof(qhstatT)))) {
+    qh_fprintf(qhmem.ferr, 6183, "qhull error (qh_initstatistics): insufficient memory\n");
+    qh_exit(qh_ERRmem);  /* can not use qh_errexit() */
+  }
 #endif
-  
+
   qhstat next= 0;
   qh_allstatA();
   qh_allstatB();
@@ -458,21 +470,21 @@
   qh_allstatG();
   qh_allstatH();
   qh_allstatI();
-  if (qhstat next > sizeof(qhstat id)) {
-    fprintf (qhmem.ferr, "qhull error (qh_initstatistics): increase size of qhstat.id[].\n\
-      qhstat.next %d should be <= sizeof(qhstat id) %d\n", qhstat next, sizeof(qhstat id));
+  if (qhstat next > (int)sizeof(qhstat id)) {
+    qh_fprintf(qhmem.ferr, 6184, "qhull error (qh_initstatistics): increase size of qhstat.id[].\n\
+      qhstat.next %d should be <= sizeof(qhstat id) %d\n", qhstat next, (int)sizeof(qhstat id));
 #if 0 /* for locating error, Znumridges should be duplicated */
-    for (i=0; i < ZEND; i++) {
+    for(i=0; i < ZEND; i++) {
       int j;
-      for (j=i+1; j < ZEND; j++) {
-	if (qhstat id[i] == qhstat id[j]) {
-          fprintf (qhmem.ferr, "qhull error (qh_initstatistics): duplicated statistic %d at indices %d and %d\n", 
-	      qhstat id[i], i, j);
-	}
+      for(j=i+1; j < ZEND; j++) {
+        if (qhstat id[i] == qhstat id[j]) {
+          qh_fprintf(qhmem.ferr, 6185, "qhull error (qh_initstatistics): duplicated statistic %d at indices %d and %d\n",
+              qhstat id[i], i, j);
+        }
       }
     }
-#endif 
-    exit (1);  /* can not use qh_errexit() */
+#endif
+    qh_exit(qh_ERRqhull);  /* can not use qh_errexit() */
   }
   qhstat init[zinc].i= 0;
   qhstat init[zadd].i= 0;
@@ -481,7 +493,7 @@
   qhstat init[wadd].r= 0;
   qhstat init[wmin].r= REALmax;
   qhstat init[wmax].r= -REALmax;
-  for (i=0; i < ZEND; i++) {
+  for(i=0; i < ZEND; i++) {
     if (qhstat type[i] > ZTYPEreal) {
       realx= qhstat init[(unsigned char)(qhstat type[i])].r;
       qhstat stats[i].r= realx;
@@ -494,24 +506,24 @@
 
 /*---------------------------------
-  
+
   qh_newstats(  )
     returns True if statistics for zdoc
 
   returns:
     next zdoc
 */
-boolT qh_newstats (int index, int *nextindex) {
+boolT qh_newstats(int idx, int *nextindex) {
   boolT isnew= False;
   int start, i;
 
-  if (qhstat type[qhstat id[index]] == zdoc) 
-    start= index+1;
+  if (qhstat type[qhstat id[idx]] == zdoc)
+    start= idx+1;
   else
-    start= index;
-  for (i= start; i < qhstat next && qhstat type[qhstat id[i]] != zdoc; i++) {
+    start= idx;
+  for(i= start; i < qhstat next && qhstat type[qhstat id[i]] != zdoc; i++) {
     if (!qh_nostatistic(qhstat id[i]) && !qhstat printed[qhstat id[i]])
-	isnew= True;
+        isnew= True;
   }
   *nextindex= i;
   return isnew;
@@ -519,16 +531,16 @@
 
 /*---------------------------------
-  
+
   qh_nostatistic( index )
     true if no statistic to print
 */
-boolT qh_nostatistic (int i) {
-  
+boolT qh_nostatistic(int i) {
+
   if ((qhstat type[i] > ZTYPEreal
        &&qhstat stats[i].r == qhstat init[(unsigned char)(qhstat type[i])].r)
       || (qhstat type[i] < ZTYPEreal
-	  &&qhstat stats[i].i == qhstat init[(unsigned char)(qhstat type[i])].i))
+          &&qhstat stats[i].i == qhstat init[(unsigned char)(qhstat type[i])].i))
     return True;
   return False;
 } /* nostatistic */
@@ -536,133 +548,133 @@
 #if qh_KEEPstatistics
 /*---------------------------------
-  
+
   qh_printallstatistics( fp, string )
     print all statistics with header 'string'
 */
-void qh_printallstatistics (FILE *fp, char *string) {
+void qh_printallstatistics(FILE *fp, const char *string) {
 
   qh_allstatistics();
   qh_collectstatistics();
-  qh_printstatistics (fp, string);
-  qh_memstatistics (fp);
+  qh_printstatistics(fp, string);
+  qh_memstatistics(fp);
 }
 
 
 /*---------------------------------
-  
+
   qh_printstatistics( fp, string )
     print statistics to a file with header 'string'
     skips statistics with qhstat.printed[] (reset with qh_allstatistics)
 
-  see: 
+  see:
     qh_printallstatistics()
 */
-void qh_printstatistics (FILE *fp, char *string) {
+void qh_printstatistics(FILE *fp, const char *string) {
   int i, k;
   realT ave;
-  
+
   if (qh num_points != qh num_vertices) {
     wval_(Wpbalance)= 0;
     wval_(Wpbalance2)= 0;
   }else
-    wval_(Wpbalance2)= qh_stddev (zval_(Zpbalance), wval_(Wpbalance), 
+    wval_(Wpbalance2)= qh_stddev(zval_(Zpbalance), wval_(Wpbalance),
                                  wval_(Wpbalance2), &ave);
-  wval_(Wnewbalance2)= qh_stddev (zval_(Zprocessed), wval_(Wnewbalance), 
+  wval_(Wnewbalance2)= qh_stddev(zval_(Zprocessed), wval_(Wnewbalance),
                                  wval_(Wnewbalance2), &ave);
-  fprintf (fp, "\n\
+  qh_fprintf(fp, 9350, "\n\
 %s\n\
- qhull invoked by: %s | %s\n%s with options:\n%s\n", string, qh rbox_command, 
+ qhull invoked by: %s | %s\n%s with options:\n%s\n", string, qh rbox_command,
      qh qhull_command, qh_version, qh qhull_options);
-  fprintf (fp, "\nprecision constants:\n\
- %6.2g max. abs. coordinate in the (transformed) input ('Qbd:n')\n\
- %6.2g max. roundoff error for distance computation ('En')\n\
+  qh_fprintf(fp, 9351, "\nprecision constants:\n\
+ %6.2g max. abs. coordinate in the (transformed) input('Qbd:n')\n\
+ %6.2g max. roundoff error for distance computation('En')\n\
  %6.2g max. roundoff error for angle computations\n\
  %6.2g min. distance for outside points ('Wn')\n\
  %6.2g min. distance for visible facets ('Vn')\n\
  %6.2g max. distance for coplanar facets ('Un')\n\
  %6.2g max. facet width for recomputing centrum and area\n\
-", 
-  qh MAXabs_coord, qh DISTround, qh ANGLEround, qh MINoutside, 
+",
+  qh MAXabs_coord, qh DISTround, qh ANGLEround, qh MINoutside,
         qh MINvisible, qh MAXcoplanar, qh WIDEfacet);
   if (qh KEEPnearinside)
-    fprintf(fp, "\
+    qh_fprintf(fp, 9352, "\
  %6.2g max. distance for near-inside points\n", qh NEARinside);
-  if (qh premerge_cos < REALmax/2) fprintf (fp, "\
+  if (qh premerge_cos < REALmax/2) qh_fprintf(fp, 9353, "\
  %6.2g max. cosine for pre-merge angle\n", qh premerge_cos);
-  if (qh PREmerge) fprintf (fp, "\
+  if (qh PREmerge) qh_fprintf(fp, 9354, "\
  %6.2g radius of pre-merge centrum\n", qh premerge_centrum);
-  if (qh postmerge_cos < REALmax/2) fprintf (fp, "\
+  if (qh postmerge_cos < REALmax/2) qh_fprintf(fp, 9355, "\
  %6.2g max. cosine for post-merge angle\n", qh postmerge_cos);
-  if (qh POSTmerge) fprintf (fp, "\
+  if (qh POSTmerge) qh_fprintf(fp, 9356, "\
  %6.2g radius of post-merge centrum\n", qh postmerge_centrum);
-  fprintf (fp, "\
+  qh_fprintf(fp, 9357, "\
  %6.2g max. distance for merging two simplicial facets\n\
  %6.2g max. roundoff error for arithmetic operations\n\
  %6.2g min. denominator for divisions\n\
   zero diagonal for Gauss: ", qh ONEmerge, REALepsilon, qh MINdenom);
-  for (k=0; k < qh hull_dim; k++)
-    fprintf (fp, "%6.2e ", qh NEARzero[k]);
-  fprintf (fp, "\n\n");
-  for (i=0 ; i < qhstat next; ) 
-    qh_printstats (fp, i, &i);
+  for(k=0; k < qh hull_dim; k++)
+    qh_fprintf(fp, 9358, "%6.2e ", qh NEARzero[k]);
+  qh_fprintf(fp, 9359, "\n\n");
+  for(i=0 ; i < qhstat next; )
+    qh_printstats(fp, i, &i);
 } /* printstatistics */
 #endif /* qh_KEEPstatistics */
 
 /*---------------------------------
-  
+
   qh_printstatlevel( fp, id )
     print level information for a statistic
 
   notes:
     nop if id >= ZEND, printed, or same as initial value
 */
-void qh_printstatlevel (FILE *fp, int id, int start) {
+void qh_printstatlevel(FILE *fp, int id, int start) {
 #define NULLfield "       "
 
   if (id >= ZEND || qhstat printed[id])
     return;
   if (qhstat type[id] == zdoc) {
-    fprintf (fp, "%s\n", qhstat doc[id]);
+    qh_fprintf(fp, 9360, "%s\n", qhstat doc[id]);
     return;
   }
   start= 0; /* not used */
   if (qh_nostatistic(id) || !qhstat doc[id])
     return;
   qhstat printed[id]= True;
-  if (qhstat count[id] != -1 
+  if (qhstat count[id] != -1
       && qhstat stats[(unsigned char)(qhstat count[id])].i == 0)
-    fprintf (fp, " *0 cnt*");
+    qh_fprintf(fp, 9361, " *0 cnt*");
   else if (qhstat type[id] >= ZTYPEreal && qhstat count[id] == -1)
-    fprintf (fp, "%7.2g", qhstat stats[id].r);
+    qh_fprintf(fp, 9362, "%7.2g", qhstat stats[id].r);
   else if (qhstat type[id] >= ZTYPEreal && qhstat count[id] != -1)
-    fprintf (fp, "%7.2g", qhstat stats[id].r/ qhstat stats[(unsigned char)(qhstat count[id])].i);
+    qh_fprintf(fp, 9363, "%7.2g", qhstat stats[id].r/ qhstat stats[(unsigned char)(qhstat count[id])].i);
   else if (qhstat type[id] < ZTYPEreal && qhstat count[id] == -1)
-    fprintf (fp, "%7d", qhstat stats[id].i);
+    qh_fprintf(fp, 9364, "%7d", qhstat stats[id].i);
   else if (qhstat type[id] < ZTYPEreal && qhstat count[id] != -1)
-    fprintf (fp, "%7.3g", (realT) qhstat stats[id].i / qhstat stats[(unsigned char)(qhstat count[id])].i);
-  fprintf (fp, " %s\n", qhstat doc[id]);
+    qh_fprintf(fp, 9365, "%7.3g", (realT) qhstat stats[id].i / qhstat stats[(unsigned char)(qhstat count[id])].i);
+  qh_fprintf(fp, 9366, " %s\n", qhstat doc[id]);
 } /* printstatlevel */
 
 
 /*---------------------------------
-  
+
   qh_printstats( fp, index, nextindex )
     print statistics for a zdoc group
 
   returns:
     next zdoc if non-null
 */
-void qh_printstats (FILE *fp, int index, int *nextindex) {
+void qh_printstats(FILE *fp, int idx, int *nextindex) {
   int j, nexti;
 
-  if (qh_newstats (index, &nexti)) {
-    fprintf (fp, "\n");
-    for (j=index; j--------------------------------
-  
+
   qh_stddev( num, tot, tot2, ave )
     compute the standard deviation and average from statistics
 
     tot2 is the sum of the squares
   notes:
-    computes r.m.s.: 
-      (x-ave)^2 
+    computes r.m.s.:
+      (x-ave)^2
       == x^2 - 2x tot/num +   (tot/num)^2
-      == tot2 - 2 tot tot/num + tot tot/num 
+      == tot2 - 2 tot tot/num + tot tot/num
       == tot2 - tot ave
 */
-realT qh_stddev (int num, realT tot, realT tot2, realT *ave) {
+realT qh_stddev(int num, realT tot, realT tot2, realT *ave) {
   realT stddev;
 
   *ave= tot/num;
-  stddev= sqrt (tot2/num - *ave * *ave);
+  stddev= sqrt(tot2/num - *ave * *ave);
   return stddev;
 } /* stddev */
 
-#endif /* qh_KEEPstatistics */ 
+#endif /* qh_KEEPstatistics */
 
 #if !qh_KEEPstatistics
-void    qh_collectstatistics (void) {}
-void    qh_printallstatistics (FILE *fp, char *string) {};
-void    qh_printstatistics (FILE *fp, char *string) {}
+void    qh_collectstatistics(void) {}
+void    qh_printallstatistics(FILE *fp, char *string) {};
+void    qh_printstatistics(FILE *fp, char *string) {}
 #endif
 

Modified: trunk/scipy/spatial/qhull/src/stat.h
===================================================================
--- trunk/scipy/spatial/qhull/src/stat.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/stat.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,16 +1,18 @@
-  /*
  -
  ---------------------------------
 
-   stat.h 
+   stat.h
      contains all statistics that are collected for qhull
 
    see qh-stat.htm and stat.c
 
-   copyright (c) 1993-2003, The Geometry Center
+   copyright (c) 1993-2010 The Geometry Center.
+   $Id: //product/qhull/main/rel/src/stat.h#28 $$Change: 1164 $
+   $DateTime: 2010/01/07 21:52:00 $$Author: bbarber $
 
    recompile qhull if you change this file
 
-   Integer statistics are Z* while real statistics are W*.  
+   Integer statistics are Z* while real statistics are W*.
 
    define maydebugx to call a routine at every statistic event
 
@@ -19,6 +21,7 @@
 #ifndef qhDEFstat
 #define qhDEFstat 1
 
+#include "libqhull.h"
 
 /*---------------------------------
@@ -90,7 +93,7 @@
     Wdegenmax,
     Wdegentot,
     Zdegenvertex,
-    Zdelfacetdup, 
+    Zdelfacetdup,
     Zdelridge,
     Zdelvertextot,
     Zdelvertexmax,
@@ -123,9 +126,9 @@
     Wduplicatetot,
     Zdupridge,
     Zdupsame,
-    Zflipped, 
-    Wflippedmax, 
-    Wflippedtot, 
+    Zflipped,
+    Wflippedmax,
+    Wflippedtot,
     Zflippedfacets,
     Zfindbest,
     Zfindbestmax,
@@ -209,13 +212,13 @@
     Zpartflip,
     Zparthorizon,
     Zpartinside,
-    Zpartition, 
+    Zpartition,
     Zpartitionall,
     Zpartnear,
     Zpbalance,
     Wpbalance,
-    Wpbalance2, 
-    Zpostfacets, 
+    Wpbalance2,
+    Zpostfacets,
     Zpremergetot,
     Zprocessed,
     Zremvertex,
@@ -262,8 +265,12 @@
     Zvertices,
     Zvisfacettot,
     Zvisfacetmax,
+    Zvisit,
+    Zvisit2max,
     Zvisvertextot,
     Zvisvertexmax,
+    Zvvisit,
+    Zvvisit2max,
     Zwidefacet,
     Zwidevertices,
     ZEND};
@@ -321,15 +328,16 @@
   Wridgeok,
   Wridgeokmax,
   Zsetplane,
+  Ztotcheck,
   Ztotmerge,
     ZEND};
 #endif
 
 /*---------------------------------
-  
+
   ztype
-    the type of a statistic sets its initial value.  
+    the type of a statistic sets its initial value.
 
   notes:
     The type should be the same as the macro for collecting the statistic
@@ -340,15 +348,15 @@
 
 /*----------------------------------
-  
+
   MAYdebugx
     define as maydebug() to be called frequently for error trapping
 */
-#define MAYdebugx 
+#define MAYdebugx
 
 /*----------------------------------
-  
+
   zzdef_, zdef_( type, name, doc, -1)
     define a statistic (assumes 'qhstat.next= 0;')
 
@@ -367,7 +375,7 @@
 
 /*----------------------------------
-  
+
   zzinc_( name ), zinc_( name)
     increment an integer statistic
 */
@@ -380,7 +388,7 @@
 
 /*----------------------------------
-  
+
   zzadd_( name, value ), zadd_( name, value ), wadd_( name, value )
     add value to an integer or real statistic
 */
@@ -444,7 +452,7 @@
 
 /*----------------------------------
- 
+
   intrealT
     union of integer and real, used for statistics
 */
@@ -456,33 +464,37 @@
 
 /*----------------------------------
-  
+
   qhstat
-    global data structure for statistics
-  
+    global data structure for statistics, similar to qh and qhrbox
+
   notes:
    access to qh_qhstat is via the "qhstat" macro.  There are two choices
    qh_QHpointer = 1     access globals via a pointer
                         enables qh_saveqhull() and qh_restoreqhull()
-		= 0     qh_qhstat is a static data structure
-		        only one instance of qhull() can be active at a time
-			default value
-   qh_QHpointer is defined in qhull.h
+                = 0     qh_qhstat is a static data structure
+                        only one instance of qhull() can be active at a time
+                        default value
+   qh_QHpointer is defined in libqhull.h
 
-   allocated in stat.c
+   allocated in stat.c using qh_malloc()
 */
-typedef struct qhstatT qhstatT; 
+#ifndef DEFqhstatT
+#define DEFqhstatT 1
+typedef struct qhstatT qhstatT;
+#endif
+
 #if qh_QHpointer
 #define qhstat qh_qhstat->
 extern qhstatT *qh_qhstat;
 #else
 #define qhstat qh_qhstat.
-extern qhstatT qh_qhstat; 
+extern qhstatT qh_qhstat;
 #endif
-struct qhstatT {  
+struct qhstatT {
   intrealT   stats[ZEND];     /* integer and real statistics */
   unsigned   char id[ZEND+10]; /* id's in print order */
-  char      *doc[ZEND];       /* array of documentation strings */
+  const char *doc[ZEND];       /* array of documentation strings */
   short int  count[ZEND];     /* -1 if none, else index of count to use */
   char       type[ZEND];      /* type, see ztypes above */
   char       printed[ZEND];   /* true, if statistic has been printed */
@@ -507,16 +519,16 @@
 void    qh_allstatG(void);
 void    qh_allstatH(void);
 void    qh_allstatI(void);
-void    qh_allstatistics (void);
-void    qh_collectstatistics (void);
-void	qh_freestatistics (void);
-void    qh_initstatistics (void);
-boolT 	qh_newstats (int index, int *nextindex);
-boolT 	qh_nostatistic (int i);
-void    qh_printallstatistics (FILE *fp, char *string);
-void    qh_printstatistics (FILE *fp, char *string);
-void  	qh_printstatlevel (FILE *fp, int id, int start);
-void  	qh_printstats (FILE *fp, int index, int *nextindex);
-realT   qh_stddev (int num, realT tot, realT tot2, realT *ave);
+void    qh_allstatistics(void);
+void    qh_collectstatistics(void);
+void    qh_freestatistics(void);
+void    qh_initstatistics(void);
+boolT   qh_newstats(int idx, int *nextindex);
+boolT   qh_nostatistic(int i);
+void    qh_printallstatistics(FILE *fp, const char *string);
+void    qh_printstatistics(FILE *fp, const char *string);
+void    qh_printstatlevel(FILE *fp, int id, int start);
+void    qh_printstats(FILE *fp, int idx, int *nextindex);
+realT   qh_stddev(int num, realT tot, realT tot2, realT *ave);
 
 #endif   /* qhDEFstat */

Deleted: trunk/scipy/spatial/qhull/src/unix.c
===================================================================
--- trunk/scipy/spatial/qhull/src/unix.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/unix.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,377 +0,0 @@
-/*
  ---------------------------------
-
-   unix.c
-     command line interface to qhull
-	 includes SIOUX interface for Macintoshes
-
-   see qh-qhull.htm
-
-   copyright (c) 1993-2003, The Geometry Center
-*/
-
-#include 
-#include 
-#include 
-#include 
-#include 
-#include "qhull.h"
-#include "mem.h"
-#include "qset.h"
-
-#if __MWERKS__ && __POWERPC__
-#include 
-#include 
-#include 
-#include 
-
-#elif __cplusplus
-extern "C" {
-  int isatty (int);
-}
-
-#elif _MSC_VER
-#include 
-#define isatty _isatty
-
-#else
-int isatty (int);  /* returns 1 if stdin is a tty
-		   if "Undefined symbol" this can be deleted along with call in main() */
-#endif
-
-/*---------------------------------
-
-  qh_prompt 
-    long prompt for qhull
-    
-  see:
-    concise prompt below
-*/  
-char qh_prompta[]= "\n\
-qhull- compute convex hulls and related structures.\n\
-    http://www.qhull.org  %s\n\
-\n\
-input (stdin):\n\
-    first lines: dimension and number of points (or vice-versa).\n\
-    other lines: point coordinates, best if one point per line\n\
-    comments:    start with a non-numeric character\n\
-    halfspaces:  use dim plus one and put offset after coefficients.\n\
-                 May be preceeded by a single interior point ('H').\n\
-\n\
-options:\n\
-    d    - Delaunay triangulation by lifting points to a paraboloid\n\
-    d Qu - furthest-site Delaunay triangulation (upper convex hull)\n\
-    v    - Voronoi diagram (dual of the Delaunay triangulation)\n\
-    v Qu - furthest-site Voronoi diagram\n\
-    Hn,n,... - halfspace intersection about point [n,n,0,...]\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Qc   - keep coplanar points with nearest facet\n\
-    Qi   - keep interior points with nearest facet\n\
-\n\
-Qhull control options:\n\
-    Qbk:n   - scale coord k so that low bound is n\n\
-      QBk:n - scale coord k so that upper bound is n (QBk is %2.2g)\n\
-    QbB  - scale input to unit cube centered at the origin\n\
-    Qbb  - scale last coordinate to [0,m] for Delaunay triangulations\n\
-    Qbk:0Bk:0 - remove k-th coordinate from input\n\
-    QJn  - randomly joggle input in range [-n,n]\n\
-    QRn  - random rotation (n=seed, n=0 time, n=-1 time/no rotate)\n\
-%s%s%s%s";  /* split up qh_prompt for Visual C++ */
-char qh_promptb[]= "\
-    Qf   - partition point to furthest outside facet\n\
-    Qg   - only build good facets (needs 'QGn', 'QVn', or 'PdD')\n\
-    Qm   - only process points that would increase max_outside\n\
-    Qr   - process random outside points instead of furthest ones\n\
-    Qs   - search all points for the initial simplex\n\
-    Qu   - for 'd' or 'v', compute upper hull without point at-infinity\n\
-              returns furthest-site Delaunay triangulation\n\
-    Qv   - test vertex neighbors for convexity\n\
-    Qx   - exact pre-merges (skips coplanar and angle-coplanar facets)\n\
-    Qz   - add point-at-infinity to Delaunay triangulation\n\
-    QGn  - good facet if visible from point n, -n for not visible\n\
-    QVn  - good facet if it includes point n, -n if not\n\
-    Q0   - turn off default premerge with 'C-0'/'Qx'\n\
-    Q1	   - sort merges by type instead of angle\n\
-    Q2   - merge all non-convex at once instead of independent sets\n\
-    Q3   - do not merge redundant vertices\n\
-    Q4   - avoid old->new merges\n\
-    Q5   - do not correct outer planes at end of qhull\n\
-    Q6   - do not pre-merge concave or coplanar facets\n\
-    Q7   - depth-first processing instead of breadth-first\n\
-    Q8   - do not process near-inside points\n\
-    Q9   - process furthest of furthest points\n\
-    Q10  - no special processing for narrow distributions\n\
-    Q11  - copy normals and recompute centrums for tricoplanar facets\n\
-\n\
-";
-char qh_promptc[]= "\
-Topts- Trace options:\n\
-    T4   - trace at level n, 4=all, 5=mem/gauss, -1= events\n\
-    Tc   - check frequently during execution\n\
-    Ts   - print statistics\n\
-    Tv   - verify result: structure, convexity, and point inclusion\n\
-    Tz   - send all output to stdout\n\
-    TFn  - report summary when n or more facets created\n\
-    TI file - input data from file, no spaces or single quotes\n\
-    TO file - output results to file, may be enclosed in single quotes\n\
-    TPn  - turn on tracing when point n added to hull\n\
-     TMn - turn on tracing at merge n\n\
-     TWn - trace merge facets when width > n\n\
-    TRn  - rerun qhull n times.  Use with 'QJn'\n\
-    TVn  - stop qhull after adding point n, -n for before (see TCn)\n\
-     TCn - stop qhull after building cone for point n (see TVn)\n\
-\n\
-Precision options:\n\
-    Cn   - radius of centrum (roundoff added).  Merge facets if non-convex\n\
-     An  - cosine of maximum angle.  Merge facets if cosine > n or non-convex\n\
-           C-0 roundoff, A-0.99/C-0.01 pre-merge, A0.99/C0.01 post-merge\n\
-    En   - max roundoff error for distance computation\n\
-    Rn   - randomly perturb computations by a factor of [1-n,1+n]\n\
-    Vn   - min distance above plane for a visible facet (default 3C-n or En)\n\
-    Un   - max distance below plane for a new, coplanar point (default Vn)\n\
-    Wn   - min facet width for outside point (before roundoff, default 2Vn)\n\
-\n\
-Output formats (may be combined; if none, produces a summary to stdout):\n\
-    f    - facet dump\n\
-    G    - Geomview output (see below)\n\
-    i    - vertices incident to each facet\n\
-    m    - Mathematica output (2-d and 3-d)\n\
-    o    - OFF format (dim, points and facets; Voronoi regions)\n\
-    n    - normals with offsets\n\
-    p    - vertex coordinates or Voronoi vertices (coplanar points if 'Qc')\n\
-    s    - summary (stderr)\n\
-\n\
-";
-char qh_promptd[]= "\
-More formats:\n\
-    Fa   - area for each facet\n\
-    FA   - compute total area and volume for option 's'\n\
-    Fc   - count plus coplanar points for each facet\n\
-           use 'Qc' (default) for coplanar and 'Qi' for interior\n\
-    FC   - centrum or Voronoi center for each facet\n\
-    Fd   - use cdd format for input (homogeneous with offset first)\n\
-    FD   - use cdd format for numeric output (offset first)\n\
-    FF   - facet dump without ridges\n\
-    Fi   - inner plane for each facet\n\
-           for 'v', separating hyperplanes for bounded Voronoi regions\n\
-    FI   - ID of each facet\n\
-    Fm   - merge count for each facet (511 max)\n\
-    FM   - Maple output (2-d and 3-d)\n\
-    Fn   - count plus neighboring facets for each facet\n\
-    FN   - count plus neighboring facets for each point\n\
-    Fo   - outer plane (or max_outside) for each facet\n\
-           for 'v', separating hyperplanes for unbounded Voronoi regions\n\
-    FO   - options and precision constants\n\
-    Fp   - dim, count, and intersection coordinates (halfspace only)\n\
-    FP   - nearest vertex and distance for each coplanar point\n\
-    FQ   - command used for qhull\n\
-    Fs   - summary: #int (8), dimension, #points, tot vertices, tot facets,\n\
-                      output: #vertices, #facets, #coplanars, #nonsimplicial\n\
-                    #real (2), max outer plane, min vertex\n\
-    FS   - sizes:   #int (0)\n\
-                    #real(2) tot area, tot volume\n\
-    Ft   - triangulation with centrums for non-simplicial facets (OFF format)\n\
-    Fv   - count plus vertices for each facet\n\
-           for 'v', Voronoi diagram as Voronoi vertices for pairs of sites\n\
-    FV   - average of vertices (a feasible point for 'H')\n\
-    Fx   - extreme points (in order for 2-d)\n\
-\n\
-";
-char qh_prompte[]= "\
-Geomview options (2-d, 3-d, and 4-d; 2-d Voronoi)\n\
-    Ga   - all points as dots\n\
-     Gp  -  coplanar points and vertices as radii\n\
-     Gv  -  vertices as spheres\n\
-    Gi   - inner planes only\n\
-     Gn  -  no planes\n\
-     Go  -  outer planes only\n\
-    Gc   - centrums\n\
-    Gh   - hyperplane intersections\n\
-    Gr   - ridges\n\
-    GDn  - drop dimension n in 3-d and 4-d output\n\
-    Gt   - for 3-d 'd', transparent outer ridges\n\
-\n\
-Print options:\n\
-    PAn  - keep n largest facets by area\n\
-    Pdk:n - drop facet if normal[k] <= n (default 0.0)\n\
-    PDk:n - drop facet if normal[k] >= n\n\
-    Pg   - print good facets (needs 'QGn' or 'QVn')\n\
-    PFn  - keep facets whose area is at least n\n\
-    PG   - print neighbors of good facets\n\
-    PMn  - keep n facets with most merges\n\
-    Po   - force output.  If error, output neighborhood of facet\n\
-    Pp   - do not report precision problems\n\
-\n\
-    .    - list of all options\n\
-    -    - one line descriptions of all options\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt2
-    synopsis for qhull
-*/
-char qh_prompt2[]= "\n\
-qhull- compute convex hulls and related structures.  Qhull %s\n\
-    input (stdin): dimension, n, point coordinates\n\
-    comments start with a non-numeric character\n\
-    halfspace: use dim+1 and put offsets after coefficients\n\
-\n\
-options (qh-quick.htm):\n\
-    d    - Delaunay triangulation by lifting points to a paraboloid\n\
-    d Qu - furthest-site Delaunay triangulation (upper convex hull)\n\
-    v    - Voronoi diagram as the dual of the Delaunay triangulation\n\
-    v Qu - furthest-site Voronoi diagram\n\
-    H1,1 - Halfspace intersection about [1,1,0,...] via polar duality\n\
-    Qt   - triangulated output\n\
-    QJ   - joggled input instead of merged facets\n\
-    Tv   - verify result: structure, convexity, and point inclusion\n\
-    .    - concise list of all options\n\
-    -    - one-line description of all options\n\
-\n\
-Output options (subset):\n\
-    s    - summary of results (default)\n\
-    i    - vertices incident to each facet\n\
-    n    - normals with offsets\n\
-    p    - vertex coordinates (if 'Qc', includes coplanar points)\n\
-           if 'v', Voronoi vertices\n\
-    Fp   - halfspace intersections\n\
-    Fx   - extreme points (convex hull vertices)\n\
-    FA   - compute total area and volume\n\
-    o    - OFF format (if 'v', outputs Voronoi regions)\n\
-    G    - Geomview output (2-d, 3-d and 4-d)\n\
-    m    - Mathematica output (2-d and 3-d)\n\
-    QVn  - print facets that include point n, -n if not\n\
-    TO file- output results to file, may be enclosed in single quotes\n\
-\n\
-examples:\n\
-    rbox c d D2 | qhull Qc s f Fx | more      rbox 1000 s | qhull Tv s FA\n\
-    rbox 10 D2 | qhull d QJ s i TO result     rbox 10 D2 | qhull v Qbb Qt p\n\
-    rbox 10 D2 | qhull d Qu QJ m              rbox 10 D2 | qhull v Qu QJ o\n\
-    rbox c | qhull n                          rbox c | qhull FV n | qhull H Fp\n\
-    rbox d D12 | qhull QR0 FA                 rbox c D7 | qhull FA TF1000\n\
-    rbox y 1000 W0 | qhull                    rbox 10 | qhull v QJ o Fv\n\
-\n\
-";
-/* for opts, don't assign 'e' or 'E' to a flag (already used for exponent) */
-
-/*---------------------------------
-
-  qh_prompt3
-    concise prompt for qhull
-*/
-char qh_prompt3[]= "\n\
-Qhull %s.\n\
-Except for 'F.' and 'PG', upper-case options take an argument.\n\
-\n\
- delaunay       voronoi	       Geomview       Halfspace      facet_dump\n\
- incidences     mathematica    normals        OFF_format     points\n\
- summary\n\
-\n\
- Farea          FArea-total    Fcoplanars     FCentrums      Fd-cdd-in\n\
- FD-cdd-out     FF-dump-xridge Finner         FIDs           Fmerges\n\
- Fneighbors     FNeigh-vertex  Fouter         FOptions       Fpoint-intersect\n\
- FPoint_near    FQhull         Fsummary       FSize          Ftriangles\n\
- Fvertices      Fvoronoi       FVertex-ave    Fxtremes       FMaple\n\
-\n\
- Gvertices      Gpoints        Gall_points    Gno_planes     Ginner\n\
- Gcentrums      Ghyperplanes   Gridges        Gouter         GDrop_dim\n\
- Gtransparent\n\
-\n\
- PArea-keep     Pdrop d0:0D0   Pgood          PFacet_area_keep\n\
- PGood_neighbors PMerge-keep   Poutput_forced Pprecision_not\n\
-\n\
- QbBound 0:0.5  Qbk:0Bk:0_drop QbB-scale-box  Qbb-scale-last Qcoplanar\n\
- Qfurthest      Qgood_only     QGood_point    Qinterior      Qmax_out\n\
- QJoggle        Qrandom        QRotate        Qsearch_1st    Qtriangulate\n\
- QupperDelaunay QVertex_good   Qvneighbors    Qxact_merge    Qzinfinite\n\
-\n\
- Q0_no_premerge Q1_no_angle    Q2_no_independ Q3_no_redundant Q4_no_old\n\
- Q5_no_check_out Q6_no_concave Q7_depth_first Q8_no_near_in  Q9_pick_furthest\n\
- Q10_no_narrow  Q11_trinormals\n\
-\n\
- T4_trace       Tcheck_often   Tstatistics    Tverify        Tz_stdout\n\
- TFacet_log     TInput_file    TPoint_trace   TMerge_trace   TOutput_file\n\
- TRerun         TWide_trace    TVertex_stop   TCone_stop\n\
-\n\
- Angle_max      Centrum_size   Error_round    Random_dist    Visible_min\n\
- Ucoplanar_max  Wide_outside\n\
-";
-
-/*---------------------------------
-
-  main( argc, argv )
-    processes the command line, calls qhull() to do the work, and exits
-
-  design:
-    initializes data structures
-    reads points
-    finishes initialization
-    computes convex hull and other structures
-    checks the result
-    writes the output
-    frees memory
-*/
-int main(int argc, char *argv[]) {
-  int curlong, totlong; /* used !qh_NOmem */
-  int exitcode, numpoints, dim;
-  coordT *points;
-  boolT ismalloc;
-
-#if __MWERKS__ && __POWERPC__
-  char inBuf[BUFSIZ], outBuf[BUFSIZ], errBuf[BUFSIZ];
-  SIOUXSettings.showstatusline= false;
-  SIOUXSettings.tabspaces= 1;
-  SIOUXSettings.rows= 40;
-  if (setvbuf (stdin, inBuf, _IOFBF, sizeof(inBuf)) < 0   /* w/o, SIOUX I/O is slow*/
-  || setvbuf (stdout, outBuf, _IOFBF, sizeof(outBuf)) < 0
-  || (stdout != stderr && setvbuf (stderr, errBuf, _IOFBF, sizeof(errBuf)) < 0))
-    fprintf (stderr, "qhull internal warning (main): could not change stdio to fully buffered.\n");
-  argc= ccommand(&argv);
-#endif
-
-  if ((argc == 1) && isatty( 0 /*stdin*/)) {
-    fprintf(stdout, qh_prompt2, qh_version);
-    exit(qh_ERRnone);
-  }
-  if (argc > 1 && *argv[1] == '-' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompta, qh_version, qh_DEFAULTbox,
-		qh_promptb, qh_promptc, qh_promptd, qh_prompte);
-    exit(qh_ERRnone);
-  }
-  if (argc >1 && *argv[1] == '.' && !*(argv[1]+1)) {
-    fprintf(stdout, qh_prompt3, qh_version);
-    exit(qh_ERRnone);
-  }
-  qh_init_A (stdin, stdout, stderr, argc, argv);  /* sets qh qhull_command */
-  exitcode= setjmp (qh errexit); /* simple statement for CRAY J916 */
-  if (!exitcode) {
-    qh_initflags (qh qhull_command);
-    points= qh_readpoints (&numpoints, &dim, &ismalloc);
-    qh_init_B (points, numpoints, dim, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();
-    if (qh VERIFYoutput && !qh FORCEoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points();
-    exitcode= qh_ERRnone;
-  }
-  qh NOerrexit= True;  /* no more setjmp */
-#ifdef qh_NOmem
-  qh_freeqhull( True);
-#else
-  qh_freeqhull( False);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong)
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-#endif
-  return exitcode;
-} /* main */
-

Modified: trunk/scipy/spatial/qhull/src/user.c
===================================================================
--- trunk/scipy/spatial/qhull/src/user.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/user.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,12 +1,14 @@
 /*
  ---------------------------------
 
-   user.c 
+   user.c
    user redefinable functions
 
+   see user2.c for qh_fprintf, qh_malloc, qh_free
+
    see README.txt  see COPYING.txt for copyright information.
 
-   see qhull.h for data structures, macros, and user-callable functions.
+   see libqhull.h for data structures, macros, and user-callable functions.
 
    see user_eg.c, unix.c, and qhull_interface.cpp for examples.
 
@@ -18,10 +20,10 @@
 
    This is unsupported software.  You're welcome to make changes,
    but you're on your own if something goes wrong.  Use 'Tc' to
-   check frequently.  Usually qhull will report an error if 
+   check frequently.  Usually qhull will report an error if
    a data structure becomes inconsistent.  If so, it also reports
    the last point added to the hull, e.g., 102.  You can then trace
-   the execution of qhull with "T4P102".  
+   the execution of qhull with "T4P102".
 
    Please report any errors that you fix to qhull at qhull.org
 
@@ -34,12 +36,14 @@
 
    if the other functions here are redefined to not use qh_print...,
    then io.o will not be loaded from qhull.a.  See user_eg.c for an
-   example.  We recommend keeping io.o for the extra debugging 
+   example.  We recommend keeping io.o for the extra debugging
    information it supplies.
 */
 
-#include "qhull_a.h" 
+#include "qhull_a.h"
 
+#include 
+
 /*---------------------------------
 
@@ -47,34 +51,34 @@
     template for calling qhull from inside your program
     remove #if 0, #endif to compile
 
-  returns: 
-    exit code (see qh_ERR... in qhull.h)
+  returns:
+    exit code(see qh_ERR... in libqhull.h)
     all memory freed
 
   notes:
-    This can be called any number of times.  
+    This can be called any number of times.
 
   see:
     qh_call_qhull_once()
-    
+
 */
 #if 0
 {
-  int dim;	            /* dimension of points */
+  int dim;                  /* dimension of points */
   int numpoints;            /* number of points */
   coordT *points;           /* array of coordinates for each point */
   boolT ismalloc;           /* True if qhull should free points in qh_freeqhull() or reallocation */
   char flags[]= "qhull Tv"; /* option flags for qhull, see qh_opt.htm */
   FILE *outfile= stdout;    /* output from qh_produce_output()
-			       use NULL to skip qh_produce_output() */
+                               use NULL to skip qh_produce_output() */
   FILE *errfile= stderr;    /* error messages from qhull code */
   int exitcode;             /* 0 if no error from qhull */
-  facetT *facet;	    /* set by FORALLfacets */
-  int curlong, totlong;	    /* memory remaining after qh_memfreeshort */
+  facetT *facet;            /* set by FORALLfacets */
+  int curlong, totlong;     /* memory remaining after qh_memfreeshort */
 
   /* initialize dim, numpoints, points[], ismalloc here */
-  exitcode= qh_new_qhull (dim, numpoints, points, ismalloc,
-                      flags, outfile, errfile); 
+  exitcode= qh_new_qhull(dim, numpoints, points, ismalloc,
+                      flags, outfile, errfile);
   if (!exitcode) {                  /* if no error */
     /* 'qh facet_list' contains the convex hull */
     FORALLfacets {
@@ -82,9 +86,9 @@
     }
   }
   qh_freeqhull(!qh_ALL);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong) 
-    fprintf (errfile, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n", totlong, curlong);
+  qh_memfreeshort(&curlong, &totlong);
+  if (curlong || totlong)
+    qh_fprintf(errfile, 7068, "qhull internal warning (main): did not free %d bytes of long memory(%d pieces)\n", totlong, curlong);
 }
 #endif
 
@@ -104,9 +108,9 @@
     qhull_cmd must start with "qhull "
     projects points to a new point array for Delaunay triangulations ('d' and 'v')
     transforms points into a new point array for halfspace intersection ('H')
-       
 
-  To allow multiple, concurrent calls to qhull() 
+
+  To allow multiple, concurrent calls to qhull()
     - set qh_QHpointer in user.h
     - use qh_save_qhull and qh_restore_qhull to swap the global data structure between calls.
     - use qh_freeqhull(qh_ALL) to free intermediate convex hulls
@@ -114,49 +118,49 @@
   see:
     user_eg.c for an example
 */
-int qh_new_qhull (int dim, int numpoints, coordT *points, boolT ismalloc, 
-		char *qhull_cmd, FILE *outfile, FILE *errfile) {
+int qh_new_qhull(int dim, int numpoints, coordT *points, boolT ismalloc,
+                char *qhull_cmd, FILE *outfile, FILE *errfile) {
   int exitcode, hulldim;
   boolT new_ismalloc;
   static boolT firstcall = True;
   coordT *new_points;
 
   if (firstcall) {
-    qh_meminit (errfile);
+    qh_meminit(errfile);
     firstcall= False;
   }
-  if (strncmp (qhull_cmd,"qhull ", 6)) {
-    fprintf (errfile, "qh_new_qhull: start qhull_cmd argument with \"qhull \"\n");
-    exit(1);
+  if (strncmp(qhull_cmd,"qhull ", (size_t)6)) {
+    qh_fprintf(errfile, 6186, "qhull error (qh_new_qhull): start qhull_cmd argument with \"qhull \"\n");
+    qh_exit(qh_ERRinput);
   }
-  qh_initqhull_start (NULL, outfile, errfile);
-  trace1(( qh ferr, "qh_new_qhull: build new Qhull for %d %d-d points with %s\n", numpoints, dim, qhull_cmd));
-  exitcode = setjmp (qh errexit);
+  qh_initqhull_start(NULL, outfile, errfile);
+  trace1((qh ferr, 1044, "qh_new_qhull: build new Qhull for %d %d-d points with %s\n", numpoints, dim, qhull_cmd));
+  exitcode = setjmp(qh errexit);
   if (!exitcode)
   {
     qh NOerrexit = False;
-    qh_initflags (qhull_cmd);
+    qh_initflags(qhull_cmd);
     if (qh DELAUNAY)
       qh PROJECTdelaunay= True;
     if (qh HALFspace) {
-      /* points is an array of halfspaces, 
+      /* points is an array of halfspaces,
          the last coordinate of each halfspace is its offset */
       hulldim= dim-1;
-      qh_setfeasible (hulldim); 
-      new_points= qh_sethalfspace_all (dim, numpoints, points, qh feasible_point);
+      qh_setfeasible(hulldim);
+      new_points= qh_sethalfspace_all(dim, numpoints, points, qh feasible_point);
       new_ismalloc= True;
       if (ismalloc)
-	free (points);
+        qh_free(points);
     }else {
       hulldim= dim;
       new_points= points;
       new_ismalloc= ismalloc;
     }
-    qh_init_B (new_points, numpoints, hulldim, new_ismalloc);
+    qh_init_B(new_points, numpoints, hulldim, new_ismalloc);
     qh_qhull();
     qh_check_output();
     if (outfile)
-      qh_produce_output(); 
+      qh_produce_output();
     if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
       qh_check_points();
   }
@@ -166,15 +170,15 @@
 
 /*---------------------------------
-  
+
   qh_errexit( exitcode, facet, ridge )
     report and exit from an error
     report facet and ridge if non-NULL
     reports useful information such as last point processed
     set qh.FORCEoutput to print neighborhood of facet
 
-  see: 
-    qh_errexit2() in qhull.c for printing 2 facets
+  see:
+    qh_errexit2() in libqhull.c for printing 2 facets
 
   design:
     check for error within error processing
@@ -184,55 +188,56 @@
     print summary and statistics (including precision statistics)
     if qh_ERRsingular
       print help text for singular data set
-    exit program via long jump (if defined) or exit()      
+    exit program via long jump (if defined) or exit()
 */
 void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge) {
 
   if (qh ERREXITcalled) {
-    fprintf (qh ferr, "\nqhull error while processing previous error.  Exit program\n");
-    exit(1);
+    qh_fprintf(qh ferr, 8126, "\nqhull error while processing previous error.  Exit program\n");
+    qh_exit(qh_ERRqhull);
   }
   qh ERREXITcalled= True;
   if (!qh QHULLfinished)
     qh hulltime= qh_CPUclock - qh hulltime;
   qh_errprint("ERRONEOUS", facet, NULL, ridge, NULL);
-  fprintf (qh ferr, "\nWhile executing: %s | %s\n", qh rbox_command, qh qhull_command);
-  fprintf(qh ferr, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
+  qh_fprintf(qh ferr, 8127, "\nWhile executing: %s | %s\n", qh rbox_command, qh qhull_command);
+  qh_fprintf(qh ferr, 8128, "Options selected for Qhull %s:\n%s\n", qh_version, qh qhull_options);
   if (qh furthest_id >= 0) {
-    fprintf(qh ferr, "Last point added to hull was p%d.", qh furthest_id);
+    qh_fprintf(qh ferr, 8129, "Last point added to hull was p%d.", qh furthest_id);
     if (zzval_(Ztotmerge))
-      fprintf(qh ferr, "  Last merge was #%d.", zzval_(Ztotmerge));
+      qh_fprintf(qh ferr, 8130, "  Last merge was #%d.", zzval_(Ztotmerge));
     if (qh QHULLfinished)
-      fprintf(qh ferr, "\nQhull has finished constructing the hull.");
+      qh_fprintf(qh ferr, 8131, "\nQhull has finished constructing the hull.");
     else if (qh POSTmerging)
-      fprintf(qh ferr, "\nQhull has started post-merging.");
-    fprintf (qh ferr, "\n");
+      qh_fprintf(qh ferr, 8132, "\nQhull has started post-merging.");
+    qh_fprintf(qh ferr, 8133, "\n");
   }
   if (qh FORCEoutput && (qh QHULLfinished || (!facet && !ridge)))
     qh_produce_output();
   else {
     if (exitcode != qh_ERRsingular && zzval_(Zsetplane) > qh hull_dim+1) {
-      fprintf (qh ferr, "\nAt error exit:\n");
-      qh_printsummary (qh ferr);
+      qh_fprintf(qh ferr, 8134, "\nAt error exit:\n");
+      qh_printsummary(qh ferr);
       if (qh PRINTstatistics) {
-	qh_collectstatistics();
-	qh_printstatistics(qh ferr, "at error exit");
-	qh_memstatistics (qh ferr);
+        qh_collectstatistics();
+        qh_printstatistics(qh ferr, "at error exit");
+        qh_memstatistics(qh ferr);
       }
     }
     if (qh PRINTprecision)
-      qh_printstats (qh ferr, qhstat precision, NULL);
+      qh_printstats(qh ferr, qhstat precision, NULL);
   }
   if (!exitcode)
     exitcode= qh_ERRqhull;
   else if (exitcode == qh_ERRsingular)
     qh_printhelp_singular(qh ferr);
   else if (exitcode == qh_ERRprec && !qh PREmerge)
-    qh_printhelp_degenerate (qh ferr);
+    qh_printhelp_degenerate(qh ferr);
   if (qh NOerrexit) {
-    fprintf (qh ferr, "qhull error while ending program.  Exit program\n");
-    exit(1);
+    qh_fprintf(qh ferr, 6187, "qhull error while ending program.  Exit program\n");
+    qh_exit(qh_ERRqhull);
   }
+  qh ERREXITcalled= False;
   qh NOerrexit= True;
   longjmp(qh errexit, exitcode);
 } /* errexit */
@@ -240,32 +245,32 @@
 
 /*---------------------------------
-  
+
   qh_errprint( fp, string, atfacet, otherfacet, atridge, atvertex )
     prints out the information of facets and ridges to fp
     also prints neighbors and geomview output
-    
+
   notes:
     except for string, any parameter may be NULL
 */
-void qh_errprint(char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex) {
+void qh_errprint(const char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex) {
   int i;
 
   if (atfacet) {
-    fprintf(qh ferr, "%s FACET:\n", string);
+    qh_fprintf(qh ferr, 8135, "%s FACET:\n", string);
     qh_printfacet(qh ferr, atfacet);
   }
   if (otherfacet) {
-    fprintf(qh ferr, "%s OTHER FACET:\n", string);
+    qh_fprintf(qh ferr, 8136, "%s OTHER FACET:\n", string);
     qh_printfacet(qh ferr, otherfacet);
   }
   if (atridge) {
-    fprintf(qh ferr, "%s RIDGE:\n", string);
+    qh_fprintf(qh ferr, 8137, "%s RIDGE:\n", string);
     qh_printridge(qh ferr, atridge);
     if (atridge->top && atridge->top != atfacet && atridge->top != otherfacet)
       qh_printfacet(qh ferr, atridge->top);
     if (atridge->bottom
-	&& atridge->bottom != atfacet && atridge->bottom != otherfacet)
+        && atridge->bottom != atfacet && atridge->bottom != otherfacet)
       qh_printfacet(qh ferr, atridge->bottom);
     if (!atfacet)
       atfacet= atridge->top;
@@ -273,24 +278,24 @@
       otherfacet= otherfacet_(atridge, atfacet);
   }
   if (atvertex) {
-    fprintf(qh ferr, "%s VERTEX:\n", string);
-    qh_printvertex (qh ferr, atvertex);
+    qh_fprintf(qh ferr, 8138, "%s VERTEX:\n", string);
+    qh_printvertex(qh ferr, atvertex);
   }
   if (qh fout && qh FORCEoutput && atfacet && !qh QHULLfinished && !qh IStracing) {
-    fprintf(qh ferr, "ERRONEOUS and NEIGHBORING FACETS to output\n");
-    for (i= 0; i < qh_PRINTEND; i++)  /* use fout for geomview output */
-      qh_printneighborhood (qh fout, qh PRINTout[i], atfacet, otherfacet,
-			    !qh_ALL);
+    qh_fprintf(qh ferr, 8139, "ERRONEOUS and NEIGHBORING FACETS to output\n");
+    for (i=0; i < qh_PRINTEND; i++)  /* use fout for geomview output */
+      qh_printneighborhood(qh fout, qh PRINTout[i], atfacet, otherfacet,
+                            !qh_ALL);
   }
 } /* errprint */
 
 
 /*---------------------------------
-  
+
   qh_printfacetlist( fp, facetlist, facets, printall )
     print all fields for a facet list and/or set of facets to fp
-    if !printall, 
+    if !printall,
       only prints good facets
 
   notes:
@@ -299,26 +304,216 @@
 void qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall) {
   facetT *facet, **facetp;
 
-  qh_printbegin (qh ferr, qh_PRINTfacets, facetlist, facets, printall);
+  qh_printbegin(qh ferr, qh_PRINTfacets, facetlist, facets, printall);
   FORALLfacet_(facetlist)
     qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);
   FOREACHfacet_(facets)
     qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);
-  qh_printend (qh ferr, qh_PRINTfacets, facetlist, facets, printall);
+  qh_printend(qh ferr, qh_PRINTfacets, facetlist, facets, printall);
 } /* printfacetlist */
 
 
+/*---------------------------------
+
+  qh_printhelp_degenerate( fp )
+    prints descriptive message for precision error
+
+  notes:
+    no message if qh_QUICKhelp
+*/
+void qh_printhelp_degenerate(FILE *fp) {
+
+  if (qh MERGEexact || qh PREmerge || qh JOGGLEmax < REALmax/2)
+    qh_fprintf(fp, 9368, "\n\
+A Qhull error has occurred.  Qhull should have corrected the above\n\
+precision error.  Please send the input and all of the output to\n\
+qhull_bug at qhull.org\n");
+  else if (!qh_QUICKhelp) {
+    qh_fprintf(fp, 9369, "\n\
+Precision problems were detected during construction of the convex hull.\n\
+This occurs because convex hull algorithms assume that calculations are\n\
+exact, but floating-point arithmetic has roundoff errors.\n\
+\n\
+To correct for precision problems, do not use 'Q0'.  By default, Qhull\n\
+selects 'C-0' or 'Qx' and merges non-convex facets.  With option 'QJ',\n\
+Qhull joggles the input to prevent precision problems.  See \"Imprecision\n\
+in Qhull\" (qh-impre.htm).\n\
+\n\
+If you use 'Q0', the output may include\n\
+coplanar ridges, concave ridges, and flipped facets.  In 4-d and higher,\n\
+Qhull may produce a ridge with four neighbors or two facets with the same \n\
+vertices.  Qhull reports these events when they occur.  It stops when a\n\
+concave ridge, flipped facet, or duplicate facet occurs.\n");
+#if REALfloat
+    qh_fprintf(fp, 9370, "\
+\n\
+Qhull is currently using single precision arithmetic.  The following\n\
+will probably remove the precision problems:\n\
+  - recompile qhull for realT precision(#define REALfloat 0 in user.h).\n");
+#endif
+    if (qh DELAUNAY && !qh SCALElast && qh MAXabs_coord > 1e4)
+      qh_fprintf(fp, 9371, "\
+\n\
+When computing the Delaunay triangulation of coordinates > 1.0,\n\
+  - use 'Qbb' to scale the last coordinate to [0,m] (max previous coordinate)\n");
+    if (qh DELAUNAY && !qh ATinfinity)
+      qh_fprintf(fp, 9372, "\
+When computing the Delaunay triangulation:\n\
+  - use 'Qz' to add a point at-infinity.  This reduces precision problems.\n");
+
+    qh_fprintf(fp, 9373, "\
+\n\
+If you need triangular output:\n\
+  - use option 'Qt' to triangulate the output\n\
+  - use option 'QJ' to joggle the input points and remove precision errors\n\
+  - use option 'Ft'.  It triangulates non-simplicial facets with added points.\n\
+\n\
+If you must use 'Q0',\n\
+try one or more of the following options.  They can not guarantee an output.\n\
+  - use 'QbB' to scale the input to a cube.\n\
+  - use 'Po' to produce output and prevent partitioning for flipped facets\n\
+  - use 'V0' to set min. distance to visible facet as 0 instead of roundoff\n\
+  - use 'En' to specify a maximum roundoff error less than %2.2g.\n\
+  - options 'Qf', 'Qbb', and 'QR0' may also help\n",
+               qh DISTround);
+    qh_fprintf(fp, 9374, "\
+\n\
+To guarantee simplicial output:\n\
+  - use option 'Qt' to triangulate the output\n\
+  - use option 'QJ' to joggle the input points and remove precision errors\n\
+  - use option 'Ft' to triangulate the output by adding points\n\
+  - use exact arithmetic (see \"Imprecision in Qhull\", qh-impre.htm)\n\
+");
+  }
+} /* printhelp_degenerate */
+
+
 /*---------------------------------
+
+  qh_printhelp_narrowhull( minangle )
+    Warn about a narrow hull
+
+  notes:
+    Alternatively, reduce qh_WARNnarrow in user.h
+
+*/
+void qh_printhelp_narrowhull(FILE *fp, realT minangle) {
+
+    qh_fprintf(fp, 9375, "qhull precision warning: \n\
+The initial hull is narrow (cosine of min. angle is %.16f).\n\
+A coplanar point may lead to a wide facet.  Options 'QbB' (scale to unit box)\n\
+or 'Qbb' (scale last coordinate) may remove this warning.  Use 'Pp' to skip\n\
+this warning.  See 'Limitations' in qh-impre.htm.\n",
+          -minangle);   /* convert from angle between normals to angle between facets */
+} /* printhelp_narrowhull */
+
+/*---------------------------------
+
+  qh_printhelp_singular( fp )
+    prints descriptive message for singular input
+*/
+void qh_printhelp_singular(FILE *fp) {
+  facetT *facet;
+  vertexT *vertex, **vertexp;
+  realT min, max, *coord, dist;
+  int i,k;
+
+  qh_fprintf(fp, 9376, "\n\
+The input to qhull appears to be less than %d dimensional, or a\n\
+computation has overflowed.\n\n\
+Qhull could not construct a clearly convex simplex from points:\n",
+           qh hull_dim);
+  qh_printvertexlist(fp, "", qh facet_list, NULL, qh_ALL);
+  if (!qh_QUICKhelp)
+    qh_fprintf(fp, 9377, "\n\
+The center point is coplanar with a facet, or a vertex is coplanar\n\
+with a neighboring facet.  The maximum round off error for\n\
+computing distances is %2.2g.  The center point, facets and distances\n\
+to the center point are as follows:\n\n", qh DISTround);
+  qh_printpointid(fp, "center point", qh hull_dim, qh interior_point, -1);
+  qh_fprintf(fp, 9378, "\n");
+  FORALLfacets {
+    qh_fprintf(fp, 9379, "facet");
+    FOREACHvertex_(facet->vertices)
+      qh_fprintf(fp, 9380, " p%d", qh_pointid(vertex->point));
+    zinc_(Zdistio);
+    qh_distplane(qh interior_point, facet, &dist);
+    qh_fprintf(fp, 9381, " distance= %4.2g\n", dist);
+  }
+  if (!qh_QUICKhelp) {
+    if (qh HALFspace)
+      qh_fprintf(fp, 9382, "\n\
+These points are the dual of the given halfspaces.  They indicate that\n\
+the intersection is degenerate.\n");
+    qh_fprintf(fp, 9383,"\n\
+These points either have a maximum or minimum x-coordinate, or\n\
+they maximize the determinant for k coordinates.  Trial points\n\
+are first selected from points that maximize a coordinate.\n");
+    if (qh hull_dim >= qh_INITIALmax)
+      qh_fprintf(fp, 9384, "\n\
+Because of the high dimension, the min x-coordinate and max-coordinate\n\
+points are used if the determinant is non-zero.  Option 'Qs' will\n\
+do a better, though much slower, job.  Instead of 'Qs', you can change\n\
+the points by randomly rotating the input with 'QR0'.\n");
+  }
+  qh_fprintf(fp, 9385, "\nThe min and max coordinates for each dimension are:\n");
+  for (k=0; k < qh hull_dim; k++) {
+    min= REALmax;
+    max= -REALmin;
+    for (i=qh num_points, coord= qh first_point+k; i--; coord += qh hull_dim) {
+      maximize_(max, *coord);
+      minimize_(min, *coord);
+    }
+    qh_fprintf(fp, 9386, "  %d:  %8.4g  %8.4g  difference= %4.4g\n", k, min, max, max-min);
+  }
+  if (!qh_QUICKhelp) {
+    qh_fprintf(fp, 9387, "\n\
+If the input should be full dimensional, you have several options that\n\
+may determine an initial simplex:\n\
+  - use 'QJ'  to joggle the input and make it full dimensional\n\
+  - use 'QbB' to scale the points to the unit cube\n\
+  - use 'QR0' to randomly rotate the input for different maximum points\n\
+  - use 'Qs'  to search all points for the initial simplex\n\
+  - use 'En'  to specify a maximum roundoff error less than %2.2g.\n\
+  - trace execution with 'T3' to see the determinant for each point.\n",
+                     qh DISTround);
+#if REALfloat
+    qh_fprintf(fp, 9388, "\
+  - recompile qhull for realT precision(#define REALfloat 0 in libqhull.h).\n");
+#endif
+    qh_fprintf(fp, 9389, "\n\
+If the input is lower dimensional:\n\
+  - use 'QJ' to joggle the input and make it full dimensional\n\
+  - use 'Qbk:0Bk:0' to delete coordinate k from the input.  You should\n\
+    pick the coordinate with the least range.  The hull will have the\n\
+    correct topology.\n\
+  - determine the flat containing the points, rotate the points\n\
+    into a coordinate plane, and delete the other coordinates.\n\
+  - add one or more points to make the input full dimensional.\n\
+");
+    if (qh DELAUNAY && !qh ATinfinity)
+      qh_fprintf(fp, 9390, "\n\n\
+This is a Delaunay triangulation and the input is co-circular or co-spherical:\n\
+  - use 'Qz' to add a point \"at infinity\" (i.e., above the paraboloid)\n\
+  - or use 'QJ' to joggle the input and avoid co-circular data\n");
+  }
+} /* printhelp_singular */
+
+/*---------------------------------
-  
+
   qh_user_memsizes()
     allocate up to 10 additional, quick allocation sizes
 
   notes:
     increase maximum number of allocations in qh_initqhull_mem()
 */
-void qh_user_memsizes (void) {
+void qh_user_memsizes(void) {
 
-  /* qh_memsize (size); */
+  /* qh_memsize(size); */
 } /* user_memsizes */
 
+

Modified: trunk/scipy/spatial/qhull/src/user.h
===================================================================
--- trunk/scipy/spatial/qhull/src/user.h	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/user.h	2010-11-16 21:18:37 UTC (rev 6902)
@@ -6,55 +6,120 @@
 
    see qh-user.htm.  see COPYING for copyright information.
 
-   before reading any code, review qhull.h for data structure definitions and 
+   before reading any code, review libqhull.h for data structure definitions and
    the "qh" macro.
+
+Sections:
+   ============= qhull library constants ======================
+   ============= data types and configuration macros ==========
+   ============= performance related constants ================
+   ============= memory constants =============================
+   ============= joggle constants =============================
+   ============= conditional compilation ======================
+   ============= -merge constants- ============================
+
+Code flags --
+  NOerrors -- the code does not call qh_errexit()
+  WARN64 -- the code may be incompatible with 64-bit pointers
+
 */
 
+#include 
+
 #ifndef qhDEFuser
 #define qhDEFuser 1
 
+/*============================================================*/
+/*============= qhull library constants ======================*/
+/*============================================================*/
+
+/*----------------------------------
+
+  FILENAMElen -- max length for TI and TO filenames
+
+*/
+
+#define qh_FILENAMElen 500
+
+/*----------------------------------
+
+  msgcode -- Unique message codes for qh_fprintf
+
+  If add new messages, assign these values and increment.
+
+  def counters =  [27, 1047, 2059, 3025, 4068, 5003, 
+     6233, 7079, 8143, 9410, 10026]
+
+  See: qh_ERR* [libqhull.h]
+*/
+
+#define MSG_TRACE0 0
+#define MSG_TRACE1 1000
+#define MSG_TRACE2 2000
+#define MSG_TRACE3 3000
+#define MSG_TRACE4 4000
+#define MSG_TRACE5 5000
+#define MSG_ERROR  6000   /* errors written to qh.ferr */
+#define MSG_WARNING 7000
+#define MSG_STDERR  8000  /* log messages Written to qh.ferr */
+#define MSG_OUTPUT  9000
+#define MSG_FIXUP  10000
+#define MSG_MAXLEN  3000 /* qh_printhelp_degenerate() in user.c */
+
+
+/*----------------------------------
+
+  qh_OPTIONline -- max length of an option line 'FO'
+*/
+#define qh_OPTIONline 80
+
+/*============================================================*/
 /*============= data types and configuration macros ==========*/
+/*============================================================*/
 
 /*----------------------------------
-  
+
   realT
     set the size of floating point numbers
-  
-  qh_REALdigits 
+
+  qh_REALdigits
     maximimum number of significant digits
-  
+
   qh_REAL_1, qh_REAL_2n, qh_REAL_3n
     format strings for printf
-  
+
   qh_REALmax, qh_REALmin
-    maximum and minimum (near zero) values  
-  
+    maximum and minimum (near zero) values
+
   qh_REALepsilon
     machine roundoff.  Maximum roundoff error for addition and multiplication.
-    
+
   notes:
    Select whether to store floating point numbers in single precision (float)
    or double precision (double).
-   
+
    Use 'float' to save about 8% in time and 25% in space.  This is particularly
-   help if high-d where convex hulls are space limited.  Using 'float' also
-   reduces the printed size of Qhull's output since numbers have 8 digits of 
+   helpful if high-d where convex hulls are space limited.  Using 'float' also
+   reduces the printed size of Qhull's output since numbers have 8 digits of
    precision.
-   
+
    Use 'double' when greater arithmetic precision is needed.  This is needed
-   for Delaunay triangulations and Voronoi diagrams when you are not merging 
+   for Delaunay triangulations and Voronoi diagrams when you are not merging
    facets.
 
    If 'double' gives insufficient precision, your data probably includes
    degeneracies.  If so you should use facet merging (done by default)
-   or exact arithmetic (see imprecision section of manual, qh-impre.htm).  
+   or exact arithmetic (see imprecision section of manual, qh-impre.htm).
    You may also use option 'Po' to force output despite precision errors.
 
    You may use 'long double', but many format statements need to be changed
    and you may need a 'long double' square root routine.  S. Grundmann
-   (sg at eeiwzb.et.tu-dresden.de) has done this.  He reports that the code runs 
-   much slower with little gain in precision.    
+   (sg at eeiwzb.et.tu-dresden.de) has done this.  He reports that the code runs
+   much slower with little gain in precision.
 
    WARNING: on some machines,    int f(){realT a= REALmax;return (a == REALmax);}
       returns False.  Use (a > REALmax/2) instead of (a == REALmax).
@@ -90,13 +155,13 @@
 
 /*----------------------------------
-  
+
   qh_CPUclock
     define the clock() function for reporting the total time spent by Qhull
     returns CPU ticks as a 'long int'
     qh_CPUclock is only used for reporting the total time spent by Qhull
 
-  qh_SECticks 
+  qh_SECticks
     the number of clock ticks per second
 
   notes:
@@ -105,29 +170,29 @@
 
     if your system does not use clock() to return CPU ticks, replace
     qh_CPUclock with the corresponding function.  It is converted
-    to unsigned long to prevent wrap-around during long runs.
-   
+    to 'unsigned long' to prevent wrap-around during long runs.  By default,
+     defines clock_t as 'long'
 
    Set qh_CLOCKtype to
-   
-     1	   	for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or microsecond
+
+     1          for CLOCKS_PER_SEC, CLOCKS_PER_SECOND, or microsecond
                 Note:  may fail if more than 1 hour elapsed time
 
-     2	   	use qh_clock() with POSIX times() (see global.c)
+     2          use qh_clock() with POSIX times() (see global.c)
 */
 #define qh_CLOCKtype 1  /* change to the desired number */
 
 #if (qh_CLOCKtype == 1)
 
-#if defined (CLOCKS_PER_SECOND)
+#if defined(CLOCKS_PER_SECOND)
 #define qh_CPUclock    ((unsigned long)clock())  /* return CPU clock */
 #define qh_SECticks CLOCKS_PER_SECOND
 
-#elif defined (CLOCKS_PER_SEC)
+#elif defined(CLOCKS_PER_SEC)
 #define qh_CPUclock    ((unsigned long)clock())  /* return CPU clock */
 #define qh_SECticks CLOCKS_PER_SEC
 
-#elif defined (CLK_TCK)
+#elif defined(CLK_TCK)
 #define qh_CPUclock    ((unsigned long)clock())  /* return CPU clock */
 #define qh_SECticks CLK_TCK
 
@@ -146,11 +211,11 @@
 
 /*----------------------------------
-  
+
   qh_RANDOMtype, qh_RANDOMmax, qh_RANDOMseed
     define random number generator
 
-    qh_RANDOMint generates a random integer between 0 and qh_RANDOMmax.  
+    qh_RANDOMint generates a random integer between 0 and qh_RANDOMmax.
     qh_RANDOMseed sets the random number seed for qh_RANDOMint
 
   Set qh_RANDOMtype (default 5) to:
@@ -159,7 +224,7 @@
     3       for rand() with 31 bits (Sun)
     4       for lrand48() with 31 bits (Solaris)
     5       for qh_rand() with 31 bits (included with Qhull)
-  
+
   notes:
     Random numbers are used by rbox to generate point sets.  Random
     numbers are used by Qhull to rotate the input ('QRn' option),
@@ -168,12 +233,12 @@
 
     Random number generators differ between systems.  Most systems provide
     rand() but the period varies.  The period of rand() is not critical
-    since qhull does not normally use random numbers.  
+    since qhull does not normally use random numbers.
 
     The default generator is Park & Miller's minimal standard random
     number generator [CACM 31:1195 '88].  It is included with Qhull.
 
-    If qh_RANDOMmax is wrong, qhull will report a warning and Geomview 
+    If qh_RANDOMmax is wrong, qhull will report a warning and Geomview
     output will likely be invisible.
 */
 #define qh_RANDOMtype 5   /* *** change to the desired number *** */
@@ -191,7 +256,7 @@
 #endif
 #define qh_RANDOMint  rand()
 #define qh_RANDOMseed_(seed) srand((unsigned)seed);
-  
+
 #elif (qh_RANDOMtype == 3)
 #define qh_RANDOMmax ((realT)0x7fffffffUL)  /* 31 bits, Sun */
 #define qh_RANDOMint  rand()
@@ -214,158 +279,166 @@
 
 /*----------------------------------
-  
+
   qh_ORIENTclock
     0 for inward pointing normals by Geomview convention
 */
-#define qh_ORIENTclock 0 
+#define qh_ORIENTclock 0
 
 
-/*========= performance related constants =========*/
+/*============================================================*/
+/*============= joggle constants =============================*/
+/*============================================================*/
 
 /*----------------------------------
-  
-  qh_HASHfactor
-    total hash slots / used hash slots.  Must be at least 1.1.
-      
-  notes:
-    =2 for at worst 50% occupancy for qh hash_table and normally 25% occupancy
+>---------------------------------
+
+qh_JOGGLEdefault
+default qh.JOGGLEmax is qh.DISTround * qh_JOGGLEdefault
+
+notes:
+rbox s r 100 | qhull QJ1e-15 QR0 generates 90% faults at distround 7e-16
+rbox s r 100 | qhull QJ1e-14 QR0 generates 70% faults
+rbox s r 100 | qhull QJ1e-13 QR0 generates 35% faults
+rbox s r 100 | qhull QJ1e-12 QR0 generates 8% faults
+rbox s r 100 | qhull QJ1e-11 QR0 generates 1% faults
+rbox s r 100 | qhull QJ1e-10 QR0 generates 0% faults
+rbox 1000 W0 | qhull QJ1e-12 QR0 generates 86% faults
+rbox 1000 W0 | qhull QJ1e-11 QR0 generates 20% faults
+rbox 1000 W0 | qhull QJ1e-10 QR0 generates 2% faults
+the later have about 20 points per facet, each of which may interfere
+
+pick a value large enough to avoid retries on most inputs
 */
-#define qh_HASHfactor 2
+#define qh_JOGGLEdefault 30000.0
 
 /*----------------------------------
-  
-  qh_VERIFYdirect
-    with 'Tv' verify all points against all facets if op count is smaller
+>---------------------------------
 
-  notes:
-    if greater, calls qh_check_bestdist() instead
+qh_JOGGLEincrease
+factor to increase qh.JOGGLEmax on qh_JOGGLEretry or qh_JOGGLEagain
 */
-#define qh_VERIFYdirect 1000000 
+#define qh_JOGGLEincrease 10.0
 
 /*----------------------------------
-  
-  qh_INITIALsearch
-     if qh_INITIALmax, search points up to this dimension
+>---------------------------------
+
+qh_JOGGLEretry
+if ZZretry = qh_JOGGLEretry, increase qh.JOGGLEmax
+
+notes:
+try twice at the original value in case of bad luck the first time
 */
-#define qh_INITIALsearch 6
+#define qh_JOGGLEretry 2
 
 /*----------------------------------
-  
-  qh_INITIALmax
-    if dim >= qh_INITIALmax, use min/max coordinate points for initial simplex
-      
-  notes:
-    from points with non-zero determinants
-    use option 'Qs' to override (much slower)
+>---------------------------------
+
+qh_JOGGLEagain
+every following qh_JOGGLEagain, increase qh.JOGGLEmax
+
+notes:
+1 is OK since it's already failed qh_JOGGLEretry times
 */
-#define qh_INITIALmax 8
+#define qh_JOGGLEagain 1
 
 /*----------------------------------
-  
-  qh_JOGGLEdefault
-    default qh.JOGGLEmax is qh.DISTround * qh_JOGGLEdefault
+>---------------------------------
 
-  notes:
-    rbox s r 100 | qhull QJ1e-15 QR0 generates 90% faults at distround 7e-16
-    rbox s r 100 | qhull QJ1e-14 QR0 generates 70% faults
-    rbox s r 100 | qhull QJ1e-13 QR0 generates 35% faults
-    rbox s r 100 | qhull QJ1e-12 QR0 generates 8% faults
-    rbox s r 100 | qhull QJ1e-11 QR0 generates 1% faults
-    rbox s r 100 | qhull QJ1e-10 QR0 generates 0% faults
-    rbox 1000 W0 | qhull QJ1e-12 QR0 generates 86% faults
-    rbox 1000 W0 | qhull QJ1e-11 QR0 generates 20% faults
-    rbox 1000 W0 | qhull QJ1e-10 QR0 generates 2% faults
-    the later have about 20 points per facet, each of which may interfere
+qh_JOGGLEmaxincrease
+maximum qh.JOGGLEmax due to qh_JOGGLEincrease
+relative to qh.MAXwidth
 
-    pick a value large enough to avoid retries on most inputs
+notes:
+qh.joggleinput will retry at this value until qh_JOGGLEmaxretry
 */
-#define qh_JOGGLEdefault 30000.0
+#define qh_JOGGLEmaxincrease 1e-2
 
 /*----------------------------------
-  
-  qh_JOGGLEincrease
-    factor to increase qh.JOGGLEmax on qh_JOGGLEretry or qh_JOGGLEagain
+>---------------------------------
+
+qh_JOGGLEmaxretry
+stop after qh_JOGGLEmaxretry attempts
 */
-#define qh_JOGGLEincrease 10.0
+#define qh_JOGGLEmaxretry 100
 
+/*============================================================*/
+/*============= performance related constants ================*/
+/*============================================================*/
+
 /*----------------------------------
-  
-  qh_JOGGLEretry
-    if ZZretry = qh_JOGGLEretry, increase qh.JOGGLEmax
+  >---------------------------------
 
+  qh_HASHfactor
+    total hash slots / used hash slots.  Must be at least 1.1.
+
   notes:
-    try twice at the original value in case of bad luck the first time
+    =2 for at worst 50% occupancy for qh hash_table and normally 25% occupancy
 */
-#define qh_JOGGLEretry 2
+#define qh_HASHfactor 2
 
 /*----------------------------------
-  
-  qh_JOGGLEagain
-    every following qh_JOGGLEagain, increase qh.JOGGLEmax
+  >---------------------------------
 
+  qh_VERIFYdirect
+    with 'Tv' verify all points against all facets if op count is smaller
+
   notes:
-    1 is OK since it's already failed qh_JOGGLEretry times
+    if greater, calls qh_check_bestdist() instead
 */
-#define qh_JOGGLEagain 1
+#define qh_VERIFYdirect 1000000
 
 /*----------------------------------
-  
-  qh_JOGGLEmaxincrease
-    maximum qh.JOGGLEmax due to qh_JOGGLEincrease
-    relative to qh.MAXwidth
+  >---------------------------------
 
-  notes:
-    qh.joggleinput will retry at this value until qh_JOGGLEmaxretry
+  qh_INITIALsearch
+     if qh_INITIALmax, search points up to this dimension
 */
-#define qh_JOGGLEmaxincrease 1e-2
+#define qh_INITIALsearch 6
 
 /*----------------------------------
-  
-  qh_JOGGLEmaxretry
-    stop after qh_JOGGLEmaxretry attempts
+  >---------------------------------
+
+  qh_INITIALmax
+    if dim >= qh_INITIALmax, use min/max coordinate points for initial simplex
+
+  notes:
+    from points with non-zero determinants
+    use option 'Qs' to override (much slower)
 */
-#define qh_JOGGLEmaxretry 100
+#define qh_INITIALmax 8
 
-/*========= memory constants =========*/
+/*============================================================*/
+/*============= memory constants =============================*/
+/*============================================================*/
 
 /*----------------------------------
-  
+
   qh_MEMalign
     memory alignment for qh_meminitbuffers() in global.c
-    
+
   notes:
     to avoid bus errors, memory allocation must consider alignment requirements.
     malloc() automatically takes care of alignment.   Since mem.c manages
     its own memory, we need to explicitly specify alignment in
     qh_meminitbuffers().
 
-    A safe choice is sizeof(double).  sizeof(float) may be used if doubles 
+    A safe choice is sizeof(double).  sizeof(float) may be used if doubles
     do not occur in data structures and pointers are the same size.  Be careful
-    of machines (e.g., DEC Alpha) with large pointers. 
+    of machines (e.g., DEC Alpha) with large pointers.
 
     If using gcc, best alignment is
               #define qh_MEMalign fmax_(__alignof__(realT),__alignof__(void *))
 */
-#define qh_MEMalign fmax_(sizeof(realT), sizeof(void *))
+#define qh_MEMalign ((int)(fmax_(sizeof(realT), sizeof(void *))))
 
 /*----------------------------------
-  
+
   qh_MEMbufsize
     size of additional memory buffers
-    
+
   notes:
     used for qh_meminitbuffers() in global.c
 */
@@ -373,10 +446,10 @@
 
 /*----------------------------------
-  
+
   qh_MEMinitbuf
     size of initial memory buffer
-    
+
   notes:
     use for qh_meminitbuffers() in global.c
 */
@@ -384,7 +457,7 @@
 
 /*----------------------------------
-  
+
   qh_INFINITE
     on output, indicates Voronoi center at infinity
 */
@@ -392,13 +465,19 @@
 
 /*----------------------------------
-  
+
   qh_DEFAULTbox
     default box size (Geomview expects 0.5)
+
+  qh_DEFAULTbox
+    default box size for integer coorindate (rbox only)
 */
-#define qh_DEFAULTbox 0.5 
+#define qh_DEFAULTbox 0.5
+#define qh_DEFAULTzbox 1e6
 
-/*======= conditional compilation ============================*/
+/*============================================================*/
+/*============= conditional compilation ======================*/
+/*============================================================*/
 
 /*----------------------------------
@@ -408,145 +487,152 @@
 
   __MSC_VER
     defined by Microsoft Visual C++
-  
+
   __MWERKS__ && __POWERPC__
     defined by Metrowerks when compiling for the Power Macintosh
 
   __STDC__
-    defined for strict ANSI C 
+    defined for strict ANSI C
 */
 
 /*----------------------------------
- 
-  qh_COMPUTEfurthest 
+
+  qh_COMPUTEfurthest
     compute furthest distance to an outside point instead of storing it with the facet
     =1 to compute furthest
-  
+
   notes:
     computing furthest saves memory but costs time
       about 40% more distance tests for partitioning
-      removes facet->furthestdist 
+      removes facet->furthestdist
 */
 #define qh_COMPUTEfurthest 0
-                         
+
 /*----------------------------------
- 
-  qh_KEEPstatistics   
+
+  qh_KEEPstatistics
     =0 removes most of statistic gathering and reporting
 
   notes:
     if 0, code size is reduced by about 4%.
 */
 #define qh_KEEPstatistics 1
-                       
+
 /*----------------------------------
- 
-  qh_MAXoutside 
+
+  qh_MAXoutside
     record outer plane for each facet
     =1 to record facet->maxoutside
-  
+
   notes:
     this takes a realT per facet and slightly slows down qhull
-    it produces better outer planes for geomview output 
+    it produces better outer planes for geomview output
 */
 #define qh_MAXoutside 1
 
 /*----------------------------------
- 
+
   qh_NOmerge
     disables facet merging if defined
-    
+
   notes:
     This saves about 10% space.
-    
+
     Unless 'Q0'
       qh_NOmerge sets 'QJ' to avoid precision errors
 
-    #define qh_NOmerge    
+    #define qh_NOmerge
 
   see:
     qh_NOmem in mem.c
-    
+
     see user.c/user_eg.c for removing io.o
-*/  
-    
+*/
+
 /*----------------------------------
- 
+
   qh_NOtrace
-    no tracing if defined 
-  
+    no tracing if defined
+
   notes:
     This saves about 5% space.
 
     #define qh_NOtrace
-*/    
+*/
 
 /*----------------------------------
-  
+
   qh_QHpointer
     access global data with pointer or static structure
 
   qh_QHpointer  = 1     access globals via a pointer to allocated memory
                         enables qh_saveqhull() and qh_restoreqhull()
-			costs about 8% in time and 2% in space
+                        [2010, gcc] costs about 4% in time and 4% in space
+                        [2003, msvc] costs about 8% in time and 2% in space
 
-		= 0     qh_qh and qh_qhstat are static data structures
-		        only one instance of qhull() can be active at a time
-			default value
+                = 0     qh_qh and qh_qhstat are static data structures
+                        only one instance of qhull() can be active at a time
+                        default value
 
   notes:
     all global variables for qhull are in qh, qhmem, and qhstat
-    qh is defined in qhull.h
+    qh is defined in libqhull.h
     qhmem is defined in mem.h
     qhstat is defined in stat.h
+    C++ build defines qh_QHpointer [libqhullp.pro, libqhullcpp.pro]
 
   see:
     user_eg.c for an example
+  FIXUP need to override for C++ (-Dqh_QHpointer=1)
 */
+#ifndef qh_QHpointer
 #define qh_QHpointer 0
+#endif
 #if 0  /* sample code */
     qhT *oldqhA, *oldqhB;
 
-    exitcode= qh_new_qhull (dim, numpoints, points, ismalloc,
-                      flags, outfile, errfile); 
+    exitcode= qh_new_qhull(dim, numpoints, points, ismalloc,
+                      flags, outfile, errfile);
     /* use results from first call to qh_new_qhull */
     oldqhA= qh_save_qhull();
-    exitcode= qh_new_qhull (dimB, numpointsB, pointsB, ismalloc,
-                      flags, outfile, errfile); 
+    exitcode= qh_new_qhull(dimB, numpointsB, pointsB, ismalloc,
+                      flags, outfile, errfile);
     /* use results from second call to qh_new_qhull */
     oldqhB= qh_save_qhull();
-    qh_restore_qhull (&oldqhA);
+    qh_restore_qhull(&oldqhA);
     /* use results from first call to qh_new_qhull */
-    qh_freeqhull (qh_ALL);  /* frees all memory used by first call */
-    qh_restore_qhull (&oldqhB);
+    qh_freeqhull(qh_ALL);  /* frees all memory used by first call */
+    qh_restore_qhull(&oldqhB);
     /* use results from second call to qh_new_qhull */
-    qh_freeqhull (!qh_ALL); /* frees long memory used by second call */
-    qh_memfreeshort (&curlong, &totlong);  /* frees short memory and memory allocator */
+    qh_freeqhull(!qh_ALL); /* frees long memory used by second call */
+    qh_memfreeshort(&curlong, &totlong);  /* frees short memory and memory allocator */
 #endif
 
 /*----------------------------------
- 
-  qh_QUICKhelp        
+
+  qh_QUICKhelp
     =1 to use abbreviated help messages, e.g., for degenerate inputs
 */
-#define qh_QUICKhelp    0  
+#define qh_QUICKhelp    0
 
-/* ============ -merge constants- ====================
-
+/*============================================================*/
+/*============= -merge constants- ============================*/
+/*============================================================*/
+/*
    These constants effect facet merging.  You probably will not need
-   to modify these.  They effect the performance of facet merging.
+   to modify them.  They effect the performance of facet merging.
 */
 
 /*----------------------------------
-  
+
   qh_DIMmergeVertex
     max dimension for vertex merging (it is not effective in high-d)
 */
@@ -554,7 +640,7 @@
 
 /*----------------------------------
-  
+
   qh_DIMreduceBuild
      max dimension for vertex reduction during build (slow in high-d)
 */
@@ -562,7 +648,7 @@
 
 /*----------------------------------
-     
+
   qh_BESTcentrum
      if > 2*dim+n vertices, qh_findbestneighbor() tests centrums (faster)
      else, qh_findbestneighbor() tests all vertices (much better merges)
@@ -575,21 +661,21 @@
 
 /*----------------------------------
-  
+
   qh_BESTnonconvex
     if > dim+n neighbors, qh_findbestneighbor() tests nonconvex ridges.
-    
+
   notes:
     It is needed because qh_findbestneighbor is slow for large facets
 */
-#define qh_BESTnonconvex 15 
+#define qh_BESTnonconvex 15
 
 /*----------------------------------
-  
+
   qh_MAXnewmerges
     if >n newmerges, qh_merge_nonconvex() calls qh_reducevertices_centrums.
-     
+
   notes:
     It is needed because postmerge can merge many facets at once
 */
@@ -597,20 +683,20 @@
 
 /*----------------------------------
-  
+
   qh_MAXnewcentrum
     if <= dim+n vertices (n approximates the number of merges),
       reset the centrum in qh_updatetested() and qh_mergecycle_facets()
-    
+
   notes:
-    needed to reduce cost and because centrums may move too much if 
+    needed to reduce cost and because centrums may move too much if
     many vertices in high-d
 */
 #define qh_MAXnewcentrum 5
 
 /*----------------------------------
-  
+
   qh_COPLANARratio
     for 3-d+ merging, qh.MINvisible is n*premerge_centrum
 
@@ -621,15 +707,15 @@
 
 /*----------------------------------
-  
+
   qh_DISToutside
-    When is a point clearly outside of a facet?  
+    When is a point clearly outside of a facet?
     Stops search in qh_findbestnew or qh_partitionall
     qh_findbest uses qh.MINoutside since since it is only called if no merges.
-     
+
   notes:
     'Qf' always searches for best facet
-    if !qh.MERGING, same as qh.MINoutside. 
+    if !qh.MERGING, same as qh.MINoutside.
     if qh_USEfindbestnew, increase value since neighboring facets may be ill-behaved
       [Note: Zdelvertextot occurs normally with interior points]
             RBOX 1000 s Z1 G1e-13 t1001188774 | QHULL Tv
@@ -642,7 +728,7 @@
     Needed in qh_findbestnew for many instances of
       RBOX 1000 s Z1 G1e-13 t | QHULL Tv
 
-  See:  
+  See:
     qh_DISToutside -- when is a point clearly outside of a facet
     qh_SEARCHdist -- when is facet coplanar with the best facet?
     qh_USEfindbestnew -- when to use qh_findbestnew for qh_partitionpoint()
@@ -652,11 +738,11 @@
 
 /*----------------------------------
-  
+
   qh_RATIOnearinside
     ratio of qh.NEARinside to qh.ONEmerge for retaining inside points for
-    qh_check_maxout().  
-  
+    qh_check_maxout().
+
   notes:
     This is overkill since do not know the correct value.
     It effects whether 'Qc' reports all coplanar points
@@ -666,9 +752,9 @@
 
 /*----------------------------------
-  
+
   qh_SEARCHdist
-    When is a facet coplanar with the best facet?  
+    When is a facet coplanar with the best facet?
     qh_findbesthorizon: all coplanar facets of the best facet need to be searched.
 
   See:
@@ -681,11 +767,11 @@
 
 /*----------------------------------
-  
+
   qh_USEfindbestnew
      Always use qh_findbestnew for qh_partitionpoint, otherwise use
      qh_findbestnew if merged new facet or sharpnewfacets.
-  
+
   See:
     qh_DISToutside -- when is a point clearly outside of a facet
     qh_SEARCHdist -- when is facet coplanar with the best facet?
@@ -695,14 +781,14 @@
 
 /*----------------------------------
-  
+
   qh_WIDEcoplanar
-    n*MAXcoplanar or n*MINvisible for a WIDEfacet 
-    
+    n*MAXcoplanar or n*MINvisible for a WIDEfacet
+
     if vertex is further than qh.WIDEfacet from the hyperplane
     then its ridges are not counted in computing the area, and
-    the facet's centrum is frozen. 
-    
+    the facet's centrum is frozen.
+
   notes:
    qh.WIDEfacet= max(qh.MAXoutside,qh_WIDEcoplanar*qh.MAXcoplanar,
       qh_WIDEcoplanar * qh.MINvisible);
@@ -711,13 +797,13 @@
 
 /*----------------------------------
-  
+
   qh_MAXnarrow
     max. cosine in initial hull that sets qh.NARROWhull
-       
+
   notes:
-    If qh.NARROWhull, the initial partition does not make 
-    coplanar points.  If narrow, a coplanar point can be 
+    If qh.NARROWhull, the initial partition does not make
+    coplanar points.  If narrow, a coplanar point can be
     coplanar to two facets of opposite orientations and
     distant from the exact convex hull.
 
@@ -727,24 +813,24 @@
 
 /*----------------------------------
-  
+
   qh_WARNnarrow
     max. cosine in initial hull to warn about qh.NARROWhull
-      
+
   notes:
-    this is a conservative estimate.  
+    this is a conservative estimate.
     Don't actually see problems until it is -1.0.  See qh-impre.htm
 */
 #define qh_WARNnarrow -0.999999999999999
 
 /*----------------------------------
-  
+
   qh_ZEROdelaunay
     a zero Delaunay facet occurs for input sites coplanar with their convex hull
     the last normal coefficient of a zero Delaunay facet is within
         qh_ZEROdelaunay * qh.ANGLEround of 0
-      
+
   notes:
     qh_ZEROdelaunay does not allow for joggled input ('QJ').
 

Deleted: trunk/scipy/spatial/qhull/src/user_eg.c
===================================================================
--- trunk/scipy/spatial/qhull/src/user_eg.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/user_eg.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,317 +0,0 @@
-/*
  ---------------------------------
-
-  user_eg.c
-  sample code for calling qhull() from an application
-  
-  call with:
-
-     user_eg "cube/diamond options" "delaunay options" "halfspace options"
-
-  for example:
-
-     user_eg                             # return summaries
-
-     user_eg "n" "o" "Fp"                # return normals, OFF, points
-
-     user_eg "n Qt" "o" "Fp"             # triangulated cube
-
-     user_eg "QR0 p" "QR0 v p" "QR0 Fp"  # rotate input and return points
-                                         # 'v' returns Voronoi
-					 # transform is rotated for halfspaces
-
-   main() makes three runs of qhull.
-
-     1) compute the convex hull of a cube
-
-     2a) compute the Delaunay triangulation of random points
-
-     2b) find the Delaunay triangle closest to a point.
-
-     3) compute the halfspace intersection of a diamond
-
- notes:
- 
-   For another example, see main() in unix.c and user_eg2.c.
-   These examples, call qh_qhull() directly.  They allow
-   tighter control on the code loaded with Qhull.
-
-   For a simple C++ example, see qhull_interface.cpp
-
-   Summaries are sent to stderr if other output formats are used
-
-   compiled by 'make user_eg'
-
-   see qhull.h for data structures, macros, and user-callable functions.
-*/
-
-#include "qhull_a.h"
-
-/*-------------------------------------------------
--internal function prototypes
-*/
-void print_summary (void);
-void makecube (coordT *points, int numpoints, int dim);
-void makeDelaunay (coordT *points, int numpoints, int dim, int seed);
-void findDelaunay (int dim);
-void makehalf (coordT *points, int numpoints, int dim);
-
-/*-------------------------------------------------
--print_summary()
-*/
-void print_summary (void) {
-  facetT *facet;
-  int k;
-
-  printf ("\n%d vertices and %d facets with normals:\n", 
-                 qh num_vertices, qh num_facets);
-  FORALLfacets {
-    for (k=0; k < qh hull_dim; k++) 
-      printf ("%6.2g ", facet->normal[k]);
-    printf ("\n");
-  }
-}
-
-/*--------------------------------------------------
--makecube- set points to vertices of cube
-  points is numpoints X dim
-*/
-void makecube (coordT *points, int numpoints, int dim) {
-  int j,k;
-  coordT *point;
-
-  for (j=0; jlocate a facet with qh_findbestfacet()
-*/
-void findDelaunay (int dim) {
-  int k;
-  coordT point[ 100];
-  boolT isoutside;
-  realT bestdist;
-  facetT *facet;
-  vertexT *vertex, **vertexp;
-
-  for (k= 0; k < dim; k++) 
-    point[k]= 0.5;
-  qh_setdelaunay (dim+1, 1, point);
-  facet= qh_findbestfacet (point, qh_ALL, &bestdist, &isoutside);
-  if (facet->tricoplanar) {
-    fprintf(stderr, "findDelaunay: not implemented for triangulated, non-simplicial Delaunay regions (tricoplanar facet, f%d).\n",
-       facet->id);
-    qh_errexit (qh_ERRqhull, facet, NULL);
-  }
-  FOREACHvertex_(facet->vertices) {
-    for (k=0; k < dim; k++)
-      printf ("%5.2f ", vertex->point[k]);
-    printf ("\n");
-  }
-} /*.findDelaunay.*/
-
-/*--------------------------------------------------
--makehalf- set points to halfspaces for a (dim)-dimensional diamond
-  points is numpoints X dim+1
-
-  each halfspace consists of dim coefficients followed by an offset
-*/
-void makehalf (coordT *points, int numpoints, int dim) {
-  int j,k;
-  coordT *point;
-
-  for (j=0; j= 2 ? argv[1] : "");
-  numpoints= SIZEcube;
-  makecube (points, numpoints, DIM);
-  for (i=numpoints; i--; )
-    rows[i]= points+dim*i;
-  qh_printmatrix (outfile, "input", rows, numpoints, dim);
-  exitcode= qh_new_qhull (dim, numpoints, points, ismalloc,
-                      flags, outfile, errfile); 
-  if (!exitcode) {                  /* if no error */
-    /* 'qh facet_list' contains the convex hull */
-    print_summary();
-    FORALLfacets {
-       /* ... your code ... */
-    }
-  }
-  qh_freeqhull(!qh_ALL);                   /* free long memory  */
-  qh_memfreeshort (&curlong, &totlong);    /* free short memory and memory allocator */
-  if (curlong || totlong) 
-    fprintf (errfile, "qhull internal warning (user_eg, #1): did not free %d bytes of long memory (%d pieces)\n", totlong, curlong);
-
-  /*
-    Run 2: Delaunay triangulation
-  */
-
-  printf( "\ncompute %d-d Delaunay triangulation\n", dim);
-  sprintf (flags, "qhull s d Tcv %s", argc >= 3 ? argv[2] : "");
-  numpoints= SIZEcube;
-  makeDelaunay (points, numpoints, dim, time(NULL));
-  for (i=numpoints; i--; )
-    rows[i]= points+dim*i;
-  qh_printmatrix (outfile, "input", rows, numpoints, dim);
-  exitcode= qh_new_qhull (dim, numpoints, points, ismalloc,
-                      flags, outfile, errfile); 
-  if (!exitcode) {                  /* if no error */
-    /* 'qh facet_list' contains the convex hull */
-    /* If you want a Voronoi diagram ('v') and do not request output (i.e., outfile=NULL), 
-       call qh_setvoronoi_all() after qh_new_qhull(). */
-    print_summary();
-    FORALLfacets {
-       /* ... your code ... */
-    }
-    printf( "\nfind %d-d Delaunay triangle closest to [0.5, 0.5, ...]\n", dim);
-    exitcode= setjmp (qh errexit);  
-    if (!exitcode) {
-      /* Trap Qhull errors in findDelaunay().  Without the setjmp(), Qhull
-         will exit() after reporting an error */
-      qh NOerrexit= False;
-      findDelaunay (DIM);
-    }
-    qh NOerrexit= True;
-  }
-#if qh_QHpointer  /* see user.h */
-  {
-    qhT *oldqhA, *oldqhB;
-    coordT pointsB[DIM*TOTpoints]; /* array of coordinates for each point */
-
-
-    printf( "\nsave first triangulation and compute a new triangulation\n");
-    oldqhA= qh_save_qhull();
-    sprintf (flags, "qhull s d Tcv %s", argc >= 3 ? argv[2] : "");
-    numpoints= SIZEcube;
-    makeDelaunay (pointsB, numpoints, dim, time(NULL)+1);
-    for (i=numpoints; i--; )
-      rows[i]= pointsB+dim*i;
-    qh_printmatrix (outfile, "input", rows, numpoints, dim);
-    exitcode= qh_new_qhull (dim, numpoints, pointsB, ismalloc,
-                      flags, outfile, errfile); 
-    if (!exitcode)
-      print_summary();
-    printf( "\nsave second triangulation and restore first one\n");
-    oldqhB= qh_save_qhull();
-    qh_restore_qhull (&oldqhA);
-    print_summary();
-    printf( "\nfree first triangulation and restore second one.\n");
-    qh_freeqhull (qh_ALL);               /* free short and long memory used by first call */
-			                 /* do not use qh_memfreeshort */
-    qh_restore_qhull (&oldqhB);
-    print_summary();
-  }
-#endif
-  qh_freeqhull(!qh_ALL);                 /* free long memory */
-  qh_memfreeshort (&curlong, &totlong);  /* free short memory and memory allocator */
-  if (curlong || totlong) 
-    fprintf (errfile, "qhull internal warning (user_eg, #2): did not free %d bytes of long memory (%d pieces)\n", totlong, curlong);
-
-  /*
-    Run 3: halfspace intersection about the origin
-  */
-  printf( "\ncompute halfspace intersection about the origin for a diamond\n");
-  sprintf (flags, "qhull H0 s Tcv %s", argc >= 4 ? argv[3] : "Fp");
-  numpoints= SIZEcube;
-  makehalf (points, numpoints, dim);
-  for (i=numpoints; i--; )
-    rows[i]= points+(dim+1)*i;
-  qh_printmatrix (outfile, "input as halfspace coefficients + offsets", rows, numpoints, dim+1);
-  /* use qh_sethalfspace_all to transform the halfspaces yourself.  
-     If so, set 'qh feasible_point and do not use option 'Hn,...' [it would retransform the halfspaces]
-  */
-  exitcode= qh_new_qhull (dim+1, numpoints, points, ismalloc,
-                      flags, outfile, errfile); 
-  if (!exitcode) 
-    print_summary();
-  qh_freeqhull (!qh_ALL);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong)  /* could also check previous runs */
-    fprintf (stderr, "qhull internal warning (user_eg, #3): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-  return exitcode;
-} /* main */
-

Deleted: trunk/scipy/spatial/qhull/src/user_eg2.c
===================================================================
--- trunk/scipy/spatial/qhull/src/user_eg2.c	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/qhull/src/user_eg2.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -1,542 +0,0 @@
-/*
  ---------------------------------
-
-  user_eg2.c
-
-  sample code for calling qhull() from an application.
-
-  See user_eg.c for a simpler method using qh_new_qhull().
-  The method used here and in unix.c gives you additional
-  control over Qhull. 
-  
-  call with:
-
-     user_eg2 "triangulated cube/diamond options" "delaunay options" "halfspace options"
-
-  for example:
-
-     user_eg2                             # return summaries
-
-     user_eg2 "n" "o" "Fp"                # return normals, OFF, points
-
-     user_eg2 "QR0 p" "QR0 v p" "QR0 Fp"  # rotate input and return points
-                                         # 'v' returns Voronoi
-					 # transform is rotated for halfspaces
-
-   main() makes three runs of qhull.
-
-     1) compute the convex hull of a cube, and incrementally add a diamond
-
-     2a) compute the Delaunay triangulation of random points, and add points.
-
-     2b) find the Delaunay triangle closest to a point.
-
-     3) compute the halfspace intersection of a diamond, and add a cube
-
- notes:
- 
-   summaries are sent to stderr if other output formats are used
-
-   derived from unix.c and compiled by 'make user_eg2'
-
-   see qhull.h for data structures, macros, and user-callable functions.
-   
-   If you want to control all output to stdio and input to stdin,
-   set the #if below to "1" and delete all lines that contain "io.c".  
-   This prevents the loading of io.o.  Qhull will
-   still write to 'qh ferr' (stderr) for error reporting and tracing.
-
-   Defining #if 1, also prevents user.o from being loaded.
-*/
-
-#include "qhull_a.h"
-
-/*-------------------------------------------------
--internal function prototypes
-*/
-void print_summary (void);
-void makecube (coordT *points, int numpoints, int dim);
-void adddiamond (coordT *points, int numpoints, int numnew, int dim);
-void makeDelaunay (coordT *points, int numpoints, int dim);
-void addDelaunay (coordT *points, int numpoints, int numnew, int dim);
-void findDelaunay (int dim);
-void makehalf (coordT *points, int numpoints, int dim);
-void addhalf (coordT *points, int numpoints, int numnew, int dim, coordT *feasible);
-
-/*-------------------------------------------------
--print_summary()
-*/
-void print_summary (void) {
-  facetT *facet;
-  int k;
-
-  printf ("\n%d vertices and %d facets with normals:\n", 
-                 qh num_vertices, qh num_facets);
-  FORALLfacets {
-    for (k=0; k < qh hull_dim; k++) 
-      printf ("%6.2g ", facet->normal[k]);
-    printf ("\n");
-  }
-}
-
-/*--------------------------------------------------
--makecube- set points to vertices of cube
-  points is numpoints X dim
-*/
-void makecube (coordT *points, int numpoints, int dim) {
-  int j,k;
-  coordT *point;
-
-  for (j=0; jlocate a facet with qh_findbestfacet()
-*/
-void findDelaunay (int dim) {
-  int k;
-  coordT point[ 100];
-  boolT isoutside;
-  realT bestdist;
-  facetT *facet;
-  vertexT *vertex, **vertexp;
-
-  for (k= 0; k < dim-1; k++) 
-    point[k]= 0.5;
-  qh_setdelaunay (dim, 1, point);
-  facet= qh_findbestfacet (point, qh_ALL, &bestdist, &isoutside);
-  if (facet->tricoplanar) {
-    fprintf(stderr, "findDelaunay: not implemented for triangulated, non-simplicial Delaunay regions (tricoplanar facet, f%d).\n",
-       facet->id);
-    qh_errexit (qh_ERRqhull, facet, NULL);
-  }
-  FOREACHvertex_(facet->vertices) {
-    for (k=0; k < dim-1; k++)
-      printf ("%5.2f ", vertex->point[k]);
-    printf ("\n");
-  }
-} /*.findDelaunay.*/
-
-/*--------------------------------------------------
--makehalf- set points to halfspaces for a (dim)-d diamond
-  points is numpoints X dim+1
-
-  each halfspace consists of dim coefficients followed by an offset
-*/
-void makehalf (coordT *points, int numpoints, int dim) {
-  int j,k;
-  coordT *point;
-
-  for (j=0; j= 2 ? argv[1] : "");
-    qh_initflags (options);
-    printf( "\ncompute triangulated convex hull of cube after rotating input\n");
-    makecube (array[0], SIZEcube, DIM);
-    qh_init_B (array[0], SIZEcube, DIM, ismalloc);
-    qh_qhull();
-    qh_check_output();
-    qh_triangulate();  /* requires option 'Q11' if want to add points */ 
-    print_summary ();
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-    printf( "\nadd points in a diamond\n");
-    adddiamond (array[0], SIZEcube, SIZEdiamond, DIM);
-    qh_check_output();
-    print_summary (); 
-    qh_produce_output();  /* delete this line to help avoid io.c */
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-  }
-  qh NOerrexit= True;
-  qh_freeqhull (!qh_ALL);
-  qh_memfreeshort (&curlong, &totlong);
-  /*
-    Run 2: Delaunay triangulation
-  */
-  qh_init_A (stdin, stdout, stderr, 0, NULL);
-  exitcode= setjmp (qh errexit);
-  if (!exitcode) {
-    coordT array[TOTpoints][DIM];
-
-    strcat (qh rbox_command, "user_eg Delaunay");
-    sprintf (options, "qhull s d Tcv %s", argc >= 3 ? argv[2] : "");
-    qh_initflags (options);
-    printf( "\ncompute %d-d Delaunay triangulation\n", DIM-1);
-    makeDelaunay (array[0], SIZEcube, DIM);
-    /* Instead of makeDelaunay with qh_setdelaunay, you may
-       produce a 2-d array of points, set DIM to 2, and set 
-       qh PROJECTdelaunay to True.  qh_init_B will call 
-       qh_projectinput to project the points to the paraboloid
-       and add a point "at-infinity".
-    */
-    qh_init_B (array[0], SIZEcube, DIM, ismalloc);
-    qh_qhull();
-    /* If you want Voronoi ('v') without qh_produce_output(), call
-       qh_setvoronoi_all() after qh_qhull() */
-    qh_check_output();
-    print_summary ();
-    qh_produce_output();  /* delete this line to help avoid io.c */
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-    printf( "\nadd points to triangulation\n");
-    addDelaunay (array[0], SIZEcube, SIZEdiamond, DIM); 
-    qh_check_output();
-    qh_produce_output();  /* delete this line to help avoid io.c */
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-    printf( "\nfind Delaunay triangle closest to [0.5, 0.5, ...]\n");
-    findDelaunay (DIM);
-  }
-  qh NOerrexit= True;
-  qh_freeqhull (!qh_ALL);
-  qh_memfreeshort (&curlong, &totlong);
-  /*
-    Run 3: halfspace intersection
-  */
-  qh_init_A (stdin, stdout, stderr, 0, NULL);
-  exitcode= setjmp (qh errexit);
-  if (!exitcode) {
-    coordT array[TOTpoints][DIM+1];  /* +1 for halfspace offset */
-    pointT *points;
-
-    strcat (qh rbox_command, "user_eg halfspaces");
-    sprintf (options, "qhull H0 s Tcv %s", argc >= 4 ? argv[3] : "");
-    qh_initflags (options);
-    printf( "\ncompute halfspace intersection about the origin for a diamond\n");
-    makehalf (array[0], SIZEcube, DIM);
-    qh_setfeasible (DIM); /* from io.c, sets qh feasible_point from 'Hn,n' */
-    /* you may malloc and set qh feasible_point directly.  It is only used for
-       option 'Fp' */
-    points= qh_sethalfspace_all ( DIM+1, SIZEcube, array[0], qh feasible_point); 
-    qh_init_B (points, SIZEcube, DIM, True); /* qh_freeqhull frees points */
-    qh_qhull();
-    qh_check_output();
-    qh_produce_output();  /* delete this line to help avoid io.c */
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-    printf( "\nadd halfspaces for cube to intersection\n");
-    addhalf (array[0], SIZEcube, SIZEdiamond, DIM, qh feasible_point); 
-    qh_check_output();
-    qh_produce_output();  /* delete this line to help avoid io.c */
-    if (qh VERIFYoutput && !qh STOPpoint && !qh STOPcone)
-      qh_check_points ();
-  }
-  qh NOerrexit= True;
-  qh NOerrexit= True;
-  qh_freeqhull (!qh_ALL);
-  qh_memfreeshort (&curlong, &totlong);
-  if (curlong || totlong)  /* could also check previous runs */
-    fprintf (stderr, "qhull internal warning (main): did not free %d bytes of long memory (%d pieces)\n",
-       totlong, curlong);
-  return exitcode;
-} /* main */
-
-#if 1    /* use 1 to prevent loading of io.o and user.o */
-/*-------------------------------------------
--errexit- return exitcode to system after an error
-  assumes exitcode non-zero
-  prints useful information
-  see qh_errexit2() in qhull.c for 2 facets
-*/
-void qh_errexit(int exitcode, facetT *facet, ridgeT *ridge) {
-
-  if (qh ERREXITcalled) {
-    fprintf (qh ferr, "qhull error while processing previous error.  Exit program\n");
-    exit(1);
-  }
-  qh ERREXITcalled= True;
-  if (!qh QHULLfinished)
-    qh hulltime= (unsigned)clock() - qh hulltime;
-  fprintf (qh ferr, "\nWhile executing: %s | %s\n", qh rbox_command, qh qhull_command);
-  fprintf(qh ferr, "Options selected:\n%s\n", qh qhull_options);
-  if (qh furthest_id >= 0) {
-    fprintf(qh ferr, "\nLast point added to hull was p%d", qh furthest_id);
-    if (zzval_(Ztotmerge))
-      fprintf(qh ferr, "  Last merge was #%d.", zzval_(Ztotmerge));
-    if (qh QHULLfinished)
-      fprintf(qh ferr, "\nQhull has finished constructing the hull.");
-    else if (qh POSTmerging)
-      fprintf(qh ferr, "\nQhull has started post-merging");
-    fprintf(qh ferr, "\n\n");
-  }
-  if (qh NOerrexit) {
-    fprintf (qh ferr, "qhull error while ending program.  Exit program\n");
-    exit(1);
-  }
-  if (!exitcode)
-    exitcode= qh_ERRqhull;
-  qh NOerrexit= True;
-  longjmp(qh errexit, exitcode);
-} /* errexit */
-
-
-/*-------------------------------------------
--errprint- prints out the information of the erroneous object
-    any parameter may be NULL, also prints neighbors and geomview output
-*/
-void qh_errprint(char *string, facetT *atfacet, facetT *otherfacet, ridgeT *atridge, vertexT *atvertex) {
-
-  fprintf (qh ferr, "%s facets f%d f%d ridge r%d vertex v%d\n",
-	   string, getid_(atfacet), getid_(otherfacet), getid_(atridge),
-	   getid_(atvertex));
-} /* errprint */
-
-
-void qh_printfacetlist(facetT *facetlist, setT *facets, boolT printall) {
-  facetT *facet, **facetp;
-
-  /* remove these calls to help avoid io.c */
-  qh_printbegin (qh ferr, qh_PRINTfacets, facetlist, facets, printall);/*io.c*/
-  FORALLfacet_(facetlist)                                              /*io.c*/
-    qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);          /*io.c*/
-  FOREACHfacet_(facets)                                                /*io.c*/
-    qh_printafacet(qh ferr, qh_PRINTfacets, facet, printall);          /*io.c*/
-  qh_printend (qh ferr, qh_PRINTfacets, facetlist, facets, printall);  /*io.c*/
-
-  FORALLfacet_(facetlist)
-    fprintf( qh ferr, "facet f%d\n", facet->id);
-} /* printfacetlist */
-
-
-
-/*-----------------------------------------
--user_memsizes- allocate up to 10 additional, quick allocation sizes
-*/
-void qh_user_memsizes (void) {
-
-  /* qh_memsize (size); */
-} /* user_memsizes */
-
-#endif

Added: trunk/scipy/spatial/qhull/src/usermem.c
===================================================================
--- trunk/scipy/spatial/qhull/src/usermem.c	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/usermem.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,64 @@
+/*
  ---------------------------------
+
+   usermem.c
+   qh_exit(), qh_free(), and qh_malloc()
+
+   see README.txt  see COPYING.txt for copyright information.
+
+   If you redefine one of these functions you must redefine all of them.
+   If you recompile and load this file, then usermem.o will not be loaded
+   from qhull.a or qhull.lib
+
+   See libqhull.h for data structures, macros, and user-callable functions.
+   See user.c for qhull-related, redefinable functions
+   see user.h for user-definable constants
+   See userprintf.c for qh_fprintf and qh_fprintf_rbox
+
+   Please report any errors that you fix to qhull at qhull.org
+*/
+
+#include "libqhull.h"
+
+#include 
+
+/*---------------------------------
+
+  qh_exit( exitcode )
+    exit program
+
+  notes:
+    same as exit()
+*/
+void qh_exit(int exitcode) {
+    exit(exitcode);
+} /* exit */
+
+/*---------------------------------
+
+qh_free( mem )
+free memory
+
+notes:
+same as free()
+*/
+void qh_free(void *mem) {
+    free(mem);
+} /* free */
+
+/*---------------------------------
+
+    qh_malloc( mem )
+      allocate memory
+
+    notes:
+      same as malloc()
+*/
+void *qh_malloc(size_t size) {
+    return malloc(size);
+} /* malloc */
+
+

Added: trunk/scipy/spatial/qhull/src/userprintf.c
===================================================================
--- trunk/scipy/spatial/qhull/src/userprintf.c	                        (rev 0)
+++ trunk/scipy/spatial/qhull/src/userprintf.c	2010-11-16 21:18:37 UTC (rev 6902)
@@ -0,0 +1,79 @@
+/*
  ---------------------------------
+
+   userprintf.c
+   qh_fprintf() and qh_fprintf_rbox()
+
+   see README.txt  see COPYING.txt for copyright information.
+
+   If you redefine one of these functions you must redefine all of them.
+   If you recompile and load this file, then userprintf.o will not be loaded
+   from qhull.a or qhull.lib
+
+   See libqhull.h for data structures, macros, and user-callable functions.
+   See user.c for qhull-related, redefinable functions
+   see user.h for user-definable constants
+   See usermem.c for qh_exit(), qh_free(), and qh_malloc()
+   see Qhull.cpp and RboxPoints.cpp for examples.
+
+   Please report any errors that you fix to qhull at qhull.org
+*/
+
+#include "libqhull.h"
+
+#include 
+#include 
+#include 
+
+/*---------------------------------
+
+   qh_fprintf(fp, msgcode, format, list of args )
+     print arguments to *fp according to format
+     Use qh_fprintf_rbox() for rboxlib.c
+
+   notes:
+     same as fprintf()
+     fgets() is not trapped like fprintf()
+     exit qh_fprintf via qh_errexit()
+     exit qh_fprintf_rbox via qh_errexit_rbox()
+*/
+
+void qh_fprintf(FILE *fp, int msgcode, const char *fmt, ... ) {
+    va_list args;
+
+    if (!fp) {
+        fprintf(stderr, "QH6232 Qhull internal error (userprintf.c): fp is 0.  Wrong qh_fprintf called.\n");
+        qh_errexit(6232, NULL, NULL);
+    }
+    va_start(args, fmt);
+#if qh_QHpointer
+    if (qh_qh && qh ANNOTATEoutput) {
+#else
+    if (qh ANNOTATEoutput) {
+#endif
+      fprintf(fp, "[QH%.4d]", msgcode);
+    }else if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR ) {
+      fprintf(fp, "QH%.4d ", msgcode);
+    }
+    vfprintf(fp, fmt, args);
+    va_end(args);
+
+    /* Place debugging traps here. Use with option 'Tn' */
+
+} /* qh_fprintf */
+
+void qh_fprintf_rbox(FILE *fp, int msgcode, const char *fmt, ... ) {
+    va_list args;
+
+    if (!fp) {
+        fprintf(stderr, "QH6231 Qhull internal error (userprintf.c): fp is 0.  Wrong qh_fprintf_rbox called.\n");
+        qh_errexit_rbox(6231);
+    }
+    if (msgcode >= MSG_ERROR && msgcode < MSG_STDERR)
+      fprintf(fp, "QH%.4d ", msgcode);
+    va_start(args, fmt);
+    vfprintf(fp, fmt, args);
+    va_end(args);
+} /* qh_fprintf_rbox */
+

Modified: trunk/scipy/spatial/setup.py
===================================================================
--- trunk/scipy/spatial/setup.py	2010-11-14 21:38:04 UTC (rev 6901)
+++ trunk/scipy/spatial/setup.py	2010-11-16 21:18:37 UTC (rev 6902)
@@ -10,9 +10,10 @@
 
     config.add_data_dir('tests')
 
-    qhull_src = ['geom.c', 'geom2.c', 'global.c', 'io.c', 'mem.c',
-                 'merge.c', 'poly.c', 'poly2.c', 'qset.c', 'user.c',
-                 'stat.c', 'qhull.c']
+    qhull_src = ['geom2.c', 'geom.c', 'global.c', 'io.c', 'libqhull.c', 
+                 'mem.c', 'merge.c', 'poly2.c', 'poly.c', 'qset.c', 
+                 'random.c', 'rboxlib.c', 'stat.c', 'user.c', 'usermem.c',
+                 'userprintf.c']
 
     config.add_library('qhull',
                        sources=[join('qhull', 'src', x) for x in qhull_src],