[Scipy-svn] r2844 - in trunk/Lib/sandbox/pyloess: . sandbox sandbox/examples sandbox/src src tests
scipy-svn@scip...
scipy-svn@scip...
Mon Mar 12 14:47:35 CDT 2007
Author: pierregm
Date: 2007-03-12 14:47:15 -0500 (Mon, 12 Mar 2007)
New Revision: 2844
Added:
trunk/Lib/sandbox/pyloess/.project
trunk/Lib/sandbox/pyloess/README
trunk/Lib/sandbox/pyloess/__init__.py
trunk/Lib/sandbox/pyloess/doc/
trunk/Lib/sandbox/pyloess/pyloess.py
trunk/Lib/sandbox/pyloess/sandbox/
trunk/Lib/sandbox/pyloess/sandbox/builder
trunk/Lib/sandbox/pyloess/sandbox/examples/
trunk/Lib/sandbox/pyloess/sandbox/examples/sin_data
trunk/Lib/sandbox/pyloess/sandbox/examples/sin_result
trunk/Lib/sandbox/pyloess/sandbox/pyloess.py
trunk/Lib/sandbox/pyloess/sandbox/setup.py
trunk/Lib/sandbox/pyloess/sandbox/src/
trunk/Lib/sandbox/pyloess/sandbox/src/S.h
trunk/Lib/sandbox/pyloess/sandbox/src/c_loess.pxd
trunk/Lib/sandbox/pyloess/sandbox/src/c_numpy.pxd
trunk/Lib/sandbox/pyloess/sandbox/src/c_python.pxd
trunk/Lib/sandbox/pyloess/sandbox/src/cloess.c
trunk/Lib/sandbox/pyloess/sandbox/src/cloess.h
trunk/Lib/sandbox/pyloess/sandbox/src/cloess.pyx
trunk/Lib/sandbox/pyloess/sandbox/src/linpack_lite.f
trunk/Lib/sandbox/pyloess/sandbox/src/loess.c
trunk/Lib/sandbox/pyloess/sandbox/src/loess.h
trunk/Lib/sandbox/pyloess/sandbox/src/loessc.c
trunk/Lib/sandbox/pyloess/sandbox/src/loessf.f
trunk/Lib/sandbox/pyloess/sandbox/src/misc.c
trunk/Lib/sandbox/pyloess/sandbox/src/predict.c
trunk/Lib/sandbox/pyloess/setup.py
trunk/Lib/sandbox/pyloess/src/
trunk/Lib/sandbox/pyloess/src/f_lowess.pyf
trunk/Lib/sandbox/pyloess/src/f_stl.pyf
trunk/Lib/sandbox/pyloess/src/lowess.f
trunk/Lib/sandbox/pyloess/src/stl.f
trunk/Lib/sandbox/pyloess/tests/
trunk/Lib/sandbox/pyloess/tests/__init__.py
trunk/Lib/sandbox/pyloess/tests/co2_data
trunk/Lib/sandbox/pyloess/tests/co2_results_double
trunk/Lib/sandbox/pyloess/tests/co2_results_real
trunk/Lib/sandbox/pyloess/tests/test_pyloess.py
Log:
Initial import.
Currently, only lowess (the univariable, simplified version of loess) and stl (season/trend loess decomposition) are functional.
Please check the sandbox subfolder for a broken attempt to port loess
Added: trunk/Lib/sandbox/pyloess/.project
===================================================================
--- trunk/Lib/sandbox/pyloess/.project 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/.project 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+ <name>pyloess</name>
+ <comment></comment>
+ <projects>
+ </projects>
+ <buildSpec>
+ <buildCommand>
+ <name>org.python.pydev.PyDevBuilder</name>
+ <arguments>
+ </arguments>
+ </buildCommand>
+ </buildSpec>
+ <natures>
+ <nature>org.python.pydev.pythonNature</nature>
+ </natures>
+</projectDescription>
Added: trunk/Lib/sandbox/pyloess/README
===================================================================
--- trunk/Lib/sandbox/pyloess/README 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/README 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,16 @@
+pyloess: a numpy wrapper to lowess and stl.
+
+LOWESS
+------
+
+The initial file is available at:
+http://netlib.bell-labs.com/netlib/go/lowess.f.gz
+Simple to double precision conversion by Pierre GERARD-MARCHANT, 2007/03.
+
+
+STL
+-----
+
+The initial file is available at:
+http://netlib.bell-labs.com/netlib/a/stl.gz
+Simple to double precision conversion by Pierre GERARD-MARCHANT, 2007/03.
Added: trunk/Lib/sandbox/pyloess/__init__.py
===================================================================
--- trunk/Lib/sandbox/pyloess/__init__.py 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/__init__.py 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,10 @@
+"""
+Numpy wrappers for lowess and stl.
+"""
+__author__ = "Pierre GF Gerard-Marchant"
+__version__ = '1.0'
+__revision__ = "$Revision: 150 $"
+__date__ = '$Date: 2007-02-28 23:42:16 -0500 (Wed, 28 Feb 2007) $'
+
+import pyloess
+from pyloess import lowess, stl
\ No newline at end of file
Added: trunk/Lib/sandbox/pyloess/pyloess.py
===================================================================
--- trunk/Lib/sandbox/pyloess/pyloess.py 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/pyloess.py 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,268 @@
+# pylint: disable-msg=E1101
+"""
+Wrapper to lowess and stl routines.
+
+LOWESS:
+Initial Fortran code available at:
+http://netlib.bell-labs.com/netlib/go/lowess.f.gz
+
+initial author: W. S. Cleveland, 1979.
+Simple to double precision conversion of the Fortran code by Pierre
+GERARD-MARCHANT, 2007/03.
+
+STL:
+Initial Fortran code available at:
+http://netlib.bell-labs.com/netlib/a/stl.gz
+Initial Authors: R. B. Cleveland, W. S. Cleveland, J. E. McRae, and
+I. Terpenning, 1990.
+Simple-to-double precision conversion of the Fortran code by Pierre
+GERARD-MARCHANT, 2007/03.
+
+
+:author: Pierre GF Gerard-Marchant
+:contact: pierregm_at_uga_edu
+:date: $Date: 2007-02-28 02:23:25 -0500 (Wed, 28 Feb 2007) $
+:version: $Id: generic.py 145 2007-02-28 07:23:25Z backtopop $
+"""
+__author__ = "Pierre GF Gerard-Marchant ($Author: backtopop $)"
+__version__ = '1.0'
+__revision__ = "$Revision: 145 $"
+__date__ = '$Date: 2007-02-28 02:23:25 -0500 (Wed, 28 Feb 2007) $'
+
+import numpy
+from numpy import bool_, complex_, float_, int_, str_, object_
+import numpy.core.numeric as numeric
+from numpy.core.records import recarray
+
+import _lowess, _stl
+
+
+def lowess(x,y,f=0.5,nsteps=2,delta=0):
+ """Performs a robust locally weighted regression (lowess).
+
+ Outputs a *3xN* array of fitted values, residuals and fit weights.
+
+
+:Parameters:
+ x : ndarray
+ Abscissas of the points on the scatterplot; the values in X must be
+ ordered from smallest to largest.
+ y : ndarray
+ Ordinates of the points on the scatterplot.
+ f : Float *[0.5]*
+ Fraction of the total number of points used to compute each fitted value.
+ As f increases the smoothed values become smoother. Choosing f in the range
+ .2 to .8 usually results in a good fit.
+ nsteps : Integer *[2]*
+ Number of iterations in the robust fit. If nsteps=0, the nonrobust fit
+ is returned; setting nsteps=2 should serve most purposes.
+ delta : Integer *[0]*
+ Nonnegative parameter which may be used to save computations.
+ If N (the number of elements in x) is less than 100, set delta=0.0;
+ if N is greater than 100 you should find out how delta works by reading
+ the additional instructions section.
+
+:Returns:
+ A recarray of smoothed values ('smooth'), residuals ('residuals') and local
+ robust weights ('weights').
+
+
+Additional instructions
+-----------------------
+
+Fro the original author:
+
+ DELTA can be used to save computations. Very roughly the
+ algorithm is this: on the initial fit and on each of the
+ NSTEPS iterations locally weighted regression fitted values
+ are computed at points in X which are spaced, roughly, DELTA
+ apart; then the fitted values at the remaining points are
+ computed using linear interpolation. The first locally
+ weighted regression (l.w.r.) computation is carried out at
+ X(1) and the last is carried out at X(N). Suppose the
+ l.w.r. computation is carried out at X(I). If X(I+1) is
+ greater than or equal to X(I)+DELTA, the next l.w.r.
+ computation is carried out at X(I+1). If X(I+1) is less
+ than X(I)+DELTA, the next l.w.r. computation is carried out
+ at the largest X(J) which is greater than or equal to X(I)
+ but is not greater than X(I)+DELTA. Then the fitted values
+ for X(K) between X(I) and X(J), if there are any, are
+ computed by linear interpolation of the fitted values at
+ X(I) and X(J). If N is less than 100 then DELTA can be set
+ to 0.0 since the computation time will not be too great.
+ For larger N it is typically not necessary to carry out the
+ l.w.r. computation for all points, so that much computation
+ time can be saved by taking DELTA to be greater than 0.0.
+ If DELTA = Range (X)/k then, if the values in X were
+ uniformly scattered over the range, the full l.w.r.
+ computation would be carried out at approximately k points.
+ Taking k to be 50 often works well.
+
+Method
+------
+
+ The fitted values are computed by using the nearest neighbor
+ routine and robust locally weighted regression of degree 1
+ with the tricube weight function. A few additional features
+ have been added. Suppose r is FN truncated to an integer.
+ Let h be the distance to the r-th nearest neighbor
+ from X[i]. All points within h of X[i] are used. Thus if
+ the r-th nearest neighbor is exactly the same distance as
+ other points, more than r points can possibly be used for
+ the smooth at X[i]. There are two cases where robust
+ locally weighted regression of degree 0 is actually used at
+ X[i]. One case occurs when h is 0.0. The second case
+ occurs when the weighted standard error of the X[i] with
+ respect to the weights w[j] is less than .001 times the
+ range of the X[i], where w[j] is the weight assigned to the
+ j-th point of X (the tricube weight times the robustness
+ weight) divided by the sum of all of the weights. Finally,
+ if the w[j] are all zero for the smooth at X[i], the fitted
+ value is taken to be Y[i].
+
+References
+----------
+ W. S. Cleveland. 1978. Visual and Computational Considerations in
+ Smoothing Scatterplots by Locally Weighted Regression. In
+ Computer Science and Statistics: Eleventh Annual Symposium on the
+ Interface, pages 96-100. Institute of Statistics, North Carolina
+ State University, Raleigh, North Carolina, 1978.
+
+ W. S. Cleveland, 1979. Robust Locally Weighted Regression and
+ Smoothing Scatterplots. Journal of the American Statistical
+ Association, 74:829-836, 1979.
+
+ W. S. Cleveland, 1981. LOWESS: A Program for Smoothing Scatterplots
+ by Robust Locally Weighted Regression. The American Statistician,
+ 35:54.
+
+ """
+ dtyp = [('smooth',float_), ('weigths', float_), ('residuals', float_)]
+ return numeric.fromiter(zip(*_lowess.lowess(x,y,f,nsteps,delta,)),
+ dtype=dtyp).view(recarray)
+
+#--------------------------------------------------------------------------
+#--- --- STL ---
+#####----------------------------------------------------------------------
+def stl(y, np=12, ns=7, nt=None, nl=13, isdeg=1, itdeg=1, ildeg=1,
+ nsjump=None,ntjump=None,nljump=None, robust=True, ni=None,no=None):
+ """Decomposes a time series into seasonal and trend components.
+
+:Parameters:
+ y : Numerical array
+ Time Series to be decomposed.
+ np : Integer *[12]*
+ Period of the seasonal component.
+ For example, if the time series is monthly with a yearly cycle, then
+ np=12.
+ ns : Integer *[7]*
+ Length of the seasonal smoother.
+ The value of ns should be an odd integer greater than or equal to 3.
+ A value ns>6 is recommended. As ns increases the values of the
+ seasonal component at a given point in the seasonal cycle (e.g., January
+ values of a monthly series with a yearly cycle) become smoother.
+ nt : Integer *[None]*
+ Length of the trend smoother.
+ The value of nt should be an odd integer greater than or equal to 3.
+ A value of nt between 1.5*np and 2*np is recommended. As nt increases,
+ the values of the trend component become smoother.
+ If nt is None, it is estimated as the smallest odd integer greater
+ or equal to (1.5*np)/[1-(1.5/ns)]
+ nl : Integer *[None]*
+ Length of the low-pass filter.
+ The value of nl should be an odd integer greater than or equal to 3.
+ The smallest odd integer greater than or equal to np is used by default.
+ isdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in seasonal smoothing.
+ The value is 0 or 1.
+ itdeg : Integer *[1]*
+ Degree of locally-fitted polynomial in trend smoothing.
+ The value is 0 or 1.
+ ildeg : Integer *[1]*
+ Degree of locally-fitted polynomial in low-pass smoothing.
+ The value is 0 or 1.
+ nsjump : Integer *[None]*
+ Skipping value for seasonal smoothing.
+ The seasonal smoother skips ahead nsjump points and then linearly
+ interpolates in between. The value of nsjump should be a positive
+ integer; if nsjump=1, a seasonal smooth is calculated at all n points.
+ To make the procedure run faster, a reasonable choice for nsjump is
+ 10%-20% of ns. By default, nsjump= 0.1*ns.
+ ntjump : Integer *[1]*
+ Skipping value for trend smoothing. If None, ntjump= 0.1*nt
+ nljump : Integer *[1]*
+ Skipping value for low-pass smoothing. If None, nljump= 0.1*nl
+ robust : Boolean *[True]*
+ Flag indicating whether robust fitting should be performed.
+ ni : Integer *[None]*
+ Number of loops for updating the seasonal and trend components.
+ The value of ni should be a positive integer.
+ See the next argument for advice on the choice of ni.
+ If ni is None, ni is set to 1 for robust fitting, to 5 otherwise.
+ no : Integer *[0]*
+ Number of iterations of robust fitting. The value of no should
+ be a nonnegative integer. If the data are well behaved without
+ outliers, then robustness iterations are not needed. In this case
+ set no=0, and set ni=2 to 5 depending on how much security
+ you want that the seasonal-trend looping converges.
+ If outliers are present then no=3 is a very secure value unless
+ the outliers are radical, in which case no=5 or even 10 might
+ be better. If no>0 then set ni to 1 or 2.
+ If None, then no is set to 15 for robust fitting, to 0 otherwise.
+
+Returns:
+ A recarray of estimated trend values ('trend'), estimated seasonal
+ components ('seasonal'), local robust weights ('weights') and fit
+ residuals ('residuals').
+ The final local robust weights are all 1 if no=0.
+
+Reference
+---------
+
+ R. B. Cleveland, W. S. Cleveland, J. E. McRae and I. Terpenning.
+ 1990. STL: A Seasonal-Trend Decomposition Procedure Based on LOESS
+ (with Discussion). Journal of Official Statistics, 6:3-73.
+
+
+ """
+ ns = max(ns, 3)
+ if ns%2 == 0:
+ ns += 1
+ np = max(2, np)
+ if nt is None:
+ nt = max(int((1.5*np/(1.-1.5/ns))+0.5), 3)
+ if not nt%2:
+ nt += 1
+ if nl is None:
+ nl = max(3,np)
+ if not nl%2:
+ nl += 1
+ if nsjump is None:
+ nsjump = int(0.1*ns + 0.9)
+ if ntjump is None:
+ ntjump = int(0.1*nt + 0.9)
+ if nljump is None:
+ nljump = int(0.1*nl + 0.9)
+ if robust:
+ if ni is None:
+ ni = 1
+ if no is None:
+ no = 15
+ else:
+ if ni is None:
+ ni = 5
+ if no is None:
+ no = 0
+
+ if hasattr(y,'_mask') and numpy.any(y._mask):
+ raise ValueError,"Missing values should first be filled !"
+ y = numeric.array(y, subok=True, copy=False).ravel()
+ (rw,szn,trn,work) = _stl.stl(y,np,ns,nt,nl,isdeg,itdeg,ildeg,
+ nsjump,ntjump,nljump,ni,no,)
+ dtyp = [('trend', float_), ('seasonal', float_),
+ ('residuals', float_), ('weights', float_)]
+ result = numeric.fromiter(zip(trn,szn,y-trn-szn,rw), dtype=dtyp)
+ return result.view(recarray)
+
+################################################################################
+
Added: trunk/Lib/sandbox/pyloess/sandbox/builder
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/builder 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/builder 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,15 @@
+rm -rf build
+pushd src
+rm -f cloess.c *.so *.o
+pyrexc cloess.pyx || exit
+gcc -c -fPIC loess.c loessc.c misc.c predict.c loessf.f linpack_lite.f
+gcc -c -fPIC cloess.c -I/usr/include/python2.4 \
+ -I/usr/lib64/python2.4/site-packages/numpy/core/include || exit
+gcc -shared loessf.o linpack_lite.o loess.o loessc.o misc.o predict.o cloess.o \
+ -llapack -lblas -o cloess.so || exit
+rm -f *.o
+popd
+mv src/cloess.so cloess.so
+python -c "import cloess; print dir(cloess)"
+python pyloess.py
+echo "OK"
\ No newline at end of file
Property changes on: trunk/Lib/sandbox/pyloess/sandbox/builder
___________________________________________________________________
Name: svn:executable
+ *
Added: trunk/Lib/sandbox/pyloess/sandbox/examples/sin_data
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/examples/sin_data 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/examples/sin_data 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,24 @@
+-0.529631673 -0.476162031 0.122393909 -0.764738290 0.694588529
+ 0.157878753 0.825755505 0.383776725 -0.297611713 0.179712838
+ 0.883403846 1.175870259 -0.222158656 0.887655136 0.506018472
+ 1.201763090 1.358657158 1.766876246 0.945261834 0.242015272
+ 1.108175506 1.588326244 0.086595996 0.135447708 1.674333147
+ 0.087861038 0.150255064 1.662807709 1.918985242 0.334817302
+ 1.995973197 0.269379941 0.469938419 0.719274928 1.441382256
+ 1.856114890 -0.004302644 1.329872080 -0.058310637 0.472398463
+ 0.435258117 1.636500756 1.699950103 1.478820190 -0.190025448
+ 1.300341865 -0.058635213 0.819062806 0.047988842 -0.168558533
+ 0.037056266 0.536154778 0.278227911 -0.313547042 0.722026888
+-0.114359903 -0.376634077 0.652043347 -0.515809282 -0.602277827
+-0.938181382 -1.037834739 0.278491625 -1.092834467 -0.778780405
+-1.070774416 0.539015258 -0.234691028 -0.152634072 -0.066153375
+-0.233711530 -0.959496456 -0.946902608 -0.871057712 -0.583103683
+-1.534738618 -0.662166840 -1.155263966 -0.533407016 -1.319182554
+-0.186566885 -0.897649461 -1.501951078 -0.004479304 -1.678331392
+-1.490781842 -0.589586598 -0.285787771 -0.510207129 -0.627988881
+-1.109061921 -1.310354670 0.002602266 -0.271113225 -0.885954568
+-1.150763444 -0.779791042 -1.053566764 -0.718805204 -0.257604369
+-1.278783228 -0.816685979 -1.417844559 -0.081346747 -1.413808292
+-1.487076480 -0.166387633 -0.922128152 0.267933770 -1.000264981
+-0.638768521 -0.298071585 0.115376460 0.104988650 -0.993492047
+-0.175837760 0.193326045 -0.068244286 0.325014896 -0.506554400
\ No newline at end of file
Added: trunk/Lib/sandbox/pyloess/sandbox/examples/sin_result
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/examples/sin_result 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/examples/sin_result 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,24 @@
+-0.119671288 -0.048917262 0.019498810 0.085541472 0.149175270
+ 0.210364749 0.269074456 0.325268935 0.378912732 0.429970393
+ 0.478406464 0.524185488 0.567272013 0.607630584 0.645225746
+ 0.679964281 0.711826741 0.740888328 0.767224242 0.790909683
+ 0.812019853 0.830629952 0.846815180 0.860650739 0.872211830
+ 0.881573652 0.888811407 0.894000296 0.897215519 0.898532276
+ 0.896495398 0.889853461 0.878987289 0.864277706 0.846105535
+ 0.824851599 0.800896721 0.774621727 0.746407438 0.716634678
+ 0.685684270 0.653937039 0.621773808 0.589575399 0.557722637
+ 0.522992287 0.482466105 0.436982397 0.387379471 0.334495633
+ 0.279169191 0.222238452 0.164541722 0.106917309 0.050203520
+-0.004761338 -0.057138959 -0.106091034 -0.150779258 -0.190365323
+-0.228071840 -0.267406108 -0.307956846 -0.349312773 -0.391062611
+-0.432795078 -0.474098896 -0.514562784 -0.553775463 -0.591325651
+-0.626802071 -0.659793440 -0.689888480 -0.716675911 -0.739744452
+-0.760199435 -0.779384403 -0.797245400 -0.813728466 -0.828779643
+-0.842344973 -0.854370498 -0.864802259 -0.873586297 -0.880668656
+-0.885995376 -0.889512498 -0.891166066 -0.890902119 -0.888666701
+-0.884599958 -0.878878792 -0.871504374 -0.862477875 -0.851800466
+-0.839473318 -0.825497602 -0.809874489 -0.792605150 -0.773690757
+-0.753132480 -0.730931491 -0.707088961 -0.681606061 -0.654483961
+-0.625716944 -0.595298336 -0.563227879 -0.529505317 -0.494130390
+-0.457102841 -0.418422412 -0.378088845 -0.336101881 -0.292461263
+-0.247166733 -0.200218032 -0.151614903 -0.101357088 -0.049444328
Added: trunk/Lib/sandbox/pyloess/sandbox/pyloess.py
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/pyloess.py 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/pyloess.py 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,517 @@
+import os
+from math import ceil
+
+import numpy
+from numpy import bool_, int_, float_
+
+narray = numpy.array
+nempty = numpy.empty
+nzeros = numpy.zeros
+
+import logging
+logging.basicConfig(level=logging.DEBUG)
+loesslogging = logging.getLogger('loesss')
+
+import cloess
+reload(cloess)
+
+class paramdict(dict):
+ def __init__(self, **kwargs):
+ dict.__init__(self, **kwargs)
+
+ def __getattr__(self, attr):
+ _got = getattr(super(paramdict,self), attr, None)
+ if _got is None:
+ _got = self.get(attr, None)
+ return _got
+
+ def __setattr__(self, attr, value):
+ if attr in self.keys():
+ self[attr] = value
+ else:
+ dict.__setattr__(self, attr, value)
+
+#-------------------------------------------------------------------------------
+class _loess_control(dict):
+
+ _optiondict = dict(surface=('interpolate', 'direct'),
+ statistics=('approximate', 'exact'),
+ trace_hat=('wait.to.decide', 'exact', 'approximate'),)
+
+ def __init__(self, surface="interpolate", statistics="approximate",
+ trace_hat="wait.to.decide", iterations=4, cell=0.2):
+ dict.__init__(self, surface=None, statistics=None,
+ trace_hat=None, iterations=iterations,
+ cell=cell)
+ self.surface = surface.lower()
+ self.statistics = statistics.lower()
+ self.trace_hat = trace_hat.lower()
+ #
+ def __getattr__(self, attr):
+ _got = getattr(super(dict,self), attr, None)
+ if _got is None:
+ _got = self.get(attr, None)
+ return _got
+ #
+ def __setattr__(self, attr, value):
+ if attr in self.keys():
+ self.__setitem__(attr, value)
+ else:
+ dict.__setattr__(self, attr, value)
+ #
+ def __setitem__(self, attr, value):
+ if attr in _loess_control._optiondict.keys():
+ self.__setoption__(attr, value)
+ else:
+ dict.__setitem__(self, attr, value)
+ #
+ def __setoption__(self, attr, value):
+ msg = "Invalid argument: %s must be in %s (got %s)"
+ attrlist = _loess_control._optiondict[attr]
+ if (not isinstance(value, str)) or \
+ (value.lower() not in attrlist):
+ raise ValueError, msg % (attr, attrlist, value)
+ dict.__setitem__(self, attr, value.lower())
+ #
+# def set_surface_status(self, new_stat):
+# if new_stat.lower() not in ('none','exact','approximate'):
+# raise ValueError,"Invalid value for the new_stat parameter: "\
+# "should be in ('none','exact','approximate'), got %s" % new_stat
+# if self.surface == "interpolate" and new_stat == "approximate":
+# if self.trace_hat == "approximate":
+# new_stat = "2.approx"
+# else:
+# trace_hat='exact' in that case
+# new_stat = "1.approx"
+# return "/".join([self.surface, new_stat])
+ def set_surface_status(self, new_stat):
+ if new_stat.lower() not in ('none','exact','approximate'):
+ raise ValueError,"Invalid value for the new_stat parameter: "\
+ "should be in ('none','exact','approximate'), got %s" % new_stat
+ statusdict = {"interpolate":{"none": 10,
+ "exact":11,
+ "1.approx":12,
+ "2.approx":13 },
+ "direct":{"none" : 20,
+ "exact": 21,
+ "approximate": 22}}
+ if self.surface == "interpolate" and new_stat == "approximate":
+ if self.trace_hat == "approximate":
+ status = 13
+ else:
+ # trace_hat='exact' in that case
+ status = 12
+ else:
+ status = statusdict[self.surface][new_stat]
+ return status
+
+#
+#
+#
+#class loess(object):
+# """
+#
+#:Ivariables:
+# x : ndarray
+# Independent variables
+# y : ndarray
+# Dependent variables
+# weights : ndarray
+# """
+# def __init__(self, x, y, weights=None,
+# span=0.75, degree=2, normalize=True, family="gaussian",
+# surface="interpolate", statistics="approximate",
+# cell=0.2, trace_hat="wait.to.decide",iterations=4):
+# x = narray(x, copy=False, subok=True, order='F')
+# if x.ndim == 2:
+# (n,d) = x.shape
+# elif x.ndim == 1:
+# (n,d) = (len(x),1)
+# else:
+# raise ValueError,"Argument 'x' should be 2D at most!"
+# max_kd = max(n, 200)
+# #
+# y = narray(y, copy=False, subok=True, order='F')
+# if weights is None:
+# weights = numpy.ones_like(y)
+# self.inputs = paramdict(x=x, y=y, weights=weights, nobs=n, nvars=d)
+# self.model = paramdict(span=span, degree=degree,
+# normalize=normalize, family=family.lower(),
+# parametric=nzeros((d,), bool_, 'F'),
+# drop_square=nzeros((d,), bool_, 'F')
+# )
+# self.control = _loess_control(surface=surface.lower(),
+# statistics=statistics.lower(),
+# trace_hat=trace_hat.lower(),
+# iterations=iterations, cell=cell,
+# )
+# self.outputs = paramdict(fitted_values=nempty((n,), float_, 'F'),
+# fitted_residuals=nempty((n,), float_, 'F'),
+# pseudovalues=nempty((n,), float_, 'F'),
+# diagonal=nempty((n,), float_, 'F'),
+# robust=numpy.ones((n,), float_, 'F'),
+# divisor=nempty((d,), float_, 'F'),
+# enp=0, s=0, one_delta=0, two_delta=0,
+# trace_hat=0
+# )
+# self.kd_tree = paramdict(parameter=nempty((7,), int_, 'F'),
+# a=nempty((max_kd,), int_, 'F'),
+# xi=nempty((max_kd,), float_, 'F'),
+# vert=nempty((d*2,), float_, 'F'),
+# vval=nempty(((d+1)*max_kd,), float_, 'F')
+# )
+# #
+# if self.model.family == "gaussian":
+# self.control['iterations'] = 0
+# if self.control.trace_hat == "wait.to.decide":
+# if (self.control.surface == "interpolate") and n >= 500:
+# self.control.trace_hat = "approximate"
+# else:
+# self.control.trace_hat = "exact"
+# #......................................................
+# def fit(self, span = 0.75, degree = 2, parametric = False,
+# drop_square = False, normalize = True,
+# statistics = "approximate", surface = "interpolate",
+# cell = 0.2, iterations = 1, trace_hat = "exact"):
+#
+# # Get input....................
+# inputs = self.inputs
+# (x, y, n, d, weights) = [inputs[k]
+# for k in ('x','y','nobs','nvars', 'weights')]
+#
+# max_kd = max(n, 200)
+## a = max_kd
+# one_delta = two_delta = trace_hat_out = 0
+#
+# # Set temporary ...............
+# kd_tree = self.kd_tree
+# (a, xi, vert, vval, parameter) = [kd_tree[k]
+# for k in ('a', 'xi', 'vert', 'vval',
+# 'parameter')]
+# a_tmp = nempty((max_kd,), int_)
+# xi_tmp = nempty((max_kd,), float_)
+# vert_tmp = nempty((2*d,), float_)
+# vval_tmp = nempty(((d+1)*max_kd,), float_)
+#
+# # Check control ................
+# control = self.control
+# surface = control.surface
+# statistics = control.statistics
+# iterations = control.iterations
+# trace_hat = control.trace_hat
+# # Get model ....................
+# model = self.model
+# family = model.family
+# parametric = model.parametric
+# drop_square = model.drop_square
+# (span, degree, normalize) = [model[k]
+# for k in ('span', 'degree', 'normalize')]
+# #
+# outputs = self.outputs
+# fitted_values = outputs.fitted_values
+# fitted_residuals = outputs.fitted_residuals
+# pseudovalues = outputs.pseudovalues
+# diagonal = outputs.diagonal
+# robust = outputs.robust
+# (enp, s, one_delta, two_delta) = [outputs[k]
+# for k in ('enp','s','one_delta','two_delta')]
+# trace_hat = outputs.trace_hat
+## parameter = 7
+# (d1_tmp, d2_tmp, trL_tmp, zero,) = (0., 0., 0., 0.)
+# (delta1, delta2, trL, trace_hat_in) = (0, 0, 0, 0)
+# temp = nempty((n,), float_)
+# diag_tmp = nempty((n,), float_)
+# param_tmp = nempty((n,), int_)
+# if iterations > 0:
+# pseudo_resid = nempty((n,), float_)
+# #
+# new_cell = span * cell
+# #
+# loesslogging.debug("initial divisor: %s" % self.outputs.divisor)
+# if normalize and d > 1:
+# cut = int(ceil(0.1*n))
+# x_trimmed = numpy.sort(x, axis=0)[cut:-cut]
+# outputs.divisor = x_trimmed.std(axis=0)
+# outputs.divisor *= numpy.sqrt(n/float(n-1))
+# x = x / outputs.divisor
+# else:
+# outputs.divisor = numpy.ones(d, float_)
+# loesslogging.debug("final divisor: %s" % self.outputs.divisor)
+# #
+# sum_drop_sqr = sum(drop_square)
+# #
+# parametric = narray(parametric, copy=True)
+# parametric.resize((d,))
+# sum_parametric = parametric.sum()
+# nonparametric = numpy.logical_not(parametric).sum()
+# order_parametric = numpy.argsort(parametric)
+# #
+# order_drop_sqr = 2 - drop_square[order_parametric]
+# x = x[:,order_parametric].ravel()
+# #
+# if degree == 1 and sum_drop_sqr:
+# msg = "Specified the square of a factor predictor to be dropped"\
+# " when degree = 1"
+# raise ValueError, msg
+# if d == 1 and sum_drop_sqr:
+# msg = "Specified the square of a predictor to be dropped "\
+# "with only one numeric predictor"
+# raise ValueError, msg
+# if sum_parametric == d:
+# raise ValueError, "Specified parametric for all predictors"
+# #
+# new_stat = statistics.lower()
+# loesslogging.debug("start iteration: %s" % new_stat)
+# for j in range(iterations+1):
+# if j > 0:
+# new_stat = "none"
+# robust = weights * robust
+# surf_stat = control.set_surface_status(new_stat)
+# #setLf = (surf_stat.lower() == "interpolate/exact")
+# setLf = int(surf_stat == 11)
+# loesslogging.debug("iteration: %i: %s - %s" % (j, surf_stat, setLf))
+# #
+# (surf_stat, fitted_values, parameter, a,
+# xi, vert, vval, diagonal, trL, delta1, delta2,
+# ) = loess_raw(y, x, weights, robust, d, n, span, degree,
+# nonparametric, order_drop_sqr, sum_drop_sqr,
+# new_cell, surf_stat, fitted_values, parameter, a,
+# xi, vert, vval, diagonal, trL, delta1, delta2,
+# setLf)
+# #
+# if j == 0:
+# trace_hat_out = trL
+# one_delta = delta1
+# two_delta = delta2
+# fitted_residuals = y - fitted_values
+# if j < iterations:
+# (fitted_residuals, n, robust, temp) = lowesw(fitted_residuals, n, robust, temp)
+# #
+# if (iterations > 0):
+# lowesp(n, y, fitted_values, weights, robust, temp, pseudovalues)
+# (temp, param_tmp, a_tmp, xi_tmp,
+# vert_tmp, vval_tmp, diag_tmp, trL_tmp, d1_tmp, d2_tmp,
+# ) = loess_raw(pseudovalues, x, weights, weights, d, n, span,
+# degree, nonparametric, order_drop_sqr, sum_drop_sqr,
+# new_cell, surf_stat, temp, param_tmp, a_tmp, xi_tmp,
+# vert_tmp, vval_tmp, diag_tmp, trL_tmp, d1_tmp, d2_tmp,
+# zero)
+# pseudo_resid = pseudovalues - temp
+# #
+# if (iterations == 0):
+# sum_squares = numpy.sum(weights * fitted_residuals**2)
+# else:
+# sum_squares = numpy.sum(weights * pseudo_resid**2)
+# #
+# loesslogging.debug("setLf:%s" % setLf)
+# loesslogging.debug("SSR:%s" % sum_squares)
+# outputs.enp = (one_delta) + 2 * (trace_hat_out) - n;
+# loesslogging.debug("one_delta:%s-trace_out:%s" % (one_delta, trace_hat_out))
+# outputs.s = numpy.sqrt(sum_squares / (one_delta))
+# for attr in ('one_delta','two_delta','diagonal','trace_hat',
+# 'fitted_values','fitted_residuals','pseudovalues'):
+# setattr(outputs,attr,eval(attr))
+## (outputs.one_delta, outputs.two_delta) = (one_delta, two_delta)
+## outputs.diagonal = diagonal
+## outputs.
+# #
+# #......................................................
+# def summary(self):
+# print "Number of Observations : %d" % self.inputs.nobs
+# print "Equivalent Number of Parameters: %.1f" % self.outputs.enp
+# if self.model.family == "gaussian":
+# print "Residual Standard Error : %.4f" % self.outputs.s
+# else:
+# print "Residual Scale Estimate : %.4f" % self.outputs.s
+# #.......................................................
+# def predict(self):
+# outputs = self.outputs
+# self.prediction = paramdict(fit=None,
+# se_fit=None,
+# residual_scale=outputs.s,
+# df=outputs.one_delta**2 / outputs.two_delta,
+# )
+# raise NotImplementedError
+#
+#
+#
+#
+#
+#
+## size_info[0] = lo->in.p;
+## size_info[1] = lo->in.n;
+## size_info[2] = m;
+##
+## pred_(lo->in.y, lo->in.x, eval, size_info, &lo->out.s,
+## lo->in.weights,
+## lo->out.robust,
+## &lo->model.span,
+## &lo->model.degree,
+## &lo->model.normalize,
+## lo->model.parametric,
+## lo->model.drop_square,
+## &lo->control.surface,
+## &lo->control.cell,
+## &lo->model.family,
+## lo->kd_tree.parameter,
+## lo->kd_tree.a,
+## lo->kd_tree.xi,
+## lo->kd_tree.vert,
+## lo->kd_tree.vval,
+## lo->out.divisor,
+## &se,
+## pre->fit,
+## pre->se_fit);
+##}
+#
+##void
+##pred_(y, x_, new_x, size_info, s, weights, robust, span, degree,
+## normalize, parametric, drop_square, surface, cell, family,
+## parameter, a, xi, vert, vval, divisor, se, fit, se_fit)
+##double *y, *x_, *new_x, *weights, *robust, *span, *cell, *fit, *s,
+## *xi, *vert, *vval, *divisor, *se_fit;
+##long *size_info, *degree, *normalize, *parametric, *drop_square,
+## *parameter, *a, *se;
+##char **surface, **family;
+##{
+## double *x, *x_tmp, *x_evaluate, *L, new_cell, z, tmp, *fit_tmp,
+## *temp, sum, mean;
+## long N, D, M, sum_drop_sqr = 0, sum_parametric = 0,
+## nonparametric = 0, *order_parametric, *order_drop_sqr;
+## int i, j, k, p, cut, comp();
+##
+## D = size_info[0];
+## N = size_info[1];
+## M = size_info[2];
+##
+## x = (double *) malloc(N * D * sizeof(double));
+## x_tmp = (double *) malloc(N * D * sizeof(double));
+## x_evaluate = (double *) malloc(M * D * sizeof(double));
+## L = (double *) malloc(N * M * sizeof(double));
+## order_parametric = (long *) malloc(D * sizeof(long));
+## order_drop_sqr = (long *) malloc(D * sizeof(long));
+## temp = (double *) malloc(N * D * sizeof(double));
+##
+## for(i = 0; i < (N * D); i++)
+## x_tmp[i] = x_[i];
+## for(i = 0; i < D; i++) {
+## k = i * M;
+## for(j = 0; j < M; j++) {
+## p = k + j;
+## new_x[p] = new_x[p] / divisor[i];
+## }
+## }
+## if(!strcmp(*surface, "direct") || se) {
+## for(i = 0; i < D; i++) {
+## k = i * N;
+## for(j = 0; j < N; j++) {
+## p = k + j;
+## x_tmp[p] = x_[p] / divisor[i];
+## }
+## }
+## }
+## j = D - 1;
+## for(i = 0; i < D; i++) {
+## sum_drop_sqr = sum_drop_sqr + drop_square[i];
+## sum_parametric = sum_parametric + parametric[i];
+## if(parametric[i])
+## order_parametric[j--] = i;
+## else
+## order_parametric[nonparametric++] = i;
+## }
+## for(i = 0; i < D; i++) {
+## order_drop_sqr[i] = 2 - drop_square[order_parametric[i]];
+## k = i * M;
+## p = order_parametric[i] * M;
+## for(j = 0; j < M; j++)
+## x_evaluate[k + j] = new_x[p + j];
+## k = i * N;
+## p = order_parametric[i] * N;
+## for(j = 0; j < N; j++)
+## x[k + j] = x_tmp[p + j];
+## }
+## for(i = 0; i < N; i++)
+## robust[i] = weights[i] * robust[i];
+##
+## if(!strcmp(*surface, "direct")) {
+## if(*se) {
+## loess_dfitse(y, x, x_evaluate, weights, robust,
+## !strcmp(*family, "gaussian"), span, degree,
+## &nonparametric, order_drop_sqr, &sum_drop_sqr,
+## &D, &N, &M, fit, L);
+## }
+## else {
+## loess_dfit(y, x, x_evaluate, robust, span, degree,
+## &nonparametric, order_drop_sqr, &sum_drop_sqr,
+## &D, &N, &M, fit);
+## }
+## }
+## else {
+## loess_ifit(parameter, a, xi, vert, vval, &M, x_evaluate, fit);
+## if(*se) {
+## new_cell = (*span) * (*cell);
+## fit_tmp = (double *) malloc(M * sizeof(double));
+## loess_ise(y, x, x_evaluate, weights, span, degree,
+## &nonparametric, order_drop_sqr, &sum_drop_sqr,
+## &new_cell, &D, &N, &M, fit_tmp, L);
+## free(fit_tmp);
+## }
+## }
+## if(*se) {
+## for(i = 0; i < N; i++) {
+## k = i * M;
+## for(j = 0; j < M; j++) {
+## p = k + j;
+## L[p] = L[p] / weights[i];
+## L[p] = L[p] * L[p];
+## }
+## }
+## for(i = 0; i < M; i++) {
+## tmp = 0;
+## for(j = 0; j < N; j++)
+## tmp = tmp + L[i + j * M];
+## se_fit[i] = (*s) * sqrt(tmp);
+## }
+## }
+## free(x);
+## free(x_tmp);
+## free(x_evaluate);
+## free(L);
+## free(order_parametric);
+## free(order_drop_sqr);
+## free(temp);
+##}
+##
+##void
+##pred_free_mem(pre)
+##struct pred_struct *pre;
+##{
+## free(pre->fit);
+## free(pre->se_fit);
+##}
+
+
+
+################################################################################
+if __name__ == '__main__':
+ import numpy as N
+ _data = open(os.path.join('examples','sin_data'), 'r')
+ _result = open(os.path.join('examples','sin_result'), 'r')
+ x = N.arange(1.,121.)
+ y = N.concatenate([N.fromiter((float(v) for v in L.rstrip().split()), float_)
+ for L in _data.readlines()])
+ z = N.concatenate([N.fromiter((float(v) for v in L.rstrip().split()), float_)
+ for L in _result.readlines()])
+# x = N.concatenate([N.fromiter((float(v) for v in L.rstrip().split()), float_)
+# for L in open('_data','r').readlines()])
+# x.shape = (-1,2)
+# y = N.concatenate([N.fromiter((float(v) for v in L.rstrip().split()), float_)
+# for L in open('_response','r').readlines()])
+ tester = cloess.loess(x,y)
+ enp_theo = 4.34
+ rse_theo = 0.579
+ trc_smoother = 4.73
+ print "OK"
+ tester.fit()
+ tester.summary()
+ print "Fit OK"
Added: trunk/Lib/sandbox/pyloess/sandbox/setup.py
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/setup.py 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/setup.py 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,44 @@
+#!/usr/bin/env python
+"""Install file for example on how to use Pyrex with Numpy.
+
+For more details, see:
+http://www.scipy.org/Cookbook/Pyrex_and_NumPy
+http://www.scipy.org/Cookbook/ArrayStruct_and_Pyrex
+"""
+
+from distutils.core import setup
+from distutils.extension import Extension
+
+# Make this usable by people who don't have pyrex installed (I've committed
+# the generated C sources to SVN).
+try:
+ from Pyrex.Distutils import build_ext
+ has_pyrex = True
+except ImportError:
+ has_pyrex = False
+import numpy
+
+# Define a pyrex-based extension module, using the generated sources if pyrex
+# is not available.
+if has_pyrex:
+ pyx_sources = ['cloess.pyx']
+ cmdclass = {'build_ext': build_ext}
+else:
+ pyx_sources = ['cloess.c']
+ cmdclass = {}
+
+f_sources = ['loessf.f', 'linpack_lite.f']
+c_sources = ['loess.c', 'loessc.c']
+
+
+pyx_ext = Extension('cloess',
+ pyx_sources + c_sources + f_sources,
+ include_dirs = [numpy.get_include()])
+
+# Call the routine which does the real work
+setup(name = 'cloess',
+ description = 'Small example on using Pyrex to write a Numpy extension',
+ url = 'http://www.scipy.org/Cookbook/Pyrex_and_NumPy',
+ ext_modules = [pyx_ext],
+ cmdclass = cmdclass,
+ )
Added: trunk/Lib/sandbox/pyloess/sandbox/src/S.h
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/src/S.h 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/src/S.h 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,29 @@
+#include <stdio.h>
+#include <math.h>
+
+#define Calloc(n,t) (t *)calloc((unsigned)(n),sizeof(t))
+#define Free(p) free((char *)(p))
+
+/* the mapping from f77 to C intermediate code -- may be machine dependent
+ * the first definition satisfies lint's narrowminded preprocessing & should
+ * stay the same for all implementations. The __STDC__ definition is for
+ * ANSI standard conforming C compilers. The #else definition should
+ * generate the version of the fortran subroutine & common block names x
+ * handed to the local loader; e.g., "x_" in system V, Berkeley & 9th edition
+ */
+
+#ifdef lint
+#define F77_SUB(x) x
+#define F77_COM(x) x
+#else
+#ifdef __STDC__
+#define F77_SUB(x) x##_
+#define F77_COM(x) x##_
+#else
+#define F77_SUB(x) x/**/_
+#define F77_COM(x) x/**/_
+#endif
+#endif
+
+#define NULL_ENTRY ((int *)NULL)
+
Added: trunk/Lib/sandbox/pyloess/sandbox/src/c_loess.pxd
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/src/c_loess.pxd 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/src/c_loess.pxd 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,87 @@
+# -*- Mode: Python -*-
+
+cdef extern from "loess.h":
+ ctypedef struct c_loess_inputs "loess_inputs":
+ long n
+ long p
+ double *y
+ double *x
+ double *weights
+ ctypedef struct c_loess_model "loess_model":
+ double span
+ long degree
+ long normalize
+ long parametric[8]
+ long drop_square[8]
+ char *family
+ ctypedef struct c_loess_control "loess_control":
+ char *surface
+ char *statistics
+ double cell
+ char *trace_hat
+ long iterations
+ ctypedef struct c_loess_kd_tree "loess_kd_tree":
+ long *parameter
+ long *a
+ double *xi
+ double *vert
+ double *vval
+ ctypedef struct c_loess_outputs "loess_outputs":
+ double *fitted_values
+ double *fitted_residuals
+ double enp
+ double s
+ double one_delta
+ double two_delta
+ double *pseudovalues
+ double trace_hat
+ double *diagonal
+ double *robust
+ double *divisor
+ ctypedef struct c_loess "loess":
+ c_loess_inputs inputs
+ c_loess_model model
+ c_loess_control control
+ c_loess_kd_tree kd_tree
+ c_loess_outputs outputs
+ #typedef struct {
+ # double *fit;
+ # double *se_fit;
+ # double residual_scale;
+ # double df;
+ #} predicted;
+ #
+ #struct anova_struct {
+ # double dfn;
+ # double dfd;
+ # double F_value;
+ # double Pr_F;
+ #};
+ #
+ #struct ci_struct {
+ # double *fit;
+ # double *upper;
+ # double *lower;
+ #};
+cdef extern from "loess.h":
+ void loess_setup(double *x, double *y, long n, long p, c_loess *lo)
+ void loess_fit(c_loess *lo)
+ void loess_(double *y, double *x_, int *size_info, double *weights,
+ double *span, int *degree, int *parametric, int *drop_square,
+ int *normalize, char **statistics, char **surface, double *cell,
+ char **trace_hat_in, int *iterations, double *fitted_values,
+ double *fitted_residuals, double *enp, double *s, double *one_delta,
+ double *two_delta, double *pseudovalues, double *trace_hat_out,
+ double *diagonal, double *robust, double *divisor, long *parameter,
+ long *a, double *xi, double *vert, double *vval)
+ void loess_free_mem(c_loess *lo)
+ void loess_summary(c_loess *lo)
+ void condition(char **surface, char *new_stat, char **trace_hat_in)
+ int comp(double *d1, double *d2)
+
+ void loess_raw(double *y, double *x, double *weights, double *robust, int *d,
+ int*n, double *span, int *degree, int *nonparametric,
+ int *drop_square, int *sum_drop_sqr, double *cell, char **surf_stat,
+ double *surface, long *parameter, long *a, double *xi, double *vert,
+ double *vval, double *diagonal, double *trL, double *one_delta,
+ double *two_delta, int *setLf)
Added: trunk/Lib/sandbox/pyloess/sandbox/src/c_numpy.pxd
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/src/c_numpy.pxd 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/src/c_numpy.pxd 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,126 @@
+# :Author: Travis Oliphant
+
+cdef extern from "numpy/arrayobject.h":
+
+ cdef enum NPY_TYPES:
+ NPY_BOOL
+ NPY_BYTE
+ NPY_UBYTE
+ NPY_SHORT
+ NPY_USHORT
+ NPY_INT
+ NPY_UINT
+ NPY_LONG
+ NPY_ULONG
+ NPY_LONGLONG
+ NPY_ULONGLONG
+ NPY_FLOAT
+ NPY_DOUBLE
+ NPY_LONGDOUBLE
+ NPY_CFLOAT
+ NPY_CDOUBLE
+ NPY_CLONGDOUBLE
+ NPY_OBJECT
+ NPY_STRING
+ NPY_UNICODE
+ NPY_VOID
+ NPY_NTYPES
+ NPY_NOTYPE
+
+ cdef enum requirements:
+ NPY_CONTIGUOUS
+ NPY_FORTRAN
+ NPY_OWNDATA
+ NPY_FORCECAST
+ NPY_ENSURECOPY
+ NPY_ENSUREARRAY
+ NPY_ELEMENTSTRIDES
+ NPY_ALIGNED
+ NPY_NOTSWAPPED
+ NPY_WRITEABLE
+ NPY_UPDATEIFCOPY
+ NPY_ARR_HAS_DESCR
+
+ NPY_BEHAVED
+ NPY_BEHAVED_NS
+ NPY_CARRAY
+ NPY_CARRAY_RO
+ NPY_FARRAY
+ NPY_FARRAY_RO
+ NPY_DEFAULT
+
+ NPY_IN_ARRAY
+ NPY_OUT_ARRAY
+ NPY_INOUT_ARRAY
+ NPY_IN_FARRAY
+ NPY_OUT_FARRAY
+ NPY_INOUT_FARRAY
+
+ NPY_UPDATE_ALL
+
+ cdef enum defines:
+ # Note: as of Pyrex 0.9.5, enums are type-checked more strictly, so this
+ # can't be used as an integer.
+ NPY_MAXDIMS
+
+ ctypedef struct npy_cdouble:
+ double real
+ double imag
+
+ ctypedef struct npy_cfloat:
+ double real
+ double imag
+
+ ctypedef int npy_intp
+
+ ctypedef extern class numpy.dtype [object PyArray_Descr]:
+ cdef int type_num, elsize, alignment
+ cdef char type, kind, byteorder, hasobject
+ cdef object fields, typeobj
+
+ ctypedef extern class numpy.ndarray [object PyArrayObject]:
+ cdef char *data
+ cdef int nd
+ cdef npy_intp *dimensions
+ cdef npy_intp *strides
+ cdef object base
+ cdef dtype descr
+ cdef int flags
+
+ ctypedef extern class numpy.flatiter [object PyArrayIterObject]:
+ cdef int nd_m1
+ cdef npy_intp index, size
+ cdef ndarray ao
+ cdef char *dataptr
+
+ ctypedef extern class numpy.broadcast [object PyArrayMultiIterObject]:
+ cdef int numiter
+ cdef npy_intp size, index
+ cdef int nd
+ # These next two should be arrays of [NPY_MAXITER], but that is
+ # difficult to cleanly specify in Pyrex. Fortunately, it doesn't matter.
+ cdef npy_intp *dimensions
+ cdef void **iters
+
+ object PyArray_ZEROS(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+ object PyArray_EMPTY(int ndims, npy_intp* dims, NPY_TYPES type_num, int fortran)
+ dtype PyArray_DescrFromTypeNum(NPY_TYPES type_num)
+ object PyArray_SimpleNew(int ndims, npy_intp* dims, NPY_TYPES type_num)
+ int PyArray_Check(object obj)
+ object PyArray_ContiguousFromAny(object obj, NPY_TYPES type,
+ int mindim, int maxdim)
+ npy_intp PyArray_SIZE(ndarray arr)
+ npy_intp PyArray_NBYTES(ndarray arr)
+ void *PyArray_DATA(ndarray arr)
+ object PyArray_FromAny(object obj, dtype newtype, int mindim, int maxdim,
+ int requirements, object context)
+ object PyArray_FROMANY(object obj, NPY_TYPES type_num, int min,
+ int max, int requirements)
+ object PyArray_NewFromDescr(object subtype, dtype newtype, int nd,
+ npy_intp* dims, npy_intp* strides, void* data,
+ int flags, object parent)
+
+ object PyArray_IterNew(object arr)
+ void PyArray_ITER_NEXT(flatiter it)
+
+ void import_array()
Added: trunk/Lib/sandbox/pyloess/sandbox/src/c_python.pxd
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/src/c_python.pxd 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/src/c_python.pxd 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,20 @@
+# -*- Mode: Python -*- Not really, but close enough
+
+# Expose as much of the Python C API as we need here
+
+cdef extern from "stdlib.h":
+ ctypedef int size_t
+
+cdef extern from "Python.h":
+ ctypedef int Py_intptr_t
+ void* PyMem_Malloc(size_t)
+ void* PyMem_Realloc(void *p, size_t n)
+ void PyMem_Free(void *p)
+ char* PyString_AsString(object string)
+ object PyString_FromString(char *v)
+ object PyString_InternFromString(char *v)
+ int PyErr_CheckSignals()
+ object PyFloat_FromDouble(double v)
+ void Py_XINCREF(object o)
+ void Py_XDECREF(object o)
+ void Py_CLEAR(object o) # use instead of decref
Added: trunk/Lib/sandbox/pyloess/sandbox/src/cloess.c
===================================================================
--- trunk/Lib/sandbox/pyloess/sandbox/src/cloess.c 2007-03-12 19:46:06 UTC (rev 2843)
+++ trunk/Lib/sandbox/pyloess/sandbox/src/cloess.c 2007-03-12 19:47:15 UTC (rev 2844)
@@ -0,0 +1,2840 @@
+/* Generated by Pyrex 0.9.5.1a on Mon Mar 12 15:39:59 2007 */
+
+#include "Python.h"
+#include "structmember.h"
+#ifndef PY_LONG_LONG
+ #define PY_LONG_LONG LONG_LONG
+#endif
+#ifdef __cplusplus
+#define __PYX_EXTERN_C extern "C"
+#else
+#define __PYX_EXTERN_C extern
+#endif
+__PYX_EXTERN_C double pow(double, double);
+#include "stdlib.h"
+#include "numpy/arrayobject.h"
+#include "loess.h"
+
+
+typedef struct {PyObject **p; char *s;} __Pyx_InternTabEntry; /*proto*/
+typedef struct {PyObject **p; char *s; long n;} __Pyx_StringTabEntry; /*proto*/
+
+static PyObject *__pyx_m;
+static PyObject *__pyx_b;
+static int __pyx_lineno;
+static char *__pyx_filename;
+static char **__pyx_f;
+
+static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/
+
+static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/
+
+static int __Pyx_PrintItem(PyObject *); /*proto*/
+static int __Pyx_PrintNewline(void); /*proto*/
+
+static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/
+
+static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/
+
+static int __Pyx_InternStrings(__Pyx_InternTabEntry *t); /*proto*/
+
+static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/
+
+static PyTypeObject *__Pyx_ImportType(char *module_name, char *class_name, long size); /*proto*/
+
+static void __Pyx_AddTraceback(char *funcname); /*proto*/
+
+/* Declarations from c_python */
+
+
+/* Declarations from c_numpy */
+
+static PyTypeObject *__pyx_ptype_7c_numpy_dtype = 0;
+static PyTypeObject *__pyx_ptype_7c_numpy_ndarray = 0;
+static PyTypeObject *__pyx_ptype_7c_numpy_flatiter = 0;
+static PyTypeObject *__pyx_ptype_7c_numpy_broadcast = 0;
+
+/* Declarations from c_loess */
+
+
+/* Declarations from cloess */
+
+
+struct __pyx_obj_6cloess_loess_inputs {
+ PyObject_HEAD
+ loess_inputs _inputs;
+ long nobs;
+ long nvar;
+ PyArrayObject *x;
+ PyArrayObject *y;
+ PyArrayObject *weights;
+};
+
+
+struct __pyx_obj_6cloess_loess_control {
+ PyObject_HEAD
+ loess_control _control;
+ char (*surface);
+ char (*statistics);
+ char (*trace_hat);
+ double cell;
+ int iterations;
+};
+
+
+struct __pyx_obj_6cloess_loess_outputs {
+ PyObject_HEAD
+ loess_outputs _outputs;
+ PyArrayObject *fitted_values;
+ PyArrayObject *fitted_residuals;
+ PyArrayObject *pseudovalues;
+ PyArrayObject *diagonal;
+ PyArrayObject *robust;
+ PyArrayObject *divisor;
+ double enp;
+ double s;
+ double one_delta;
+ double two_delta;
+ double trace_hat;
+};
+
+
+struct __pyx_obj_6cloess_loess_kd_tree {
+ PyObject_HEAD
+ loess_kd_tree _kdtree;
+ PyArrayObject *parameter;
+ PyArrayObject *a;
+ PyArrayObject *xi;
+ PyArrayObject *vert;
+ PyArrayObject *vval;
+};
+
+
+struct __pyx_obj_6cloess_loess_model {
+ PyObject_HEAD
+ loess_model _model;
+ double span;
+ int degree;
+ int normalize;
+ char (*family);
+ PyObject *parametric_flags;
+ PyObject *drop_square_flags;
+};
+
+
+struct __pyx_obj_6cloess_loess {
+ PyObject_HEAD
+ loess _base;
+ struct __pyx_obj_6cloess_loess_inputs *inputs;
+ struct __pyx_obj_6cloess_loess_model *model;
+ struct __pyx_obj_6cloess_loess_control *control;
+ struct __pyx_obj_6cloess_loess_kd_tree *kd_tree;
+ struct __pyx_obj_6cloess_loess_outputs *outputs;
+};
+
+static PyTypeObject *__pyx_ptype_6cloess_loess_inputs = 0;
+static PyTypeObject *__pyx_ptype_6cloess_loess_control = 0;
+static PyTypeObject *__pyx_ptype_6cloess_loess_outputs = 0;
+static PyTypeObject *__pyx_ptype_6cloess_loess_kd_tree = 0;
+static PyTypeObject *__pyx_ptype_6cloess_loess_model = 0;
+static PyTypeObject *__pyx_ptype_6cloess_loess = 0;
+static PyObject *__pyx_k2;
+static double __pyx_k3;
+static int __pyx_k4;
+static int __pyx_k5;
+static PyObject *__pyx_k6;
+static PyObject *__pyx_k7;
+static PyObject *__pyx_k9;
+static PyObject *__pyx_k10;
+
+
+/* Implementation of cloess */
+
+
+static PyObject *__pyx_n_c_python;
+static PyObject *__pyx_n_c_numpy;
+static PyObject *__pyx_n__N;
+static PyObject *__pyx_n_c_loess;
+static PyObject *__pyx_n_numpy;
+static PyObject *__pyx_n_False;
+static PyObject *__pyx_n_gaussian;
+
+static PyObject *__pyx_n_ndim;
+static PyObject *__pyx_n_ValueError;
+static PyObject *__pyx_n_len;
+static PyObject *__pyx_n_size;
+
+static PyObject *__pyx_k11p;
+static PyObject *__pyx_k12p;
+static PyObject *__pyx_k13p;
+static PyObject *__pyx_k14p;
+
+static char (__pyx_k11[]) = "DEBUG: Initializing loess_inputs...";
+static char (__pyx_k12[]) = "Argument 'x' should be 2D at most!";
+static char (__pyx_k13[]) = "Invalid size of the 'weights' vector!";
+static char (__pyx_k14[]) = " OK.";
+
+static int __pyx_f_6cloess_12loess_inputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_12loess_inputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_x = 0;
+ PyObject *__pyx_v_y = 0;
+ PyObject *__pyx_v_weights = 0;
+ double (*__pyx_v_w_dat);
+ npy_intp __pyx_v_n;
+ npy_intp __pyx_v_p;
+ npy_intp (*__pyx_v_dims);
+ PyObject *__pyx_v_i;
+ int __pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ int __pyx_3;
+ PyObject *__pyx_4 = 0;
+ npy_intp __pyx_5;
+ long __pyx_6;
+ static char *__pyx_argnames[] = {"x","y","weights",0};
+ __pyx_v_weights = __pyx_k2;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_x, &__pyx_v_y, &__pyx_v_weights)) return -1;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_x);
+ Py_INCREF(__pyx_v_y);
+ Py_INCREF(__pyx_v_weights);
+ __pyx_v_i = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":27 */
+ if (__Pyx_PrintItem(__pyx_k11p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 27; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":28 */
+ __pyx_1 = PyArray_FROMANY(__pyx_v_x,NPY_DOUBLE,1,1,NPY_OWNDATA); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x));
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":29 */
+ __pyx_1 = PyArray_FROMANY(__pyx_v_y,NPY_DOUBLE,1,1,NPY_OWNDATA); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->y));
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->y = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":31 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x), __pyx_n_ndim); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(2); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_1, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; goto __pyx_L1;}
+ __pyx_3 = __pyx_3 > 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__pyx_3) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":32 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ __Pyx_Raise(__pyx_1, __pyx_k12p, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ __pyx_L2:;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":33 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x));
+ PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x));
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_5 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_v_n = __pyx_5;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":34 */
+ __pyx_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x), __pyx_n_size); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ __pyx_1 = PyInt_FromLong(__pyx_v_n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Divide(__pyx_2, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_5 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 34; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_v_p = __pyx_5;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":36 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->nobs = ((long )__pyx_v_n);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":37 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->nvar = ((long )__pyx_v_p);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":38 */
+ (__pyx_v_dims[0]) = __pyx_v_n;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":40 */
+ __pyx_3 = __pyx_v_weights == Py_None;
+ if (__pyx_3) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":41 */
+ __pyx_2 = PyArray_EMPTY(1,__pyx_v_dims,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 41; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights));
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":42 */
+ __pyx_v_w_dat = ((double (*))((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":43 */
+ __pyx_5 = (__pyx_v_dims[0]);
+ for (__pyx_6 = 0; __pyx_6 < __pyx_5; ++__pyx_6) {
+ __pyx_1 = PyInt_FromLong(__pyx_6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; goto __pyx_L1;}
+ Py_DECREF(__pyx_v_i);
+ __pyx_v_i = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":44 */
+ __pyx_3 = PyInt_AsLong(__pyx_v_i); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; goto __pyx_L1;}
+ (__pyx_v_w_dat[__pyx_3]) = 1;
+ }
+ goto __pyx_L3;
+ }
+ /*else*/ {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":46 */
+ __pyx_4 = PyArray_FROMANY(__pyx_v_weights,NPY_DOUBLE,1,1,NPY_OWNDATA); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights));
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":47 */
+ __pyx_2 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights), __pyx_n_ndim); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ __pyx_1 = PyInt_FromLong(1); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_2, __pyx_1, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ __pyx_3 = __pyx_3 > 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (!__pyx_3) {
+ __pyx_4 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights), __pyx_n_size); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ if (PyObject_Cmp(__pyx_4, __pyx_2, &__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; goto __pyx_L1;}
+ __pyx_3 = __pyx_3 != 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ }
+ if (__pyx_3) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":48 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_ValueError); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
+ __Pyx_Raise(__pyx_1, __pyx_k13p, 0);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; goto __pyx_L1;}
+ goto __pyx_L6;
+ }
+ __pyx_L6:;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":49 */
+ __pyx_v_w_dat = ((double (*))((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights->data);
+ }
+ __pyx_L3:;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":51 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->_inputs.n = ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->nobs;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":52 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->_inputs.p = ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->nvar;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":53 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->_inputs.x = ((double (*))((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->x->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":54 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->_inputs.y = ((double (*))((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->y->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":55 */
+ ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->_inputs.weights = ((double (*))((struct __pyx_obj_6cloess_loess_inputs *)__pyx_v_self)->weights->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":62 */
+ if (__Pyx_PrintItem(__pyx_k14p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":63 */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("cloess.loess_inputs.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_i);
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_x);
+ Py_DECREF(__pyx_v_y);
+ Py_DECREF(__pyx_v_weights);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k15p;
+static PyObject *__pyx_k19p;
+
+static char (__pyx_k15[]) = "DEBUG: Initializing loess_control...";
+static char (__pyx_k16[]) = "interpolate";
+static char (__pyx_k17[]) = "approximate";
+static char (__pyx_k18[]) = "wait.to.decide";
+static char (__pyx_k19[]) = "OK.";
+
+static int __pyx_f_6cloess_13loess_control___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_13loess_control___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ int __pyx_r;
+ static char *__pyx_argnames[] = {0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return -1;
+ Py_INCREF(__pyx_v_self);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":76 */
+ if (__Pyx_PrintItem(__pyx_k15p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":77 */
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->surface = __pyx_k16;
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->_control.surface = __pyx_k16;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":78 */
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->statistics = __pyx_k17;
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->_control.statistics = __pyx_k17;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":79 */
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->cell = 0.2;
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->_control.cell = 0.2;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":80 */
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->trace_hat = __pyx_k18;
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->_control.trace_hat = __pyx_k18;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":81 */
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->iterations = 4;
+ ((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->_control.iterations = 4;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":82 */
+ if (__Pyx_PrintItem(__pyx_k19p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 82; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":83 */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ __Pyx_AddTraceback("cloess.loess_control.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_join;
+
+static PyObject *__pyx_k20p;
+static PyObject *__pyx_k21p;
+static PyObject *__pyx_k22p;
+static PyObject *__pyx_k23p;
+static PyObject *__pyx_k24p;
+static PyObject *__pyx_k25p;
+static PyObject *__pyx_k26p;
+
+static char (__pyx_k20[]) = "Control :";
+static char (__pyx_k21[]) = "Surface type : %s";
+static char (__pyx_k22[]) = "Statistics : %s";
+static char (__pyx_k23[]) = "Trace estimation : %s";
+static char (__pyx_k24[]) = "Cell size : %s";
+static char (__pyx_k25[]) = "Nb iterations : %s";
+static char (__pyx_k26[]) = "\n";
+
+static PyObject *__pyx_f_6cloess_13loess_control___str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6cloess_13loess_control___str__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_v_strg;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ Py_INCREF(__pyx_v_self);
+ __pyx_v_strg = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":86 */
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->surface); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k21p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 87; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->statistics); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ __pyx_3 = PyNumber_Remainder(__pyx_k22p, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 88; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->trace_hat); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Remainder(__pyx_k23p, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->cell); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ __pyx_5 = PyNumber_Remainder(__pyx_k24p, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 90; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6cloess_loess_control *)__pyx_v_self)->iterations); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ __pyx_6 = PyNumber_Remainder(__pyx_k25p, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyList_New(6); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 86; goto __pyx_L1;}
+ Py_INCREF(__pyx_k20p);
+ PyList_SET_ITEM(__pyx_1, 0, __pyx_k20p);
+ PyList_SET_ITEM(__pyx_1, 1, __pyx_2);
+ PyList_SET_ITEM(__pyx_1, 2, __pyx_3);
+ PyList_SET_ITEM(__pyx_1, 3, __pyx_4);
+ PyList_SET_ITEM(__pyx_1, 4, __pyx_5);
+ PyList_SET_ITEM(__pyx_1, 5, __pyx_6);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_4 = 0;
+ __pyx_5 = 0;
+ __pyx_6 = 0;
+ Py_DECREF(__pyx_v_strg);
+ __pyx_v_strg = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":92 */
+ __pyx_2 = PyObject_GetAttr(__pyx_k26p, __pyx_n_join); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_strg);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_strg);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ __Pyx_AddTraceback("cloess.loess_control.__str__");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_strg);
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_pesudovalues;
+
+static PyObject *__pyx_k27p;
+static PyObject *__pyx_k28p;
+
+static char (__pyx_k27[]) = "DEBUG: Initializing loess_outputs...";
+static char (__pyx_k28[]) = "OK.";
+
+static int __pyx_f_6cloess_13loess_outputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_13loess_outputs___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_n = 0;
+ PyObject *__pyx_v_p = 0;
+ npy_intp (*__pyx_v_rows);
+ npy_intp (*__pyx_v_cols);
+ int __pyx_r;
+ PyObject *__pyx_1 = 0;
+ static char *__pyx_argnames[] = {"n","p",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO", __pyx_argnames, &__pyx_v_n, &__pyx_v_p)) return -1;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_n);
+ Py_INCREF(__pyx_v_p);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":106 */
+ (__pyx_v_rows[0]) = ((int )__pyx_v_n);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":107 */
+ (__pyx_v_cols[0]) = ((int )__pyx_v_p);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":108 */
+ if (__Pyx_PrintItem(__pyx_k27p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 108; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":110 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_rows,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 110; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_values));
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_values = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":111 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_rows,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_residuals));
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_residuals = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":112 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_rows,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
+ if (PyObject_SetAttr(__pyx_v_self, __pyx_n_pesudovalues, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":113 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_rows,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 113; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->diagonal));
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->diagonal = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":114 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_rows,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->robust));
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->robust = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":115 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_cols,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 115; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->divisor));
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->divisor = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":117 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.fitted_values = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_values->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":118 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.fitted_residuals = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->fitted_residuals->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":119 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.pseudovalues = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->pseudovalues->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":120 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.diagonal = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->diagonal->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":121 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.robust = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->robust->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":122 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.divisor = ((double (*))((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->divisor->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":124 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->enp = 0;
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.enp = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":125 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->s = 0;
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.s = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":126 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->one_delta = 0;
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.one_delta = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":127 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->two_delta = 0;
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.two_delta = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":128 */
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->trace_hat = 0;
+ ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_v_self)->_outputs.trace_hat = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":129 */
+ if (__Pyx_PrintItem(__pyx_k28p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 129; goto __pyx_L1;}
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ __Pyx_AddTraceback("cloess.loess_outputs.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_n);
+ Py_DECREF(__pyx_v_p);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_max;
+static PyObject *__pyx_n_NPY_LONG;
+
+static PyObject *__pyx_k29p;
+static PyObject *__pyx_k30p;
+static PyObject *__pyx_k31p;
+static PyObject *__pyx_k32p;
+
+static char (__pyx_k29[]) = "DEBUG: Initializing loess_kdtree...";
+static char (__pyx_k30[]) = "(python side)";
+static char (__pyx_k31[]) = "(C side)";
+static char (__pyx_k32[]) = "OK.";
+
+static int __pyx_f_6cloess_13loess_kd_tree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_13loess_kd_tree___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ long __pyx_v_n;
+ long __pyx_v_p;
+ long __pyx_v_maxkd;
+ long __pyx_v_nval;
+ long __pyx_v_nvert;
+ npy_intp (*__pyx_v_nmaxkd);
+ npy_intp (*__pyx_v_nnval);
+ npy_intp (*__pyx_v_nnvert);
+ npy_intp (*__pyx_v_npars);
+ int __pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ long __pyx_5;
+ enum NPY_TYPES __pyx_6;
+ static char *__pyx_argnames[] = {"n","p",0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "ll", __pyx_argnames, &__pyx_v_n, &__pyx_v_p)) return -1;
+ Py_INCREF(__pyx_v_self);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":150 */
+ if (__Pyx_PrintItem(__pyx_k29p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 150; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":151 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_max); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ __pyx_3 = PyInt_FromLong(200); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ __pyx_4 = PyTuple_New(2); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyObject_CallObject(__pyx_1, __pyx_4); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_5 = PyInt_AsLong(__pyx_2); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_v_maxkd = __pyx_5;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":152 */
+ __pyx_v_nvert = (__pyx_v_p * 2);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":153 */
+ __pyx_v_nval = ((__pyx_v_p + 1) * __pyx_v_maxkd);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":155 */
+ if (__Pyx_PrintItem(__pyx_k30p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":156 */
+ (__pyx_v_nmaxkd[0]) = ((int )__pyx_v_maxkd);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":157 */
+ (__pyx_v_nnvert[0]) = ((int )__pyx_v_nvert);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":158 */
+ (__pyx_v_nnval[0]) = ((int )__pyx_v_nval);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":159 */
+ (__pyx_v_npars[0]) = ((int )8);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":160 */
+ __pyx_3 = __Pyx_GetName(__pyx_b, __pyx_n_NPY_LONG); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
+ __pyx_6 = ((enum NPY_TYPES )PyInt_AsLong(__pyx_3)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_npars,__pyx_6,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->parameter));
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->parameter = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":161 */
+ __pyx_4 = __Pyx_GetName(__pyx_b, __pyx_n_NPY_LONG); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
+ __pyx_6 = ((enum NPY_TYPES )PyInt_AsLong(__pyx_4)); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ __pyx_2 = PyArray_EMPTY(1,__pyx_v_nmaxkd,__pyx_6,NPY_ALIGNED); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 161; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_2)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->a));
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->a = ((PyArrayObject *)__pyx_2);
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":162 */
+ __pyx_3 = PyArray_EMPTY(1,__pyx_v_nmaxkd,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 162; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_3)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->xi));
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->xi = ((PyArrayObject *)__pyx_3);
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":163 */
+ __pyx_1 = PyArray_EMPTY(1,__pyx_v_nnvert,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 163; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_1)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vert));
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vert = ((PyArrayObject *)__pyx_1);
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":164 */
+ __pyx_4 = PyArray_EMPTY(1,__pyx_v_nnval,NPY_DOUBLE,NPY_ALIGNED); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; goto __pyx_L1;}
+ Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_4)));
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vval));
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vval = ((PyArrayObject *)__pyx_4);
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":171 */
+ if (__Pyx_PrintItem(__pyx_k31p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 171; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":172 */
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->_kdtree.parameter = ((long (*))((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->parameter->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":173 */
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->_kdtree.a = ((long (*))((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->a->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":174 */
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->_kdtree.xi = ((double (*))((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->xi->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":175 */
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->_kdtree.vert = ((double (*))((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vert->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":176 */
+ ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->_kdtree.vval = ((double (*))((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_v_self)->vval->data);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":187 */
+ if (__Pyx_PrintItem(__pyx_k32p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":188 */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("cloess.loess_kd_tree.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_hasattr;
+static PyObject *__pyx_n___len__;
+
+static PyObject *__pyx_k33p;
+static PyObject *__pyx_k36p;
+
+static char (__pyx_k33[]) = "DEBUG: Initializing loess_model...";
+static char (__pyx_k36[]) = "OK.";
+
+static int __pyx_f_6cloess_11loess_model___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_11loess_model___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ double __pyx_v_span;
+ int __pyx_v_degree;
+ int __pyx_v_normalize;
+ PyObject *__pyx_v_parametric_in = 0;
+ PyObject *__pyx_v_drop_square_in = 0;
+ PyObject *__pyx_v_family = 0;
+ int __pyx_v_i;
+ int __pyx_r;
+ char (*__pyx_1);
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ int __pyx_5;
+ long __pyx_6;
+ long __pyx_7;
+ static char *__pyx_argnames[] = {"span","degree","normalize","parametric_in","drop_square_in","family",0};
+ __pyx_v_span = __pyx_k3;
+ __pyx_v_degree = __pyx_k4;
+ __pyx_v_normalize = __pyx_k5;
+ __pyx_v_parametric_in = __pyx_k6;
+ __pyx_v_drop_square_in = __pyx_k7;
+ __pyx_v_family = __pyx_k9;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "|diiOOO", __pyx_argnames, &__pyx_v_span, &__pyx_v_degree, &__pyx_v_normalize, &__pyx_v_parametric_in, &__pyx_v_drop_square_in, &__pyx_v_family)) return -1;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_parametric_in);
+ Py_INCREF(__pyx_v_drop_square_in);
+ Py_INCREF(__pyx_v_family);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":208 */
+ if (__Pyx_PrintItem(__pyx_k33p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":209 */
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->span = __pyx_v_span;
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.span = __pyx_v_span;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":210 */
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->degree = __pyx_v_degree;
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.degree = __pyx_v_degree;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":211 */
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->normalize = __pyx_v_normalize;
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.normalize = __pyx_v_normalize;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":212 */
+ __pyx_1 = PyString_AsString(__pyx_v_family); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->family = __pyx_1;
+ __pyx_1 = PyString_AsString(__pyx_v_family); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 212; goto __pyx_L1;}
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.family = __pyx_1;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":214 */
+ __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
+ Py_INCREF(Py_None);
+ PyList_SET_ITEM(__pyx_2, 0, Py_None);
+ __pyx_3 = PyInt_FromLong(8); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->parametric_flags);
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->parametric_flags = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":215 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_hasattr); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_parametric_in);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_parametric_in);
+ Py_INCREF(__pyx_n___len__);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_n___len__);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_5) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":216 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_parametric_in);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_parametric_in);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 216; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_6; ++__pyx_v_i) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":217 */
+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_parametric_in, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
+ if (PyObject_SetItem(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->parametric_flags, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 217; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":218 */
+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_parametric_in, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_7 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ (((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.parametric[__pyx_v_i]) = __pyx_7;
+ }
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":220 */
+ for (__pyx_v_i = 0; __pyx_v_i <= 7; ++__pyx_v_i) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":221 */
+ __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
+ if (PyObject_SetItem(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->parametric_flags, __pyx_4, __pyx_v_parametric_in) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":222 */
+ __pyx_7 = PyInt_AsLong(__pyx_v_parametric_in); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 222; goto __pyx_L1;}
+ (((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.parametric[__pyx_v_i]) = __pyx_7;
+ }
+ }
+ __pyx_L2:;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":224 */
+ __pyx_2 = PyList_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
+ Py_INCREF(Py_None);
+ PyList_SET_ITEM(__pyx_2, 0, Py_None);
+ __pyx_3 = PyInt_FromLong(8); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Multiply(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 224; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ Py_DECREF(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->drop_square_flags);
+ ((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->drop_square_flags = __pyx_4;
+ __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":225 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_hasattr); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_drop_square_in);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_drop_square_in);
+ Py_INCREF(__pyx_n___len__);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_n___len__);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_5 = PyObject_IsTrue(__pyx_4); if (__pyx_5 < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ if (__pyx_5) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":226 */
+ __pyx_2 = __Pyx_GetName(__pyx_b, __pyx_n_len); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_drop_square_in);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_drop_square_in);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_6 = PyInt_AsLong(__pyx_4); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 226; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ for (__pyx_v_i = 0; __pyx_v_i < __pyx_6; ++__pyx_v_i) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":227 */
+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_drop_square_in, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
+ if (PyObject_SetItem(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->drop_square_flags, __pyx_4, __pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":228 */
+ __pyx_2 = PyInt_FromLong(__pyx_v_i); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+ __pyx_3 = PyObject_GetItem(__pyx_v_drop_square_in, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_7 = PyInt_AsLong(__pyx_3); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 228; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ (((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.drop_square[__pyx_v_i]) = __pyx_7;
+ }
+ goto __pyx_L7;
+ }
+ /*else*/ {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":230 */
+ for (__pyx_v_i = 0; __pyx_v_i < 8; ++__pyx_v_i) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":231 */
+ __pyx_4 = PyInt_FromLong(__pyx_v_i); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
+ if (PyObject_SetItem(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->drop_square_flags, __pyx_4, __pyx_v_drop_square_in) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 231; goto __pyx_L1;}
+ Py_DECREF(__pyx_4); __pyx_4 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":232 */
+ __pyx_7 = PyInt_AsLong(__pyx_v_drop_square_in); if (PyErr_Occurred()) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 232; goto __pyx_L1;}
+ (((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.drop_square[__pyx_v_i]) = __pyx_7;
+ }
+ }
+ __pyx_L7:;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":233 */
+ if (__Pyx_PrintItem(__pyx_k36p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 233; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":246 */
+ __pyx_r = 0;
+ goto __pyx_L0;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ __Pyx_AddTraceback("cloess.loess_model.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_parametric_in);
+ Py_DECREF(__pyx_v_drop_square_in);
+ Py_DECREF(__pyx_v_family);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_id;
+
+static PyObject *__pyx_k37p;
+
+static char (__pyx_k37[]) = "loess model parameters @%s";
+
+static PyObject *__pyx_f_6cloess_11loess_model___repr__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6cloess_11loess_model___repr__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ Py_INCREF(__pyx_v_self);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":249 */
+ __pyx_1 = __Pyx_GetName(__pyx_b, __pyx_n_id); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
+ __pyx_2 = PyTuple_New(1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_self);
+ PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_self);
+ __pyx_3 = PyObject_CallObject(__pyx_1, __pyx_2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ __pyx_1 = PyNumber_Remainder(__pyx_k37p, __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 249; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_r = __pyx_1;
+ __pyx_1 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ __Pyx_AddTraceback("cloess.loess_model.__repr__");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n___name__;
+static PyObject *__pyx_n_parametric;
+static PyObject *__pyx_n_drop_square;
+
+static PyObject *__pyx_k38p;
+static PyObject *__pyx_k39p;
+static PyObject *__pyx_k40p;
+static PyObject *__pyx_k41p;
+static PyObject *__pyx_k42p;
+static PyObject *__pyx_k43p;
+static PyObject *__pyx_k44p;
+static PyObject *__pyx_k45p;
+
+static char (__pyx_k38[]) = "Object : %s";
+static char (__pyx_k39[]) = "family : %s";
+static char (__pyx_k40[]) = "span : %s";
+static char (__pyx_k41[]) = "degree : %s";
+static char (__pyx_k42[]) = "normalized : %s";
+static char (__pyx_k43[]) = "parametric : %s";
+static char (__pyx_k44[]) = "drop_square : %s";
+static char (__pyx_k45[]) = "\n";
+
+static PyObject *__pyx_f_6cloess_11loess_model___str__(PyObject *__pyx_v_self); /*proto*/
+static PyObject *__pyx_f_6cloess_11loess_model___str__(PyObject *__pyx_v_self) {
+ PyObject *__pyx_v_strg;
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ PyObject *__pyx_4 = 0;
+ PyObject *__pyx_5 = 0;
+ PyObject *__pyx_6 = 0;
+ PyObject *__pyx_7 = 0;
+ PyObject *__pyx_8 = 0;
+ Py_INCREF(__pyx_v_self);
+ __pyx_v_strg = Py_None; Py_INCREF(Py_None);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":251 */
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n___name__); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k38p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyString_FromString(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.family); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
+ __pyx_3 = PyNumber_Remainder(__pyx_k39p, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 252; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.span); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
+ __pyx_4 = PyNumber_Remainder(__pyx_k40p, __pyx_1); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 253; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.degree); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
+ __pyx_5 = PyNumber_Remainder(__pyx_k41p, __pyx_1); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 254; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyInt_FromLong(((struct __pyx_obj_6cloess_loess_model *)__pyx_v_self)->_model.normalize); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
+ __pyx_6 = PyNumber_Remainder(__pyx_k42p, __pyx_1); if (!__pyx_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 255; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_parametric); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
+ __pyx_7 = PyNumber_Remainder(__pyx_k43p, __pyx_1); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 256; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyObject_GetAttr(__pyx_v_self, __pyx_n_drop_square); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; goto __pyx_L1;}
+ __pyx_8 = PyNumber_Remainder(__pyx_k44p, __pyx_1); if (!__pyx_8) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 257; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ __pyx_1 = PyList_New(7); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 251; goto __pyx_L1;}
+ PyList_SET_ITEM(__pyx_1, 0, __pyx_2);
+ PyList_SET_ITEM(__pyx_1, 1, __pyx_3);
+ PyList_SET_ITEM(__pyx_1, 2, __pyx_4);
+ PyList_SET_ITEM(__pyx_1, 3, __pyx_5);
+ PyList_SET_ITEM(__pyx_1, 4, __pyx_6);
+ PyList_SET_ITEM(__pyx_1, 5, __pyx_7);
+ PyList_SET_ITEM(__pyx_1, 6, __pyx_8);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_4 = 0;
+ __pyx_5 = 0;
+ __pyx_6 = 0;
+ __pyx_7 = 0;
+ __pyx_8 = 0;
+ Py_DECREF(__pyx_v_strg);
+ __pyx_v_strg = __pyx_1;
+ __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":258 */
+ __pyx_2 = PyObject_GetAttr(__pyx_k45p, __pyx_n_join); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_strg);
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_strg);
+ __pyx_4 = PyObject_CallObject(__pyx_2, __pyx_3); if (!__pyx_4) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 258; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ __pyx_r = __pyx_4;
+ __pyx_4 = 0;
+ goto __pyx_L0;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ Py_XDECREF(__pyx_4);
+ Py_XDECREF(__pyx_5);
+ Py_XDECREF(__pyx_6);
+ Py_XDECREF(__pyx_7);
+ Py_XDECREF(__pyx_8);
+ __Pyx_AddTraceback("cloess.loess_model.__str__");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_strg);
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_k46p;
+
+static char (__pyx_k46[]) = "DEBUG:Initializing loess_cside";
+
+static int __pyx_f_6cloess_5loess___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static int __pyx_f_6cloess_5loess___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_v_x = 0;
+ PyObject *__pyx_v_y = 0;
+ PyObject *__pyx_v_weights = 0;
+ long __pyx_v_n;
+ long __pyx_v_p;
+ int __pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ PyObject *__pyx_3 = 0;
+ static char *__pyx_argnames[] = {"x","y","weights",0};
+ __pyx_v_weights = __pyx_k10;
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "OO|O", __pyx_argnames, &__pyx_v_x, &__pyx_v_y, &__pyx_v_weights)) return -1;
+ Py_INCREF(__pyx_v_self);
+ Py_INCREF(__pyx_v_x);
+ Py_INCREF(__pyx_v_y);
+ Py_INCREF(__pyx_v_weights);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":285 */
+ __pyx_1 = PyTuple_New(3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ Py_INCREF(__pyx_v_x);
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x);
+ Py_INCREF(__pyx_v_y);
+ PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_y);
+ Py_INCREF(__pyx_v_weights);
+ PyTuple_SET_ITEM(__pyx_1, 2, __pyx_v_weights);
+ __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6cloess_loess_inputs), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6cloess_loess_inputs)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 285; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs));
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs = ((struct __pyx_obj_6cloess_loess_inputs *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":286 */
+ __pyx_v_n = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs->nobs;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":287 */
+ __pyx_v_p = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs->nvar;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":288 */
+ __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_6cloess_loess_model), 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6cloess_loess_model)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 288; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->model));
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->model = ((struct __pyx_obj_6cloess_loess_model *)__pyx_1);
+ __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":289 */
+ __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6cloess_loess_control), 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6cloess_loess_control)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 289; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->control));
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->control = ((struct __pyx_obj_6cloess_loess_control *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":290 */
+ __pyx_1 = PyInt_FromLong(__pyx_v_n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ __pyx_2 = PyInt_FromLong(__pyx_v_p); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ __pyx_3 = PyTuple_New(2); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1);
+ PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2);
+ __pyx_1 = 0;
+ __pyx_2 = 0;
+ __pyx_1 = PyObject_CallObject(((PyObject*)__pyx_ptype_6cloess_loess_outputs), __pyx_3); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ Py_DECREF(__pyx_3); __pyx_3 = 0;
+ if (!__Pyx_TypeTest(__pyx_1, __pyx_ptype_6cloess_loess_outputs)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 290; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs));
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs = ((struct __pyx_obj_6cloess_loess_outputs *)__pyx_1);
+ __pyx_1 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":291 */
+ __pyx_2 = PyInt_FromLong(__pyx_v_n); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+ __pyx_3 = PyInt_FromLong(__pyx_v_p); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+ __pyx_1 = PyTuple_New(2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+ PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2);
+ PyTuple_SET_ITEM(__pyx_1, 1, __pyx_3);
+ __pyx_2 = 0;
+ __pyx_3 = 0;
+ __pyx_2 = PyObject_CallObject(((PyObject*)__pyx_ptype_6cloess_loess_kd_tree), __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (!__Pyx_TypeTest(__pyx_2, __pyx_ptype_6cloess_loess_kd_tree)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 291; goto __pyx_L1;}
+ Py_DECREF(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->kd_tree));
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->kd_tree = ((struct __pyx_obj_6cloess_loess_kd_tree *)__pyx_2);
+ __pyx_2 = 0;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":293 */
+ if (__Pyx_PrintItem(__pyx_k46p) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 293; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":294 */
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->_base.inputs = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs->_inputs;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":295 */
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->_base.model = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->model->_model;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":296 */
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->_base.control = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->control->_control;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":297 */
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->_base.kd_tree = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->kd_tree->_kdtree;
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":298 */
+ ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->_base.outputs = ((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs->_outputs;
+
+ __pyx_r = 0;
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ Py_XDECREF(__pyx_3);
+ __Pyx_AddTraceback("cloess.loess.__init__");
+ __pyx_r = -1;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ Py_DECREF(__pyx_v_x);
+ Py_DECREF(__pyx_v_y);
+ Py_DECREF(__pyx_v_weights);
+ return __pyx_r;
+}
+
+static PyObject *__pyx_n_n;
+
+static PyObject *__pyx_k47p;
+static PyObject *__pyx_k48p;
+static PyObject *__pyx_k50p;
+static PyObject *__pyx_k51p;
+
+static char (__pyx_k47[]) = "Number of Observations : %d";
+static char (__pyx_k48[]) = "Equivalent Number of Parameters: %.1f";
+static char (__pyx_k49[]) = "gaussian";
+static char (__pyx_k50[]) = "Residual Standard Error : %.4f";
+static char (__pyx_k51[]) = "Residual Scale Estimate : %.4f";
+
+static PyObject *__pyx_f_6cloess_5loess_summary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/
+static PyObject *__pyx_f_6cloess_5loess_summary(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) {
+ PyObject *__pyx_r;
+ PyObject *__pyx_1 = 0;
+ PyObject *__pyx_2 = 0;
+ int __pyx_3;
+ static char *__pyx_argnames[] = {0};
+ if (!PyArg_ParseTupleAndKeywords(__pyx_args, __pyx_kwds, "", __pyx_argnames)) return 0;
+ Py_INCREF(__pyx_v_self);
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":310 */
+ __pyx_1 = PyObject_GetAttr(((PyObject *)((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->inputs), __pyx_n_n); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k47p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 310; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":311 */
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs->enp); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k48p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 311; goto __pyx_L1;}
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":312 */
+ __pyx_3 = (((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->model->family == __pyx_k49);
+ if (__pyx_3) {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":313 */
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs->s); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k50p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 313; goto __pyx_L1;}
+ goto __pyx_L2;
+ }
+ /*else*/ {
+
+ /* "/home/backtopop/workspace/pyloess_c/src/cloess.pyx":315 */
+ __pyx_1 = PyFloat_FromDouble(((struct __pyx_obj_6cloess_loess *)__pyx_v_self)->outputs->s); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+ __pyx_2 = PyNumber_Remainder(__pyx_k51p, __pyx_1); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+ Py_DECREF(__pyx_1); __pyx_1 = 0;
+ if (__Pyx_PrintItem(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+ Py_DECREF(__pyx_2); __pyx_2 = 0;
+ if (__Pyx_PrintNewline() < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 315; goto __pyx_L1;}
+ }
+ __pyx_L2:;
+
+ __pyx_r = Py_None; Py_INCREF(Py_None);
+ goto __pyx_L0;
+ __pyx_L1:;
+ Py_XDECREF(__pyx_1);
+ Py_XDECREF(__pyx_2);
+ __Pyx_AddTraceback("cloess.loess.summary");
+ __pyx_r = 0;
+ __pyx_L0:;
+ Py_DECREF(__pyx_v_self);
+ return __pyx_r;
+}
+
+static __Pyx_InternTabEntry __pyx_intern_tab[] = {
+ {&__pyx_n_False, "False"},
+ {&__pyx_n_NPY_LONG, "NPY_LONG"},
+ {&__pyx_n_ValueError, "ValueError"},
+ {&__pyx_n__N, "_N"},
+ {&__pyx_n___len__, "__len__"},
+ {&__pyx_n___name__, "__name__"},
+ {&__pyx_n_c_loess, "c_loess"},
+ {&__pyx_n_c_numpy, "c_numpy"},
+ {&__pyx_n_c_python, "c_python"},
+ {&__pyx_n_drop_square, "drop_square"},
+ {&__pyx_n_gaussian, "gaussian"},
+ {&__pyx_n_hasattr, "hasattr"},
+ {&__pyx_n_id, "id"},
+ {&__pyx_n_join, "join"},
+ {&__pyx_n_len, "len"},
+ {&__pyx_n_max, "max"},
+ {&__pyx_n_n, "n"},
+ {&__pyx_n_ndim, "ndim"},
+ {&__pyx_n_numpy, "numpy"},
+ {&__pyx_n_parametric, "parametric"},
+ {&__pyx_n_pesudovalues, "pesudovalues"},
+ {&__pyx_n_size, "size"},
+ {0, 0}
+};
+
+static __Pyx_StringTabEntry __p