From scipy-svn at scipy.org Tue Jun 1 00:09:29 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 31 May 2010 23:09:29 -0500 (CDT) Subject: [Scipy-svn] r6462 - trunk/doc/source/tutorial/stats Message-ID: <20100601040929.1281D39CAEA@scipy.org> Author: oliphant Date: 2010-05-31 23:09:28 -0500 (Mon, 31 May 2010) New Revision: 6462 Added: trunk/doc/source/tutorial/stats/continuous.lyx trunk/doc/source/tutorial/stats/discrete.lyx Log: Add back original LyX files Added: trunk/doc/source/tutorial/stats/continuous.lyx =================================================================== --- trunk/doc/source/tutorial/stats/continuous.lyx (rev 0) +++ trunk/doc/source/tutorial/stats/continuous.lyx 2010-06-01 04:09:28 UTC (rev 6462) @@ -0,0 +1,4972 @@ +#LyX 1.5.1 created this file. For more info see http://www.lyx.org/ +\lyxformat 276 +\begin_document +\begin_header +\textclass article +\language english +\inputencoding auto +\font_roman default +\font_sans default +\font_typewriter default +\font_default_family default +\font_sc false +\font_osf false +\font_sf_scale 100 +\font_tt_scale 100 +\graphics default +\paperfontsize default +\spacing single +\papersize default +\use_geometry true +\use_amsmath 2 +\use_esint 0 +\cite_engine basic +\use_bibtopic false +\paperorientation portrait +\leftmargin 1in +\topmargin 1in +\rightmargin 1in +\bottommargin 1in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\papercolumns 1 +\papersides 1 +\paperpagestyle default +\tracking_changes false +\output_changes false +\author "" +\end_header + +\begin_body + +\begin_layout Title +Continuous Statistical Distributions +\end_layout + +\begin_layout Section +Overview +\end_layout + +\begin_layout Standard +All distributions will have location (L) and Scale (S) parameters along + with any shape parameters needed, the names for the shape parameters will + vary. + Standard form for the distributions will be given where +\begin_inset Formula $L=0.0$ +\end_inset + + and +\begin_inset Formula $S=1.0.$ +\end_inset + + The nonstandard forms can be obtained for the various functions using (note + +\begin_inset Formula $U$ +\end_inset + + is a standard uniform random variate). + +\end_layout + +\begin_layout Standard +\align center + +\size small +\begin_inset Tabular + + + + + + + +\begin_inset Text + +\begin_layout Standard +Function Name +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +Standard Function +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +Transformation +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Cumulative Distribution Function (CDF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $F\left(x\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $F\left(x;L,S\right)=F\left(\frac{\left(x-L\right)}{S}\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Probability Density Function (PDF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $f\left(x\right)=F^{\prime}\left(x\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $f\left(x;L,S\right)=\frac{1}{S}f\left(\frac{\left(x-L\right)}{S}\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Percent Point Function (PPF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $G\left(q\right)=F^{-1}\left(q\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $G\left(q;L,S\right)=L+SG\left(q\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Probability Sparsity Function (PSF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $g\left(q\right)=G^{\prime}\left(q\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $g\left(q;L,S\right)=Sg\left(q\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Hazard Function (HF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $h_{a}\left(x\right)=\frac{f\left(x\right)}{1-F\left(x\right)}$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $h_{a}\left(x;L,S\right)=\frac{1}{S}h_{a}\left(\frac{\left(x-L\right)}{S}\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Cumulative Hazard Functon (CHF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $H_{a}\left(x\right)=$ +\end_inset + + +\begin_inset Formula $\log\frac{1}{1-F\left(x\right)}$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $H_{a}\left(x;L,S\right)=H_{a}\left(\frac{\left(x-L\right)}{S}\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Survival Function (SF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $S\left(x\right)=1-F\left(x\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $S\left(x;L,S\right)=S\left(\frac{\left(x-L\right)}{S}\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Inverse Survival Function (ISF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $Z\left(\alpha\right)=S^{-1}\left(\alpha\right)=G\left(1-\alpha\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $Z\left(\alpha;L,S\right)=L+SZ\left(\alpha\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Moment Generating Function (MGF) +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $M_{Y}\left(t\right)=E\left[e^{Yt}\right]$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $M_{X}\left(t\right)=e^{Lt}M_{Y}\left(St\right)$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Random Variates +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $Y=G\left(U\right)$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $X=L+SY$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +(Differential) Entropy +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $h\left[Y\right]=-\int f\left(y\right)\log f\left(y\right)dy$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $h\left[X\right]=h\left[Y\right]+\log S$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +(Non-central) Moments +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $\mu_{n}^{\prime}=E\left[Y^{n}\right]$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $E\left[X^{n}\right]=L^{n}\sum_{k=0}^{N}\left(\begin{array}{c} +n\\ +k\end{array}\right)\left(\frac{S}{L}\right)^{k}\mu_{k}^{\prime}$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +Central Moments +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $\mu_{n}=E\left[\left(Y-\mu\right)^{n}\right]$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $E\left[\left(X-\mu_{X}\right)^{n}\right]=S^{n}\mu_{n}$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +mean (mode, median), var +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $\mu,\,\mu_{2}$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $L+S\mu,\, S^{2}\mu_{2}$ +\end_inset + + +\end_layout + +\end_inset + + + + +\begin_inset Text + +\begin_layout Standard +skewness, kurtosis +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $\gamma_{1}=\frac{\mu_{3}}{\left(\mu_{2}\right)^{3/2}},\,$ +\end_inset + + +\begin_inset Formula $\gamma_{2}=\frac{\mu_{4}}{\left(\mu_{2}\right)^{2}}-3$ +\end_inset + + +\end_layout + +\end_inset + + +\begin_inset Text + +\begin_layout Standard +\begin_inset Formula $\gamma_{1},\,\gamma_{2}$ +\end_inset + + +\end_layout + +\end_inset + + + + +\end_inset + + +\end_layout + +\begin_layout Standard +\InsetSpace ~ + +\end_layout + +\begin_layout Subsection +Moments +\end_layout + +\begin_layout Standard +Non-central moments are defined using the PDF +\begin_inset Formula \[ +\mu_{n}^{\prime}=\int_{-\infty}^{\infty}x^{n}f\left(x\right)dx.\] + +\end_inset + + Note, that these can always be computed using the PPF. + Substitute +\begin_inset Formula $x=G\left(q\right)$ +\end_inset + + in the above equation and get +\begin_inset Formula \[ +\mu_{n}^{\prime}=\int_{0}^{1}G^{n}\left(q\right)dq\] + +\end_inset + + which may be easier to compute numerically. + Note that +\begin_inset Formula $q=F\left(x\right)$ +\end_inset + + so that +\begin_inset Formula $dq=f\left(x\right)dx.$ +\end_inset + + Central moments are computed similarly +\begin_inset Formula $\mu=\mu_{1}^{\prime}$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{n} & = & \int_{-\infty}^{\infty}\left(x-\mu\right)^{n}f\left(x\right)dx\\ + & = & \int_{0}^{1}\left(G\left(q\right)-\mu\right)^{n}dq\\ + & = & \sum_{k=0}^{n}\left(\begin{array}{c} +n\\ +k\end{array}\right)\left(-\mu\right)^{k}\mu_{n-k}^{\prime}\end{eqnarray*} + +\end_inset + + In particular +\begin_inset Formula \begin{eqnarray*} +\mu_{3} & = & \mu_{3}^{\prime}-3\mu\mu_{2}^{\prime}+2\mu^{3}\\ + & = & \mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}\\ +\mu_{4} & = & \mu_{4}^{\prime}-4\mu\mu_{3}^{\prime}+6\mu^{2}\mu_{2}^{\prime}-3\mu^{4}\\ + & = & \mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}\end{eqnarray*} + +\end_inset + + Skewness is defined as +\begin_inset Formula \[ +\gamma_{1}=\sqrt{\beta_{1}}=\frac{\mu_{3}}{\mu_{2}^{3/2}}\] + +\end_inset + + while (Fisher) kurtosis is +\begin_inset Formula \[ +\gamma_{2}=\frac{\mu_{4}}{\mu_{2}^{2}}-3,\] + +\end_inset + + so that a normal distribution has a kurtosis of zero. + +\end_layout + +\begin_layout Subsection +Median and mode +\end_layout + +\begin_layout Standard +The median, +\begin_inset Formula $m_{n}$ +\end_inset + + is defined as the point at which half of the density is on one side and + half on the other. + In other words, +\begin_inset Formula $F\left(m_{n}\right)=\frac{1}{2}$ +\end_inset + + so that +\begin_inset Formula \[ +m_{n}=G\left(\frac{1}{2}\right).\] + +\end_inset + + In addition, the mode, +\begin_inset Formula $m_{d}$ +\end_inset + +, is defined as the value for which the probability density function reaches + it's peak +\begin_inset Formula \[ +m_{d}=\arg\max_{x}f\left(x\right).\] + +\end_inset + + +\end_layout + +\begin_layout Subsection +Fitting data +\end_layout + +\begin_layout Standard +To fit data to a distribution, maximizing the likelihood function is common. + Alternatively, some distributions have well-known minimum variance unbiased + estimators. + These will be chosen by default, but the likelihood function will always + be available for minimizing. + +\end_layout + +\begin_layout Standard +If +\begin_inset Formula $f\left(x;\boldsymbol{\theta}\right)$ +\end_inset + + is the PDF of a random-variable where +\begin_inset Formula $\boldsymbol{\theta}$ +\end_inset + + is a vector of parameters ( +\emph on +e.g. + +\begin_inset Formula $L$ +\end_inset + + +\emph default + and +\begin_inset Formula $S$ +\end_inset + +), then for a collection of +\begin_inset Formula $N$ +\end_inset + + independent samples from this distribution, the joint distribution the + random vector +\begin_inset Formula $\mathbf{x}$ +\end_inset + + is +\begin_inset Formula \[ +f\left(\mathbf{x};\boldsymbol{\theta}\right)=\prod_{i=1}^{N}f\left(x_{i};\boldsymbol{\theta}\right).\] + +\end_inset + + The maximum likelihood estimate of the parameters +\begin_inset Formula $\boldsymbol{\theta}$ +\end_inset + + are the parameters which maximize this function with +\begin_inset Formula $\mathbf{x}$ +\end_inset + + fixed and given by the data: +\begin_inset Formula \begin{eqnarray*} +\boldsymbol{\theta}_{es} & = & \arg\max_{\boldsymbol{\theta}}f\left(\mathbf{x};\boldsymbol{\theta}\right)\\ + & = & \arg\min_{\boldsymbol{\theta}}l_{\mathbf{x}}\left(\boldsymbol{\theta}\right).\end{eqnarray*} + +\end_inset + + Where +\begin_inset Formula \begin{eqnarray*} +l_{\mathbf{x}}\left(\boldsymbol{\theta}\right) & = & -\sum_{i=1}^{N}\log f\left(x_{i};\boldsymbol{\theta}\right)\\ + & = & -N\overline{\log f\left(x_{i};\boldsymbol{\theta}\right)}\end{eqnarray*} + +\end_inset + + Note that if +\begin_inset Formula $\boldsymbol{\theta}$ +\end_inset + + includes only shape parameters, the location and scale-parameters can be + fit by replacing +\begin_inset Formula $x_{i}$ +\end_inset + + with +\begin_inset Formula $\left(x_{i}-L\right)/S$ +\end_inset + + in the log-likelihood function adding +\begin_inset Formula $N\log S$ +\end_inset + + and minimizing, thus +\begin_inset Formula \begin{eqnarray*} +l_{\mathbf{x}}\left(L,S;\boldsymbol{\theta}\right) & = & N\log S-\sum_{i=1}^{N}\log f\left(\frac{x_{i}-L}{S};\boldsymbol{\theta}\right)\\ + & = & N\log S+l_{\frac{\mathbf{x}-S}{L}}\left(\boldsymbol{\theta}\right)\end{eqnarray*} + +\end_inset + + If desired, sample estimates for +\begin_inset Formula $L$ +\end_inset + + and +\begin_inset Formula $S$ +\end_inset + + (not necessarily maximum likelihood estimates) can be obtained from samples + estimates of the mean and variance using +\begin_inset Formula \begin{eqnarray*} +\hat{S} & = & \sqrt{\frac{\hat{\mu}_{2}}{\mu_{2}}}\\ +\hat{L} & = & \hat{\mu}-\hat{S}\mu\end{eqnarray*} + +\end_inset + + where +\begin_inset Formula $\mu$ +\end_inset + + and +\begin_inset Formula $\mu_{2}$ +\end_inset + + are assumed known as the mean and variance of the +\series bold +untransformed +\series default + distribution (when +\begin_inset Formula $L=0$ +\end_inset + + and +\begin_inset Formula $S=1$ +\end_inset + +) and +\begin_inset Formula \begin{eqnarray*} +\hat{\mu} & = & \frac{1}{N}\sum_{i=1}^{N}x_{i}=\bar{\mathbf{x}}\\ +\hat{\mu}_{2} & = & \frac{1}{N-1}\sum_{i=1}^{N}\left(x_{i}-\hat{\mu}\right)^{2}=\frac{N}{N-1}\overline{\left(\mathbf{x}-\bar{\mathbf{x}}\right)^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Subsection +Standard notation for mean +\end_layout + +\begin_layout Standard +We will use +\begin_inset Formula \[ +\overline{y\left(\mathbf{x}\right)}=\frac{1}{N}\sum_{i=1}^{N}y\left(x_{i}\right)\] + +\end_inset + + where +\begin_inset Formula $N$ +\end_inset + + should be clear from context as the number of samples +\begin_inset Formula $x_{i}$ +\end_inset + + +\end_layout + +\begin_layout Section +Alpha +\end_layout + +\begin_layout Standard +One shape parameters +\begin_inset Formula $\alpha>0$ +\end_inset + + (paramter +\begin_inset Formula $\beta$ +\end_inset + + in DATAPLOT is a scale-parameter). + Standard form is +\begin_inset Formula $x>0:$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha\right) & = & \frac{1}{x^{2}\Phi\left(\alpha\right)\sqrt{2\pi}}\exp\left(-\frac{1}{2}\left(\alpha-\frac{1}{x}\right)^{2}\right)\\ +F\left(x;\alpha\right) & = & \frac{\Phi\left(\alpha-\frac{1}{x}\right)}{\Phi\left(\alpha\right)}\\ +G\left(q;\alpha\right) & = & \left[\alpha-\Phi^{-1}\left(q\Phi\left(\alpha\right)\right)\right]^{-1}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=\frac{1}{\Phi\left(a\right)\sqrt{2\pi}}\int_{0}^{\infty}\frac{e^{xt}}{x^{2}}\exp\left(-\frac{1}{2}\left(\alpha-\frac{1}{x}\right)^{2}\right)dx\] + +\end_inset + + +\end_layout + +\begin_layout Standard +No moments? +\begin_inset Formula \[ +l_{\mathbf{x}}\left(\alpha\right)=N\log\left[\Phi\left(\alpha\right)\sqrt{2\pi}\right]+2N\overline{\log\mathbf{x}}+\frac{N}{2}\alpha^{2}-\alpha\overline{\mathbf{x}^{-1}}+\frac{1}{2}\overline{\mathbf{x}^{-2}}\] + +\end_inset + + +\end_layout + +\begin_layout Section +Anglit +\end_layout + +\begin_layout Standard +Defined over +\begin_inset Formula $x\in\left[-\frac{\pi}{4},\frac{\pi}{4}\right]$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \sin\left(2x+\frac{\pi}{2}\right)=\cos\left(2x\right)\\ +F\left(x\right) & = & \sin^{2}\left(x+\frac{\pi}{4}\right)\\ +G\left(q\right) & = & \arcsin\left(\sqrt{q}\right)-\frac{\pi}{4}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & 0\\ +\mu_{2} & = & \frac{\pi^{2}}{16}-\frac{1}{2}\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & -2\frac{\pi^{4}-96}{\left(\pi^{2}-8\right)^{2}}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & 1-\log2\\ + & \approx & 0.30685281944005469058\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +M\left(t\right) & = & \int_{-\frac{\pi}{4}}^{\frac{\pi}{4}}\cos\left(2x\right)e^{xt}dx\\ + & = & \frac{4\cosh\left(\frac{\pi t}{4}\right)}{t^{2}+4}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +l_{\mathbf{x}}\left(\cdot\right)=-N\overline{\log\left[\cos\left(2\mathbf{x}\right)\right]}\] + +\end_inset + + +\end_layout + +\begin_layout Section +Arcsine +\end_layout + +\begin_layout Standard +Defined over +\begin_inset Formula $x\in\left(0,1\right)$ +\end_inset + +. + To get the JKB definition put +\begin_inset Formula $x=\frac{u+1}{2}.$ +\end_inset + + i.e. + +\begin_inset Formula $L=-1$ +\end_inset + + and +\begin_inset Formula $S=2.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{\pi\sqrt{x\left(1-x\right)}}\\ +F\left(x\right) & = & \frac{2}{\pi}\arcsin\left(\sqrt{x}\right)\\ +G\left(q\right) & = & \sin^{2}\left(\frac{\pi}{2}q\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=E^{t/2}I_{0}\left(\frac{t}{2}\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{n}^{\prime} & = & \frac{1}{\pi}\int_{0}^{1}dx\, x^{n-1/2}\left(1-x\right)^{-1/2}\\ + & = & \frac{1}{\pi}B\left(\frac{1}{2},n+\frac{1}{2}\right)=\frac{\left(2n-1\right)!!}{2^{n}n!}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{1}{2}\\ +\mu_{2} & = & \frac{1}{8}\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & -\frac{3}{2}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]\approx-0.24156447527049044468\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +l_{\mathbf{x}}\left(\cdot\right)=N\log\pi+\frac{N}{2}\overline{\log\mathbf{x}}+\frac{N}{2}\overline{\log\left(1-\mathbf{x}\right)}\] + +\end_inset + + +\end_layout + +\begin_layout Section +Beta +\end_layout + +\begin_layout Standard +Two shape parameters +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +a,b>0\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,b\right) & = & \frac{\Gamma\left(a+b\right)}{\Gamma\left(a\right)\Gamma\left(b\right)}x^{a-1}\left(1-x\right)^{b-1}I_{\left(0,1\right)}\left(x\right)\\ +F\left(x;a,b\right) & = & \int_{0}^{x}f\left(y;a,b\right)dy=I\left(x,a,b\right)\\ +G\left(\alpha;a,b\right) & = & I^{-1}\left(\alpha;a,b\right)\\ +M\left(t\right) & = & \frac{\Gamma\left(a\right)\Gamma\left(b\right)}{\Gamma\left(a+b\right)}\,_{1}F_{1}\left(a;a+b;t\right)\\ +\mu & = & \frac{a}{a+b}\\ +\mu_{2} & = & \frac{ab\left(a+b+1\right)}{\left(a+b\right)^{2}}\\ +\gamma_{1} & = & 2\frac{b-a}{a+b+2}\sqrt{\frac{a+b+1}{ab}}\\ +\gamma_{2} & = & \frac{6\left(a^{3}+a^{2}\left(1-2b\right)+b^{2}\left(b+1\right)-2ab\left(b+2\right)\right)}{ab\left(a+b+2\right)\left(a+b+3\right)}\\ +m_{d} & = & \frac{\left(a-1\right)}{\left(a+b-2\right)}\, a+b\neq2\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula $f\left(x;a,1\right)$ +\end_inset + + is also called the Power-function distribution. +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +l_{\mathbf{x}}\left(a,b\right)=-N\log\Gamma\left(a+b\right)+N\log\Gamma\left(a\right)+N\log\Gamma\left(b\right)-N\left(a-1\right)\overline{\log\mathbf{x}}-N\left(b-1\right)\overline{\log\left(1-\mathbf{x}\right)}\] + +\end_inset + + All of the +\begin_inset Formula $x_{i}\in\left[0,1\right]$ +\end_inset + + +\end_layout + +\begin_layout Section +Beta Prime +\end_layout + +\begin_layout Standard +Defined over +\begin_inset Formula $00.$ +\end_inset + + (Note the CDF evaluation uses Eq. + 3.194.1 on pg. + 313 of Gradshteyn & Ryzhik (sixth edition). + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha,\beta\right) & = & \frac{\Gamma\left(\alpha+\beta\right)}{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}x^{\alpha-1}\left(1+x\right)^{-\alpha-\beta}\\ +F\left(x;\alpha,\beta\right) & = & \frac{\Gamma\left(\alpha+\beta\right)}{\alpha\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}x^{\alpha}\,_{2}F_{1}\left(\alpha+\beta,\alpha;1+\alpha;-x\right)\\ +G\left(q;\alpha,\beta\right) & = & F^{-1}\left(x;\alpha,\beta\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left\{ \begin{array}{ccc} +\frac{\Gamma\left(n+\alpha\right)\Gamma\left(\beta-n\right)}{\Gamma\left(\alpha\right)\Gamma\left(\beta\right)}=\frac{\left(\alpha\right)_{n}}{\left(\beta-n\right)_{n}} & & \beta>n\\ +\infty & & \textrm{otherwise}\end{array}\right.\] + +\end_inset + + Therefore, +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{\alpha}{\beta-1}\quad\beta>1\\ +\mu_{2} & = & \frac{\alpha\left(\alpha+1\right)}{\left(\beta-2\right)\left(\beta-1\right)}-\frac{\alpha^{2}}{\left(\beta-1\right)^{2}}\quad\beta>2\\ +\gamma_{1} & = & \frac{\frac{\alpha\left(\alpha+1\right)\left(\alpha+2\right)}{\left(\beta-3\right)\left(\beta-2\right)\left(\beta-1\right)}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\quad\beta>3\\ +\gamma_{2} & = & \frac{\mu_{4}}{\mu_{2}^{2}}-3\\ +\mu_{4} & = & \frac{\alpha\left(\alpha+1\right)\left(\alpha+2\right)\left(\alpha+3\right)}{\left(\beta-4\right)\left(\beta-3\right)\left(\beta-2\right)\left(\beta-1\right)}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}\quad\beta>4\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Bradford +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +c & > & 0\\ +k & = & \log\left(1+c\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{c}{k\left(1+cx\right)}I_{\left(0,1\right)}\left(x\right)\\ +F\left(x;c\right) & = & \frac{\log\left(1+cx\right)}{k}\\ +G\left(\alpha\; c\right) & = & \frac{\left(1+c\right)^{\alpha}-1}{c}\\ +M\left(t\right) & = & \frac{1}{k}e^{-t/c}\left[\textrm{Ei}\left(t+\frac{t}{c}\right)-\textrm{Ei}\left(\frac{t}{c}\right)\right]\\ +\mu & = & \frac{c-k}{ck}\\ +\mu_{2} & = & \frac{\left(c+2\right)k-2c}{2ck^{2}}\\ +\gamma_{1} & = & \frac{\sqrt{2}\left(12c^{2}-9kc\left(c+2\right)+2k^{2}\left(c\left(c+3\right)+3\right)\right)}{\sqrt{c\left(c\left(k-2\right)+2k\right)}\left(3c\left(k-2\right)+6k\right)}\\ +\gamma_{2} & = & \frac{c^{3}\left(k-3\right)\left(k\left(3k-16\right)+24\right)+12kc^{2}\left(k-4\right)\left(k-3\right)+6ck^{2}\left(3k-14\right)+12k^{3}}{3c\left(c\left(k-2\right)+2k\right)^{2}}\\ +m_{d} & = & 0\\ +m_{n} & = & \sqrt{1+c}-1\end{eqnarray*} + +\end_inset + + where +\begin_inset Formula $\textrm{Ei}\left(\textrm{z}\right)$ +\end_inset + + is the exponential integral function. + Also +\begin_inset Formula \[ +h\left[X\right]=\frac{1}{2}\log\left(1+c\right)-\log\left(\frac{c}{\log\left(1+c\right)}\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +Burr +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +c & > & 0\\ +d & > & 0\\ +k & = & \Gamma\left(d\right)\Gamma\left(1-\frac{2}{c}\right)\Gamma\left(\frac{2}{c}+d\right)-\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+d\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c,d\right) & = & \frac{cd}{x^{c+1}\left(1+x^{-c}\right)^{d+1}}I_{\left(0,\infty\right)}\left(x\right)\\ +F\left(x;c,d\right) & = & \left(1+x^{-c}\right)^{-d}\\ +G\left(\alpha;c,d\right) & = & \left(\alpha^{-1/d}-1\right)^{-1/c}\\ +\mu & = & \frac{\Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+d\right)}{\Gamma\left(d\right)}\\ +\mu_{2} & = & \frac{k}{\Gamma^{2}\left(d\right)}\\ +\gamma_{1} & = & \frac{1}{\sqrt{k^{3}}}\left[2\Gamma^{3}\left(1-\frac{1}{c}\right)\Gamma^{3}\left(\frac{1}{c}+d\right)+\Gamma^{2}\left(d\right)\Gamma\left(1-\frac{3}{c}\right)\Gamma\left(\frac{3}{c}+d\right)\right.\\ + & & \left.-3\Gamma\left(d\right)\Gamma\left(1-\frac{2}{c}\right)\Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+d\right)\Gamma\left(\frac{2}{c}+d\right)\right]\\ +\gamma_{2} & = & -3+\frac{1}{k^{2}}\left[6\Gamma\left(d\right)\Gamma\left(1-\frac{2}{c}\right)\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+d\right)\Gamma\left(\frac{2}{c}+d\right)\right.\\ + & & -3\Gamma^{4}\left(1-\frac{1}{c}\right)\Gamma^{4}\left(\frac{1}{c}+d\right)+\Gamma^{3}\left(d\right)\Gamma\left(1-\frac{4}{c}\right)\Gamma\left(\frac{4}{c}+d\right)\\ + & & \left.-4\Gamma^{2}\left(d\right)\Gamma\left(1-\frac{3}{c}\right)\Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+d\right)\Gamma\left(\frac{3}{c}+d\right)\right]\\ +m_{d} & = & \left(\frac{cd-1}{c+1}\right)^{1/c}\,\textrm{if }cd>1\,\textrm{otherwise }0\\ +m_{n} & = & \left(2^{1/d}-1\right)^{-1/c}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Cauchy +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{\pi\left(1+x^{2}\right)}\\ +F\left(x\right) & = & \frac{1}{2}+\frac{1}{\pi}\tan^{-1}x\\ +G\left(\alpha\right) & = & \tan\left(\pi\alpha-\frac{\pi}{2}\right)\\ +m_{d} & = & 0\\ +m_{n} & = & 0\end{eqnarray*} + +\end_inset + +No finite moments. + This is the t distribution with one degree of freedom. + +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(4\pi\right)\\ + & \approx & 2.5310242469692907930.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Chi +\end_layout + +\begin_layout Standard +Generated by taking the (positive) square-root of chi-squared variates. +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu\right) & = & \frac{x^{\nu-1}e^{-x^{2}/2}}{2^{\nu/2-1}\Gamma\left(\frac{\nu}{2}\right)}I_{\left(0,\infty\right)}\left(x\right)\\ +F\left(x;\nu\right) & = & \Gamma\left(\frac{\nu}{2},\frac{x^{2}}{2}\right)\\ +G\left(\alpha;\nu\right) & = & \sqrt{2\Gamma^{-1}\left(\frac{\nu}{2},\alpha\right)}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\Gamma\left(\frac{v}{2}\right)\,_{1}F_{1}\left(\frac{v}{2};\frac{1}{2};\frac{t^{2}}{2}\right)+\frac{t}{\sqrt{2}}\Gamma\left(\frac{1+\nu}{2}\right)\,_{1}F_{1}\left(\frac{1+\nu}{2};\frac{3}{2};\frac{t^{2}}{2}\right)\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{\sqrt{2}\Gamma\left(\frac{\nu+1}{2}\right)}{\Gamma\left(\frac{\nu}{2}\right)}\\ +\mu_{2} & = & \nu-\mu^{2}\\ +\gamma_{1} & = & \frac{2\mu^{3}+\mu\left(1-2\nu\right)}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{2\nu\left(1-\nu\right)-6\mu^{4}+4\mu^{2}\left(2\nu-1\right)}{\mu_{2}^{2}}\\ +m_{d} & = & \sqrt{\nu-1}\quad\nu\geq1\\ +m_{n} & = & \sqrt{2\Gamma^{-1}\left(\frac{\nu}{2},\frac{1}{2}\right)}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Chi-squared +\end_layout + +\begin_layout Standard +This is the gamma distribution with +\begin_inset Formula $L=0.0$ +\end_inset + + and +\begin_inset Formula $S=2.0$ +\end_inset + + and +\begin_inset Formula $\alpha=\nu/2$ +\end_inset + + where +\begin_inset Formula $\nu$ +\end_inset + + is called the degrees of freedom. + If +\begin_inset Formula $Z_{1}\ldots Z_{\nu}$ +\end_inset + + are all standard normal distributions, then +\begin_inset Formula $W=\sum_{k}Z_{k}^{2}$ +\end_inset + + has (standard) chi-square distribution with +\begin_inset Formula $\nu$ +\end_inset + + degrees of freedom. + +\end_layout + +\begin_layout Standard +The standard form (most often used in standard form only) is +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha\right) & = & \frac{1}{2\Gamma\left(\frac{\nu}{2}\right)}\left(\frac{x}{2}\right)^{\nu/2-1}e^{-x/2}\\ +F\left(x;\alpha\right) & = & \Gamma\left(\frac{\nu}{2},\frac{x}{2}\right)\\ +G\left(q;\alpha\right) & = & 2\Gamma^{-1}\left(\frac{\nu}{2},q\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\frac{\Gamma\left(\frac{\nu}{2}\right)}{\left(\frac{1}{2}-t\right)^{\nu/2}}\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \nu\\ +\mu_{2} & = & 2\nu\\ +\gamma_{1} & = & \frac{2\sqrt{2}}{\sqrt{\nu}}\\ +\gamma_{2} & = & \frac{12}{\nu}\\ +m_{d} & = & \frac{\nu}{2}-1\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Cosine +\end_layout + +\begin_layout Standard +Approximation to the normal distribution. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{2\pi}\left[1+\cos x\right]I_{\left[-\pi,\pi\right]}\left(x\right)\\ +F\left(x\right) & = & \frac{1}{2\pi}\left[\pi+x+\sin x\right]I_{\left[-\pi,\pi\right]}\left(x\right)+I_{\left(\pi,\infty\right)}\left(x\right)\\ +G\left(\alpha\right) & = & F^{-1}\left(\alpha\right)\\ +M\left(t\right) & = & \frac{\sinh\left(\pi t\right)}{\pi t\left(1+t^{2}\right)}\\ +\mu=m_{d}=m_{n} & = & 0\\ +\mu_{2} & = & \frac{\pi^{2}}{3}-2\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & \frac{-6\left(\pi^{4}-90\right)}{5\left(\pi^{2}-6\right)^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(4\pi\right)-1\\ + & \approx & 1.5310242469692907930.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Double Gamma +\end_layout + +\begin_layout Standard +The double gamma is the signed version of the Gamma distribution. + For +\begin_inset Formula $\alpha>0:$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha\right) & = & \frac{1}{2\Gamma\left(\alpha\right)}\left|x\right|^{\alpha-1}e^{-\left|x\right|}\\ +F\left(x;\alpha\right) & = & \left\{ \begin{array}{ccc} +\frac{1}{2}-\frac{1}{2}\Gamma\left(\alpha,\left|x\right|\right) & & x\leq0\\ +\frac{1}{2}+\frac{1}{2}\Gamma\left(\alpha,\left|x\right|\right) & & x>0\end{array}\right.\\ +G\left(q;\alpha\right) & = & \left\{ \begin{array}{ccc} +-\Gamma^{-1}\left(\alpha,\left|2q-1\right|\right) & & q\leq\frac{1}{2}\\ +\Gamma^{-1}\left(\alpha,\left|2q-1\right|\right) & & q>\frac{1}{2}\end{array}\right.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=\frac{1}{2\left(1-t\right)^{a}}+\frac{1}{2\left(1+t\right)^{a}}\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu=m_{n} & = & 0\\ +\mu_{2} & = & \alpha\left(\alpha+1\right)\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & \frac{\left(\alpha+2\right)\left(\alpha+3\right)}{\alpha\left(\alpha+1\right)}-3\\ +m_{d} & = & \textrm{NA}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Doubly Non-central F* +\end_layout + +\begin_layout Section +Doubly Non-central t* +\end_layout + +\begin_layout Section +Double Weibull +\end_layout + +\begin_layout Standard +This is a signed form of the Weibull distribution. +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{c}{2}\left|x\right|^{c-1}\exp\left(-\left|x\right|^{c}\right)\\ +F\left(x;c\right) & = & \left\{ \begin{array}{ccc} +\frac{1}{2}\exp\left(-\left|x\right|^{c}\right) & & x\leq0\\ +1-\frac{1}{2}\exp\left(-\left|x\right|^{c}\right) & & x>0\end{array}\right.\\ +G\left(q;c\right) & = & \left\{ \begin{array}{ccc} +-\log^{1/c}\left(\frac{1}{2q}\right) & & q\leq\frac{1}{2}\\ +\log^{1/c}\left(\frac{1}{2q-1}\right) & & q>\frac{1}{2}\end{array}\right.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\mu_{n}=\begin{cases} +\Gamma\left(1+\frac{n}{c}\right) & n\textrm{ even}\\ +0 & n\textrm{ odd}\end{cases}\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +m_{d}=\mu & = & 0\\ +\mu_{2} & = & \Gamma\left(\frac{c+2}{c}\right)\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & \frac{\Gamma\left(1+\frac{4}{c}\right)}{\Gamma^{2}\left(1+\frac{2}{c}\right)}\\ +m_{d} & = & \textrm{NA bimodal}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Erlang +\end_layout + +\begin_layout Standard +This is just the Gamma distribution with shape parameter +\begin_inset Formula $\alpha=n$ +\end_inset + + an integer. + +\end_layout + +\begin_layout Section +Exponential +\end_layout + +\begin_layout Standard +This is a special case of the Gamma (and Erlang) distributions with shape + parameter +\begin_inset Formula $\left(\alpha=1\right)$ +\end_inset + + and the same location and scale parameters. + The standard form is therefore ( +\begin_inset Formula $x\geq0$ +\end_inset + +) +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & e^{-x}\\ +F\left(x\right) & = & \Gamma\left(1,x\right)=1-e^{-x}\\ +G\left(q\right) & = & -\log\left(1-q\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=n!\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=\frac{1}{1-t}\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & 1\\ +\mu_{2} & = & 1\\ +\gamma_{1} & = & 2\\ +\gamma_{2} & = & 6\\ +m_{d} & = & 0\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=1.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Exponentiated Weibull +\end_layout + +\begin_layout Standard +Two positive shape parameters +\begin_inset Formula $a$ +\end_inset + + and +\begin_inset Formula $c$ +\end_inset + + and +\begin_inset Formula $x\in\left(0,\infty\right)$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,c\right) & = & ac\left[1-\exp\left(-x^{c}\right)\right]^{a-1}\exp\left(-x^{c}\right)x^{c-1}\\ +F\left(x;a,c\right) & = & \left[1-\exp\left(-x^{c}\right)\right]^{a}\\ +G\left(q;a,c\right) & = & \left[-\log\left(1-q^{1/a}\right)\right]^{1/c}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Exponential Power +\end_layout + +\begin_layout Standard +One positive shape parameter +\begin_inset Formula $b$ +\end_inset + +. + Defined for +\begin_inset Formula $x\geq0.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;b\right) & = & ebx^{b-1}\exp\left[x^{b}-e^{x^{b}}\right]\\ +F\left(x;b\right) & = & 1-\exp\left[1-e^{x^{b}}\right]\\ +G\left(q;b\right) & = & \log^{1/b}\left[1-\log\left(1-q\right)\right]\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Fatigue Life (Birnbaum-Sanders) +\end_layout + +\begin_layout Standard +This distribution's pdf is the average of the inverse-Gaussian +\begin_inset Formula $\left(\mu=1\right)$ +\end_inset + + and reciprocal inverse-Gaussian pdf +\begin_inset Formula $\left(\mu=1\right)$ +\end_inset + +. + We follow the notation of JKB here with +\begin_inset Formula $\beta=S.$ +\end_inset + + for +\begin_inset Formula $x>0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{x+1}{2c\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-1\right)^{2}}{2xc^{2}}\right)\\ +F\left(x;c\right) & = & \Phi\left(\frac{1}{c}\left(\sqrt{x}-\frac{1}{\sqrt{x}}\right)\right)\\ +G\left(q;c\right) & = & \frac{1}{4}\left[c\Phi^{-1}\left(q\right)+\sqrt{c^{2}\left(\Phi^{-1}\left(q\right)\right)^{2}+4}\right]^{2}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=c\sqrt{2\pi}\exp\left[\frac{1}{c^{2}}\left(1-\sqrt{1-2c^{2}t}\right)\right]\left(1+\frac{1}{\sqrt{1-2c^{2}t}}\right)\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{c^{2}}{2}+1\\ +\mu_{2} & = & c^{2}\left(\frac{5}{4}c^{2}+1\right)\\ +\gamma_{1} & = & \frac{4c\sqrt{11c^{2}+6}}{\left(5c^{2}+4\right)^{3/2}}\\ +\gamma_{2} & = & \frac{6c^{2}\left(93c^{2}+41\right)}{\left(5c^{2}+4\right)^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Fisk (Log Logistic) +\end_layout + +\begin_layout Standard +Special case of the Burr distribution with +\begin_inset Formula $d=1$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +c & > & 0\\ +k & = & \Gamma\left(1-\frac{2}{c}\right)\Gamma\left(\frac{2}{c}+1\right)-\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+1\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c,d\right) & = & \frac{cx^{c-1}}{\left(1+x^{c}\right)^{2}}I_{\left(0,\infty\right)}\left(x\right)\\ +F\left(x;c,d\right) & = & \left(1+x^{-c}\right)^{-1}\\ +G\left(\alpha;c,d\right) & = & \left(\alpha^{-1}-1\right)^{-1/c}\\ +\mu & = & \Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+1\right)\\ +\mu_{2} & = & k\\ +\gamma_{1} & = & \frac{1}{\sqrt{k^{3}}}\left[2\Gamma^{3}\left(1-\frac{1}{c}\right)\Gamma^{3}\left(\frac{1}{c}+1\right)+\Gamma\left(1-\frac{3}{c}\right)\Gamma\left(\frac{3}{c}+1\right)\right.\\ + & & \left.-3\Gamma\left(1-\frac{2}{c}\right)\Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+1\right)\Gamma\left(\frac{2}{c}+1\right)\right]\\ +\gamma_{2} & = & -3+\frac{1}{k^{2}}\left[6\Gamma\left(1-\frac{2}{c}\right)\Gamma^{2}\left(1-\frac{1}{c}\right)\Gamma^{2}\left(\frac{1}{c}+1\right)\Gamma\left(\frac{2}{c}+1\right)\right.\\ + & & -3\Gamma^{4}\left(1-\frac{1}{c}\right)\Gamma^{4}\left(\frac{1}{c}+1\right)+\Gamma\left(1-\frac{4}{c}\right)\Gamma\left(\frac{4}{c}+1\right)\\ + & & \left.-4\Gamma\left(1-\frac{3}{c}\right)\Gamma\left(1-\frac{1}{c}\right)\Gamma\left(\frac{1}{c}+1\right)\Gamma\left(\frac{3}{c}+1\right)\right]\\ +m_{d} & = & \left(\frac{c-1}{c+1}\right)^{1/c}\,\textrm{if }c>1\,\textrm{otherwise }0\\ +m_{n} & = & 1\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=2-\log c.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Folded Cauchy +\end_layout + +\begin_layout Standard +This formula can be expressed in terms of the standard formulas for the + Cauchy distribution (call the cdf +\begin_inset Formula $C\left(x\right)$ +\end_inset + + and the pdf +\begin_inset Formula $d\left(x\right)$ +\end_inset + +). + if +\begin_inset Formula $Y$ +\end_inset + + is cauchy then +\begin_inset Formula $\left|Y\right|$ +\end_inset + + is folded cauchy. + Note that +\begin_inset Formula $x\geq0.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{1}{\pi\left(1+\left(x-c\right)^{2}\right)}+\frac{1}{\pi\left(1+\left(x+c\right)^{2}\right)}\\ +F\left(x;c\right) & = & \frac{1}{\pi}\tan^{-1}\left(x-c\right)+\frac{1}{\pi}\tan^{-1}\left(x+c\right)\\ +G\left(q;c\right) & = & F^{-1}\left(x;c\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +No moments +\end_layout + +\begin_layout Section +Folded Normal +\end_layout + +\begin_layout Standard +If +\begin_inset Formula $Z$ +\end_inset + + is Normal with mean +\begin_inset Formula $L$ +\end_inset + + and +\begin_inset Formula $\sigma=S$ +\end_inset + +, then +\begin_inset Formula $\left|Z\right|$ +\end_inset + + is a folded normal with shape parameter +\begin_inset Formula $c=\left|L\right|/S$ +\end_inset + +, location parameter +\begin_inset Formula $0$ +\end_inset + + and scale parameter +\begin_inset Formula $S$ +\end_inset + +. + This is a special case of the non-central chi distribution with one-degree + of freedom and non-centrality parameter +\begin_inset Formula $c^{2}.$ +\end_inset + + Note that +\begin_inset Formula $c\geq0$ +\end_inset + +. + The standard form of the folded normal is +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \sqrt{\frac{2}{\pi}}\cosh\left(cx\right)\exp\left(-\frac{x^{2}+c^{2}}{2}\right)\\ +F\left(x;c\right) & = & \Phi\left(x-c\right)-\Phi\left(-x-c\right)=\Phi\left(x-c\right)+\Phi\left(x+c\right)-1\\ +G\left(\alpha;c\right) & = & F^{-1}\left(x;c\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\exp\left[\frac{t}{2}\left(t-2c\right)\right]\left(1+e^{2ct}\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +k & = & \textrm{erf}\left(\frac{c}{\sqrt{2}}\right)\\ +p & = & \exp\left(-\frac{c^{2}}{2}\right)\\ +\mu & = & \sqrt{\frac{2}{\pi}}p+ck\\ +\mu_{2} & = & c^{2}+1-\mu^{2}\\ +\gamma_{1} & = & \frac{\sqrt{\frac{2}{\pi}}p^{3}\left(4-\frac{\pi}{p^{2}}\left(2c^{2}+1\right)\right)+2ck\left(6p^{2}+3cpk\sqrt{2\pi}+\pi c\left(k^{2}-1\right)\right)}{\pi\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{c^{4}+6c^{2}+3+6\left(c^{2}+1\right)\mu^{2}-3\mu^{4}-4p\mu\left(\sqrt{\frac{2}{\pi}}\left(c^{2}+2\right)+\frac{ck}{p}\left(c^{2}+3\right)\right)}{\mu_{2}^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Fratio (or F) +\end_layout + +\begin_layout Standard +Defined for +\begin_inset Formula $x>0$ +\end_inset + +. + The distribution of +\begin_inset Formula $\left(X_{1}/X_{2}\right)\left(\nu_{2}/\nu_{1}\right)$ +\end_inset + + if +\begin_inset Formula $X_{1}$ +\end_inset + + is chi-squared with +\begin_inset Formula $v_{1}$ +\end_inset + + degrees of freedom and +\begin_inset Formula $X_{2}$ +\end_inset + + is chi-squared with +\begin_inset Formula $v_{2}$ +\end_inset + + degrees of freedom. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu_{1},\nu_{2}\right) & = & \frac{\nu_{2}^{\nu_{2}/2}\nu_{1}^{\nu_{1}/2}x^{\nu_{1}/2-1}}{\left(\nu_{2}+\nu_{1}x\right)^{\left(\nu_{1}+\nu_{2}\right)/2}B\left(\frac{\nu_{1}}{2},\frac{\nu_{2}}{2}\right)}\\ +F\left(x;v_{1},v_{2}\right) & = & I\left(\frac{\nu_{1}}{2},\frac{\nu_{2}}{2},\frac{\nu_{2}x}{\nu_{2}+\nu_{1}x}\right)\\ +G\left(q;\nu_{1},\nu_{2}\right) & = & \left[\frac{\nu_{2}}{I^{-1}\left(\nu_{1}/2,\nu_{2}/2,q\right)}-\frac{\nu_{1}}{\nu_{2}}\right]^{-1}.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{\nu_{2}}{\nu_{2}-2}\quad\nu_{2}>2\\ +\mu_{2} & = & \frac{2\nu_{2}^{2}\left(\nu_{1}+\nu_{2}-2\right)}{\nu_{1}\left(\nu_{2}-2\right)^{2}\left(\nu_{2}-4\right)}\quad v_{2}>4\\ +\gamma_{1} & = & \frac{2\left(2\nu_{1}+\nu_{2}-2\right)}{\nu_{2}-6}\sqrt{\frac{2\left(\nu_{2}-4\right)}{\nu_{1}\left(\nu_{1}+\nu_{2}-2\right)}}\quad\nu_{2}>6\\ +\gamma_{2} & = & \frac{3\left[8+\left(\nu_{2}-6\right)\gamma_{1}^{2}\right]}{2\nu-16}\quad\nu_{2}>8\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Fr?chet (ExtremeLB, Extreme Value II, Weibull minimum) +\end_layout + +\begin_layout Standard +A type of extreme-value distribution with a lower bound. + Defined for +\begin_inset Formula $x>0$ +\end_inset + + and +\begin_inset Formula $c>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & cx^{c-1}\exp\left(-x^{c}\right)\\ +F\left(x;c\right) & = & 1-\exp\left(-x^{c}\right)\\ +G\left(q;c\right) & = & \left[-\log\left(1-q\right)\right]^{1/c}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\Gamma\left(1+\frac{n}{c}\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \Gamma\left(1+\frac{1}{c}\right)\\ +\mu_{2} & = & \Gamma\left(1+\frac{2}{c}\right)-\Gamma^{2}\left(1-\frac{1}{c}\right)\\ +\gamma_{1} & = & \frac{\Gamma\left(1+\frac{3}{c}\right)-3\Gamma\left(1+\frac{2}{c}\right)\Gamma\left(1+\frac{1}{c}\right)+2\Gamma^{3}\left(1+\frac{1}{c}\right)}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\Gamma\left(1+\frac{4}{c}\right)-4\Gamma\left(1+\frac{1}{c}\right)\Gamma\left(1+\frac{3}{c}\right)+6\Gamma^{2}\left(1+\frac{1}{c}\right)\Gamma\left(1+\frac{2}{c}\right)-\Gamma^{4}\left(1+\frac{1}{c}\right)}{\mu_{2}^{2}}-3\\ +m_{d} & = & \left(\frac{c}{1+c}\right)^{1/c}\\ +m_{n} & = & G\left(\frac{1}{2};c\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=-\frac{\gamma}{c}-\log\left(c\right)+\gamma+1\] + +\end_inset + + where +\begin_inset Formula $\gamma$ +\end_inset + + is Euler's constant and equal to +\begin_inset Formula \[ +\gamma\approx0.57721566490153286061.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Fr?chet (left-skewed, Extreme Value Type III, Weibull maximum) +\end_layout + +\begin_layout Standard +Defined for +\begin_inset Formula $x<0$ +\end_inset + + and +\begin_inset Formula $c>0$ +\end_inset + +. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & c\left(-x\right)^{c-1}\exp\left(-\left(-x\right)^{c}\right)\\ +F\left(x;c\right) & = & \exp\left(-\left(-x\right)^{c}\right)\\ +G\left(q;c\right) & = & -\left(-\log q\right)^{1/c}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +The mean is the negative of the right-skewed Frechet distribution given + above, and the other statistical parameters can be computed from +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left(-1\right)^{n}\Gamma\left(1+\frac{n}{c}\right).\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=-\frac{\gamma}{c}-\log\left(c\right)+\gamma+1\] + +\end_inset + + where +\begin_inset Formula $\gamma$ +\end_inset + + is Euler's constant and equal to +\begin_inset Formula \[ +\gamma\approx0.57721566490153286061.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Gamma +\end_layout + +\begin_layout Standard +The standard form for the gamma distribution is +\begin_inset Formula $\left(\alpha>0\right)$ +\end_inset + + valid for +\begin_inset Formula $x\geq0$ +\end_inset + +. +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha\right) & = & \frac{1}{\Gamma\left(\alpha\right)}x^{\alpha-1}e^{-x}\\ +F\left(x;\alpha\right) & = & \Gamma\left(\alpha,x\right)\\ +G\left(q;\alpha\right) & = & \Gamma^{-1}\left(\alpha,q\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\frac{1}{\left(1-t\right)^{\alpha}}\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \alpha\\ +\mu_{2} & = & \alpha\\ +\gamma_{1} & = & \frac{2}{\sqrt{\alpha}}\\ +\gamma_{2} & = & \frac{6}{\alpha}\\ +m_{d} & = & \alpha-1\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=\Psi\left(a\right)\left[1-a\right]+a+\log\Gamma\left(a\right)\] + +\end_inset + + where +\begin_inset Formula \[ +\Psi\left(a\right)=\frac{\Gamma^{\prime}\left(a\right)}{\Gamma\left(a\right)}.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Logistic +\end_layout + +\begin_layout Standard +Has been used in the analysis of extreme values. + Has one shape parameter +\begin_inset Formula $c>0.$ +\end_inset + + And +\begin_inset Formula $x>0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{c\exp\left(-x\right)}{\left[1+\exp\left(-x\right)\right]^{c+1}}\\ +F\left(x;c\right) & = & \frac{1}{\left[1+\exp\left(-x\right)\right]^{c}}\\ +G\left(q;c\right) & = & -\log\left(q^{-1/c}-1\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=\frac{c}{1-t}\,_{2}F_{1}\left(1+c,\,1-t\,;\,2-t\,;-1\right)\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \gamma+\psi_{0}\left(c\right)\\ +\mu_{2} & = & \frac{\pi^{2}}{6}+\psi_{1}\left(c\right)\\ +\gamma_{1} & = & \frac{\psi_{2}\left(c\right)+2\zeta\left(3\right)}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\left(\frac{\pi^{4}}{15}+\psi_{3}\left(c\right)\right)}{\mu_{2}^{2}}\\ +m_{d} & = & \log c\\ +m_{n} & = & -\log\left(2^{1/c}-1\right)\end{eqnarray*} + +\end_inset + + Note that the polygamma function is +\begin_inset Formula \begin{eqnarray*} +\psi_{n}\left(z\right) & = & \frac{d^{n+1}}{dz^{n+1}}\log\Gamma\left(z\right)\\ + & = & \left(-1\right)^{n+1}n!\sum_{k=0}^{\infty}\frac{1}{\left(z+k\right)^{n+1}}\\ + & = & \left(-1\right)^{n+1}n!\zeta\left(n+1,z\right)\end{eqnarray*} + +\end_inset + + where +\begin_inset Formula $\zeta\left(k,x\right)$ +\end_inset + + is a generalization of the Riemann zeta function called the Hurwitz zeta + function Note that +\begin_inset Formula $\zeta\left(n\right)\equiv\zeta\left(n,1\right)$ +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Pareto +\end_layout + +\begin_layout Standard +Shape parameter +\begin_inset Formula $c\neq0$ +\end_inset + + and defined for +\begin_inset Formula $x\geq0$ +\end_inset + + for all +\begin_inset Formula $c$ +\end_inset + + and +\begin_inset Formula $x<\frac{1}{\left|c\right|}$ +\end_inset + + if +\begin_inset Formula $c$ +\end_inset + + is negative. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \left(1+cx\right)^{-1-\frac{1}{c}}\\ +F\left(x;c\right) & = & 1-\frac{1}{\left(1+cx\right)^{1/c}}\\ +G\left(q;c\right) & = & \frac{1}{c}\left[\left(\frac{1}{1-q}\right)^{c}-1\right]\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=\left\{ \begin{array}{cc} +\left(-\frac{t}{c}\right)^{\frac{1}{c}}e^{-\frac{t}{c}}\left[\Gamma\left(1-\frac{1}{c}\right)+\Gamma\left(-\frac{1}{c},-\frac{t}{c}\right)-\pi\csc\left(\frac{\pi}{c}\right)/\Gamma\left(\frac{1}{c}\right)\right] & c>0\\ +\left(\frac{\left|c\right|}{t}\right)^{1/\left|c\right|}\Gamma\left[\frac{1}{\left|c\right|},\frac{t}{\left|c\right|}\right] & c<0\end{array}\right.\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=\frac{\left(-1\right)^{n}}{c^{n}}\sum_{k=0}^{n}\left(\begin{array}{c} +n\\ +k\end{array}\right)\frac{\left(-1\right)^{k}}{1-ck}\quad cn<1\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{1}^{\prime} & = & \frac{1}{1-c}\quad c<1\\ +\mu_{2}^{\prime} & = & \frac{2}{\left(1-2c\right)\left(1-c\right)}\quad c<\frac{1}{2}\\ +\mu_{3}^{\prime} & = & \frac{6}{\left(1-c\right)\left(1-2c\right)\left(1-3c\right)}\quad c<\frac{1}{3}\\ +\mu_{4}^{\prime} & = & \frac{24}{\left(1-c\right)\left(1-2c\right)\left(1-3c\right)\left(1-4c\right)}\quad c<\frac{1}{4}\end{eqnarray*} + +\end_inset + + Thus, +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu_{1}^{\prime}\\ +\mu_{2} & = & \mu_{2}^{\prime}-\mu^{2}\\ +\gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=1+c\quad c>0\] + +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Exponential +\end_layout + +\begin_layout Standard +Three positive shape parameters for +\begin_inset Formula $x\geq0.$ +\end_inset + + Note that +\begin_inset Formula $a,b,$ +\end_inset + + and +\begin_inset Formula $c$ +\end_inset + + are all +\begin_inset Formula $>0.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,b,c\right) & = & \left(a+b\left(1-e^{-cx}\right)\right)\exp\left[ax-bx+\frac{b}{c}\left(1-e^{-cx}\right)\right]\\ +F\left(x;a,b,c\right) & = & 1-\exp\left[ax-bx+\frac{b}{c}\left(1-e^{-cx}\right)\right]\\ +G\left(q;a,b,c\right) & = & F^{-1}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Extreme Value +\end_layout + +\begin_layout Standard +Extreme value distributions with shape parameter +\begin_inset Formula $c$ +\end_inset + +. + +\end_layout + +\begin_layout Standard +For +\begin_inset Formula $c>0$ +\end_inset + + defined on +\begin_inset Formula $-\infty-1\] + +\end_inset + + So, +\begin_inset Formula \begin{eqnarray*} +\mu_{1}^{\prime} & = & \frac{1}{c}\left(1-\Gamma\left(1+c\right)\right)\quad c>-1\\ +\mu_{2}^{\prime} & = & \frac{1}{c^{2}}\left(1-2\Gamma\left(1+c\right)+\Gamma\left(1+2c\right)\right)\quad c>-\frac{1}{2}\\ +\mu_{3}^{\prime} & = & \frac{1}{c^{3}}\left(1-3\Gamma\left(1+c\right)+3\Gamma\left(1+2c\right)-\Gamma\left(1+3c\right)\right)\quad c>-\frac{1}{3}\\ +\mu_{4}^{\prime} & = & \frac{1}{c^{4}}\left(1-4\Gamma\left(1+c\right)+6\Gamma\left(1+2c\right)-4\Gamma\left(1+3c\right)+\Gamma\left(1+4c\right)\right)\quad c>-\frac{1}{4}\end{eqnarray*} + +\end_inset + + For +\begin_inset Formula $c<0$ +\end_inset + + defined on +\begin_inset Formula $\frac{1}{c}\leq x<\infty.$ +\end_inset + + For +\begin_inset Formula $c=0$ +\end_inset + + defined over all space +\begin_inset Formula \begin{eqnarray*} +f\left(x;0\right) & = & \exp\left[-e^{-x}\right]e^{-x}\\ +F\left(x;0\right) & = & \exp\left[-e^{-x}\right]\\ +G\left(q;0\right) & = & -\log\left(-\log q\right)\end{eqnarray*} + +\end_inset + + This is just the (left-skewed) Gumbel distribution for c=0. + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \gamma=-\psi_{0}\left(1\right)\\ +\mu_{2} & = & \frac{\pi^{2}}{6}\\ +\gamma_{1} & = & \frac{12\sqrt{6}}{\pi^{3}}\zeta\left(3\right)\\ +\gamma_{2} & = & \frac{12}{5}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Gamma +\end_layout + +\begin_layout Standard +A general probability form that reduces to many common distributions: +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula $a>0$ +\end_inset + + and +\begin_inset Formula $c\neq0.$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,c\right) & = & \frac{\left|c\right|x^{ca-1}}{\Gamma\left(a\right)}\exp\left(-x^{c}\right)\\ +F\left(x;a,c\right) & = & \begin{array}{cc} +\frac{\Gamma\left(a,x^{c}\right)}{\Gamma\left(a\right)} & c>0\\ +1-\frac{\Gamma\left(a,x^{c}\right)}{\Gamma\left(a\right)} & c<0\end{array}\\ +G\left(q;a,c\right) & = & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)q\right]\right\} ^{1/c}\quad c>0\\ + & & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)\left(1-q\right)\right]\right\} ^{1/c}\quad c<0\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\frac{\Gamma\left(a+\frac{n}{c}\right)}{\Gamma\left(a\right)}\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{\Gamma\left(a+\frac{1}{c}\right)}{\Gamma\left(a\right)}\\ +\mu_{2} & = & \frac{\Gamma\left(a+\frac{2}{c}\right)}{\Gamma\left(a\right)}-\mu^{2}\\ +\gamma_{1} & = & \frac{\Gamma\left(a+\frac{3}{c}\right)/\Gamma\left(a\right)-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\Gamma\left(a+\frac{4}{c}\right)/\Gamma\left(a\right)-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\\ +m_{d} & = & \left(\frac{ac-1}{c}\right)^{1/c}.\end{eqnarray*} + +\end_inset + + Special cases are Weibull +\begin_inset Formula $\left(a=1\right)$ +\end_inset + +, half-normal +\begin_inset Formula $\left(a=1/2,c=2\right)$ +\end_inset + + and ordinary gamma distributions +\begin_inset Formula $c=1.$ +\end_inset + + If +\begin_inset Formula $c=-1$ +\end_inset + + then it is the inverted gamma distribution. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=a-a\Psi\left(a\right)+\frac{1}{c}\Psi\left(a\right)+\log\Gamma\left(a\right)-\log\left|c\right|.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Generalized Half-Logistic +\end_layout + +\begin_layout Standard +For +\begin_inset Formula $x\in\left[0,1/c\right]$ +\end_inset + + and +\begin_inset Formula $c>0$ +\end_inset + + we have +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{2\left(1-cx\right)^{\frac{1}{c}-1}}{\left(1+\left(1-cx\right)^{1/c}\right)^{2}}\\ +F\left(x;c\right) & = & \frac{1-\left(1-cx\right)^{1/c}}{1+\left(1-cx\right)^{1/c}}\\ +G\left(q;c\right) & = & \frac{1}{c}\left[1-\left(\frac{1-q}{1+q}\right)^{c}\right]\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & 2-\left(2c+1\right)\log2.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Gilbrat +\end_layout + +\begin_layout Standard +Special case of the log-normal with +\begin_inset Formula $\sigma=1$ +\end_inset + + and +\begin_inset Formula $S=1.0$ +\end_inset + + (typically also +\begin_inset Formula $L=0.0$ +\end_inset + +) +\begin_inset Formula \begin{eqnarray*} +f\left(x;\sigma\right) & = & \frac{1}{x\sqrt{2\pi}}\exp\left[-\frac{1}{2}\left(\log x\right)^{2}\right]\\ +F\left(x;\sigma\right) & = & \Phi\left(\log x\right)=\frac{1}{2}\left[1+\textrm{erf}\left(\frac{\log x}{\sqrt{2}}\right)\right]\\ +G\left(q;\sigma\right) & = & \exp\left\{ \Phi^{-1}\left(q\right)\right\} \end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \sqrt{e}\\ +\mu_{2} & = & e\left[e-1\right]\\ +\gamma_{1} & = & \sqrt{e-1}\left(2+e\right)\\ +\gamma_{2} & = & e^{4}+2e^{3}+3e^{2}-6\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(\sqrt{2\pi e}\right)\\ + & \approx & 1.4189385332046727418\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Gompertz (Truncated Gumbel) +\end_layout + +\begin_layout Standard +For +\begin_inset Formula $x\geq0$ +\end_inset + + and +\begin_inset Formula $c>0$ +\end_inset + +. + In JKB the two shape parameters +\begin_inset Formula $b,a$ +\end_inset + + are reduced to the single shape-parameter +\begin_inset Formula $c=b/a$ +\end_inset + +. + As +\begin_inset Formula $a$ +\end_inset + + is just a scale parameter when +\begin_inset Formula $a\neq0$ +\end_inset + +. + If +\begin_inset Formula $a=0,$ +\end_inset + + the distribution reduces to the exponential distribution scaled by +\begin_inset Formula $1/b.$ +\end_inset + + Thus, the standard form is given as +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & ce^{x}\exp\left[-c\left(e^{x}-1\right)\right]\\ +F\left(x;c\right) & = & 1-\exp\left[-c\left(e^{x}-1\right)\right]\\ +G\left(q;c\right) & = & \log\left[1-\frac{1}{c}\log\left(1-q\right)\right]\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=1-\log\left(c\right)-e^{c}\textrm{Ei}\left(1,c\right),\] + +\end_inset + +where +\begin_inset Formula \[ +\textrm{Ei}\left(n,x\right)=\int_{1}^{\infty}t^{-n}\exp\left(-xt\right)dt\] + +\end_inset + + +\end_layout + +\begin_layout Section +Gumbel (LogWeibull, Fisher-Tippetts, Type I Extreme Value) +\end_layout + +\begin_layout Standard +One of a clase of extreme value distributions (right-skewed). +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \exp\left(-\left(x+e^{-x}\right)\right)\\ +F\left(x\right) & = & \exp\left(-e^{-x}\right)\\ +G\left(q\right) & = & -\log\left(-\log\left(q\right)\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\Gamma\left(1-t\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \gamma=-\psi_{0}\left(1\right)\\ +\mu_{2} & = & \frac{\pi^{2}}{6}\\ +\gamma_{1} & = & \frac{12\sqrt{6}}{\pi^{3}}\zeta\left(3\right)\\ +\gamma_{2} & = & \frac{12}{5}\\ +m_{d} & = & 0\\ +m_{n} & = & -\log\left(\log2\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]\approx1.0608407169541684911\] + +\end_inset + + +\end_layout + +\begin_layout Section +Gumbel Left-skewed (for minimum order statistic) +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \exp\left(x-e^{x}\right)\\ +F\left(x\right) & = & 1-\exp\left(-e^{x}\right)\\ +G\left(q\right) & = & \log\left(-\log\left(1-q\right)\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\Gamma\left(1+t\right)\] + +\end_inset + + Note, that +\begin_inset Formula $\mu$ +\end_inset + + is negative the mean for the right-skewed distribution. + Similar for median and mode. + All other moments are the same. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]\approx1.0608407169541684911.\] + +\end_inset + + +\end_layout + +\begin_layout Section +HalfCauchy +\end_layout + +\begin_layout Standard +If +\begin_inset Formula $Z$ +\end_inset + + is Hyperbolic Secant distributed then +\begin_inset Formula $e^{Z}$ +\end_inset + + is Half-Cauchy distributed. + Also, if +\begin_inset Formula $W$ +\end_inset + + is (standard) Cauchy distributed, then +\begin_inset Formula $\left|W\right|$ +\end_inset + + is Half-Cauchy distributed. + Special case of the Folded Cauchy distribution with +\begin_inset Formula $c=0.$ +\end_inset + + The standard form is +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{2}{\pi\left(1+x^{2}\right)}I_{[0,\infty)}\left(x\right)\\ +F\left(x\right) & = & \frac{2}{\pi}\arctan\left(x\right)I_{\left[0,\infty\right]}\left(x\right)\\ +G\left(q\right) & = & \tan\left(\frac{\pi}{2}q\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\cos t+\frac{2}{\pi}\left[\textrm{Si}\left(t\right)\cos t-\textrm{Ci}\left(\textrm{-}t\right)\sin t\right]\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +m_{d} & = & 0\\ +m_{n} & = & \tan\left(\frac{\pi}{4}\right)\end{eqnarray*} + +\end_inset + + No moments, as the integrals diverge. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(2\pi\right)\\ + & \approx & 1.8378770664093454836.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +HalfNormal +\end_layout + +\begin_layout Standard +This is a special case of the chi distribution with +\begin_inset Formula $L=a$ +\end_inset + + and +\begin_inset Formula $S=b$ +\end_inset + + and +\begin_inset Formula $\nu=1.$ +\end_inset + + This is also a special case of the folded normal with shape parameter +\begin_inset Formula $c=0$ +\end_inset + + and +\begin_inset Formula $S=S.$ +\end_inset + + If +\begin_inset Formula $Z$ +\end_inset + + is (standard) normally distributed then, +\begin_inset Formula $\left|Z\right|$ +\end_inset + + is half-normal. + The standard form is +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \sqrt{\frac{2}{\pi}}e^{-x^{2}/2}I_{\left(0,\infty\right)}\left(x\right)\\ +F\left(x\right) & = & 2\Phi\left(x\right)-1\\ +G\left(q\right) & = & \Phi^{-1}\left(\frac{1+q}{2}\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\sqrt{2\pi}e^{t^{2}/2}\Phi\left(t\right)\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \sqrt{\frac{2}{\pi}}\\ +\mu_{2} & = & 1-\frac{2}{\pi}\\ +\gamma_{1} & = & \frac{\sqrt{2}\left(4-\pi\right)}{\left(\pi-2\right)^{3/2}}\\ +\gamma_{2} & = & \frac{8\left(\pi-3\right)}{\left(\pi-2\right)^{2}}\\ +m_{d} & = & 0\\ +m_{n} & = & \Phi^{-1}\left(\frac{3}{4}\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(\sqrt{\frac{\pi e}{2}}\right)\\ + & \approx & 0.72579135264472743239.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Half-Logistic +\end_layout + +\begin_layout Standard +In the limit as +\begin_inset Formula $c\rightarrow\infty$ +\end_inset + + for the generalized half-logistic we have the half-logistic defined over + +\begin_inset Formula $x\geq0.$ +\end_inset + + Also, the distribution of +\begin_inset Formula $\left|X\right|$ +\end_inset + + where +\begin_inset Formula $X$ +\end_inset + + has logistic distribtution. + +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{2e^{-x}}{\left(1+e^{-x}\right)^{2}}=\frac{1}{2}\textrm{sech}^{2}\left(\frac{x}{2}\right)\\ +F\left(x\right) & = & \frac{1-e^{-x}}{1+e^{-x}}=\tanh\left(\frac{x}{2}\right)\\ +G\left(q\right) & = & \log\left(\frac{1+q}{1-q}\right)=2\textrm{arctanh}\left(q\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +M\left(t\right)=1-t\psi_{0}\left(\frac{1}{2}-\frac{t}{2}\right)+t\psi_{0}\left(1-\frac{t}{2}\right)\] + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=2\left(1-2^{1-n}\right)n!\zeta\left(n\right)\quad n\neq1\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{1}^{\prime} & = & 2\log\left(2\right)\\ +\mu_{2}^{\prime} & = & 2\zeta\left(2\right)=\frac{\pi^{2}}{3}\\ +\mu_{3}^{\prime} & = & 9\zeta\left(3\right)\\ +\mu_{4}^{\prime} & = & 42\zeta\left(4\right)=\frac{7\pi^{4}}{15}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & 2-\log\left(2\right)\\ + & \approx & 1.3068528194400546906.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Hyperbolic Secant +\end_layout + +\begin_layout Standard +Related to the logistic distribution and used in lifetime analysis. + Standard form is (defined over all +\begin_inset Formula $x$ +\end_inset + +) +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{\pi}\textrm{sech}\left(x\right)\\ +F\left(x\right) & = & \frac{2}{\pi}\arctan\left(e^{x}\right)\\ +G\left(q\right) & = & \log\left(\tan\left(\frac{\pi}{2}q\right)\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\sec\left(\frac{\pi}{2}t\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{n}^{\prime} & = & \frac{1+\left(-1\right)^{n}}{2\pi2^{2n}}n!\left[\zeta\left(n+1,\frac{1}{4}\right)-\zeta\left(n+1,\frac{3}{4}\right)\right]\\ + & = & \left\{ \begin{array}{cc} +0 & n\textrm{ odd}\\ +C_{n/2}\frac{\pi^{n}}{2^{n}} & n\textrm{ even}\end{array}\right.\end{eqnarray*} + +\end_inset + + where +\begin_inset Formula $C_{m}$ +\end_inset + + is an integer given by +\begin_inset Formula \begin{eqnarray*} +C_{m} & = & \frac{\left(2m\right)!\left[\zeta\left(2m+1,\frac{1}{4}\right)-\zeta\left(2m+1,\frac{3}{4}\right)\right]}{\pi^{2m+1}2^{2m}}\\ + & = & 4\left(-1\right)^{m-1}\frac{16^{m}}{2m+1}B_{2m+1}\left(\frac{1}{4}\right)\end{eqnarray*} + +\end_inset + +where +\begin_inset Formula $B_{2m+1}\left(\frac{1}{4}\right)$ +\end_inset + + is the Bernoulli polynomial of order +\begin_inset Formula $2m+1$ +\end_inset + + evaluated at +\begin_inset Formula $1/4.$ +\end_inset + + Thus +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left\{ \begin{array}{cc} +0 & n\textrm{ odd}\\ +4\left(-1\right)^{n/2-1}\frac{\left(2\pi\right)^{n}}{n+1}B_{n+1}\left(\frac{1}{4}\right) & n\textrm{ even}\end{array}\right.\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +m_{d}=m_{n}=\mu & = & 0\\ +\mu_{2} & = & \frac{\pi^{2}}{4}\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & 2\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=\log\left(2\pi\right).\] + +\end_inset + + +\end_layout + +\begin_layout Section +Gauss Hypergeometric +\end_layout + +\begin_layout Standard +\begin_inset Formula $x\in\left[0,1\right]$ +\end_inset + +, +\begin_inset Formula $\alpha>0,\,\beta>0$ +\end_inset + + +\begin_inset Formula \[ +C^{-1}=B\left(\alpha,\beta\right)\,_{2}F_{1}\left(\gamma,\alpha;\alpha+\beta;-z\right)\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\alpha,\beta,\gamma,z\right) & = & Cx^{\alpha-1}\frac{\left(1-x\right)^{\beta-1}}{\left(1+zx\right)^{\gamma}}\\ +\mu_{n}^{\prime} & = & \frac{B\left(n+\alpha,\beta\right)}{B\left(\alpha,\beta\right)}\frac{\,_{2}F_{1}\left(\gamma,\alpha+n;\alpha+\beta+n;-z\right)}{\,_{2}F_{1}\left(\gamma,\alpha;\alpha+\beta;-z\right)}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Inverted Gamma +\end_layout + +\begin_layout Standard +Special case of the generalized Gamma distribution with +\begin_inset Formula $c=-1$ +\end_inset + + and +\begin_inset Formula $a>0$ +\end_inset + +, +\begin_inset Formula $x>0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;a\right) & = & \frac{x^{-a-1}}{\Gamma\left(a\right)}\exp\left(-\frac{1}{x}\right)\\ +F\left(x;a\right) & = & \frac{\Gamma\left(a,\frac{1}{x}\right)}{\Gamma\left(a\right)}\\ +G\left(q;a\right) & = & \left\{ \Gamma^{-1}\left[a,\Gamma\left(a\right)q\right]\right\} ^{-1}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\frac{\Gamma\left(a-n\right)}{\Gamma\left(a\right)}\quad a>n\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{1}{a-1}\quad a>1\\ +\mu_{2} & = & \frac{1}{\left(a-2\right)\left(a-1\right)}-\mu^{2}\quad a>2\\ +\gamma_{1} & = & \frac{\frac{1}{\left(a-3\right)\left(a-2\right)\left(a-1\right)}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\frac{1}{\left(a-4\right)\left(a-3\right)\left(a-2\right)\left(a-1\right)}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +m_{d}=\frac{1}{a+1}\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=a-\left(a+1\right)\Psi\left(a\right)+\log\Gamma\left(a\right).\] + +\end_inset + + +\end_layout + +\begin_layout Section +Inverse Normal (Inverse Gaussian) +\end_layout + +\begin_layout Standard +The standard form involves the shape parameter +\begin_inset Formula $\mu$ +\end_inset + + (in most definitions, +\begin_inset Formula $L=0.0$ +\end_inset + + is used). + (In terms of the regress documentation +\begin_inset Formula $\mu=A/B$ +\end_inset + +) and +\begin_inset Formula $B=S$ +\end_inset + + and +\begin_inset Formula $L$ +\end_inset + + is not a parameter in that distribution. + A standard form is +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\mu\right) & = & \frac{1}{\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-\mu\right)^{2}}{2x\mu^{2}}\right).\\ +F\left(x;\mu\right) & = & \Phi\left(\frac{1}{\sqrt{x}}\frac{x-\mu}{\mu}\right)+\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{x+\mu}{\mu}\right)\\ +G\left(q;\mu\right) & = & F^{-1}\left(q;\mu\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu\\ +\mu_{2} & = & \mu^{3}\\ +\gamma_{1} & = & 3\sqrt{\mu}\\ +\gamma_{2} & = & 15\mu\\ +m_{d} & = & \frac{\mu}{2}\left(\sqrt{9\mu^{2}+4}-3\mu\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +This is related to the canonical form or JKB +\begin_inset Quotes eld +\end_inset + +two-parameter +\begin_inset Quotes erd +\end_inset + + inverse Gaussian when written in it's full form with scale parameter +\begin_inset Formula $S$ +\end_inset + + and location parameter +\begin_inset Formula $L$ +\end_inset + + by taking +\begin_inset Formula $L=0$ +\end_inset + + and +\begin_inset Formula $S\equiv\lambda,$ +\end_inset + + then +\begin_inset Formula $\mu S$ +\end_inset + + is equal to +\begin_inset Formula $\mu_{2}$ +\end_inset + + where +\begin_inset Formula $\mu_{2}$ +\end_inset + + is the parameter used by JKB. + We prefer this form because of it's consistent use of the scale parameter. + Notice that in JKB the skew +\begin_inset Formula $\left(\sqrt{\beta_{1}}\right)$ +\end_inset + + and the kurtosis ( +\begin_inset Formula $\beta_{2}-3$ +\end_inset + +) are both functions only of +\begin_inset Formula $\mu_{2}/\lambda=\mu S/S=\mu$ +\end_inset + + as shown here, while the variance and mean of the standard form here are + transformed appropriately. + +\end_layout + +\begin_layout Section +Inverted Weibull +\end_layout + +\begin_layout Standard +Shape parameter +\begin_inset Formula $c>0$ +\end_inset + + and +\begin_inset Formula $x>0$ +\end_inset + +. + Then +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & cx^{-c-1}\exp\left(-x^{-c}\right)\\ +F\left(x;c\right) & = & \exp\left(-x^{-c}\right)\\ +G\left(q;c\right) & = & \left(-\log q\right)^{-1/c}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=1+\gamma+\frac{\gamma}{c}-\log\left(c\right)\] + +\end_inset + + where +\begin_inset Formula $\gamma$ +\end_inset + + is Euler's constant. +\end_layout + +\begin_layout Section +Johnson SB +\end_layout + +\begin_layout Standard +Defined for +\begin_inset Formula $x\in\left(0,1\right)$ +\end_inset + + with two shape parameters +\begin_inset Formula $a$ +\end_inset + + and +\begin_inset Formula $b>0.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,b\right) & = & \frac{b}{x\left(1-x\right)}\phi\left(a+b\log\frac{x}{1-x}\right)\\ +F\left(x;a,b\right) & = & \Phi\left(a+b\log\frac{x}{1-x}\right)\\ +G\left(q;a,b\right) & = & \frac{1}{1+\exp\left[-\frac{1}{b}\left(\Phi^{-1}\left(q\right)-a\right)\right]}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Johnson SU +\end_layout + +\begin_layout Standard +Defined for all +\begin_inset Formula $x$ +\end_inset + + with two shape parameters +\begin_inset Formula $a$ +\end_inset + + and +\begin_inset Formula $b>0$ +\end_inset + +. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,b\right) & = & \frac{b}{\sqrt{x^{2}+1}}\phi\left(a+b\log\left(x+\sqrt{x^{2}+1}\right)\right)\\ +F\left(x;a,b\right) & = & \Phi\left(a+b\log\left(x+\sqrt{x^{2}+1}\right)\right)\\ +G\left(q;a,b\right) & = & \sinh\left[\frac{\Phi^{-1}\left(q\right)-a}{b}\right]\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +KSone +\end_layout + +\begin_layout Section +KStwo +\end_layout + +\begin_layout Section +Laplace (Double Exponential, Bilateral Expoooonential) +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{2}e^{-\left|x\right|}\\ +F\left(x\right) & = & \left\{ \begin{array}{ccc} +\frac{1}{2}e^{x} & & x\leq0\\ +1-\frac{1}{2}e^{-x} & & x>0\end{array}\right.\\ +G\left(q\right) & = & \left\{ \begin{array}{ccc} +\log\left(2q\right) & & q\leq\frac{1}{2}\\ +-\log\left(2-2q\right) & & q>\frac{1}{2}\end{array}\right.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +m_{d}=m_{n}=\mu & = & 0\\ +\mu_{2} & = & 2\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & 3\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +The ML estimator of the location parameter is +\begin_inset Formula \[ +\hat{L}=\textrm{median}\left(X_{i}\right)\] + +\end_inset + + where +\begin_inset Formula $X_{i}$ +\end_inset + + is a sequence of +\begin_inset Formula $N$ +\end_inset + + mutually independent Laplace RV's and the median is some number between + the +\begin_inset Formula $\frac{1}{2}N\textrm{th}$ +\end_inset + + and the +\begin_inset Formula $(N/2+1)\textrm{th}$ +\end_inset + + order statistic ( +\emph on +e.g. + +\emph default + take the average of these two) when +\begin_inset Formula $N$ +\end_inset + + is even. + Also, +\begin_inset Formula \[ +\hat{S}=\frac{1}{N}\sum_{j=1}^{N}\left|X_{j}-\hat{L}\right|.\] + +\end_inset + + Replace +\begin_inset Formula $\hat{L}$ +\end_inset + + with +\begin_inset Formula $L$ +\end_inset + + if it is known. + If +\begin_inset Formula $L$ +\end_inset + + is known then this estimator is distributed as +\begin_inset Formula $\left(2N\right)^{-1}S\cdot\chi_{2N}^{2}$ +\end_inset + +. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(2e\right)\\ + & \approx & 1.6931471805599453094.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Left-skewed L?vy +\end_layout + +\begin_layout Standard +Special case of L?vy-stable distribution with +\begin_inset Formula $\alpha=\frac{1}{2}$ +\end_inset + + and +\begin_inset Formula $\beta=-1$ +\end_inset + + the support is +\begin_inset Formula $x<0$ +\end_inset + +. + In standard form +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{\left|x\right|\sqrt{2\pi\left|x\right|}}\exp\left(-\frac{1}{2\left|x\right|}\right)\\ +F\left(x\right) & = & 2\Phi\left(\frac{1}{\sqrt{\left|x\right|}}\right)-1\\ +G\left(q\right) & = & -\left[\Phi^{-1}\left(\frac{q+1}{2}\right)\right]^{-2}.\end{eqnarray*} + +\end_inset + +No moments. +\end_layout + +\begin_layout Section +L?vy +\end_layout + +\begin_layout Standard +A special case of L?vy-stable distributions with +\begin_inset Formula $\alpha=\frac{1}{2}$ +\end_inset + + and +\begin_inset Formula $\beta=1$ +\end_inset + +. + In standard form it is defined for +\begin_inset Formula $x>0$ +\end_inset + + as +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{x\sqrt{2\pi x}}\exp\left(-\frac{1}{2x}\right)\\ +F\left(x\right) & = & 2\left[1-\Phi\left(\frac{1}{\sqrt{x}}\right)\right]\\ +G\left(q\right) & = & \left[\Phi^{-1}\left(1-\frac{q}{2}\right)\right]^{-2}.\end{eqnarray*} + +\end_inset + + It has no finite moments. +\end_layout + +\begin_layout Section +Logistic (Sech-squared) +\end_layout + +\begin_layout Standard +A special case of the Generalized Logistic distribution with +\begin_inset Formula $c=1.$ +\end_inset + + Defined for +\begin_inset Formula $x>0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{\exp\left(-x\right)}{\left[1+\exp\left(-x\right)\right]^{2}}\\ +F\left(x\right) & = & \frac{1}{1+\exp\left(-x\right)}\\ +G\left(q\right) & = & -\log\left(1/q-1\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \gamma+\psi_{0}\left(1\right)=0\\ +\mu_{2} & = & \frac{\pi^{2}}{6}+\psi_{1}\left(1\right)=\frac{\pi^{2}}{3}\\ +\gamma_{1} & = & \frac{\psi_{2}\left(c\right)+2\zeta\left(3\right)}{\mu_{2}^{3/2}}=0\\ +\gamma_{2} & = & \frac{\left(\frac{\pi^{4}}{15}+\psi_{3}\left(c\right)\right)}{\mu_{2}^{2}}=\frac{6}{5}\\ +m_{d} & = & \log1=0\\ +m_{n} & = & -\log\left(2-1\right)=0\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=1.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Log Double Exponential (Log-Laplace) +\end_layout + +\begin_layout Standard +Defined over +\begin_inset Formula $x>0$ +\end_inset + + with +\begin_inset Formula $c>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \left\{ \begin{array}{ccc} +\frac{c}{2}x^{c-1} & & 00$ +\end_inset + + (Defined for all +\begin_inset Formula $x$ +\end_inset + +) +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{\exp\left(cx-e^{x}\right)}{\Gamma\left(c\right)}\\ +F\left(x;c\right) & = & \frac{\Gamma\left(c,e^{x}\right)}{\Gamma\left(c\right)}\\ +G\left(q;c\right) & = & \log\left[\Gamma^{-1}\left[c,q\Gamma\left(c\right)\right]\right]\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\int_{0}^{\infty}\left[\log y\right]^{n}y^{c-1}\exp\left(-y\right)dy.\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu_{1}^{\prime}\\ +\mu_{2} & = & \mu_{2}^{\prime}-\mu^{2}\\ +\gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Log Normal (Cobb-Douglass) +\end_layout + +\begin_layout Standard +Has one shape parameter +\begin_inset Formula $\sigma$ +\end_inset + +>0. + (Notice that the +\begin_inset Quotes eld +\end_inset + +Regress +\begin_inset Quotes erd +\end_inset + + +\begin_inset Formula $A=\log S$ +\end_inset + + where +\begin_inset Formula $S$ +\end_inset + + is the scale parameter and +\begin_inset Formula $A$ +\end_inset + + is the mean of the underlying normal distribution). + The standard form is +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\sigma\right) & = & \frac{1}{\sigma x\sqrt{2\pi}}\exp\left[-\frac{1}{2}\left(\frac{\log x}{\sigma}\right)^{2}\right]\\ +F\left(x;\sigma\right) & = & \Phi\left(\frac{\log x}{\sigma}\right)\\ +G\left(q;\sigma\right) & = & \exp\left\{ \sigma\Phi^{-1}\left(q\right)\right\} \end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \exp\left(\sigma^{2}/2\right)\\ +\mu_{2} & = & \exp\left(\sigma^{2}\right)\left[\exp\left(\sigma^{2}\right)-1\right]\\ +\gamma_{1} & = & \sqrt{p-1}\left(2+p\right)\\ +\gamma_{2} & = & p^{4}+2p^{3}+3p^{2}-6\quad\quad p=e^{\sigma^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +Notice that using JKB notation we have +\begin_inset Formula $\theta=L,$ +\end_inset + + +\begin_inset Formula $\zeta=\log S$ +\end_inset + + and we have given the so-called antilognormal form of the distribution. + This is more consistent with the location, scale parameter description + of general probability distributions. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=\frac{1}{2}\left[1+\log\left(2\pi\right)+2\log\left(\sigma\right)\right].\] + +\end_inset + + +\end_layout + +\begin_layout Standard +Also, note that if +\begin_inset Formula $X$ +\end_inset + + is a log-normally distributed random-variable with +\begin_inset Formula $L=0$ +\end_inset + + and +\begin_inset Formula $S$ +\end_inset + + and shape parameter +\begin_inset Formula $\sigma.$ +\end_inset + + Then, +\begin_inset Formula $\log X$ +\end_inset + + is normally distributed with variance +\begin_inset Formula $\sigma^{2}$ +\end_inset + + and mean +\begin_inset Formula $\log S.$ +\end_inset + + +\end_layout + +\begin_layout Section +Nakagami +\end_layout + +\begin_layout Standard +Generalization of the chi distribution. + Shape parameter is +\begin_inset Formula $\nu>0.$ +\end_inset + + Defined for +\begin_inset Formula $x>0.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu\right) & = & \frac{2\nu^{\nu}}{\Gamma\left(\nu\right)}x^{2\nu-1}\exp\left(-\nu x^{2}\right)\\ +F\left(x;\nu\right) & = & \Gamma\left(\nu,\nu x^{2}\right)\\ +G\left(q;\nu\right) & = & \sqrt{\frac{1}{\nu}\Gamma^{-1}\left(v,q\right)}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{\Gamma\left(\nu+\frac{1}{2}\right)}{\sqrt{\nu}\Gamma\left(\nu\right)}\\ +\mu_{2} & = & \left[1-\mu^{2}\right]\\ +\gamma_{1} & = & \frac{\mu\left(1-4v\mu_{2}\right)}{2\nu\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{-6\mu^{4}\nu+\left(8\nu-2\right)\mu^{2}-2\nu+1}{\nu\mu_{2}^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Noncentral beta* +\end_layout + +\begin_layout Standard +Defined over +\begin_inset Formula $x\in\left[0,1\right]$ +\end_inset + + with +\begin_inset Formula $a>0$ +\end_inset + + and +\begin_inset Formula $b>0$ +\end_inset + + and +\begin_inset Formula $c\geq0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +F\left(x;a,b,c\right)=\sum_{j=0}^{\infty}\frac{e^{-c/2}\left(\frac{c}{2}\right)^{j}}{j!}I_{B}\left(a+j,b;0\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +Noncentral chi* +\end_layout + +\begin_layout Section +Noncentral chi-squared +\end_layout + +\begin_layout Standard +The distribution of +\begin_inset Formula $\sum_{i=1}^{\nu}\left(Z_{i}+\delta_{i}\right)^{2}$ +\end_inset + + where +\begin_inset Formula $Z_{i}$ +\end_inset + + are independent standard normal variables and +\begin_inset Formula $\delta_{i}$ +\end_inset + + are constants. + +\begin_inset Formula $\lambda=\sum_{i=1}^{\nu}\delta_{i}^{2}>0.$ +\end_inset + + (In communications it is called the Marcum-Q function). + Can be thought of as a Generalized Rayleigh-Rice distribution. + For +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu,\lambda\right) & = & e^{-\left(\lambda+x\right)/2}\frac{1}{2}\left(\frac{x}{\lambda}\right)^{\left(\nu-2\right)/4}I_{\left(\nu-2\right)/2}\left(\sqrt{\lambda x}\right)\\ +F\left(x;\nu,\lambda\right) & = & \sum_{j=0}^{\infty}\left\{ \frac{\left(\lambda/2\right)^{j}}{j!}e^{-\lambda/2}\right\} \textrm{Pr}\left[\chi_{\nu+2j}^{2}\leq x\right]\\ +G\left(q;\nu,\lambda\right) & = & F^{-1}\left(x;\nu,\lambda\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \nu+\lambda\\ +\mu_{2} & = & 2\left(\nu+2\lambda\right)\\ +\gamma_{1} & = & \frac{\sqrt{8}\left(\nu+3\lambda\right)}{\left(\nu+2\lambda\right)^{3/2}}\\ +\gamma_{2} & = & \frac{12\left(\nu+4\lambda\right)}{\left(\nu+2\lambda\right)^{2}}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Noncentral F +\end_layout + +\begin_layout Standard +Let +\begin_inset Formula $\lambda>0$ +\end_inset + + and +\begin_inset Formula $\nu_{1}>0$ +\end_inset + + and +\begin_inset Formula $\nu_{2}>0.$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\lambda,\nu_{1},\nu_{2}\right) & = & \exp\left[\frac{\lambda}{2}+\frac{\left(\lambda\nu_{1}x\right)}{2\left(\nu_{1}x+\nu_{2}\right)}\right]\nu_{1}^{\nu_{1}/2}\nu_{2}^{\nu_{2}/2}x^{\nu_{1}/2-1}\\ + & & \times\left(\nu_{2}+\nu_{1}x\right)^{-\left(\nu_{1}+\nu_{2}\right)/2}\frac{\Gamma\left(\frac{\nu_{1}}{2}\right)\Gamma\left(1+\frac{\nu_{2}}{2}\right)L_{\nu_{2}/2}^{\nu_{1}/2-1}\left(-\frac{\lambda\nu_{1}x}{2\left(\nu_{1}x+\nu_{2}\right)}\right)}{B\left(\frac{\nu_{1}}{2},\frac{\nu_{2}}{2}\right)\Gamma\left(\frac{\nu_{1}+\nu_{2}}{2}\right)}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Noncentral t +\end_layout + +\begin_layout Standard +The distribution of the ratio +\begin_inset Formula \[ +\frac{U+\lambda}{\chi_{\nu}/\sqrt{\nu}}\] + +\end_inset + + where +\begin_inset Formula $U$ +\end_inset + + and +\begin_inset Formula $\chi_{\nu}$ +\end_inset + + are independent and distributed as a standard normal and chi with +\begin_inset Formula $\nu$ +\end_inset + + degrees of freedom. + Note +\begin_inset Formula $\lambda>0$ +\end_inset + + and +\begin_inset Formula $\nu>0$ +\end_inset + +. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\lambda,\nu\right) & = & \frac{\nu^{\nu/2}\Gamma\left(\nu+1\right)}{2^{\nu}e^{\lambda^{2}/2}\left(\nu+x^{2}\right)^{\nu/2}\Gamma\left(\nu/2\right)}\\ + & & \times\left\{ \frac{\sqrt{2}\lambda x\,_{1}F_{1}\left(\frac{\nu}{2}+1;\frac{3}{2};\frac{\lambda^{2}x^{2}}{2\left(\nu+x^{2}\right)}\right)}{\left(\nu+x^{2}\right)\Gamma\left(\frac{\nu+1}{2}\right)}\right.\\ + & & -\left.\frac{\,_{1}F_{1}\left(\frac{\nu+1}{2};\frac{1}{2};\frac{\lambda^{2}x^{2}}{2\left(\nu+x^{2}\right)}\right)}{\sqrt{\nu+x^{2}}\Gamma\left(\frac{\nu}{2}+1\right)}\right\} \\ + & = & \frac{\Gamma\left(\nu+1\right)}{2^{\left(\nu-1\right)/2}\sqrt{\pi\nu}\Gamma\left(\nu/2\right)}\exp\left[-\frac{\nu\lambda^{2}}{\nu+x^{2}}\right]\\ + & & \times\left(\frac{\nu}{\nu+x^{2}}\right)^{\left(\nu-1\right)/2}Hh_{\nu}\left(-\frac{\lambda x}{\sqrt{\nu+x^{2}}}\right)\\ +F\left(x;\lambda,\nu\right) & =\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Normal +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{e^{-x^{2}/2}}{\sqrt{2\pi}}\\ +F\left(x\right) & = & \Phi\left(x\right)=\frac{1}{2}+\frac{1}{2}\textrm{erf}\left(\frac{\textrm{x}}{\sqrt{2}}\right)\\ +G\left(q\right) & = & \Phi^{-1}\left(q\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\align center +\begin_inset Formula \begin{eqnarray*} +m_{d}=m_{n}=\mu & = & 0\\ +\mu_{2} & = & 1\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & 0\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +h\left[X\right] & = & \log\left(\sqrt{2\pi e}\right)\\ + & \approx & 1.4189385332046727418\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Maxwell +\end_layout + +\begin_layout Standard +This is a special case of the Chi distribution with +\begin_inset Formula $L=0$ +\end_inset + + and +\begin_inset Formula $S=S=\frac{1}{\sqrt{a}}$ +\end_inset + + and +\begin_inset Formula $\nu=3.$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \sqrt{\frac{2}{\pi}}x^{2}e^{-x^{2}/2}I_{\left(0,\infty\right)}\left(x\right)\\ +F\left(x\right) & = & \Gamma\left(\frac{3}{2},\frac{x^{2}}{2}\right)\\ +G\left(\alpha\right) & = & \sqrt{2\Gamma^{-1}\left(\frac{3}{2},\alpha\right)}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & 2\sqrt{\frac{2}{\pi}}\\ +\mu_{2} & = & 3-\frac{8}{\pi}\\ +\gamma_{1} & = & \sqrt{2}\frac{32-10\pi}{\left(3\pi-8\right)^{3/2}}\\ +\gamma_{2} & = & \frac{-12\pi^{2}+160\pi-384}{\left(3\pi-8\right)^{2}}\\ +m_{d} & = & \sqrt{2}\\ +m_{n} & = & \sqrt{2\Gamma^{-1}\left(\frac{3}{2},\frac{1}{2}\right)}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\log\left(\sqrt{\frac{2\pi}{e}}\right)+\gamma.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Mielke's Beta-Kappa +\end_layout + +\begin_layout Standard +A generalized F distribution. + Two shape parameters +\begin_inset Formula $\kappa$ +\end_inset + + and +\begin_inset Formula $\theta$ +\end_inset + +, and +\begin_inset Formula $x>0$ +\end_inset + +. + The +\begin_inset Formula $\beta$ +\end_inset + + in the DATAPLOT reference is a scale parameter. +\begin_inset Formula \begin{eqnarray*} +f\left(x;\kappa,\theta\right) & = & \frac{\kappa x^{\kappa-1}}{\left(1+x^{\theta}\right)^{1+\frac{\kappa}{\theta}}}\\ +F\left(x;\kappa,\theta\right) & = & \frac{x^{\kappa}}{\left(1+x^{\theta}\right)^{\kappa/\theta}}\\ +G\left(q;\kappa,\theta\right) & = & \left(\frac{q^{\theta/\kappa}}{1-q^{\theta/\kappa}}\right)^{1/\theta}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Pareto +\end_layout + +\begin_layout Standard +For +\begin_inset Formula $x\geq1$ +\end_inset + + and +\begin_inset Formula $b>0$ +\end_inset + +. + Standard form is +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;b\right) & = & \frac{b}{x^{b+1}}\\ +F\left(x;b\right) & = & 1-\frac{1}{x^{b}}\\ +G\left(q;b\right) & = & \left(1-q\right)^{-1/b}\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{b}{b-1}\quad b>1\\ +\mu_{2} & = & \frac{b}{\left(b-2\right)\left(b-1\right)^{2}}\quad b>2\\ +\gamma_{1} & = & \frac{2\left(b+1\right)\sqrt{b-2}}{\left(b-3\right)\sqrt{b}}\quad b>3\\ +\gamma_{2} & = & \frac{6\left(b^{3}+b^{2}-6b-2\right)}{b\left(b^{2}-7b+12\right)}\quad b>4\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left(X\right)=\frac{1}{c}+1-\log\left(c\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +Pareto Second Kind (Lomax) +\end_layout + +\begin_layout Standard +\begin_inset Formula $c>0.$ +\end_inset + + This is Pareto of the first kind with +\begin_inset Formula $L=-1.0$ +\end_inset + + so +\begin_inset Formula $x\geq0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{c}{\left(1+x\right)^{c+1}}\\ +F\left(x;c\right) & = & 1-\frac{1}{\left(1+x\right)^{c}}\\ +G\left(q;c\right) & = & \left(1-q\right)^{-1/c}-1\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\frac{1}{c}+1-\log\left(c\right).\] + +\end_inset + + +\end_layout + +\begin_layout Section +Power Log Normal +\end_layout + +\begin_layout Standard +A generalization of the log-normal distribution +\begin_inset Formula $\sigma>0$ +\end_inset + + and +\begin_inset Formula $c>0$ +\end_inset + + and +\begin_inset Formula $x>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\sigma,c\right) & = & \frac{c}{x\sigma}\phi\left(\frac{\log x}{\sigma}\right)\left(\Phi\left(-\frac{\log x}{\sigma}\right)\right)^{c-1}\\ +F\left(x;\sigma,c\right) & = & 1-\left(\Phi\left(-\frac{\log x}{\sigma}\right)\right)^{c}\\ +G\left(q;\sigma,c\right) & = & \exp\left[-\sigma\Phi^{-1}\left[\left(1-q\right)^{1/c}\right]\right]\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\int_{0}^{1}\exp\left[-n\sigma\Phi^{-1}\left(y^{1/c}\right)\right]dy\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu_{1}^{\prime}\\ +\mu_{2} & = & \mu_{2}^{\prime}-\mu^{2}\\ +\gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + + This distribution reduces to the log-normal distribution when +\begin_inset Formula $c=1.$ +\end_inset + + +\end_layout + +\begin_layout Section +Power Normal +\end_layout + +\begin_layout Standard +A generalization of the normal distribution, +\begin_inset Formula $c>0$ +\end_inset + + for +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & c\phi\left(x\right)\left(\Phi\left(-x\right)\right)^{c-1}\\ +F\left(x;c\right) & = & 1-\left(\Phi\left(-x\right)\right)^{c}\\ +G\left(q;c\right) & = & -\Phi^{-1}\left[\left(1-q\right)^{1/c}\right]\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left(-1\right)^{n}\int_{0}^{1}\left[\Phi^{-1}\left(y^{1/c}\right)\right]^{n}dy\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu_{1}^{\prime}\\ +\mu_{2} & = & \mu_{2}^{\prime}-\mu^{2}\\ +\gamma_{1} & = & \frac{\mu_{3}^{\prime}-3\mu\mu_{2}-\mu^{3}}{\mu_{2}^{3/2}}\\ +\gamma_{2} & = & \frac{\mu_{4}^{\prime}-4\mu\mu_{3}-6\mu^{2}\mu_{2}-\mu^{4}}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + +For +\begin_inset Formula $c=1$ +\end_inset + + this reduces to the normal distribution. + +\end_layout + +\begin_layout Section +Power-function +\end_layout + +\begin_layout Standard +A special case of the beta distribution with +\begin_inset Formula $b=1$ +\end_inset + +: defined for +\begin_inset Formula $x\in\left[0,1\right]$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +a>0\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;a\right) & = & ax^{a-1}\\ +F\left(x;a\right) & = & x^{a}\\ +G\left(q;a\right) & = & q^{1/a}\\ +\mu & = & \frac{a}{a+1}\\ +\mu_{2} & = & \frac{a\left(a+2\right)}{\left(a+1\right)^{2}}\\ +\gamma_{1} & = & 2\left(1-a\right)\sqrt{\frac{a+2}{a\left(a+3\right)}}\\ +\gamma_{2} & = & \frac{6\left(a^{3}-a^{2}-6a+2\right)}{a\left(a+3\right)\left(a+4\right)}\\ +m_{d} & = & 1\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=1-\frac{1}{a}-\log\left(a\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +R-distribution +\end_layout + +\begin_layout Standard +A general-purpose distribution with a variety of shapes controlled by +\begin_inset Formula $c>0.$ +\end_inset + + Range of standard distribution is +\begin_inset Formula $x\in\left[-1,1\right]$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{\left(1-x^{2}\right)^{c/2-1}}{B\left(\frac{1}{2},\frac{c}{2}\right)}\\ +F\left(x;c\right) & = & \frac{1}{2}+\frac{x}{B\left(\frac{1}{2},\frac{c}{2}\right)}\,_{2}F_{1}\left(\frac{1}{2},1-\frac{c}{2};\frac{3}{2};x^{2}\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\frac{\left(1+\left(-1\right)^{n}\right)}{2}B\left(\frac{n+1}{2},\frac{c}{2}\right)\] + +\end_inset + + The R-distribution with parameter +\begin_inset Formula $n$ +\end_inset + + is the distribution of the correlation coefficient of a random sample of + size +\begin_inset Formula $n$ +\end_inset + + drawn from a bivariate normal distribution with +\begin_inset Formula $\rho=0.$ +\end_inset + + The mean of the standard distribution is always zero and as the sample + size grows, the distribution's mass concentrates more closely about this + mean. + +\end_layout + +\begin_layout Section +Rayleigh +\end_layout + +\begin_layout Standard +This is Chi distribution with +\begin_inset Formula $L=0.0$ +\end_inset + + and +\begin_inset Formula $\nu=2$ +\end_inset + + and +\begin_inset Formula $S=S$ +\end_inset + + (no location parameter is generally used), the mode of the distribution + is +\begin_inset Formula $S.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(r\right) & = & re^{-r^{2}/2}I_{[0,\infty)}\left(x\right)\\ +F\left(r\right) & = & 1-e^{-r^{2}/2}I_{[0,\infty)}\left(x\right)\\ +G\left(q\right) & = & \sqrt{-2\log\left(1-q\right)}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \sqrt{\frac{\pi}{2}}\\ +\mu_{2} & = & \frac{4-\pi}{2}\\ +\gamma_{1} & = & \frac{2\left(\pi-3\right)\sqrt{\pi}}{\left(4-\pi\right)^{3/2}}\\ +\gamma_{2} & = & \frac{24\pi-6\pi^{2}-16}{\left(4-\pi\right)^{2}}\\ +m_{d} & = & 1\\ +m_{n} & = & \sqrt{2\log\left(2\right)}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\frac{\gamma}{2}+\log\left(\frac{e}{\sqrt{2}}\right).\] + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=\sqrt{2^{n}}\Gamma\left(\frac{n}{2}+1\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +Rice* +\end_layout + +\begin_layout Standard +Defined for +\begin_inset Formula $x>0$ +\end_inset + + and +\begin_inset Formula $b>0$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;b\right) & = & x\exp\left(-\frac{x^{2}+b^{2}}{2}\right)I_{0}\left(xb\right)\\ +F\left(x;b\right) & = & \int_{0}^{x}\alpha\exp\left(-\frac{\alpha^{2}+b^{2}}{2}\right)I_{0}\left(\alpha b\right)d\alpha\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +\mu_{n}^{\prime}=\sqrt{2^{n}}\Gamma\left(1+\frac{n}{2}\right)\,_{1}F_{1}\left(-\frac{n}{2};1;-\frac{b^{2}}{2}\right)\] + +\end_inset + + +\end_layout + +\begin_layout Section +Reciprocal +\end_layout + +\begin_layout Standard +Shape parameters +\begin_inset Formula $a,b>0$ +\end_inset + + +\begin_inset Formula $x\in\left[a,b\right]$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;a,b\right) & = & \frac{1}{x\log\left(b/a\right)}\\ +F\left(x;a,b\right) & = & \frac{\log\left(x/a\right)}{\log\left(b/a\right)}\\ +G\left(q;a,b\right) & = & a\exp\left(q\log\left(b/a\right)\right)=a\left(\frac{b}{a}\right)^{q}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +d & = & \log\left(a/b\right)\\ +\mu & = & \frac{a-b}{d}\\ +\mu_{2} & = & \mu\frac{a+b}{2}-\mu^{2}=\frac{\left(a-b\right)\left[a\left(d-2\right)+b\left(d+2\right)\right]}{2d^{2}}\\ +\gamma_{1} & = & \frac{\sqrt{2}\left[12d\left(a-b\right)^{2}+d^{2}\left(a^{2}\left(2d-9\right)+2abd+b^{2}\left(2d+9\right)\right)\right]}{3d\sqrt{a-b}\left[a\left(d-2\right)+b\left(d+2\right)\right]^{3/2}}\\ +\gamma_{2} & = & \frac{-36\left(a-b\right)^{3}+36d\left(a-b\right)^{2}\left(a+b\right)-16d^{2}\left(a^{3}-b^{3}\right)+3d^{3}\left(a^{2}+b^{2}\right)\left(a+b\right)}{3\left(a-b\right)\left[a\left(d-2\right)+b\left(d+2\right)\right]^{2}}-3\\ +m_{d} & = & a\\ +m_{n} & = & \sqrt{ab}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\frac{1}{2}\log\left(ab\right)+\log\left[\log\left(\frac{b}{a}\right)\right].\] + +\end_inset + + +\end_layout + +\begin_layout Section +Reciprocal Inverse Gaussian +\end_layout + +\begin_layout Standard +The pdf is found from the inverse gaussian (IG), +\begin_inset Formula $f_{RIG}\left(x;\mu\right)=\frac{1}{x^{2}}f_{IG}\left(\frac{1}{x};\mu\right)$ +\end_inset + + defined for +\begin_inset Formula $x\geq0$ +\end_inset + + as +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f_{IG}\left(x;\mu\right) & = & \frac{1}{\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-\mu\right)^{2}}{2x\mu^{2}}\right).\\ +F_{IG}\left(x;\mu\right) & = & \Phi\left(\frac{1}{\sqrt{x}}\frac{x-\mu}{\mu}\right)+\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{x+\mu}{\mu}\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f_{RIG}\left(x;\mu\right) & = & \frac{1}{\sqrt{2\pi x}}\exp\left(-\frac{\left(1-\mu x\right)^{2}}{2x\mu^{2}}\right)\\ +F_{RIG}\left(x;\mu\right) & = & 1-F_{IG}\left(\frac{1}{x},\mu\right)\\ + & = & 1-\Phi\left(\frac{1}{\sqrt{x}}\frac{1-\mu x}{\mu}\right)-\exp\left(\frac{2}{\mu}\right)\Phi\left(-\frac{1}{\sqrt{x}}\frac{1+\mu x}{\mu}\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Semicircular +\end_layout + +\begin_layout Standard +Defined on +\begin_inset Formula $x\in\left[-1,1\right]$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{2}{\pi}\sqrt{1-x^{2}}\\ +F\left(x\right) & = & \frac{1}{2}+\frac{1}{\pi}\left[x\sqrt{1-x^{2}}+\arcsin x\right]\\ +G\left(q\right) & = & F^{-1}\left(q\right)\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +m_{d}=m_{n}=\mu & = & 0\\ +\mu_{2} & = & \frac{1}{4}\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & -1\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=0.64472988584940017414.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Studentized Range* +\end_layout + +\begin_layout Section +Student t +\end_layout + +\begin_layout Standard +Shape parameter +\begin_inset Formula $\nu>0.$ +\end_inset + + +\begin_inset Formula $I\left(a,b,x\right)$ +\end_inset + + is the incomplete beta integral and +\begin_inset Formula $I^{-1}\left(a,b,I\left(a,b,x\right)\right)=x$ +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu\right) & = & \frac{\Gamma\left(\frac{\nu+1}{2}\right)}{\sqrt{\pi\nu}\Gamma\left(\frac{\nu}{2}\right)\left[1+\frac{x^{2}}{\nu}\right]^{\frac{\nu+1}{2}}}\\ +F\left(x;\nu\right) & = & \left\{ \begin{array}{ccc} +\frac{1}{2}I\left(\frac{\nu}{2},\frac{1}{2},\frac{\nu}{\nu+x^{2}}\right) & & x\leq0\\ +1-\frac{1}{2}I\left(\frac{\nu}{2},\frac{1}{2},\frac{\nu}{\nu+x^{2}}\right) & & x\geq0\end{array}\right.\\ +G\left(q;\nu\right) & = & \left\{ \begin{array}{ccc} +-\sqrt{\frac{\nu}{I^{-1}\left(\frac{\nu}{2},\frac{1}{2},2q\right)}-\nu} & & q\leq\frac{1}{2}\\ +\sqrt{\frac{\nu}{I^{-1}\left(\frac{\nu}{2},\frac{1}{2},2-2q\right)}-\nu} & & q\geq\frac{1}{2}\end{array}\right.\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +m_{n}=m_{d}=\mu & = & 0\\ +\mu_{2} & = & \frac{\nu}{\nu-2}\quad\nu>2\\ +\gamma_{1} & = & 0\quad\nu>3\\ +\gamma_{2} & = & \frac{6}{\nu-4}\quad\nu>4\end{eqnarray*} + +\end_inset + + As +\begin_inset Formula $\nu\rightarrow\infty,$ +\end_inset + + this distribution approaches the standard normal distribution. + +\end_layout + +\begin_layout Standard +\begin_inset Formula \[ +h\left[X\right]=\frac{1}{4}\log\left(\frac{\pi c\Gamma^{2}\left(\frac{c}{2}\right)}{\Gamma^{2}\left(\frac{c+1}{2}\right)}\right)-\frac{\left(c+1\right)}{4}\left[\Psi\left(\frac{c}{2}\right)-cZ\left(c\right)+\pi\tan\left(\frac{\pi c}{2}\right)+\gamma+2\log2\right]\] + +\end_inset + +where +\begin_inset Formula \[ +Z\left(c\right)=\,_{3}F_{2}\left(1,1,1+\frac{c}{2};\frac{3}{2},2;1\right)=\sum_{k=0}^{\infty}\frac{k!}{k+1}\frac{\Gamma\left(\frac{c}{2}+1+k\right)}{\Gamma\left(\frac{c}{2}+1\right)}\frac{\Gamma\left(\frac{3}{2}\right)}{\Gamma\left(\frac{3}{2}+k\right)}\] + +\end_inset + + +\end_layout + +\begin_layout Section +Student Z +\end_layout + +\begin_layout Standard +The student Z distriubtion is defined over all space with one shape parameter + +\begin_inset Formula $\nu>0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;\nu\right) & = & \frac{\Gamma\left(\frac{\nu}{2}\right)}{\sqrt{\pi}\Gamma\left(\frac{\nu-1}{2}\right)}\left(1+x^{2}\right)^{-\nu/2}\\ +F\left(x;\nu\right) & = & \left\{ \begin{array}{ccc} +Q\left(x;\nu\right) & & x\leq0\\ +1-Q\left(x;\nu\right) & & x\geq0\end{array}\right.\\ +Q\left(x;\nu\right) & = & \frac{\left|x\right|^{1-n}\Gamma\left(\frac{n}{2}\right)\,_{2}F_{1}\left(\frac{n-1}{2},\frac{n}{2};\frac{n+1}{2};-\frac{1}{x^{2}}\right)}{2\sqrt{\pi}\Gamma\left(\frac{n+1}{2}\right)}\end{eqnarray*} + +\end_inset + +Interesting moments are +\begin_inset Formula \begin{eqnarray*} +\mu & = & 0\\ +\sigma^{2} & = & \frac{1}{\nu-3}\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & \frac{6}{\nu-5}.\end{eqnarray*} + +\end_inset + + The moment generating function is +\begin_inset Formula \[ +\theta\left(t\right)=2\sqrt{\left|\frac{t}{2}\right|^{\nu-1}}\frac{K_{\left(n-1\right)/2}\left(\left|t\right|\right)}{\Gamma\left(\frac{\nu-1}{2}\right)}.\] + +\end_inset + + +\end_layout + +\begin_layout Section +Symmetric Power* +\end_layout + +\begin_layout Section +Triangular +\end_layout + +\begin_layout Standard +One shape parameter +\begin_inset Formula $c\in[0,1]$ +\end_inset + + giving the distance to the peak as a percentage of the total extent of + the non-zero portion. + The location parameter is the start of the non-zero portion, and the scale-para +meter is the width of the non-zero portion. + In standard form we have +\begin_inset Formula $x\in\left[0,1\right].$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \left\{ \begin{array}{ccc} +2\frac{x}{c} & & x0$ +\end_inset + +. + Note, the PDF and CDF functions are periodic and are always defined over + +\begin_inset Formula $x\in\left[-\pi,\pi\right]$ +\end_inset + + regardless of the location parameter. + Thus, if an input beyond this range is given, it is converted to the equivalent + angle in this range. + For values of +\begin_inset Formula $b<100$ +\end_inset + + the PDF and CDF formulas below are used. + Otherwise, a normal approximation with variance +\begin_inset Formula $1/b$ +\end_inset + + is used. + +\begin_inset Formula \begin{eqnarray*} +f\left(x;b\right) & = & \frac{e^{b\cos x}}{2\pi I_{0}\left(b\right)}\\ +F\left(x;b\right) & = & \frac{1}{2}+\frac{x}{2\pi}+\sum_{k=1}^{\infty}\frac{I_{k}\left(b\right)\sin\left(kx\right)}{I_{0}\left(b\right)\pi k}\\ +G\left(q;b\right) & = & F^{-1}\left(x;b\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & 0\\ +\mu_{2} & = & \int_{-\pi}^{\pi}x^{2}f\left(x;b\right)dx\\ +\gamma_{1} & = & 0\\ +\gamma_{2} & = & \frac{\int_{-\pi}^{\pi}x^{4}f\left(x;b\right)dx}{\mu_{2}^{2}}-3\end{eqnarray*} + +\end_inset + + This can be used for defining circular variance. + +\end_layout + +\begin_layout Section +Wald +\end_layout + +\begin_layout Standard +Special case of the Inverse Normal with shape parameter set to +\begin_inset Formula $1.0$ +\end_inset + +. + Defined for +\begin_inset Formula $x>0$ +\end_inset + +. +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +f\left(x\right) & = & \frac{1}{\sqrt{2\pi x^{3}}}\exp\left(-\frac{\left(x-1\right)^{2}}{2x}\right).\\ +F\left(x\right) & = & \Phi\left(\frac{x-1}{\sqrt{x}}\right)+\exp\left(2\right)\Phi\left(-\frac{x+1}{\sqrt{x}}\right)\\ +G\left(q;\mu\right) & = & F^{-1}\left(q;\mu\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Standard +\begin_inset Formula \begin{eqnarray*} +\mu & = & 1\\ +\mu_{2} & = & 1\\ +\gamma_{1} & = & 3\\ +\gamma_{2} & = & 15\\ +m_{d} & = & \frac{1}{2}\left(\sqrt{13}-3\right)\end{eqnarray*} + +\end_inset + + +\end_layout + +\begin_layout Section +Wishart* +\end_layout + +\begin_layout Section +Wrapped Cauchy +\end_layout + +\begin_layout Standard +For +\begin_inset Formula $x\in\left[0,2\pi\right]$ +\end_inset + + +\begin_inset Formula $c\in\left(0,1\right)$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +f\left(x;c\right) & = & \frac{1-c^{2}}{2\pi\left(1+c^{2}-2c\cos x\right)}\\ +g_{c}\left(x\right) & = & \frac{1}{\pi}\arctan\left[\frac{1+c}{1-c}\tan\left(\frac{x}{2}\right)\right]\\ +r_{c}\left(q\right) & = & 2\arctan\left[\frac{1-c}{1+c}\tan\left(\pi q\right)\right]\\ +F\left(x;c\right) & = & \left\{ \begin{array}{ccc} +g_{c}\left(x\right) & & 0\leq x<\pi\\ +1-g_{c}\left(2\pi-x\right) & & \pi\leq x\leq2\pi\end{array}\right.\\ +G\left(q;c\right) & = & \left\{ \begin{array}{ccc} +r_{c}\left(q\right) & & 0\leq q<\frac{1}{2}\\ +2\pi-r_{c}\left(1-q\right) & & \frac{1}{2}\leq q\leq1\end{array}\right.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +\] + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\log\left(2\pi\left(1-c^{2}\right)\right).\] + +\end_inset + + +\end_layout + +\end_body +\end_document Added: trunk/doc/source/tutorial/stats/discrete.lyx =================================================================== --- trunk/doc/source/tutorial/stats/discrete.lyx (rev 0) +++ trunk/doc/source/tutorial/stats/discrete.lyx 2010-06-01 04:09:28 UTC (rev 6462) @@ -0,0 +1,1218 @@ +#LyX 1.3 created this file. For more info see http://www.lyx.org/ +\lyxformat 221 +\textclass article +\language english +\inputencoding auto +\fontscheme default +\graphics default +\paperfontsize default +\spacing single +\papersize Default +\paperpackage a4 +\use_geometry 1 +\use_amsmath 1 +\use_natbib 0 +\use_numerical_citations 0 +\paperorientation portrait +\leftmargin 1in +\topmargin 1in +\rightmargin 1in +\bottommargin 1in +\secnumdepth 3 +\tocdepth 3 +\paragraph_separation indent +\defskip medskip +\quotes_language english +\quotes_times 2 +\papercolumns 1 +\papersides 1 +\paperpagestyle default + +\layout Title + +Discrete Statistical Distributions +\layout Standard + +Discrete random variables take on only a countable number of values. + The commonly used distributions are included in SciPy and described in + this document. + Each discrete distribution can take one extra integer parameter: +\begin_inset Formula $L.$ +\end_inset + + The relationship between the general distribution and the standard one + is +\begin_inset Formula \[ +p\left(x\right)=p_{0}\left(x-L\right)\] + +\end_inset + + which allows for shifting of the input. + When a distribution generator is initialized, the discrete distribution + can either specify the beginning and ending (integer) values +\begin_inset Formula $a$ +\end_inset + + and +\begin_inset Formula $b$ +\end_inset + + which must be such that +\begin_inset Formula \[ +p_{0}\left(x\right)=0\quad xb\] + +\end_inset + + in which case, it is assumed that the pdf function is specified on the + integers +\begin_inset Formula $a+mk\leq b$ +\end_inset + + where +\begin_inset Formula $k$ +\end_inset + + is a non-negative integer ( +\begin_inset Formula $0,1,2,\ldots$ +\end_inset + +) and +\begin_inset Formula $m$ +\end_inset + + is a positive integer multiplier. + Alternatively, the two lists +\begin_inset Formula $x_{k}$ +\end_inset + + and +\begin_inset Formula $p\left(x_{k}\right)$ +\end_inset + + can be provided directly in which case a dictionary is set up internally + to evaulate probabilities and generate random variates. + +\layout Subsection + +Probability Mass Function (PMF) +\layout Standard + +The probability mass function of a random variable X is defined as the probabili +ty that the random variable takes on a particular value. + +\begin_inset Formula \[ +p\left(x_{k}\right)=P\left[X=x_{k}\right]\] + +\end_inset + + This is also sometimes called the probability density function, although + technically +\begin_inset Formula \[ +f\left(x\right)=\sum_{k}p\left(x_{k}\right)\delta\left(x-x_{k}\right)\] + +\end_inset + + is the probability density function for a discrete distribution +\begin_inset Foot +collapsed false + +\layout Standard + +Note that we will be using +\begin_inset Formula $p$ +\end_inset + + to represent the probability mass function and a parameter (a probability). + The usage should be obvious from context. + +\end_inset + +. + +\layout Subsection + +Cumulative Distribution Function (CDF) +\layout Standard + +The cumulative distribution function is +\begin_inset Formula \[ +F\left(x\right)=P\left[X\leq x\right]=\sum_{x_{k}\leq x}p\left(x_{k}\right)\] + +\end_inset + + and is also useful to be able to compute. + Note that +\begin_inset Formula \[ +F\left(x_{k}\right)-F\left(x_{k-1}\right)=p\left(x_{k}\right)\] + +\end_inset + + +\layout Subsection + +Survival Function +\layout Standard + +The survival function is just +\begin_inset Formula \[ +S\left(x\right)=1-F\left(x\right)=P\left[X>k\right]\] + +\end_inset + + the probability that the random variable is strictly larger than +\begin_inset Formula $k$ +\end_inset + +. + +\layout Subsection + +Percent Point Function (Inverse CDF) +\layout Standard + +The percent point function is the inverse of the cumulative distribution + function and is +\begin_inset Formula \[ +G\left(q\right)=F^{-1}\left(q\right)\] + +\end_inset + + for discrete distributions, this must be modified for cases where there + is no +\begin_inset Formula $x_{k}$ +\end_inset + + such that +\begin_inset Formula $F\left(x_{k}\right)=q.$ +\end_inset + + In these cases we choose +\begin_inset Formula $G\left(q\right)$ +\end_inset + + to be the smallest value +\begin_inset Formula $x_{k}=G\left(q\right)$ +\end_inset + + for which +\begin_inset Formula $F\left(x_{k}\right)\geq q$ +\end_inset + +. + If +\begin_inset Formula $q=0$ +\end_inset + + then we define +\begin_inset Formula $G\left(0\right)=a-1$ +\end_inset + +. + This definition allows random variates to be defined in the same way as + with continuous rv's using the inverse cdf on a uniform distribution to + generate random variates. + +\layout Subsection + +Inverse survival function +\layout Standard + +The inverse survival function is the inverse of the survival function +\begin_inset Formula \[ +Z\left(\alpha\right)=S^{-1}\left(\alpha\right)=G\left(1-\alpha\right)\] + +\end_inset + + and is thus the smallest non-negative integer +\begin_inset Formula $k$ +\end_inset + + for which +\begin_inset Formula $F\left(k\right)\geq1-\alpha$ +\end_inset + + or the smallest non-negative integer +\begin_inset Formula $k$ +\end_inset + + for which +\begin_inset Formula $S\left(k\right)\leq\alpha.$ +\end_inset + + +\layout Subsection + +Hazard functions +\layout Standard + +If desired, the hazard function and the cumulative hazard function could + be defined as +\begin_inset Formula \[ +h\left(x_{k}\right)=\frac{p\left(x_{k}\right)}{1-F\left(x_{k}\right)}\] + +\end_inset + + and +\begin_inset Formula \[ +H\left(x\right)=\sum_{x_{k}\leq x}h\left(x_{k}\right)=\sum_{x_{k}\leq x}\frac{F\left(x_{k}\right)-F\left(x_{k-1}\right)}{1-F\left(x_{k}\right)}.\] + +\end_inset + + +\layout Subsection + +Moments +\layout Standard + +Non-central moments are defined using the PDF +\begin_inset Formula \[ +\mu_{m}^{\prime}=E\left[X^{m}\right]=\sum_{k}x_{k}^{m}p\left(x_{k}\right).\] + +\end_inset + + Central moments are computed similarly +\begin_inset Formula $\mu=\mu_{1}^{\prime}$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu_{m}=E\left[\left(X-\mu\right)^{2}\right] & = & \sum_{k}\left(x_{k}-\mu\right)^{m}p\left(x_{k}\right)\\ + & = & \sum_{k=0}^{m}\left(-1\right)^{m-k}\left(\begin{array}{c} +m\\ +k\end{array}\right)\mu^{m-k}\mu_{k}^{\prime}\end{eqnarray*} + +\end_inset + + The mean is the first moment +\begin_inset Formula \[ +\mu=\mu_{1}^{\prime}=E\left[X\right]=\sum_{k}x_{k}p\left(x_{k}\right)\] + +\end_inset + + the variance is the second central moment +\begin_inset Formula \[ +\mu_{2}=E\left[\left(X-\mu\right)^{2}\right]=\sum_{x_{k}}x_{k}^{2}p\left(x_{k}\right)-\mu^{2}.\] + +\end_inset + +Skewness is defined as +\begin_inset Formula \[ +\gamma_{1}=\frac{\mu_{3}}{\mu_{2}^{3/2}}\] + +\end_inset + + while (Fisher) kurtosis is +\begin_inset Formula \[ +\gamma_{2}=\frac{\mu_{4}}{\mu_{2}^{2}}-3,\] + +\end_inset + + so that a normal distribution has a kurtosis of zero. + +\layout Subsection + +Moment generating function +\layout Standard + +The moment generating funtion is defined as +\begin_inset Formula \[ +M_{X}\left(t\right)=E\left[e^{Xt}\right]=\sum_{x_{k}}e^{x_{k}t}p\left(x_{k}\right)\] + +\end_inset + + Moments are found as the derivatives of the moment generating function + evaluated at +\begin_inset Formula $0.$ +\end_inset + + +\layout Subsection + +Fitting data +\layout Standard + +To fit data to a distribution, maximizing the likelihood function is common. + Alternatively, some distributions have well-known minimum variance unbiased + estimators. + These will be chosen by default, but the likelihood function will always + be available for minimizing. + +\layout Standard + +If +\begin_inset Formula $f_{i}\left(k;\boldsymbol{\theta}\right)$ +\end_inset + + is the PDF of a random-variable where +\begin_inset Formula $\boldsymbol{\theta}$ +\end_inset + + is a vector of parameters ( +\emph on +e.g. + +\begin_inset Formula $L$ +\end_inset + + +\emph default +and +\begin_inset Formula $S$ +\end_inset + +), then for a collection of +\begin_inset Formula $N$ +\end_inset + + independent samples from this distribution, the joint distribution the + random vector +\begin_inset Formula $\mathbf{k}$ +\end_inset + + is +\begin_inset Formula \[ +f\left(\mathbf{k};\boldsymbol{\theta}\right)=\prod_{i=1}^{N}f_{i}\left(k_{i};\boldsymbol{\theta}\right).\] + +\end_inset + + The maximum likelihood estimate of the parameters +\begin_inset Formula $\boldsymbol{\theta}$ +\end_inset + + are the parameters which maximize this function with +\begin_inset Formula $\mathbf{x}$ +\end_inset + + fixed and given by the data: +\begin_inset Formula \begin{eqnarray*} +\hat{\boldsymbol{\theta}} & = & \arg\max_{\boldsymbol{\theta}}f\left(\mathbf{k};\boldsymbol{\theta}\right)\\ + & = & \arg\min_{\boldsymbol{\theta}}l_{\mathbf{k}}\left(\boldsymbol{\theta}\right).\end{eqnarray*} + +\end_inset + + Where +\begin_inset Formula \begin{eqnarray*} +l_{\mathbf{k}}\left(\boldsymbol{\theta}\right) & = & -\sum_{i=1}^{N}\log f\left(k_{i};\boldsymbol{\theta}\right)\\ + & = & -N\overline{\log f\left(k_{i};\boldsymbol{\theta}\right)}\end{eqnarray*} + +\end_inset + + +\layout Subsection + +Standard notation for mean +\layout Standard + +We will use +\begin_inset Formula \[ +\overline{y\left(\mathbf{x}\right)}=\frac{1}{N}\sum_{i=1}^{N}y\left(x_{i}\right)\] + +\end_inset + + where +\begin_inset Formula $N$ +\end_inset + + should be clear from context. + +\layout Subsection + +Combinations +\layout Standard + +Note that +\begin_inset Formula \[ +k!=k\cdot\left(k-1\right)\cdot\left(k-2\right)\cdot\cdots\cdot1=\Gamma\left(k+1\right)\] + +\end_inset + + and has special cases of +\begin_inset Formula \begin{eqnarray*} +0! & \equiv & 1\\ +k! & \equiv & 0\quad k<0\end{eqnarray*} + +\end_inset + + and +\begin_inset Formula \[ +\left(\begin{array}{c} +n\\ +k\end{array}\right)=\frac{n!}{\left(n-k\right)!k!}.\] + +\end_inset + + If +\begin_inset Formula $n<0$ +\end_inset + + or +\begin_inset Formula $k<0$ +\end_inset + + or +\begin_inset Formula $k>n$ +\end_inset + + we define +\begin_inset Formula $\left(\begin{array}{c} +n\\ +k\end{array}\right)=0$ +\end_inset + + +\layout Section + +Bernoulli +\layout Standard + +A Bernoulli random variable of parameter +\begin_inset Formula $p$ +\end_inset + + takes one of only two values +\begin_inset Formula $X=0$ +\end_inset + + or +\begin_inset Formula $X=1$ +\end_inset + +. + The probability of success ( +\begin_inset Formula $X=1$ +\end_inset + +) is +\begin_inset Formula $p$ +\end_inset + +, and the probability of failure ( +\begin_inset Formula $X=0$ +\end_inset + +) is +\begin_inset Formula $1-p.$ +\end_inset + + It can be thought of as a binomial random variable with +\begin_inset Formula $n=1$ +\end_inset + +. + The PMF is +\begin_inset Formula $p\left(k\right)=0$ +\end_inset + + for +\begin_inset Formula $k\neq0,1$ +\end_inset + + and +\begin_inset Formula \begin{eqnarray*} +p\left(k;p\right) & = & \begin{cases} +1-p & k=0\\ +p & k=1\end{cases}\\ +F\left(x;p\right) & = & \begin{cases} +0 & x<0\\ +1-p & 0\le x<1\\ +1 & 1\leq x\end{cases}\\ +G\left(q;p\right) & = & \begin{cases} +0 & 0\leq q<1-p\\ +1 & 1-p\leq q\leq1\end{cases}\\ +\mu & = & p\\ +\mu_{2} & = & p\left(1-p\right)\\ +\gamma_{3} & = & \frac{1-2p}{\sqrt{p\left(1-p\right)}}\\ +\gamma_{4} & = & \frac{1-6p\left(1-p\right)}{p\left(1-p\right)}\end{eqnarray*} + +\end_inset + + +\layout Standard + + +\begin_inset Formula \[ +M\left(t\right)=1-p\left(1-e^{t}\right)\] + +\end_inset + + +\layout Standard + + +\begin_inset Formula \[ +\mu_{m}^{\prime}=p\] + +\end_inset + + +\layout Standard + + +\begin_inset Formula \[ +h\left[X\right]=p\log p+\left(1-p\right)\log\left(1-p\right)\] + +\end_inset + + +\layout Section + +Binomial +\layout Standard + +A binomial random variable with parameters +\begin_inset Formula $\left(n,p\right)$ +\end_inset + + can be described as the sum of +\begin_inset Formula $n$ +\end_inset + + independent Bernoulli random variables of parameter +\begin_inset Formula $p;$ +\end_inset + + +\begin_inset Formula \[ +Y=\sum_{i=1}^{n}X_{i}.\] + +\end_inset + + Therefore, this random variable counts the number of successes in +\begin_inset Formula $n$ +\end_inset + + independent trials of a random experiment where the probability of success + is +\begin_inset Formula $p.$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +p\left(k;n,p\right) & = & \left(\begin{array}{c} +n\\ +k\end{array}\right)p^{k}\left(1-p\right)^{n-k}\,\, k\in\left\{ 0,1,\ldots n\right\} ,\\ +F\left(x;n,p\right) & = & \sum_{k\leq x}\left(\begin{array}{c} +n\\ +k\end{array}\right)p^{k}\left(1-p\right)^{n-k}=I_{1-p}\left(n-\left\lfloor x\right\rfloor ,\left\lfloor x\right\rfloor +1\right)\quad x\geq0\end{eqnarray*} + +\end_inset + + where the incomplete beta integral is +\begin_inset Formula \[ +I_{x}\left(a,b\right)=\frac{\Gamma\left(a+b\right)}{\Gamma\left(a\right)\Gamma\left(b\right)}\int_{0}^{x}t^{a-1}\left(1-t\right)^{b-1}dt.\] + +\end_inset + + Now +\begin_inset Formula \begin{eqnarray*} +\mu & = & np\\ +\mu_{2} & = & np\left(1-p\right)\\ +\gamma_{1} & = & \frac{1-2p}{\sqrt{np\left(1-p\right)}}\\ +\gamma_{2} & = & \frac{1-6p\left(1-p\right)}{np\left(1-p\right)}.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\left[1-p\left(1-e^{t}\right)\right]^{n}\] + +\end_inset + + +\layout Section + +Boltzmann (truncated Planck) +\layout Standard + + +\begin_inset Formula \begin{eqnarray*} +p\left(k;N,\lambda\right) & = & \frac{1-e^{-\lambda}}{1-e^{-\lambda N}}\exp\left(-\lambda k\right)\quad k\in\left\{ 0,1,\ldots,N-1\right\} \\ +F\left(x;N,\lambda\right) & = & \left\{ \begin{array}{cc} +0 & x<0\\ +\frac{1-\exp\left[-\lambda\left(\left\lfloor x\right\rfloor +1\right)\right]}{1-\exp\left(-\lambda N\right)} & 0\leq x\leq N-1\\ +1 & x\geq N-1\end{array}\right.\\ +G\left(q,\lambda\right) & = & \left\lceil -\frac{1}{\lambda}\log\left[1-q\left(1-e^{-\lambda N}\right)\right]-1\right\rceil \end{eqnarray*} + +\end_inset + + Define +\begin_inset Formula $z=e^{-\lambda}$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{z}{1-z}-\frac{Nz^{N}}{1-z^{N}}\\ +\mu_{2} & = & \frac{z}{\left(1-z\right)^{2}}-\frac{N^{2}z^{N}}{\left(1-z^{N}\right)^{2}}\\ +\gamma_{1} & = & \frac{z\left(1+z\right)\left(\frac{1-z^{N}}{1-z}\right)^{3}-N^{3}z^{N}\left(1+z^{N}\right)}{\left[z\left(\frac{1-z^{N}}{1-z}\right)^{2}-N^{2}z^{N}\right]^{3/2}}\\ +\gamma_{2} & = & \frac{z\left(1+4z+z^{2}\right)\left(\frac{1-z^{N}}{1-z}\right)^{4}-N^{4}z^{N}\left(1+4z^{N}+z^{2N}\right)}{\left[z\left(\frac{1-z^{N}}{1-z}\right)^{2}-N^{2}z^{N}\right]^{2}}\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \[ +M\left(t\right)=\frac{1-e^{N\left(t-\lambda\right)}}{1-e^{t-\lambda}}\frac{1-e^{-\lambda}}{1-e^{-\lambda N}}\] + +\end_inset + + +\layout Section + +Planck (discrete exponential) +\layout Standard + +Named Planck because of its relationship to the black-body problem he solved. + +\layout Standard + + +\begin_inset Formula \begin{eqnarray*} +p\left(k;\lambda\right) & = & \left(1-e^{-\lambda}\right)e^{-\lambda k}\quad k\lambda\geq0\\ +F\left(x;\lambda\right) & = & 1-e^{-\lambda\left(\left\lfloor x\right\rfloor +1\right)}\quad x\lambda\geq0\\ +G\left(q;\lambda\right) & = & \left\lceil -\frac{1}{\lambda}\log\left[1-q\right]-1\right\rceil .\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \frac{1}{e^{\lambda}-1}\\ +\mu_{2} & = & \frac{e^{-\lambda}}{\left(1-e^{-\lambda}\right)^{2}}\\ +\gamma_{1} & = & 2\cosh\left(\frac{\lambda}{2}\right)\\ +\gamma_{2} & = & 4+2\cosh\left(\lambda\right)\end{eqnarray*} + +\end_inset + + +\layout Standard + + +\begin_inset Formula \[ +M\left(t\right)=\frac{1-e^{-\lambda}}{1-e^{t-\lambda}}\] + +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=\frac{\lambda e^{-\lambda}}{1-e^{-\lambda}}-\log\left(1-e^{-\lambda}\right)\] + +\end_inset + + +\layout Section + +Poisson +\layout Standard + +The Poisson random variable counts the number of successes in +\begin_inset Formula $n$ +\end_inset + + independent Bernoulli trials in the limit as +\begin_inset Formula $n\rightarrow\infty$ +\end_inset + + and +\begin_inset Formula $p\rightarrow0$ +\end_inset + + where the probability of success in each trial is +\begin_inset Formula $p$ +\end_inset + + and +\begin_inset Formula $np=\lambda\geq0$ +\end_inset + + is a constant. + It can be used to approximate the Binomial random variable or in it's own + right to count the number of events that occur in the interval +\begin_inset Formula $\left[0,t\right]$ +\end_inset + + for a process satisfying certain +\begin_inset Quotes eld +\end_inset + +sparsity +\begin_inset Quotes erd +\end_inset + + constraints. + The functions are +\begin_inset Formula \begin{eqnarray*} +p\left(k;\lambda\right) & = & e^{-\lambda}\frac{\lambda^{k}}{k!}\quad k\geq0,\\ +F\left(x;\lambda\right) & = & \sum_{n=0}^{\left\lfloor x\right\rfloor }e^{-\lambda}\frac{\lambda^{n}}{n!}=\frac{1}{\Gamma\left(\left\lfloor x\right\rfloor +1\right)}\int_{\lambda}^{\infty}t^{\left\lfloor x\right\rfloor }e^{-t}dt,\\ +\mu & = & \lambda\\ +\mu_{2} & = & \lambda\\ +\gamma_{1} & = & \frac{1}{\sqrt{\lambda}}\\ +\gamma_{2} & = & \frac{1}{\lambda}.\end{eqnarray*} + +\end_inset + + +\layout Standard + + +\begin_inset Formula \[ +M\left(t\right)=\exp\left[\lambda\left(e^{t}-1\right)\right].\] + +\end_inset + + +\layout Section + +Geometric +\layout Standard + +The geometric random variable with parameter +\begin_inset Formula $p\in\left(0,1\right)$ +\end_inset + + can be defined as the number of trials required to obtain a success where + the probability of success on each trial is +\begin_inset Formula $p$ +\end_inset + +. + Thus, +\begin_inset Formula \begin{eqnarray*} +p\left(k;p\right) & = & \left(1-p\right)^{k-1}p\quad k\geq1\\ +F\left(x;p\right) & = & 1-\left(1-p\right)^{\left\lfloor x\right\rfloor }\quad x\geq1\\ +G\left(q;p\right) & = & \left\lceil \frac{\log\left(1-q\right)}{\log\left(1-p\right)}\right\rceil \\ +\mu & = & \frac{1}{p}\\ +\mu_{2} & = & \frac{1-p}{p^{2}}\\ +\gamma_{1} & = & \frac{2-p}{\sqrt{1-p}}\\ +\gamma_{2} & = & \frac{p^{2}-6p+6}{1-p}.\end{eqnarray*} + +\end_inset + + +\layout Standard + + +\begin_inset Formula \begin{eqnarray*} +M\left(t\right) & = & \frac{p}{e^{-t}-\left(1-p\right)}\end{eqnarray*} + +\end_inset + + +\layout Section + +Negative Binomial +\layout Standard + +The negative binomial random variable with parameters +\begin_inset Formula $n$ +\end_inset + + and +\begin_inset Formula $p\in\left(0,1\right)$ +\end_inset + + can be defined as the number of +\emph on +extra +\emph default +independent trials (beyond +\begin_inset Formula $n$ +\end_inset + +) required to accumulate a total of +\begin_inset Formula $n$ +\end_inset + + successes where the probability of a success on each trial is +\begin_inset Formula $p.$ +\end_inset + + Equivalently, this random variable is the number of failures encoutered + while accumulating +\begin_inset Formula $n$ +\end_inset + + successes during independent trials of an experiment that succeeds with + probability +\begin_inset Formula $p.$ +\end_inset + + Thus, +\begin_inset Formula \begin{eqnarray*} +p\left(k;n,p\right) & = & \left(\begin{array}{c} +k+n-1\\ +n-1\end{array}\right)p^{n}\left(1-p\right)^{k}\quad k\geq0\\ +F\left(x;n,p\right) & = & \sum_{i=0}^{\left\lfloor x\right\rfloor }\left(\begin{array}{c} +i+n-1\\ +i\end{array}\right)p^{n}\left(1-p\right)^{i}\quad x\geq0\\ + & = & I_{p}\left(n,\left\lfloor x\right\rfloor +1\right)\quad x\geq0\\ +\mu & = & n\frac{1-p}{p}\\ +\mu_{2} & = & n\frac{1-p}{p^{2}}\\ +\gamma_{1} & = & \frac{2-p}{\sqrt{n\left(1-p\right)}}\\ +\gamma_{2} & = & \frac{p^{2}+6\left(1-p\right)}{n\left(1-p\right)}.\end{eqnarray*} + +\end_inset + + Recall that +\begin_inset Formula $I_{p}\left(a,b\right)$ +\end_inset + + is the incomplete beta integral. + +\layout Section + +Hypergeometric +\layout Standard + +The hypergeometric random variable with parameters +\begin_inset Formula $\left(M,n,N\right)$ +\end_inset + + counts the number of +\begin_inset Quotes eld +\end_inset + +good +\begin_inset Quotes erd +\end_inset + + objects in a sample of size +\begin_inset Formula $N$ +\end_inset + + chosen without replacement from a population of +\begin_inset Formula $M$ +\end_inset + + objects where +\begin_inset Formula $n$ +\end_inset + + is the number of +\begin_inset Quotes eld +\end_inset + +good +\begin_inset Quotes erd +\end_inset + + objects in the total population. + +\begin_inset Formula \begin{eqnarray*} +p\left(k;N,n,M\right) & = & \frac{\left(\begin{array}{c} +n\\ +k\end{array}\right)\left(\begin{array}{c} +M-n\\ +N-k\end{array}\right)}{\left(\begin{array}{c} +M\\ +N\end{array}\right)}\quad N-\left(M-n\right)\leq k\leq\min\left(n,N\right)\\ +F\left(x;N,n,M\right) & = & \sum_{k=0}^{\left\lfloor x\right\rfloor }\frac{\left(\begin{array}{c} +m\\ +k\end{array}\right)\left(\begin{array}{c} +N-m\\ +n-k\end{array}\right)}{\left(\begin{array}{c} +N\\ +n\end{array}\right)},\\ +\mu & = & \frac{nN}{M}\\ +\mu_{2} & = & \frac{nN\left(M-n\right)\left(M-N\right)}{M^{2}\left(M-1\right)}\\ +\gamma_{1} & = & \frac{\left(M-2n\right)\left(M-2N\right)}{M-2}\sqrt{\frac{M-1}{nN\left(M-m\right)\left(M-n\right)}}\\ +\gamma_{2} & = & \frac{g\left(N,n,M\right)}{nN\left(M-n\right)\left(M-3\right)\left(M-2\right)\left(N-M\right)}\end{eqnarray*} + +\end_inset + + where (defining +\begin_inset Formula $m=M-n$ +\end_inset + +) +\begin_inset Formula \begin{eqnarray*} +g\left(N,n,M\right) & = & m^{3}-m^{5}+3m^{2}n-6m^{3}n+m^{4}n+3mn^{2}\\ + & & -12m^{2}n^{2}+8m^{3}n^{2}+n^{3}-6mn^{3}+8m^{2}n^{3}\\ + & & +mn^{4}-n^{5}-6m^{3}N+6m^{4}N+18m^{2}nN\\ + & & -6m^{3}nN+18mn^{2}N-24m^{2}n^{2}N-6n^{3}N\\ + & & -6mn^{3}N+6n^{4}N+6m^{2}N^{2}-6m^{3}N^{2}-24mnN^{2}\\ + & & +12m^{2}nN^{2}+6n^{2}N^{2}+12mn^{2}N^{2}-6n^{3}N^{2}.\end{eqnarray*} + +\end_inset + + +\layout Section + +Zipf (Zeta) +\layout Standard + +A random variable has the zeta distribution (also called the zipf distribution) + with parameter +\begin_inset Formula $\alpha>1$ +\end_inset + + if it's probability mass function is given by +\begin_inset Formula \begin{eqnarray*} +p\left(k;\alpha\right) & = & \frac{1}{\zeta\left(\alpha\right)k^{\alpha}}\quad k\geq1\end{eqnarray*} + +\end_inset + +where +\begin_inset Formula \[ +\zeta\left(\alpha\right)=\sum_{n=1}^{\infty}\frac{1}{n^{\alpha}}\] + +\end_inset + + is the Riemann zeta function. + Other functions of this distribution are +\begin_inset Formula \begin{eqnarray*} +F\left(x;\alpha\right) & = & \frac{1}{\zeta\left(\alpha\right)}\sum_{k=1}^{\left\lfloor x\right\rfloor }\frac{1}{k^{\alpha}}\\ +\mu & = & \frac{\zeta_{1}}{\zeta_{0}}\quad\alpha>2\\ +\mu_{2} & = & \frac{\zeta_{2}\zeta_{0}-\zeta_{1}^{2}}{\zeta_{0}^{2}}\quad\alpha>3\\ +\gamma_{1} & = & \frac{\zeta_{3}\zeta_{0}^{2}-3\zeta_{0}\zeta_{1}\zeta_{2}+2\zeta_{1}^{3}}{\left[\zeta_{2}\zeta_{0}-\zeta_{1}^{2}\right]^{3/2}}\quad\alpha>4\\ +\gamma_{2} & = & \frac{\zeta_{4}\zeta_{0}^{3}-4\zeta_{3}\zeta_{1}\zeta_{0}^{2}+12\zeta_{2}\zeta_{1}^{2}\zeta_{0}-6\zeta_{1}^{4}-3\zeta_{2}^{2}\zeta_{0}^{2}}{\left(\zeta_{2}\zeta_{0}-\zeta_{1}^{2}\right)^{2}}.\end{eqnarray*} + +\end_inset + + +\layout Standard + + +\begin_inset Formula \begin{eqnarray*} +M\left(t\right) & = & \frac{\textrm{Li}_{\alpha}\left(e^{t}\right)}{\zeta\left(\alpha\right)}\end{eqnarray*} + +\end_inset + +where +\begin_inset Formula $\zeta_{i}=\zeta\left(\alpha-i\right)$ +\end_inset + + and +\begin_inset Formula $\textrm{Li}_{n}\left(z\right)$ +\end_inset + + is the +\begin_inset Formula $n^{\textrm{th}}$ +\end_inset + + polylogarithm function of +\begin_inset Formula $z$ +\end_inset + + defined as +\begin_inset Formula \[ +\textrm{Li}_{n}\left(z\right)\equiv\sum_{k=1}^{\infty}\frac{z^{k}}{k^{n}}\] + +\end_inset + + +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left.M^{\left(n\right)}\left(t\right)\right|_{t=0}=\left.\frac{\textrm{Li}_{\alpha-n}\left(e^{t}\right)}{\zeta\left(a\right)}\right|_{t=0}=\frac{\zeta\left(\alpha-n\right)}{\zeta\left(\alpha\right)}\] + +\end_inset + + +\layout Section + +Logarithmic (Log-Series, Series) +\layout Standard + +The logarimthic distribution with parameter +\begin_inset Formula $p$ +\end_inset + + has a probability mass function with terms proportional to the Taylor series + expansion of +\begin_inset Formula $\log\left(1-p\right)$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +p\left(k;p\right) & = & -\frac{p^{k}}{k\log\left(1-p\right)}\quad k\geq1\\ +F\left(x;p\right) & = & -\frac{1}{\log\left(1-p\right)}\sum_{k=1}^{\left\lfloor x\right\rfloor }\frac{p^{k}}{k}=1+\frac{p^{1+\left\lfloor x\right\rfloor }\Phi\left(p,1,1+\left\lfloor x\right\rfloor \right)}{\log\left(1-p\right)}\end{eqnarray*} + +\end_inset + +where +\begin_inset Formula \[ +\Phi\left(z,s,a\right)=\sum_{k=0}^{\infty}\frac{z^{k}}{\left(a+k\right)^{s}}\] + +\end_inset + + is the Lerch Transcendent. + Also define +\begin_inset Formula $r=\log\left(1-p\right)$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & -\frac{p}{\left(1-p\right)r}\\ +\mu_{2} & = & -\frac{p\left[p+r\right]}{\left(1-p\right)^{2}r^{2}}\\ +\gamma_{1} & = & -\frac{2p^{2}+3pr+\left(1+p\right)r^{2}}{r\left(p+r\right)\sqrt{-p\left(p+r\right)}}r\\ +\gamma_{2} & = & -\frac{6p^{3}+12p^{2}r+p\left(4p+7\right)r^{2}+\left(p^{2}+4p+1\right)r^{3}}{p\left(p+r\right)^{2}}.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +M\left(t\right) & = & -\frac{1}{\log\left(1-p\right)}\sum_{k=1}^{\infty}\frac{e^{tk}p^{k}}{k}\\ + & = & \frac{\log\left(1-pe^{t}\right)}{\log\left(1-p\right)}\end{eqnarray*} + +\end_inset + + Thus, +\begin_inset Formula \[ +\mu_{n}^{\prime}=\left.M^{\left(n\right)}\left(t\right)\right|_{t=0}=\left.\frac{\textrm{Li}_{1-n}\left(pe^{t}\right)}{\log\left(1-p\right)}\right|_{t=0}=-\frac{\textrm{Li}_{1-n}\left(p\right)}{\log\left(1-p\right)}.\] + +\end_inset + + +\layout Section + +Discrete Uniform (randint) +\layout Standard + +The discrete uniform distribution with parameters +\begin_inset Formula $\left(a,b\right)$ +\end_inset + + constructs a random variable that has an equal probability of being any + one of the integers in the half-open range +\begin_inset Formula $[a,b).$ +\end_inset + + If +\begin_inset Formula $a$ +\end_inset + + is not given it is assumed to be zero and the only parameter is +\begin_inset Formula $b.$ +\end_inset + + Therefore, +\begin_inset Formula \begin{eqnarray*} +p\left(k;a,b\right) & = & \frac{1}{b-a}\quad a\leq k0$ +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +p\left(k\right) & = & \tanh\left(\frac{a}{2}\right)e^{-a\left|k\right|},\\ +F\left(x\right) & = & \left\{ \begin{array}{cc} +\frac{e^{a\left(\left\lfloor x\right\rfloor +1\right)}}{e^{a}+1} & \left\lfloor x\right\rfloor <0,\\ +1-\frac{e^{-a\left\lfloor x\right\rfloor }}{e^{a}+1} & \left\lfloor x\right\rfloor \geq0.\end{array}\right.\\ +G\left(q\right) & = & \left\{ \begin{array}{cc} +\left\lceil \frac{1}{a}\log\left[q\left(e^{a}+1\right)\right]-1\right\rceil & q<\frac{1}{1+e^{-a}},\\ +\left\lceil -\frac{1}{a}\log\left[\left(1-q\right)\left(1+e^{a}\right)\right]\right\rceil & q\geq\frac{1}{1+e^{-a}}.\end{array}\right.\end{eqnarray*} + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +M\left(t\right) & = & \tanh\left(\frac{a}{2}\right)\sum_{k=-\infty}^{\infty}e^{tk}e^{-a\left|k\right|}\\ + & = & C\left(1+\sum_{k=1}^{\infty}e^{-\left(t+a\right)k}+\sum_{1}^{\infty}e^{\left(t-a\right)k}\right)\\ + & = & \tanh\left(\frac{a}{2}\right)\left(1+\frac{e^{-\left(t+a\right)}}{1-e^{-\left(t+a\right)}}+\frac{e^{t-a}}{1-e^{t-a}}\right)\\ + & = & \frac{\tanh\left(\frac{a}{2}\right)\sinh a}{\cosh a-\cosh t}.\end{eqnarray*} + +\end_inset + + Thus, +\begin_inset Formula \[ +\mu_{n}^{\prime}=M^{\left(n\right)}\left(0\right)=\left[1+\left(-1\right)^{n}\right]\textrm{Li}_{-n}\left(e^{-a}\right)\] + +\end_inset + + where +\begin_inset Formula $\textrm{Li}_{-n}\left(z\right)$ +\end_inset + + is the polylogarithm function of order +\begin_inset Formula $-n$ +\end_inset + + evaluated at +\begin_inset Formula $z.$ +\end_inset + + +\begin_inset Formula \[ +h\left[X\right]=-\log\left(\tanh\left(\frac{a}{2}\right)\right)+\frac{a}{\sinh a}\] + +\end_inset + + +\layout Section + +Discrete Gaussian* +\layout Standard + +Defined for all +\begin_inset Formula $\mu$ +\end_inset + + and +\begin_inset Formula $\lambda>0$ +\end_inset + + and +\begin_inset Formula $k$ +\end_inset + + +\begin_inset Formula \[ +p\left(k;\mu,\lambda\right)=\frac{1}{Z\left(\lambda\right)}\exp\left[-\lambda\left(k-\mu\right)^{2}\right]\] + +\end_inset + + where +\begin_inset Formula \[ +Z\left(\lambda\right)=\sum_{k=-\infty}^{\infty}\exp\left[-\lambda k^{2}\right]\] + +\end_inset + + +\begin_inset Formula \begin{eqnarray*} +\mu & = & \mu\\ +\mu_{2} & = & -\frac{\partial}{\partial\lambda}\log Z\left(\lambda\right)\\ + & = & G\left(\lambda\right)e^{-\lambda}\end{eqnarray*} + +\end_inset + + where +\begin_inset Formula $G\left(0\right)\rightarrow\infty$ +\end_inset + + and +\begin_inset Formula $G\left(\infty\right)\rightarrow2$ +\end_inset + + with a minimum less than 2 near +\begin_inset Formula $\lambda=1$ +\end_inset + + +\begin_inset Formula \[ +G\left(\lambda\right)=\frac{1}{Z\left(\lambda\right)}\sum_{k=-\infty}^{\infty}k^{2}\exp\left[-\lambda\left(k+1\right)\left(k-1\right)\right]\] + +\end_inset + + +\the_end From scipy-svn at scipy.org Tue Jun 1 01:51:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 00:51:53 -0500 (CDT) Subject: [Scipy-svn] r6463 - branches/0.8.x/scipy/stats Message-ID: <20100601055153.9A92339CAEA@scipy.org> Author: oliphant Date: 2010-06-01 00:51:53 -0500 (Tue, 01 Jun 2010) New Revision: 6463 Modified: branches/0.8.x/scipy/stats/distributions.py Log: Add documentationfor more new methods of distributions. Fix an indentation bug in expect. Use super when calling parent class methods. Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-01 04:09:28 UTC (rev 6462) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-01 05:51:53 UTC (rev 6463) @@ -5,10 +5,14 @@ # SciPy Developers 2004-2010 # +import math +from copy import copy + from scipy.misc import comb, derivative from scipy import special from scipy import optimize from scipy import integrate +from scipy.special import gammaln as gamln import inspect from numpy import alltrue, where, arange, putmask, \ @@ -22,8 +26,6 @@ import numpy as np import numpy.random as mtrand from numpy import flatnonzero as nonzero -from scipy.special import gammaln as gamln -from copy import copy import vonmises_cython def _moment(data, n, mu=None): @@ -562,34 +564,112 @@ return vals def median(self, *args, **kwds): + """ + Median of the distribution. + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + median : float + the median of the distribution. + + See Also + -------- + self.ppf --- inverse of the CDF + """ return self.ppf(0.5, *args, **kwds) def mean(self, *args, **kwds): + """ + Mean of the distribution + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + mean : float + the mean of the distribution + """ kwds['moments'] = 'm' res = self.stats(*args, **kwds) if isinstance(res, ndarray) and res.ndim == 0: return res[()] + return res def var(self, *args, **kwds): + """ + Variance of the distribution + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + var : float + the variance of the distribution + + """ kwds['moments'] = 'v' res = self.stats(*args, **kwds) if isinstance(res, ndarray) and res.ndim == 0: return res[()] - else: - return res + return res def std(self, *args, **kwds): + """ + Standard deviation of the distribution. + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + std : float + standard deviation of the distribution + + """ kwds['moments'] = 'v' - res = sqrt(self.stats(*args, **kwds)) + res = math.sqrt(self.stats(*args, **kwds)) return res def interval(self, alpha, *args, **kwds): - """Confidence interval centered on the median + """Confidence interval with equal areas around the median Parameters ---------- alpha : array-like float in [0,1] - Probability that an rv will be drawn from the returned range + Probability that an rv will be drawn from the returned range arg1, arg2, ... : array-like The shape parameter(s) for the distribution (see docstring of the instance object for more information) @@ -1606,10 +1686,10 @@ """ if func is None: def fun(x, *args): - return x*self.pdf(x, *args, loc=loc, scale=scale) + return x*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) else: def fun(x, *args): - return func(x)*self.pdf(x, *args, loc=loc, scale=scale) + return func(x)*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) if lb is None: lb = (self.a - loc)/(1.0*scale) if ub is None: @@ -1618,8 +1698,8 @@ invfac = self.sf(lb,*args) - self.sf(ub,*args) else: invfac = 1.0 - kwds['args'] = args - return integrate.quad(fun, lb, ub, **kwds)[0] / invfac + kwds['args'] = args + return integrate.quad(fun, lb, ub, **kwds)[0] / invfac _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) @@ -1659,7 +1739,6 @@ # loc = mu, scale = std # Keep these implementations out of the class definition so they can be reused # by other distributions. -import math _norm_pdf_C = math.sqrt(2*pi) _norm_pdf_logC = math.log(_norm_pdf_C) def _norm_pdf(x): @@ -4482,7 +4561,7 @@ moment_tol=1e-8,values=None,inc=1,longname=None, shapes=None, extradoc=None): - rv_generic.__init__(self) + super(rv_generic,self).__init__() if badvalue is None: badvalue = nan @@ -5181,15 +5260,15 @@ Parameters ---------- - fn : function (default: identity mapping) + fn : function (default: identity mapping) Function for which integral is calculated. Takes only one argument. - args : tuple + args : tuple argument (parameters) of the distribution - optional keyword parameters - lb, ub : numbers + optional keyword parameters + lb, ub : numbers lower and upper bound for integration, default is set to the support of the distribution, lb and ub are inclusive (ul<=k<=ub) - conditional : boolean (False) + conditional : boolean (False) If true then the expectation is corrected by the conditional probability of the integration interval. The return value is the expectation of the function, conditional on being in the given @@ -5197,7 +5276,7 @@ Returns ------- - expected value : float + expected value : float Notes ----- @@ -5214,7 +5293,6 @@ (a maximum of suppnmin+1000 positive plus suppnmin+1000 negative integers are evaluated) - """ #moment_tol = 1e-12 # increase compared to self.moment_tol, @@ -5274,7 +5352,7 @@ pos -= self.inc count += 1 if count > maxcount: - # replace with proper warning + # fixme: replace with proper warning print 'sum did not converge' return tot/invfac From scipy-svn at scipy.org Tue Jun 1 01:54:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 00:54:12 -0500 (CDT) Subject: [Scipy-svn] r6464 - trunk/scipy/stats Message-ID: <20100601055412.2E27839CAEA@scipy.org> Author: oliphant Date: 2010-06-01 00:54:12 -0500 (Tue, 01 Jun 2010) New Revision: 6464 Modified: trunk/scipy/stats/distributions.py Log: Apply docstring clean-up patch and bug fixes in 0.8.x branch to trunk. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-01 05:51:53 UTC (rev 6463) +++ trunk/scipy/stats/distributions.py 2010-06-01 05:54:12 UTC (rev 6464) @@ -5,10 +5,14 @@ # SciPy Developers 2004-2010 # +import math +from copy import copy + from scipy.misc import comb, derivative from scipy import special from scipy import optimize from scipy import integrate +from scipy.special import gammaln as gamln import inspect from numpy import alltrue, where, arange, putmask, \ @@ -22,8 +26,6 @@ import numpy as np import numpy.random as mtrand from numpy import flatnonzero as nonzero -from scipy.special import gammaln as gamln -from copy import copy import vonmises_cython def _moment(data, n, mu=None): @@ -562,34 +564,112 @@ return vals def median(self, *args, **kwds): + """ + Median of the distribution. + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + median : float + the median of the distribution. + + See Also + -------- + self.ppf --- inverse of the CDF + """ return self.ppf(0.5, *args, **kwds) def mean(self, *args, **kwds): + """ + Mean of the distribution + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + mean : float + the mean of the distribution + """ kwds['moments'] = 'm' res = self.stats(*args, **kwds) if isinstance(res, ndarray) and res.ndim == 0: return res[()] + return res def var(self, *args, **kwds): + """ + Variance of the distribution + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + var : float + the variance of the distribution + + """ kwds['moments'] = 'v' res = self.stats(*args, **kwds) if isinstance(res, ndarray) and res.ndim == 0: return res[()] - else: - return res + return res def std(self, *args, **kwds): + """ + Standard deviation of the distribution. + + Parameters + ---------- + arg1, arg2, arg3,... : array-like + The shape parameter(s) for the distribution (see docstring of the + instance object for more information) + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + + Returns + ------- + std : float + standard deviation of the distribution + + """ kwds['moments'] = 'v' - res = sqrt(self.stats(*args, **kwds)) + res = math.sqrt(self.stats(*args, **kwds)) return res def interval(self, alpha, *args, **kwds): - """Confidence interval centered on the median + """Confidence interval with equal areas around the median Parameters ---------- alpha : array-like float in [0,1] - Probability that an rv will be drawn from the returned range + Probability that an rv will be drawn from the returned range arg1, arg2, ... : array-like The shape parameter(s) for the distribution (see docstring of the instance object for more information) @@ -1605,10 +1685,10 @@ """ if func is None: def fun(x, *args): - return x*self.pdf(x, *args, loc=loc, scale=scale) + return x*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) else: def fun(x, *args): - return func(x)*self.pdf(x, *args, loc=loc, scale=scale) + return func(x)*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) if lb is None: lb = (self.a - loc)/(1.0*scale) if ub is None: @@ -1617,8 +1697,8 @@ invfac = self.sf(lb,*args) - self.sf(ub,*args) else: invfac = 1.0 - kwds['args'] = args - return integrate.quad(fun, lb, ub, **kwds)[0] / invfac + kwds['args'] = args + return integrate.quad(fun, lb, ub, **kwds)[0] / invfac _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) @@ -1658,7 +1738,6 @@ # loc = mu, scale = std # Keep these implementations out of the class definition so they can be reused # by other distributions. -import math _norm_pdf_C = math.sqrt(2*pi) _norm_pdf_logC = math.log(_norm_pdf_C) def _norm_pdf(x): @@ -4481,7 +4560,7 @@ moment_tol=1e-8,values=None,inc=1,longname=None, shapes=None, extradoc=None): - rv_generic.__init__(self) + super(rv_generic,self).__init__() if badvalue is None: badvalue = nan @@ -5180,15 +5259,15 @@ Parameters ---------- - fn : function (default: identity mapping) + fn : function (default: identity mapping) Function for which integral is calculated. Takes only one argument. - args : tuple + args : tuple argument (parameters) of the distribution - optional keyword parameters - lb, ub : numbers + optional keyword parameters + lb, ub : numbers lower and upper bound for integration, default is set to the support of the distribution, lb and ub are inclusive (ul<=k<=ub) - conditional : boolean (False) + conditional : boolean (False) If true then the expectation is corrected by the conditional probability of the integration interval. The return value is the expectation of the function, conditional on being in the given @@ -5196,7 +5275,7 @@ Returns ------- - expected value : float + expected value : float Notes ----- @@ -5213,7 +5292,6 @@ (a maximum of suppnmin+1000 positive plus suppnmin+1000 negative integers are evaluated) - """ #moment_tol = 1e-12 # increase compared to self.moment_tol, @@ -5273,7 +5351,7 @@ pos -= self.inc count += 1 if count > maxcount: - # replace with proper warning + # fixme: replace with proper warning print 'sum did not converge' return tot/invfac From scipy-svn at scipy.org Tue Jun 1 03:58:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 02:58:06 -0500 (CDT) Subject: [Scipy-svn] r6465 - branches/0.8.x/scipy/stats/tests Message-ID: <20100601075806.DFE0639CAF8@scipy.org> Author: oliphant Date: 2010-06-01 02:58:06 -0500 (Tue, 01 Jun 2010) New Revision: 6465 Modified: branches/0.8.x/scipy/stats/tests/test_distributions.py Log: Add test for fit method including test for fixing number of parameters. Testing interface and calling only. Does not do a statistical test on the computed parameters. Modified: branches/0.8.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_distributions.py 2010-06-01 05:54:12 UTC (rev 6464) +++ branches/0.8.x/scipy/stats/tests/test_distributions.py 2010-06-01 07:58:06 UTC (rev 6465) @@ -380,6 +380,47 @@ assert_array_equal(b, a) assert_array_equal(c, [2] * numpy.size(a)) +import sys +class TestFitMethod(TestCase): + skip = ['ncf'] + def test_fit(self): + for func, dist, args, alpha in test_all_distributions(): + if dist in self.skip: + continue + distfunc = getattr(stats, dist) + res = distfunc.rvs(*args, size=200) + vals = distfunc.fit(res) + if dist in ['erlang', 'frechet']: + assert(len(vals)==len(args)) + else: + assert(len(vals) == 2+len(args)) + def test_fix_fit(self): + for func, dist, args, alpha in test_all_distributions(): + # Not sure why 'ncf', and 'beta' are failing + # erlang and frechet have different len(args) than distfunc.numargs + if dist in self.skip + ['erlang', 'frechet', 'beta']: + continue + distfunc = getattr(stats, dist) + res = distfunc.rvs(*args, size=200) + vals = distfunc.fit(res,floc=0) + vals2 = distfunc.fit(res,fscale=1) + assert(len(vals) == 2+len(args)) + assert(vals[-2] == 0) + assert(vals2[-1] == 1) + assert(len(vals2) == 2+len(args)) + if len(args) > 0: + vals3 = distfunc.fit(res, f0=args[0]) + assert(len(vals3) == 2+len(args)) + assert(vals3[0] == args[0]) + if len(args) > 1: + vals4 = distfunc.fit(res, f1=args[1]) + assert(len(vals4) == 2+len(args)) + assert(vals4[1] == args[1]) + if len(args) > 2: + vals5 = distfunc.fit(res, f2=args[2]) + assert(len(vals5) == 2+len(args)) + assert(vals5[2] == args[2]) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Jun 1 03:59:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 02:59:21 -0500 (CDT) Subject: [Scipy-svn] r6466 - trunk/scipy/stats/tests Message-ID: <20100601075921.0D2B339CAF8@scipy.org> Author: oliphant Date: 2010-06-01 02:59:20 -0500 (Tue, 01 Jun 2010) New Revision: 6466 Modified: trunk/scipy/stats/tests/test_distributions.py Log: Add tests for fit method including fixing input parameters. Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2010-06-01 07:58:06 UTC (rev 6465) +++ trunk/scipy/stats/tests/test_distributions.py 2010-06-01 07:59:20 UTC (rev 6466) @@ -380,6 +380,47 @@ assert_array_equal(b, a) assert_array_equal(c, [2] * numpy.size(a)) +import sys +class TestFitMethod(TestCase): + skip = ['ncf'] + def test_fit(self): + for func, dist, args, alpha in test_all_distributions(): + if dist in self.skip: + continue + distfunc = getattr(stats, dist) + res = distfunc.rvs(*args, size=200) + vals = distfunc.fit(res) + if dist in ['erlang', 'frechet']: + assert(len(vals)==len(args)) + else: + assert(len(vals) == 2+len(args)) + def test_fix_fit(self): + for func, dist, args, alpha in test_all_distributions(): + # Not sure why 'ncf', and 'beta' are failing + # erlang and frechet have different len(args) than distfunc.numargs + if dist in self.skip + ['erlang', 'frechet', 'beta']: + continue + distfunc = getattr(stats, dist) + res = distfunc.rvs(*args, size=200) + vals = distfunc.fit(res,floc=0) + vals2 = distfunc.fit(res,fscale=1) + assert(len(vals) == 2+len(args)) + assert(vals[-2] == 0) + assert(vals2[-1] == 1) + assert(len(vals2) == 2+len(args)) + if len(args) > 0: + vals3 = distfunc.fit(res, f0=args[0]) + assert(len(vals3) == 2+len(args)) + assert(vals3[0] == args[0]) + if len(args) > 1: + vals4 = distfunc.fit(res, f1=args[1]) + assert(len(vals4) == 2+len(args)) + assert(vals4[1] == args[1]) + if len(args) > 2: + vals5 = distfunc.fit(res, f2=args[2]) + assert(len(vals5) == 2+len(args)) + assert(vals5[2] == args[2]) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Jun 1 04:47:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 03:47:56 -0500 (CDT) Subject: [Scipy-svn] r6467 - in trunk: doc/release scipy/linalg scipy/linalg/tests Message-ID: <20100601084756.98B9339CAF5@scipy.org> Author: warren.weckesser Date: 2010-06-01 03:47:56 -0500 (Tue, 01 Jun 2010) New Revision: 6467 Modified: trunk/doc/release/0.8.0-notes.rst trunk/scipy/linalg/basic.py trunk/scipy/linalg/tests/test_basic.py Log: DEP: Revert a change made to solveh_banded, and add a deprecation warning so the change can eventually be made for the 0.9 release. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-06-01 07:59:20 UTC (rev 6466) +++ trunk/doc/release/0.8.0-notes.rst 2010-06-01 08:47:56 UTC (rev 6467) @@ -61,6 +61,12 @@ The modules `helpmod`, `ppimport` and `pexec` from `scipy.misc` are deprecated. They will be removed from SciPy in version 0.9. +Additional deprecations +----------------------- +* linalg: The function `solveh_banded` currently returns a tuple containing + the Cholesky factorization and the solution to the linear system. In + SciPy 0.9, the return value will be just the solution. + New features ============ Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-06-01 07:59:20 UTC (rev 6466) +++ trunk/scipy/linalg/basic.py 2010-06-01 08:47:56 UTC (rev 6467) @@ -6,6 +6,8 @@ __all__ = ['solve', 'solveh_banded', 'solve_banded', 'inv', 'det', 'lstsq', 'pinv', 'pinv2'] +from warnings import warn + from numpy import asarray, zeros, sum, conjugate, dot, transpose, \ asarray_chkfinite, single import numpy @@ -165,10 +167,20 @@ Returns ------- + c : array, shape (u+1, M) + Cholesky factorization of a, in the same banded format as ab x : array, shape (M,) or (M, K) The solution to the system a x = b + + Notes + ----- + The inclusion of `c` in the return value is deprecated. In SciPy + version 0.9, the return value will be the solution `x` only. """ + warn("In SciPy 0.9, the return value of solveh_banded will be " + "the solution x only.", DeprecationWarning) + ab, b = map(asarray_chkfinite, (ab, b)) # Validate shapes. @@ -183,7 +195,7 @@ if info < 0: raise ValueError('illegal value in %d-th argument of internal pbsv' % -info) - return x + return c, x # matrix inversion Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-06-01 07:59:20 UTC (rev 6466) +++ trunk/scipy/linalg/tests/test_basic.py 2010-06-01 08:47:56 UTC (rev 6467) @@ -19,6 +19,8 @@ python tests/test_basic.py """ +import warnings + from numpy import arange, array, dot, zeros, identity, conjugate, transpose, \ float32, zeros_like import numpy.linalg as linalg @@ -98,8 +100,12 @@ class TestSolveHBanded(TestCase): + # solveh_banded currently has a DeprecationWarning. When the warning + # is removed in scipy 0.9, the 'ignore' filters and the test for the + # warning can be removed. def test_01_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -107,10 +113,17 @@ # with the RHS as a 1D array. ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) + # Remove the following part of this test in scipy 0.9. + a = array([[4.0, 1.0, 0.0], [1.0, 4.0, 1.0], [0.0, 1.0, 4.0]]) + fac = zeros_like(a) + fac[range(3),range(3)] = c[-1] + fac[(0,1),(1,2)] = c[0,1:] + assert_array_almost_equal(a, dot(fac.T, fac)) def test_02_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -121,13 +134,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_03_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -135,10 +149,11 @@ # with the RHS as a 2D array with shape (3,1). ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]).reshape(-1,1) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, array([0.0, 1.0, 0.0]).reshape(-1,1)) def test_01_lower(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -147,10 +162,11 @@ ab = array([[4.0, 4.0, 4.0], [1.0, 1.0, -99]]) b = array([1.0, 4.0, 1.0]) - x = solveh_banded(ab, b, lower=True) + c, x = solveh_banded(ab, b, lower=True) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_lower(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -161,13 +177,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - x = solveh_banded(ab, b, lower=True) + c, x = solveh_banded(ab, b, lower=True) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_float32(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -175,10 +192,11 @@ # ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]], dtype=float32) b = array([1.0, 4.0, 1.0], dtype=float32) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_float32(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -189,13 +207,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]], dtype=float32) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_complex(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j] # [ j 4 -j] X = [4-j] @@ -203,10 +222,11 @@ # ab = array([[-99, -1.0j, -1.0j], [4.0, 4.0, 4.0]]) b = array([-1.0j, 4.0-1j, 4+1j]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 1.0]) def test_02_complex(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j 4j] # [ j 4 -j] X = [4-j -1-j] @@ -217,13 +237,15 @@ b = array([[ -1j, 4.0j], [4.0-1j, -1.0-1j], [4.0+1j, 4.0]]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0j], [1.0, 0.0], [1.0, 1.0]]) assert_array_almost_equal(x, expected) def test_bad_shapes(self): + warnings.simplefilter('ignore', category=DeprecationWarning) + ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([[1.0, 4.0], @@ -232,6 +254,12 @@ assert_raises(ValueError, solveh_banded, ab, [1.0, 2.0]) assert_raises(ValueError, solveh_banded, ab, [1.0]) + def test_00_deprecation_warning(self): + warnings.simplefilter('error', category=DeprecationWarning) + ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) + b = array([1.0, 4.0, 1.0]) + assert_raises(DeprecationWarning, solveh_banded, ab, b) + #warnings.simplefilter('ignore', category=DeprecationWarning) class TestSolve(TestCase): From scipy-svn at scipy.org Tue Jun 1 04:50:32 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 03:50:32 -0500 (CDT) Subject: [Scipy-svn] r6468 - trunk/scipy/linalg/tests Message-ID: <20100601085032.1ACBB39CAF5@scipy.org> Author: warren.weckesser Date: 2010-06-01 03:50:31 -0500 (Tue, 01 Jun 2010) New Revision: 6468 Modified: trunk/scipy/linalg/tests/test_basic.py Log: Removed commented line of code. Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-06-01 08:47:56 UTC (rev 6467) +++ trunk/scipy/linalg/tests/test_basic.py 2010-06-01 08:50:31 UTC (rev 6468) @@ -259,8 +259,8 @@ ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]) assert_raises(DeprecationWarning, solveh_banded, ab, b) - #warnings.simplefilter('ignore', category=DeprecationWarning) + class TestSolve(TestCase): def test_20Feb04_bug(self): From scipy-svn at scipy.org Tue Jun 1 05:14:38 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 04:14:38 -0500 (CDT) Subject: [Scipy-svn] r6469 - in branches/0.8.x: doc/release scipy/linalg scipy/linalg/tests Message-ID: <20100601091438.4737639CAFC@scipy.org> Author: warren.weckesser Date: 2010-06-01 04:14:38 -0500 (Tue, 01 Jun 2010) New Revision: 6469 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst branches/0.8.x/scipy/linalg/basic.py branches/0.8.x/scipy/linalg/tests/test_basic.py Log: DEP: Revert a change made to solveh_banded, and add a deprecation warning so the change can eventually be made for the 0.9 release. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-01 08:50:31 UTC (rev 6468) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-01 09:14:38 UTC (rev 6469) @@ -61,6 +61,12 @@ The modules `helpmod`, `ppimport` and `pexec` from `scipy.misc` are deprecated. They will be removed from SciPy in version 0.9. +Additional deprecations +----------------------- +* linalg: The function `solveh_banded` currently returns a tuple containing + the Cholesky factorization and the solution to the linear system. In + SciPy 0.9, the return value will be just the solution. + New features ============ Modified: branches/0.8.x/scipy/linalg/basic.py =================================================================== --- branches/0.8.x/scipy/linalg/basic.py 2010-06-01 08:50:31 UTC (rev 6468) +++ branches/0.8.x/scipy/linalg/basic.py 2010-06-01 09:14:38 UTC (rev 6469) @@ -6,6 +6,8 @@ __all__ = ['solve', 'solveh_banded', 'solve_banded', 'inv', 'det', 'lstsq', 'pinv', 'pinv2'] +from warnings import warn + from numpy import asarray, zeros, sum, conjugate, dot, transpose, \ asarray_chkfinite, single import numpy @@ -165,10 +167,20 @@ Returns ------- + c : array, shape (u+1, M) + Cholesky factorization of a, in the same banded format as ab x : array, shape (M,) or (M, K) The solution to the system a x = b + + Notes + ----- + The inclusion of `c` in the return value is deprecated. In SciPy + version 0.9, the return value will be the solution `x` only. """ + warn("In SciPy 0.9, the return value of solveh_banded will be " + "the solution x only.", DeprecationWarning) + ab, b = map(asarray_chkfinite, (ab, b)) # Validate shapes. @@ -183,7 +195,7 @@ if info < 0: raise ValueError('illegal value in %d-th argument of internal pbsv' % -info) - return x + return c, x # matrix inversion Modified: branches/0.8.x/scipy/linalg/tests/test_basic.py =================================================================== --- branches/0.8.x/scipy/linalg/tests/test_basic.py 2010-06-01 08:50:31 UTC (rev 6468) +++ branches/0.8.x/scipy/linalg/tests/test_basic.py 2010-06-01 09:14:38 UTC (rev 6469) @@ -19,6 +19,8 @@ python tests/test_basic.py """ +import warnings + from numpy import arange, array, dot, zeros, identity, conjugate, transpose, \ float32, zeros_like import numpy.linalg as linalg @@ -98,8 +100,12 @@ class TestSolveHBanded(TestCase): + # solveh_banded currently has a DeprecationWarning. When the warning + # is removed in scipy 0.9, the 'ignore' filters and the test for the + # warning can be removed. def test_01_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -107,10 +113,17 @@ # with the RHS as a 1D array. ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) + # Remove the following part of this test in scipy 0.9. + a = array([[4.0, 1.0, 0.0], [1.0, 4.0, 1.0], [0.0, 1.0, 4.0]]) + fac = zeros_like(a) + fac[range(3),range(3)] = c[-1] + fac[(0,1),(1,2)] = c[0,1:] + assert_array_almost_equal(a, dot(fac.T, fac)) def test_02_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -121,13 +134,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_03_upper(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -135,10 +149,11 @@ # with the RHS as a 2D array with shape (3,1). ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([1.0, 4.0, 1.0]).reshape(-1,1) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, array([0.0, 1.0, 0.0]).reshape(-1,1)) def test_01_lower(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -147,10 +162,11 @@ ab = array([[4.0, 4.0, 4.0], [1.0, 1.0, -99]]) b = array([1.0, 4.0, 1.0]) - x = solveh_banded(ab, b, lower=True) + c, x = solveh_banded(ab, b, lower=True) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_lower(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -161,13 +177,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]]) - x = solveh_banded(ab, b, lower=True) + c, x = solveh_banded(ab, b, lower=True) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_float32(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1] # [ 1 4 1] X = [4] @@ -175,10 +192,11 @@ # ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]], dtype=float32) b = array([1.0, 4.0, 1.0], dtype=float32) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 0.0]) def test_02_float32(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 1 0] [1 4] # [ 1 4 1] X = [4 2] @@ -189,13 +207,14 @@ b = array([[1.0, 4.0], [4.0, 2.0], [1.0, 4.0]], dtype=float32) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0], [1.0, 0.0], [0.0, 1.0]]) assert_array_almost_equal(x, expected) def test_01_complex(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j] # [ j 4 -j] X = [4-j] @@ -203,10 +222,11 @@ # ab = array([[-99, -1.0j, -1.0j], [4.0, 4.0, 4.0]]) b = array([-1.0j, 4.0-1j, 4+1j]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) assert_array_almost_equal(x, [0.0, 1.0, 1.0]) def test_02_complex(self): + warnings.simplefilter('ignore', category=DeprecationWarning) # Solve # [ 4 -j 0] [ -j 4j] # [ j 4 -j] X = [4-j -1-j] @@ -217,13 +237,15 @@ b = array([[ -1j, 4.0j], [4.0-1j, -1.0-1j], [4.0+1j, 4.0]]) - x = solveh_banded(ab, b) + c, x = solveh_banded(ab, b) expected = array([[0.0, 1.0j], [1.0, 0.0], [1.0, 1.0]]) assert_array_almost_equal(x, expected) def test_bad_shapes(self): + warnings.simplefilter('ignore', category=DeprecationWarning) + ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) b = array([[1.0, 4.0], @@ -232,7 +254,13 @@ assert_raises(ValueError, solveh_banded, ab, [1.0, 2.0]) assert_raises(ValueError, solveh_banded, ab, [1.0]) + def test_00_deprecation_warning(self): + warnings.simplefilter('error', category=DeprecationWarning) + ab = array([[-99, 1.0, 1.0], [4.0, 4.0, 4.0]]) + b = array([1.0, 4.0, 1.0]) + assert_raises(DeprecationWarning, solveh_banded, ab, b) + class TestSolve(TestCase): def test_20Feb04_bug(self): From scipy-svn at scipy.org Tue Jun 1 05:18:15 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 04:18:15 -0500 (CDT) Subject: [Scipy-svn] r6470 - trunk/doc/release Message-ID: <20100601091815.30BDC39CAFD@scipy.org> Author: warren.weckesser Date: 2010-06-01 04:18:15 -0500 (Tue, 01 Jun 2010) New Revision: 6470 Modified: trunk/doc/release/0.8.0-notes.rst Log: DOC: Fix release notes--return value of solveh_banded is not changed. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-06-01 09:14:38 UTC (rev 6469) +++ trunk/doc/release/0.8.0-notes.rst 2010-06-01 09:18:15 UTC (rev 6470) @@ -126,9 +126,6 @@ The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. -The function `solveh_banded` no longer returns the Cholesky factorization. It -returns just the solution. - ARPACK-based sparse SVD ----------------------- From scipy-svn at scipy.org Tue Jun 1 05:19:15 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 04:19:15 -0500 (CDT) Subject: [Scipy-svn] r6471 - branches/0.8.x/doc/release Message-ID: <20100601091915.BE58839CAFD@scipy.org> Author: warren.weckesser Date: 2010-06-01 04:19:15 -0500 (Tue, 01 Jun 2010) New Revision: 6471 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: DOC: Fix release notes--return value of solveh_banded is not changed. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-01 09:18:15 UTC (rev 6470) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-01 09:19:15 UTC (rev 6471) @@ -126,9 +126,6 @@ The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. -The function `solveh_banded` no longer returns the Cholesky factorization. It -returns just the solution. - ARPACK-based sparse SVD ----------------------- From scipy-svn at scipy.org Tue Jun 1 06:10:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 05:10:30 -0500 (CDT) Subject: [Scipy-svn] r6472 - in trunk/scipy/stats: . tests Message-ID: <20100601101030.73FC439CAF5@scipy.org> Author: oliphant Date: 2010-06-01 05:10:30 -0500 (Tue, 01 Jun 2010) New Revision: 6472 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_continuous_basic.py Log: Add tests for logpdf, logcdf, and logsf plus one fix. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-01 09:19:15 UTC (rev 6471) +++ trunk/scipy/stats/distributions.py 2010-06-01 10:10:30 UTC (rev 6472) @@ -2332,7 +2332,7 @@ return exp(1)*b*xbm1 * exp(xb - exp(xb)) def _logpdf(self, x, b): xb = x**(b-1.0)*x - return log(b) + (b-1.0)*log(x) + xb - exp(xb) + return 1 + log(b) + (b-1.0)*log(x) + xb - exp(xb) def _cdf(self, x, b): xb = arr(x**b) return -expm1(-expm1(xb)) @@ -4282,11 +4282,13 @@ %(example)s """ def _rvs(self): - return invnorm_gen._rvs(self, 1.0) + return mtrand.wald(1.0, 1.0, size=self._size) def _pdf(self, x): - return invnorm.pdf(x,1.0) + return invnorm._pdf(x, 1.0) + def _logpdf(self, x): + return invnorm._logpdf(x, 1.0) def _cdf(self, x): - return invnorm.cdf(x,1,0) + return invnorm._logcdf(x, 1.0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 wald = wald_gen(a=0.0, name="wald", extradoc=""" Modified: trunk/scipy/stats/tests/test_continuous_basic.py =================================================================== --- trunk/scipy/stats/tests/test_continuous_basic.py 2010-06-01 09:19:15 UTC (rev 6471) +++ trunk/scipy/stats/tests/test_continuous_basic.py 2010-06-01 10:10:30 UTC (rev 6472) @@ -175,11 +175,14 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname + if distname in ['wald']: continue + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname if distname in distmissing: alpha = 0.01 - yield check_distribution_rvs, dist, args, alpha, rvs + # yield check_distribution_rvs, dist, args, alpha, rvs - @npt.dec.slow def test_cont_basic_slow(): # same as above for slow distributions @@ -202,14 +205,14 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname #yield check_oth, distfn, arg # is still missing if distname in distmissing: alpha = 0.01 yield check_distribution_rvs, dist, args, alpha, rvs - - - def check_moment(distfn, arg, m, v, msg): m1 = distfn.moment(1,*arg) m2 = distfn.moment(2,*arg) @@ -314,7 +317,37 @@ npt.assert_almost_equal(pdfv, cdfdiff, decimal=DECIMAL, err_msg= msg + ' - cdf-pdf relationship') +def check_pdf_logpdf(distfn, args, msg): + # compares pdf at several points with the log of the pdf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + pdf = distfn.pdf(vals, *args) + logpdf = distfn.logpdf(vals, *args) + pdf = pdf[pdf != 0] + logpdf = logpdf[np.isfinite(logpdf)] + npt.assert_almost_equal(np.log(pdf), logpdf, decimal=7, err_msg=msg + " - logpdf-log(pdf) relationship") +def check_sf_logsf(distfn, args, msg): + # compares sf at several points with the log of the sf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + sf = distfn.sf(vals, *args) + logsf = distfn.logsf(vals, *args) + sf = sf[sf != 0] + logsf = logsf[np.isfinite(logsf)] + npt.assert_almost_equal(np.log(sf), logsf, decimal=7, err_msg=msg + " - logsf-log(sf) relationship") + +def check_cdf_logcdf(distfn, args, msg): + # compares cdf at several points with the log of the cdf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + cdf = distfn.cdf(vals, *args) + logcdf = distfn.logcdf(vals, *args) + cdf = cdf[cdf != 0] + logcdf = logcdf[np.isfinite(logcdf)] + npt.assert_almost_equal(np.log(cdf), logcdf, decimal=7, err_msg=msg + " - logcdf-log(cdf) relationship") + + def check_distribution_rvs(dist, args, alpha, rvs): #test from scipy.stats.tests #this version reuses existing random variables From scipy-svn at scipy.org Tue Jun 1 06:11:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 05:11:33 -0500 (CDT) Subject: [Scipy-svn] r6473 - in branches/0.8.x/scipy/stats: . tests Message-ID: <20100601101133.EF5B139CAF5@scipy.org> Author: oliphant Date: 2010-06-01 05:11:33 -0500 (Tue, 01 Jun 2010) New Revision: 6473 Modified: branches/0.8.x/scipy/stats/distributions.py branches/0.8.x/scipy/stats/tests/test_continuous_basic.py Log: Add tests for logpdf, logcdf, and logsf to 0.8.x branch from trunk Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-01 10:10:30 UTC (rev 6472) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-01 10:11:33 UTC (rev 6473) @@ -2333,7 +2333,7 @@ return exp(1)*b*xbm1 * exp(xb - exp(xb)) def _logpdf(self, x, b): xb = x**(b-1.0)*x - return log(b) + (b-1.0)*log(x) + xb - exp(xb) + return 1 + log(b) + (b-1.0)*log(x) + xb - exp(xb) def _cdf(self, x, b): xb = arr(x**b) return -expm1(-expm1(xb)) @@ -4283,11 +4283,13 @@ %(example)s """ def _rvs(self): - return invnorm_gen._rvs(self, 1.0) + return mtrand.wald(1.0, 1.0, size=self._size) def _pdf(self, x): - return invnorm.pdf(x,1.0) + return invnorm._pdf(x, 1.0) + def _logpdf(self, x): + return invnorm._logpdf(x, 1.0) def _cdf(self, x): - return invnorm.cdf(x,1,0) + return invnorm._logcdf(x, 1.0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 wald = wald_gen(a=0.0, name="wald", extradoc=""" Modified: branches/0.8.x/scipy/stats/tests/test_continuous_basic.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_continuous_basic.py 2010-06-01 10:10:30 UTC (rev 6472) +++ branches/0.8.x/scipy/stats/tests/test_continuous_basic.py 2010-06-01 10:11:33 UTC (rev 6473) @@ -175,11 +175,14 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname + if distname in ['wald']: continue + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname if distname in distmissing: alpha = 0.01 - yield check_distribution_rvs, dist, args, alpha, rvs + # yield check_distribution_rvs, dist, args, alpha, rvs - @npt.dec.slow def test_cont_basic_slow(): # same as above for slow distributions @@ -202,14 +205,14 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname + yield check_pdf_logpdf, distfn, arg, distname + yield check_cdf_logcdf, distfn, arg, distname + yield check_sf_logsf, distfn, arg, distname #yield check_oth, distfn, arg # is still missing if distname in distmissing: alpha = 0.01 yield check_distribution_rvs, dist, args, alpha, rvs - - - def check_moment(distfn, arg, m, v, msg): m1 = distfn.moment(1,*arg) m2 = distfn.moment(2,*arg) @@ -314,7 +317,37 @@ npt.assert_almost_equal(pdfv, cdfdiff, decimal=DECIMAL, err_msg= msg + ' - cdf-pdf relationship') +def check_pdf_logpdf(distfn, args, msg): + # compares pdf at several points with the log of the pdf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + pdf = distfn.pdf(vals, *args) + logpdf = distfn.logpdf(vals, *args) + pdf = pdf[pdf != 0] + logpdf = logpdf[np.isfinite(logpdf)] + npt.assert_almost_equal(np.log(pdf), logpdf, decimal=7, err_msg=msg + " - logpdf-log(pdf) relationship") +def check_sf_logsf(distfn, args, msg): + # compares sf at several points with the log of the sf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + sf = distfn.sf(vals, *args) + logsf = distfn.logsf(vals, *args) + sf = sf[sf != 0] + logsf = logsf[np.isfinite(logsf)] + npt.assert_almost_equal(np.log(sf), logsf, decimal=7, err_msg=msg + " - logsf-log(sf) relationship") + +def check_cdf_logcdf(distfn, args, msg): + # compares cdf at several points with the log of the cdf + points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) + vals = distfn.ppf(points, *args) + cdf = distfn.cdf(vals, *args) + logcdf = distfn.logcdf(vals, *args) + cdf = cdf[cdf != 0] + logcdf = logcdf[np.isfinite(logcdf)] + npt.assert_almost_equal(np.log(cdf), logcdf, decimal=7, err_msg=msg + " - logcdf-log(cdf) relationship") + + def check_distribution_rvs(dist, args, alpha, rvs): #test from scipy.stats.tests #this version reuses existing random variables From scipy-svn at scipy.org Tue Jun 1 19:13:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 18:13:36 -0500 (CDT) Subject: [Scipy-svn] r6474 - branches/0.8.x/scipy/stats Message-ID: <20100601231336.B92F039CAE9@scipy.org> Author: oliphant Date: 2010-06-01 18:13:36 -0500 (Tue, 01 Jun 2010) New Revision: 6474 Modified: branches/0.8.x/scipy/stats/distributions.py Log: Remove accidental committal of old rv_continuous template. Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-01 10:11:33 UTC (rev 6473) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-01 23:13:36 UTC (rev 6474) @@ -731,70 +731,6 @@ ------- ... - generic.pdf(x,,loc=0,scale=1) - - probability density function - - generic.cdf(x,,loc=0,scale=1) - - cumulative density function - - generic.sf(x,,loc=0,scale=1) - - survival function (1-cdf --- sometimes more accurate) - - generic.ppf(q,,loc=0,scale=1) - - percent point function (inverse of cdf --- percentiles) - - generic.median(,loc=0,scale=1) - - median of the distribution - - generic.isf(q,,loc=0,scale=1) - - inverse survival function (inverse of sf) - - generic.stats(,loc=0,scale=1,moments='mv') - - mean('m'), variance('v'), skew('s'), and/or kurtosis('k') - - generic.mean(,loc=0,scale=1) - - mean of the distribution - - generic.var(,loc=0,scale=1) - - variance of the distribution - - generic.std(,loc=0,scale=1) - - standard deviation of the distribution - - generic.entropy(,loc=0,scale=1) - - (differential) entropy of the RV. - - generic.fit(data,,loc=0,scale=1) - - Parameter estimates for generic data - - generic.interval(alpha, ,loc=0,scale=1) - - Return an alpha confidence interval centered on the median - - Alternatively, the object may be called (as a function) to fix the shape, - location, and scale parameters returning a "frozen" continuous RV object: - - rv = generic(,loc=0,scale=1) - - frozen RV object with the same methods but holding the given shape, location, and scale fixed - - Parameters - ---------- - x : array-like - quantiles - q : array-like - lower or upper tail probability - : array-like - shape parameters - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - size : int or tuple of ints, optional - shape of random variates (default computed from input arguments ) - moments : string, optional - composed of letters ['mvsk'] specifying which moments to compute where - 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and - 'k' = (Fisher's) kurtosis. (default='mv') - Examples -------- To create a new Gaussian distribution, we would do the following:: From scipy-svn at scipy.org Tue Jun 1 19:26:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 18:26:07 -0500 (CDT) Subject: [Scipy-svn] r6475 - trunk/scipy/stats Message-ID: <20100601232607.96DA139CB07@scipy.org> Author: oliphant Date: 2010-06-01 18:26:07 -0500 (Tue, 01 Jun 2010) New Revision: 6475 Modified: trunk/scipy/stats/distributions.py Log: Fix Python < 2.6 syntax in the trunk. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-01 23:13:36 UTC (rev 6474) +++ trunk/scipy/stats/distributions.py 2010-06-01 23:26:07 UTC (rev 6475) @@ -1903,7 +1903,6 @@ return a, b, floc, fscale else: # do general fit return super(beta_gen, self).fit(data, *args, **kwds) - beta = beta_gen(a=0.0, b=1.0, name='beta',shapes='a, b',extradoc=""" Beta distribution @@ -5104,7 +5103,7 @@ signature = inspect.getargspec(self._stats.im_func) if (signature[2] is not None) or ('moments' in signature[0]): - mu, mu2, g1, g2 = self._stats(*args,moments=moments) + mu, mu2, g1, g2 = self._stats(*args,**{'moments':moments}) else: mu, mu2, g1, g2 = self._stats(*args) if g1 is None: From scipy-svn at scipy.org Tue Jun 1 19:27:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 1 Jun 2010 18:27:33 -0500 (CDT) Subject: [Scipy-svn] r6476 - trunk/scipy/stats Message-ID: <20100601232733.7D28A39CAE9@scipy.org> Author: oliphant Date: 2010-06-01 18:27:33 -0500 (Tue, 01 Jun 2010) New Revision: 6476 Modified: trunk/scipy/stats/distributions.py Log: Remove accidentally applied rv_continuous doc template. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-01 23:26:07 UTC (rev 6475) +++ trunk/scipy/stats/distributions.py 2010-06-01 23:27:33 UTC (rev 6476) @@ -731,70 +731,6 @@ ------- ... - generic.pdf(x,,loc=0,scale=1) - - probability density function - - generic.cdf(x,,loc=0,scale=1) - - cumulative density function - - generic.sf(x,,loc=0,scale=1) - - survival function (1-cdf --- sometimes more accurate) - - generic.ppf(q,,loc=0,scale=1) - - percent point function (inverse of cdf --- percentiles) - - generic.median(,loc=0,scale=1) - - median of the distribution - - generic.isf(q,,loc=0,scale=1) - - inverse survival function (inverse of sf) - - generic.stats(,loc=0,scale=1,moments='mv') - - mean('m'), variance('v'), skew('s'), and/or kurtosis('k') - - generic.mean(,loc=0,scale=1) - - mean of the distribution - - generic.var(,loc=0,scale=1) - - variance of the distribution - - generic.std(,loc=0,scale=1) - - standard deviation of the distribution - - generic.entropy(,loc=0,scale=1) - - (differential) entropy of the RV. - - generic.fit(data,,loc=0,scale=1) - - Parameter estimates for generic data - - generic.interval(alpha, ,loc=0,scale=1) - - Return an alpha confidence interval centered on the median - - Alternatively, the object may be called (as a function) to fix the shape, - location, and scale parameters returning a "frozen" continuous RV object: - - rv = generic(,loc=0,scale=1) - - frozen RV object with the same methods but holding the given shape, location, and scale fixed - - Parameters - ---------- - x : array-like - quantiles - q : array-like - lower or upper tail probability - : array-like - shape parameters - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - size : int or tuple of ints, optional - shape of random variates (default computed from input arguments ) - moments : string, optional - composed of letters ['mvsk'] specifying which moments to compute where - 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and - 'k' = (Fisher's) kurtosis. (default='mv') - Examples -------- To create a new Gaussian distribution, we would do the following:: From scipy-svn at scipy.org Wed Jun 2 19:50:28 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 2 Jun 2010 18:50:28 -0500 (CDT) Subject: [Scipy-svn] r6477 - in trunk: doc/release scipy/constants scipy/constants/tests Message-ID: <20100602235028.4474E39CAE9@scipy.org> Author: warren.weckesser Date: 2010-06-02 18:50:28 -0500 (Wed, 02 Jun 2010) New Revision: 6477 Modified: trunk/doc/release/0.8.0-notes.rst trunk/scipy/constants/codata.py trunk/scipy/constants/tests/test_codata.py Log: Add a keyword argument to constants.codata.find, so the change in behavior can go through a proper deprecation cycle. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-06-01 23:27:33 UTC (rev 6476) +++ trunk/doc/release/0.8.0-notes.rst 2010-06-02 23:50:28 UTC (rev 6477) @@ -66,6 +66,10 @@ * linalg: The function `solveh_banded` currently returns a tuple containing the Cholesky factorization and the solution to the linear system. In SciPy 0.9, the return value will be just the solution. +* The function `constants.codata.find` will generate a DeprecationWarning. + In Scipy version 0.8.0, the keyword argument 'disp' was added to the + function, with the default value 'True'. In 0.9.0, the default will be + 'False'. New features ============ @@ -133,10 +137,13 @@ scipy.sparse.linalg.eigen.arpack. It is based on using an symmetric solver on , and as such may not be very precise. -Better behavior for `scipy.constants.find` (scipy.constants) ------------------------------------------------------------- -The function `scipy.constants.find` was modified to return the list of keys -that it finds, instead of printing them and returning None. +Alternative behavior available for `scipy.constants.find` +--------------------------------------------------------- +The keyword argument `disp` was added to the function `scipy.constants.find`, +with the default value `True`. When `disp` is `True`, the behavior is the +same as in Scipy version 0.7. When `False`, the function returns the list of +keys instead of printing them. (In SciPy version 0.9, the default will be +reversed.) Incomplete sparse LU decompositions ----------------------------------- Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-06-01 23:27:33 UTC (rev 6476) +++ trunk/scipy/constants/codata.py 2010-06-02 23:50:28 UTC (rev 6477) @@ -20,6 +20,7 @@ find(sub) prints out a list of keys containing the string sub. """ +import warnings import string from math import pi, sqrt __all__ = ['physical_constants', 'value', 'unit', 'precision', 'find'] @@ -442,19 +443,24 @@ """ return physical_constants[key][2] / physical_constants[key][0] -def find(sub) : + +def find(sub, disp=True) : """ - Return list of codata.physical_constant keys containing a given string + Find the codata.physical_constant keys containing a given string. Parameters ---------- sub : str or unicode Sub-string to search keys for + disp : bool + If True, print the keys that are found, and return None. + Otherwise, return the list of keys without printing anything. Returns ------- - keys : list - List of keys containing `sub` + keys : None or list + If `disp` is False, the list of keys is returned. Otherwise, None + is returned. See Also -------- @@ -462,6 +468,9 @@ dictionary literal object, does not itself possess a docstring. """ + warnings.warn("In Scipy version 0.8.0, the keyword argument 'disp' was added to " + "find(), with the default value True. In 0.9.0, the default will be False.", + DeprecationWarning) l_sub = string.lower(sub) result = [] for key in physical_constants : @@ -469,8 +478,14 @@ if l_sub in l_key: result.append(key) result.sort() - return result + if disp: + for key in result: + print key + return + else: + return result + #table is lacking some digits for exact values: calculate from definition c = value('speed of light in vacuum') Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2010-06-01 23:27:33 UTC (rev 6476) +++ trunk/scipy/constants/tests/test_codata.py 2010-06-02 23:50:28 UTC (rev 6477) @@ -1,16 +1,20 @@ +import warnings + from scipy.constants import find from numpy.testing import assert_equal def test_find(): - keys = find('weak mixing') + warnings.simplefilter('ignore', DeprecationWarning) + + keys = find('weak mixing', disp=False) assert_equal(keys, ['weak mixing angle']) - keys = find('qwertyuiop') + keys = find('qwertyuiop', disp=False) assert_equal(keys, []) - keys = find('natural unit') + keys = find('natural unit', disp=False) assert_equal(keys, sorted(['natural unit of velocity', 'natural unit of action', 'natural unit of action in eV s', From scipy-svn at scipy.org Wed Jun 2 19:58:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 2 Jun 2010 18:58:30 -0500 (CDT) Subject: [Scipy-svn] r6478 - in branches/0.8.x: doc/release scipy/constants scipy/constants/tests Message-ID: <20100602235830.775BC39CAE9@scipy.org> Author: warren.weckesser Date: 2010-06-02 18:58:30 -0500 (Wed, 02 Jun 2010) New Revision: 6478 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst branches/0.8.x/scipy/constants/codata.py branches/0.8.x/scipy/constants/tests/test_codata.py Log: 0.8.x branch: Add a keyword argument to constants.codata.find, so the change in behavior can go through a proper deprecation cycle. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-02 23:50:28 UTC (rev 6477) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-02 23:58:30 UTC (rev 6478) @@ -66,6 +66,10 @@ * linalg: The function `solveh_banded` currently returns a tuple containing the Cholesky factorization and the solution to the linear system. In SciPy 0.9, the return value will be just the solution. +* The function `constants.codata.find` will generate a DeprecationWarning. + In Scipy version 0.8.0, the keyword argument 'disp' was added to the + function, with the default value 'True'. In 0.9.0, the default will be + 'False'. New features ============ @@ -133,10 +137,13 @@ scipy.sparse.linalg.eigen.arpack. It is based on using an symmetric solver on , and as such may not be very precise. -Better behavior for `scipy.constants.find` (scipy.constants) ------------------------------------------------------------- -The function `scipy.constants.find` was modified to return the list of keys -that it finds, instead of printing them and returning None. +Alternative behavior available for `scipy.constants.find` +--------------------------------------------------------- +The keyword argument `disp` was added to the function `scipy.constants.find`, +with the default value `True`. When `disp` is `True`, the behavior is the +same as in Scipy version 0.7. When `False`, the function returns the list of +keys instead of printing them. (In SciPy version 0.9, the default will be +reversed.) Incomplete sparse LU decompositions ----------------------------------- Modified: branches/0.8.x/scipy/constants/codata.py =================================================================== --- branches/0.8.x/scipy/constants/codata.py 2010-06-02 23:50:28 UTC (rev 6477) +++ branches/0.8.x/scipy/constants/codata.py 2010-06-02 23:58:30 UTC (rev 6478) @@ -20,6 +20,7 @@ find(sub) prints out a list of keys containing the string sub. """ +import warnings import string from math import pi, sqrt __all__ = ['physical_constants', 'value', 'unit', 'precision', 'find'] @@ -442,19 +443,24 @@ """ return physical_constants[key][2] / physical_constants[key][0] -def find(sub) : + +def find(sub, disp=True) : """ - Return list of codata.physical_constant keys containing a given string + Find the codata.physical_constant keys containing a given string. Parameters ---------- sub : str or unicode Sub-string to search keys for + disp : bool + If True, print the keys that are found, and return None. + Otherwise, return the list of keys without printing anything. Returns ------- - keys : list - List of keys containing `sub` + keys : None or list + If `disp` is False, the list of keys is returned. Otherwise, None + is returned. See Also -------- @@ -462,6 +468,9 @@ dictionary literal object, does not itself possess a docstring. """ + warnings.warn("In Scipy version 0.8.0, the keyword argument 'disp' was added to " + "find(), with the default value True. In 0.9.0, the default will be False.", + DeprecationWarning) l_sub = string.lower(sub) result = [] for key in physical_constants : @@ -469,8 +478,14 @@ if l_sub in l_key: result.append(key) result.sort() - return result + if disp: + for key in result: + print key + return + else: + return result + #table is lacking some digits for exact values: calculate from definition c = value('speed of light in vacuum') Modified: branches/0.8.x/scipy/constants/tests/test_codata.py =================================================================== --- branches/0.8.x/scipy/constants/tests/test_codata.py 2010-06-02 23:50:28 UTC (rev 6477) +++ branches/0.8.x/scipy/constants/tests/test_codata.py 2010-06-02 23:58:30 UTC (rev 6478) @@ -1,16 +1,20 @@ +import warnings + from scipy.constants import find from numpy.testing import assert_equal def test_find(): - keys = find('weak mixing') + warnings.simplefilter('ignore', DeprecationWarning) + + keys = find('weak mixing', disp=False) assert_equal(keys, ['weak mixing angle']) - keys = find('qwertyuiop') + keys = find('qwertyuiop', disp=False) assert_equal(keys, []) - keys = find('natural unit') + keys = find('natural unit', disp=False) assert_equal(keys, sorted(['natural unit of velocity', 'natural unit of action', 'natural unit of action in eV s', From scipy-svn at scipy.org Wed Jun 2 22:36:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 2 Jun 2010 21:36:51 -0500 (CDT) Subject: [Scipy-svn] r6479 - trunk/scipy/signal Message-ID: <20100603023651.7DB2D39CAF5@scipy.org> Author: warren.weckesser Date: 2010-06-02 21:36:51 -0500 (Wed, 02 Jun 2010) New Revision: 6479 Modified: trunk/scipy/signal/waveforms.py Log: Fix signal.chirp to maintain old behavior, and add deprecation warnings. Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-06-02 23:58:30 UTC (rev 6478) +++ trunk/scipy/signal/waveforms.py 2010-06-03 02:36:51 UTC (rev 6479) @@ -5,8 +5,9 @@ # Rewrote much of chirp() # Added sweep_poly() +import warnings from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \ - exp, cos, sin, polyval, polyint + exp, cos, sin, polyval, polyint, size, log10 def sawtooth(t,width=1): """ @@ -186,9 +187,83 @@ return yI, yQ, yenv -def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True): +# This is chirp from scipy 0.7: + +def old_chirp(t, f0=0, t1=1, f1=100, method='linear', phi=0, qshape=None): """Frequency-swept cosine generator. + Parameters + ---------- + t : ndarray + Times at which to evaluate the waveform. + f0 : float or ndarray, optional + Frequency (in Hz) of the waveform at time 0. If `f0` is an + ndarray, it specifies the frequency change as a polynomial in + `t` (see Notes below). + t1 : float, optional + Time at which `f1` is specified. + f1 : float, optional + Frequency (in Hz) of the waveform at time `t1`. + method : {'linear', 'quadratic', 'logarithmic'}, optional + Kind of frequency sweep. + phi : float + Phase offset, in degrees. + qshape : {'convex', 'concave'} + If method is 'quadratic', `qshape` specifies its shape. + + Notes + ----- + If `f0` is an array, it forms the coefficients of a polynomial in + `t` (see `numpy.polval`). The polynomial determines the waveform + frequency change in time. In this case, the values of `f1`, `t1`, + `method`, and `qshape` are ignored. + + This function is deprecated. It will be removed in SciPy version 0.9.0. + It exists so that during in version 0.8.0, the new chirp function can + call this function to preserve the old behavior of the quadratic chirp. + """ + warnings.warn("The function old_chirp is deprecated, and will be removed in " + "SciPy 0.9", DeprecationWarning) + # Convert to radians. + phi *= pi / 180 + if size(f0) > 1: + # We were given a polynomial. + return cos(2*pi*polyval(polyint(f0),t)+phi) + if method in ['linear','lin','li']: + beta = (f1-f0)/t1 + phase_angle = 2*pi * (f0*t + 0.5*beta*t*t) + elif method in ['quadratic','quad','q']: + if qshape == 'concave': + mxf = max(f0,f1) + mnf = min(f0,f1) + f1,f0 = mxf, mnf + elif qshape == 'convex': + mxf = max(f0,f1) + mnf = min(f0,f1) + f1,f0 = mnf, mxf + else: + raise ValueError("qshape must be either 'concave' or 'convex' but " + "a value of %r was given." % qshape) + beta = (f1-f0)/t1/t1 + phase_angle = 2*pi * (f0*t + beta*t*t*t/3) + elif method in ['logarithmic','log','lo']: + if f1 <= f0: + raise ValueError( + "For a logarithmic sweep, f1=%f must be larger than f0=%f." + % (f1, f0)) + beta = log10(f1-f0)/t1 + phase_angle = 2*pi * (f0*t + (pow(10,beta*t)-1)/(beta*log(10))) + else: + raise ValueError("method must be 'linear', 'quadratic', or " + "'logarithmic' but a value of %r was given." % method) + + return cos(phase_angle + phi) + + +def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True, + qshape=None): + """Frequency-swept cosine generator. + In the following, 'Hz' should be interpreted as 'cycles per time unit'; there is no assumption here that the time unit is one second. The important distinction is that the units of rotation are cycles, not @@ -213,6 +288,10 @@ This parameter is only used when `method` is 'quadratic'. It determines whether the vertex of the parabola that is the graph of the frequency is at t=0 or t=t1. + qshape : str (deprecated) + If `method` is `quadratic` and `qshape` is not None, chirp() will + use scipy.signal.waveforms.old_chirp to compute the wave form. + This parameter is deprecated, and will be removed in SciPy 0.9. Returns ------- @@ -272,6 +351,24 @@ f1 must be positive, and f0 must be greater than f1. """ + if size(f0) > 1: + # Preserve old behavior for one release cycle; this can be + # removed in scipy 0.9. + warnings.warn("Passing a list of polynomial coefficients in f0 to the " + "function chirp is deprecated. Use scipy.signal.sweep_poly.", + DeprecationWarning) + return old_chirp(t, f0, t1, f1, method, phi, qshape) + + if method in ['quadratic', 'quad', 'q'] and qshape is not None: + # We must use the old version of the quadratic chirp. Fortunately, + # the old API *required* that qshape be either 'convex' or 'concave' + # if the quadratic method was selected--`None` would raise an error. + # So if the code reaches this point, we should use the old version. + warnings.warn("The qshape keyword argument is deprecated. " + "Use vertex_zero.", DeprecationWarning) + waveform = old_chirp(t, f0, t1, f1, method, phi, qshape) + return waveform + # 'phase' is computed in _chirp_phase, to make testing easier. phase = _chirp_phase(t, f0, t1, f1, method, vertex_zero) # Convert phi to radians. From scipy-svn at scipy.org Wed Jun 2 22:37:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 2 Jun 2010 21:37:25 -0500 (CDT) Subject: [Scipy-svn] r6480 - trunk/doc/release Message-ID: <20100603023725.6EC6939CAF5@scipy.org> Author: warren.weckesser Date: 2010-06-02 21:37:25 -0500 (Wed, 02 Jun 2010) New Revision: 6480 Modified: trunk/doc/release/0.8.0-notes.rst Log: Update release notes to go along with r6479. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-06-03 02:36:51 UTC (rev 6479) +++ trunk/doc/release/0.8.0-notes.rst 2010-06-03 02:37:25 UTC (rev 6480) @@ -70,6 +70,11 @@ In Scipy version 0.8.0, the keyword argument 'disp' was added to the function, with the default value 'True'. In 0.9.0, the default will be 'False'. +* The `qshape` keyword argument of `signal.chirp` is deprecated. Use + the argument `vertex_zero` instead. +* Passing the coefficients of a polynomial as the argument `f0` to + `signal.chirp` is deprecated. Use the function `signal.sweep_poly` + instead. New features ============ @@ -198,9 +203,4 @@ The module `scipy.misc.limits` was removed. -scipy.signal.chirp: -* The `qshape` keyword argument was removed. Instead, use the `vertex_zero` - argument. -* `chirp` no longer handles the case of a general polynomial. This - functionality has been moved to a new function, `sweep_poly`. From scipy-svn at scipy.org Wed Jun 2 22:41:25 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 2 Jun 2010 21:41:25 -0500 (CDT) Subject: [Scipy-svn] r6481 - in branches/0.8.x: doc/release scipy/signal Message-ID: <20100603024125.299B539CAF5@scipy.org> Author: warren.weckesser Date: 2010-06-02 21:41:25 -0500 (Wed, 02 Jun 2010) New Revision: 6481 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst branches/0.8.x/scipy/signal/waveforms.py Log: 0.8.x branch: Fix signal.chirp to maintain old behavior, and add deprecation warnings. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-03 02:37:25 UTC (rev 6480) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-03 02:41:25 UTC (rev 6481) @@ -70,6 +70,11 @@ In Scipy version 0.8.0, the keyword argument 'disp' was added to the function, with the default value 'True'. In 0.9.0, the default will be 'False'. +* The `qshape` keyword argument of `signal.chirp` is deprecated. Use + the argument `vertex_zero` instead. +* Passing the coefficients of a polynomial as the argument `f0` to + `signal.chirp` is deprecated. Use the function `signal.sweep_poly` + instead. New features ============ @@ -198,9 +203,4 @@ The module `scipy.misc.limits` was removed. -scipy.signal.chirp: -* The `qshape` keyword argument was removed. Instead, use the `vertex_zero` - argument. -* `chirp` no longer handles the case of a general polynomial. This - functionality has been moved to a new function, `sweep_poly`. Modified: branches/0.8.x/scipy/signal/waveforms.py =================================================================== --- branches/0.8.x/scipy/signal/waveforms.py 2010-06-03 02:37:25 UTC (rev 6480) +++ branches/0.8.x/scipy/signal/waveforms.py 2010-06-03 02:41:25 UTC (rev 6481) @@ -5,8 +5,9 @@ # Rewrote much of chirp() # Added sweep_poly() +import warnings from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \ - exp, cos, sin, polyval, polyint + exp, cos, sin, polyval, polyint, size, log10 def sawtooth(t,width=1): """ @@ -186,9 +187,83 @@ return yI, yQ, yenv -def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True): +# This is chirp from scipy 0.7: + +def old_chirp(t, f0=0, t1=1, f1=100, method='linear', phi=0, qshape=None): """Frequency-swept cosine generator. + Parameters + ---------- + t : ndarray + Times at which to evaluate the waveform. + f0 : float or ndarray, optional + Frequency (in Hz) of the waveform at time 0. If `f0` is an + ndarray, it specifies the frequency change as a polynomial in + `t` (see Notes below). + t1 : float, optional + Time at which `f1` is specified. + f1 : float, optional + Frequency (in Hz) of the waveform at time `t1`. + method : {'linear', 'quadratic', 'logarithmic'}, optional + Kind of frequency sweep. + phi : float + Phase offset, in degrees. + qshape : {'convex', 'concave'} + If method is 'quadratic', `qshape` specifies its shape. + + Notes + ----- + If `f0` is an array, it forms the coefficients of a polynomial in + `t` (see `numpy.polval`). The polynomial determines the waveform + frequency change in time. In this case, the values of `f1`, `t1`, + `method`, and `qshape` are ignored. + + This function is deprecated. It will be removed in SciPy version 0.9.0. + It exists so that during in version 0.8.0, the new chirp function can + call this function to preserve the old behavior of the quadratic chirp. + """ + warnings.warn("The function old_chirp is deprecated, and will be removed in " + "SciPy 0.9", DeprecationWarning) + # Convert to radians. + phi *= pi / 180 + if size(f0) > 1: + # We were given a polynomial. + return cos(2*pi*polyval(polyint(f0),t)+phi) + if method in ['linear','lin','li']: + beta = (f1-f0)/t1 + phase_angle = 2*pi * (f0*t + 0.5*beta*t*t) + elif method in ['quadratic','quad','q']: + if qshape == 'concave': + mxf = max(f0,f1) + mnf = min(f0,f1) + f1,f0 = mxf, mnf + elif qshape == 'convex': + mxf = max(f0,f1) + mnf = min(f0,f1) + f1,f0 = mnf, mxf + else: + raise ValueError("qshape must be either 'concave' or 'convex' but " + "a value of %r was given." % qshape) + beta = (f1-f0)/t1/t1 + phase_angle = 2*pi * (f0*t + beta*t*t*t/3) + elif method in ['logarithmic','log','lo']: + if f1 <= f0: + raise ValueError( + "For a logarithmic sweep, f1=%f must be larger than f0=%f." + % (f1, f0)) + beta = log10(f1-f0)/t1 + phase_angle = 2*pi * (f0*t + (pow(10,beta*t)-1)/(beta*log(10))) + else: + raise ValueError("method must be 'linear', 'quadratic', or " + "'logarithmic' but a value of %r was given." % method) + + return cos(phase_angle + phi) + + +def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True, + qshape=None): + """Frequency-swept cosine generator. + In the following, 'Hz' should be interpreted as 'cycles per time unit'; there is no assumption here that the time unit is one second. The important distinction is that the units of rotation are cycles, not @@ -213,6 +288,10 @@ This parameter is only used when `method` is 'quadratic'. It determines whether the vertex of the parabola that is the graph of the frequency is at t=0 or t=t1. + qshape : str (deprecated) + If `method` is `quadratic` and `qshape` is not None, chirp() will + use scipy.signal.waveforms.old_chirp to compute the wave form. + This parameter is deprecated, and will be removed in SciPy 0.9. Returns ------- @@ -272,6 +351,24 @@ f1 must be positive, and f0 must be greater than f1. """ + if size(f0) > 1: + # Preserve old behavior for one release cycle; this can be + # removed in scipy 0.9. + warnings.warn("Passing a list of polynomial coefficients in f0 to the " + "function chirp is deprecated. Use scipy.signal.sweep_poly.", + DeprecationWarning) + return old_chirp(t, f0, t1, f1, method, phi, qshape) + + if method in ['quadratic', 'quad', 'q'] and qshape is not None: + # We must use the old version of the quadratic chirp. Fortunately, + # the old API *required* that qshape be either 'convex' or 'concave' + # if the quadratic method was selected--`None` would raise an error. + # So if the code reaches this point, we should use the old version. + warnings.warn("The qshape keyword argument is deprecated. " + "Use vertex_zero.", DeprecationWarning) + waveform = old_chirp(t, f0, t1, f1, method, phi, qshape) + return waveform + # 'phase' is computed in _chirp_phase, to make testing easier. phase = _chirp_phase(t, f0, t1, f1, method, vertex_zero) # Convert phi to radians. From scipy-svn at scipy.org Thu Jun 3 10:00:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 3 Jun 2010 09:00:34 -0500 (CDT) Subject: [Scipy-svn] r6482 - in branches/0.8.x/scipy/stats: . tests Message-ID: <20100603140034.1476939CB09@scipy.org> Author: rgommers Date: 2010-06-03 09:00:33 -0500 (Thu, 03 Jun 2010) New Revision: 6482 Modified: branches/0.8.x/scipy/stats/_support.py branches/0.8.x/scipy/stats/distributions.py branches/0.8.x/scipy/stats/morestats.py branches/0.8.x/scipy/stats/stats.py branches/0.8.x/scipy/stats/tests/test_continuous_basic.py branches/0.8.x/scipy/stats/tests/test_distributions.py Log: REF: Remove recent stats commits since r6391, except for: r6406, r6417, r6420, r6421, r6443 Modified: branches/0.8.x/scipy/stats/_support.py =================================================================== --- branches/0.8.x/scipy/stats/_support.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/_support.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -134,7 +134,8 @@ Format: adm (a,criterion) where criterion is like 'x[2]==37'\n""" - lines = eval('filter(lambda x: '+criterion+',a)') + function = 'lines = filter(lambda x: '+criterion+',a)' + exec(function) try: lines = np.array(lines) except: Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -1,52 +1,32 @@ # Functions to implement several important functions for # various Continous and Discrete Probability Distributions # -# Author: Travis Oliphant 2002-2010 with contributions from -# SciPy Developers 2004-2010 +# Author: Travis Oliphant 2002-2003 # -import math -from copy import copy - +import scipy from scipy.misc import comb, derivative from scipy import special from scipy import optimize -from scipy import integrate -from scipy.special import gammaln as gamln +import scipy.integrate import inspect -from numpy import alltrue, where, arange, putmask, \ +from numpy import alltrue, where, arange, put, putmask, \ ravel, take, ones, sum, shape, product, repeat, reshape, \ zeros, floor, logical_and, log, sqrt, exp, arctanh, tan, sin, arcsin, \ arctan, tanh, ndarray, cos, cosh, sinh, newaxis, array, log1p, expm1 -from numpy import atleast_1d, polyval, ceil, place, extract, \ - any, argsort, argmax, vectorize, r_, asarray, nan, inf, pi, isinf, \ - power, NINF, empty +from numpy import atleast_1d, polyval, angle, ceil, place, extract, \ + any, argsort, argmax, vectorize, r_, asarray, nan, inf, pi, isnan, isinf, \ + power import numpy import numpy as np import numpy.random as mtrand from numpy import flatnonzero as nonzero +from scipy.special import gammaln as gamln +from copy import copy import vonmises_cython -def _moment(data, n, mu=None): - if mu is None: - mu = data.mean() - return ((data - mu)**n).mean() -def _skew(data): - data = np.ravel(data) - mu = data.mean() - m2 = ((data - mu)**2).mean() - m3 = ((data - mu)**3).mean() - return m3 / m2**1.5 - -def _kurtosis(data): - data = np.ravel(data) - mu = data.mean() - m2 = ((data - mu)**2).mean() - m4 = ((data - mu)**4).mean() - return m4 / m2**2 - 3 - __all__ = [ 'rv_continuous', 'ksone', 'kstwobign', 'norm', 'alpha', 'anglit', 'arcsine', @@ -76,9 +56,14 @@ errp = special.errprint arr = asarray gam = special.gamma +lgam = special.gammaln + import types +import stats as st + from scipy.misc import doccer + all = alltrue sgf = vectorize import new @@ -334,22 +319,12 @@ kwds = self.kwds kwds.update({'moments':moments}) return self.dist.stats(*self.args,**kwds) - def median(self): - return self.dist.median(*self.args, **self.kwds) - def mean(self): - return self.dist.mean(*self.args,**self.kwds) - def var(self): - return self.dist.var(*self.args, **self.kwds) - def std(self): - return self.dist.std(*self.args, **self.kwds) def moment(self,n): return self.dist.moment(n,*self.args,**self.kwds) def entropy(self): return self.dist.entropy(*self.args,**self.kwds) def pmf(self,k): return self.dist.pmf(k,*self.args,**self.kwds) - def interval(self,alpha): - return self.dist.interval(alpha, *self.args, **self.kwds) @@ -388,11 +363,8 @@ ## ## rvs -- Random Variates (alternatively calling the class could produce these) ## pdf -- PDF -## logpdf -- log PDF (more numerically accurate if possible) ## cdf -- CDF -## logcdf -- log of CDF ## sf -- Survival Function (1-CDF) -## logsf --- log of SF ## ppf -- Percent Point Function (Inverse of CDF) ## isf -- Inverse Survival Function (Inverse of SF) ## stats -- Return mean, variance, (Fisher's) skew, or (Fisher's) kurtosis @@ -422,7 +394,7 @@ ## ## _cdf, _ppf, _rvs, _isf, _sf ## -## Rarely would you override _isf and _sf but you could for numerical precision. +## Rarely would you override _isf and _sf but you could. ## ## Statistics are computed using numerical integration by default. ## For speed you can redefine this using @@ -451,7 +423,7 @@ if typecode is not None: out = out.astype(typecode) if not isinstance(out, ndarray): - out = arr(out) + out = asarray(out) return out # This should be rewritten @@ -563,136 +535,7 @@ return vals - def median(self, *args, **kwds): - """ - Median of the distribution. - Parameters - ---------- - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - median : float - the median of the distribution. - - See Also - -------- - self.ppf --- inverse of the CDF - """ - return self.ppf(0.5, *args, **kwds) - - def mean(self, *args, **kwds): - """ - Mean of the distribution - - Parameters - ---------- - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - mean : float - the mean of the distribution - """ - kwds['moments'] = 'm' - res = self.stats(*args, **kwds) - if isinstance(res, ndarray) and res.ndim == 0: - return res[()] - return res - - def var(self, *args, **kwds): - """ - Variance of the distribution - - Parameters - ---------- - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - var : float - the variance of the distribution - - """ - kwds['moments'] = 'v' - res = self.stats(*args, **kwds) - if isinstance(res, ndarray) and res.ndim == 0: - return res[()] - return res - - def std(self, *args, **kwds): - """ - Standard deviation of the distribution. - - Parameters - ---------- - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - std : float - standard deviation of the distribution - - """ - kwds['moments'] = 'v' - res = math.sqrt(self.stats(*args, **kwds)) - return res - - def interval(self, alpha, *args, **kwds): - """Confidence interval with equal areas around the median - - Parameters - ---------- - alpha : array-like float in [0,1] - Probability that an rv will be drawn from the returned range - arg1, arg2, ... : array-like - The shape parameter(s) for the distribution (see docstring of the instance - object for more information) - loc: array-like, optioal - location parameter (deafult = 0) - scale : array-like, optional - scale paramter (default = 1) - - Returns - ------- - a, b: array-like (float) - end-points of range that contain alpha % of the rvs - """ - alpha = arr(alpha) - if any((alpha > 1) | (alpha < 0)): - raise ValueError, "alpha must be between 0 and 1 inclusive" - q1 = (1.0-alpha)/2 - q2 = (1.0+alpha)/2 - a = self.ppf(q1, *args, **kwds) - b = self.ppf(q2, *args, **kwds) - return a, b - - class rv_continuous(rv_generic): """A generic continuous random variable class meant for subclassing. @@ -840,13 +683,13 @@ def _mom_integ0(self, x,m,*args): return x**m * self.pdf(x,*args) def _mom0_sc(self, m,*args): - return integrate.quad(self._mom_integ0, self.a, + return scipy.integrate.quad(self._mom_integ0, self.a, self.b, args=(m,)+args)[0] # moment calculated using ppf def _mom_integ1(self, q,m,*args): return (self.ppf(q,*args))**m def _mom1_sc(self, m,*args): - return integrate.quad(self._mom_integ1, 0, 1,args=(m,)+args)[0] + return scipy.integrate.quad(self._mom_integ1, 0, 1,args=(m,)+args)[0] ## These are the methods you must define (standard form functions) def _argcheck(self, *args): @@ -861,11 +704,7 @@ def _pdf(self,x,*args): return derivative(self._cdf,x,dx=1e-5,args=args,order=5) - ## Could also define any of these - def _logpdf(self, x, *args): - return log(self._pdf(x, *args)) - - ##(return 1-d using self._size to get number) + ## Could also define any of these (return 1-d using self._size to get number) def _rvs(self, *args): ## Use basic inverse cdf algorithm for RV generation as default. U = mtrand.sample(self._size) @@ -873,20 +712,14 @@ return Y def _cdf_single_call(self, x, *args): - return integrate.quad(self._pdf, self.a, x, args=args)[0] + return scipy.integrate.quad(self._pdf, self.a, x, args=args)[0] def _cdf(self, x, *args): return self.veccdf(x,*args) - def _logcdf(self, x, *args): - return log(self._cdf(x, *args)) - def _sf(self, x, *args): return 1.0-self._cdf(x,*args) - def _logsf(self, x, *args): - return log(self._sf(x, *args)) - def _ppf(self, q, *args): return self.vecfunc(q,*args) @@ -897,6 +730,7 @@ # If these are defined, the others won't be looked at. # Otherwise, the other set can be defined. def _stats(self,*args, **kwds): + moments = kwds.get('moments') return None, None, None, None # Central moments @@ -942,49 +776,6 @@ return output[()] return output - def logpdf(self, x, *args, **kwds): - """ - Log of the probability density function at x of the given RV. - - This uses more numerically accurate calculation if available. - - Parameters - ---------- - x : array-like - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - logpdf : array-like - Log of the probability density function evaluated at x - - """ - loc,scale=map(kwds.get,['loc','scale']) - args, loc, scale = self._fix_loc_scale(args, loc, scale) - x,loc,scale = map(arr,(x,loc,scale)) - args = tuple(map(arr,args)) - x = arr((x-loc)*1.0/scale) - cond0 = self._argcheck(*args) & (scale > 0) - cond1 = (scale > 0) & (x >= self.a) & (x <= self.b) - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - putmask(output,(1-cond0)*array(cond1,bool),self.badvalue) - goodargs = argsreduce(cond, *((x,)+args+(scale,))) - scale, goodargs = goodargs[-1], goodargs[:-1] - place(output,cond,self._logpdf(*goodargs) - log(scale)) - if output.ndim == 0: - return output[()] - return output - - def cdf(self,x,*args,**kwds): """ Cumulative distribution function at x of the given RV. @@ -1026,48 +817,6 @@ return output[()] return output - def logcdf(self,x,*args,**kwds): - """ - Log of the cumulative distribution function at x of the given RV. - - Parameters - ---------- - x : array-like - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - logcdf : array-like - Log of the cumulative distribution function evaluated at x - - """ - loc,scale=map(kwds.get,['loc','scale']) - args, loc, scale = self._fix_loc_scale(args, loc, scale) - x,loc,scale = map(arr,(x,loc,scale)) - args = tuple(map(arr,args)) - x = (x-loc)*1.0/scale - cond0 = self._argcheck(*args) & (scale > 0) - cond1 = (scale > 0) & (x > self.a) & (x < self.b) - cond2 = (x >= self.b) & cond0 - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - place(output,(1-cond0)*(cond1==cond1),self.badvalue) - place(output,cond2,0.0) - if any(cond): #call only if at least 1 entry - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._logcdf(*goodargs)) - if output.ndim == 0: - return output[()] - return output - def sf(self,x,*args,**kwds): """ Survival function (1-cdf) at x of the given RV. @@ -1108,46 +857,6 @@ return output[()] return output - def logsf(self,x,*args,**kwds): - """ - Log of the Survival function log(1-cdf) at x of the given RV. - - Parameters - ---------- - x : array-like - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - scale : array-like, optional - scale parameter (default=1) - - Returns - ------- - logsf : array-like - Log of the survival function evaluated at x - """ - loc,scale=map(kwds.get,['loc','scale']) - args, loc, scale = self._fix_loc_scale(args, loc, scale) - x,loc,scale = map(arr,(x,loc,scale)) - args = tuple(map(arr,args)) - x = (x-loc)*1.0/scale - cond0 = self._argcheck(*args) & (scale > 0) - cond1 = (scale > 0) & (x > self.a) & (x < self.b) - cond2 = cond0 & (x <= self.a) - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - place(output,(1-cond0)*(cond1==cond1),self.badvalue) - place(output,cond2,0.0) - goodargs = argsreduce(cond, *((x,)+args)) - place(output,cond,self._logsf(*goodargs)) - if output.ndim == 0: - return output[()] - return output - def ppf(self,q,*args,**kwds): """ Percent point function (inverse of cdf) at q of the given RV. @@ -1402,7 +1111,7 @@ return self._munp(n,*args) def _nnlf(self, x, *args): - return -sum(self._logpdf(x, *args),axis=0) + return -sum(log(self._pdf(x, *args)),axis=0) def nnlf(self, theta, x): # - sum (log pdf(x, theta),axis=0) @@ -1424,115 +1133,26 @@ N = len(x) return self._nnlf(x, *args) + N*log(scale) - # return starting point for fit (shape arguments + loc + scale) - def _fitstart(self, data, args=None): - if args is None: - args = (1.0,)*self.numargs - return args + self.fit_loc_scale(data, *args) - - def _reduce_func(self, args, kwds): - args = list(args) - Nargs = len(args) - 2 - fixedn = [] - index = range(Nargs) + [-2, -1] - names = ['f%d' % n for n in range(Nargs)] + ['floc', 'fscale'] - x0 = args[:] - for n, key in zip(index, names): - if kwds.has_key(key): - fixedn.append(n) - args[n] = kwds[key] - del x0[n] - - if len(fixedn) == 0: - func = self.nnlf - restore = None - else: - if len(fixedn) == len(index): - raise ValueError, "All parameters fixed. There is nothing to optimize." - def restore(args, theta): - # Replace with theta for all numbers not in fixedn - # This allows the non-fixed values to vary, but - # we still call self.nnlf with all parameters. - i = 0 - for n in range(Nargs): - if n not in fixedn: - args[n] = theta[i] - i += 1 - return args - - def func(theta, x): - newtheta = restore(args[:], theta) - return self.nnlf(newtheta, x) - - return x0, func, restore, args - - def fit(self, data, *args, **kwds): - """ - Return max like estimators to shape, location, and scale from data - - Starting points for the fit are given by input arguments. For any - arguments not given starting points, self._fitstart(data) is called - to get the starting estimates. - - You can hold some parameters fixed to specific values by passing in - keyword arguments f0..fn for shape paramters and floc, fscale for - location and scale parameters. - - Parameters - ---------- - data : array-like - Data to use in calculating the MLE - args : optional - Starting values for any shape arguments (those not specified - will be determined by _fitstart(data)) - kwds : loc, scale - Starting values for the location and scale parameters - Special keyword arguments are recognized as holding certain - parameters fixed: - f1..fn : hold respective shape paramters fixed - floc : hold location parameter fixed to specified value - fscale : hold scale parameter fixed to specified value - - Return - ------ - shape, loc, scale : tuple of float - MLE estimates for any shape arguments followed by location and scale - """ + loc0, scale0 = map(kwds.get, ['loc', 'scale'],[0.0, 1.0]) Narg = len(args) - if Narg > self.numargs: + if Narg != self.numargs: + if Narg > self.numargs: raise ValueError, "Too many input arguments." - start = [None]*2 - if (Narg < self.numargs) or not (kwds.has_key('loc') and - kwds.has_key('scale')): - start = self._fitstart(data) # get distribution specific starting locations - args += start[Narg:-2] - loc = kwds.get('loc', start[-2]) - scale = kwds.get('scale', start[-1]) - args += (loc, scale) - x0, func, restore, args = self._reduce_func(args, kwds) - vals = optimize.fmin(func,x0,args=(ravel(data),),disp=0) - vals = tuple(vals) - if restore is not None: - vals = restore(args, vals) - return vals + else: + args += (1.0,)*(self.numargs-Narg) + # location and scale are at the end + x0 = args + (loc0, scale0) + return optimize.fmin(self.nnlf,x0,args=(ravel(data),),disp=0) - def fit_loc_scale(self, data, *args): - """ - Estimate loc and scale parameters from data using 1st and 2nd moments - """ + def est_loc_scale(self, data, *args): mu, mu2 = self.stats(*args,**{'moments':'mv'}) - muhat = arr(data).mean() - mu2hat = arr(data).var() + muhat = st.nanmean(data) + mu2hat = st.nanstd(data) Shat = sqrt(mu2hat / mu2) Lhat = muhat - Shat*mu return Lhat, Shat - @np.deprecate - def est_loc_scale(self, data, *args): - """This function is deprecated, use self.fit_loc_scale(data) instead. """ - return self.fit_loc_scale(data, *args) - def freeze(self,*args,**kwds): return rv_frozen(self,*args,**kwds) @@ -1544,7 +1164,7 @@ val = self._pdf(x, *args) return val*log(val) - entr = -integrate.quad(integ,self.a,self.b)[0] + entr = -scipy.integrate.quad(integ,self.a,self.b)[0] if not np.isnan(entr): return entr else: # try with different limits if integration problems @@ -1557,7 +1177,7 @@ lower = low else: lower = self.a - return -integrate.quad(integ,lower,upper)[0] + return -scipy.integrate.quad(integ,lower,upper)[0] def entropy(self, *args, **kwds): @@ -1589,55 +1209,7 @@ else: place(output,cond0,self.vecentropy(*goodargs)+log(scale)) return output - - def expect(self, func=None, args=(), loc=0, scale=1, lb=None, ub=None, - conditional=False, **kwds): - """calculate expected value of a function with respect to the distribution - location and scale only tested on a few examples - - Parameters - ---------- - all parameters are keyword parameters - func : function (default: identity mapping) - Function for which integral is calculated. Takes only one argument. - args : tuple - argument (parameters) of the distribution - lb, ub : numbers - lower and upper bound for integration, default is set to the support - of the distribution - conditional : boolean (False) - If true then the integral is corrected by the conditional probability - of the integration interval. The return value is the expectation - of the function, conditional on being in the given interval. - - Returns - ------- - expected value : float - - Notes - ----- - This function has not been checked for it's behavior when the integral is - not finite. The integration behavior is inherited from integrate.quad. - """ - if func is None: - def fun(x, *args): - return x*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) - else: - def fun(x, *args): - return func(x)*self.pdf(x, *args, **{'loc':loc, 'scale':scale}) - if lb is None: - lb = (self.a - loc)/(1.0*scale) - if ub is None: - ub = (self.b - loc)/(1.0*scale) - if conditional: - invfac = self.sf(lb,*args) - self.sf(ub,*args) - else: - invfac = 1.0 - kwds['args'] = args - return integrate.quad(fun, lb, ub, **kwds)[0] / invfac - - _EULER = 0.577215664901532860606512090082402431042 # -special.psi(1) _ZETA3 = 1.202056903159594285399738161511449990765 # special.zeta(3,1) Apery's constant @@ -1675,16 +1247,10 @@ # loc = mu, scale = std # Keep these implementations out of the class definition so they can be reused # by other distributions. -_norm_pdf_C = math.sqrt(2*pi) -_norm_pdf_logC = math.log(_norm_pdf_C) def _norm_pdf(x): - return exp(-x**2/2.0) / _norm_pdf_C -def _norm_logpdf(x): - return -x**2 / 2.0 - _norm_pdf_logC + return 1.0/sqrt(2*pi)*exp(-x**2/2.0) def _norm_cdf(x): return special.ndtr(x) -def _norm_logcdf(x): - return log(special.ndtr(x)) def _norm_ppf(q): return special.ndtri(q) class norm_gen(rv_continuous): @@ -1692,16 +1258,10 @@ return mtrand.standard_normal(self._size) def _pdf(self,x): return _norm_pdf(x) - def _logpdf(self, x): - return _norm_logpdf(x) def _cdf(self,x): return _norm_cdf(x) - def _logcdf(self, x): - return _norm_logcdf(x) def _sf(self, x): return _norm_cdf(-x) - def _logsf(self, x): - return _norm_logcdf(-x) def _ppf(self,q): return _norm_ppf(q) def _isf(self,q): @@ -1725,9 +1285,7 @@ ## class alpha_gen(rv_continuous): def _pdf(self, x, a): - return 1.0/(x**2)/special.ndtr(a)*_norm_pdf(a-1.0/x) - def _logpdf(self, x, a): - return -2*log(x) + _norm_logpdf(a-1.0/x) - log(special.ndtr(a)) + return 1.0/arr(x**2)/special.ndtr(a)*norm.pdf(a-1.0/x) def _cdf(self, x, a): return special.ndtr(a-1.0/x) / special.ndtr(a) def _ppf(self, q, a): @@ -1773,7 +1331,7 @@ def _ppf(self, q): return sin(pi/2.0*q)**2.0 def _stats(self): - #mup = 0.5, 3.0/8.0, 15.0/48.0, 35.0/128.0 + mup = 0.5, 3.0/8.0, 15.0/48.0, 35.0/128.0 mu = 0.5 mu2 = 1.0/8 g1 = 0 @@ -1799,10 +1357,6 @@ Px = (1.0-x)**(b-1.0) * x**(a-1.0) Px /= special.beta(a,b) return Px - def _logpdf(self, x, a, b): - lPx = (b-1.0)*log(1.0-x) + (a-1.0)*log(x) - lPx -= log(special.beta(a,b)) - return lPx def _cdf(self, x, a, b): return special.btdtr(a,b,x) def _ppf(self, q, a, b): @@ -1814,33 +1368,6 @@ g2 = 6.0*(a**3 + a**2*(1-2*b) + b**2*(1+b) - 2*a*b*(2+b)) g2 /= a*b*(a+b+2)*(a+b+3) return mn, var, g1, g2 - def _fitstart(self, data): - g1 = _skew(data) - g2 = _kurtosis(data) - def func(x): - a, b = x - sk = 2*(b-a)*math.sqrt(a + b + 1) / (a + b + 2) / math.sqrt(a*b) - ku = a**3 - a**2*(2*b-1) + b**2*(b+1) - 2*a*b*(b+2) - ku /= a*b*(a+b+2)*(a+b+3) - ku *= 6 - return [sk-g1, ku-g2] - a, b = optimize.fsolve(func, (1.0, 1.0)) - return super(beta_gen, self)._fitstart(data, args=(a,b)) - def fit(self, data, *args, **kwds): - floc = kwds.get('floc', None) - fscale = kwds.get('fscale', None) - if floc is not None and fscale is not None: - # special case - data = (ravel(data)-floc)/fscale - xbar = data.mean() - v = data.var(ddof=0) - fac = xbar*(1-xbar)/v - 1 - a = xbar * fac - b = (1-xbar) * fac - return a, b, floc, fscale - else: # do general fit - return super(beta_gen, self).fit(data, *args, **kwds) - beta = beta_gen(a=0.0, b=1.0, name='beta',shapes='a, b',extradoc=""" Beta distribution @@ -1857,8 +1384,6 @@ return (u1 / u2) def _pdf(self, x, a, b): return 1.0/special.beta(a,b)*x**(a-1.0)/(1+x)**(a+b) - def _logpdf(self, x, a, b): - return (a-1.0)*log(x) - (a+b)*log(1+x) - log(special.beta(a,b)) def _cdf_skip(self, x, a, b): # remove for now: special.hyp2f1 is incorrect for large a x = where(x==1.0, 1.0-1e-6,x) @@ -2054,12 +1579,10 @@ def _rvs(self, df): return mtrand.chisquare(df,self._size) def _pdf(self, x, df): - return exp(self._logpdf(x, df)) - def _logpdf(self, x, df): - return (df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2. + return exp((df/2.-1)*log(x)-x/2.-gamln(df/2.)-(log(2)*df)/2.) ## Px = x**(df/2.0-1)*exp(-x/2.0) ## Px /= special.gamma(df/2.0)* 2**(df/2.0) -## return log(Px) +## return Px def _cdf(self, x, df): return special.chdtr(df, x) def _sf(self, x, df): @@ -2109,9 +1632,6 @@ def _pdf(self, x, a): ax = abs(x) return 1.0/(2*special.gamma(a))*ax**(a-1.0) * exp(-ax) - def _logpdf(self, x, a): - ax = abs(x) - return (a-1.0)*log(ax) - ax - log(2) - gamln(a) def _cdf(self, x, a): fac = 0.5*special.gammainc(a,abs(x)) return where(x>0,0.5+fac,0.5-fac) @@ -2145,9 +1665,6 @@ ax = abs(x) Px = c/2.0*ax**(c-1.0)*exp(-ax**c) return Px - def _logpdf(self, x, c): - ax = abs(x) - return log(c) - log(2.0) + (c-1.0)*log(ax) - ax**c def _cdf(self, x, c): Cx1 = 0.5*exp(-abs(x)**c) return where(x > 0, 1-Cx1, Cx1) @@ -2179,8 +1696,6 @@ def _pdf(self, x, n): Px = (x)**(n-1.0)*exp(-x)/special.gamma(n) return Px - def _logpdf(self, x, n): - return (n-1.0)*log(x) - x - gamln(n) def _cdf(self, x, n): return special.gdtr(1.0,n,x) def _sf(self, x, n): @@ -2191,7 +1706,7 @@ n = n*1.0 return n, n, 2/sqrt(n), 6/n def _entropy(self, n): - return special.psi(n)*(1-n) + 1 + gamln(n) + return special.psi(n)*(1-n) + 1 + special.gammaln(n) erlang = erlang_gen(a=0.0,name='erlang',longname='An Erlang', shapes='n',extradoc=""" @@ -2207,16 +1722,12 @@ return mtrand.standard_exponential(self._size) def _pdf(self, x): return exp(-x) - def _logpdf(self, x): - return -x def _cdf(self, x): return -expm1(-x) def _ppf(self, q): return -log1p(-q) def _sf(self,x): return exp(-x) - def _logsf(self, x): - return -x def _isf(self,q): return -log(q) def _stats(self): @@ -2240,10 +1751,7 @@ class exponweib_gen(rv_continuous): def _pdf(self, x, a, c): exc = exp(-x**c) - return a*c*(1-exc)**arr(a-1) * exc * x**(c-1) - def _logpdf(self, x, a, c): - exc = exp(-x**c) - return log(a) + log(c) + (a-1.)*log(1-exc) - x**c + (c-1.0)*log(x) + return a*c*(1-exc)**arr(a-1) * exc * x**arr(c-1) def _cdf(self, x, a, c): exm1c = -expm1(-x**c) return arr((exm1c)**a) @@ -2267,9 +1775,6 @@ xbm1 = arr(x**(b-1.0)) xb = xbm1 * x return exp(1)*b*xbm1 * exp(xb - exp(xb)) - def _logpdf(self, x, b): - xb = x**(b-1.0)*x - return 1 + log(b) + (b-1.0)*log(x) + xb - exp(xb) def _cdf(self, x, b): xb = arr(x**b) return -expm1(-expm1(xb)) @@ -2300,8 +1805,6 @@ return t def _pdf(self, x, c): return (x+1)/arr(2*c*sqrt(2*pi*x**3))*exp(-(x-1)**2/arr((2.0*x*c**2))) - def _logpdf(self, x, c): - return log(x+1) - (x-1)**2 / (2.0*x*c**2) - log(2*c) - 0.5*(log(2*pi) + 3*log(x)) def _cdf(self, x, c): return special.ndtr(1.0/c*(sqrt(x)-1.0/arr(sqrt(x)))) def _ppf(self, q, c): @@ -2355,17 +1858,11 @@ def _rvs(self, dfn, dfd): return mtrand.f(dfn, dfd, self._size) def _pdf(self, x, dfn, dfd): -# n = arr(1.0*dfn) -# m = arr(1.0*dfd) -# Px = m**(m/2) * n**(n/2) * x**(n/2-1) -# Px /= (m+n*x)**((n+m)/2)*special.beta(n/2,m/2) - return exp(self._logpdf(x, dfn, dfd)) - def _logpdf(self, x, dfn, dfd): - n = 1.0*dfn - m = 1.0*dfd - lPx = m/2*log(m) + n/2*log(n) + (n/2-1)*log(x) - lPx -= ((n+m)/2)*log(m+n*x) + special.betaln(n/2,m/2) - return lPx + n = arr(1.0*dfn) + m = arr(1.0*dfd) + Px = m**(m/2) * n**(n/2) * x**(n/2-1) + Px /= (m+n*x)**((n+m)/2)*special.beta(n/2,m/2) + return Px def _cdf(self, x, dfn, dfd): return special.fdtr(dfn, dfd, x) def _sf(self, x, dfn, dfd): @@ -2441,8 +1938,6 @@ class frechet_r_gen(rv_continuous): def _pdf(self, x, c): return c*pow(x,c-1)*exp(-pow(x,c)) - def _logpdf(self, x, c): - return log(c) + (c-1)*log(x) - pow(x,c) def _cdf(self, x, c): return -expm1(-pow(x,c)) def _ppf(self, q, c): @@ -2512,8 +2007,6 @@ def _pdf(self, x, c): Px = c*exp(-x)/(1+exp(-x))**(c+1.0) return Px - def _logpdf(self, x, c): - return log(c) - x - (c+1.0)*log1p(exp(-x)) def _cdf(self, x, c): Cx = (1+exp(-x))**(-c) return Cx @@ -2549,8 +2042,6 @@ def _pdf(self, x, c): Px = pow(1+c*x,arr(-1.0-1.0/c)) return Px - def _logpdf(self, x, c): - return (-1.0-1.0/c) * np.log1p(c*x) def _cdf(self, x, c): return 1.0 - pow(1+c*x,arr(-1.0/c)) def _ppf(self, q, c): @@ -2566,7 +2057,6 @@ else: self.b = -1.0 / c return rv_continuous._entropy(self, c) - genpareto = genpareto_gen(a=0.0,name='genpareto', longname="A generalized Pareto", shapes='c',extradoc=""" @@ -2585,8 +2075,6 @@ return (a+b*(-expm1(-c*x)))*exp((-a-b)*x+b*(-expm1(-c*x))/c) def _cdf(self, x, a, b, c): return -expm1((-a-b)*x + b*(-expm1(-c*x))/c) - def _logpdf(self, x, a, b, c): - return np.log(a+b*(-expm1(-c*x))) + (-a-b)*x+b*(-expm1(-c*x))/c genexpon = genexpon_gen(a=0.0,name='genexpon', longname='A generalized exponential', shapes='a, b, c',extradoc=""" @@ -2702,8 +2190,6 @@ return mtrand.standard_gamma(a, self._size) def _pdf(self, x, a): return x**(a-1)*exp(-x)/special.gamma(a) - def _logpdf(self, x, a): - return (a-1)*log(x) - x - gamln(a) def _cdf(self, x, a): return special.gammainc(a, x) def _ppf(self, q, a): @@ -2711,26 +2197,7 @@ def _stats(self, a): return a, a, 2.0/sqrt(a), 6.0/a def _entropy(self, a): - return special.psi(a)*(1-a) + 1 + gamln(a) - def _fitstart(self, data): - a = 4 / _skew(data)**2 - return super(gamma_gen, self)._fitstart(data, args=(a,)) - def fit(self, data, *args, **kwds): - floc = kwds.get('floc', None) - if floc == 0: - xbar = ravel(data).mean() - logx_bar = ravel(log(data)).mean() - s = log(xbar) - logx_bar - def func(a): - return log(a) - special.digamma(a) - s - aest = (3-s + math.sqrt((s-3)**2 + 24*s)) / (12*s) - xa = aest*(1-0.4) - xb = aest*(1+0.4) - a = optimize.brentq(func, xa, xb, disp=0) - scale = xbar / a - return a, floc, scale - else: - return super(gamma_gen, self).fit(data, *args, **kwds) + return special.psi(a)*(1-a) + 1 + special.gammaln(a) gamma = gamma_gen(a=0.0,name='gamma',longname='A gamma', shapes='a',extradoc=""" @@ -2749,7 +2216,7 @@ def _argcheck(self, a, c): return (a > 0) & (c != 0) def _pdf(self, x, a, c): - return abs(c)* exp((c*a-1)*log(x)-x**c- gamln(a)) + return abs(c)* exp((c*a-1)*log(x)-x**c- special.gammaln(a)) def _cdf(self, x, a, c): val = special.gammainc(a,x**c) cond = c + 0*val @@ -2764,7 +2231,7 @@ return special.gamma(a+n*1.0/c) / special.gamma(a) def _entropy(self, a,c): val = special.psi(a) - return a*(1-val) + 1.0/c*val + gamln(a)-log(abs(c)) + return a*(1-val) + 1.0/c*val + special.gammaln(a)-log(abs(c)) gengamma = gengamma_gen(a=0.0, name='gengamma', longname='A generalized gamma', shapes="a, c", extradoc=""" @@ -2841,12 +2308,8 @@ def _pdf(self, x): ex = exp(-x) return ex*exp(-ex) - def _logpdf(self, x): - return -x - exp(-x) def _cdf(self, x): return exp(-exp(-x)) - def _logcdf(self, x): - return -exp(-x) def _ppf(self, q): return -log(-log(q)) def _stats(self): @@ -2866,8 +2329,6 @@ def _pdf(self, x): ex = exp(x) return ex*exp(-ex) - def _logpdf(self, x): - return x - exp(x) def _cdf(self, x): return 1.0-exp(-exp(x)) def _ppf(self, q): @@ -2891,8 +2352,6 @@ class halfcauchy_gen(rv_continuous): def _pdf(self, x): return 2.0/pi/(1.0+x*x) - def _logpdf(self, x): - return np.log(2.0/pi) - np.log1p(x*x) def _cdf(self, x): return 2.0/pi*arctan(x) def _ppf(self, q): @@ -2949,8 +2408,6 @@ return abs(norm.rvs(size=self._size)) def _pdf(self, x): return sqrt(2.0/pi)*exp(-x*x/2.0) - def _logpdf(self, x): - return 0.5 * np.log(2.0/pi) - x*x/2.0 def _cdf(self, x): return special.ndtr(x)*2-1.0 def _ppf(self, q): @@ -3025,17 +2482,15 @@ class invgamma_gen(rv_continuous): def _pdf(self, x, a): - return exp(self._logpdf(x,a)) - def _logpdf(self, x, a): - return (-(a+1)*log(x)-gamln(a) - 1.0/x) + return exp(-(a+1)*log(x)-special.gammaln(a) - 1.0/x) def _cdf(self, x, a): return 1.0-special.gammainc(a, 1.0/x) def _ppf(self, q, a): return 1.0/special.gammaincinv(a,1-q) def _munp(self, n, a): - return exp(gamln(a-n) - gamln(a)) + return exp(special.gammaln(a-n) - special.gammaln(a)) def _entropy(self, a): - return a - (a+1.0)*special.psi(a) + gamln(a) + return a - (a+1.0)*special.psi(a) + special.gammaln(a) invgamma = invgamma_gen(a=0.0, name='invgamma',longname="An inverted gamma", shapes='a',extradoc=""" @@ -3055,8 +2510,6 @@ return mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): return 1.0/sqrt(2*pi*x**3.0)*exp(-1.0/(2*x)*((x-mu)/mu)**2) - def _logpdf(self, x, mu): - return -0.5*log(2*pi) - 1.5*log(x) - ((x-mu)/mu)**2/(2*x) def _cdf(self, x, mu): fac = sqrt(1.0/x) C1 = norm.cdf(fac*(x-mu)/mu) @@ -3292,7 +2745,7 @@ def _rvs(self, c): return log(mtrand.gamma(c, size=self._size)) def _pdf(self, x, c): - return exp(c*x-exp(x)-gamln(c)) + return exp(c*x-exp(x)-special.gammaln(c)) def _cdf(self, x, c): return special.gammainc(c, exp(x)) def _ppf(self, q, c): @@ -3579,14 +3032,9 @@ #return 0.5*sqrt(df)*(sY-1.0/sY) def _pdf(self, x, df): r = arr(df*1.0) - Px = exp(gamln((r+1)/2)-gamln(r/2)) + Px = exp(special.gammaln((r+1)/2)-special.gammaln(r/2)) Px /= sqrt(r*pi)*(1+(x**2)/r)**((r+1)/2) return Px - def _logpdf(self, x, df): - r = df*1.0 - lPx = gamln((r+1)/2)-gamln(r/2) - lPx -= 0.5*log(r*pi) + (r+1)/2*log(1+(x**2)/r) - return lPx def _cdf(self, x, df): return special.stdtr(df, x) def _sf(self, x, df): @@ -3729,14 +3177,8 @@ class lomax_gen(rv_continuous): def _pdf(self, x, c): return c*1.0/(1.0+x)**(c+1.0) - def _logpdf(self, x, c): - return log(c) - (c+1)*log(1+x) def _cdf(self, x, c): return 1.0-1.0/(1.0+x)**c - def _sf(self, x, c): - return 1.0/(1.0+x)**c - def _logsf(self, x, c): - return -c*log(1+x) def _ppf(self, q, c): return pow(1.0-q,-1.0/c)-1 def _stats(self, c): @@ -3760,12 +3202,8 @@ class powerlaw_gen(rv_continuous): def _pdf(self, x, a): return a*x**(a-1.0) - def _logpdf(self, x, a): - return log(a) + (a-1)*log(x) def _cdf(self, x, a): return x**(a*1.0) - def _logcdf(self, x, a): - return a*log(x) def _ppf(self, q, a): return pow(q, 1.0/a) def _stats(self, a): @@ -3810,12 +3248,10 @@ class powernorm_gen(rv_continuous): def _pdf(self, x, c): - return c*_norm_pdf(x)* \ - (_norm_cdf(-x)**(c-1.0)) - def _logpdf(self, x, c): - return log(c) + _norm_logpdf(x) + (c-1)*_norm_logcdf(-x) + return c*norm.pdf(x)* \ + (norm.cdf(-x)**(c-1.0)) def _cdf(self, x, c): - return 1.0-_norm_cdf(-x)**(c*1.0) + return 1.0-norm.cdf(-x)**(c*1.0) def _ppf(self, q, c): return -norm.ppf(pow(1.0-q,1.0/c)) powernorm = powernorm_gen(name='powernorm', longname="A power normal", @@ -3890,8 +3326,6 @@ def _pdf(self, x, a, b): # argcheck should be called before _pdf return 1.0/(x*self.d) - def _logpdf(self, x, a, b): - return -log(x) - log(self.d) def _cdf(self, x, a, b): return (log(x)-log(a)) / self.d def _ppf(self, q, a, b): @@ -3917,8 +3351,6 @@ class rice_gen(rv_continuous): def _pdf(self, x, b): return x*exp(-(x*x+b*b)/2.0)*special.i0(x*b) - def _logpdf(self, x, b): - return log(x) - (x*x + b*b)/2.0 + log(special.i0(x*b)) def _munp(self, n, b): nd2 = n/2.0 n1 = 1+nd2 @@ -3943,13 +3375,11 @@ return 1.0/mtrand.wald(mu, 1.0, size=self._size) def _pdf(self, x, mu): return 1.0/sqrt(2*pi*x)*exp(-(1-mu*x)**2.0 / (2*x*mu**2.0)) - def _logpdf(self, x, mu): - return -(1-mu*x)**2.0 / (2*x*mu**2.0) - 0.5*log(2*pi*x) def _cdf(self, x, mu): trm1 = 1.0/mu - x trm2 = 1.0/mu + x isqx = 1.0/sqrt(x) - return 1.0-_norm_cdf(isqx*trm1)-exp(2.0/mu)*_norm_cdf(-isqx*trm2) + return 1.0-norm.cdf(isqx*trm1)-exp(2.0/mu)*norm.cdf(-isqx*trm2) # xb=50 or something large is necessary for stats to converge without exception recipinvgauss = recipinvgauss_gen(a=0.0, xb=50, name='recipinvgauss', longname="A reciprocal inverse Gaussian", @@ -4027,8 +3457,6 @@ return (b > 0) def _pdf(self, x, b): return exp(-x)/(1-exp(-b)) - def _logpdf(self, x, b): - return -x - log(1-exp(-b)) def _cdf(self, x, b): return (1.0-exp(-x))/(1-exp(-b)) def _ppf(self, q, b): @@ -4064,25 +3492,19 @@ def _argcheck(self, a, b): self.a = a self.b = b - self._nb = _norm_cdf(b) - self._na = _norm_cdf(a) - self._delta = self._nb - self._na - self._logdelta = log(self._delta) + self.nb = norm._cdf(b) + self.na = norm._cdf(a) return (a != b) - # All of these assume that _argcheck is called first - # and no other thread calls _pdf before. def _pdf(self, x, a, b): - return _norm_pdf(x) / self._delta - def _logpdf(self, x, a, b): - return _norm_logpdf(x) - self._logdelta + return norm._pdf(x) / (self.nb - self.na) def _cdf(self, x, a, b): - return (_norm_cdf(x) - self._na) / self._delta + return (norm._cdf(x) - self.na) / (self.nb - self.na) def _ppf(self, q, a, b): - return norm._ppf(q*self._nb + self._na*(1.0-q)) + return norm._ppf(q*self.nb + self.na*(1.0-q)) def _stats(self, a, b): - nA, nB = self._na, self._nb + nA, nB = self.na, self.nb d = nB - nA - pA, pB = _norm_pdf(a), _norm_pdf(b) + pA, pB = norm._pdf(a), norm._pdf(b) mu = (pA - pB) / d #correction sign mu2 = 1 + (a*pA - b*pB) / d - mu*mu return mu, mu2, None, None @@ -4133,7 +3555,7 @@ def _entropy(self, lam): def integ(p): return log(pow(p,lam-1)+pow(1-p,lam-1)) - return integrate.quad(integ,0,1)[0] + return scipy.integrate.quad(integ,0,1)[0] tukeylambda = tukeylambda_gen(name='tukeylambda', longname="A Tukey-Lambda", shapes="lam", extradoc=""" @@ -4219,13 +3641,11 @@ %(example)s """ def _rvs(self): - return mtrand.wald(1.0, 1.0, size=self._size) + return invnorm_gen._rvs(self, 1.0) def _pdf(self, x): - return invnorm._pdf(x, 1.0) - def _logpdf(self, x): - return invnorm._logpdf(x, 1.0) + return invnorm.pdf(x,1.0) def _cdf(self, x): - return invnorm._logcdf(x, 1.0) + return invnorm.cdf(x,1,0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 wald = wald_gen(a=0.0, name="wald", extradoc=""" @@ -4499,7 +3919,7 @@ moment_tol=1e-8,values=None,inc=1,longname=None, shapes=None, extradoc=None): - super(rv_generic,self).__init__() + rv_generic.__init__(self) if badvalue is None: badvalue = nan @@ -4613,11 +4033,8 @@ return cond def _pmf(self, k, *args): - return self._cdf(k,*args) - self._cdf(k-1,*args) + return self.cdf(k,*args) - self.cdf(k-1,*args) - def _logpmf(self, k, *args): - return log(self._pmf(k, *args)) - def _cdfsingle(self, k, *args): m = arange(int(self.a),k+1) return sum(self._pmf(m,*args),axis=0) @@ -4626,15 +4043,9 @@ k = floor(x) return self._cdfvec(k,*args) - def _logcdf(self, x, *args): - return log(self._cdf(x, *args)) - def _sf(self, x, *args): return 1.0-self._cdf(x,*args) - def _logsf(self, x, *args): - return log(self._sf(x, *args)) - def _ppf(self, q, *args): return self._vecppf(q, *args) @@ -4669,7 +4080,7 @@ """ kwargs['discrete'] = True - return super(rv_discrete, self).rvs(*args, **kwargs) + return rv_generic.rvs(self, *args, **kwargs) def pmf(self, k,*args, **kwds): """ @@ -4708,44 +4119,6 @@ return output[()] return output - def logpmf(self, k,*args, **kwds): - """ - Log of the probability mass function at k of the given RV. - - - Parameters - ---------- - k : array-like - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - - Returns - ------- - logpmf : array-like - Log of the probability mass function evaluated at k - - """ - loc = kwds.get('loc') - args, loc = self._fix_loc(args, loc) - k,loc = map(arr,(k,loc)) - args = tuple(map(arr,args)) - k = arr((k-loc)) - cond0 = self._argcheck(*args) - cond1 = (k >= self.a) & (k <= self.b) & self._nonzero(k,*args) - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - place(output,(1-cond0)*(cond1==cond1),self.badvalue) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logpmf(*goodargs)) - if output.ndim == 0: - return output[()] - return output - def cdf(self, k, *args, **kwds): """ Cumulative distribution function at k of the given RV @@ -4786,47 +4159,6 @@ return output[()] return output - def logcdf(self, k, *args, **kwds): - """ - Log of the cumulative distribution function at k of the given RV - - Parameters - ---------- - k : array-like, int - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - - Returns - ------- - logcdf : array-like - Log of the cumulative distribution function evaluated at k - - """ - loc = kwds.get('loc') - args, loc = self._fix_loc(args, loc) - k,loc = map(arr,(k,loc)) - args = tuple(map(arr,args)) - k = arr((k-loc)) - cond0 = self._argcheck(*args) - cond1 = (k >= self.a) & (k < self.b) - cond2 = (k >= self.b) - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - place(output,(1-cond0)*(cond1==cond1),self.badvalue) - place(output,cond2*(cond0==cond0), 0.0) - - if any(cond): - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logcdf(*goodargs)) - if output.ndim == 0: - return output[()] - return output - def sf(self,k,*args,**kwds): """ Survival function (1-cdf) at k of the given RV @@ -4865,45 +4197,6 @@ return output[()] return output - def logsf(self,k,*args,**kwds): - """ - Log of the survival function (1-cdf) at k of the given RV - - Parameters - ---------- - k : array-like - quantiles - arg1, arg2, arg3,... : array-like - The shape parameter(s) for the distribution (see docstring of the - instance object for more information) - loc : array-like, optional - location parameter (default=0) - - Returns - ------- - sf : array-like - Survival function evaluated at k - - """ - loc= kwds.get('loc') - args, loc = self._fix_loc(args, loc) - k,loc = map(arr,(k,loc)) - args = tuple(map(arr,args)) - k = arr(k-loc) - cond0 = self._argcheck(*args) - cond1 = (k >= self.a) & (k <= self.b) - cond2 = (k < self.a) & cond0 - cond = cond0 & cond1 - output = empty(shape(cond),'d') - output.fill(NINF) - place(output,(1-cond0)*(cond1==cond1),self.badvalue) - place(output,cond2,0.0) - goodargs = argsreduce(cond, *((k,)+args)) - place(output,cond,self._logsf(*goodargs)) - if output.ndim == 0: - return output[()] - return output - def ppf(self,q,*args,**kwds): """ Percent point function (inverse of cdf) at q of the given RV @@ -4917,8 +4210,6 @@ instance object for more information) loc : array-like, optional location parameter (default=0) - scale: array-like, optional - scale parameter (default=1) Returns ------- @@ -5192,109 +4483,6 @@ def __call__(self, *args, **kwds): return self.freeze(*args,**kwds) - def expect(self, func=None, args=(), loc=0, lb=None, ub=None, conditional=False): - """calculate expected value of a function with respect to the distribution - for discrete distribution - - Parameters - ---------- - fn : function (default: identity mapping) - Function for which integral is calculated. Takes only one argument. - args : tuple - argument (parameters) of the distribution - optional keyword parameters - lb, ub : numbers - lower and upper bound for integration, default is set to the support - of the distribution, lb and ub are inclusive (ul<=k<=ub) - conditional : boolean (False) - If true then the expectation is corrected by the conditional - probability of the integration interval. The return value is the - expectation of the function, conditional on being in the given - interval (k such that ul<=k<=ub). - - Returns - ------- - expected value : float - - Notes - ----- - * function is not vectorized - * accuracy: uses self.moment_tol as stopping criterium - for heavy tailed distribution e.g. zipf(4), accuracy for - mean, variance in example is only 1e-5, - increasing precision (moment_tol) makes zipf very slow - * suppnmin=100 internal parameter for minimum number of points to evaluate - could be added as keyword parameter, to evaluate functions with - non-monotonic shapes, points include integers in (-suppnmin, suppnmin) - * uses maxcount=1000 limits the number of points that are evaluated - to break loop for infinite sums - (a maximum of suppnmin+1000 positive plus suppnmin+1000 negative integers - are evaluated) - - """ - - #moment_tol = 1e-12 # increase compared to self.moment_tol, - # too slow for only small gain in precision for zipf - - #avoid endless loop with unbound integral, eg. var of zipf(2) - maxcount = 1000 - suppnmin = 100 #minimum number of points to evaluate (+ and -) - - if func is None: - def fun(x): - #loc and args from outer scope - return (x+loc)*self._pmf(x, *args) - else: - def fun(x): - #loc and args from outer scope - return func(x+loc)*self._pmf(x, *args) - # used pmf because _pmf does not check support in randint - # and there might be problems(?) with correct self.a, self.b at this stage - # maybe not anymore, seems to work now with _pmf - - self._argcheck(*args) # (re)generate scalar self.a and self.b - if lb is None: - lb = (self.a) - if ub is None: - ub = (self.b) - if conditional: - invfac = self.sf(lb,*args) - self.sf(ub+1,*args) - else: - invfac = 1.0 - - tot = 0.0 - low, upp = self._ppf(0.001, *args), self._ppf(0.999, *args) - low = max(min(-suppnmin, low), lb) - upp = min(max(suppnmin, upp), ub) - supp = np.arange(low, upp+1, self.inc) #check limits - #print 'low, upp', low, upp - tot = np.sum(fun(supp)) - diff = 1e100 - pos = upp + self.inc - count = 0 - - #handle cases with infinite support - - while (pos <= ub) and (diff > self.moment_tol) and count <= maxcount: - diff = fun(pos) - tot += diff - pos += self.inc - count += 1 - - if self.a < 0: #handle case when self.a = -inf - diff = 1e100 - pos = low - self.inc - while (pos >= lb) and (diff > self.moment_tol) and count <= maxcount: - diff = fun(pos) - tot += diff - pos -= self.inc - count += 1 - if count > maxcount: - # fixme: replace with proper warning - print 'sum did not converge' - return tot/invfac - - # Binomial class binom_gen(rv_discrete): @@ -5303,13 +4491,11 @@ def _argcheck(self, n, pr): self.b = n return (n>=0) & (pr >= 0) & (pr <= 1) - def _logpmf(self, x, n, pr): - k = floor(x) - combiln = (gamln(n+1) - (gamln(k+1) + - gamln(n-k+1))) - return combiln + k*np.log(pr) + (n-k)*np.log(1-pr) def _pmf(self, x, n, pr): - return exp(self._logpmf(x, n, pr)) + k = floor(x) + combiln = (special.gammaln(n+1) - (special.gammaln(k+1) + + special.gammaln(n-k+1))) + return np.exp(combiln + k*np.log(pr) + (n-k)*np.log(1-pr)) def _cdf(self, x, n, pr): k = floor(x) vals = special.bdtr(k,n,pr) @@ -5352,18 +4538,16 @@ return binom_gen._rvs(self, 1, pr) def _argcheck(self, pr): return (pr >=0 ) & (pr <= 1) - def _logpmf(self, x, pr): - return binom._logpmf(x, 1, pr) def _pmf(self, x, pr): - return binom._pmf(x, 1, pr) + return binom_gen._pmf(self, x, 1, pr) def _cdf(self, x, pr): - return binom._cdf(x, 1, pr) + return binom_gen._cdf(self, x, 1, pr) def _sf(self, x, pr): - return binom._sf(x, 1, pr) + return binom_gen._sf(self, x, 1, pr) def _ppf(self, q, pr): - return binom._ppf(q, 1, pr) + return binom_gen._ppf(self, q, 1, pr) def _stats(self, pr): - return binom._stats(1, pr) + return binom_gen._stats(self, 1, pr) def _entropy(self, pr): return -pr*log(pr)-(1-pr)*log(1-pr) bernoulli = bernoulli_gen(b=1,name='bernoulli',shapes="pr",extradoc=""" @@ -5397,11 +4581,8 @@ def _argcheck(self, n, pr): return (n >= 0) & (pr >= 0) & (pr <= 1) def _pmf(self, x, n, pr): - coeff = exp(gamln(n+x) - gamln(x+1) - gamln(n)) + coeff = exp(special.gammaln(n+x) - special.gammaln(x+1) - special.gammaln(n)) return coeff * power(pr,n) * power(1-pr,x) - def _logpmf(self, x, n, pr): - coeff = gamln(n+x) - gamln(x+1) - gamln(n) - return coeff + n*log(pr) + x*log(1-pr) def _cdf(self, x, n, pr): k = floor(x) return special.betainc(n, k+1, pr) @@ -5441,8 +4622,6 @@ return (pr<=1) & (pr >= 0) def _pmf(self, k, pr): return (1-pr)**(k-1) * pr - def _logpmf(self, k, pr): - return (k-1)*log(1-pr) + pr def _cdf(self, x, pr): k = floor(x) return (1.0-(1.0-pr)**k) @@ -5481,16 +4660,14 @@ self.a = N-(M-n) self.b = min(n,N) return cond - def _logpmf(self, k, M, n, N): + def _pmf(self, k, M, n, N): tot, good = M, n bad = tot - good - return gamln(good+1) - gamln(good-k+1) - gamln(k+1) + gamln(bad+1) \ - - gamln(bad-N+k+1) - gamln(N-k+1) - gamln(tot+1) + gamln(tot-N+1) \ - + gamln(N+1) - def _pmf(self, k, M, n, N): + return np.exp(lgam(good+1) - lgam(good-k+1) - lgam(k+1) + lgam(bad+1) + - lgam(bad-N+k+1) - lgam(N-k+1) - lgam(tot+1) + lgam(tot-N+1) + + lgam(N+1)) #same as the following but numerically more precise #return comb(good,k) * comb(bad,N-k) / comb(tot,N) - return exp(self._logpmf(k, M, n, N)) def _stats(self, M, n, N): tot, good = M, n n = good*1.0 @@ -5570,7 +4747,7 @@ def _rvs(self, mu): return mtrand.poisson(mu, self._size) def _pmf(self, k, mu): - Pk = k*log(mu)-gamln(k+1) - mu + Pk = k*log(mu)-special.gammaln(k+1) - mu return exp(Pk) def _cdf(self, x, mu): k = floor(x) Modified: branches/0.8.x/scipy/stats/morestats.py =================================================================== --- branches/0.8.x/scipy/stats/morestats.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/morestats.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -18,7 +18,7 @@ from numpy.testing.decorators import setastest import warnings -__all__ = ['find_repeats', 'mvsdist', +__all__ = ['find_repeats', 'bayes_mvs', 'kstat', 'kstatvar', 'probplot', 'ppcc_max', 'ppcc_plot', 'boxcox_llf', 'boxcox', 'boxcox_normmax', 'boxcox_normplot', 'shapiro', 'anderson', 'ansari', 'bartlett', 'levene', 'binom_test', @@ -100,7 +100,7 @@ return _gauss_mvs(x, n, alpha) xbar = x.mean() C = x.var() - # mean + # mean fac = sqrt(C/(n-1)) tval = distributions.t.ppf((1+alpha)/2.0,n-1) delta = fac*tval @@ -136,40 +136,6 @@ return (mp,(ma,mb)),(vp,(va,vb)),(stp,(sta,stb)) -def mvsdist(data): - """Return 'frozen' distributions for mean, variance, and standard deviation of data. - - Parameters - ---------- - data : array-like (raveled to 1-d) - - Returns - ------- - mdist : "frozen" distribution object - Distribution object representing the mean of the data - vdist : "frozen" distribution object - Distribution object representing the variance of the data - sdist : "frozen" distribution object - Distribution object representing the standard deviation of the data - """ - x = ravel(data) - n = len(x) - if (n < 2): - raise ValueError, "Need at least 2 data-points." - xbar = x.mean() - C = x.var() - if (n > 1000): # gaussian approximations for large n - mdist = distributions.norm(loc=xbar, scale=math.sqrt(C/n)) - sdist = distributions.norm(loc=math.sqrt(C), scale=math.sqrt(C/(2.*n))) - vdist = distributions.norm(loc=C, scale=math.sqrt(2.0/n)*C) - else: - nm1 = n-1 - fac = n*C/2. - val = nm1/2. - mdist = distributions.t(nm1,loc=xbar,scale=math.sqrt(C/nm1)) - sdist = distributions.gengamma(val,-2,scale=math.sqrt(fac)) - vdist = distributions.invgamma(val,scale=fac) - return mdist, vdist, sdist ################################ Modified: branches/0.8.x/scipy/stats/stats.py =================================================================== --- branches/0.8.x/scipy/stats/stats.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/stats.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -2,7 +2,7 @@ # # Disclaimer # -# This software is provided "as-is". There are no exprgoessed or implied +# This software is provided "as-is". There are no expressed or implied # warranties of any kind, including, but not limited to, the warranties # of merchantability and fittness for a given application. In no event # shall Gary Strangman be liable for any direct, indirect, incidental, @@ -1777,6 +1777,18 @@ +def zmap(scores, compare, axis=0): + """ +Returns an array of z-scores the shape of scores (e.g., [x,y]), compared to +array passed to compare (e.g., [time,x,y]). Assumes collapsing over dim 0 +of the compare array. + +""" + mns = np.mean(compare,axis) + sstd = samplestd(compare,0) + return (scores - mns) / sstd + + ##################################### ####### TRIMMING FUNCTIONS ####### ##################################### Modified: branches/0.8.x/scipy/stats/tests/test_continuous_basic.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_continuous_basic.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/tests/test_continuous_basic.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -175,14 +175,11 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname - if distname in ['wald']: continue - yield check_pdf_logpdf, distfn, arg, distname - yield check_cdf_logcdf, distfn, arg, distname - yield check_sf_logsf, distfn, arg, distname if distname in distmissing: alpha = 0.01 - # yield check_distribution_rvs, dist, args, alpha, rvs + yield check_distribution_rvs, dist, args, alpha, rvs + @npt.dec.slow def test_cont_basic_slow(): # same as above for slow distributions @@ -205,14 +202,14 @@ yield check_cdf_ppf, distfn, arg, distname yield check_sf_isf, distfn, arg, distname yield check_pdf, distfn, arg, distname - yield check_pdf_logpdf, distfn, arg, distname - yield check_cdf_logcdf, distfn, arg, distname - yield check_sf_logsf, distfn, arg, distname #yield check_oth, distfn, arg # is still missing if distname in distmissing: alpha = 0.01 yield check_distribution_rvs, dist, args, alpha, rvs + + + def check_moment(distfn, arg, m, v, msg): m1 = distfn.moment(1,*arg) m2 = distfn.moment(2,*arg) @@ -317,37 +314,7 @@ npt.assert_almost_equal(pdfv, cdfdiff, decimal=DECIMAL, err_msg= msg + ' - cdf-pdf relationship') -def check_pdf_logpdf(distfn, args, msg): - # compares pdf at several points with the log of the pdf - points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) - vals = distfn.ppf(points, *args) - pdf = distfn.pdf(vals, *args) - logpdf = distfn.logpdf(vals, *args) - pdf = pdf[pdf != 0] - logpdf = logpdf[np.isfinite(logpdf)] - npt.assert_almost_equal(np.log(pdf), logpdf, decimal=7, err_msg=msg + " - logpdf-log(pdf) relationship") -def check_sf_logsf(distfn, args, msg): - # compares sf at several points with the log of the sf - points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) - vals = distfn.ppf(points, *args) - sf = distfn.sf(vals, *args) - logsf = distfn.logsf(vals, *args) - sf = sf[sf != 0] - logsf = logsf[np.isfinite(logsf)] - npt.assert_almost_equal(np.log(sf), logsf, decimal=7, err_msg=msg + " - logsf-log(sf) relationship") - -def check_cdf_logcdf(distfn, args, msg): - # compares cdf at several points with the log of the cdf - points = np.array([0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8]) - vals = distfn.ppf(points, *args) - cdf = distfn.cdf(vals, *args) - logcdf = distfn.logcdf(vals, *args) - cdf = cdf[cdf != 0] - logcdf = logcdf[np.isfinite(logcdf)] - npt.assert_almost_equal(np.log(cdf), logcdf, decimal=7, err_msg=msg + " - logcdf-log(cdf) relationship") - - def check_distribution_rvs(dist, args, alpha, rvs): #test from scipy.stats.tests #this version reuses existing random variables Modified: branches/0.8.x/scipy/stats/tests/test_distributions.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_distributions.py 2010-06-03 02:41:25 UTC (rev 6481) +++ branches/0.8.x/scipy/stats/tests/test_distributions.py 2010-06-03 14:00:33 UTC (rev 6482) @@ -380,47 +380,6 @@ assert_array_equal(b, a) assert_array_equal(c, [2] * numpy.size(a)) -import sys -class TestFitMethod(TestCase): - skip = ['ncf'] - def test_fit(self): - for func, dist, args, alpha in test_all_distributions(): - if dist in self.skip: - continue - distfunc = getattr(stats, dist) - res = distfunc.rvs(*args, size=200) - vals = distfunc.fit(res) - if dist in ['erlang', 'frechet']: - assert(len(vals)==len(args)) - else: - assert(len(vals) == 2+len(args)) - def test_fix_fit(self): - for func, dist, args, alpha in test_all_distributions(): - # Not sure why 'ncf', and 'beta' are failing - # erlang and frechet have different len(args) than distfunc.numargs - if dist in self.skip + ['erlang', 'frechet', 'beta']: - continue - distfunc = getattr(stats, dist) - res = distfunc.rvs(*args, size=200) - vals = distfunc.fit(res,floc=0) - vals2 = distfunc.fit(res,fscale=1) - assert(len(vals) == 2+len(args)) - assert(vals[-2] == 0) - assert(vals2[-1] == 1) - assert(len(vals2) == 2+len(args)) - if len(args) > 0: - vals3 = distfunc.fit(res, f0=args[0]) - assert(len(vals3) == 2+len(args)) - assert(vals3[0] == args[0]) - if len(args) > 1: - vals4 = distfunc.fit(res, f1=args[1]) - assert(len(vals4) == 2+len(args)) - assert(vals4[1] == args[1]) - if len(args) > 2: - vals5 = distfunc.fit(res, f2=args[2]) - assert(len(vals5) == 2+len(args)) - assert(vals5[2] == args[2]) - if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Thu Jun 3 10:00:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 3 Jun 2010 09:00:53 -0500 (CDT) Subject: [Scipy-svn] r6483 - branches/0.8.x/doc/release Message-ID: <20100603140053.A7FAB39CB09@scipy.org> Author: rgommers Date: 2010-06-03 09:00:53 -0500 (Thu, 03 Jun 2010) New Revision: 6483 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: REF: Remove mention of changes to scipy.stats from release notes. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-03 14:00:33 UTC (rev 6482) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-03 14:00:53 UTC (rev 6483) @@ -180,22 +180,6 @@ argument to `scipy.io.savemat` and friends. -Improvements to scipy.stats ---------------------------- - -* addition of mvsdist function which returns distribution objects - providing full information about mean, variance, and standard deviation - of a data-set -* addition of 'median', 'mean', 'std', 'var', 'interval', 'logpdf', - 'logcdf', 'logsf', 'expect' -* addition of 'fit_loc_scale' (deprecation of 'est_loc_scale') -* improvement to 'fit' method of distribution objects so that sub-classes - can add a _fitstart method to fix the starting position of the arguments. - Also, some parameters can be fixed and the data-fitting proceed over the - remaining free parameters using f0..fn and floc and fscale keywords to the - fit function. - - Removed features ================ From scipy-svn at scipy.org Fri Jun 4 11:02:05 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 4 Jun 2010 10:02:05 -0500 (CDT) Subject: [Scipy-svn] r6484 - branches/0.8.x/scipy/signal/tests Message-ID: <20100604150205.ACE2339CAE7@scipy.org> Author: rgommers Date: 2010-06-04 10:02:05 -0500 (Fri, 04 Jun 2010) New Revision: 6484 Modified: branches/0.8.x/scipy/signal/tests/test_ltisys.py Log: BUG: Fix signal.ltisys test that crashes interpreter on Windows. Modified: branches/0.8.x/scipy/signal/tests/test_ltisys.py =================================================================== --- branches/0.8.x/scipy/signal/tests/test_ltisys.py 2010-06-03 14:00:53 UTC (rev 6483) +++ branches/0.8.x/scipy/signal/tests/test_ltisys.py 2010-06-04 15:02:05 UTC (rev 6484) @@ -14,7 +14,7 @@ def test_basic(self): for p, q, r in [ (3, 3, 3), - (0, 3, 3), + (1, 3, 3), (1, 1, 1)]: yield self.tst_matrix_shapes, p, q, r @@ -64,7 +64,7 @@ # This test triggers a "BadCoefficients" warning from scipy.signal.filter_design, # but the test passes. I think the warning is related to the incomplete handling # of multi-input systems in scipy.signal. - + # A system with two state variables, two inputs, and one output. A = np.array([[-1.0, 0.0], [0.0, -2.0]]) B = np.array([[1.0, 0.0], [0.0, 1.0]]) @@ -116,7 +116,7 @@ def test_03(self): """Specify an initial condition as a scalar.""" - + # First order system: x'(t) + x(t) = u(t), x(0)=3.0 # Exact impulse response is x(t) = 4*exp(-t). system = ([1.0],[1.0,1.0]) @@ -175,7 +175,7 @@ def test_03(self): """Specify an initial condition as a scalar.""" - + # First order system: x'(t) + x(t) = u(t), x(0)=3.0 # Exact step response is x(t) = 1 + 2*exp(-t). system = ([1.0],[1.0,1.0]) From scipy-svn at scipy.org Fri Jun 4 12:47:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 4 Jun 2010 11:47:49 -0500 (CDT) Subject: [Scipy-svn] r6485 - tags Message-ID: <20100604164749.BA2EE39CAED@scipy.org> Author: rgommers Date: 2010-06-04 11:47:49 -0500 (Fri, 04 Jun 2010) New Revision: 6485 Added: tags/0.8.0b1/ Log: Create tag 0.8.0b1 Copied: tags/0.8.0b1 (from rev 6484, branches/0.8.x) From scipy-svn at scipy.org Sat Jun 5 22:57:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 5 Jun 2010 21:57:59 -0500 (CDT) Subject: [Scipy-svn] r6486 - branches/0.8.x Message-ID: <20100606025759.D3EE839CAEF@scipy.org> Author: rgommers Date: 2010-06-05 21:57:59 -0500 (Sat, 05 Jun 2010) New Revision: 6486 Modified: branches/0.8.x/setup.py Log: REL: reset version tag after beta release. Modified: branches/0.8.x/setup.py =================================================================== --- branches/0.8.x/setup.py 2010-06-04 16:47:49 UTC (rev 6485) +++ branches/0.8.x/setup.py 2010-06-06 02:57:59 UTC (rev 6486) @@ -43,8 +43,8 @@ MAJOR = 0 MINOR = 8 MICRO = 0 -ISRELEASED = True -VERSION = '%d.%d.%db1' % (MAJOR, MINOR, MICRO) +ISRELEASED = False +VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) # BEFORE importing distutils, remove MANIFEST. distutils doesn't properly # update it when the contents of directories change. From scipy-svn at scipy.org Mon Jun 7 02:20:43 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 01:20:43 -0500 (CDT) Subject: [Scipy-svn] r6487 - trunk/scipy/sparse/linalg/dsolve Message-ID: <20100607062043.27BEC39CAF8@scipy.org> Author: cdavid Date: 2010-06-07 01:20:42 -0500 (Mon, 07 Jun 2010) New Revision: 6487 Modified: trunk/scipy/sparse/linalg/dsolve/SConscript Log: BUG: attempt at fixing #1176. Modified: trunk/scipy/sparse/linalg/dsolve/SConscript =================================================================== --- trunk/scipy/sparse/linalg/dsolve/SConscript 2010-06-06 02:57:59 UTC (rev 6486) +++ trunk/scipy/sparse/linalg/dsolve/SConscript 2010-06-07 06:20:42 UTC (rev 6487) @@ -1,4 +1,5 @@ -from os.path import join as pjoin +import os +import glob import sys from numscons import GetNumpyEnvironment @@ -29,46 +30,22 @@ if sys.platform == 'win32': superlu_def.append((('NO_TIMER'), 1)) superlu_def.append((('USE_VENDOR_BLAS'), 2)) -superlu_env.Append(CPPDEFINES = superlu_def) +superlu_env.Append(CPPDEFINES=superlu_def) +superlu_env.Append(CPPPATH=[os.path.join('SuperLU', 'SRC')]) -superlu_src = [pjoin('SuperLU', 'SRC', s) for s in [ "ccolumn_bmod.c", -"ccolumn_dfs.c", "ccopy_to_ucol.c", "cgscon.c", "cgsequ.c", "cgsrfs.c", -"cgssv.c", "cgssvx.c", "cgstrf.c", "cgstrs.c", "clacon.c", "clangs.c", -"claqgs.c", "cmemory.c", "colamd.c", "cpanel_bmod.c", "cpanel_dfs.c", -"cpivotL.c", "cpivotgrowth.c", "cpruneL.c", "creadhb.c", "csnode_bmod.c", -"csnode_dfs.c", "csp_blas2.c", "csp_blas3.c", "cutil.c", "dGetDiagU.c", -"dcolumn_bmod.c", "dcolumn_dfs.c", "dcomplex.c", "dcopy_to_ucol.c", "dgscon.c", -"dgsequ.c", "dgsrfs.c", "dgssv.c", "dgssvx.c", "dgstrf.c", "dgstrs.c", -"dgstrsL.c", "dlacon.c", "dlamch.c", "dlangs.c", "dlaqgs.c", "dmemory.c", -"dpanel_bmod.c", "dpanel_dfs.c", "dpivotL.c", "dpivotgrowth.c", "dpruneL.c", -"dreadhb.c", "dsnode_bmod.c", "dsnode_dfs.c", "dsp_blas2.c", "dsp_blas3.c", -"dutil.c", "dzsum1.c", "get_perm_c.c", "heap_relax_snode.c", "icmax1.c", -"izmax1.c", "memory.c", "mmd.c", "relax_snode.c", "scolumn_bmod.c", -"scolumn_dfs.c", "scomplex.c", "scopy_to_ucol.c", "scsum1.c", "sgscon.c", -"sgsequ.c", "sgsrfs.c", "sgssv.c", "sgssvx.c", "sgstrf.c", "sgstrs.c", -"slacon.c", "slamch.c", "slangs.c", "slaqgs.c", "smemory.c", "sp_coletree.c", -"sp_ienv.c", "sp_preorder.c", "spanel_bmod.c", "spanel_dfs.c", "spivotL.c", -"spivotgrowth.c", "spruneL.c", "sreadhb.c", "ssnode_bmod.c", "ssnode_dfs.c", -"ssp_blas2.c", "ssp_blas3.c", "superlu_timer.c", "sutil.c", "util.c", -"xerbla.c", "zcolumn_bmod.c", "zcolumn_dfs.c", "zcopy_to_ucol.c", "zgscon.c", -"zgsequ.c", "zgsrfs.c", "zgssv.c", "zgssvx.c", "zgstrf.c", "zgstrs.c", -"zlacon.c", "zlangs.c", "zlaqgs.c", "zmemory.c", "zpanel_bmod.c", -"zpanel_dfs.c", "zpivotL.c", "zpivotgrowth.c", "zpruneL.c", "zreadhb.c", -"zsnode_bmod.c", "zsnode_dfs.c", "zsp_blas2.c", "zsp_blas3.c", "zutil.c"]] +superlu_src = env.Glob(os.path.join('SuperLU', 'SRC', "*.c")) # XXX: we should detect whether lsame is already defined in BLAS/LAPACK. Here, # when using MSVC + MKL, lsame is already in MKL if not (built_with_mstools(env) and (not built_with_gnu_f77(env))): - superlu_src.append(pjoin("SuperLU", "SRC", "lsame.c")) -superlu = superlu_env.DistutilsStaticExtLibrary('superlu_src', source = superlu_src) + superlu_src.append(os.path.join("SuperLU", "SRC", "lsame.c")) +superlu = superlu_env.DistutilsStaticExtLibrary('superlu_src', source=superlu_src) # Build python extensions pyenv = env.Clone() -pyenv.Append(CPPPATH = [pjoin('SuperLU', 'SRC')]) -pyenv.Prepend(LIBS = superlu) +pyenv.Append(CPPPATH=[os.path.join('SuperLU', 'SRC')]) +pyenv.Prepend(LIBPATH=["."]) +pyenv.Prepend(LIBS=["superlu_src"]) common_src = ['_superlu_utils.c', '_superluobject.c'] -for prec in ['z', 'd', 'c', 's']: - pyenv.NumpyPythonExtension('_%ssuperlu' % prec, - source = common_src + \ - ['_%ssuperlumodule.c' % prec]) +pyenv.NumpyPythonExtension('_superlu', source=common_src + ['_superlumodule.c']) From scipy-svn at scipy.org Mon Jun 7 07:42:24 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 06:42:24 -0500 (CDT) Subject: [Scipy-svn] r6488 - branches/0.8.x Message-ID: <20100607114224.7DAB239CAEB@scipy.org> Author: rgommers Date: 2010-06-07 06:42:24 -0500 (Mon, 07 Jun 2010) New Revision: 6488 Modified: branches/0.8.x/pavement.py Log: REL: update Changelog generation for 0.8.x branch. Modified: branches/0.8.x/pavement.py =================================================================== --- branches/0.8.x/pavement.py 2010-06-07 06:20:42 UTC (rev 6487) +++ branches/0.8.x/pavement.py 2010-06-07 11:42:24 UTC (rev 6488) @@ -110,7 +110,7 @@ # Start/end of the log (from git) LOG_START = 'svn/tags/0.7.0' -LOG_END = 'master' +LOG_END = '0.8.x' # Virtualenv bootstrap stuff BOOTSTRAP_DIR = "bootstrap" From scipy-svn at scipy.org Mon Jun 7 07:50:47 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 06:50:47 -0500 (CDT) Subject: [Scipy-svn] r6489 - branches/0.8.x/doc/release Message-ID: <20100607115047.588A339CAEB@scipy.org> Author: rgommers Date: 2010-06-07 06:50:47 -0500 (Mon, 07 Jun 2010) New Revision: 6489 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: REL: update release notes for 0.8.0 release. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 11:42:24 UTC (rev 6488) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 11:50:47 UTC (rev 6489) @@ -4,7 +4,7 @@ .. contents:: -SciPy 0.8.0 is the culmination of XXX months of hard work. It contains +SciPy 0.8.0 is the culmination of 17 months of hard work. It contains many new features, numerous bug-fixes, improved test coverage and better documentation. There have been a number of deprecations and API changes in this release, which are documented below. All users @@ -12,16 +12,14 @@ of bug-fixes and optimizations. Moreover, our development attention will now shift to bug-fix releases on the 0.8.x branch, and on adding new features on the development trunk. This release requires Python -2.4 - 2.6 and NumPy 1.3 or greater. +2.4 - 2.6 and NumPy 1.4.1 or greater. Please note that SciPy is still considered to have "Beta" status, as we work toward a SciPy 1.0.0 release. The 1.0.0 release will mark a major milestone in the development of SciPy, after which changing the package structure or API will be much more difficult. Whilst these pre-1.0 releases are considered to have "Beta" status, we are -committed to making them as bug-free as possible. For example, in -addition to fixing numerous bugs in this release, we have also doubled -the number of unit tests since the last release. +committed to making them as bug-free as possible. However, until the 1.0 release, we are aggressively reviewing and refining the functionality, organization, and interface. This is being @@ -37,7 +35,8 @@ Python 3 compatibility is planned and is currently technically feasible, since Numpy has been ported. However, since the Python 3 compatible Numpy 2.0 has not been released yet, support for Python 3 -in Scipy might not yet be included in Scipy 0.8. +in Scipy is not yet included in Scipy 0.8. SciPy 0.9, planned for fall +2010, will very likely include experimental support for Python 3. Major documentation improvements ================================ From scipy-svn at scipy.org Mon Jun 7 08:20:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 07:20:19 -0500 (CDT) Subject: [Scipy-svn] r6490 - trunk/scipy/stats Message-ID: <20100607122019.5260439CAEB@scipy.org> Author: rgommers Date: 2010-06-07 07:20:19 -0500 (Mon, 07 Jun 2010) New Revision: 6490 Modified: trunk/scipy/stats/distributions.py Log: DOC: merge wiki edits for stats.distributions.rv_continuous and rv_discrete. Those docstrings are not complete yet, but it's an improvement on what's currently in trunk. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-07 11:50:47 UTC (rev 6489) +++ trunk/scipy/stats/distributions.py 2010-06-07 12:20:19 UTC (rev 6490) @@ -694,23 +694,32 @@ class rv_continuous(rv_generic): - """A generic continuous random variable class meant for subclassing. + """ + A generic continuous random variable class meant for subclassing. `rv_continuous` is a base class to construct specific distribution classes - and instances from for continuous random variables. + and instances from for continuous random variables. It cannot be used + directly as a distribution. Parameters ---------- - momtype : - a : - b : - xa : - xb : + momtype : int, optional + The type of generic moment calculation to use (check this). + a : float, optional + Lower bound of the support of the distribution, default is minus + infinity. + b : float, optional + Upper bound of the support of the distribution, default is plus + infinity. + xa : float, optional + Lower bound for fixed point calculation for generic ppf. + xb : float, optional + Upper bound for fixed point calculation for generic ppf. xtol : float, optional - The tolerance .... + The tolerance for fixed point calculation for generic ppf. badvalue : object, optional - The value in (masked) arrays that indicates a value that should be - ignored. + The value in a result arrays that indicates a value that for which + some argument restriction is violated, default is np.nan. name : str, optional The name of the instance. This string is used to construct the default example for distributions. @@ -720,7 +729,7 @@ for backwards compatibility, do not use for new subclasses. shapes : str, optional The shape of the distribution. For example ``"m, n"`` for a - distribution that takes two integers as the first two arguments for all + distribution that takes two integers as the two shape arguments for all its methods. extradoc : str, optional This string is used as the last part of the docstring returned when a @@ -729,8 +738,135 @@ Methods ------- - ... + rvs(, loc=0, scale=1, size=1) + random variates + pdf(x, , loc=0, scale=1) + probability density function + + cdf(x, , loc=0, scale=1) + cumulative density function + + sf(x, , loc=0, scale=1) + survival function (1-cdf --- sometimes more accurate) + + ppf(q, , loc=0, scale=1) + percent point function (inverse of cdf --- quantiles) + + isf(q, , loc=0, scale=1) + inverse survival function (inverse of sf) + + moments(n, ) + non-central n-th moment of the standard distribution (oc=0, scale=1) + + stats(, loc=0, scale=1, moments='mv') + mean('m'), variance('v'), skew('s'), and/or kurtosis('k') + + entropy(, loc=0, scale=1) + (differential) entropy of the RV. + + fit(data, , loc=0, scale=1) + Parameter estimates for generic data + + __call__(, loc=0, scale=1) + calling a distribution instance creates a frozen RV object with the + same methods but holding the given shape, location, and scale fixed. + see Notes section + + **Parameters for Methods** + + x : array-like + quantiles + q : array-like + lower or upper tail probability + : array-like + shape parameters + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + size : int or tuple of ints, optional + shape of random variates (default computed from input arguments ) + moments : string, optional + composed of letters ['mvsk'] specifying which moments to compute where + 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and + 'k' = (Fisher's) kurtosis. (default='mv') + n : int + order of moment to calculate in method moments + + + **Methods that can be overwritten by subclasses** + :: + + _rvs + _pdf + _cdf + _sf + _ppf + _isf + _stats + _munp + _entropy + _argcheck + + There are additional (internal and private) generic methods that can + be useful for cross-checking and for debugging, but might work in all + cases when directly called. + + + Notes + ----- + + **Frozen Distribution** + + Alternatively, the object may be called (as a function) to fix the shape, + location, and scale parameters returning a "frozen" continuous RV object: + + rv = generic(, loc=0, scale=1) + frozen RV object with the same methods but holding the given shape, + location, and scale fixed + + **Subclassing** + + New random variables can be defined by subclassing rv_continuous class + and re-defining at least the + + _pdf or the cdf method which will be given clean arguments (in between a + and b) and passing the argument check method + + If postive argument checking is not correct for your RV + then you will also need to re-define :: + + _argcheck + + Correct, but potentially slow defaults exist for the remaining + methods but for speed and/or accuracy you can over-ride :: + + _cdf, _ppf, _rvs, _isf, _sf + + Rarely would you override _isf and _sf but you could. + + Statistics are computed using numerical integration by default. + For speed you can redefine this using + + _stats + - take shape parameters and return mu, mu2, g1, g2 + - If you can't compute one of these, return it as None + - Can also be defined with a keyword argument moments= + where is a string composed of 'm', 'v', 's', + and/or 'k'. Only the components appearing in string + should be computed and returned in the order 'm', 'v', + 's', or 'k' with missing values returned as None + + OR + + You can override + + _munp + takes n and shape parameters and returns + the nth non-central moment of the distribution. + + Examples -------- To create a new Gaussian distribution, we would do the following:: @@ -740,6 +876,7 @@ def _pdf: ... ... + """ def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, @@ -4444,20 +4581,28 @@ # x_k, p(x_k) lists in initialization class rv_discrete(rv_generic): - """A generic discrete random variable class meant for subclassing. + """ + A generic discrete random variable class meant for subclassing. `rv_discrete` is a base class to construct specific distribution classes - and instances from for discrete random variables. + and instances from for discrete random variables. rv_discrete can be used + to construct an arbitrary distribution with defined by a list of support + points and the corresponding probabilities. Parameters ---------- - momtype : - a : - b : - xa : - xb : - xtol : float, optional - The tolerance .... + a : float, optional + Lower bound of the support of the distribution, default: 0 + b : float, optional + Upper bound of the support of the distribution, default: plus infinity + moment_tol : float, optional + The tolerance for the generic calculation of moments + values : tuple of two array_like + (xk, pk) where xk are points (integers) with positive probability pk + with sum(pk) = 1 + inc : integer + increment for the support of the distribution, default: 1 + other values have not been tested badvalue : object, optional The value in (masked) arrays that indicates a value that should be ignored. @@ -4477,20 +4622,95 @@ subclass has no docstring of its own. Note: `extradoc` exists for backwards compatibility, do not use for new subclasses. + Methods ------- - ... + generic.rvs(, loc=0, size=1) + random variates + + generic.pmf(x, , loc=0) + probability mass function + + generic.cdf(x, , loc=0) + cumulative density function + + generic.sf(x, , loc=0) + survival function (1-cdf --- sometimes more accurate) + + generic.ppf(q, , loc=0) + percent point function (inverse of cdf --- percentiles) + + generic.isf(q, , loc=0) + inverse survival function (inverse of sf) + + generic.stats(, loc=0, moments='mv') + mean('m', axis=0), variance('v'), skew('s'), and/or kurtosis('k') + + generic.entropy(, loc=0) + entropy of the RV + + generic(, loc=0) + calling a distribution instance returns a frozen distribution + + Notes + ----- + + Alternatively, the object may be called (as a function) to fix + the shape and location parameters returning a + "frozen" discrete RV object: + + myrv = generic(, loc=0) + - frozen RV object with the same methods but holding the given shape + and location fixed. + + You can construct an aribtrary discrete rv where P{X=xk} = pk + by passing to the rv_discrete initialization method (through the + values=keyword) a tuple of sequences (xk, pk) which describes only those + values of X (xk) that occur with nonzero probability (pk). + + To create a new discrete distribution, we would do the following:: + + class poisson_gen(rv_continuous): + #"Poisson distribution" + def _pmf(self, k, mu): + ... + + and create an instance + + poisson = poisson_gen(name="poisson", shapes="mu", longname='A Poisson') + + The docstring can be created from a template. + + Examples -------- - To create a new Gaussian distribution, we would do the following:: - class gaussian_gen(rv_continuous): - "Gaussian distribution" - def _pdf: - ... - ... + >>> import matplotlib.pyplot as plt + >>> numargs = generic.numargs + >>> [ ] = ['Replace with resonable value', ]*numargs + Display frozen pmf: + + >>> rv = generic() + >>> x = np.arange(0, np.min(rv.dist.b, 3)+1) + >>> h = plt.plot(x, rv.pmf(x)) + + Check accuracy of cdf and ppf: + + >>> prb = generic.cdf(x, ) + >>> h = plt.semilogy(np.abs(x-generic.ppf(prb, ))+1e-20) + + Random number generation: + + >>> R = generic.rvs(, size=100) + + Custom made discrete distribution: + + >>> vals = [arange(7), (0.1, 0.2, 0.3, 0.1, 0.1, 0.1, 0.1)] + >>> custm = rv_discrete(name='custm', values=vals) + >>> h = plt.plot(vals[0], custm.pmf(vals[0])) + """ def __init__(self, a=0, b=inf, name=None, badvalue=None, From scipy-svn at scipy.org Mon Jun 7 08:22:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 07:22:06 -0500 (CDT) Subject: [Scipy-svn] r6491 - branches/0.8.x/scipy/stats Message-ID: <20100607122206.66A6039CAEB@scipy.org> Author: rgommers Date: 2010-06-07 07:22:06 -0500 (Mon, 07 Jun 2010) New Revision: 6491 Modified: branches/0.8.x/scipy/stats/distributions.py Log: DOC: merge wiki edits for stats.distributions.rv_continuous and rv_discrete. Those docstrings are not complete yet, but it's an improvement on what's currently in trunk. Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-07 12:20:19 UTC (rev 6490) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-07 12:22:06 UTC (rev 6491) @@ -537,23 +537,32 @@ class rv_continuous(rv_generic): - """A generic continuous random variable class meant for subclassing. + """ + A generic continuous random variable class meant for subclassing. `rv_continuous` is a base class to construct specific distribution classes - and instances from for continuous random variables. + and instances from for continuous random variables. It cannot be used + directly as a distribution. Parameters ---------- - momtype : - a : - b : - xa : - xb : + momtype : int, optional + The type of generic moment calculation to use (check this). + a : float, optional + Lower bound of the support of the distribution, default is minus + infinity. + b : float, optional + Upper bound of the support of the distribution, default is plus + infinity. + xa : float, optional + Lower bound for fixed point calculation for generic ppf. + xb : float, optional + Upper bound for fixed point calculation for generic ppf. xtol : float, optional - The tolerance .... + The tolerance for fixed point calculation for generic ppf. badvalue : object, optional - The value in (masked) arrays that indicates a value that should be - ignored. + The value in a result arrays that indicates a value that for which + some argument restriction is violated, default is np.nan. name : str, optional The name of the instance. This string is used to construct the default example for distributions. @@ -563,7 +572,7 @@ for backwards compatibility, do not use for new subclasses. shapes : str, optional The shape of the distribution. For example ``"m, n"`` for a - distribution that takes two integers as the first two arguments for all + distribution that takes two integers as the two shape arguments for all its methods. extradoc : str, optional This string is used as the last part of the docstring returned when a @@ -572,8 +581,135 @@ Methods ------- - ... + rvs(, loc=0, scale=1, size=1) + random variates + pdf(x, , loc=0, scale=1) + probability density function + + cdf(x, , loc=0, scale=1) + cumulative density function + + sf(x, , loc=0, scale=1) + survival function (1-cdf --- sometimes more accurate) + + ppf(q, , loc=0, scale=1) + percent point function (inverse of cdf --- quantiles) + + isf(q, , loc=0, scale=1) + inverse survival function (inverse of sf) + + moments(n, ) + non-central n-th moment of the standard distribution (oc=0, scale=1) + + stats(, loc=0, scale=1, moments='mv') + mean('m'), variance('v'), skew('s'), and/or kurtosis('k') + + entropy(, loc=0, scale=1) + (differential) entropy of the RV. + + fit(data, , loc=0, scale=1) + Parameter estimates for generic data + + __call__(, loc=0, scale=1) + calling a distribution instance creates a frozen RV object with the + same methods but holding the given shape, location, and scale fixed. + see Notes section + + **Parameters for Methods** + + x : array-like + quantiles + q : array-like + lower or upper tail probability + : array-like + shape parameters + loc : array-like, optional + location parameter (default=0) + scale : array-like, optional + scale parameter (default=1) + size : int or tuple of ints, optional + shape of random variates (default computed from input arguments ) + moments : string, optional + composed of letters ['mvsk'] specifying which moments to compute where + 'm' = mean, 'v' = variance, 's' = (Fisher's) skew and + 'k' = (Fisher's) kurtosis. (default='mv') + n : int + order of moment to calculate in method moments + + + **Methods that can be overwritten by subclasses** + :: + + _rvs + _pdf + _cdf + _sf + _ppf + _isf + _stats + _munp + _entropy + _argcheck + + There are additional (internal and private) generic methods that can + be useful for cross-checking and for debugging, but might work in all + cases when directly called. + + + Notes + ----- + + **Frozen Distribution** + + Alternatively, the object may be called (as a function) to fix the shape, + location, and scale parameters returning a "frozen" continuous RV object: + + rv = generic(, loc=0, scale=1) + frozen RV object with the same methods but holding the given shape, + location, and scale fixed + + **Subclassing** + + New random variables can be defined by subclassing rv_continuous class + and re-defining at least the + + _pdf or the cdf method which will be given clean arguments (in between a + and b) and passing the argument check method + + If postive argument checking is not correct for your RV + then you will also need to re-define :: + + _argcheck + + Correct, but potentially slow defaults exist for the remaining + methods but for speed and/or accuracy you can over-ride :: + + _cdf, _ppf, _rvs, _isf, _sf + + Rarely would you override _isf and _sf but you could. + + Statistics are computed using numerical integration by default. + For speed you can redefine this using + + _stats + - take shape parameters and return mu, mu2, g1, g2 + - If you can't compute one of these, return it as None + - Can also be defined with a keyword argument moments= + where is a string composed of 'm', 'v', 's', + and/or 'k'. Only the components appearing in string + should be computed and returned in the order 'm', 'v', + 's', or 'k' with missing values returned as None + + OR + + You can override + + _munp + takes n and shape parameters and returns + the nth non-central moment of the distribution. + + Examples -------- To create a new Gaussian distribution, we would do the following:: @@ -583,6 +719,7 @@ def _pdf: ... ... + """ def __init__(self, momtype=1, a=None, b=None, xa=-10.0, xb=10.0, @@ -3866,20 +4003,28 @@ # x_k, p(x_k) lists in initialization class rv_discrete(rv_generic): - """A generic discrete random variable class meant for subclassing. + """ + A generic discrete random variable class meant for subclassing. `rv_discrete` is a base class to construct specific distribution classes - and instances from for discrete random variables. + and instances from for discrete random variables. rv_discrete can be used + to construct an arbitrary distribution with defined by a list of support + points and the corresponding probabilities. Parameters ---------- - momtype : - a : - b : - xa : - xb : - xtol : float, optional - The tolerance .... + a : float, optional + Lower bound of the support of the distribution, default: 0 + b : float, optional + Upper bound of the support of the distribution, default: plus infinity + moment_tol : float, optional + The tolerance for the generic calculation of moments + values : tuple of two array_like + (xk, pk) where xk are points (integers) with positive probability pk + with sum(pk) = 1 + inc : integer + increment for the support of the distribution, default: 1 + other values have not been tested badvalue : object, optional The value in (masked) arrays that indicates a value that should be ignored. @@ -3899,20 +4044,95 @@ subclass has no docstring of its own. Note: `extradoc` exists for backwards compatibility, do not use for new subclasses. + Methods ------- - ... + generic.rvs(, loc=0, size=1) + random variates + + generic.pmf(x, , loc=0) + probability mass function + + generic.cdf(x, , loc=0) + cumulative density function + + generic.sf(x, , loc=0) + survival function (1-cdf --- sometimes more accurate) + + generic.ppf(q, , loc=0) + percent point function (inverse of cdf --- percentiles) + + generic.isf(q, , loc=0) + inverse survival function (inverse of sf) + + generic.stats(, loc=0, moments='mv') + mean('m', axis=0), variance('v'), skew('s'), and/or kurtosis('k') + + generic.entropy(, loc=0) + entropy of the RV + + generic(, loc=0) + calling a distribution instance returns a frozen distribution + + Notes + ----- + + Alternatively, the object may be called (as a function) to fix + the shape and location parameters returning a + "frozen" discrete RV object: + + myrv = generic(, loc=0) + - frozen RV object with the same methods but holding the given shape + and location fixed. + + You can construct an aribtrary discrete rv where P{X=xk} = pk + by passing to the rv_discrete initialization method (through the + values=keyword) a tuple of sequences (xk, pk) which describes only those + values of X (xk) that occur with nonzero probability (pk). + + To create a new discrete distribution, we would do the following:: + + class poisson_gen(rv_continuous): + #"Poisson distribution" + def _pmf(self, k, mu): + ... + + and create an instance + + poisson = poisson_gen(name="poisson", shapes="mu", longname='A Poisson') + + The docstring can be created from a template. + + Examples -------- - To create a new Gaussian distribution, we would do the following:: - class gaussian_gen(rv_continuous): - "Gaussian distribution" - def _pdf: - ... - ... + >>> import matplotlib.pyplot as plt + >>> numargs = generic.numargs + >>> [ ] = ['Replace with resonable value', ]*numargs + Display frozen pmf: + + >>> rv = generic() + >>> x = np.arange(0, np.min(rv.dist.b, 3)+1) + >>> h = plt.plot(x, rv.pmf(x)) + + Check accuracy of cdf and ppf: + + >>> prb = generic.cdf(x, ) + >>> h = plt.semilogy(np.abs(x-generic.ppf(prb, ))+1e-20) + + Random number generation: + + >>> R = generic.rvs(, size=100) + + Custom made discrete distribution: + + >>> vals = [arange(7), (0.1, 0.2, 0.3, 0.1, 0.1, 0.1, 0.1)] + >>> custm = rv_discrete(name='custm', values=vals) + >>> h = plt.plot(vals[0], custm.pmf(vals[0])) + """ def __init__(self, a=0, b=inf, name=None, badvalue=None, From scipy-svn at scipy.org Mon Jun 7 13:04:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 12:04:45 -0500 (CDT) Subject: [Scipy-svn] r6492 - branches/0.8.x/doc/release Message-ID: <20100607170445.6ED2B39CAEB@scipy.org> Author: rgommers Date: 2010-06-07 12:04:45 -0500 (Mon, 07 Jun 2010) New Revision: 6492 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: REL: change next NumPy version in release notes from 2.0 to 1.5. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 12:22:06 UTC (rev 6491) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 17:04:45 UTC (rev 6492) @@ -34,7 +34,7 @@ Python 3 compatibility is planned and is currently technically feasible, since Numpy has been ported. However, since the Python 3 -compatible Numpy 2.0 has not been released yet, support for Python 3 +compatible Numpy 1.5 has not been released yet, support for Python 3 in Scipy is not yet included in Scipy 0.8. SciPy 0.9, planned for fall 2010, will very likely include experimental support for Python 3. From scipy-svn at scipy.org Mon Jun 7 15:01:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 7 Jun 2010 14:01:34 -0500 (CDT) Subject: [Scipy-svn] r6493 - branches/0.8.x/doc/release Message-ID: <20100607190134.B2A5739CAEB@scipy.org> Author: ptvirtan Date: 2010-06-07 14:01:34 -0500 (Mon, 07 Jun 2010) New Revision: 6493 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: DOC: release: add scipy.special improvements to release notes Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 17:04:45 UTC (rev 6492) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-07 19:01:34 UTC (rev 6493) @@ -178,7 +178,33 @@ of this change; for now we suggest using the ``oned_as='row'`` keyword argument to `scipy.io.savemat` and friends. +Faster evaluation of orthogonal polynomials +------------------------------------------- +Values of orthogonal polynomials can be evaluated with new vectorized functions +in ``scipy.special``: ``eval_legendre``, ``eval_chebyt``, ``eval_chebyu``, +``eval_chebyc``, ``eval_chebys``, ``eval_jacobi``, ``eval_laguerre``, +``eval_genlaguerre``, ``eval_hermite``, ``eval_hermitenorm``, +``eval_gegenbauer``, ``eval_sh_legendre``, ``eval_sh_chebyt``, +``eval_sh_chebyu``, ``eval_sh_jacobi``. This is faster than constructing the +full coefficient representation of the polynomials, which was previously the +only available way. + +Note that the previous orthogonal polynomial routines will now also invoke this +feature, when possible. + +Lambert W function +------------------ + +``scipy.special.lambertw`` can now be used for evaluating the Lambert W +function. + +Improved hypergeometric 2F1 function +------------------------------------ + +Implementation of ``scipy.special.hyp2f1`` for real parameters was revised. +The new version should produce accurate values for all real parameters. + Removed features ================ From scipy-svn at scipy.org Wed Jun 9 00:24:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 8 Jun 2010 23:24:45 -0500 (CDT) Subject: [Scipy-svn] r6494 - trunk/scipy/stats/tests Message-ID: <20100609042445.42B3439C4B4@scipy.org> Author: oliphant Date: 2010-06-08 23:24:45 -0500 (Tue, 08 Jun 2010) New Revision: 6494 Modified: trunk/scipy/stats/tests/test_distributions.py Log: Fix syntax error in test_distributions.py for Python < 2.6 Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2010-06-07 19:01:34 UTC (rev 6493) +++ trunk/scipy/stats/tests/test_distributions.py 2010-06-09 04:24:45 UTC (rev 6494) @@ -388,7 +388,7 @@ if dist in self.skip: continue distfunc = getattr(stats, dist) - res = distfunc.rvs(*args, size=200) + res = distfunc.rvs(*args, **{'size':200}) vals = distfunc.fit(res) if dist in ['erlang', 'frechet']: assert(len(vals)==len(args)) @@ -402,7 +402,7 @@ if dist in self.skip + ['erlang', 'frechet', 'beta']: continue distfunc = getattr(stats, dist) - res = distfunc.rvs(*args, size=200) + res = distfunc.rvs(*args, **{'size':200}) vals = distfunc.fit(res,floc=0) vals2 = distfunc.fit(res,fscale=1) assert(len(vals) == 2+len(args)) From scipy-svn at scipy.org Wed Jun 9 00:27:20 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 8 Jun 2010 23:27:20 -0500 (CDT) Subject: [Scipy-svn] r6495 - trunk/scipy/stats Message-ID: <20100609042720.97B8239C4B4@scipy.org> Author: oliphant Date: 2010-06-08 23:27:20 -0500 (Tue, 08 Jun 2010) New Revision: 6495 Modified: trunk/scipy/stats/distributions.py Log: Use correct underlying function. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-09 04:24:45 UTC (rev 6494) +++ trunk/scipy/stats/distributions.py 2010-06-09 04:27:20 UTC (rev 6495) @@ -4360,7 +4360,7 @@ def _logpdf(self, x): return invnorm._logpdf(x, 1.0) def _cdf(self, x): - return invnorm._logcdf(x, 1.0) + return invnorm._cdf(x, 1.0) def _stats(self): return 1.0, 1.0, 3.0, 15.0 wald = wald_gen(a=0.0, name="wald", extradoc=""" From scipy-svn at scipy.org Wed Jun 9 13:46:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 9 Jun 2010 12:46:03 -0500 (CDT) Subject: [Scipy-svn] r6496 - trunk/scipy/io/matlab Message-ID: <20100609174603.07CF839CB4C@scipy.org> Author: stefan Date: 2010-06-09 12:46:02 -0500 (Wed, 09 Jun 2010) New Revision: 6496 Modified: trunk/scipy/io/matlab/mio_utils.c Log: BUG: Regenerate Cython for io/matlab/mio_utils. Modified: trunk/scipy/io/matlab/mio_utils.c =================================================================== --- trunk/scipy/io/matlab/mio_utils.c 2010-06-09 04:27:20 UTC (rev 6495) +++ trunk/scipy/io/matlab/mio_utils.c 2010-06-09 17:46:02 UTC (rev 6496) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Thu May 27 17:30:06 2010 */ +/* Generated by Cython 0.11.3 on Wed Jun 9 11:39:04 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,7 +6,6 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else - #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -18,7 +17,6 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif - #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -28,9 +26,7 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) - #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif - #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -38,19 +34,20 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) + #define PyBytes_CheckExact PyString_CheckExact typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -64,32 +61,22 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif - #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif - #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif - #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif - #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type #define PyString_CheckExact PyUnicode_CheckExact -#else - #define PyBytes_Type PyString_Type - #define PyBytes_CheckExact PyString_CheckExact -#endif - -#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -104,17 +91,13 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) - + #define PyBytes_Type PyString_Type #endif - #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif - #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -128,7 +111,6 @@ #else #define _USE_MATH_DEFINES #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -138,7 +120,6 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif - #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -158,14 +139,12 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifndef CYTHON_INLINE - #if defined(__GNUC__) - #define CYTHON_INLINE __inline__ - #elif defined(_MSC_VER) - #define CYTHON_INLINE __inline - #else - #define CYTHON_INLINE - #endif +#ifdef __GNUC__ +#define INLINE __inline__ +#elif _WIN32 +#define INLINE __inline +#else +#define INLINE #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -187,8 +166,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -252,9 +231,9 @@ #endif #endif -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -302,11 +281,68 @@ #endif #endif -#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) - #undef _Complex_I - #define _Complex_I 1.0fj +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; #endif +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + #else + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + #endif +#else + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + #else + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + #endif +#else + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< long double > __pyx_t_long_double_complex; + #else + typedef long double _Complex __pyx_t_long_double_complex; + #endif +#else + typedef struct { long double real, imag; } __pyx_t_long_double_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + #else + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); + #endif +#else + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); +#endif + +/* Type declarations */ + typedef npy_int8 __pyx_t_5numpy_int8_t; typedef npy_int16 __pyx_t_5numpy_int16_t; @@ -327,14 +363,14 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; +typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; + +typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; + typedef npy_long __pyx_t_5numpy_int_t; typedef npy_longlong __pyx_t_5numpy_long_t; -typedef npy_intp __pyx_t_5numpy_intp_t; - -typedef npy_uintp __pyx_t_5numpy_uintp_t; - typedef npy_ulong __pyx_t_5numpy_uint_t; typedef npy_ulonglong __pyx_t_5numpy_ulong_t; @@ -345,28 +381,6 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - -/* Type declarations */ - typedef npy_cfloat __pyx_t_5numpy_cfloat_t; typedef npy_cdouble __pyx_t_5numpy_cdouble_t; @@ -375,54 +389,38 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; -#ifndef CYTHON_REFNANNY - #define CYTHON_REFNANNY 0 -#endif - -#if CYTHON_REFNANNY - typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*SetupContext)(const char*, int, const char*); - void (*FinishContext)(void**); - } __Pyx_RefNannyAPIStruct; - static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; - static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { - PyObject *m = NULL, *p = NULL; - void *r = NULL; - m = PyImport_ImportModule((char *)modname); - if (!m) goto end; - p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); - if (!p) goto end; - r = PyLong_AsVoidPtr(p); - end: - Py_XDECREF(p); - Py_XDECREF(m); - return (__Pyx_RefNannyAPIStruct *)r; - } - #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) - #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) - #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) - #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#ifdef CYTHON_REFNANNY +typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*NewContext)(const char*, int, const char*); + void (*FinishContext)(void**); +} __Pyx_RefnannyAPIStruct; +static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; +#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") +#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) +#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) +#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) #else - #define __Pyx_RefNannySetupContext(name) - #define __Pyx_RefNannyFinishContext() - #define __Pyx_INCREF(r) Py_INCREF(r) - #define __Pyx_DECREF(r) Py_DECREF(r) - #define __Pyx_GOTREF(r) - #define __Pyx_GIVEREF(r) - #define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_INCREF(r) Py_INCREF(r) +#define __Pyx_DECREF(r) Py_DECREF(r) +#define __Pyx_GOTREF(r) +#define __Pyx_GIVEREF(r) +#define __Pyx_XDECREF(r) Py_XDECREF(r) +#define __Pyx_SetupRefcountContext(name) +#define __Pyx_FinishRefcountContext() #endif /* CYTHON_REFNANNY */ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -435,7 +433,7 @@ __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); @@ -455,7 +453,7 @@ __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); @@ -476,7 +474,7 @@ __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); @@ -495,16 +493,16 @@ return r; } -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); +static INLINE void __Pyx_RaiseTooManyValuesError(void); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); +static INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ @@ -515,7 +513,7 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -530,16 +528,6 @@ #define __Pyx_CIMAG(z) ((z).imag) #endif -#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX - #define __Pyx_SET_CREAL(z,x) ((z).real(x)) - #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) -#else - #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) - #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) -#endif - -static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) @@ -548,7 +536,7 @@ #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_is_zerof(z) ((z)==0.0) #define __Pyx_c_conjf(z) (::std::conj(z)) /*#define __Pyx_c_absf(z) (::std::abs(z))*/ #else @@ -557,19 +545,17 @@ /*#define __Pyx_c_absf(z) (cabsf(z))*/ #endif #else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + static INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ #endif -static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) @@ -578,7 +564,7 @@ #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_is_zero(z) ((z)==0.0) #define __Pyx_c_conj(z) (::std::conj(z)) /*#define __Pyx_c_abs(z) (::std::abs(z))*/ #else @@ -587,55 +573,83 @@ /*#define __Pyx_c_abs(z) (cabs(z))*/ #endif #else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + static INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eql(a, b) ((a)==(b)) + #define __Pyx_c_suml(a, b) ((a)+(b)) + #define __Pyx_c_diffl(a, b) ((a)-(b)) + #define __Pyx_c_prodl(a, b) ((a)*(b)) + #define __Pyx_c_quotl(a, b) ((a)/(b)) + #define __Pyx_c_negl(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerol(z) ((z)==0.0) + #define __Pyx_c_conjl(z) (::std::conj(z)) + /*#define __Pyx_c_absl(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerol(z) ((z)==0) + #define __Pyx_c_conjl(z) (conjl(z)) + /*#define __Pyx_c_absl(z) (cabsl(z))*/ + #endif +#else + static INLINE int __Pyx_c_eql(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_suml(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_diffl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_prodl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_quotl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_negl(__pyx_t_long_double_complex); + static INLINE int __Pyx_c_is_zerol(__pyx_t_long_double_complex); + static INLINE __pyx_t_long_double_complex __Pyx_c_conjl(__pyx_t_long_double_complex); + /*static INLINE long double __Pyx_c_absl(__pyx_t_long_double_complex);*/ +#endif static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); +static INLINE char __Pyx_PyInt_AsChar(PyObject *); -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); +static INLINE short __Pyx_PyInt_AsShort(PyObject *); -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static INLINE int __Pyx_PyInt_AsInt(PyObject *); -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static INLINE long __Pyx_PyInt_AsLong(PyObject *); -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + static void __Pyx_WriteUnraisable(const char *name); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -644,7 +658,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from python_buffer */ -/* Module declarations from python_ref */ +/* Module declarations from python_object */ /* Module declarations from stdlib */ @@ -659,14 +673,12 @@ static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ /* Module declarations from scipy.io.matlab.mio_utils */ static size_t __pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *, int __pyx_skip_dispatch); /*proto*/ @@ -681,13 +693,15 @@ static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "Non-native byte order not supported"; -static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_6[] = "Format string allocated too short."; -static char __pyx_k_7[] = " Utilities for generic processing of return arrays from read\n"; -static char __pyx_k_8[] = "squeeze_element (line 17)"; -static char __pyx_k_9[] = "chars_to_strings (line 30)"; +static char __pyx_k_3[] = ">"; +static char __pyx_k_4[] = "<"; +static char __pyx_k_5[] = "Non-native byte order not supported"; +static char __pyx_k_6[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_7[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_8[] = "Format string allocated too short."; +static char __pyx_k_9[] = " Utilities for generic processing of return arrays from read\n"; +static char __pyx_k_10[] = "squeeze_element (line 17)"; +static char __pyx_k_11[] = "chars_to_strings (line 30)"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -709,7 +723,6 @@ static char __pyx_k__buf[] = "buf"; static char __pyx_k__obj[] = "obj"; static char __pyx_k__str[] = "str"; -static char __pyx_k__base[] = "base"; static char __pyx_k__item[] = "item"; static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__size[] = "size"; @@ -740,20 +753,21 @@ static char __pyx_k__chars_to_strings[] = "chars_to_strings"; static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; static PyObject *__pyx_kp_u_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_2; -static PyObject *__pyx_kp_u_3; -static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_8; -static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__array; static PyObject *__pyx_n_s__ascontiguousarray; -static PyObject *__pyx_n_s__base; static PyObject *__pyx_n_s__buf; static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__chars_to_strings; @@ -783,7 +797,7 @@ static PyObject *__pyx_n_s__view; static PyObject *__pyx_int_15; -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -800,10 +814,10 @@ int __pyx_t_2; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; - __Pyx_RefNannySetupContext("cproduct"); + __Pyx_SetupRefcountContext("cproduct"); __Pyx_INCREF(__pyx_v_tup); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":10 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -812,7 +826,7 @@ */ __pyx_v_res = 1; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":12 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -823,7 +837,7 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":13 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< @@ -837,7 +851,7 @@ __pyx_v_res *= __pyx_t_4; } - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":14 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -855,11 +869,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_tup); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -871,7 +885,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *__pyx_self, PyObject *__pyx_v_tup) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("cproduct"); + __Pyx_SetupRefcountContext("cproduct"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(__pyx_v_tup, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -888,11 +902,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -909,10 +923,10 @@ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - __Pyx_RefNannySetupContext("squeeze_element"); + __Pyx_SetupRefcountContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":22 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: # <<<<<<<<<<<<<< @@ -926,7 +940,7 @@ __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":23 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: * return np.array([]) # <<<<<<<<<<<<<< @@ -957,7 +971,7 @@ } __pyx_L3:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":24 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":24 * if not arr.size: * return np.array([]) * arr = np.squeeze(arr) # <<<<<<<<<<<<<< @@ -978,12 +992,12 @@ __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":25 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":25 * return np.array([]) * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< @@ -1005,7 +1019,7 @@ } if (__pyx_t_6) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":26 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":26 * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() # <<<<<<<<<<<<<< @@ -1025,7 +1039,7 @@ } __pyx_L4:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":27 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":27 * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() * return arr # <<<<<<<<<<<<<< @@ -1048,11 +1062,11 @@ __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -1065,7 +1079,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyObject *__pyx_self, PyObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("squeeze_element"); + __Pyx_SetupRefcountContext("squeeze_element"); __pyx_self = __pyx_self; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); @@ -1083,11 +1097,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1107,22 +1121,22 @@ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_RefNannySetupContext("chars_to_strings"); + __Pyx_SetupRefcountContext("chars_to_strings"); __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":44 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape */ - if (!(likely(((__pyx_v_in_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":45 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1131,7 +1145,7 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":46 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< @@ -1140,7 +1154,7 @@ */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":47 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< @@ -1149,7 +1163,7 @@ */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":49 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] * cdef object new_dt_str * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< @@ -1159,7 +1173,7 @@ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":50 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":50 * cdef object new_dt_str * if last_dim == 0: # deal with empty array case * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< @@ -1178,7 +1192,7 @@ } /*else*/ { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":52 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":52 * new_dt_str = arr.dtype.str * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< @@ -1213,7 +1227,7 @@ } __pyx_L3:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":54 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":54 * new_dt_str = arr.dtype.str[:-1] + str(last_dim) * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< @@ -1234,12 +1248,12 @@ __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":55 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":55 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< @@ -1256,12 +1270,12 @@ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":56 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":56 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< @@ -1283,7 +1297,7 @@ __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -1301,11 +1315,11 @@ __Pyx_DECREF(__pyx_v_new_dt_str); __Pyx_DECREF(__pyx_v_in_arr); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 +/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1318,7 +1332,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *__pyx_self, PyObject *__pyx_v_in_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("chars_to_strings"); + __Pyx_SetupRefcountContext("chars_to_strings"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(__pyx_v_in_arr, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1335,11 +1349,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":187 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":158 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1361,21 +1375,21 @@ int __pyx_v_hasfields; int __pyx_r; int __pyx_t_1; - int __pyx_t_2; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; - PyObject *__pyx_t_5 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; + int __pyx_t_5; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; char *__pyx_t_9; - __Pyx_RefNannySetupContext("__getbuffer__"); + __Pyx_SetupRefcountContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":193 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":164 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1384,7 +1398,7 @@ */ __pyx_v_endian_detector = 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":194 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":165 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1393,7 +1407,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":196 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":167 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1402,7 +1416,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":198 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":169 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1412,7 +1426,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":199 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":170 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1424,7 +1438,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":201 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":172 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1435,63 +1449,60 @@ } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":203 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":174 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_t_1) { + if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":204 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":175 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); - __pyx_t_3 = __pyx_t_2; + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); } else { - __pyx_t_3 = __pyx_t_1; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); } - if (__pyx_t_3) { + if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":205 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":176 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":207 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":178 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_t_3) { + if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":208 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":179 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1499,35 +1510,34 @@ * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); - __pyx_t_2 = __pyx_t_1; } else { - __pyx_t_2 = __pyx_t_3; + __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); } - if (__pyx_t_2) { + if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":209 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":180 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":211 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":182 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1536,7 +1546,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":212 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":183 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1545,17 +1555,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":213 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":184 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_t_6 = __pyx_v_copy_shape; - if (__pyx_t_6) { + __pyx_t_4 = __pyx_v_copy_shape; + if (__pyx_t_4) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":216 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1564,7 +1574,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":217 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1573,18 +1583,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":218 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":189 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_6 = __pyx_v_ndim; - for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { - __pyx_v_i = __pyx_t_7; + __pyx_t_4 = __pyx_v_ndim; + for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { + __pyx_v_i = __pyx_t_5; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":219 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":190 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1593,7 +1603,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":220 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":191 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1606,7 +1616,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":222 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1615,7 +1625,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":223 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1626,7 +1636,7 @@ } __pyx_L8:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":224 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1635,7 +1645,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":225 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1644,7 +1654,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":226 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1653,7 +1663,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":229 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1662,7 +1672,7 @@ */ __pyx_v_f = NULL; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":230 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1672,7 +1682,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":234 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1681,23 +1691,21 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":236 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_t_2 = (!__pyx_v_hasfields); - if (__pyx_t_2) { - __pyx_t_3 = (!__pyx_v_copy_shape); - __pyx_t_1 = __pyx_t_3; + if ((!__pyx_v_hasfields)) { + __pyx_t_1 = (!__pyx_v_copy_shape); } else { - __pyx_t_1 = __pyx_t_2; + __pyx_t_1 = (!__pyx_v_hasfields); } if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":238 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1713,7 +1721,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":241 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1728,7 +1736,7 @@ } __pyx_L11:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":243 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1738,7 +1746,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":244 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":215 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1747,64 +1755,77 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":245 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + __pyx_t_2 = PyInt_FromLong(__pyx_v_descr->byteorder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_3), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_1) { - __pyx_t_2 = __pyx_v_little_endian; + __pyx_t_6 = __pyx_v_little_endian; + __pyx_t_7 = __pyx_t_6; } else { - __pyx_t_2 = __pyx_t_1; + __pyx_t_7 = __pyx_t_1; } - if (!__pyx_t_2) { + if (!__pyx_t_7) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":246 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + __pyx_t_3 = PyInt_FromLong(__pyx_v_descr->byteorder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_4), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (__pyx_t_1) { - __pyx_t_3 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_3; + __pyx_t_6 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_6; } else { __pyx_t_8 = __pyx_t_1; } __pyx_t_1 = __pyx_t_8; } else { - __pyx_t_1 = __pyx_t_2; + __pyx_t_1 = __pyx_t_7; } if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":247 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L13; } __pyx_L13:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":248 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -1817,7 +1838,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":249 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1830,7 +1851,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":250 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1843,7 +1864,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":251 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1856,7 +1877,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":252 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1869,7 +1890,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":253 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1882,7 +1903,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":254 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1895,7 +1916,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":255 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1908,7 +1929,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":256 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1921,7 +1942,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":257 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":228 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1934,7 +1955,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":258 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1947,7 +1968,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":259 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1960,7 +1981,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":260 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1973,7 +1994,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":261 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":232 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1986,7 +2007,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":262 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":233 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1999,7 +2020,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":263 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2012,7 +2033,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":264 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2026,33 +2047,33 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":266 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_Raise(__pyx_t_4, 0, 0); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_2, 0, 0); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L14:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":267 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2061,7 +2082,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":268 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2074,7 +2095,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":270 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2083,7 +2104,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":271 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2092,7 +2113,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":272 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2101,17 +2122,17 @@ */ __pyx_v_offset = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":275 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":276 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2125,8 +2146,8 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_4); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); __pyx_r = -1; __Pyx_GOTREF(__pyx_v_info->obj); @@ -2140,11 +2161,11 @@ __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_DECREF((PyObject *)__pyx_v_self); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":278 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2155,10 +2176,10 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { int __pyx_t_1; - __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_SetupRefcountContext("__releasebuffer__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":279 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2168,7 +2189,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":280 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2180,7 +2201,7 @@ } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":281 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2190,7 +2211,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":282 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2203,10 +2224,10 @@ __pyx_L6:; __Pyx_DECREF((PyObject *)__pyx_v_self); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":755 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":704 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2214,12 +2235,12 @@ * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + __Pyx_SetupRefcountContext("PyArray_MultiIterNew1"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":756 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":705 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2227,7 +2248,7 @@ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2241,11 +2262,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":758 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":707 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2253,12 +2274,12 @@ * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + __Pyx_SetupRefcountContext("PyArray_MultiIterNew2"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":759 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":708 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2266,7 +2287,7 @@ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2280,11 +2301,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":761 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":710 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2292,12 +2313,12 @@ * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + __Pyx_SetupRefcountContext("PyArray_MultiIterNew3"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":762 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":711 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2305,7 +2326,7 @@ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2319,11 +2340,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":764 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":713 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2331,12 +2352,12 @@ * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + __Pyx_SetupRefcountContext("PyArray_MultiIterNew4"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":765 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":714 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2344,7 +2365,7 @@ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2358,11 +2379,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":767 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":716 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2370,12 +2391,12 @@ * */ -static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { +static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + __Pyx_SetupRefcountContext("PyArray_MultiIterNew5"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":768 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":717 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2383,7 +2404,7 @@ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2397,11 +2418,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":770 +/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":719 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2409,7 +2430,7 @@ * # string. The new location in the format string is returned. */ -static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { +static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child; int __pyx_v_endian_detector; int __pyx_v_little_endian; @@ -2428,7 +2449,7 @@ int __pyx_t_8; int __pyx_t_9; char *__pyx_t_10; - __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_SetupRefcountContext("_util_dtypestring"); __Pyx_INCREF((PyObject *)__pyx_v_descr); __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); @@ -2436,7 +2457,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":777 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":726 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2445,7 +2466,7 @@ */ __pyx_v_endian_detector = 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":778 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":727 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2454,7 +2475,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":781 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":730 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2464,7 +2485,7 @@ if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; @@ -2473,21 +2494,21 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":782 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":731 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":783 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":732 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2497,7 +2518,7 @@ if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { PyObject* tuple = ((PyObject *)__pyx_v_fields); __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); @@ -2507,114 +2528,127 @@ __pyx_t_4 = 0; } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":785 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":734 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":786 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":735 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":788 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":737 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->byteorder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_3), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_7 = __pyx_t_6; + __pyx_t_8 = __pyx_t_6; } - if (!__pyx_t_7) { + if (!__pyx_t_8) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":789 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":738 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + __pyx_t_5 = PyInt_FromLong(__pyx_v_child->byteorder); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_4), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { - __pyx_t_8 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_8; + __pyx_t_7 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_7; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_6 = __pyx_t_7; + __pyx_t_6 = __pyx_t_8; } if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":790 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":739 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":800 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":749 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2622,16 +2656,16 @@ * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":801 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":750 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2640,7 +2674,7 @@ */ (__pyx_v_f[0]) = 120; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":802 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":751 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2649,7 +2683,7 @@ */ __pyx_v_f += 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":803 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":752 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2659,7 +2693,7 @@ (__pyx_v_offset[0]) += 1; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":805 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":754 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2668,7 +2702,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":807 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -2678,20 +2712,20 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":808 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":809 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -2701,288 +2735,288 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":810 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":813 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":814 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":815 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":816 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":817 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":818 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":819 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":820 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":821 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":822 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":823 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":772 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":824 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":773 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":825 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":774 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":826 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":775 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -2991,19 +3025,19 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":827 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":776 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -3012,19 +3046,19 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":828 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -3033,19 +3067,19 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":829 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; @@ -3053,30 +3087,30 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":831 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":780 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":832 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3088,21 +3122,21 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":836 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_10; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":837 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3128,149 +3162,10 @@ __Pyx_DECREF(__pyx_v_new_offset); __Pyx_DECREF(__pyx_v_t); __Pyx_DECREF((PyObject *)__pyx_v_descr); - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":952 - * - * - * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< - * cdef PyObject* baseptr - * if base is None: - */ - -static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { - PyObject *__pyx_v_baseptr; - int __pyx_t_1; - __Pyx_RefNannySetupContext("set_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - __Pyx_INCREF(__pyx_v_base); - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":954 - * cdef inline void set_array_base(ndarray arr, object base): - * cdef PyObject* baseptr - * if base is None: # <<<<<<<<<<<<<< - * baseptr = NULL - * else: - */ - __pyx_t_1 = (__pyx_v_base == Py_None); - if (__pyx_t_1) { - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":955 - * cdef PyObject* baseptr - * if base is None: - * baseptr = NULL # <<<<<<<<<<<<<< - * else: - * Py_INCREF(base) # important to do this before decref below! - */ - __pyx_v_baseptr = NULL; - goto __pyx_L3; - } - /*else*/ { - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":957 - * baseptr = NULL - * else: - * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< - * baseptr = base - * Py_XDECREF(arr.base) - */ - Py_INCREF(__pyx_v_base); - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":958 - * else: - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base # <<<<<<<<<<<<<< - * Py_XDECREF(arr.base) - * arr.base = baseptr - */ - __pyx_v_baseptr = ((PyObject *)__pyx_v_base); - } - __pyx_L3:; - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":959 - * Py_INCREF(base) # important to do this before decref below! - * baseptr = base - * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< - * arr.base = baseptr - * - */ - Py_XDECREF(__pyx_v_arr->base); - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":960 - * baseptr = base - * Py_XDECREF(arr.base) - * arr.base = baseptr # <<<<<<<<<<<<<< - * - * cdef inline object get_array_base(ndarray arr): - */ - __pyx_v_arr->base = __pyx_v_baseptr; - - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_DECREF(__pyx_v_base); - __Pyx_RefNannyFinishContext(); -} - -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":962 - * arr.base = baseptr - * - * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< - * if arr.base is NULL: - * return None - */ - -static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { - PyObject *__pyx_r = NULL; - int __pyx_t_1; - __Pyx_RefNannySetupContext("get_array_base"); - __Pyx_INCREF((PyObject *)__pyx_v_arr); - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":963 - * - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: # <<<<<<<<<<<<<< - * return None - * else: - */ - __pyx_t_1 = (__pyx_v_arr->base == NULL); - if (__pyx_t_1) { - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":964 - * cdef inline object get_array_base(ndarray arr): - * if arr.base is NULL: - * return None # <<<<<<<<<<<<<< - * else: - * return arr.base - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(Py_None); - __pyx_r = Py_None; - goto __pyx_L0; - goto __pyx_L3; - } - /*else*/ { - - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":966 - * return None - * else: - * return arr.base # <<<<<<<<<<<<<< - */ - __Pyx_XDECREF(__pyx_r); - __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); - __pyx_r = ((PyObject *)__pyx_v_arr->base); - goto __pyx_L0; - } - __pyx_L3:; - - __pyx_r = Py_None; __Pyx_INCREF(Py_None); - __pyx_L0:; - __Pyx_DECREF((PyObject *)__pyx_v_arr); - __Pyx_XGIVEREF(__pyx_r); - __Pyx_RefNannyFinishContext(); - return __pyx_r; -} - static struct PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("cproduct"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("squeeze_element"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element, METH_O, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_9mio_utils_squeeze_element)}, @@ -3284,7 +3179,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mio_utils"), - __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_9), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3296,20 +3191,21 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, - {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, - {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, - {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, - {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, @@ -3341,8 +3237,8 @@ }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3367,18 +3263,18 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - #if CYTHON_REFNANNY - void* __pyx_refnanny = NULL; - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); - if (!__Pyx_RefNanny) { + __pyx_init_filenames(); + #ifdef CYTHON_REFNANNY + void* __pyx_refchk = NULL; + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); + if (!__Pyx_Refnanny) { PyErr_Clear(); - __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); - if (!__Pyx_RefNanny) - Py_FatalError("failed to import 'refnanny' module"); + __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); + if (!__Pyx_Refnanny) + Py_FatalError("failed to import refnanny module"); } - __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); + __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); #endif - __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3394,7 +3290,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_9), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -3416,15 +3312,15 @@ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject)); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":5 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< @@ -3436,7 +3332,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":1 + /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":1 * # -*- python -*- like file # <<<<<<<<<<<<<< * ''' Utilities for generic processing of return arrays from read * ''' @@ -3448,19 +3344,19 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_8), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_10), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_11), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\stdlib.pxd":2 + /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) @@ -3478,7 +3374,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.mio_utils"); } __pyx_L0:; - __Pyx_RefNannyFinishContext(); + __Pyx_FinishRefcountContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -3498,19 +3394,19 @@ } -static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (unlikely(!type)) { +static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (!type) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } - if (likely(PyObject_TypeCheck(obj, type))) + if (obj == Py_None || PyObject_TypeCheck(obj, type)) return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", - Py_TYPE(obj)->tp_name, type->tp_name); + PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, @@ -3520,7 +3416,7 @@ (index == 1) ? "" : "s"); } -static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { +static INLINE void __Pyx_RaiseTooManyValuesError(void) { PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } @@ -3547,7 +3443,7 @@ return -1; } -static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { +static INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } @@ -3622,90 +3518,85 @@ return result; } -static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - const npy_intp neg_one = (npy_intp)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; - if (sizeof(npy_intp) < sizeof(long)) { - return PyInt_FromLong((long)val); - } else if (sizeof(npy_intp) == sizeof(long)) { - if (is_unsigned) - return PyLong_FromUnsignedLong((unsigned long)val); - else - return PyInt_FromLong((long)val); - } else { /* (sizeof(npy_intp) > sizeof(long)) */ - if (is_unsigned) - return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); - else - return PyLong_FromLongLong((PY_LONG_LONG)val); - } +static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { + /**/ if (sizeof(npy_intp) < sizeof(long)) + return PyInt_FromLong((long)val); + else if (sizeof(npy_intp) == sizeof(long)) + return (((npy_intp)-1) < ((npy_intp)0)) ? + PyInt_FromLong((long)val) : + PyLong_FromUnsignedLong((unsigned long)val); + else /* (sizeof(npy_intp) > sizeof(long)) */ + return (((npy_intp)-1) < ((npy_intp)0)) ? + PyLong_FromLongLong((PY_LONG_LONG)val) : + PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); } #if CYTHON_CCOMPLEX #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + static INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + static INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + static INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + static INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if HAVE_HYPOT return hypotf(z.real, z.imag); #else @@ -3717,70 +3608,70 @@ #if CYTHON_CCOMPLEX #ifdef __cplusplus - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + static INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if HAVE_HYPOT return hypot(z.real, z.imag); #else @@ -3790,34 +3681,81 @@ */ #endif -static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return ::std::complex< long double >(x, y); + } + #else + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + return x + y*(__pyx_t_long_double_complex)_Complex_I; + } + #endif +#else + static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { + __pyx_t_long_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} +#if CYTHON_CCOMPLEX +#else + static INLINE int __Pyx_c_eql(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static INLINE __pyx_t_long_double_complex __Pyx_c_suml(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static INLINE __pyx_t_long_double_complex __Pyx_c_diffl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static INLINE __pyx_t_long_double_complex __Pyx_c_prodl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static INLINE __pyx_t_long_double_complex __Pyx_c_quotl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { + __pyx_t_long_double_complex z; + long double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static INLINE __pyx_t_long_double_complex __Pyx_c_negl(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static INLINE int __Pyx_c_is_zerol(__pyx_t_long_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static INLINE __pyx_t_long_double_complex __Pyx_c_conjl(__pyx_t_long_double_complex a) { + __pyx_t_long_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static INLINE long double __Pyx_c_absl(__pyx_t_long_double_complex z) { +#if HAVE_HYPOT + return hypotl(z.real, z.imag); +#else + return sqrtl(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif -static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; - - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; -} - - -#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3873,7 +3811,6 @@ } #endif } - __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3883,59 +3820,57 @@ return; } -#else /* Python 3+ */ +static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { - if (tb == Py_None) { - tb = 0; - } else if (tb && !PyTraceBack_Check(tb)) { - PyErr_SetString(PyExc_TypeError, - "raise: arg 3 must be a traceback or None"); - goto bad; +#if PY_MAJOR_VERSION >= 3 + /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ + if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { + tmp_type = tstate->exc_type; + tmp_value = tstate->exc_value; + tmp_tb = tstate->exc_traceback; + PyErr_NormalizeException(&type, &value, &tb); + PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); + tstate->exc_type = 0; + tstate->exc_value = 0; + tstate->exc_traceback = 0; + PyException_SetContext(value, tmp_value); + Py_DECREF(tmp_type); + Py_XDECREF(tmp_tb); } - if (value == Py_None) - value = 0; +#endif - if (PyExceptionInstance_Check(type)) { - if (value) { - PyErr_SetString(PyExc_TypeError, - "instance exception may not have a separate value"); - goto bad; - } - value = type; - type = (PyObject*) Py_TYPE(value); - } else if (!PyExceptionClass_Check(type)) { - PyErr_SetString(PyExc_TypeError, - "raise: exception class must be a subclass of BaseException"); - goto bad; - } + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} - PyErr_SetObject(type, value); +static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; - if (tb) { - PyThreadState *tstate = PyThreadState_GET(); - PyObject* tmp_tb = tstate->curexc_traceback; - if (tb != tmp_tb) { - Py_INCREF(tb); - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_tb); - } - } - -bad: - return; + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; } -#endif -static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { - const unsigned char neg_one = (unsigned char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; + +static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -3946,15 +3881,13 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { - const unsigned short neg_one = (unsigned short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -3965,15 +3898,13 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { - const unsigned int neg_one = (unsigned int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -3984,15 +3915,13 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { - const char neg_one = (char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((char)-1) > ((char)0) && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -4003,15 +3932,13 @@ return (char)__Pyx_PyInt_AsLong(x); } -static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { - const short neg_one = (short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((short)-1) > ((short)0) && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -4022,15 +3949,13 @@ return (short)__Pyx_PyInt_AsLong(x); } -static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { - const int neg_one = (int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((int)-1) > ((int)0) && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -4041,15 +3966,13 @@ return (int)__Pyx_PyInt_AsLong(x); } -static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { - const signed char neg_one = (signed char)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -4060,15 +3983,13 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { - const signed short neg_one = (signed short)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -4079,15 +4000,13 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { - const signed int neg_one = (signed int)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (is_unsigned && unlikely(val < 0)) ? + (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -4098,13 +4017,11 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { - const unsigned long neg_one = (unsigned long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -4113,16 +4030,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); + if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; } + return (((unsigned long)-1) < ((unsigned long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4133,13 +4048,11 @@ } } -static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -4148,16 +4061,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); + if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; } + return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4168,13 +4079,11 @@ } } -static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { - const long neg_one = (long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((long)-1) > ((long)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -4183,16 +4092,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); + if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; } + return (((long)-1) < ((long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4203,13 +4110,11 @@ } } -static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { - const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -4218,16 +4123,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); + if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; } + return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4238,13 +4141,11 @@ } } -static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { - const signed long neg_one = (signed long)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -4253,16 +4154,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; - } - return PyLong_AsUnsignedLong(x); - } else { - return PyLong_AsLong(x); + if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; } + return (((signed long)-1) < ((signed long)0)) ? + PyLong_AsLong(x) : + PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4273,13 +4172,11 @@ } } -static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { - const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; - const int is_unsigned = neg_one > const_zero; +static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (is_unsigned && unlikely(val < 0)) { + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -4288,16 +4185,14 @@ } else #endif if (likely(PyLong_Check(x))) { - if (is_unsigned) { - if (unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; - } - return PyLong_AsUnsignedLongLong(x); - } else { - return PyLong_AsLongLong(x); + if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; } + return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? + PyLong_AsLongLong(x) : + PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4329,12 +4224,11 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size, int strict) + long size) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; - char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -4359,15 +4253,9 @@ module_name, class_name); goto bad; } - if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { - PyOS_snprintf(warning, sizeof(warning), - "%s.%s size changed, may indicate binary incompatibility", - module_name, class_name); - PyErr_WarnEx(NULL, warning, 0); - } - else if (((PyTypeObject *)result)->tp_basicsize != size) { + if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s has the wrong size, try recompiling", + "%s.%s does not appear to be the correct type object", module_name, class_name); goto bad; } @@ -4503,13 +4391,13 @@ /* Type Conversion Functions */ -static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -4555,7 +4443,7 @@ return res; } -static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -4564,7 +4452,7 @@ return ival; } -static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -4578,7 +4466,7 @@ #endif } -static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; From scipy-svn at scipy.org Wed Jun 9 13:46:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 9 Jun 2010 12:46:39 -0500 (CDT) Subject: [Scipy-svn] r6497 - trunk/scipy/io/matlab/tests Message-ID: <20100609174639.E54AE39CB4C@scipy.org> Author: stefan Date: 2010-06-09 12:46:39 -0500 (Wed, 09 Jun 2010) New Revision: 6497 Modified: trunk/scipy/io/matlab/tests/test_byteordercodes.py trunk/scipy/io/matlab/tests/test_mio.py trunk/scipy/io/matlab/tests/test_mio5_utils.py trunk/scipy/io/matlab/tests/test_mio_funcs.py trunk/scipy/io/matlab/tests/test_mio_utils.py trunk/scipy/io/matlab/tests/test_streams.py Log: ENH: Allow scipy.io.matlab tests to be run individually. Modified: trunk/scipy/io/matlab/tests/test_byteordercodes.py =================================================================== --- trunk/scipy/io/matlab/tests/test_byteordercodes.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_byteordercodes.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -4,7 +4,7 @@ import numpy as np -from numpy.testing import assert_raises +from numpy.testing import assert_raises, run_module_suite import scipy.io.matlab.byteordercodes as sibc @@ -26,3 +26,6 @@ for code in ('big', '>', 'b', 'B', 'be'): assert sibc.to_numpy_code(code) == '>' assert_raises(ValueError, sibc.to_numpy_code, 'silly string') + +if __name__ == "__main__": + run_module_suite() Modified: trunk/scipy/io/matlab/tests/test_mio.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_mio.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -17,7 +17,7 @@ assert_array_equal, \ assert_array_almost_equal, \ assert_equal, \ - assert_raises + assert_raises, run_module_suite from nose.tools import assert_true @@ -774,3 +774,5 @@ res = loadmat(stream) yield assert_array_equal, res['a'], out_arr_u +if __name__ == "__main__": + run_module_suite() Modified: trunk/scipy/io/matlab/tests/test_mio5_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_mio5_utils.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -9,7 +9,8 @@ from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises -from numpy.testing import assert_array_equal, assert_array_almost_equal +from numpy.testing import assert_array_equal, assert_array_almost_equal, \ + run_module_suite import scipy.io.matlab.byteordercodes as boc import scipy.io.matlab.streams as streams @@ -158,3 +159,5 @@ el = c_reader.read_numeric() yield assert_true, el.flags.writeable +if __name__ == "__main__": + run_module_suite() Modified: trunk/scipy/io/matlab/tests/test_mio_funcs.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_mio_funcs.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -10,7 +10,7 @@ assert_array_equal, \ assert_array_almost_equal, \ assert_equal, \ - assert_raises + assert_raises, run_module_suite from nose.tools import assert_true @@ -57,3 +57,6 @@ # example fname = pjoin(test_data_path, 'parabola.mat') ws_vars = read_workspace_vars(fname) + +if __name__ == "__main__": + run_module_suite() Modified: trunk/scipy/io/matlab/tests/test_mio_utils.py =================================================================== --- trunk/scipy/io/matlab/tests/test_mio_utils.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_mio_utils.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -7,7 +7,8 @@ from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises -from numpy.testing import assert_array_equal, assert_array_almost_equal +from numpy.testing import assert_array_equal, assert_array_almost_equal, \ + run_module_suite from scipy.io.matlab.mio_utils import cproduct, squeeze_element, \ chars_to_strings @@ -53,4 +54,7 @@ arr = np.array([['']], dtype='U1') out_arr = np.array([''], dtype='U1') yield assert_array_equal, chars_to_strings(arr), out_arr - + +if __name__ == "__main__": + run_module_suite() + Modified: trunk/scipy/io/matlab/tests/test_streams.py =================================================================== --- trunk/scipy/io/matlab/tests/test_streams.py 2010-06-09 17:46:02 UTC (rev 6496) +++ trunk/scipy/io/matlab/tests/test_streams.py 2010-06-09 17:46:39 UTC (rev 6497) @@ -13,7 +13,8 @@ from nose.tools import assert_true, assert_false, \ assert_equal, assert_raises -from numpy.testing import assert_array_equal, assert_array_almost_equal +from numpy.testing import assert_array_equal, assert_array_almost_equal, \ + run_module_suite from scipy.io.matlab.streams import make_stream, \ GenericStream, cStringStream, FileStream, \ @@ -88,3 +89,6 @@ res = _read_string(st, 4) yield assert_equal, res, 'ring' yield assert_raises, IOError, _read_string, st, 2 + +if __name__ == "__main__": + run_module_suite() From scipy-svn at scipy.org Thu Jun 10 06:05:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 10 Jun 2010 05:05:33 -0500 (CDT) Subject: [Scipy-svn] r6498 - trunk/scipy/special Message-ID: <20100610100533.4C9D339C4B4@scipy.org> Author: cdavid Date: 2010-06-10 05:05:33 -0500 (Thu, 10 Jun 2010) New Revision: 6498 Modified: trunk/scipy/special/setup.py Log: ENH: barf with a sensical message when get_info is missing. Modified: trunk/scipy/special/setup.py =================================================================== --- trunk/scipy/special/setup.py 2010-06-09 17:46:39 UTC (rev 6497) +++ trunk/scipy/special/setup.py 2010-06-10 10:05:33 UTC (rev 6498) @@ -4,8 +4,15 @@ import sys from os.path import join from distutils.sysconfig import get_python_inc -from numpy.distutils.misc_util import get_numpy_include_dirs, get_info +import numpy +from numpy.distutils.misc_util import get_numpy_include_dirs +try: + from numpy.distutils.misc_util import get_info +except ImportError: + raise ValueError("numpy >= 1.4 is required (detected %s from %s)" % \ + (numpy.__version__, numpy.__file__)) + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('special', parent_package, top_path) From scipy-svn at scipy.org Mon Jun 14 12:52:18 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 14 Jun 2010 11:52:18 -0500 (CDT) Subject: [Scipy-svn] r6499 - branches/0.8.x/doc/release Message-ID: <20100614165218.BD93139CAEA@scipy.org> Author: stefan Date: 2010-06-14 11:52:18 -0500 (Mon, 14 Jun 2010) New Revision: 6499 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: DOC: Update release notes with lsqr. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-10 10:05:33 UTC (rev 6498) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-14 16:52:18 UTC (rev 6499) @@ -134,6 +134,12 @@ The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. +New sparse least squares solver +------------------------------- +The `lsqr` function was added to `scipy.sparse`. `This routine +`_ finds a +least-squares solution to a large, sparse, linear system of equations. + ARPACK-based sparse SVD ----------------------- From scipy-svn at scipy.org Mon Jun 14 21:33:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 14 Jun 2010 20:33:57 -0500 (CDT) Subject: [Scipy-svn] r6500 - trunk/scipy/signal Message-ID: <20100615013357.0348739CAF6@scipy.org> Author: warren.weckesser Date: 2010-06-14 20:33:56 -0500 (Mon, 14 Jun 2010) New Revision: 6500 Modified: trunk/scipy/signal/waveforms.py Log: STY, DOC: signal: Clean up gausspulse a bit, including using bool instead of ints for boolean args and correcting the docstring. Also tweak spacing of args in a couple other functions. Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-06-14 16:52:18 UTC (rev 6499) +++ trunk/scipy/signal/waveforms.py 2010-06-15 01:33:56 UTC (rev 6500) @@ -9,7 +9,7 @@ from numpy import asarray, zeros, place, nan, mod, pi, extract, log, sqrt, \ exp, cos, sin, polyval, polyint, size, log10 -def sawtooth(t,width=1): +def sawtooth(t, width=1): """ Return a periodic sawtooth waveform. @@ -69,7 +69,7 @@ return y -def square(t,duty=0.5): +def square(t, duty=0.5): """ Return a periodic square-wave waveform. @@ -121,42 +121,45 @@ place(y,mask3,-1) return y -def gausspulse(t,fc=1000,bw=0.5,bwr=-6,tpr=-60,retquad=0,retenv=0): +def gausspulse(t, fc=1000, bw=0.5, bwr=-6, tpr=-60, retquad=False, retenv=False): """ - Return a gaussian modulated sinusoid: exp(-a t^2) exp(1j*2*pi*fc). + Return a gaussian modulated sinusoid: exp(-a t^2) exp(1j*2*pi*fc*t). - If `retquad` is non-zero, then return the real and imaginary parts - (in-phase and quadrature) - If `retenv` is non-zero, then return the envelope (unmodulated signal). + If `retquad` is True, then return the real and imaginary parts + (in-phase and quadrature). + If `retenv` is True, then return the envelope (unmodulated signal). Otherwise, return the real part of the modulated sinusoid. Parameters ---------- - t : ndarray + t : ndarray, or the string 'cutoff' Input array. fc : int, optional - Center frequency (Hz). + Center frequency (Hz). Default is 1000. bw : float, optional Fractional bandwidth in frequency domain of pulse (Hz). + Default is 0.5. bwr: float, optional Reference level at which fractional bandwidth is calculated (dB). + Default is -6. tpr : float, optional If `t` is 'cutoff', then the function returns the cutoff time for when the pulse amplitude falls below `tpr` (in dB). - retquad : int, optional - Return the quadrature (imaginary) as well as the real part - of the signal. - retenv : int, optional - Return the envelope of the signal. + Default is -60. + retquad : bool, optional + If True, return the quadrature (imaginary) as well as the real part + of the signal. Default is False. + retenv : bool, optional + If True, return the envelope of the signal. Default is False. """ if fc < 0: - raise ValueError, "Center frequency (fc=%.2f) must be >=0." % fc + raise ValueError("Center frequency (fc=%.2f) must be >=0." % fc) if bw <= 0: - raise ValueError, "Fractional bandwidth (bw=%.2f) must be > 0." % bw + raise ValueError("Fractional bandwidth (bw=%.2f) must be > 0." % bw) if bwr >= 0: - raise ValueError, "Reference level for bandwidth (bwr=%.2f) must " \ - "be < 0 dB" % bwr + raise ValueError("Reference level for bandwidth (bwr=%.2f) must " + "be < 0 dB" % bwr) # exp(-a t^2) <-> sqrt(pi/a) exp(-pi^2/a * f^2) = g(f) @@ -170,7 +173,7 @@ # Solve exp(-a tc**2) = tref for tc # tc = sqrt(-log(tref) / a) where tref = 10^(tpr/20) if tpr >= 0: - raise ValueError, "Reference level for time cutoff must be < 0 dB" + raise ValueError("Reference level for time cutoff must be < 0 dB") tref = pow(10.0, tpr / 20.0) return sqrt(-log(tref)/a) From scipy-svn at scipy.org Tue Jun 15 22:31:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 15 Jun 2010 21:31:21 -0500 (CDT) Subject: [Scipy-svn] r6501 - branches/0.8.x/scipy/optimize Message-ID: <20100616023121.0658D39CAE7@scipy.org> Author: charris Date: 2010-06-15 21:31:20 -0500 (Tue, 15 Jun 2010) New Revision: 6501 Modified: branches/0.8.x/scipy/optimize/minpack.py branches/0.8.x/scipy/optimize/zeros.py Log: DEP: Deprecate minpack.bisection and move minpack.newton to zeros.newton. Also fix ticket #1198. Modified: branches/0.8.x/scipy/optimize/minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/minpack.py 2010-06-15 01:33:56 UTC (rev 6500) +++ branches/0.8.x/scipy/optimize/minpack.py 2010-06-16 02:31:20 UTC (rev 6501) @@ -7,8 +7,7 @@ error = _minpack.error -__all__ = ['fsolve', 'leastsq', 'newton', 'fixed_point', - 'bisection', 'curve_fit'] +__all__ = ['fsolve', 'leastsq', 'fixed_point', 'bisection', 'curve_fit'] def check_func(thefunc, x0, args, numinputs, output_shape=None): res = atleast_1d(thefunc(*((x0[:numinputs],)+args))) @@ -518,6 +517,9 @@ interval has been found. """ + msg = "minpack.newton is moving to zeros.newton" + warnings.warn(msg, DeprecationWarning) + if fprime is not None: # Newton-Rapheson method p0 = x0 @@ -620,10 +622,13 @@ func(a) * func(b) < 0, find the root between a and b. """ + msg = "minpack.bisection is deprecated, use zeros.bisect instead" + warnings.warn(msg, DeprecationWarning) + i = 1 eva = func(a,*args) evb = func(b,*args) - if eva*evb < 0: + if eva*evb >= 0: msg = "Must start with interval where func(a) * func(b) < 0" raise ValueError(msg) while i <= maxiter: Modified: branches/0.8.x/scipy/optimize/zeros.py =================================================================== --- branches/0.8.x/scipy/optimize/zeros.py 2010-06-15 01:33:56 UTC (rev 6500) +++ branches/0.8.x/scipy/optimize/zeros.py 2010-06-16 02:31:20 UTC (rev 6501) @@ -1,4 +1,3 @@ - import _zeros from numpy import finfo @@ -7,13 +6,14 @@ # not actually used at the moment _rtol = finfo(float).eps * 2 -__all__ = ['bisect','ridder','brentq','brenth'] +__all__ = ['newton', 'bisect', 'ridder', 'brentq', 'brenth'] CONVERGED = 'converged' SIGNERR = 'sign error' CONVERR = 'convergence error' flag_map = {0 : CONVERGED, -1 : SIGNERR, -2 : CONVERR} + class RootResults(object): def __init__(self, root, iterations, function_calls, flag): self.root = root @@ -25,6 +25,7 @@ except KeyError: self.flag = 'unknown error %d' % (flag,) + def results_c(full_output, r): if full_output: x, funcalls, iterations, flag = r @@ -36,6 +37,101 @@ else: return r + +# Newton-Raphson method +def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50): + """Find a zero using the Newton-Raphson or secant method. + + Find a zero of the function `func` given a nearby starting point `x0`. + The Newton-Rapheson method is used if the derivative `fprime` of `func` + is provided, otherwise the secant method is used. + + Parameters + ---------- + func : function + The function whose zero is wanted. It must be a function of a + single variable of the form f(x,a,b,c...), where a,b,c... are extra + arguments that can be passed in the `args` parameter. + x0 : float + An initial estimate of the zero that should be somewhere near the + actual zero. + fprime : {None, function}, optional + The derivative of the function when available and convenient. If it + is None, then the secant method is used. The default is None. + args : tuple, optional + Extra arguments to be used in the function call. + tol : float, optional + The allowable error of the zero value. + maxiter : int, optional + Maximum number of iterations. + + Returns + ------- + zero : float + Estimated location where function is zero. + + See Also + -------- + brentq, brenth, ridder, bisect -- find zeroes in one dimension. + fsolve -- find zeroes in n dimensions. + + Notes + ----- + The convergence rate of the Newton-Rapheson method is quadratic while + that of the secant method is somewhat less. This means that if the + function is well behaved the actual error in the estimated zero is + approximatly the square of the requested tolerance up to roundoff + error. However, the stopping criterion used here is the step size and + there is no quarantee that a zero has been found. Consequently the + result should be verified. Safer algorithms are brentq, brenth, ridder, + and bisect, but they all require that the root first be bracketed in an + interval where the function changes sign. The brentq algorithm is + recommended for general use in one dimemsional problems when such an + interval has been found. + + """ + if fprime is not None: + # Newton-Rapheson method + p0 = x0 + for iter in range(maxiter): + myargs = (p0,) + args + fval = func(*myargs) + fder = fprime(*myargs) + if fder == 0: + msg = "derivative was zero." + warnings.warn(msg, RuntimeWarning) + return p0 + p = p0 - func(*myargs)/fprime(*myargs) + if abs(p - p0) < tol: + return p + p0 = p + else: + # Secant method + p0 = x0 + if x0 >= 0: + p1 = x0*(1 + 1e-4) + 1e-4 + else: + p1 = x0*(1 + 1e-4) - 1e-4 + q0 = func(*((p0,) + args)) + q1 = func(*((p1,) + args)) + for iter in range(maxiter): + if q1 == q0: + if p1 != p0: + msg = "Tolerance of %s reached" % (p1 - p0) + warnings.warn(msg, RuntimeWarning) + return (p1 + p0)/2.0 + else: + p = p1 - q1*(p1 - p0)/(q1 - q0) + if abs(p - p1) < tol: + return p + p0 = p1 + q0 = q1 + p1 = p + q1 = func(*((p1,) + args)) + msg = "Failed to converge after %d iterations, value is %s" % (maxiter, p) + raise RuntimeError(msg) + + def bisect(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -91,6 +187,7 @@ r = _zeros._bisect(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def ridder(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -160,6 +257,7 @@ r = _zeros._ridder(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def brentq(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -262,6 +360,7 @@ r = _zeros._brentq(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def brenth(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): From scipy-svn at scipy.org Tue Jun 15 23:08:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 15 Jun 2010 22:08:54 -0500 (CDT) Subject: [Scipy-svn] r6502 - trunk/scipy/optimize Message-ID: <20100616030854.7D0E239CAE7@scipy.org> Author: charris Date: 2010-06-15 22:08:54 -0500 (Tue, 15 Jun 2010) New Revision: 6502 Modified: trunk/scipy/optimize/minpack.py trunk/scipy/optimize/zeros.py Log: DEP: Forward port changes to 0.8.x prior to removing deprecated features. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-16 02:31:20 UTC (rev 6501) +++ trunk/scipy/optimize/minpack.py 2010-06-16 03:08:54 UTC (rev 6502) @@ -7,8 +7,7 @@ error = _minpack.error -__all__ = ['fsolve', 'leastsq', 'newton', 'fixed_point', - 'bisection', 'curve_fit'] +__all__ = ['fsolve', 'leastsq', 'fixed_point', 'bisection', 'curve_fit'] def check_func(thefunc, x0, args, numinputs, output_shape=None): res = atleast_1d(thefunc(*((x0[:numinputs],)+args))) @@ -518,6 +517,9 @@ interval has been found. """ + msg = "minpack.newton is moving to zeros.newton" + warnings.warn(msg, DeprecationWarning) + if fprime is not None: # Newton-Rapheson method p0 = x0 @@ -620,10 +622,13 @@ func(a) * func(b) < 0, find the root between a and b. """ + msg = "minpack.bisection is deprecated, use zeros.bisect instead" + warnings.warn(msg, DeprecationWarning) + i = 1 eva = func(a,*args) evb = func(b,*args) - if eva*evb < 0: + if eva*evb >= 0: msg = "Must start with interval where func(a) * func(b) < 0" raise ValueError(msg) while i <= maxiter: Modified: trunk/scipy/optimize/zeros.py =================================================================== --- trunk/scipy/optimize/zeros.py 2010-06-16 02:31:20 UTC (rev 6501) +++ trunk/scipy/optimize/zeros.py 2010-06-16 03:08:54 UTC (rev 6502) @@ -1,4 +1,3 @@ - import _zeros from numpy import finfo @@ -7,13 +6,14 @@ # not actually used at the moment _rtol = finfo(float).eps * 2 -__all__ = ['bisect','ridder','brentq','brenth'] +__all__ = ['newton', 'bisect', 'ridder', 'brentq', 'brenth'] CONVERGED = 'converged' SIGNERR = 'sign error' CONVERR = 'convergence error' flag_map = {0 : CONVERGED, -1 : SIGNERR, -2 : CONVERR} + class RootResults(object): def __init__(self, root, iterations, function_calls, flag): self.root = root @@ -25,6 +25,7 @@ except KeyError: self.flag = 'unknown error %d' % (flag,) + def results_c(full_output, r): if full_output: x, funcalls, iterations, flag = r @@ -36,6 +37,101 @@ else: return r + +# Newton-Raphson method +def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50): + """Find a zero using the Newton-Raphson or secant method. + + Find a zero of the function `func` given a nearby starting point `x0`. + The Newton-Rapheson method is used if the derivative `fprime` of `func` + is provided, otherwise the secant method is used. + + Parameters + ---------- + func : function + The function whose zero is wanted. It must be a function of a + single variable of the form f(x,a,b,c...), where a,b,c... are extra + arguments that can be passed in the `args` parameter. + x0 : float + An initial estimate of the zero that should be somewhere near the + actual zero. + fprime : {None, function}, optional + The derivative of the function when available and convenient. If it + is None, then the secant method is used. The default is None. + args : tuple, optional + Extra arguments to be used in the function call. + tol : float, optional + The allowable error of the zero value. + maxiter : int, optional + Maximum number of iterations. + + Returns + ------- + zero : float + Estimated location where function is zero. + + See Also + -------- + brentq, brenth, ridder, bisect -- find zeroes in one dimension. + fsolve -- find zeroes in n dimensions. + + Notes + ----- + The convergence rate of the Newton-Rapheson method is quadratic while + that of the secant method is somewhat less. This means that if the + function is well behaved the actual error in the estimated zero is + approximatly the square of the requested tolerance up to roundoff + error. However, the stopping criterion used here is the step size and + there is no quarantee that a zero has been found. Consequently the + result should be verified. Safer algorithms are brentq, brenth, ridder, + and bisect, but they all require that the root first be bracketed in an + interval where the function changes sign. The brentq algorithm is + recommended for general use in one dimemsional problems when such an + interval has been found. + + """ + if fprime is not None: + # Newton-Rapheson method + p0 = x0 + for iter in range(maxiter): + myargs = (p0,) + args + fval = func(*myargs) + fder = fprime(*myargs) + if fder == 0: + msg = "derivative was zero." + warnings.warn(msg, RuntimeWarning) + return p0 + p = p0 - func(*myargs)/fprime(*myargs) + if abs(p - p0) < tol: + return p + p0 = p + else: + # Secant method + p0 = x0 + if x0 >= 0: + p1 = x0*(1 + 1e-4) + 1e-4 + else: + p1 = x0*(1 + 1e-4) - 1e-4 + q0 = func(*((p0,) + args)) + q1 = func(*((p1,) + args)) + for iter in range(maxiter): + if q1 == q0: + if p1 != p0: + msg = "Tolerance of %s reached" % (p1 - p0) + warnings.warn(msg, RuntimeWarning) + return (p1 + p0)/2.0 + else: + p = p1 - q1*(p1 - p0)/(q1 - q0) + if abs(p - p1) < tol: + return p + p0 = p1 + q0 = q1 + p1 = p + q1 = func(*((p1,) + args)) + msg = "Failed to converge after %d iterations, value is %s" % (maxiter, p) + raise RuntimeError(msg) + + def bisect(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -91,6 +187,7 @@ r = _zeros._bisect(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def ridder(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -160,6 +257,7 @@ r = _zeros._ridder(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def brentq(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): @@ -262,6 +360,7 @@ r = _zeros._brentq(f,a,b,xtol,maxiter,args,full_output,disp) return results_c(full_output, r) + def brenth(f, a, b, args=(), xtol=_xtol, rtol=_rtol, maxiter=_iter, full_output=False, disp=True): From scipy-svn at scipy.org Tue Jun 15 23:53:04 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 15 Jun 2010 22:53:04 -0500 (CDT) Subject: [Scipy-svn] r6503 - trunk/scipy/stats Message-ID: <20100616035304.B2A0539CAE7@scipy.org> Author: warren.weckesser Date: 2010-06-15 22:53:04 -0500 (Tue, 15 Jun 2010) New Revision: 6503 Modified: trunk/scipy/stats/stats.py Log: Fix some typos. Modified: trunk/scipy/stats/stats.py =================================================================== --- trunk/scipy/stats/stats.py 2010-06-16 03:08:54 UTC (rev 6502) +++ trunk/scipy/stats/stats.py 2010-06-16 03:53:04 UTC (rev 6503) @@ -2,9 +2,9 @@ # # Disclaimer # -# This software is provided "as-is". There are no exprgoessed or implied +# This software is provided "as-is". There are no expressed or implied # warranties of any kind, including, but not limited to, the warranties -# of merchantability and fittness for a given application. In no event +# of merchantability and fitness for a given application. In no event # shall Gary Strangman be liable for any direct, indirect, incidental, # special, exemplary or consequential damages (including, but not limited # to, loss of use, data or profits, or business interruption) however @@ -125,7 +125,7 @@ [CRCProbStat2000]_ .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. """ @@ -194,7 +194,7 @@ import warnings import math -#friedmanchisquare patch uses python sum +# friedmanchisquare patch uses python sum pysum = sum # save it before it gets overwritten # Scipy imports. @@ -531,7 +531,7 @@ [CRCProbStat2000]_ Section 2.2.6 .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. """ @@ -921,7 +921,7 @@ [CRCProbStat2000]_ Section 2.2.20 .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. """ @@ -959,7 +959,7 @@ [CRCProbStat2000]_ Section 2.2.24.1 .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. """ @@ -1017,7 +1017,7 @@ [CRCProbStat2000]_ Section 2.2.25 .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. """ @@ -2161,7 +2161,7 @@ [CRCProbStat2000]_ Section 14.7 .. [CRCProbStat2000] Zwillinger, D. and Kokoska, S. (2000). CRC Standard - Probablity and Statistics Tables and Formulae. Chapman & Hall: New + Probability and Statistics Tables and Formulae. Chapman & Hall: New York. 2000. Examples @@ -2862,7 +2862,7 @@ k-1-p. If the parameters are estimated in a different way, then then the dof can be between k-1-p and k-1. However, it is also possible that the asymptotic distributions is not a chisquare, in which case this - test is notappropriate. + test is not appropriate. References ---------- @@ -3190,7 +3190,7 @@ Notes ----- Due to the assumption that the test statistic has a chi squared - distribution, the p-vale is only reliable for n > 10 and more than + distribution, the p-value is only reliable for n > 10 and more than 6 repeated measurements. References From scipy-svn at scipy.org Wed Jun 16 06:59:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 05:59:02 -0500 (CDT) Subject: [Scipy-svn] r6504 - branches/0.8.x/scipy/sparse/linalg/dsolve Message-ID: <20100616105902.B56A039C4B4@scipy.org> Author: rgommers Date: 2010-06-16 05:59:02 -0500 (Wed, 16 Jun 2010) New Revision: 6504 Modified: branches/0.8.x/scipy/sparse/linalg/dsolve/SConscript Log: BUG: backport of r6487. Attempt at fixing #1176. Modified: branches/0.8.x/scipy/sparse/linalg/dsolve/SConscript =================================================================== --- branches/0.8.x/scipy/sparse/linalg/dsolve/SConscript 2010-06-16 03:53:04 UTC (rev 6503) +++ branches/0.8.x/scipy/sparse/linalg/dsolve/SConscript 2010-06-16 10:59:02 UTC (rev 6504) @@ -1,4 +1,5 @@ -from os.path import join as pjoin +import os +import glob import sys from numscons import GetNumpyEnvironment @@ -29,46 +30,22 @@ if sys.platform == 'win32': superlu_def.append((('NO_TIMER'), 1)) superlu_def.append((('USE_VENDOR_BLAS'), 2)) -superlu_env.Append(CPPDEFINES = superlu_def) +superlu_env.Append(CPPDEFINES=superlu_def) +superlu_env.Append(CPPPATH=[os.path.join('SuperLU', 'SRC')]) -superlu_src = [pjoin('SuperLU', 'SRC', s) for s in [ "ccolumn_bmod.c", -"ccolumn_dfs.c", "ccopy_to_ucol.c", "cgscon.c", "cgsequ.c", "cgsrfs.c", -"cgssv.c", "cgssvx.c", "cgstrf.c", "cgstrs.c", "clacon.c", "clangs.c", -"claqgs.c", "cmemory.c", "colamd.c", "cpanel_bmod.c", "cpanel_dfs.c", -"cpivotL.c", "cpivotgrowth.c", "cpruneL.c", "creadhb.c", "csnode_bmod.c", -"csnode_dfs.c", "csp_blas2.c", "csp_blas3.c", "cutil.c", "dGetDiagU.c", -"dcolumn_bmod.c", "dcolumn_dfs.c", "dcomplex.c", "dcopy_to_ucol.c", "dgscon.c", -"dgsequ.c", "dgsrfs.c", "dgssv.c", "dgssvx.c", "dgstrf.c", "dgstrs.c", -"dgstrsL.c", "dlacon.c", "dlamch.c", "dlangs.c", "dlaqgs.c", "dmemory.c", -"dpanel_bmod.c", "dpanel_dfs.c", "dpivotL.c", "dpivotgrowth.c", "dpruneL.c", -"dreadhb.c", "dsnode_bmod.c", "dsnode_dfs.c", "dsp_blas2.c", "dsp_blas3.c", -"dutil.c", "dzsum1.c", "get_perm_c.c", "heap_relax_snode.c", "icmax1.c", -"izmax1.c", "memory.c", "mmd.c", "relax_snode.c", "scolumn_bmod.c", -"scolumn_dfs.c", "scomplex.c", "scopy_to_ucol.c", "scsum1.c", "sgscon.c", -"sgsequ.c", "sgsrfs.c", "sgssv.c", "sgssvx.c", "sgstrf.c", "sgstrs.c", -"slacon.c", "slamch.c", "slangs.c", "slaqgs.c", "smemory.c", "sp_coletree.c", -"sp_ienv.c", "sp_preorder.c", "spanel_bmod.c", "spanel_dfs.c", "spivotL.c", -"spivotgrowth.c", "spruneL.c", "sreadhb.c", "ssnode_bmod.c", "ssnode_dfs.c", -"ssp_blas2.c", "ssp_blas3.c", "superlu_timer.c", "sutil.c", "util.c", -"xerbla.c", "zcolumn_bmod.c", "zcolumn_dfs.c", "zcopy_to_ucol.c", "zgscon.c", -"zgsequ.c", "zgsrfs.c", "zgssv.c", "zgssvx.c", "zgstrf.c", "zgstrs.c", -"zlacon.c", "zlangs.c", "zlaqgs.c", "zmemory.c", "zpanel_bmod.c", -"zpanel_dfs.c", "zpivotL.c", "zpivotgrowth.c", "zpruneL.c", "zreadhb.c", -"zsnode_bmod.c", "zsnode_dfs.c", "zsp_blas2.c", "zsp_blas3.c", "zutil.c"]] +superlu_src = env.Glob(os.path.join('SuperLU', 'SRC', "*.c")) # XXX: we should detect whether lsame is already defined in BLAS/LAPACK. Here, # when using MSVC + MKL, lsame is already in MKL if not (built_with_mstools(env) and (not built_with_gnu_f77(env))): - superlu_src.append(pjoin("SuperLU", "SRC", "lsame.c")) -superlu = superlu_env.DistutilsStaticExtLibrary('superlu_src', source = superlu_src) + superlu_src.append(os.path.join("SuperLU", "SRC", "lsame.c")) +superlu = superlu_env.DistutilsStaticExtLibrary('superlu_src', source=superlu_src) # Build python extensions pyenv = env.Clone() -pyenv.Append(CPPPATH = [pjoin('SuperLU', 'SRC')]) -pyenv.Prepend(LIBS = superlu) +pyenv.Append(CPPPATH=[os.path.join('SuperLU', 'SRC')]) +pyenv.Prepend(LIBPATH=["."]) +pyenv.Prepend(LIBS=["superlu_src"]) common_src = ['_superlu_utils.c', '_superluobject.c'] -for prec in ['z', 'd', 'c', 's']: - pyenv.NumpyPythonExtension('_%ssuperlu' % prec, - source = common_src + \ - ['_%ssuperlumodule.c' % prec]) +pyenv.NumpyPythonExtension('_superlu', source=common_src + ['_superlumodule.c']) From scipy-svn at scipy.org Wed Jun 16 06:59:18 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 05:59:18 -0500 (CDT) Subject: [Scipy-svn] r6505 - branches/0.8.x/scipy/special Message-ID: <20100616105918.AF00639C4B4@scipy.org> Author: rgommers Date: 2010-06-16 05:59:18 -0500 (Wed, 16 Jun 2010) New Revision: 6505 Modified: branches/0.8.x/scipy/special/setup.py Log: ENH: backport of r6498. Barf with a sensical message when get_info is missing. Modified: branches/0.8.x/scipy/special/setup.py =================================================================== --- branches/0.8.x/scipy/special/setup.py 2010-06-16 10:59:02 UTC (rev 6504) +++ branches/0.8.x/scipy/special/setup.py 2010-06-16 10:59:18 UTC (rev 6505) @@ -4,8 +4,15 @@ import sys from os.path import join from distutils.sysconfig import get_python_inc -from numpy.distutils.misc_util import get_numpy_include_dirs, get_info +import numpy +from numpy.distutils.misc_util import get_numpy_include_dirs +try: + from numpy.distutils.misc_util import get_info +except ImportError: + raise ValueError("numpy >= 1.4 is required (detected %s from %s)" % \ + (numpy.__version__, numpy.__file__)) + def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration config = Configuration('special', parent_package, top_path) From scipy-svn at scipy.org Wed Jun 16 06:59:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 05:59:36 -0500 (CDT) Subject: [Scipy-svn] r6506 - branches/0.8.x/scipy/linalg/tests Message-ID: <20100616105936.8430539C4B4@scipy.org> Author: rgommers Date: 2010-06-16 05:59:36 -0500 (Wed, 16 Jun 2010) New Revision: 6506 Modified: branches/0.8.x/scipy/linalg/tests/test_decomp.py Log: TST: mark linalg_misaligned test as knownfailure in 0.8.x branch. Modified: branches/0.8.x/scipy/linalg/tests/test_decomp.py =================================================================== --- branches/0.8.x/scipy/linalg/tests/test_decomp.py 2010-06-16 10:59:18 UTC (rev 6505) +++ branches/0.8.x/scipy/linalg/tests/test_decomp.py 2010-06-16 10:59:36 UTC (rev 6506) @@ -16,7 +16,7 @@ import numpy as np from numpy.testing import TestCase, assert_equal, assert_array_almost_equal, \ - assert_array_equal, assert_raises, run_module_suite + assert_array_equal, assert_raises, run_module_suite, dec from scipy.linalg import eig, eigvals, lu, svd, svdvals, cholesky, qr, \ schur, rsf2csf, lu_solve, lu_factor, solve, diagsvd, hessenberg, rq, \ @@ -1030,8 +1030,8 @@ eig(z, overwrite_a=True) eig(z.T, overwrite_a=True) - + def test_aligned_mem(): """Check linalg works with non-aligned memory""" # Allocate 804 bytes of memory (allocated on boundary) @@ -1041,7 +1041,7 @@ z = np.frombuffer(a.data, offset=4, count=100, dtype=float) z.shape = 10, 10 - eig(z, overwrite_a=True) + eig(z, overwrite_a=True) eig(z.T, overwrite_a=True) def test_aligned_mem_complex(): @@ -1074,6 +1074,7 @@ func(*a,**kwargs) + at dec.knownfailureif(True, "Ticket #1152, triggers a segfault in rare cases.") def test_lapack_misaligned(): M = np.eye(10,dtype=float) R = np.arange(100) @@ -1089,8 +1090,8 @@ (eigvals,(S,),dict(overwrite_a=True)), # no crash (lu,(S,),dict(overwrite_a=True)), # no crash (lu_factor,(S,),dict(overwrite_a=True)), # no crash - (lu_solve,((LU,piv),b),dict(overwrite_b=True)), - (solve,(S,b),dict(overwrite_a=True,overwrite_b=True)), + (lu_solve,((LU,piv),b),dict(overwrite_b=True)), + (solve,(S,b),dict(overwrite_a=True,overwrite_b=True)), (svd,(M,),dict(overwrite_a=True)), # no crash (svd,(R,),dict(overwrite_a=True)), # no crash (svd,(S,),dict(overwrite_a=True)), # crash From scipy-svn at scipy.org Wed Jun 16 11:21:35 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 10:21:35 -0500 (CDT) Subject: [Scipy-svn] r6507 - trunk/scipy/optimize Message-ID: <20100616152135.38FD239CAE7@scipy.org> Author: charris Date: 2010-06-16 10:21:34 -0500 (Wed, 16 Jun 2010) New Revision: 6507 Modified: trunk/scipy/optimize/minpack.py Log: DEP: Remove deprecated minpack.bisection function. Remove minpack.newton, newton is now in zeros. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-16 10:59:36 UTC (rev 6506) +++ trunk/scipy/optimize/minpack.py 2010-06-16 15:21:34 UTC (rev 6507) @@ -7,7 +7,7 @@ error = _minpack.error -__all__ = ['fsolve', 'leastsq', 'fixed_point', 'bisection', 'curve_fit'] +__all__ = ['fsolve', 'leastsq', 'fixed_point', 'curve_fit'] def check_func(thefunc, x0, args, numinputs, output_shape=None): res = atleast_1d(thefunc(*((x0[:numinputs],)+args))) @@ -465,103 +465,6 @@ return (good,err) -# Newton-Raphson method -def newton(func, x0, fprime=None, args=(), tol=1.48e-8, maxiter=50): - """Find a zero using the Newton-Raphson or secant method. - - Find a zero of the function `func` given a nearby starting point `x0`. - The Newton-Rapheson method is used if the derivative `fprime` of `func` - is provided, otherwise the secant method is used. - - Parameters - ---------- - func : function - The function whose zero is wanted. It must be a function of a - single variable of the form f(x,a,b,c...), where a,b,c... are extra - arguments that can be passed in the `args` parameter. - x0 : float - An initial estimate of the zero that should be somewhere near the - actual zero. - fprime : {None, function}, optional - The derivative of the function when available and convenient. If it - is None, then the secant method is used. The default is None. - args : tuple, optional - Extra arguments to be used in the function call. - tol : float, optional - The allowable error of the zero value. - maxiter : int, optional - Maximum number of iterations. - - Returns - ------- - zero : float - Estimated location where function is zero. - - See Also - -------- - brentq, brenth, ridder, bisect -- find zeroes in one dimension. - fsolve -- find zeroes in n dimensions. - - Notes - ----- - The convergence rate of the Newton-Rapheson method is quadratic while - that of the secant method is somewhat less. This means that if the - function is well behaved the actual error in the estimated zero is - approximatly the square of the requested tolerance up to roundoff - error. However, the stopping criterion used here is the step size and - there is no quarantee that a zero has been found. Consequently the - result should be verified. Safer algorithms are brentq, brenth, ridder, - and bisect, but they all require that the root first be bracketed in an - interval where the function changes sign. The brentq algorithm is - recommended for general use in one dimemsional problems when such an - interval has been found. - - """ - msg = "minpack.newton is moving to zeros.newton" - warnings.warn(msg, DeprecationWarning) - - if fprime is not None: - # Newton-Rapheson method - p0 = x0 - for iter in range(maxiter): - myargs = (p0,) + args - fval = func(*myargs) - fder = fprime(*myargs) - if fder == 0: - msg = "derivative was zero." - warnings.warn(msg, RuntimeWarning) - return p0 - p = p0 - func(*myargs)/fprime(*myargs) - if abs(p - p0) < tol: - return p - p0 = p - else: - # Secant method - p0 = x0 - if x0 >= 0: - p1 = x0*(1 + 1e-4) + 1e-4 - else: - p1 = x0*(1 + 1e-4) - 1e-4 - q0 = func(*((p0,) + args)) - q1 = func(*((p1,) + args)) - for iter in range(maxiter): - if q1 == q0: - if p1 != p0: - msg = "Tolerance of %s reached" % (p1 - p0) - warnings.warn(msg, RuntimeWarning) - return (p1 + p0)/2.0 - else: - p = p1 - q1*(p1 - p0)/(q1 - q0) - if abs(p - p1) < tol: - return p - p0 = p1 - q0 = q1 - p1 = p - q1 = func(*((p1,) + args)) - msg = "Failed to converge after %d iterations, value is %s" % (maxiter, p) - raise RuntimeError(msg) - - # Steffensen's Method using Aitken's Del^2 convergence acceleration. def fixed_point(func, x0, args=(), xtol=1e-8, maxiter=500): """Find the point where func(x) == x @@ -615,35 +518,3 @@ p0 = p msg = "Failed to converge after %d iterations, value is %s" % (maxiter, p) raise RuntimeError(msg) - - -def bisection(func, a, b, args=(), xtol=1e-10, maxiter=400): - """Bisection root-finding method. Given a function and an interval with - func(a) * func(b) < 0, find the root between a and b. - - """ - msg = "minpack.bisection is deprecated, use zeros.bisect instead" - warnings.warn(msg, DeprecationWarning) - - i = 1 - eva = func(a,*args) - evb = func(b,*args) - if eva*evb >= 0: - msg = "Must start with interval where func(a) * func(b) < 0" - raise ValueError(msg) - while i <= maxiter: - dist = (b - a)/2.0 - p = a + dist - if dist < xtol: - return p - ev = func(p,*args) - if ev == 0: - return p - i += 1 - if ev*eva > 0: - a = p - eva = ev - else: - b = p - msg = "Failed to converge after %d iterations, value is %s" % (maxiter, p) - raise RuntimeError(msg) From scipy-svn at scipy.org Wed Jun 16 11:21:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 10:21:40 -0500 (CDT) Subject: [Scipy-svn] r6508 - trunk/scipy/optimize Message-ID: <20100616152140.63A3139CB02@scipy.org> Author: charris Date: 2010-06-16 10:21:40 -0500 (Wed, 16 Jun 2010) New Revision: 6508 Modified: trunk/scipy/optimize/minpack.py Log: DEP, STY: Remove deprecated warning keyword from leastsq and make a few style cleanups. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-16 15:21:34 UTC (rev 6507) +++ trunk/scipy/optimize/minpack.py 2010-06-16 15:21:40 UTC (rev 6508) @@ -171,7 +171,7 @@ def leastsq(func, x0, args=(), Dfun=None, full_output=0, col_deriv=0, ftol=1.49012e-8, xtol=1.49012e-8, - gtol=0.0, maxfev=0, epsfcn=0.0, factor=100, diag=None,warning=True): + gtol=0.0, maxfev=0, epsfcn=0.0, factor=100, diag=None): """Minimize the sum of squares of a set of equations. :: @@ -216,9 +216,6 @@ (``factor * || diag * x||``). Should be in interval ``(0.1, 100)``. diag : sequence N positive entries that serve as a scale factors for the variables. - warning : bool - Whether to print a warning message when the call is unsuccessful. - Deprecated, use the warnings module instead. Returns ------- @@ -261,29 +258,27 @@ "leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms. """ - if not warning : - msg = "The warning keyword is deprecated. Use the warnings module." - warnings.warn(msg, DeprecationWarning) - x0 = array(x0,ndmin=1) + x0 = array(x0, ndmin=1) n = len(x0) - if type(args) != type(()): args = (args,) - m = check_func(func,x0,args,n)[0] - if n>m: + if type(args) != type(()): + args = (args,) + m = check_func(func, x0, args, n)[0] + if n > m: raise TypeError('Improper input: N=%s must not exceed M=%s' % (n,m)) if Dfun is None: if (maxfev == 0): - maxfev = 200*(n+1) - retval = _minpack._lmdif(func, x0, args, full_output, - ftol, xtol, gtol, - maxfev, epsfcn, factor, diag) + maxfev = 200*(n + 1) + retval = _minpack._lmdif(func, x0, args, full_output, ftol, xtol, + gtol, maxfev, epsfcn, factor, diag) else: if col_deriv: - check_func(Dfun,x0,args,n,(n,m)) + check_func(Dfun, x0, args, n, (n,m)) else: - check_func(Dfun,x0,args,n,(m,n)) + check_func(Dfun, x0, args, n, (m,n)) if (maxfev == 0): - maxfev = 100*(n+1) - retval = _minpack._lmder(func,Dfun,x0,args,full_output,col_deriv,ftol,xtol,gtol,maxfev,factor,diag) + maxfev = 100*(n + 1) + retval = _minpack._lmder(func, Dfun, x0, args, full_output, col_deriv, + ftol, xtol, gtol, maxfev, factor, diag) errors = {0:["Improper input parameters.", TypeError], 1:["Both actual and predicted relative reductions " @@ -335,7 +330,7 @@ cov_x = inv(dot(transpose(R),R)) except LinAlgError: pass - return (retval[0], cov_x) + retval[1:-1] + (mesg,info) + return (retval[0], cov_x) + retval[1:-1] + (mesg, info) else: return (retval[0], info) From scipy-svn at scipy.org Wed Jun 16 11:21:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 10:21:45 -0500 (CDT) Subject: [Scipy-svn] r6509 - trunk/scipy/optimize Message-ID: <20100616152145.50A7139CAE7@scipy.org> Author: charris Date: 2010-06-16 10:21:45 -0500 (Wed, 16 Jun 2010) New Revision: 6509 Modified: trunk/scipy/optimize/minpack.py Log: STY: Coding style cleanups. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-16 15:21:40 UTC (rev 6508) +++ trunk/scipy/optimize/minpack.py 2010-06-16 15:21:45 UTC (rev 6509) @@ -110,26 +110,26 @@ if not warning : msg = "The warning keyword is deprecated. Use the warnings module." warnings.warn(msg, DeprecationWarning) - x0 = array(x0,ndmin=1) + x0 = array(x0, ndmin=1) n = len(x0) if type(args) != type(()): args = (args,) - check_func(func,x0,args,n,(n,)) + check_func(func, x0, args, n, (n,)) Dfun = fprime if Dfun is None: if band is None: - ml,mu = -10,-10 + ml, mu = -10,-10 else: - ml,mu = band[:2] + ml, mu = band[:2] if (maxfev == 0): - maxfev = 200*(n+1) + maxfev = 200*(n + 1) retval = _minpack._hybrd(func, x0, args, full_output, xtol, - maxfev, ml, mu, epsfcn, factor, diag) + maxfev, ml, mu, epsfcn, factor, diag) else: check_func(Dfun,x0,args,n,(n,n)) if (maxfev == 0): - maxfev = 100*(n+1) + maxfev = 100*(n + 1) retval = _minpack._hybrj(func, Dfun, x0, args, full_output, - col_deriv, xtol, maxfev, factor,diag) + col_deriv, xtol, maxfev, factor,diag) errors = {0:["Improper input parameters were entered.",TypeError], 1:["The solution converged.", None], @@ -429,35 +429,35 @@ return popt, pcov -def check_gradient(fcn,Dfcn,x0,args=(),col_deriv=0): +def check_gradient(fcn, Dfcn, x0, args=(), col_deriv=0): """Perform a simple check on the gradient for correctness. """ x = atleast_1d(x0) n = len(x) - x=x.reshape((n,)) + x = x.reshape((n,)) fvec = atleast_1d(fcn(x,*args)) m = len(fvec) - fvec=fvec.reshape((m,)) + fvec = fvec.reshape((m,)) ldfjac = m fjac = atleast_1d(Dfcn(x,*args)) - fjac=fjac.reshape((m,n)) + fjac = fjac.reshape((m,n)) if col_deriv == 0: fjac = transpose(fjac) xp = zeros((n,), float) err = zeros((m,), float) fvecp = None - _minpack._chkder(m,n,x,fvec,fjac,ldfjac,xp,fvecp,1,err) + _minpack._chkder(m, n, x, fvec, fjac, ldfjac, xp, fvecp, 1, err) fvecp = atleast_1d(fcn(xp,*args)) - fvecp=fvecp.reshape((m,)) - _minpack._chkder(m,n,x,fvec,fjac,ldfjac,xp,fvecp,2,err) + fvecp = fvecp.reshape((m,)) + _minpack._chkder(m, n, x, fvec, fjac, ldfjac, xp, fvecp, 2, err) - good = (product(greater(err,0.5),axis=0)) + good = (product(greater(err, 0.5), axis=0)) - return (good,err) + return (good, err) # Steffensen's Method using Aitken's Del^2 convergence acceleration. @@ -489,7 +489,7 @@ p1 = func(p0, *args) p2 = func(p1, *args) d = p2 - 2.0 * p1 + p0 - p = where(d == 0, p2, p0 - (p1 - p0)*(p1-p0) / d) + p = where(d == 0, p2, p0 - (p1 - p0)*(p1 - p0) / d) relerr = where(p0 == 0, p, (p-p0)/p0) if all(relerr < xtol): return p @@ -503,11 +503,11 @@ if d == 0.0: return p2 else: - p = p0 - (p1 - p0)*(p1-p0) / d + p = p0 - (p1 - p0)*(p1 - p0) / d if p0 == 0: relerr = p else: - relerr = (p-p0)/p0 + relerr = (p - p0)/p0 if relerr < xtol: return p p0 = p From scipy-svn at scipy.org Wed Jun 16 11:21:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 10:21:49 -0500 (CDT) Subject: [Scipy-svn] r6510 - trunk/scipy/optimize Message-ID: <20100616152149.6D0C139CAE7@scipy.org> Author: charris Date: 2010-06-16 10:21:49 -0500 (Wed, 16 Jun 2010) New Revision: 6510 Modified: trunk/scipy/optimize/minpack.py Log: DEP: Remove deprecated warning keyword from fsolve. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-16 15:21:45 UTC (rev 6509) +++ trunk/scipy/optimize/minpack.py 2010-06-16 15:21:49 UTC (rev 6510) @@ -24,7 +24,7 @@ def fsolve(func, x0, args=(), fprime=None, full_output=0, col_deriv=0, xtol=1.49012e-8, maxfev=0, band=None, - epsfcn=0.0, factor=100, diag=None, warning=True): + epsfcn=0.0, factor=100, diag=None): """ Find the roots of a function. @@ -47,9 +47,6 @@ col_deriv : bool Specify whether the Jacobian function computes derivatives down the columns (faster, because there is no transpose operation). - warning : bool - Whether to print a warning message when the call is unsuccessful. - This option is deprecated, use the warnings module instead. Returns ------- @@ -107,9 +104,6 @@ ``fsolve`` is a wrapper around MINPACK's hybrd and hybrj algorithms. """ - if not warning : - msg = "The warning keyword is deprecated. Use the warnings module." - warnings.warn(msg, DeprecationWarning) x0 = array(x0, ndmin=1) n = len(x0) if type(args) != type(()): args = (args,) From scipy-svn at scipy.org Thu Jun 17 07:47:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 06:47:37 -0500 (CDT) Subject: [Scipy-svn] r6513 - trunk/scipy/signal Message-ID: <20100617114737.8D11639CAFE@scipy.org> Author: rgommers Date: 2010-06-17 06:47:37 -0500 (Thu, 17 Jun 2010) New Revision: 6513 Modified: trunk/scipy/signal/sigtoolsmodule.c Log: BUG: fix 64-bit problem in signal.medfilt. Patch by C. Gohlke. Modified: trunk/scipy/signal/sigtoolsmodule.c =================================================================== --- trunk/scipy/signal/sigtoolsmodule.c 2010-06-16 16:43:41 UTC (rev 6512) +++ trunk/scipy/signal/sigtoolsmodule.c 2010-06-17 11:47:37 UTC (rev 6513) @@ -1254,7 +1254,7 @@ if (a_image == NULL) goto fail; if (size != NULL) { - a_size = (PyArrayObject *)PyArray_ContiguousFromObject(size, PyArray_LONG, 1, 1); + a_size = (PyArrayObject *)PyArray_ContiguousFromObject(size, NPY_INTP, 1, 1); if (a_size == NULL) goto fail; if ((RANK(a_size) != 1) || (DIMS(a_size)[0] < 2)) PYERR("Size must be a length two sequence"); From scipy-svn at scipy.org Thu Jun 17 07:52:42 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 06:52:42 -0500 (CDT) Subject: [Scipy-svn] r6514 - branches/0.8.x/scipy/signal Message-ID: <20100617115242.8439539CAFE@scipy.org> Author: rgommers Date: 2010-06-17 06:52:42 -0500 (Thu, 17 Jun 2010) New Revision: 6514 Modified: branches/0.8.x/scipy/signal/sigtoolsmodule.c Log: BUG: fix 64-bit problem in signal.medfilt. Patch by C. Gohlke. Backport of r6513. Modified: branches/0.8.x/scipy/signal/sigtoolsmodule.c =================================================================== --- branches/0.8.x/scipy/signal/sigtoolsmodule.c 2010-06-17 11:47:37 UTC (rev 6513) +++ branches/0.8.x/scipy/signal/sigtoolsmodule.c 2010-06-17 11:52:42 UTC (rev 6514) @@ -1254,7 +1254,7 @@ if (a_image == NULL) goto fail; if (size != NULL) { - a_size = (PyArrayObject *)PyArray_ContiguousFromObject(size, PyArray_LONG, 1, 1); + a_size = (PyArrayObject *)PyArray_ContiguousFromObject(size, NPY_INTP, 1, 1); if (a_size == NULL) goto fail; if ((RANK(a_size) != 1) || (DIMS(a_size)[0] < 2)) PYERR("Size must be a length two sequence"); From scipy-svn at scipy.org Thu Jun 17 08:50:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 07:50:45 -0500 (CDT) Subject: [Scipy-svn] r6515 - trunk/scipy/stats/tests Message-ID: <20100617125045.99F7F39CAFE@scipy.org> Author: rgommers Date: 2010-06-17 07:50:45 -0500 (Thu, 17 Jun 2010) New Revision: 6515 Modified: trunk/scipy/stats/tests/test_stats.py Log: TST: lower precision for kstest to fix test failure reported in #1196. Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-06-17 11:52:42 UTC (rev 6514) +++ trunk/scipy/stats/tests/test_stats.py 2010-06-17 12:50:45 UTC (rev 6515) @@ -512,7 +512,7 @@ # - multidimensional arrays (since 'a' is ravel'd as the first line in the method) # - very large arrays # - Nans, Infs, empty and otherwise bad inputs - + # sample arrays to test the histogram with low_values = np.array([0.2, 0.3, 0.4, 0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2], dtype=float) # 11 values @@ -567,7 +567,7 @@ (self.few_values, (np.array([ 4.5, 0. , 0.1, 0. , 0. , 0. , 0. , 1. , 0. , 3. ]), -1., 0.4, 0)), - + ) for inputs, expected_results in basic_tests: # use the first lot of weights for test @@ -1231,8 +1231,9 @@ np.array((0.12464329735846891, 0.089444888711820769)), 15) assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'less')), np.array((0.12464329735846891, 0.040989164077641749)), 15) + # this 'greater' test fails with precision of decimal=14 assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'greater')), - np.array((0.0072115233216310994, 0.98531158590396228)), 14) + np.array((0.0072115233216310994, 0.98531158590396228)), 12) #missing: no test that uses *args @@ -1494,7 +1495,7 @@ b = 31.8137186141 self.do(a, b) - # Note the next tests use axis=None as default, not axis=0 + # Note the next tests use axis=None as default, not axis=0 def test_2dlist(self): ''' Test a 2d list''' a=[[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120]] @@ -1663,7 +1664,7 @@ assert_equal(stats.trim1(a, 0.2), np.arange(9)) assert_equal(stats.trim1(a, 0.2, tail='left'), np.arange(2,11)) assert_equal(stats.trim1(a, 3/11., tail='left'), np.arange(3,11)) - + def test_trimboth(self): a = np.arange(11) assert_equal(stats.trimboth(a, 3/11.), np.arange(3,8)) @@ -1672,7 +1673,7 @@ np.arange(4,20).reshape(4,4)) assert_equal(stats.trimboth(np.arange(24).reshape(4,6).T, 2/6.), np.array([[ 2, 8, 14, 20],[ 3, 9, 15, 21]])) - assert_raises(ValueError, stats.trimboth, + assert_raises(ValueError, stats.trimboth, np.arange(24).reshape(4,6).T, 4/6.) def test_trim_mean(self): @@ -1706,7 +1707,7 @@ assert_equal(upp, c.mean() + fact*c.std()) assert_equal(c.size, 4) assert_equal(a.size, 36) #check original array unchanged - + def test_sigmaclip3(self): a = np.concatenate((np.linspace(9.5,10.5,11),np.linspace(-100,-50,3))) fact = 1.8 From scipy-svn at scipy.org Thu Jun 17 08:53:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 07:53:03 -0500 (CDT) Subject: [Scipy-svn] r6516 - branches/0.8.x/scipy/stats/tests Message-ID: <20100617125303.2597239CAFE@scipy.org> Author: rgommers Date: 2010-06-17 07:53:02 -0500 (Thu, 17 Jun 2010) New Revision: 6516 Modified: branches/0.8.x/scipy/stats/tests/test_stats.py Log: TST: lower precision for kstest to fix test failure reported in #1196. Backport of r6515. Modified: branches/0.8.x/scipy/stats/tests/test_stats.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_stats.py 2010-06-17 12:50:45 UTC (rev 6515) +++ branches/0.8.x/scipy/stats/tests/test_stats.py 2010-06-17 12:53:02 UTC (rev 6516) @@ -512,7 +512,7 @@ # - multidimensional arrays (since 'a' is ravel'd as the first line in the method) # - very large arrays # - Nans, Infs, empty and otherwise bad inputs - + # sample arrays to test the histogram with low_values = np.array([0.2, 0.3, 0.4, 0.5, 0.5, 0.6, 0.7, 0.8, 0.9, 1.1, 1.2], dtype=float) # 11 values @@ -567,7 +567,7 @@ (self.few_values, (np.array([ 4.5, 0. , 0.1, 0. , 0. , 0. , 0. , 1. , 0. , 3. ]), -1., 0.4, 0)), - + ) for inputs, expected_results in basic_tests: # use the first lot of weights for test @@ -1231,8 +1231,9 @@ np.array((0.12464329735846891, 0.089444888711820769)), 15) assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'less')), np.array((0.12464329735846891, 0.040989164077641749)), 15) + # this 'greater' test fails with precision of decimal=14 assert_almost_equal( np.array(stats.kstest(x,'norm', alternative = 'greater')), - np.array((0.0072115233216310994, 0.98531158590396228)), 14) + np.array((0.0072115233216310994, 0.98531158590396228)), 12) #missing: no test that uses *args @@ -1494,7 +1495,7 @@ b = 31.8137186141 self.do(a, b) - # Note the next tests use axis=None as default, not axis=0 + # Note the next tests use axis=None as default, not axis=0 def test_2dlist(self): ''' Test a 2d list''' a=[[10, 20, 30, 40], [50, 60, 70, 80], [90, 100, 110, 120]] @@ -1663,7 +1664,7 @@ assert_equal(stats.trim1(a, 0.2), np.arange(9)) assert_equal(stats.trim1(a, 0.2, tail='left'), np.arange(2,11)) assert_equal(stats.trim1(a, 3/11., tail='left'), np.arange(3,11)) - + def test_trimboth(self): a = np.arange(11) assert_equal(stats.trimboth(a, 3/11.), np.arange(3,8)) @@ -1672,7 +1673,7 @@ np.arange(4,20).reshape(4,4)) assert_equal(stats.trimboth(np.arange(24).reshape(4,6).T, 2/6.), np.array([[ 2, 8, 14, 20],[ 3, 9, 15, 21]])) - assert_raises(ValueError, stats.trimboth, + assert_raises(ValueError, stats.trimboth, np.arange(24).reshape(4,6).T, 4/6.) def test_trim_mean(self): @@ -1706,7 +1707,7 @@ assert_equal(upp, c.mean() + fact*c.std()) assert_equal(c.size, 4) assert_equal(a.size, 36) #check original array unchanged - + def test_sigmaclip3(self): a = np.concatenate((np.linspace(9.5,10.5,11),np.linspace(-100,-50,3))) fact = 1.8 From scipy-svn at scipy.org Thu Jun 17 09:25:14 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 08:25:14 -0500 (CDT) Subject: [Scipy-svn] r6517 - trunk/scipy/weave Message-ID: <20100617132514.44ADD39CB08@scipy.org> Author: rgommers Date: 2010-06-17 08:25:14 -0500 (Thu, 17 Jun 2010) New Revision: 6517 Modified: trunk/scipy/weave/blitz_tools.py trunk/scipy/weave/bytecodecompiler.py Log: BUG: string exceptions are invalid syntax in Python >=2.6. Fixes #1193. Modified: trunk/scipy/weave/blitz_tools.py =================================================================== --- trunk/scipy/weave/blitz_tools.py 2010-06-17 12:53:02 UTC (rev 6516) +++ trunk/scipy/weave/blitz_tools.py 2010-06-17 13:25:14 UTC (rev 6517) @@ -32,7 +32,10 @@ # of time. It also can cause core-dumps if the sizes of the inputs # aren't compatible. if check_size and not size_check.check_expr(expr,local_dict,global_dict): - raise 'inputs failed to pass size check.' + if sys.version_info < (2, 6): + raise "inputs failed to pass size check." + else: + raise ValueError("inputs failed to pass size check.") # 2. try local cache try: Modified: trunk/scipy/weave/bytecodecompiler.py =================================================================== --- trunk/scipy/weave/bytecodecompiler.py 2010-06-17 12:53:02 UTC (rev 6516) +++ trunk/scipy/weave/bytecodecompiler.py 2010-06-17 13:25:14 UTC (rev 6517) @@ -6,6 +6,7 @@ #**************************************************************************# #* *# #**************************************************************************# +import sys import inspect import accelerate_tools @@ -237,7 +238,10 @@ elif goto is None: return next # Normal else: - raise 'xx' + if sys.version_info < (2, 6): + raise "Executing code failed." + else: + raise ValueError("Executing code failed.") symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal', 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in', @@ -977,7 +981,6 @@ var_name = self.codeobject.co_names[var_num] # First, figure out who owns this global - import sys myHash = id(self.function.func_globals) for module_name in sys.modules.keys(): module = sys.modules[module_name] From scipy-svn at scipy.org Thu Jun 17 09:28:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 08:28:06 -0500 (CDT) Subject: [Scipy-svn] r6518 - branches/0.8.x/scipy/weave Message-ID: <20100617132806.5A3E239CB08@scipy.org> Author: rgommers Date: 2010-06-17 08:28:06 -0500 (Thu, 17 Jun 2010) New Revision: 6518 Modified: branches/0.8.x/scipy/weave/blitz_tools.py branches/0.8.x/scipy/weave/bytecodecompiler.py Log: BUG: string exceptions are invalid syntax in Python >=2.6. Fixes #1193. Backport of r6517. Modified: branches/0.8.x/scipy/weave/blitz_tools.py =================================================================== --- branches/0.8.x/scipy/weave/blitz_tools.py 2010-06-17 13:25:14 UTC (rev 6517) +++ branches/0.8.x/scipy/weave/blitz_tools.py 2010-06-17 13:28:06 UTC (rev 6518) @@ -32,7 +32,10 @@ # of time. It also can cause core-dumps if the sizes of the inputs # aren't compatible. if check_size and not size_check.check_expr(expr,local_dict,global_dict): - raise 'inputs failed to pass size check.' + if sys.version_info < (2, 6): + raise "inputs failed to pass size check." + else: + raise ValueError("inputs failed to pass size check.") # 2. try local cache try: Modified: branches/0.8.x/scipy/weave/bytecodecompiler.py =================================================================== --- branches/0.8.x/scipy/weave/bytecodecompiler.py 2010-06-17 13:25:14 UTC (rev 6517) +++ branches/0.8.x/scipy/weave/bytecodecompiler.py 2010-06-17 13:28:06 UTC (rev 6518) @@ -6,6 +6,7 @@ #**************************************************************************# #* *# #**************************************************************************# +import sys import inspect import accelerate_tools @@ -237,7 +238,10 @@ elif goto is None: return next # Normal else: - raise 'xx' + if sys.version_info < (2, 6): + raise "Executing code failed." + else: + raise ValueError("Executing code failed.") symbols = { 0: 'less', 1: 'lesseq', 2: 'equal', 3: 'notequal', 4: 'greater', 5: 'greatereq', 6: 'in', 7: 'not in', @@ -977,7 +981,6 @@ var_name = self.codeobject.co_names[var_num] # First, figure out who owns this global - import sys myHash = id(self.function.func_globals) for module_name in sys.modules.keys(): module = sys.modules[module_name] From scipy-svn at scipy.org Thu Jun 17 16:36:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 15:36:36 -0500 (CDT) Subject: [Scipy-svn] r6519 - in trunk/scipy/special: . c_misc Message-ID: <20100617203636.C43F639CAE9@scipy.org> Author: ptvirtan Date: 2010-06-17 15:36:36 -0500 (Thu, 17 Jun 2010) New Revision: 6519 Modified: trunk/scipy/special/c_misc/fsolve.c trunk/scipy/special/c_misc/gammaincinv.c trunk/scipy/special/c_misc/misc.h trunk/scipy/special/setup.py Log: BUG: special: make gammaincinv behave more sanely when it thinks the iteration did not converge Modified: trunk/scipy/special/c_misc/fsolve.c =================================================================== --- trunk/scipy/special/c_misc/fsolve.c 2010-06-17 13:28:06 UTC (rev 6518) +++ trunk/scipy/special/c_misc/fsolve.c 2010-06-17 20:36:36 UTC (rev 6519) @@ -48,7 +48,7 @@ false_position(double *a, double *fa, double *b, double *fb, objective_function f, void *f_extra, double abserr, double relerr, double bisect_til, - double *best_x, double *best_f) + double *best_x, double *best_f, double *errest) { double x1=*a, f1=*fa, x2=*b, f2=*fb; fsolve_result_t r = FSOLVE_CONVERGED; @@ -163,5 +163,6 @@ r = FSOLVE_EXACT; finish: *a = x1; *fa = f1; *b = x2; *fb = f2; + *errest = w; return r; } Modified: trunk/scipy/special/c_misc/gammaincinv.c =================================================================== --- trunk/scipy/special/c_misc/gammaincinv.c 2010-06-17 13:28:06 UTC (rev 6518) +++ trunk/scipy/special/c_misc/gammaincinv.c 2010-06-17 20:36:36 UTC (rev 6519) @@ -1,9 +1,17 @@ +#include +#include + #include #include + #include "../cephes.h" #undef fabs #include "misc.h" +/* Limits after which to issue warnings about non-convergence */ +#define ALLOWED_ATOL (1e-306) +#define ALLOWED_RTOL (1e-9) + void scipy_special_raise_warning(char *fmt, ...); /* @@ -16,7 +24,7 @@ */ -extern double MACHEP; +extern double MACHEP, MAXNUM; static double gammainc(double x, double params[2]) @@ -30,7 +38,7 @@ double lo = 0.0, hi; double flo = -y, fhi = 0.25 - y; double params[2]; - double best_x, best_f; + double best_x, best_f, errest; fsolve_result_t r; if (a <= 0.0 || y <= 0.0 || y >= 0.25) { @@ -53,12 +61,13 @@ r = false_position(&lo, &flo, &hi, &fhi, (objective_function)gammainc, params, 2*MACHEP, 2*MACHEP, 1e-2*a, - &best_x, &best_f); - if (!(r == FSOLVE_CONVERGED || r == FSOLVE_EXACT)) { + &best_x, &best_f, &errest); + if (!(r == FSOLVE_CONVERGED || r == FSOLVE_EXACT) && + errest > ALLOWED_ATOL + ALLOWED_RTOL*fabs(best_x)) { scipy_special_raise_warning( - "gammaincinv: failed to converge at (a, y) = (%.20g, %.20g): %d\n", - a, y, r); - best_x = 0.0; + "gammaincinv: failed to converge at (a, y) = (%.20g, %.20g): got %g +- %g, code %d\n", + a, y, best_x, errest, r); + best_x = NPY_NAN; } return best_x; } Modified: trunk/scipy/special/c_misc/misc.h =================================================================== --- trunk/scipy/special/c_misc/misc.h 2010-06-17 13:28:06 UTC (rev 6518) +++ trunk/scipy/special/c_misc/misc.h 2010-06-17 20:36:36 UTC (rev 6519) @@ -18,7 +18,7 @@ fsolve_result_t false_position(double *a, double *fa, double *b, double *fb, objective_function f, void *f_extra, double abserr, double relerr, double bisect_til, - double *best_x, double *best_f); + double *best_x, double *best_f, double *errest); double besselpoly(double a, double lambda, double nu); double gammaincinv(double a, double x); Modified: trunk/scipy/special/setup.py =================================================================== --- trunk/scipy/special/setup.py 2010-06-17 13:28:06 UTC (rev 6518) +++ trunk/scipy/special/setup.py 2010-06-17 20:36:36 UTC (rev 6519) @@ -24,7 +24,9 @@ define_macros.append(('_USE_MATH_DEFINES',None)) # C libraries - config.add_library('sc_c_misc',sources=[join('c_misc','*.c')]) + config.add_library('sc_c_misc',sources=[join('c_misc','*.c')], + include_dirs=[get_python_inc(), get_numpy_include_dirs()], + macros=define_macros) config.add_library('sc_cephes',sources=[join('cephes','*.c')], include_dirs=[get_python_inc(), get_numpy_include_dirs()], macros=define_macros) From scipy-svn at scipy.org Thu Jun 17 16:36:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 15:36:51 -0500 (CDT) Subject: [Scipy-svn] r6520 - trunk/scipy/special/tests Message-ID: <20100617203651.4FC3D39CAE9@scipy.org> Author: ptvirtan Date: 2010-06-17 15:36:51 -0500 (Thu, 17 Jun 2010) New Revision: 6520 Modified: trunk/scipy/special/tests/test_basic.py trunk/scipy/special/tests/test_data.py Log: BUG: special: adjust test tolerances to be more lenient about numerical differences on non-x86 platforms Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2010-06-17 20:36:36 UTC (rev 6519) +++ trunk/scipy/special/tests/test_basic.py 2010-06-17 20:36:51 UTC (rev 6520) @@ -1592,7 +1592,7 @@ self.check_cephes_vs_amos(yv, yn, rtol=1e-11, atol=1e-305, skip=skipper) def test_iv_cephes_vs_amos(self): - self.check_cephes_vs_amos(iv, iv, rtol=1e-12, atol=1e-305) + self.check_cephes_vs_amos(iv, iv, rtol=5e-9, atol=1e-305) @dec.slow def test_iv_cephes_vs_amos_mass_test(self): @@ -1607,6 +1607,10 @@ c1 = iv(v, x) c2 = iv(v, x+0j) + # deal with differences in the inf cutoffs + c1[abs(c1) > 1e300] = np.inf + c2[abs(c2) > 1e300] = np.inf + dc = abs(c1/c2 - 1) dc[np.isnan(dc)] = 0 @@ -1614,7 +1618,7 @@ # Most error apparently comes from AMOS and not our implementation; # there are some problems near integer orders there - assert dc[k] < 1e-9, (iv(v[k], x[k]), iv(v[k], x[k]+0j)) + assert dc[k] < 1e-9, (v[k], x[k], iv(v[k], x[k]), iv(v[k], x[k]+0j)) def test_kv_cephes_vs_amos(self): #self.check_cephes_vs_amos(kv, kn, rtol=1e-9, atol=1e-305) Modified: trunk/scipy/special/tests/test_data.py =================================================================== --- trunk/scipy/special/tests/test_data.py 2010-06-17 20:36:36 UTC (rev 6519) +++ trunk/scipy/special/tests/test_data.py 2010-06-17 20:36:51 UTC (rev 6520) @@ -140,7 +140,7 @@ data(gammaincinv, 'gamma_inv_data_ipp-gamma_inv_data', (0,1), 2, rtol=1e-12), data(gammaincinv, 'gamma_inv_big_data_ipp-gamma_inv_big_data', - (0,1), 2, rtol=5e-12), + (0,1), 2, rtol=1e-11), # XXX: the data file needs reformatting... #data(gammaincinv, 'gamma_inv_small_data_ipp-gamma_inv_small_data', From scipy-svn at scipy.org Thu Jun 17 17:40:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 16:40:16 -0500 (CDT) Subject: [Scipy-svn] r6521 - in branches/0.8.x/scipy/special: . c_misc Message-ID: <20100617214016.646A839CAE9@scipy.org> Author: ptvirtan Date: 2010-06-17 16:40:16 -0500 (Thu, 17 Jun 2010) New Revision: 6521 Modified: branches/0.8.x/scipy/special/c_misc/fsolve.c branches/0.8.x/scipy/special/c_misc/gammaincinv.c branches/0.8.x/scipy/special/c_misc/misc.h branches/0.8.x/scipy/special/setup.py Log: BUG: special: make gammaincinv behave more sanely when it thinks the iteration did not converge (cherry picked from r6519) Modified: branches/0.8.x/scipy/special/c_misc/fsolve.c =================================================================== --- branches/0.8.x/scipy/special/c_misc/fsolve.c 2010-06-17 20:36:51 UTC (rev 6520) +++ branches/0.8.x/scipy/special/c_misc/fsolve.c 2010-06-17 21:40:16 UTC (rev 6521) @@ -48,7 +48,7 @@ false_position(double *a, double *fa, double *b, double *fb, objective_function f, void *f_extra, double abserr, double relerr, double bisect_til, - double *best_x, double *best_f) + double *best_x, double *best_f, double *errest) { double x1=*a, f1=*fa, x2=*b, f2=*fb; fsolve_result_t r = FSOLVE_CONVERGED; @@ -163,5 +163,6 @@ r = FSOLVE_EXACT; finish: *a = x1; *fa = f1; *b = x2; *fb = f2; + *errest = w; return r; } Modified: branches/0.8.x/scipy/special/c_misc/gammaincinv.c =================================================================== --- branches/0.8.x/scipy/special/c_misc/gammaincinv.c 2010-06-17 20:36:51 UTC (rev 6520) +++ branches/0.8.x/scipy/special/c_misc/gammaincinv.c 2010-06-17 21:40:16 UTC (rev 6521) @@ -1,9 +1,17 @@ +#include +#include + #include #include + #include "../cephes.h" #undef fabs #include "misc.h" +/* Limits after which to issue warnings about non-convergence */ +#define ALLOWED_ATOL (1e-306) +#define ALLOWED_RTOL (1e-9) + void scipy_special_raise_warning(char *fmt, ...); /* @@ -16,7 +24,7 @@ */ -extern double MACHEP; +extern double MACHEP, MAXNUM; static double gammainc(double x, double params[2]) @@ -30,7 +38,7 @@ double lo = 0.0, hi; double flo = -y, fhi = 0.25 - y; double params[2]; - double best_x, best_f; + double best_x, best_f, errest; fsolve_result_t r; if (a <= 0.0 || y <= 0.0 || y >= 0.25) { @@ -53,12 +61,13 @@ r = false_position(&lo, &flo, &hi, &fhi, (objective_function)gammainc, params, 2*MACHEP, 2*MACHEP, 1e-2*a, - &best_x, &best_f); - if (!(r == FSOLVE_CONVERGED || r == FSOLVE_EXACT)) { + &best_x, &best_f, &errest); + if (!(r == FSOLVE_CONVERGED || r == FSOLVE_EXACT) && + errest > ALLOWED_ATOL + ALLOWED_RTOL*fabs(best_x)) { scipy_special_raise_warning( - "gammaincinv: failed to converge at (a, y) = (%.20g, %.20g): %d\n", - a, y, r); - best_x = 0.0; + "gammaincinv: failed to converge at (a, y) = (%.20g, %.20g): got %g +- %g, code %d\n", + a, y, best_x, errest, r); + best_x = NPY_NAN; } return best_x; } Modified: branches/0.8.x/scipy/special/c_misc/misc.h =================================================================== --- branches/0.8.x/scipy/special/c_misc/misc.h 2010-06-17 20:36:51 UTC (rev 6520) +++ branches/0.8.x/scipy/special/c_misc/misc.h 2010-06-17 21:40:16 UTC (rev 6521) @@ -18,7 +18,7 @@ fsolve_result_t false_position(double *a, double *fa, double *b, double *fb, objective_function f, void *f_extra, double abserr, double relerr, double bisect_til, - double *best_x, double *best_f); + double *best_x, double *best_f, double *errest); double besselpoly(double a, double lambda, double nu); double gammaincinv(double a, double x); Modified: branches/0.8.x/scipy/special/setup.py =================================================================== --- branches/0.8.x/scipy/special/setup.py 2010-06-17 20:36:51 UTC (rev 6520) +++ branches/0.8.x/scipy/special/setup.py 2010-06-17 21:40:16 UTC (rev 6521) @@ -24,7 +24,9 @@ define_macros.append(('_USE_MATH_DEFINES',None)) # C libraries - config.add_library('sc_c_misc',sources=[join('c_misc','*.c')]) + config.add_library('sc_c_misc',sources=[join('c_misc','*.c')], + include_dirs=[get_python_inc(), get_numpy_include_dirs()], + macros=define_macros) config.add_library('sc_cephes',sources=[join('cephes','*.c')], include_dirs=[get_python_inc(), get_numpy_include_dirs()], macros=define_macros) From scipy-svn at scipy.org Thu Jun 17 17:40:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Thu, 17 Jun 2010 16:40:33 -0500 (CDT) Subject: [Scipy-svn] r6522 - branches/0.8.x/scipy/special/tests Message-ID: <20100617214033.8012639CAE9@scipy.org> Author: ptvirtan Date: 2010-06-17 16:40:33 -0500 (Thu, 17 Jun 2010) New Revision: 6522 Modified: branches/0.8.x/scipy/special/tests/test_basic.py branches/0.8.x/scipy/special/tests/test_data.py Log: BUG: special: adjust test tolerances to be more lenient about numerical differences on non-x86 platforms (cherry picked from r6520) Modified: branches/0.8.x/scipy/special/tests/test_basic.py =================================================================== --- branches/0.8.x/scipy/special/tests/test_basic.py 2010-06-17 21:40:16 UTC (rev 6521) +++ branches/0.8.x/scipy/special/tests/test_basic.py 2010-06-17 21:40:33 UTC (rev 6522) @@ -1592,7 +1592,7 @@ self.check_cephes_vs_amos(yv, yn, rtol=1e-11, atol=1e-305, skip=skipper) def test_iv_cephes_vs_amos(self): - self.check_cephes_vs_amos(iv, iv, rtol=1e-12, atol=1e-305) + self.check_cephes_vs_amos(iv, iv, rtol=5e-9, atol=1e-305) @dec.slow def test_iv_cephes_vs_amos_mass_test(self): @@ -1607,6 +1607,10 @@ c1 = iv(v, x) c2 = iv(v, x+0j) + # deal with differences in the inf cutoffs + c1[abs(c1) > 1e300] = np.inf + c2[abs(c2) > 1e300] = np.inf + dc = abs(c1/c2 - 1) dc[np.isnan(dc)] = 0 @@ -1614,7 +1618,7 @@ # Most error apparently comes from AMOS and not our implementation; # there are some problems near integer orders there - assert dc[k] < 1e-9, (iv(v[k], x[k]), iv(v[k], x[k]+0j)) + assert dc[k] < 1e-9, (v[k], x[k], iv(v[k], x[k]), iv(v[k], x[k]+0j)) def test_kv_cephes_vs_amos(self): #self.check_cephes_vs_amos(kv, kn, rtol=1e-9, atol=1e-305) Modified: branches/0.8.x/scipy/special/tests/test_data.py =================================================================== --- branches/0.8.x/scipy/special/tests/test_data.py 2010-06-17 21:40:16 UTC (rev 6521) +++ branches/0.8.x/scipy/special/tests/test_data.py 2010-06-17 21:40:33 UTC (rev 6522) @@ -140,7 +140,7 @@ data(gammaincinv, 'gamma_inv_data_ipp-gamma_inv_data', (0,1), 2, rtol=1e-12), data(gammaincinv, 'gamma_inv_big_data_ipp-gamma_inv_big_data', - (0,1), 2, rtol=5e-12), + (0,1), 2, rtol=1e-11), # XXX: the data file needs reformatting... #data(gammaincinv, 'gamma_inv_small_data_ipp-gamma_inv_small_data', From scipy-svn at scipy.org Fri Jun 18 09:02:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:02:16 -0500 (CDT) Subject: [Scipy-svn] r6523 - in trunk/scipy/io: . tests Message-ID: <20100618130216.3E5A039CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:02:16 -0500 (Fri, 18 Jun 2010) New Revision: 6523 Removed: trunk/scipy/io/array_import.py trunk/scipy/io/fopen.py trunk/scipy/io/npfile.py trunk/scipy/io/pickler.py trunk/scipy/io/tests/test_array_import.py trunk/scipy/io/tests/test_npfile.py Modified: trunk/scipy/io/__init__.py trunk/scipy/io/data_store.py Log: Remove deprecated objects in scipy.io on Python level. Modified: trunk/scipy/io/__init__.py =================================================================== --- trunk/scipy/io/__init__.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/__init__.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -6,11 +6,6 @@ from numpy import deprecate -# These are all deprecated (until the end deprecated tag) -from npfile import npfile -from data_store import save, load, create_module, create_shelf -from array_import import read_array, write_array -from pickler import objload, objsave from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray Deleted: trunk/scipy/io/array_import.py =================================================================== --- trunk/scipy/io/array_import.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/array_import.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,500 +0,0 @@ -# Authors: Travis Oliphant, Trent Oliphant -# with support from Lee Barford's group at Agilent, Inc. -# - -"""This module allows for the loading of an array from an ASCII -Text File - -""" - -__all__ = ['read_array', 'write_array'] - -# Standard library imports. -import os -import re -import sys -import types - -# Numpy imports. -import numpy - -from numpy import array, take, concatenate, asarray, real, imag, \ - deprecate -# Sadly, this module is still written with typecodes in mind. -from numpy.oldnumeric import Float - -# Local imports. -import numpyio - -default = None -_READ_BUFFER_SIZE = 1024*1024 -#_READ_BUFFER_SIZE = 1000 -#_READ_BUFFER_SIZE = 160 - -# ASCII Text object stream with automatic (un)compression and URL access. -# -# Adapted from -# TextFile class Written by: Konrad Hinsen -# -# Written by Travis Oliphant and Trent Oliphant -# with support from Agilent, Inc. -# - - -def convert_separator(sep): - newsep = '' - for k in sep: - if k in '.^$*+?{[\\|()': - newsep = newsep + '\\' + k - else: - newsep = newsep + k - return newsep - -def build_numberlist(lines): - if lines is default: - linelist = [-1] - else: - linelist = [] - errstr = "Argument lines must be a sequence of integers and/or range tuples." - try: - for num in lines[:-1]: # handle all but last element - if type(num) not in [types.IntType, types.TupleType]: - raise ValueError, errstr - if isinstance(num, types.IntType): - linelist.append(num) - else: - if not 1 < len(num) < 4: - raise ValueError, "Tuples must be valid range tuples." - linelist.extend(range(*num)) - except TypeError: - raise ValueError, errstr - num = lines[-1] - if type(num) is types.IntType: - linelist.append(num) - elif type(num) is types.TupleType: - if [types.IntType]*len(num) != map(type, num): - if len(num) > 1 and num[1] is not None: - raise ValueError, errstr - if len(num) == 1: - linelist.extend([num[0],-1]) - elif len(num) == 2: - if num[1] is None: - linelist.extend([num[0], -1]) - else: - linelist.extend(range(*num)) - elif len(num) == 3: - if num[1] is None: - linelist.extend([num[0], -num[2]]) - else: - linelist.extend(range(*num)) - else: - raise ValueError, errstr - return linelist - -def get_open_file(fileobject, mode='rb'): - try: - # this is the duck typing check: if fileobject - # can be used is os.path.expanduser, it is a string - # otherwise it is a fileobject - fileobject = os.path.expanduser(fileobject) - - if mode[0]=='r' and not os.path.exists(fileobject): - raise IOError, (2, 'No such file or directory: ' - + fileobject) - else: - try: - file = open(fileobject, mode) - except IOError, details: - file = None - if type(details) == type(()): - details = details + (fileobject,) - raise IOError, details - except (AttributeError, TypeError): - # it is assumed that the fileobject is a python - # file object if it can not be used in os.path.expanduser - file = fileobject - - return file - - -class ascii_stream(object): - """Text files with line iteration - - Ascii_stream instances can be used like normal read-only file objects - (i.e. by calling readline() and readlines()), but can - also be used as sequences of lines in for-loops. - - Finally, ascii_stream objects accept file names that start with '~' or - '~user' to indicate a home directory(for reading only). - - Constructor: ascii_stream(|fileobject|, |lines|,|comment|), - where |fileobject| is either an open python file object or - the name of the file, |lines| is a sequence of integers - or tuples(indicating ranges) of lines to be read, |comment| is the - comment line identifier """ - - def __init__(self, fileobject, lines=default, comment="#", - linesep='\n'): - if not isinstance(comment, types.StringType): - raise ValueError, "Comment must be a string." - self.linelist = build_numberlist(lines) - self.comment = comment - self.lencomment = len(comment) - self.file = get_open_file(fileobject, mode='r') - self.should_close_file = not (self.file is fileobject) - self._pos = self.file.tell() - self._lineindex = 0 - if self.linelist[-1] < 0: - self._linetoget = self.linelist[-1] - else: - self._linetoget = 0 - self._oldbuflines = 0 - self._linesplitter = linesep - self._buffer = self.readlines(_READ_BUFFER_SIZE) - self._totbuflines = len(self._buffer) - - def readlines(self, sizehint): - buffer = self.file.read(sizehint) - lines = buffer.split(self._linesplitter) - if len(buffer) < sizehint: # EOF - if buffer == '': - return [] - else: - return lines - else: - if len(lines) < 2: - raise ValueError, "Buffer size too small." - backup = len(lines[-1]) - self.file.seek(-backup, 1) - return lines[:-1] - - def __del__(self): - if hasattr(getattr(self, 'file', None),'close') and self.should_close_file: - self.file.close() - - def __getitem__(self, item): - while 1: - line = self.readnextline() - if line is None: - raise IndexError - if len(line) < self.lencomment or line[:self.lencomment] != self.comment: - break - return line - - def readnextline(self): - if self.linelist[self._lineindex] >= 0: - self._linetoget = self.linelist[self._lineindex] - self._lineindex += 1 - else: - self._linetoget = self._linetoget - self.linelist[self._lineindex] - while self._linetoget >= self._totbuflines: - self._buffer = self.readlines(_READ_BUFFER_SIZE) - self._oldbuflines = self._totbuflines - self._totbuflines += len(self._buffer) - if (self._totbuflines == self._oldbuflines): - return None - line = self._buffer[self._linetoget - self._oldbuflines] - return line - - def close(self): - self.file.close() - - def flush(self): - self.file.flush() - - -def move_past_spaces(firstline): - ind = 0 - firstline = firstline.lstrip() - while firstline[ind] not in [' ','\n','\t','\v','\f','\r']: - ind += 1 - return firstline[ind:], ind - - -def extract_columns(arlist, collist, atype, missing): - if collist[-1] < 0: - if len(collist) == 1: - toconvlist = arlist[::-collist[-1]] - else: - toconvlist = take(arlist,collist[:-1],0) - toconvlist = concatenate((toconvlist, - arlist[(collist[-2]-collist[-1])::(-collist[-1])])) - else: - toconvlist = take(arlist, collist,0) - - return numpyio.convert_objectarray(toconvlist, atype, missing) - - -# Given a string representing one line, a separator tuple, a list of -# columns to read for each element of the atype list and a missing -# value to insert when conversion fails. - -# Regular expressions for detecting complex numbers and for dealing -# with spaces between the real and imaginary parts - -_obj = re.compile(r""" - ([0-9.eE]+) # Real part - ([\t ]*) # Space between real and imaginary part - ([+-]) # +/- sign - ([\t ]*) # 0 or more spaces - (([0-9.eE]+[iIjJ]) - |([iIjJ][0-9.eE]+)) # Imaginary part - """, re.VERBOSE) - -_not_warned = 1 -def process_line(line, separator, collist, atype, missing): - global _not_warned - strlist = [] - line = _obj.sub(r"\1\3\5",line) # remove spaces between real - # and imaginary parts of complex numbers - - if _not_warned: - warn = 0 - if (_obj.search(line) is not None): - warn = 1 - for k in range(len(atype)): - if atype[k] in numpy.typecodes['Complex']: - warn = 0 - if warn: - numpy.disp("Warning: Complex data detected, but no requested typecode was complex.") - _not_warned = 0 - for mysep in separator[:-1]: - if mysep is None: - newline, ind = move_past_spaces(line) - strlist.append(line[:ind]) - line = newline - else: - ind = line.find(mysep) - strlist.append(line[:ind]) - line = line[ind+len(mysep):] - strlist.extend(line.split(separator[-1])) - arlist = array(strlist,'O') - N = len(atype) - vals = [None]*N - for k in range(len(atype)): - vals[k] = extract_columns(arlist, collist[k], atype[k], missing) - return vals - -def getcolumns(stream, columns, separator): - global _not_warned - comment = stream.comment - lenc = stream.lencomment - k, K = stream.linelist[0], len(stream._buffer) - while k < K: - firstline = stream._buffer[k] - if firstline != '' and firstline[:lenc] != comment: - break - k = k + 1 - if k == K: - raise ValueError, "First line to read not within %d lines of top." % K - firstline = stream._buffer[k] - N = len(columns) - collist = [None]*N - colsize = [None]*N - for k in range(N): - collist[k] = build_numberlist(columns[k]) - _not_warned = 0 - val = process_line(firstline, separator, collist, [Float]*N, 0) - for k in range(N): - colsize[k] = len(val[k]) - return colsize, collist - -def convert_to_equal_lists(cols, atype): - if not isinstance(cols, types.ListType): - cols = [cols] - if not isinstance(atype, types.ListType): - atype = [atype] - N = len(cols) - len(atype) - if N > 0: - atype.extend([atype[-1]]*N) - elif N < 0: - cols.extend([cols[-1]]*(-N)) - return cols, atype - - - at deprecate(message=""" -The functionality of read_array is in numpy.loadtxt which allows the same -functionality using different syntax. -""") -def read_array(fileobject, separator=default, columns=default, comment="#", - lines=default, atype=Float, linesep='\n', - rowsize=10000, missing=0): - """Return an array or arrays from ascii_formatted data in |fileobject|. - - Inputs: - - fileobject -- An open file object or a string for a valid filename. - The string can be prepended by "~/" or "~/" to - read a file from the home directory. - separator -- a string or a tuple of strings to indicate the column - separators. If the length of the string tuple is less - than the total number of columns, then the last separator - is assumed to be the separator for the rest of the columns. - columns -- a tuple of integers and range-tuples which describe the - columns to read from the file. A negative entry in the - last column specifies the negative skip value to the end. - Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) - will read [1,4,5,6,7,8,11,14,17,19,21,23,...] - If multiple arrays are to be returned, then this argument - should be an ordered list of such tuples. There should be - one entry in the list for each arraytype in the atype list. - lines -- a tuple with the same structure as columns which indicates - the lines to read. - comment -- the comment character (line will be ignored even if it is - specified by the lines tuple) - linesep -- separator between rows. - missing -- value to insert in array when conversion to number fails. - atype -- the typecode of the output array. If multiple outputs are - desired, then this should be a list of typecodes. The columns - to fill the array represented by the given typecode is - determined from the columns argument. If the length of atype - does not match the length of the columns list, then, the - smallest one is expanded to match the largest by repeatedly - copying the last entry. - rowsize -- the allocation row size (array grows by this amount as - data is read in). - - Output -- the 1 or 2d array, or a tuple of output arrays of different - types, sorted in order of the first column to be placed - in the output array. - - """ - - global _not_warned - # Make separator into a tuple of separators. - if type(separator) in [types.StringType, type(default)]: - sep = (separator,) - else: - sep = tuple(separator) - # Create ascii_object from |fileobject| argument. - ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) - columns, atype = convert_to_equal_lists(columns, atype) - numout = len(atype) - # Get the number of columns to read and expand the columns argument - colsize, collist = getcolumns(ascii_object, columns, sep) - # Intialize the output arrays - outrange = range(numout) - outarr = [] - typecodes = "".join(numpy.typecodes.values()) - for k in outrange: - if not atype[k] in typecodes: - raise ValueError, "One of the array types is invalid, k=%d" % k - outarr.append(numpy.zeros((rowsize, colsize[k]),atype[k])) - row = 0 - block_row = 0 - _not_warned = 1 - for line in ascii_object: - if line.strip() == '': - continue - vals = process_line(line, sep, collist, atype, missing) - for k in outrange: - outarr[k][row] = vals[k] - row += 1 - block_row += 1 - if block_row >= rowsize: - for k in outrange: - outarr[k].resize((outarr[k].shape[0] + rowsize,colsize[k])) - block_row = 0 - for k in outrange: - if outarr[k].shape[0] != row: - outarr[k].resize((row,colsize[k])) - a = outarr[k] - if a.shape[0] == 1 or a.shape[1] == 1: - outarr[k] = numpy.ravel(a) - if len(outarr) == 1: - return outarr[0] - else: - return tuple(outarr) - - -# takes 1-d array and returns a string -def str_array(arr, precision=5,col_sep=' ',row_sep="\n",ss=0): - thestr = [] - arr = asarray(arr) - N,M = arr.shape - thistype = arr.dtype.char - nofloat = (thistype in '1silbwu') or (thistype in 'Oc') - cmplx = thistype in 'FD' - fmtstr = "%%.%de" % precision - cmpnum = pow(10.0,-precision) - for n in xrange(N): - theline = [] - for m in xrange(M): - val = arr[n,m] - if ss and abs(val) < cmpnum: - val = 0*val - if nofloat or val==0: - thisval = str(val) - elif cmplx: - rval = real(val) - ival = imag(val) - thisval = eval('fmtstr % rval') - if (ival >= 0): - istr = eval('fmtstr % ival') - thisval = '%s+j%s' % (thisval, istr) - else: - istr = eval('fmtstr % abs(ival)') - thisval = '%s-j%s' % (thisval, istr) - else: - thisval = eval('fmtstr % val') - theline.append(thisval) - strline = col_sep.join(theline) - thestr.append(strline) - return row_sep.join(thestr) - - - at deprecate(message=""" -This function is replaced by numpy.savetxt which allows the same functionality -through a different syntax. -""") -def write_array(fileobject, arr, separator=" ", linesep='\n', - precision=5, suppress_small=0, keep_open=0): - """Write a rank-2 or less array to file represented by fileobject. - - Inputs: - - fileobject -- An open file object or a string to a valid filename. - arr -- The array to write. - separator -- separator to write between elements of the array. - linesep -- separator to write between rows of array - precision -- number of digits after the decimal place to write. - suppress_small -- non-zero to round small numbers down to 0.0 - keep_open = non-zero to return the open file, otherwise, the file is closed. - Outputs: - - file -- The open file (if keep_open is non-zero) - """ - # XXX: What to when appending to files ? 'wa' does not do what one might - # expect, and opening a file twice to create it first is not easily doable - # with get_open_file ? - file = get_open_file(fileobject, mode='w') - rank = numpy.rank(arr) - if rank > 2: - raise ValueError, "Can-only write up to 2-D arrays." - - if rank == 0: - h = 1 - arr = numpy.reshape(arr, (1,1)) - elif rank == 1: - h = numpy.shape(arr)[0] - arr = numpy.reshape(arr, (h,1)) - else: - h = numpy.shape(arr)[0] - arr = asarray(arr) - - for ch in separator: - if ch in '0123456789-+FfeEgGjJIi.': - raise ValueError, "Bad string for separator" - - astr = str_array(arr, precision=precision, - col_sep=separator, row_sep=linesep, - ss = suppress_small) - file.write(astr) - file.write('\n') - if keep_open: - return file - else: - if file is sys.stdout or file is sys.stderr: - return - file.close() - return Modified: trunk/scipy/io/data_store.py =================================================================== --- trunk/scipy/io/data_store.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/data_store.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -15,39 +15,12 @@ 1 """ -__all__ = ['save_as_module', - # The rest of these are all deprecated - 'save', 'create_module', - 'create_shelf', 'load'] +__all__ = ['save_as_module'] import dumb_shelve import os -from numpy import deprecate -def _load(module): - """ Load data into module from a shelf with - the same name as the module. - """ - dir,filename = os.path.split(module.__file__) - filebase = filename.split('.')[0] - fn = os.path.join(dir, filebase) - f = dumb_shelve.open(fn, "r") - #exec( 'import ' + module.__name__) - for i in f.keys(): - exec( 'import ' + module.__name__+ ';' + - module.__name__+'.'+i + '=' + 'f["' + i + '"]') -# print i, 'loaded...' -# print 'done' - -load = deprecate(_load, message=""" -This is an internal function used with scipy.io.save_as_module - -If you are saving arrays into a module, you should think about using -HDF5 or .npz files instead. -""") - - def _create_module(file_name): """ Create the module file. """ @@ -59,13 +32,7 @@ f.write('data_store._load(%s)' % module_name) f.close() -create_module = deprecate(_create_module, message=""" -This is an internal function used with scipy.io.save_as_module -If you are saving arrays into a module, you should think about -using HDF5 or .npz files instead. -""") - def _create_shelf(file_name,data): """Use this to write the data to a new file """ @@ -77,14 +44,7 @@ # print 'done' f.close() -create_shelf = deprecate(_create_shelf, message=""" -This is an internal function used with scipy.io.save_as_module -If you are saving arrays into a module, you should think about using -HDF5 or .npz files instead. -""") - - def save_as_module(file_name=None,data=None): """ Save the dictionary "data" into a module and shelf named save. @@ -100,4 +60,3 @@ _create_module(file_name) _create_shelf(file_name,data) -save = deprecate(save_as_module, old_name='save', new_name='save_as_module') Deleted: trunk/scipy/io/fopen.py =================================================================== --- trunk/scipy/io/fopen.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/fopen.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,356 +0,0 @@ -# Author: Travis Oliphant - -import struct -import sys -import types - -from numpy import * -import numpyio - -import warnings -warnings.warn('fopen module is deprecated, please use npfile instead', - DeprecationWarning, stacklevel=2) - -LittleEndian = (sys.byteorder == 'little') - -__all__ = ['fopen'] - -def getsize_type(mtype): - if mtype in ['B','uchar','byte','unsigned char','integer*1', 'int8']: - mtype = 'B' - elif mtype in ['S1', 'char', 'char*1']: - mtype = 'B' - elif mtype in ['b', 'schar', 'signed char']: - mtype = 'b' - elif mtype in ['h','short','int16','integer*2']: - mtype = 'h' - elif mtype in ['H','ushort','uint16','unsigned short']: - mtype = 'H' - elif mtype in ['i','int']: - mtype = 'i' - elif mtype in ['I','uint','uint32','unsigned int']: - mtype = 'I' - elif mtype in ['u4','int32','integer*4']: - mtype = 'u4' - elif mtype in ['f','float','float32','real*4', 'real']: - mtype = 'f' - elif mtype in ['d','double','float64','real*8', 'double precision']: - mtype = 'd' - elif mtype in ['F','complex float','complex*8','complex64']: - mtype = 'F' - elif mtype in ['D','complex*16','complex128','complex','complex double']: - mtype = 'D' - else: - mtype = obj2sctype(mtype) - - newarr = empty((1,),mtype) - return newarr.itemsize, newarr.dtype.char - -class fopen(object): - """Class for reading and writing binary files into numpy arrays. - - Inputs: - - file_name -- The complete path name to the file to open. - permission -- Open the file with given permissions: ('r', 'H', 'a') - for reading, writing, or appending. This is the same - as the mode argument in the builtin open command. - format -- The byte-ordering of the file: - (['native', 'n'], ['ieee-le', 'l'], ['ieee-be', 'B']) for - native, little-endian, or big-endian respectively. - - Attributes (Read only): - - bs -- non-zero if byte-swapping is performed on read and write. - format -- 'native', 'ieee-le', or 'ieee-be' - closed -- non-zero if the file is closed. - mode -- permissions with which this file was opened - name -- name of the file - """ - -# Methods: -# -# read -- read data from file and return numpy array -# write -- write to file from numpy array -# fort_read -- read Fortran-formatted binary data from the file. -# fort_write -- write Fortran-formatted binary data to the file. -# rewind -- rewind to beginning of file -# size -- get size of file -# seek -- seek to some position in the file -# tell -- return current position in file -# close -- close the file - - def __init__(self,file_name,permission='rb',format='n'): - if 'b' not in permission: permission += 'b' - if isinstance(file_name, basestring): - self.file = file(file_name, permission) - elif isinstance(file_name, file) and not file_name.closed: - # first argument is an open file - self.file = file_name - else: - raise TypeError, 'Need filename or open file as input' - self.setformat(format) - - def __del__(self): - try: - self.file.close() - except: - pass - - def close(self): - self.file.close() - - def seek(self, *args): - self.file.seek(*args) - - def tell(self): - return self.file.tell() - - def raw_read(self, size=-1): - """Read raw bytes from file as string.""" - return self.file.read(size) - - def raw_write(self, str): - """Write string to file as raw bytes.""" - return self.file.write(str) - - def setformat(self, format): - """Set the byte-order of the file.""" - if format in ['native','n','default']: - self.bs = False - self.format = 'native' - elif format in ['ieee-le','l','little-endian','le']: - self.bs = not LittleEndian - self.format = 'ieee-le' - elif format in ['ieee-be','B','big-endian','be']: - self.bs = LittleEndian - self.format = 'ieee-be' - else: - raise ValueError, "Unrecognized format: " + format - return - - def write(self,data,mtype=None,bs=None): - """Write to open file object the flattened numpy array data. - - Inputs: - - data -- the numpy array to write. - mtype -- a string indicating the binary type to write. - The default is the type of data. If necessary a cast is made. - unsigned byte : 'B', 'uchar', 'byte' 'unsigned char', 'int8', - 'integer*1' - character : 'S1', 'char', 'char*1' - signed char : 'b', 'schar', 'signed char' - short : 'h', 'short', 'int16', 'integer*2' - unsigned short : 'H', 'ushort','uint16','unsigned short' - int : 'i', 'int' - unsigned int : 'I', 'uint32','uint','unsigned int' - int32 : 'u4', 'int32', 'integer*4' - float : 'f', 'float', 'float32', 'real*4' - double : 'd', 'double', 'float64', 'real*8' - complex float : 'F', 'complex float', 'complex*8', 'complex64' - complex double : 'D', 'complex', 'complex double', 'complex*16', - 'complex128' - """ - if bs is None: - bs = self.bs - else: - bs = (bs == 1) - if isinstance(data, str): - N, buf = len(data), buffer(data) - data = ndarray(shape=(N,),dtype='B',buffer=buf) - else: - data = asarray(data) - if mtype is None: - mtype = data.dtype.char - howmany,mtype = getsize_type(mtype) - count = product(data.shape,axis=0) - numpyio.fwrite(self.file,count,data,mtype,bs) - return - - fwrite = write - - def read(self,count,stype,rtype=None,bs=None,c_is_b=0): - """Read data from file and return it in a numpy array. - - Inputs: - - count -- an integer specifying the number of elements of type - stype to read or a tuple indicating the shape of - the output array. - stype -- The data type of the stored data (see fwrite method). - rtype -- The type of the output array. Same as stype if None. - bs -- Whether or not to byteswap (or use self.bs if None) - c_is_b --- If non-zero then the count is an integer - specifying the total number of bytes to read - (must be a multiple of the size of stype). - - Outputs: (output,) - - output -- a numpy array of type rtype. - """ - if bs is None: - bs = self.bs - else: - bs = (bs == 1) - howmany,stype = getsize_type(stype) - shape = None - if c_is_b: - if count % howmany != 0: - raise ValueError, "When c_is_b is non-zero then " \ - "count is bytes\nand must be multiple of basic size." - count = count / howmany - elif type(count) in [types.TupleType, types.ListType]: - shape = list(count) - # allow -1 to specify unknown dimension size as in reshape - minus_ones = shape.count(-1) - if minus_ones == 0: - count = product(shape,axis=0) - elif minus_ones == 1: - now = self.tell() - self.seek(0,2) - end = self.tell() - self.seek(now) - remaining_bytes = end - now - know_dimensions_size = -product(count,axis=0) * getsize_type(stype)[0] - unknown_dimension_size, illegal = divmod(remaining_bytes, - know_dimensions_size) - if illegal: - raise ValueError("unknown dimension doesn't match filesize") - shape[shape.index(-1)] = unknown_dimension_size - count = product(shape,axis=0) - else: - raise ValueError( - "illegal count; can only specify one unknown dimension") - shape = tuple(shape) - if rtype is None: - rtype = stype - else: - howmany,rtype = getsize_type(rtype) - if count == 0: - return zeros(0,rtype) - retval = numpyio.fread(self.file, count, stype, rtype, bs) - if shape is not None: - retval = resize(retval, shape) - return retval - - fread = read - - def rewind(self,howmany=None): - """Rewind a file to its beginning or by a specified amount. - """ - if howmany is None: - self.seek(0) - else: - self.seek(-howmany,1) - - def size(self): - """Return the size of the file. - """ - try: - sz = self.thesize - except AttributeError: - curpos = self.tell() - self.seek(0,2) - sz = self.tell() - self.seek(curpos) - self.thesize = sz - return sz - - def fort_write(self,fmt,*args): - """Write a Fortran binary record. - - Inputs: - - fmt -- If a string then it represents the same format string as - used by struct.pack. The remaining arguments are passed - to struct.pack. - - If fmt is an array, then this array will be written as - a Fortran record using the output type args[0]. - - *args -- Arguments representing data to write. - """ - if self.format == 'ieee-le': - nfmt = " 0: - sz,mtype = getsize_type(args[0]) - else: - sz,mtype = getsize_type(fmt.dtype.char) - count = product(fmt.shape,axis=0) - strlen = struct.pack(nfmt,count*sz) - self.write(strlen) - numpyio.fwrite(self.file,count,fmt,mtype,self.bs) - self.write(strlen) - else: - raise TypeError, "Unknown type in first argument" - - def fort_read(self,fmt,dtype=None): - """Read a Fortran binary record. - - Inputs: - - fmt -- If dtype is not given this represents a struct.pack - format string to interpret the next record. Otherwise this - argument is ignored. - dtype -- If dtype is not None, then read in the next record as - an array of type dtype. - - Outputs: (data,) - - data -- If dtype is None, then data is a tuple containing the output - of struct.unpack on the next Fortan record. - If dtype is a datatype string, then the next record is - read in as a 1-D array of type datatype. - """ - lookup_dict = {'ieee-le':"<",'ieee-be':">",'native':''} - if dtype is None: - fmt = lookup_dict[self.format] + fmt - numbytes = struct.calcsize(fmt) - nn = struct.calcsize("i"); - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - strdata = self.raw_read(numbytes) - if strdata == '': - raise ValueError, "Unexpected end of file..." - data = struct.unpack(fmt,strdata) - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - return data - else: # Ignore format string and read in next record as an array. - fmt = lookup_dict[self.format] + "i" - nn = struct.calcsize(fmt) - nbytestr = self.raw_read(nn) - if nbytestr == '': - raise ValueError, "Unexpected end of file..." - nbytes = struct.unpack(fmt,nbytestr)[0] - howmany, dtype = getsize_type(dtype) - ncount = nbytes / howmany - if ncount*howmany != nbytes: - self.rewind(4) - raise ValueError, "A mismatch between the type requested and the data stored." - if ncount < 0: - raise ValueError, "Negative number of bytes to read:\n file is probably not opened with correct endian-ness." - if ncount == 0: - raise ValueError, "End of file? Zero-bytes to read." - retval = numpyio.fread(self.file, ncount, dtype, dtype, self.bs) - if len(retval) == 1: - retval = retval[0] - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - return retval Deleted: trunk/scipy/io/npfile.py =================================================================== --- trunk/scipy/io/npfile.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/npfile.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,232 +0,0 @@ -# Authors: Matthew Brett, Travis Oliphant - -""" -Class for reading and writing numpy arrays from / to binary files -""" - -import sys - -import numpy as np - -__all__ = ['sys_endian_code', 'npfile'] - -sys_endian_code = (sys.byteorder == 'little') and '<' or '>' - -class npfile(object): - ''' Class for reading and writing numpy arrays to/from files - - Inputs: - file_name -- The complete path name to the file to open - or an open file-like object - permission -- Open the file with given permissions: ('r', 'w', 'a') - for reading, writing, or appending. This is the same - as the mode argument in the builtin open command. - format -- The byte-ordering of the file: - (['native', 'n'], ['ieee-le', 'l'], ['ieee-be', 'B']) for - native, little-endian, or big-endian respectively. - - Attributes: - endian -- default endian code for reading / writing - order -- default order for reading writing ('C' or 'F') - file -- file object containing read / written data - - Methods: - seek, tell, close -- as for file objects - rewind -- set read position to beginning of file - read_raw -- read string data from file (read method of file) - write_raw -- write string data to file (write method of file) - read_array -- read numpy array from binary file data - write_array -- write numpy array contents to binary file - - Example use: - >>> from StringIO import StringIO - >>> import numpy as np - >>> from scipy.io import npfile - >>> arr = np.arange(10).reshape(5,2) - >>> # Make file-like object (could also be file name) - >>> my_file = StringIO() - >>> npf = npfile(my_file) - >>> npf.write_array(arr) - >>> npf.rewind() - >>> npf.read_array((5,2), arr.dtype) - >>> npf.close() - >>> # Or read write in Fortran order, Big endian - >>> # and read back in C, system endian - >>> my_file = StringIO() - >>> npf = npfile(my_file, order='F', endian='>') - >>> npf.write_array(arr) - >>> npf.rewind() - >>> npf.read_array((5,2), arr.dtype) - ''' - - def __init__(self, file_name, - permission='rb', - endian = 'dtype', - order = 'C'): - if 'b' not in permission: permission += 'b' - if isinstance(file_name, basestring): - self.file = file(file_name, permission) - else: - try: - closed = file_name.closed - except AttributeError: - raise TypeError, 'Need filename or file object as input' - if closed: - raise TypeError, 'File object should be open' - self.file = file_name - self.endian = endian - self.order = order - - def get_endian(self): - return self._endian - def set_endian(self, endian_code): - self._endian = self.parse_endian(endian_code) - endian = property(get_endian, set_endian, None, 'get/set endian code') - - def parse_endian(self, endian_code): - ''' Returns valid endian code from wider input options''' - if endian_code in ['native', 'n', 'N','default', '=']: - return sys_endian_code - elif endian_code in ['swapped', 's', 'S']: - return sys_endian_code == '<' and '>' or '<' - elif endian_code in ['ieee-le','l','L','little-endian', - 'little','le','<']: - return '<' - elif endian_code in ['ieee-be','B','b','big-endian', - 'big','be', '>']: - return '>' - elif endian_code == 'dtype': - return 'dtype' - else: - raise ValueError, "Unrecognized endian code: " + endian_code - return - - def __del__(self): - try: - self.file.close() - except: - pass - - def close(self): - self.file.close() - - def seek(self, *args): - self.file.seek(*args) - - def tell(self): - return self.file.tell() - - def rewind(self,howmany=None): - """Rewind a file to its beginning or by a specified amount. - """ - if howmany is None: - self.seek(0) - else: - self.seek(-howmany,1) - - def read_raw(self, size=-1): - """Read raw bytes from file as string.""" - return self.file.read(size) - - def write_raw(self, str): - """Write string to file as raw bytes.""" - return self.file.write(str) - - def remaining_bytes(self): - cur_pos = self.tell() - self.seek(0, 2) - end_pos = self.tell() - self.seek(cur_pos) - return end_pos - cur_pos - - def _endian_order(self, endian, order): - ''' Housekeeping function to return endian, order from input args ''' - if endian is None: - endian = self.endian - else: - endian = self.parse_endian(endian) - if order is None: - order = self.order - return endian, order - - def _endian_from_dtype(self, dt): - dt_endian = dt.byteorder - if dt_endian == '=': - dt_endian = sys_endian_code - return dt_endian - - def write_array(self, data, endian=None, order=None): - ''' Write to open file object the flattened numpy array data - - Inputs - data - numpy array or object convertable to array - endian - endianness of written data - (can be None, 'dtype', '<', '>') - (if None, get from self.endian) - order - order of array to write (C, F) - (if None from self.order) - ''' - endian, order = self._endian_order(endian, order) - data = np.asarray(data) - dt_endian = self._endian_from_dtype(data.dtype) - if not endian == 'dtype': - if dt_endian != endian: - data = data.byteswap() - self.file.write(data.tostring(order=order)) - - def read_array(self, dt, shape=-1, endian=None, order=None): - '''Read data from file and return it in a numpy array. - - Inputs - ------ - dt - dtype of array to be read - shape - shape of output array, or number of elements - (-1 as number of elements or element in shape - means unknown dimension as in reshape; size - of array calculated from remaining bytes in file) - endian - endianness of data in file - (can be None, 'dtype', '<', '>') - (if None, get from self.endian) - order - order of array in file (C, F) - (if None get from self.order) - - Outputs - arr - array from file with given dtype (dt) - ''' - endian, order = self._endian_order(endian, order) - dt = np.dtype(dt) - try: - shape = list(shape) - except TypeError: - shape = [shape] - minus_ones = shape.count(-1) - if minus_ones == 0: - pass - elif minus_ones == 1: - known_dimensions_size = -np.product(shape,axis=0) * dt.itemsize - unknown_dimension_size, illegal = divmod(self.remaining_bytes(), - known_dimensions_size) - if illegal: - raise ValueError("unknown dimension doesn't match filesize") - shape[shape.index(-1)] = unknown_dimension_size - else: - raise ValueError( - "illegal -1 count; can only specify one unknown dimension") - sz = dt.itemsize * np.product(shape) - dt_endian = self._endian_from_dtype(dt) - buf = self.file.read(sz) - arr = np.ndarray(shape=shape, - dtype=dt, - buffer=buf, - order=order) - if (not endian == 'dtype') and (dt_endian != endian): - return arr.byteswap() - return arr.copy() - -npfile = np.deprecate(npfile, message=""" -You can achieve the same effect as using npfile using numpy.save and -numpy.load. - -You can use memory-mapped arrays and data-types to map out a -file format for direct manipulation in NumPy. -""") Deleted: trunk/scipy/io/pickler.py =================================================================== --- trunk/scipy/io/pickler.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/pickler.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,38 +0,0 @@ -import cPickle - -from numpy import deprecate - - at deprecate(message=""" -Just use cPickle.dump directly or numpy.savez -""") -def objsave(file, allglobals, *args): - """Pickle the part of a dictionary containing the argument list - into file string. - - Syntax: objsave(file, globals(), obj1, obj2, ... ) - """ - fid = open(file,'w') - savedict = {} - for key in allglobals.keys(): - inarglist = 0 - for obj in args: - if allglobals[key] is obj: - inarglist = 1 - break - if inarglist: - savedict[key] = obj - cPickle.dump(savedict,fid,1) - fid.close() - - at deprecate(message=""" -Just use cPickle.load or numpy.load. -""") -def objload(file, allglobals): - """Load a previously pickled dictionary and insert into given dictionary. - - Syntax: objload(file, globals()) - """ - fid = open(file,'r') - savedict = cPickle.load(fid) - allglobals.update(savedict) - fid.close() Deleted: trunk/scipy/io/tests/test_array_import.py =================================================================== --- trunk/scipy/io/tests/test_array_import.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/tests/test_array_import.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -# This python script tests the numpyio module. -# also check out numpyio.fread.__doc__ and other method docstrings. - -import os -from numpy.testing import * -import scipy.io as io -from scipy.io import numpyio -from scipy.io import array_import - -import numpy.oldnumeric as N -import tempfile - -class TestNumpyio(TestCase): - def test_basic(self): - # Generate some data - a = 255*rand(20) - # Open a file - fname = tempfile.mktemp('.dat') - fid = open(fname,"wb") - # Write the data as shorts - numpyio.fwrite(fid,20,a,N.Int16) - fid.close() - # Reopen the file and read in data - fid = open(fname,"rb") - if verbose >= 3: - print "\nDon't worry about a warning regarding the number of bytes read." - b = numpyio.fread(fid,1000000,N.Int16,N.Int) - fid.close() - assert(N.product(a.astype(N.Int16) == b,axis=0)) - os.remove(fname) - -class TestReadArray(TestCase): - def test_complex(self): - a = rand(13,4) + 1j*rand(13,4) - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname,atype=N.Complex) - assert_array_almost_equal(a,b,decimal=4) - os.remove(fname) - - def test_float(self): - a = rand(3,4)*30 - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname) - assert_array_almost_equal(a,b,decimal=4) - os.remove(fname) - - def test_integer(self): - from scipy import stats - a = stats.randint.rvs(1,20,size=(3,4)) - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname,atype=a.dtype.char) - assert_array_equal(a,b) - os.remove(fname) - -class TestRegression(TestCase): - def test_get_open_file_works_with_filelike_objects(self): - f = tempfile.TemporaryFile() - f2 = array_import.get_open_file(f) - assert f2 is f - f.close() - -if __name__ == "__main__": - run_module_suite() Deleted: trunk/scipy/io/tests/test_npfile.py =================================================================== --- trunk/scipy/io/tests/test_npfile.py 2010-06-17 21:40:33 UTC (rev 6522) +++ trunk/scipy/io/tests/test_npfile.py 2010-06-18 13:02:16 UTC (rev 6523) @@ -1,105 +0,0 @@ -import os -from StringIO import StringIO -from tempfile import mkstemp -from numpy.testing import * -import numpy as np - -from scipy.io.npfile import npfile, sys_endian_code - -class TestNpFile(TestCase): - - def test_init(self): - fd, fname = mkstemp() - os.close(fd) - npf = npfile(fname) - arr = np.reshape(np.arange(10), (5,2)) - self.assertRaises(IOError, npf.write_array, arr) - npf.close() - npf = npfile(fname, 'w') - npf.write_array(arr) - npf.rewind() - self.assertRaises(IOError, npf.read_array, - arr.dtype, arr.shape) - npf.close() - os.remove(fname) - - npf = npfile(StringIO(), endian='>', order='F') - assert npf.endian == '>', 'Endian not set correctly' - assert npf.order == 'F', 'Order not set correctly' - npf.endian = '<' - assert npf.endian == '<', 'Endian not set correctly' - - def test_parse_endian(self): - npf = npfile(StringIO()) - swapped_code = sys_endian_code == '<' and '>' or '<' - assert npf.parse_endian('native') == sys_endian_code - assert npf.parse_endian('swapped') == swapped_code - assert npf.parse_endian('l') == '<' - assert npf.parse_endian('B') == '>' - assert npf.parse_endian('dtype') == 'dtype' - self.assertRaises(ValueError, npf.parse_endian, 'nonsense') - - def test_read_write_raw(self): - npf = npfile(StringIO()) - str = 'test me with this string' - npf.write_raw(str) - npf.rewind() - assert str == npf.read_raw(len(str)) - - def test_remaining_bytes(self): - npf = npfile(StringIO()) - assert npf.remaining_bytes() == 0 - npf.write_raw('+' * 10) - assert npf.remaining_bytes() == 0 - npf.rewind() - assert npf.remaining_bytes() == 10 - npf.seek(5) - assert npf.remaining_bytes() == 5 - - def test_read_write_array(self): - npf = npfile(StringIO()) - arr = np.reshape(np.arange(10), (5,2)) - # Arr as read in fortran order - f_arr = arr.reshape((2,5)).T - # Arr written in fortran order read in C order - cf_arr = arr.T.reshape((5,2)) - # Byteswapped array - bo = arr.dtype.byteorder - swapped_code = sys_endian_code == '<' and '>' or '<' - if bo in ['=', sys_endian_code]: - nbo = swapped_code - else: - nbo = sys_endian_code - bs_arr = arr.newbyteorder(nbo) - adt = arr.dtype - shp = arr.shape - npf.write_array(arr) - npf.rewind() - assert_array_equal(npf.read_array(adt), arr.flatten()) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, endian=swapped_code), - bs_arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, order='F'), - f_arr) - npf.rewind() - npf.write_array(arr, order='F') - npf.rewind() - assert_array_equal(npf.read_array(adt), arr.flatten('F')) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), - cf_arr) - - npf = npfile(StringIO(), endian='swapped', order='F') - npf.write_array(arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, endian='dtype'), bs_arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, order='C'), cf_arr) - -if __name__ == "__main__": - run_module_suite() From scipy-svn at scipy.org Fri Jun 18 09:02:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:02:34 -0500 (CDT) Subject: [Scipy-svn] r6524 - trunk/scipy/io Message-ID: <20100618130234.D9C6439CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:02:34 -0500 (Fri, 18 Jun 2010) New Revision: 6524 Removed: trunk/scipy/io/numpyiomodule.c Modified: trunk/scipy/io/__init__.py trunk/scipy/io/setup.py Log: Remove deprecated objects in scipy.io on the C level. Modified: trunk/scipy/io/__init__.py =================================================================== --- trunk/scipy/io/__init__.py 2010-06-18 13:02:16 UTC (rev 6523) +++ trunk/scipy/io/__init__.py 2010-06-18 13:02:34 UTC (rev 6524) @@ -7,65 +7,6 @@ from numpy import deprecate -from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ - convert_objectarray - -fread = deprecate(fread, message=""" -scipy.io.fread can be replaced with NumPy I/O routines such as -np.load, np.fromfile as well as NumPy's memory-mapping capabilities. -""") - -fwrite = deprecate(fwrite, message=""" -scipy.io.fwrite can be replaced with NumPy I/O routines such as np.save, -np.savez and x.tofile. Also, files can be directly memory-mapped into NumPy -arrays which is often a better way of reading large files. -""") - -bswap = deprecate(bswap, message=""" -scipy.io.bswap can be replaced with the byteswap method on an array. -out = scipy.io.bswap(arr) --> out = arr.byteswap(True) -""") - -packbits = deprecate(packbits, message=""" -The functionality of scipy.io.packbits is now available as numpy.packbits -The calling convention is a bit different, as the 2-d case is no -longer specialized. - -However, you can simulate scipy.packbits by raveling the last 2 dimensions -of the array and calling numpy.packbits with an axis=-1 keyword: - -def scipy_packbits(inp): - a = np.asarray(inp) - if a.ndim < 2: - return np.packbits(a) - oldshape = a.shape - newshape = oldshape[:-2] + (oldshape[-2]*oldshape[-1],) - a = np.reshape(a, newshape) - return np.packbits(a, axis=-1).ravel() -""") - -unpackbits = deprecate(unpackbits, message=""" -The functionality of scipy.io.unpackbits is now available in numpy.unpackbits -The calling convention is different, however, as the 2-d case is no longer -specialized. - -Thus, the scipy.unpackbits behavior must be simulated using numpy.unpackbits. - -def scipy_unpackbits(inp, els_per_slice, out_type=None): - inp = np.asarray(inp) - num4els = ((els_per_slice-1) >> 3) + 1 - inp = np.reshape(inp, (-1,num4els)) - res = np.unpackbits(inp, axis=-1)[:,:els_per_slice] - return res.ravel() -""") - -convert_objectarray = deprecate(convert_objectarray, message=""" -The same functionality can be obtained using NumPy string arrays and the -.astype method (except for the optional missing value feature). -""") - -# end deprecated - # matfile read and write from matlab.mio import loadmat, savemat Deleted: trunk/scipy/io/numpyiomodule.c =================================================================== --- trunk/scipy/io/numpyiomodule.c 2010-06-18 13:02:16 UTC (rev 6523) +++ trunk/scipy/io/numpyiomodule.c 2010-06-18 13:02:34 UTC (rev 6524) @@ -1,1011 +0,0 @@ -/* numpyio.c -- Version 0.9.9 - * - * Author: Travis E. Oliphant - * Date : March 1999 - * - * This file is a module for python that defines basically two functions for - * reading from and writing to a binary file. It also has some functions - * for byteswapping data and packing and unpacking bits. - * - * The data goes into a NumPy array object (multiarray) - * - * It is basically an implemetation of read and write with the data - * going directly into a NumPy array - * - * Permission is granted to use this program however you see fit, but I give - * no guarantees as to its usefulness or reliability. You assume full - * responsibility for using this program. - * - * Thanks to Michael A. Miller - * whose TableIO packages helped me learn how - * to write an extension package. I've adapted his Makefile as well. - */ - -#include "Python.h" /* Python header files */ -#include "numpy/arrayobject.h" -/* #include */ -#include - -void rbo(char *, int, int); -void packbits(char *, int, char *, int, int); -void unpackbits(char *, int, char *, int, int, int); -int is_little_endian(void); - -static PyObject *ErrorObject; /* locally-raised exception */ - -#define PYERR(message) do {PyErr_SetString(PyExc_ValueError, message); goto fail;} while(0) -#define DATA(arr) ((arr)->data) -#define DIMS(arr) ((arr)->dimensions) -#define STRIDES(arr) ((arr)->strides) -#define ELSIZE(arr) ((arr)->descr->elsize) -#define OBJECTTYPE(arr) ((arr)->descr->type_num) -#define BASEOBJ(arr) ((PyArrayObject *)((arr)->base)) -#define RANK(arr) ((arr)->nd) -#define ISCONTIGUOUS(m) ((m)->flags & NPY_CONTIGUOUS) - -#define PYSETERROR(message) \ -{ PyErr_SetString(ErrorObject, message); goto fail; } - -#define INCREMENT(ret_ind, nd, max_ind) \ -{ \ - int k; \ - k = (nd) - 1; \ - if (++(ret_ind)[k] >= (max_ind)[k]) { \ - while (k >= 0 && ((ret_ind)[k] >= (max_ind)[k]-1)) \ - (ret_ind)[k--] = 0; \ - if (k >= 0) (ret_ind)[k]++; \ - else (ret_ind)[0] = (max_ind)[0]; \ - } \ -} - -#define CALCINDEX(indx, nd_index, strides, ndim) \ -{ \ - int i; \ - \ - indx = 0; \ - for (i=0; i < (ndim); i++) \ - indx += nd_index[i]*strides[i]; \ -} - -static PyObject * - numpyio_fromfile(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyObject *file; - PyArrayObject *arr=NULL; - PyArray_Descr *indescr=NULL; - void *ibuff=NULL; - int myelsize; - int ibuff_cleared = 1; - long n,nread; - char read_type; - FILE *fp; - char dobyteswap = 0; - int swap_factor; - char out_type = 124; /* set to unused value */ - PyArray_VectorUnaryFunc *castfunc; - - if (!PyArg_ParseTuple( args, "Olc|cb" , &file, &n, &read_type, &out_type, &dobyteswap )) - return NULL; - - if (out_type == 124) - out_type = read_type; - - fp = PyFile_AsFile(file); - - if (fp == NULL) { - PYSETERROR("First argument must be an open file"); - } - - if (n <= 0) { - PYSETERROR("Second argument (number of bytes to read) must be positive."); - } - /* Make a 1-D NumPy array of type read_type with n elements */ - - if ((arr = (PyArrayObject *)PyArray_SimpleNew(1,(npy_intp*)&n,out_type)) == NULL) - return NULL; - - if (arr->descr->elsize == 0) { - PYSETERROR("Does not support variable types."); - } - - /* Read the data into the array from the file */ - if (out_type == read_type) { - ibuff = arr -> data; - myelsize = arr -> descr -> elsize; - } - else { /* Alocate a storage buffer for data read in */ - indescr = PyArray_DescrFromType((int ) read_type); - if (indescr == NULL) goto fail; - if (indescr->elsize == 0) { - PYSETERROR("Does not support variable types."); - } - if (PyTypeNum_ISEXTENDED(indescr->type_num)) { - PyErr_SetString(PyExc_ValueError, - "Does not support extended types."); - goto fail; - } - myelsize = indescr -> elsize; - ibuff = malloc(myelsize*n); - castfunc = indescr->f->cast[arr->descr->type_num]; - Py_DECREF(indescr); - indescr=NULL; - if (ibuff == NULL) - PYSETERROR("Could not allocate memory for type casting") - ibuff_cleared = 0; - } - - nread = fread(ibuff,myelsize,n,fp); - if (ferror(fp)) { - clearerr(fp); - PYSETERROR("There was an error reading from the file"); - } - - /* Check to see correct number of bytes were read. If not, then - resize the array to the number of bytes actually read in. - */ - - if (nread < n) { - fprintf(stderr,"Warning: %ld bytes requested, %ld bytes read.\n", n, nread); - arr->dimensions[0] = nread; - arr->data = realloc(arr->data,arr->descr->elsize*nread); - } - - if (dobyteswap) { - swap_factor = ((read_type=='F' || read_type=='D') ? 2 : 1); - rbo(ibuff,myelsize/swap_factor,nread*swap_factor); - } - - if (out_type != read_type) { /* We need to type_cast it */ - castfunc(ibuff, arr->data, nread, NULL, NULL); - free(ibuff); - ibuff_cleared = 1; - } - - return PyArray_Return(arr); - - fail: - Py_XDECREF(indescr); - if (!ibuff_cleared) free(ibuff); - Py_XDECREF(arr); - return NULL; - -} - -static int write_buffered_output(FILE *fp, PyArrayObject *arr, PyArray_Descr* outdescr, char *buffer, int buffer_size, int bswap) { - - /* INITIALIZE N-D index */ - - /* Loop over the N-D index filling the buffer with the data in arr - (indexed correctly using strides) - Each time dimension subdim is about to roll - write the buffer to disk and fill it again. */ - - char *buff_ptr, *output_ptr; - int nwrite, *nd_index, indx; - int buffer_size_bytes, elsize; - - buff_ptr = buffer; - nd_index = (int *)calloc(arr->nd,sizeof(int)); - if (NULL == nd_index) { - PyErr_SetString(ErrorObject,"Could not allocate memory for index array."); - return -1; - } - buffer_size_bytes = buffer_size * arr->descr->elsize; - while(nd_index[0] != arr->dimensions[0]) { - CALCINDEX(indx,nd_index,arr->strides,arr->nd); - memcpy(buff_ptr, arr->data+indx, arr->descr->elsize); - buff_ptr += arr->descr->elsize; - INCREMENT(nd_index,arr->nd,arr->dimensions); - if ((buff_ptr - buffer) >= buffer_size_bytes) { - buff_ptr = buffer; - - if (outdescr->type != arr->descr->type) { /* Cast to new type before writing */ - output_ptr = buffer + buffer_size_bytes; - (arr->descr->f->cast[outdescr->type_num])(buffer,output_ptr,buffer_size,NULL, NULL); - elsize = outdescr->elsize; - } - else { - output_ptr = buffer; - elsize = arr->descr->elsize; - } - if (bswap) { - rbo((char *)output_ptr, elsize, buffer_size); - } - - nwrite = fwrite(output_ptr, elsize, buffer_size, fp); - - if (ferror(fp)) { - clearerr(fp); - PyErr_SetString(ErrorObject,"There was an error writing to the file"); - return -1; - } - if (nwrite < buffer_size) { - fprintf(stderr,"Warning: %d of %d specified bytes written.\n",nwrite, buffer_size); - } - } - - } - return 0; -} - -static PyObject * - numpyio_tofile(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyObject *file; - PyArrayObject *arr = NULL; - PyObject *obj; - PyArray_Descr *outdescr=NULL; - void *obuff = NULL; - long n, k, nwrite, maxN, elsize_bytes; - int myelsize, buffer_size; - FILE *fp; - char *buffer = NULL; - char dobyteswap = 0; - int swap_factor = 1; - char ownalloc = 0; - char write_type = 124; - - if (!PyArg_ParseTuple( args, "OlO|cb" , &file, &n, &obj, &write_type, &dobyteswap)) - return NULL; - - fp = PyFile_AsFile(file); - - if (fp == NULL) { - PYSETERROR("First argument must be an open file"); - } - - if (!PyArray_Check(obj)) { - PYSETERROR("Third argument must be a NumPy array."); - } - - if (PyArray_ISEXTENDED(obj)) { - PYSETERROR("Does not support extended types."); - } - - maxN = PyArray_SIZE((PyArrayObject *)obj); - if (n > maxN) - PYSETERROR("The NumPy array does not have that many elements."); - - if (((PyArrayObject *)obj)->descr->type_num == PyArray_OBJECT) - PYSETERROR("Cannot write an object array."); - - if (!PyArray_ISCONTIGUOUS((PyArrayObject *)obj)) { - arr = (PyArrayObject *)PyArray_CopyFromObject(obj,((PyArrayObject *)obj) -> descr -> type_num, 0, 0); - if (NULL == arr) { /* Memory allocation failed - Write out buffered data using strides info */ - arr = (PyArrayObject *)obj; - Py_INCREF(arr); - if (write_type == 124) - write_type = arr -> descr -> type; - - if (write_type != arr -> descr -> type) { - outdescr = PyArray_DescrFromType((int) write_type); - if (outdescr == NULL) goto fail; - elsize_bytes = (outdescr->elsize + arr->descr->elsize); /* allocate space for buffer and casted buffer */ - } - else { - outdescr = arr->descr; - Py_INCREF(outdescr); - elsize_bytes = (arr->descr->elsize); - } - k = 0; - do { - k++; - buffer_size = PyArray_MultiplyList(arr->dimensions + k, arr->nd - k); - buffer = (char *)malloc(elsize_bytes*buffer_size); - } - while ((NULL == buffer) && (k < arr->nd - 1)); - - if (NULL == buffer) /* Still NULL no size was small enough */ - PYSETERROR("Could not allocate memory for any attempted output buffer size."); - - /* Write a buffered output */ - - if (write_buffered_output(fp, (PyArrayObject *)obj, outdescr, buffer, buffer_size, dobyteswap) < 0) { - free(buffer); - goto fail; - } - free(buffer); - Py_DECREF(outdescr); - Py_DECREF(arr); - Py_INCREF(Py_None); - return Py_None; - } - } - else { - arr = (PyArrayObject *)obj; - Py_INCREF(arr); - } - - /* Write the array to file (low-level data transfer) */ - if (n > 0) { - - if (write_type == 124) /* Wasn't specified: use input type */ - write_type = arr -> descr -> type; - - if (write_type == arr -> descr -> type) { /* point output buffer to data */ - obuff = arr -> data; - myelsize = arr -> descr -> elsize; - } - else { - if ((outdescr = PyArray_DescrFromType((int ) write_type)) == NULL) - goto fail; - myelsize = outdescr -> elsize; - obuff = malloc(n*myelsize); - if (obuff == NULL) - PYSETERROR("Could not allocate memory for type-casting"); - ownalloc = 1; - (arr->descr->f->cast[(int)outdescr->type_num])(arr->data,obuff,n,NULL,NULL); - Py_DECREF(outdescr); - outdescr=NULL; - } - /* Write the data from the array to the file */ - if (dobyteswap) { - swap_factor = ((write_type=='F' || write_type=='D') ? 2 : 1); - rbo((char *)obuff,myelsize/swap_factor,n*swap_factor); - } - - nwrite = fwrite(obuff,myelsize,n,fp); - - if (dobyteswap) { /* Swap data in memory back if allocated obuff */ - if (write_type == arr -> descr -> type) /* otherwise we changed obuff only */ - rbo(arr->data,arr->descr->elsize/swap_factor,PyArray_SIZE(arr)*swap_factor); - } - - if (ferror(fp)) { - clearerr(fp); - PYSETERROR("There was an error writing to the file"); - } - if (nwrite < n) { - fprintf(stderr,"Warning: %ld of %ld specified bytes written.\n",nwrite,n); - } - } - - if (ownalloc == 1) { - free(obuff); - } - - Py_DECREF(arr); - Py_INCREF(Py_None); - return Py_None; - - fail: - Py_XDECREF(outdescr); - if (ownalloc == 1) free(obuff); - Py_XDECREF(arr); - return NULL; - -} - -static PyObject * - numpyio_byteswap(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyArrayObject *arr = NULL; - PyObject *obj; - int type; - - if (!PyArg_ParseTuple( args, "O" , &obj)) - return NULL; - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - rbo(arr->data,arr->descr->elsize,PyArray_SIZE(arr)); - - return PyArray_Return(arr); -} - -static PyObject * - numpyio_pack(PyObject *self, PyObject *args) /* args: in */ -{ - PyArrayObject *arr = NULL, *out = NULL; - PyObject *obj; - int els_per_slice; - int out_size; - int type; - - if (!PyArg_ParseTuple( args, "O" , &obj)) - return NULL; - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - if (arr->descr->type_num > PyArray_LONG) - PYSETERROR("Expecting an input array of integer type (no floats)."); - - /* Get size information from input array and make a 1-D output array of bytes */ - - els_per_slice = arr->dimensions[arr->nd - 1]; - if (arr->nd > 1) - els_per_slice = els_per_slice * arr->dimensions[arr->nd - 2]; - - out_size = (PyArray_SIZE(arr)/els_per_slice)*ceil ( (float) els_per_slice / 8); - - if ((out = (PyArrayObject *)PyArray_SimpleNew(1,&out_size,PyArray_UBYTE))==NULL) { - goto fail; - } - - packbits(arr->data,arr->descr->elsize,out->data,PyArray_SIZE(arr),els_per_slice); - - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(arr); - return NULL; - -} - -static PyObject * - numpyio_unpack(PyObject *self, PyObject *args) /* args: in, out_type */ -{ - PyArrayObject *arr = NULL, *out=NULL; - PyObject *obj; - int els_per_slice, arrsize; - int out_size, type; - char out_type = 'b'; - - if (!PyArg_ParseTuple( args, "Oi|c" , &obj, &els_per_slice, &out_type)) - return NULL; - - if (els_per_slice < 1) - PYSETERROR("Second argument is elements_per_slice and it must be >= 1."); - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - arrsize = PyArray_SIZE(arr); - - if ((arrsize % (int) (ceil( (float) els_per_slice / 8))) != 0) - PYSETERROR("That cannot be the number of elements per slice for this array size."); - - if (arr->descr->type_num > PyArray_LONG) - PYSETERROR("Can only unpack arrays that are of integer type."); - - /* Make an 1-D output array of type out_type */ - - out_size = els_per_slice * arrsize / ceil( (float) els_per_slice / 8); - - if ((out = (PyArrayObject *)PyArray_SimpleNew(1,&out_size,out_type))==NULL) - goto fail; - - if (out->descr->type_num > PyArray_LONG) { - PYSETERROR("Can only unpack bits into integer type."); - } - - unpackbits(arr->data,arr->descr->elsize,out->data,out->descr->elsize,out_size,els_per_slice); - - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(out); - Py_XDECREF(arr); - return NULL; -} - - -static char fread_doc[] = -"g = numpyio.fread( fid, Num, read_type { mem_type, byteswap})\n\n" -" fid = open file pointer object (i.e. from fid = open('filename') )\n" -" Num = number of elements to read of type read_type\n" -" read_type = a character in 'cb1silfdFD' (PyArray types)\n" -" describing how to interpret bytes on disk.\nOPTIONAL\n" -" mem_type = a character (PyArray type) describing what kind of\n" -" PyArray to return in g. Default = read_type\n" -" byteswap = 0 for no byteswapping or a 1 to byteswap (to handle\n" -" different endianness). Default = 0."; - -static char fwrite_doc[] = -"numpyio.fwrite( fid, Num, myarray { write_type, byteswap} )\n\n" -" fid = open file stream\n" -" Num = number of elements to write\n" -" myarray = NumPy array holding the data to write (will be\n" -" written as if ravel(myarray) was passed)\nOPTIONAL\n" -" write_type = character ('cb1silfdFD') describing how to write the\n" -" data (what datatype to use) Default = type of\n" -" myarray.\n" -" byteswap = 0 or 1 to determine if byteswapping occurs on write.\n" -" Default = 0."; - -static char bswap_doc[] = -" out = numpyio.bswap(myarray)\n\n" -" myarray = an array whose elements you want to byteswap.\n" -" out = a reference to byteswapped myarray.\n\n" -" This does an inplace byte-swap so that myarray is changed in\n" -" memory."; - -static char packbits_doc[] = -"out = numpyio.packbits(myarray)\n\n" -" myarray = an array whose (assumed binary) elements you want to\n" -" pack into bits (must be of integer type, 'cb1sl')\n\n" -" This routine packs the elements of a binary-valued dataset into a\n" -" 1-D NumPy array of type PyArray_UBYTE ('b') whose bits correspond to\n" -" the logical (0 or nonzero) value of the input elements. \n\n" -" If myarray has more dimensions than 2 it packs each slice (rows*columns)\n" -" separately. The number of elements per slice (rows*columns) is\n" -" important to know to be able to unpack the data later.\n\n" -" Example:\n" -" >>> a = array([[[1,0,1],\n" -" ... [0,1,0]],\n" -" ... [[1,1,0],\n" -" ... [0,0,1]]])\n" -" >>> b = numpyio.packbits(a)\n" -" >>> b\n" -" array([168, 196], 'b')\n\n" -" Note that 168 = 128 + 32 + 8\n" -" 196 = 128 + 64 + 4"; - -static char unpackbits_doc[] = -"out = numpyio.unpackbits(myarray, elements_per_slice {, out_type} )\n\n" -" myarray = Array of integer type ('cb1sl') whose least\n" -" significant byte is a bit-field for the\n" -" resulting output array.\n\n" -" elements_per_slice = Necessary for interpretation of myarray.\n" -" This is how many elements in the\n " -" rows*columns of original packed structure.\n\nOPTIONAL\n" -" out_type = The type of output array to populate with 1's\n" -" and 0's. Must be an integer type.\n\n\nThe output array\n" -" will be a 1-D array of 1's and zero's"; - - -#define BUFSIZE 256 -/* Convert a Python string object to a complex number */ -static int convert_from_object(PyObject *obj, Py_complex *cnum) -{ - PyObject *res=NULL, *elobj=NULL; - PyObject *newstr=NULL, *finalobj=NULL, *valobj=NULL; - char strbuffer[2*BUFSIZE]; - char *xptr, *elptr; - char *newstrbuff, thischar; - char buffer[BUFSIZE]; - char validnum[] = "0123456789.eE+-"; - int validlen = 15; - int inegflag = 1; - int rnegflag = 1; - int n, k, m, i, elN, size, state, count; - double val; - - if (!PyString_Check(obj)) return -1; - - /* strip string */ - newstr = PyObject_CallMethod(obj, "strip", NULL); - if (newstr == NULL) goto fail; - - /* Replace any 'e+' or 'e-' */ - size = PyString_GET_SIZE(newstr); - newstrbuff = PyString_AsString(newstr); - if (newstrbuff == NULL) goto fail; - if (size > 2*BUFSIZE) PYERR("String too large."); - - state = 0; - count = 0; - for (k=0; k BUFSIZE)) - PYSETERROR("String too large."); - - /* Replace back the + and - and strip away invalid characters */ - elptr = PyString_AsString(elobj); - m = 0; - for (n=0; n < elN; n++) { - thischar = elptr[n]; - if (thischar == '\254') - buffer[m++] = '+'; - else if (thischar == '\253') - buffer[m++] = '-'; - else { - for (i=0; i< validlen; i++) { - if (thischar == validnum[i]) break; - } - if (i < validlen) buffer[m++] = thischar; - } - } - finalobj = PyString_FromStringAndSize(buffer, m); - if (finalobj == NULL) goto fail; - valobj = PyFloat_FromString(finalobj, NULL); /* Try to make a float */ - if (valobj == NULL) goto fail; - val = PyFloat_AsDouble(valobj); - if (PyErr_Occurred()) goto fail; - Py_DECREF(finalobj); - Py_DECREF(valobj); - Py_DECREF(elobj); - if (k==0) { - cnum->real = val*rnegflag; - } - else { - cnum->imag = val*inegflag; - } - - } - Py_DECREF(newstr); - Py_DECREF(res); - return 0; - - fail: - Py_XDECREF(res); - Py_XDECREF(elobj); - Py_XDECREF(newstr); - Py_XDECREF(finalobj); - Py_XDECREF(valobj); - return -1; -} - - - -static int PyTypeFromChar(char ctype) -{ - switch(ctype) { - case 'c': return PyArray_CHAR; - case 'b': return PyArray_UBYTE; - case '1': return PyArray_BYTE; - case 's': return PyArray_SHORT; - case 'i': return PyArray_INT; -#ifdef PyArray_UNSIGNED_TYPES - case 'u': return PyArray_UINT; - case 'w': return PyArray_USHORT; -#endif - case 'l': return PyArray_LONG; - case 'f': return PyArray_FLOAT; - case 'd': return PyArray_DOUBLE; - case 'F': return PyArray_CFLOAT; - case 'D': return PyArray_CDOUBLE; - case 'O': return PyArray_OBJECT; - } - return PyArray_NOTYPE; -} - - -static PyObject * - numpyio_convert_objects(PyObject *self, PyObject *args) -{ - PyObject *obj = NULL, *missing_val = NULL; - PyArrayObject *arr = NULL, *out=NULL; - PyArrayObject *missing_arr = NULL; - PyArray_Descr *descr; - PyObject *builtins, *dict; - char out_type; - int int_type, i, err; - char *outptr; - PyObject **arrptr; - PyObject *numobj=NULL; - PyObject *comp_obj; - Py_complex numc; - PyArray_VectorUnaryFunc *funcptr; - - if (!PyArg_ParseTuple( args, "Oc|O" , &obj, &out_type, &missing_val)) - return NULL; - - if (missing_val == NULL) { - missing_val = PyInt_FromLong(0); - } - else { - Py_INCREF(missing_val); /* Increment missing_val for later DECREF */ - } - - int_type = PyTypeFromChar(out_type); - if ((int_type == PyArray_NOTYPE) || (int_type == PyArray_OBJECT) || \ - PyTypeNum_ISEXTENDED(int_type)) - PYERR("Invalid output type."); - - missing_arr = (PyArrayObject *)PyArray_ContiguousFromObject(missing_val, - int_type, 0, 0); - Py_DECREF(missing_val); - missing_val = NULL; /* So later later failures don't decrement it */ - - if ((missing_arr == NULL)) goto fail; - if ((RANK(missing_arr) > 0)) PYERR("Missing value must be as scalar"); - - arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj, PyArray_OBJECT, - 0, 0); - if (arr == NULL) goto fail; - - out = (PyArrayObject *)PyArray_SimpleNew(RANK(arr), DIMS(arr), int_type); - if (out == NULL) goto fail; - - /* Get the builtin_functions from the builtin module */ - builtins = PyImport_AddModule("__builtin__"); - if (builtins == NULL) goto fail; - - dict = PyModule_GetDict(builtins); - comp_obj = PyDict_GetItemString(dict, "complex"); - if (comp_obj == NULL) goto fail; - - /* get_complex = PyDict_GetItemString(dict, "complex"); - get_float = PyDict_GetItemString(dict, "float"); - get_int = PyDict_GetItemString(dict, "int"); - if ((get_complex == NULL) || (get_float == NULL) || (get_int == NULL) ) goto fail; - */ - /* - get_complex_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "complex")); - get_float_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "float")); - get_int_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "int")); - */ - - /* Loop through arr and convert each element and place in out */ - i = PyArray_Size((PyObject *)arr); - arrptr = ((PyObject **)DATA(arr)) - 1; - outptr = (DATA(out)) - ELSIZE(out); - - descr = PyArray_DescrFromType(PyArray_CDOUBLE); - funcptr = descr->f->cast[int_type]; - Py_DECREF(descr); - - while (i--) { - outptr += ELSIZE(out); - arrptr += 1; - numc.real = 0; - numc.imag = 0; - numobj = PyObject_CallFunction(comp_obj, "O", *arrptr); - if (numobj != NULL) { - numc = PyComplex_AsCComplex(numobj); - Py_DECREF(numobj); - } - if (PyErr_Occurred()) { /* Use our own homegrown converter... */ - PyErr_Clear(); - err = convert_from_object(*arrptr, &numc); - if (PyErr_Occurred()) PyErr_Clear(); - if (err < 0) { /* Nothing works fill with missing value... */ - memcpy(outptr, DATA(missing_arr), ELSIZE(out)); - } - } - /* Place numc into the array */ - funcptr((void *)&(numc.real), (void *)outptr, 1, NULL, NULL); - } - - Py_DECREF(missing_arr); - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(out); - Py_XDECREF(arr); - Py_XDECREF(missing_arr); - Py_XDECREF(missing_val); - return NULL; -} - - -static char convert_objects_doc[] = -"convert_objectarray(myarray, arraytype{, missing_value} ) -> out \n\n" -" myarray = Sequence of strings.\n" -" arraytype = Type of output array.\n" -" missing_value = Value to insert when conversion fails."; - -/* *************************************************************************** */ -/* Method registration table: name-string -> function-pointer */ - -static struct PyMethodDef numpyio_methods[] = { - {"fread", numpyio_fromfile, 1, fread_doc}, - {"fwrite", numpyio_tofile, 1, fwrite_doc}, - {"bswap", numpyio_byteswap, 1, bswap_doc}, - {"packbits", numpyio_pack, 1, packbits_doc}, - {"unpackbits", numpyio_unpack, 1, unpackbits_doc}, - {"convert_objectarray", numpyio_convert_objects, 1, convert_objects_doc}, - {NULL, NULL} -}; - -PyMODINIT_FUNC initnumpyio(void) -{ - PyObject *m, *d; - - import_array(); /* allows multiarray to be a shared library (I think) */ - /* Should be defined in arrayobject.h */ - - /* create the module and add the functions */ - m = Py_InitModule("numpyio", numpyio_methods); /* registration hook */ - - /* add symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = Py_BuildValue("s", "numpyio.error"); /* export exception */ - PyDict_SetItemString(d, "error", ErrorObject); /* add more if need */ - -} - -/**********************************************************/ -/* */ -/* SYNOPSIS: rbo(data, bpe, nel) ; */ -/* where: */ -/* nel..... number of array elements */ -/* data.... pointer to the first byte in the */ -/* array */ -/* bpe..... bytes per array element */ -/* */ -/* PURPOSE: convert data from little to big endian (and */ -/* visa-versa) */ -/* */ -/**********************************************************/ - -void rbo(char * data, int bpe, int nel) -{ - int nswaps, i,j; /* number of swaps to make per element */ - char tmp; /* temporary storage for swapping */ - long int p1, p2; /* indexes for elements to be swapped */ - - nswaps = bpe / 2; /* divide element size by two */ - if (nswaps == 0) return; /* return if it is a byte array */ - - p1 = 0; - for ( i=0; i 0); /* add to this bit if the input value is non-zero */ - } - if (index == out_bytes - 1) build <<= (8-remain); - /* printf("Here: %d %d %d %d\n",build,slice,index,maxi); - */ - *(outptr++) = build; - } - } - return; -} - - -void unpackbits( - char In[], - int in_element_size, - char Out[], - int element_size, - int total_elements, - int els_per_slice - ) -{ - unsigned char mask; - int i,index,slice,slices,out_bytes; - int maxi, remain; - char *outptr,*inptr; - - outptr = Out; - inptr = In; - if (is_little_endian()) { - fprintf(stderr,"This is a little-endian machine.\n"); - } - else { - fprintf(stderr,"This is a big-endian machine.\n"); - outptr += (element_size - 1); - inptr += (in_element_size - 1); - } - slices = total_elements / els_per_slice; - out_bytes = ceil( (float) els_per_slice / 8); - remain = els_per_slice % 8; - if (remain == 0) remain = 8; - /* printf("Start: %d %d %d %d %d\n",inM,MN,slices,out_bytes,remain); - */ - for (slice = 0; slice < slices; slice++) { - for (index = 0; index < out_bytes; index++) { - maxi = (index != out_bytes - 1 ? 8 : remain); - mask = 128; - for (i = 0; i < maxi ; i++) { - *outptr = ((mask & (unsigned char)(*inptr)) > 0); - outptr += element_size; - mask >>= 1; - } - /* printf("Here: %d %d %d %d\n",build,slice,index,maxi); - */ - inptr += in_element_size; - } - } - return; -} - -int is_little_endian() -{ /* high low */ - short testnum = 1; /* If little endian it will be 0x00 0x01 */ - /* If big endian it will be 0x01 0x00 */ - void *testptr; - char *myptr; - - testptr = (void *)(&testnum); /* Assumes address gives low-byte in memory */ - myptr = (char*)testptr; - - return (*(myptr) == 1); - -} - - Modified: trunk/scipy/io/setup.py =================================================================== --- trunk/scipy/io/setup.py 2010-06-18 13:02:16 UTC (rev 6523) +++ trunk/scipy/io/setup.py 2010-06-18 13:02:34 UTC (rev 6524) @@ -4,9 +4,6 @@ from numpy.distutils.misc_util import Configuration config = Configuration('io', parent_package, top_path) - config.add_extension('numpyio', - sources = ['numpyiomodule.c']) - config.add_data_dir('tests') config.add_data_dir('examples') config.add_data_dir('docs') From scipy-svn at scipy.org Fri Jun 18 09:03:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:03:03 -0500 (CDT) Subject: [Scipy-svn] r6525 - in trunk/scipy/io: . examples Message-ID: <20100618130303.55ADA39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:03:03 -0500 (Fri, 18 Jun 2010) New Revision: 6525 Removed: trunk/scipy/io/examples/read_array_demo1.py trunk/scipy/io/examples/test.txt Modified: trunk/scipy/io/setup.py trunk/scipy/io/setupscons.py Log: Remove example using removed functions from scipy.io. Deleted: trunk/scipy/io/examples/read_array_demo1.py =================================================================== --- trunk/scipy/io/examples/read_array_demo1.py 2010-06-18 13:02:34 UTC (rev 6524) +++ trunk/scipy/io/examples/read_array_demo1.py 2010-06-18 13:03:03 UTC (rev 6525) @@ -1,58 +0,0 @@ -#========================================================================= -# NAME: read_array_demo1 -# -# DESCRIPTION: Examples to read 2 columns from a multicolumn ascii text -# file, skipping the first line of header. First example reads into -# 2 separate arrays. Second example reads into a single array. Data are -# then plotted. -# -# Here is the format of the file test.txt: -# -------- -# Some header to skip -# 1 2 3 -# 2 4 6 -# 3 6 9 -# 4 8 12 -# -# USAGE: -# python read_array_demo1.py -# -# PARAMETERS: -# -# DEPENDENCIES: -# matplotlib (pylab) -# test.txt -# -# -# AUTHOR: Simon J. Hook -# DATE : 09/23/2005 -# -# MODIFICATION HISTORY: -# -# COMMENT: -# -#============================================================================ - -from scipy import * -from scipy.io import read_array -from pylab import * - -def main(): - - # First example, read first and second column from ascii file. Skip first - # line of header. - # Note use of (1,-1) in lines to skip first line and then read to end of file - # Note use of (0,) in columns to pick first column, since its a tuple need trailing comma - x=read_array("test.txt",lines=(1,-1), columns=(0,)) - y=read_array("test.txt",lines=(1,-1), columns=(1,)) - - #Second example, read the file into a single arry - z=read_array("test.txt",lines=(1,-1), columns=(0,2)) - - # Plot the data - plot(x,y,'r--',z[:,0],z[:,1]) - show() - -# The one and only main function -if __name__ == "__main__": - main() Deleted: trunk/scipy/io/examples/test.txt =================================================================== --- trunk/scipy/io/examples/test.txt 2010-06-18 13:02:34 UTC (rev 6524) +++ trunk/scipy/io/examples/test.txt 2010-06-18 13:03:03 UTC (rev 6525) @@ -1,5 +0,0 @@ -some header to skip -1 2 3 -2 4 6 -3 6 9 -4 8 12 \ No newline at end of file Modified: trunk/scipy/io/setup.py =================================================================== --- trunk/scipy/io/setup.py 2010-06-18 13:02:34 UTC (rev 6524) +++ trunk/scipy/io/setup.py 2010-06-18 13:03:03 UTC (rev 6525) @@ -5,7 +5,6 @@ config = Configuration('io', parent_package, top_path) config.add_data_dir('tests') - config.add_data_dir('examples') config.add_data_dir('docs') config.add_subpackage('matlab') config.add_subpackage('arff') Modified: trunk/scipy/io/setupscons.py =================================================================== --- trunk/scipy/io/setupscons.py 2010-06-18 13:02:34 UTC (rev 6524) +++ trunk/scipy/io/setupscons.py 2010-06-18 13:03:03 UTC (rev 6525) @@ -7,7 +7,6 @@ config.add_sconscript('SConstruct') config.add_data_dir('tests') - config.add_data_dir('examples') config.add_data_dir('docs') config.add_subpackage('matlab') config.add_subpackage('arff') From scipy-svn at scipy.org Fri Jun 18 09:03:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:03:22 -0500 (CDT) Subject: [Scipy-svn] r6526 - trunk/scipy/io Message-ID: <20100618130322.3A5C139CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:03:21 -0500 (Fri, 18 Jun 2010) New Revision: 6526 Modified: trunk/scipy/io/SConscript Log: Remove numpyiomodule from io SConscript file. Modified: trunk/scipy/io/SConscript =================================================================== --- trunk/scipy/io/SConscript 2010-06-18 13:03:03 UTC (rev 6525) +++ trunk/scipy/io/SConscript 2010-06-18 13:03:21 UTC (rev 6526) @@ -3,5 +3,3 @@ from numscons import GetNumpyEnvironment env = GetNumpyEnvironment(ARGUMENTS) - -env.NumpyPythonExtension('numpyio', source = 'numpyiomodule.c') From scipy-svn at scipy.org Fri Jun 18 09:03:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:03:39 -0500 (CDT) Subject: [Scipy-svn] r6527 - trunk/scipy/io Message-ID: <20100618130339.9ADE039CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:03:39 -0500 (Fri, 18 Jun 2010) New Revision: 6527 Modified: trunk/scipy/io/setupscons.py Log: BUG: Correctly build io.matlab extensions with numscons. Modified: trunk/scipy/io/setupscons.py =================================================================== --- trunk/scipy/io/setupscons.py 2010-06-18 13:03:21 UTC (rev 6526) +++ trunk/scipy/io/setupscons.py 2010-06-18 13:03:39 UTC (rev 6527) @@ -2,7 +2,8 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration - config = Configuration('io', parent_package, top_path) + config = Configuration('io', parent_package, top_path, + setup_name = 'setupscons.py') config.add_sconscript('SConstruct') From scipy-svn at scipy.org Fri Jun 18 09:03:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:03:59 -0500 (CDT) Subject: [Scipy-svn] r6528 - trunk/scipy/io/arff Message-ID: <20100618130359.8064339CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:03:56 -0500 (Fri, 18 Jun 2010) New Revision: 6528 Modified: trunk/scipy/io/arff/arffread.py Log: ENH: Add ARFF reader speed improvements by Benjamin Root. Modified: trunk/scipy/io/arff/arffread.py =================================================================== --- trunk/scipy/io/arff/arffread.py 2010-06-18 13:03:39 UTC (rev 6527) +++ trunk/scipy/io/arff/arffread.py 2010-06-18 13:03:56 UTC (rev 6528) @@ -343,7 +343,7 @@ >>> safe_float('?\\n') nan """ - if x.strip() == '?': + if '?' in x: return np.nan else: return np.float(x) @@ -574,15 +574,20 @@ while r_comment.match(raw): raw = row_iter.next() + # 'compiling' the range since it does not change + # Note, I have already tried zipping the converters and + # row elements and got slightly worse performance. + elems = range(ni) + row = raw.split(delim) - yield tuple([convertors[i](row[i]) for i in range(ni)]) + yield tuple([convertors[i](row[i]) for i in elems]) for raw in row_iter: while r_comment.match(raw): raw = row_iter.next() while r_empty.match(raw): raw = row_iter.next() row = raw.split(delim) - yield tuple([convertors[i](row[i]) for i in range(ni)]) + yield tuple([convertors[i](row[i]) for i in elems]) a = generator(ofile, delim = delim) # No error should happen here: it is a bug otherwise From scipy-svn at scipy.org Fri Jun 18 09:04:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:04:16 -0500 (CDT) Subject: [Scipy-svn] r6529 - in trunk/scipy/io: . tests Message-ID: <20100618130416.5EC5C39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:04:16 -0500 (Fri, 18 Jun 2010) New Revision: 6529 Modified: trunk/scipy/io/recaster.py trunk/scipy/io/tests/test_recaster.py Log: Deprecate io.recaster module. Modified: trunk/scipy/io/recaster.py =================================================================== --- trunk/scipy/io/recaster.py 2010-06-18 13:03:56 UTC (rev 6528) +++ trunk/scipy/io/recaster.py 2010-06-18 13:04:16 UTC (rev 6529) @@ -5,9 +5,20 @@ """ from numpy import * +from numpy.lib.utils import deprecate +# deprecated in 0.8, will be removed in 0.9. + at deprecate def sctype_attributes(): - ''' Return dictionary describing numpy scalar types ''' + """Return dictionary describing numpy scalar types + + .. deprecated:: sctype_attributes is deprecated in scipy 0.8 and + will be removed in scipy 0.9. + """ + return _sctype_attributes() + + +def _sctype_attributes(): d_dict = {} for sc_type in ('complex','float'): t_list = sctypes[sc_type] @@ -46,9 +57,13 @@ class RecastError(ValueError): pass +# deprecated in 0.8, will be removed in 0.9. class Recaster(object): ''' Class to recast arrays to one of acceptable scalar types + .. deprecated:: Recaster is deprecated in scipy 0.8 and will be + removed in scipy 0.9. + Initialization specifies acceptable types (ATs) Implements recast method - returns array that may be of different @@ -58,7 +73,7 @@ specified in options at object creation. ''' - _sctype_attributes = sctype_attributes() + _sctype_attributes = _sctype_attributes() _k = 2**10 _option_defaults = { 'only_if_none': { @@ -107,6 +122,7 @@ } } + @deprecate def __init__(self, sctype_list=None, sctype_tols=None, recast_options='only_if_none'): Modified: trunk/scipy/io/tests/test_recaster.py =================================================================== --- trunk/scipy/io/tests/test_recaster.py 2010-06-18 13:03:56 UTC (rev 6528) +++ trunk/scipy/io/tests/test_recaster.py 2010-06-18 13:04:16 UTC (rev 6529) @@ -1,3 +1,5 @@ +import warnings + import numpy as np from numpy.testing import * @@ -167,5 +169,7 @@ assert dtt is outp, \ 'Expected %s from %s, got %s' % (outp, inp, dtt) +warnings.simplefilter('ignore', category=DeprecationWarning) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Fri Jun 18 09:10:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:10:39 -0500 (CDT) Subject: [Scipy-svn] r6530 - in branches/0.8.x/scipy/io: . tests Message-ID: <20100618131039.1711E39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:10:38 -0500 (Fri, 18 Jun 2010) New Revision: 6530 Removed: branches/0.8.x/scipy/io/array_import.py branches/0.8.x/scipy/io/fopen.py branches/0.8.x/scipy/io/npfile.py branches/0.8.x/scipy/io/pickler.py branches/0.8.x/scipy/io/tests/test_array_import.py branches/0.8.x/scipy/io/tests/test_npfile.py Modified: branches/0.8.x/scipy/io/__init__.py branches/0.8.x/scipy/io/data_store.py Log: Remove deprecated objects in scipy.io on Python level. Modified: branches/0.8.x/scipy/io/__init__.py =================================================================== --- branches/0.8.x/scipy/io/__init__.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/__init__.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -6,11 +6,6 @@ from numpy import deprecate -# These are all deprecated (until the end deprecated tag) -from npfile import npfile -from data_store import save, load, create_module, create_shelf -from array_import import read_array, write_array -from pickler import objload, objsave from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ convert_objectarray Deleted: branches/0.8.x/scipy/io/array_import.py =================================================================== --- branches/0.8.x/scipy/io/array_import.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/array_import.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,500 +0,0 @@ -# Authors: Travis Oliphant, Trent Oliphant -# with support from Lee Barford's group at Agilent, Inc. -# - -"""This module allows for the loading of an array from an ASCII -Text File - -""" - -__all__ = ['read_array', 'write_array'] - -# Standard library imports. -import os -import re -import sys -import types - -# Numpy imports. -import numpy - -from numpy import array, take, concatenate, asarray, real, imag, \ - deprecate -# Sadly, this module is still written with typecodes in mind. -from numpy.oldnumeric import Float - -# Local imports. -import numpyio - -default = None -_READ_BUFFER_SIZE = 1024*1024 -#_READ_BUFFER_SIZE = 1000 -#_READ_BUFFER_SIZE = 160 - -# ASCII Text object stream with automatic (un)compression and URL access. -# -# Adapted from -# TextFile class Written by: Konrad Hinsen -# -# Written by Travis Oliphant and Trent Oliphant -# with support from Agilent, Inc. -# - - -def convert_separator(sep): - newsep = '' - for k in sep: - if k in '.^$*+?{[\\|()': - newsep = newsep + '\\' + k - else: - newsep = newsep + k - return newsep - -def build_numberlist(lines): - if lines is default: - linelist = [-1] - else: - linelist = [] - errstr = "Argument lines must be a sequence of integers and/or range tuples." - try: - for num in lines[:-1]: # handle all but last element - if type(num) not in [types.IntType, types.TupleType]: - raise ValueError, errstr - if isinstance(num, types.IntType): - linelist.append(num) - else: - if not 1 < len(num) < 4: - raise ValueError, "Tuples must be valid range tuples." - linelist.extend(range(*num)) - except TypeError: - raise ValueError, errstr - num = lines[-1] - if type(num) is types.IntType: - linelist.append(num) - elif type(num) is types.TupleType: - if [types.IntType]*len(num) != map(type, num): - if len(num) > 1 and num[1] is not None: - raise ValueError, errstr - if len(num) == 1: - linelist.extend([num[0],-1]) - elif len(num) == 2: - if num[1] is None: - linelist.extend([num[0], -1]) - else: - linelist.extend(range(*num)) - elif len(num) == 3: - if num[1] is None: - linelist.extend([num[0], -num[2]]) - else: - linelist.extend(range(*num)) - else: - raise ValueError, errstr - return linelist - -def get_open_file(fileobject, mode='rb'): - try: - # this is the duck typing check: if fileobject - # can be used is os.path.expanduser, it is a string - # otherwise it is a fileobject - fileobject = os.path.expanduser(fileobject) - - if mode[0]=='r' and not os.path.exists(fileobject): - raise IOError, (2, 'No such file or directory: ' - + fileobject) - else: - try: - file = open(fileobject, mode) - except IOError, details: - file = None - if type(details) == type(()): - details = details + (fileobject,) - raise IOError, details - except (AttributeError, TypeError): - # it is assumed that the fileobject is a python - # file object if it can not be used in os.path.expanduser - file = fileobject - - return file - - -class ascii_stream(object): - """Text files with line iteration - - Ascii_stream instances can be used like normal read-only file objects - (i.e. by calling readline() and readlines()), but can - also be used as sequences of lines in for-loops. - - Finally, ascii_stream objects accept file names that start with '~' or - '~user' to indicate a home directory(for reading only). - - Constructor: ascii_stream(|fileobject|, |lines|,|comment|), - where |fileobject| is either an open python file object or - the name of the file, |lines| is a sequence of integers - or tuples(indicating ranges) of lines to be read, |comment| is the - comment line identifier """ - - def __init__(self, fileobject, lines=default, comment="#", - linesep='\n'): - if not isinstance(comment, types.StringType): - raise ValueError, "Comment must be a string." - self.linelist = build_numberlist(lines) - self.comment = comment - self.lencomment = len(comment) - self.file = get_open_file(fileobject, mode='r') - self.should_close_file = not (self.file is fileobject) - self._pos = self.file.tell() - self._lineindex = 0 - if self.linelist[-1] < 0: - self._linetoget = self.linelist[-1] - else: - self._linetoget = 0 - self._oldbuflines = 0 - self._linesplitter = linesep - self._buffer = self.readlines(_READ_BUFFER_SIZE) - self._totbuflines = len(self._buffer) - - def readlines(self, sizehint): - buffer = self.file.read(sizehint) - lines = buffer.split(self._linesplitter) - if len(buffer) < sizehint: # EOF - if buffer == '': - return [] - else: - return lines - else: - if len(lines) < 2: - raise ValueError, "Buffer size too small." - backup = len(lines[-1]) - self.file.seek(-backup, 1) - return lines[:-1] - - def __del__(self): - if hasattr(getattr(self, 'file', None),'close') and self.should_close_file: - self.file.close() - - def __getitem__(self, item): - while 1: - line = self.readnextline() - if line is None: - raise IndexError - if len(line) < self.lencomment or line[:self.lencomment] != self.comment: - break - return line - - def readnextline(self): - if self.linelist[self._lineindex] >= 0: - self._linetoget = self.linelist[self._lineindex] - self._lineindex += 1 - else: - self._linetoget = self._linetoget - self.linelist[self._lineindex] - while self._linetoget >= self._totbuflines: - self._buffer = self.readlines(_READ_BUFFER_SIZE) - self._oldbuflines = self._totbuflines - self._totbuflines += len(self._buffer) - if (self._totbuflines == self._oldbuflines): - return None - line = self._buffer[self._linetoget - self._oldbuflines] - return line - - def close(self): - self.file.close() - - def flush(self): - self.file.flush() - - -def move_past_spaces(firstline): - ind = 0 - firstline = firstline.lstrip() - while firstline[ind] not in [' ','\n','\t','\v','\f','\r']: - ind += 1 - return firstline[ind:], ind - - -def extract_columns(arlist, collist, atype, missing): - if collist[-1] < 0: - if len(collist) == 1: - toconvlist = arlist[::-collist[-1]] - else: - toconvlist = take(arlist,collist[:-1],0) - toconvlist = concatenate((toconvlist, - arlist[(collist[-2]-collist[-1])::(-collist[-1])])) - else: - toconvlist = take(arlist, collist,0) - - return numpyio.convert_objectarray(toconvlist, atype, missing) - - -# Given a string representing one line, a separator tuple, a list of -# columns to read for each element of the atype list and a missing -# value to insert when conversion fails. - -# Regular expressions for detecting complex numbers and for dealing -# with spaces between the real and imaginary parts - -_obj = re.compile(r""" - ([0-9.eE]+) # Real part - ([\t ]*) # Space between real and imaginary part - ([+-]) # +/- sign - ([\t ]*) # 0 or more spaces - (([0-9.eE]+[iIjJ]) - |([iIjJ][0-9.eE]+)) # Imaginary part - """, re.VERBOSE) - -_not_warned = 1 -def process_line(line, separator, collist, atype, missing): - global _not_warned - strlist = [] - line = _obj.sub(r"\1\3\5",line) # remove spaces between real - # and imaginary parts of complex numbers - - if _not_warned: - warn = 0 - if (_obj.search(line) is not None): - warn = 1 - for k in range(len(atype)): - if atype[k] in numpy.typecodes['Complex']: - warn = 0 - if warn: - numpy.disp("Warning: Complex data detected, but no requested typecode was complex.") - _not_warned = 0 - for mysep in separator[:-1]: - if mysep is None: - newline, ind = move_past_spaces(line) - strlist.append(line[:ind]) - line = newline - else: - ind = line.find(mysep) - strlist.append(line[:ind]) - line = line[ind+len(mysep):] - strlist.extend(line.split(separator[-1])) - arlist = array(strlist,'O') - N = len(atype) - vals = [None]*N - for k in range(len(atype)): - vals[k] = extract_columns(arlist, collist[k], atype[k], missing) - return vals - -def getcolumns(stream, columns, separator): - global _not_warned - comment = stream.comment - lenc = stream.lencomment - k, K = stream.linelist[0], len(stream._buffer) - while k < K: - firstline = stream._buffer[k] - if firstline != '' and firstline[:lenc] != comment: - break - k = k + 1 - if k == K: - raise ValueError, "First line to read not within %d lines of top." % K - firstline = stream._buffer[k] - N = len(columns) - collist = [None]*N - colsize = [None]*N - for k in range(N): - collist[k] = build_numberlist(columns[k]) - _not_warned = 0 - val = process_line(firstline, separator, collist, [Float]*N, 0) - for k in range(N): - colsize[k] = len(val[k]) - return colsize, collist - -def convert_to_equal_lists(cols, atype): - if not isinstance(cols, types.ListType): - cols = [cols] - if not isinstance(atype, types.ListType): - atype = [atype] - N = len(cols) - len(atype) - if N > 0: - atype.extend([atype[-1]]*N) - elif N < 0: - cols.extend([cols[-1]]*(-N)) - return cols, atype - - - at deprecate(message=""" -The functionality of read_array is in numpy.loadtxt which allows the same -functionality using different syntax. -""") -def read_array(fileobject, separator=default, columns=default, comment="#", - lines=default, atype=Float, linesep='\n', - rowsize=10000, missing=0): - """Return an array or arrays from ascii_formatted data in |fileobject|. - - Inputs: - - fileobject -- An open file object or a string for a valid filename. - The string can be prepended by "~/" or "~/" to - read a file from the home directory. - separator -- a string or a tuple of strings to indicate the column - separators. If the length of the string tuple is less - than the total number of columns, then the last separator - is assumed to be the separator for the rest of the columns. - columns -- a tuple of integers and range-tuples which describe the - columns to read from the file. A negative entry in the - last column specifies the negative skip value to the end. - Example: columns=(1, 4, (5, 9), (11, 15, 3), 17, -2) - will read [1,4,5,6,7,8,11,14,17,19,21,23,...] - If multiple arrays are to be returned, then this argument - should be an ordered list of such tuples. There should be - one entry in the list for each arraytype in the atype list. - lines -- a tuple with the same structure as columns which indicates - the lines to read. - comment -- the comment character (line will be ignored even if it is - specified by the lines tuple) - linesep -- separator between rows. - missing -- value to insert in array when conversion to number fails. - atype -- the typecode of the output array. If multiple outputs are - desired, then this should be a list of typecodes. The columns - to fill the array represented by the given typecode is - determined from the columns argument. If the length of atype - does not match the length of the columns list, then, the - smallest one is expanded to match the largest by repeatedly - copying the last entry. - rowsize -- the allocation row size (array grows by this amount as - data is read in). - - Output -- the 1 or 2d array, or a tuple of output arrays of different - types, sorted in order of the first column to be placed - in the output array. - - """ - - global _not_warned - # Make separator into a tuple of separators. - if type(separator) in [types.StringType, type(default)]: - sep = (separator,) - else: - sep = tuple(separator) - # Create ascii_object from |fileobject| argument. - ascii_object = ascii_stream(fileobject, lines=lines, comment=comment, linesep=linesep) - columns, atype = convert_to_equal_lists(columns, atype) - numout = len(atype) - # Get the number of columns to read and expand the columns argument - colsize, collist = getcolumns(ascii_object, columns, sep) - # Intialize the output arrays - outrange = range(numout) - outarr = [] - typecodes = "".join(numpy.typecodes.values()) - for k in outrange: - if not atype[k] in typecodes: - raise ValueError, "One of the array types is invalid, k=%d" % k - outarr.append(numpy.zeros((rowsize, colsize[k]),atype[k])) - row = 0 - block_row = 0 - _not_warned = 1 - for line in ascii_object: - if line.strip() == '': - continue - vals = process_line(line, sep, collist, atype, missing) - for k in outrange: - outarr[k][row] = vals[k] - row += 1 - block_row += 1 - if block_row >= rowsize: - for k in outrange: - outarr[k].resize((outarr[k].shape[0] + rowsize,colsize[k])) - block_row = 0 - for k in outrange: - if outarr[k].shape[0] != row: - outarr[k].resize((row,colsize[k])) - a = outarr[k] - if a.shape[0] == 1 or a.shape[1] == 1: - outarr[k] = numpy.ravel(a) - if len(outarr) == 1: - return outarr[0] - else: - return tuple(outarr) - - -# takes 1-d array and returns a string -def str_array(arr, precision=5,col_sep=' ',row_sep="\n",ss=0): - thestr = [] - arr = asarray(arr) - N,M = arr.shape - thistype = arr.dtype.char - nofloat = (thistype in '1silbwu') or (thistype in 'Oc') - cmplx = thistype in 'FD' - fmtstr = "%%.%de" % precision - cmpnum = pow(10.0,-precision) - for n in xrange(N): - theline = [] - for m in xrange(M): - val = arr[n,m] - if ss and abs(val) < cmpnum: - val = 0*val - if nofloat or val==0: - thisval = str(val) - elif cmplx: - rval = real(val) - ival = imag(val) - thisval = eval('fmtstr % rval') - if (ival >= 0): - istr = eval('fmtstr % ival') - thisval = '%s+j%s' % (thisval, istr) - else: - istr = eval('fmtstr % abs(ival)') - thisval = '%s-j%s' % (thisval, istr) - else: - thisval = eval('fmtstr % val') - theline.append(thisval) - strline = col_sep.join(theline) - thestr.append(strline) - return row_sep.join(thestr) - - - at deprecate(message=""" -This function is replaced by numpy.savetxt which allows the same functionality -through a different syntax. -""") -def write_array(fileobject, arr, separator=" ", linesep='\n', - precision=5, suppress_small=0, keep_open=0): - """Write a rank-2 or less array to file represented by fileobject. - - Inputs: - - fileobject -- An open file object or a string to a valid filename. - arr -- The array to write. - separator -- separator to write between elements of the array. - linesep -- separator to write between rows of array - precision -- number of digits after the decimal place to write. - suppress_small -- non-zero to round small numbers down to 0.0 - keep_open = non-zero to return the open file, otherwise, the file is closed. - Outputs: - - file -- The open file (if keep_open is non-zero) - """ - # XXX: What to when appending to files ? 'wa' does not do what one might - # expect, and opening a file twice to create it first is not easily doable - # with get_open_file ? - file = get_open_file(fileobject, mode='w') - rank = numpy.rank(arr) - if rank > 2: - raise ValueError, "Can-only write up to 2-D arrays." - - if rank == 0: - h = 1 - arr = numpy.reshape(arr, (1,1)) - elif rank == 1: - h = numpy.shape(arr)[0] - arr = numpy.reshape(arr, (h,1)) - else: - h = numpy.shape(arr)[0] - arr = asarray(arr) - - for ch in separator: - if ch in '0123456789-+FfeEgGjJIi.': - raise ValueError, "Bad string for separator" - - astr = str_array(arr, precision=precision, - col_sep=separator, row_sep=linesep, - ss = suppress_small) - file.write(astr) - file.write('\n') - if keep_open: - return file - else: - if file is sys.stdout or file is sys.stderr: - return - file.close() - return Modified: branches/0.8.x/scipy/io/data_store.py =================================================================== --- branches/0.8.x/scipy/io/data_store.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/data_store.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -15,39 +15,12 @@ 1 """ -__all__ = ['save_as_module', - # The rest of these are all deprecated - 'save', 'create_module', - 'create_shelf', 'load'] +__all__ = ['save_as_module'] import dumb_shelve import os -from numpy import deprecate -def _load(module): - """ Load data into module from a shelf with - the same name as the module. - """ - dir,filename = os.path.split(module.__file__) - filebase = filename.split('.')[0] - fn = os.path.join(dir, filebase) - f = dumb_shelve.open(fn, "r") - #exec( 'import ' + module.__name__) - for i in f.keys(): - exec( 'import ' + module.__name__+ ';' + - module.__name__+'.'+i + '=' + 'f["' + i + '"]') -# print i, 'loaded...' -# print 'done' - -load = deprecate(_load, message=""" -This is an internal function used with scipy.io.save_as_module - -If you are saving arrays into a module, you should think about using -HDF5 or .npz files instead. -""") - - def _create_module(file_name): """ Create the module file. """ @@ -59,13 +32,7 @@ f.write('data_store._load(%s)' % module_name) f.close() -create_module = deprecate(_create_module, message=""" -This is an internal function used with scipy.io.save_as_module -If you are saving arrays into a module, you should think about -using HDF5 or .npz files instead. -""") - def _create_shelf(file_name,data): """Use this to write the data to a new file """ @@ -77,14 +44,7 @@ # print 'done' f.close() -create_shelf = deprecate(_create_shelf, message=""" -This is an internal function used with scipy.io.save_as_module -If you are saving arrays into a module, you should think about using -HDF5 or .npz files instead. -""") - - def save_as_module(file_name=None,data=None): """ Save the dictionary "data" into a module and shelf named save. @@ -100,4 +60,3 @@ _create_module(file_name) _create_shelf(file_name,data) -save = deprecate(save_as_module, old_name='save', new_name='save_as_module') Deleted: branches/0.8.x/scipy/io/fopen.py =================================================================== --- branches/0.8.x/scipy/io/fopen.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/fopen.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,356 +0,0 @@ -# Author: Travis Oliphant - -import struct -import sys -import types - -from numpy import * -import numpyio - -import warnings -warnings.warn('fopen module is deprecated, please use npfile instead', - DeprecationWarning, stacklevel=2) - -LittleEndian = (sys.byteorder == 'little') - -__all__ = ['fopen'] - -def getsize_type(mtype): - if mtype in ['B','uchar','byte','unsigned char','integer*1', 'int8']: - mtype = 'B' - elif mtype in ['S1', 'char', 'char*1']: - mtype = 'B' - elif mtype in ['b', 'schar', 'signed char']: - mtype = 'b' - elif mtype in ['h','short','int16','integer*2']: - mtype = 'h' - elif mtype in ['H','ushort','uint16','unsigned short']: - mtype = 'H' - elif mtype in ['i','int']: - mtype = 'i' - elif mtype in ['I','uint','uint32','unsigned int']: - mtype = 'I' - elif mtype in ['u4','int32','integer*4']: - mtype = 'u4' - elif mtype in ['f','float','float32','real*4', 'real']: - mtype = 'f' - elif mtype in ['d','double','float64','real*8', 'double precision']: - mtype = 'd' - elif mtype in ['F','complex float','complex*8','complex64']: - mtype = 'F' - elif mtype in ['D','complex*16','complex128','complex','complex double']: - mtype = 'D' - else: - mtype = obj2sctype(mtype) - - newarr = empty((1,),mtype) - return newarr.itemsize, newarr.dtype.char - -class fopen(object): - """Class for reading and writing binary files into numpy arrays. - - Inputs: - - file_name -- The complete path name to the file to open. - permission -- Open the file with given permissions: ('r', 'H', 'a') - for reading, writing, or appending. This is the same - as the mode argument in the builtin open command. - format -- The byte-ordering of the file: - (['native', 'n'], ['ieee-le', 'l'], ['ieee-be', 'B']) for - native, little-endian, or big-endian respectively. - - Attributes (Read only): - - bs -- non-zero if byte-swapping is performed on read and write. - format -- 'native', 'ieee-le', or 'ieee-be' - closed -- non-zero if the file is closed. - mode -- permissions with which this file was opened - name -- name of the file - """ - -# Methods: -# -# read -- read data from file and return numpy array -# write -- write to file from numpy array -# fort_read -- read Fortran-formatted binary data from the file. -# fort_write -- write Fortran-formatted binary data to the file. -# rewind -- rewind to beginning of file -# size -- get size of file -# seek -- seek to some position in the file -# tell -- return current position in file -# close -- close the file - - def __init__(self,file_name,permission='rb',format='n'): - if 'b' not in permission: permission += 'b' - if isinstance(file_name, basestring): - self.file = file(file_name, permission) - elif isinstance(file_name, file) and not file_name.closed: - # first argument is an open file - self.file = file_name - else: - raise TypeError, 'Need filename or open file as input' - self.setformat(format) - - def __del__(self): - try: - self.file.close() - except: - pass - - def close(self): - self.file.close() - - def seek(self, *args): - self.file.seek(*args) - - def tell(self): - return self.file.tell() - - def raw_read(self, size=-1): - """Read raw bytes from file as string.""" - return self.file.read(size) - - def raw_write(self, str): - """Write string to file as raw bytes.""" - return self.file.write(str) - - def setformat(self, format): - """Set the byte-order of the file.""" - if format in ['native','n','default']: - self.bs = False - self.format = 'native' - elif format in ['ieee-le','l','little-endian','le']: - self.bs = not LittleEndian - self.format = 'ieee-le' - elif format in ['ieee-be','B','big-endian','be']: - self.bs = LittleEndian - self.format = 'ieee-be' - else: - raise ValueError, "Unrecognized format: " + format - return - - def write(self,data,mtype=None,bs=None): - """Write to open file object the flattened numpy array data. - - Inputs: - - data -- the numpy array to write. - mtype -- a string indicating the binary type to write. - The default is the type of data. If necessary a cast is made. - unsigned byte : 'B', 'uchar', 'byte' 'unsigned char', 'int8', - 'integer*1' - character : 'S1', 'char', 'char*1' - signed char : 'b', 'schar', 'signed char' - short : 'h', 'short', 'int16', 'integer*2' - unsigned short : 'H', 'ushort','uint16','unsigned short' - int : 'i', 'int' - unsigned int : 'I', 'uint32','uint','unsigned int' - int32 : 'u4', 'int32', 'integer*4' - float : 'f', 'float', 'float32', 'real*4' - double : 'd', 'double', 'float64', 'real*8' - complex float : 'F', 'complex float', 'complex*8', 'complex64' - complex double : 'D', 'complex', 'complex double', 'complex*16', - 'complex128' - """ - if bs is None: - bs = self.bs - else: - bs = (bs == 1) - if isinstance(data, str): - N, buf = len(data), buffer(data) - data = ndarray(shape=(N,),dtype='B',buffer=buf) - else: - data = asarray(data) - if mtype is None: - mtype = data.dtype.char - howmany,mtype = getsize_type(mtype) - count = product(data.shape,axis=0) - numpyio.fwrite(self.file,count,data,mtype,bs) - return - - fwrite = write - - def read(self,count,stype,rtype=None,bs=None,c_is_b=0): - """Read data from file and return it in a numpy array. - - Inputs: - - count -- an integer specifying the number of elements of type - stype to read or a tuple indicating the shape of - the output array. - stype -- The data type of the stored data (see fwrite method). - rtype -- The type of the output array. Same as stype if None. - bs -- Whether or not to byteswap (or use self.bs if None) - c_is_b --- If non-zero then the count is an integer - specifying the total number of bytes to read - (must be a multiple of the size of stype). - - Outputs: (output,) - - output -- a numpy array of type rtype. - """ - if bs is None: - bs = self.bs - else: - bs = (bs == 1) - howmany,stype = getsize_type(stype) - shape = None - if c_is_b: - if count % howmany != 0: - raise ValueError, "When c_is_b is non-zero then " \ - "count is bytes\nand must be multiple of basic size." - count = count / howmany - elif type(count) in [types.TupleType, types.ListType]: - shape = list(count) - # allow -1 to specify unknown dimension size as in reshape - minus_ones = shape.count(-1) - if minus_ones == 0: - count = product(shape,axis=0) - elif minus_ones == 1: - now = self.tell() - self.seek(0,2) - end = self.tell() - self.seek(now) - remaining_bytes = end - now - know_dimensions_size = -product(count,axis=0) * getsize_type(stype)[0] - unknown_dimension_size, illegal = divmod(remaining_bytes, - know_dimensions_size) - if illegal: - raise ValueError("unknown dimension doesn't match filesize") - shape[shape.index(-1)] = unknown_dimension_size - count = product(shape,axis=0) - else: - raise ValueError( - "illegal count; can only specify one unknown dimension") - shape = tuple(shape) - if rtype is None: - rtype = stype - else: - howmany,rtype = getsize_type(rtype) - if count == 0: - return zeros(0,rtype) - retval = numpyio.fread(self.file, count, stype, rtype, bs) - if shape is not None: - retval = resize(retval, shape) - return retval - - fread = read - - def rewind(self,howmany=None): - """Rewind a file to its beginning or by a specified amount. - """ - if howmany is None: - self.seek(0) - else: - self.seek(-howmany,1) - - def size(self): - """Return the size of the file. - """ - try: - sz = self.thesize - except AttributeError: - curpos = self.tell() - self.seek(0,2) - sz = self.tell() - self.seek(curpos) - self.thesize = sz - return sz - - def fort_write(self,fmt,*args): - """Write a Fortran binary record. - - Inputs: - - fmt -- If a string then it represents the same format string as - used by struct.pack. The remaining arguments are passed - to struct.pack. - - If fmt is an array, then this array will be written as - a Fortran record using the output type args[0]. - - *args -- Arguments representing data to write. - """ - if self.format == 'ieee-le': - nfmt = " 0: - sz,mtype = getsize_type(args[0]) - else: - sz,mtype = getsize_type(fmt.dtype.char) - count = product(fmt.shape,axis=0) - strlen = struct.pack(nfmt,count*sz) - self.write(strlen) - numpyio.fwrite(self.file,count,fmt,mtype,self.bs) - self.write(strlen) - else: - raise TypeError, "Unknown type in first argument" - - def fort_read(self,fmt,dtype=None): - """Read a Fortran binary record. - - Inputs: - - fmt -- If dtype is not given this represents a struct.pack - format string to interpret the next record. Otherwise this - argument is ignored. - dtype -- If dtype is not None, then read in the next record as - an array of type dtype. - - Outputs: (data,) - - data -- If dtype is None, then data is a tuple containing the output - of struct.unpack on the next Fortan record. - If dtype is a datatype string, then the next record is - read in as a 1-D array of type datatype. - """ - lookup_dict = {'ieee-le':"<",'ieee-be':">",'native':''} - if dtype is None: - fmt = lookup_dict[self.format] + fmt - numbytes = struct.calcsize(fmt) - nn = struct.calcsize("i"); - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - strdata = self.raw_read(numbytes) - if strdata == '': - raise ValueError, "Unexpected end of file..." - data = struct.unpack(fmt,strdata) - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - return data - else: # Ignore format string and read in next record as an array. - fmt = lookup_dict[self.format] + "i" - nn = struct.calcsize(fmt) - nbytestr = self.raw_read(nn) - if nbytestr == '': - raise ValueError, "Unexpected end of file..." - nbytes = struct.unpack(fmt,nbytestr)[0] - howmany, dtype = getsize_type(dtype) - ncount = nbytes / howmany - if ncount*howmany != nbytes: - self.rewind(4) - raise ValueError, "A mismatch between the type requested and the data stored." - if ncount < 0: - raise ValueError, "Negative number of bytes to read:\n file is probably not opened with correct endian-ness." - if ncount == 0: - raise ValueError, "End of file? Zero-bytes to read." - retval = numpyio.fread(self.file, ncount, dtype, dtype, self.bs) - if len(retval) == 1: - retval = retval[0] - if (self.raw_read(nn) == ''): - raise ValueError, "Unexpected end of file..." - return retval Deleted: branches/0.8.x/scipy/io/npfile.py =================================================================== --- branches/0.8.x/scipy/io/npfile.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/npfile.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,232 +0,0 @@ -# Authors: Matthew Brett, Travis Oliphant - -""" -Class for reading and writing numpy arrays from / to binary files -""" - -import sys - -import numpy as np - -__all__ = ['sys_endian_code', 'npfile'] - -sys_endian_code = (sys.byteorder == 'little') and '<' or '>' - -class npfile(object): - ''' Class for reading and writing numpy arrays to/from files - - Inputs: - file_name -- The complete path name to the file to open - or an open file-like object - permission -- Open the file with given permissions: ('r', 'w', 'a') - for reading, writing, or appending. This is the same - as the mode argument in the builtin open command. - format -- The byte-ordering of the file: - (['native', 'n'], ['ieee-le', 'l'], ['ieee-be', 'B']) for - native, little-endian, or big-endian respectively. - - Attributes: - endian -- default endian code for reading / writing - order -- default order for reading writing ('C' or 'F') - file -- file object containing read / written data - - Methods: - seek, tell, close -- as for file objects - rewind -- set read position to beginning of file - read_raw -- read string data from file (read method of file) - write_raw -- write string data to file (write method of file) - read_array -- read numpy array from binary file data - write_array -- write numpy array contents to binary file - - Example use: - >>> from StringIO import StringIO - >>> import numpy as np - >>> from scipy.io import npfile - >>> arr = np.arange(10).reshape(5,2) - >>> # Make file-like object (could also be file name) - >>> my_file = StringIO() - >>> npf = npfile(my_file) - >>> npf.write_array(arr) - >>> npf.rewind() - >>> npf.read_array((5,2), arr.dtype) - >>> npf.close() - >>> # Or read write in Fortran order, Big endian - >>> # and read back in C, system endian - >>> my_file = StringIO() - >>> npf = npfile(my_file, order='F', endian='>') - >>> npf.write_array(arr) - >>> npf.rewind() - >>> npf.read_array((5,2), arr.dtype) - ''' - - def __init__(self, file_name, - permission='rb', - endian = 'dtype', - order = 'C'): - if 'b' not in permission: permission += 'b' - if isinstance(file_name, basestring): - self.file = file(file_name, permission) - else: - try: - closed = file_name.closed - except AttributeError: - raise TypeError, 'Need filename or file object as input' - if closed: - raise TypeError, 'File object should be open' - self.file = file_name - self.endian = endian - self.order = order - - def get_endian(self): - return self._endian - def set_endian(self, endian_code): - self._endian = self.parse_endian(endian_code) - endian = property(get_endian, set_endian, None, 'get/set endian code') - - def parse_endian(self, endian_code): - ''' Returns valid endian code from wider input options''' - if endian_code in ['native', 'n', 'N','default', '=']: - return sys_endian_code - elif endian_code in ['swapped', 's', 'S']: - return sys_endian_code == '<' and '>' or '<' - elif endian_code in ['ieee-le','l','L','little-endian', - 'little','le','<']: - return '<' - elif endian_code in ['ieee-be','B','b','big-endian', - 'big','be', '>']: - return '>' - elif endian_code == 'dtype': - return 'dtype' - else: - raise ValueError, "Unrecognized endian code: " + endian_code - return - - def __del__(self): - try: - self.file.close() - except: - pass - - def close(self): - self.file.close() - - def seek(self, *args): - self.file.seek(*args) - - def tell(self): - return self.file.tell() - - def rewind(self,howmany=None): - """Rewind a file to its beginning or by a specified amount. - """ - if howmany is None: - self.seek(0) - else: - self.seek(-howmany,1) - - def read_raw(self, size=-1): - """Read raw bytes from file as string.""" - return self.file.read(size) - - def write_raw(self, str): - """Write string to file as raw bytes.""" - return self.file.write(str) - - def remaining_bytes(self): - cur_pos = self.tell() - self.seek(0, 2) - end_pos = self.tell() - self.seek(cur_pos) - return end_pos - cur_pos - - def _endian_order(self, endian, order): - ''' Housekeeping function to return endian, order from input args ''' - if endian is None: - endian = self.endian - else: - endian = self.parse_endian(endian) - if order is None: - order = self.order - return endian, order - - def _endian_from_dtype(self, dt): - dt_endian = dt.byteorder - if dt_endian == '=': - dt_endian = sys_endian_code - return dt_endian - - def write_array(self, data, endian=None, order=None): - ''' Write to open file object the flattened numpy array data - - Inputs - data - numpy array or object convertable to array - endian - endianness of written data - (can be None, 'dtype', '<', '>') - (if None, get from self.endian) - order - order of array to write (C, F) - (if None from self.order) - ''' - endian, order = self._endian_order(endian, order) - data = np.asarray(data) - dt_endian = self._endian_from_dtype(data.dtype) - if not endian == 'dtype': - if dt_endian != endian: - data = data.byteswap() - self.file.write(data.tostring(order=order)) - - def read_array(self, dt, shape=-1, endian=None, order=None): - '''Read data from file and return it in a numpy array. - - Inputs - ------ - dt - dtype of array to be read - shape - shape of output array, or number of elements - (-1 as number of elements or element in shape - means unknown dimension as in reshape; size - of array calculated from remaining bytes in file) - endian - endianness of data in file - (can be None, 'dtype', '<', '>') - (if None, get from self.endian) - order - order of array in file (C, F) - (if None get from self.order) - - Outputs - arr - array from file with given dtype (dt) - ''' - endian, order = self._endian_order(endian, order) - dt = np.dtype(dt) - try: - shape = list(shape) - except TypeError: - shape = [shape] - minus_ones = shape.count(-1) - if minus_ones == 0: - pass - elif minus_ones == 1: - known_dimensions_size = -np.product(shape,axis=0) * dt.itemsize - unknown_dimension_size, illegal = divmod(self.remaining_bytes(), - known_dimensions_size) - if illegal: - raise ValueError("unknown dimension doesn't match filesize") - shape[shape.index(-1)] = unknown_dimension_size - else: - raise ValueError( - "illegal -1 count; can only specify one unknown dimension") - sz = dt.itemsize * np.product(shape) - dt_endian = self._endian_from_dtype(dt) - buf = self.file.read(sz) - arr = np.ndarray(shape=shape, - dtype=dt, - buffer=buf, - order=order) - if (not endian == 'dtype') and (dt_endian != endian): - return arr.byteswap() - return arr.copy() - -npfile = np.deprecate(npfile, message=""" -You can achieve the same effect as using npfile using numpy.save and -numpy.load. - -You can use memory-mapped arrays and data-types to map out a -file format for direct manipulation in NumPy. -""") Deleted: branches/0.8.x/scipy/io/pickler.py =================================================================== --- branches/0.8.x/scipy/io/pickler.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/pickler.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,38 +0,0 @@ -import cPickle - -from numpy import deprecate - - at deprecate(message=""" -Just use cPickle.dump directly or numpy.savez -""") -def objsave(file, allglobals, *args): - """Pickle the part of a dictionary containing the argument list - into file string. - - Syntax: objsave(file, globals(), obj1, obj2, ... ) - """ - fid = open(file,'w') - savedict = {} - for key in allglobals.keys(): - inarglist = 0 - for obj in args: - if allglobals[key] is obj: - inarglist = 1 - break - if inarglist: - savedict[key] = obj - cPickle.dump(savedict,fid,1) - fid.close() - - at deprecate(message=""" -Just use cPickle.load or numpy.load. -""") -def objload(file, allglobals): - """Load a previously pickled dictionary and insert into given dictionary. - - Syntax: objload(file, globals()) - """ - fid = open(file,'r') - savedict = cPickle.load(fid) - allglobals.update(savedict) - fid.close() Deleted: branches/0.8.x/scipy/io/tests/test_array_import.py =================================================================== --- branches/0.8.x/scipy/io/tests/test_array_import.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/tests/test_array_import.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,68 +0,0 @@ -#!/usr/bin/env python - -# This python script tests the numpyio module. -# also check out numpyio.fread.__doc__ and other method docstrings. - -import os -from numpy.testing import * -import scipy.io as io -from scipy.io import numpyio -from scipy.io import array_import - -import numpy.oldnumeric as N -import tempfile - -class TestNumpyio(TestCase): - def test_basic(self): - # Generate some data - a = 255*rand(20) - # Open a file - fname = tempfile.mktemp('.dat') - fid = open(fname,"wb") - # Write the data as shorts - numpyio.fwrite(fid,20,a,N.Int16) - fid.close() - # Reopen the file and read in data - fid = open(fname,"rb") - if verbose >= 3: - print "\nDon't worry about a warning regarding the number of bytes read." - b = numpyio.fread(fid,1000000,N.Int16,N.Int) - fid.close() - assert(N.product(a.astype(N.Int16) == b,axis=0)) - os.remove(fname) - -class TestReadArray(TestCase): - def test_complex(self): - a = rand(13,4) + 1j*rand(13,4) - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname,atype=N.Complex) - assert_array_almost_equal(a,b,decimal=4) - os.remove(fname) - - def test_float(self): - a = rand(3,4)*30 - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname) - assert_array_almost_equal(a,b,decimal=4) - os.remove(fname) - - def test_integer(self): - from scipy import stats - a = stats.randint.rvs(1,20,size=(3,4)) - fname = tempfile.mktemp('.dat') - io.write_array(fname,a) - b = io.read_array(fname,atype=a.dtype.char) - assert_array_equal(a,b) - os.remove(fname) - -class TestRegression(TestCase): - def test_get_open_file_works_with_filelike_objects(self): - f = tempfile.TemporaryFile() - f2 = array_import.get_open_file(f) - assert f2 is f - f.close() - -if __name__ == "__main__": - run_module_suite() Deleted: branches/0.8.x/scipy/io/tests/test_npfile.py =================================================================== --- branches/0.8.x/scipy/io/tests/test_npfile.py 2010-06-18 13:04:16 UTC (rev 6529) +++ branches/0.8.x/scipy/io/tests/test_npfile.py 2010-06-18 13:10:38 UTC (rev 6530) @@ -1,105 +0,0 @@ -import os -from StringIO import StringIO -from tempfile import mkstemp -from numpy.testing import * -import numpy as np - -from scipy.io.npfile import npfile, sys_endian_code - -class TestNpFile(TestCase): - - def test_init(self): - fd, fname = mkstemp() - os.close(fd) - npf = npfile(fname) - arr = np.reshape(np.arange(10), (5,2)) - self.assertRaises(IOError, npf.write_array, arr) - npf.close() - npf = npfile(fname, 'w') - npf.write_array(arr) - npf.rewind() - self.assertRaises(IOError, npf.read_array, - arr.dtype, arr.shape) - npf.close() - os.remove(fname) - - npf = npfile(StringIO(), endian='>', order='F') - assert npf.endian == '>', 'Endian not set correctly' - assert npf.order == 'F', 'Order not set correctly' - npf.endian = '<' - assert npf.endian == '<', 'Endian not set correctly' - - def test_parse_endian(self): - npf = npfile(StringIO()) - swapped_code = sys_endian_code == '<' and '>' or '<' - assert npf.parse_endian('native') == sys_endian_code - assert npf.parse_endian('swapped') == swapped_code - assert npf.parse_endian('l') == '<' - assert npf.parse_endian('B') == '>' - assert npf.parse_endian('dtype') == 'dtype' - self.assertRaises(ValueError, npf.parse_endian, 'nonsense') - - def test_read_write_raw(self): - npf = npfile(StringIO()) - str = 'test me with this string' - npf.write_raw(str) - npf.rewind() - assert str == npf.read_raw(len(str)) - - def test_remaining_bytes(self): - npf = npfile(StringIO()) - assert npf.remaining_bytes() == 0 - npf.write_raw('+' * 10) - assert npf.remaining_bytes() == 0 - npf.rewind() - assert npf.remaining_bytes() == 10 - npf.seek(5) - assert npf.remaining_bytes() == 5 - - def test_read_write_array(self): - npf = npfile(StringIO()) - arr = np.reshape(np.arange(10), (5,2)) - # Arr as read in fortran order - f_arr = arr.reshape((2,5)).T - # Arr written in fortran order read in C order - cf_arr = arr.T.reshape((5,2)) - # Byteswapped array - bo = arr.dtype.byteorder - swapped_code = sys_endian_code == '<' and '>' or '<' - if bo in ['=', sys_endian_code]: - nbo = swapped_code - else: - nbo = sys_endian_code - bs_arr = arr.newbyteorder(nbo) - adt = arr.dtype - shp = arr.shape - npf.write_array(arr) - npf.rewind() - assert_array_equal(npf.read_array(adt), arr.flatten()) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, endian=swapped_code), - bs_arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, order='F'), - f_arr) - npf.rewind() - npf.write_array(arr, order='F') - npf.rewind() - assert_array_equal(npf.read_array(adt), arr.flatten('F')) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), - cf_arr) - - npf = npfile(StringIO(), endian='swapped', order='F') - npf.write_array(arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp), arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, endian='dtype'), bs_arr) - npf.rewind() - assert_array_equal(npf.read_array(adt, shp, order='C'), cf_arr) - -if __name__ == "__main__": - run_module_suite() From scipy-svn at scipy.org Fri Jun 18 09:10:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:10:56 -0500 (CDT) Subject: [Scipy-svn] r6531 - branches/0.8.x/scipy/io Message-ID: <20100618131056.D451E39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:10:56 -0500 (Fri, 18 Jun 2010) New Revision: 6531 Removed: branches/0.8.x/scipy/io/numpyiomodule.c Modified: branches/0.8.x/scipy/io/__init__.py branches/0.8.x/scipy/io/setup.py Log: Remove deprecated objects in scipy.io on the C level. Modified: branches/0.8.x/scipy/io/__init__.py =================================================================== --- branches/0.8.x/scipy/io/__init__.py 2010-06-18 13:10:38 UTC (rev 6530) +++ branches/0.8.x/scipy/io/__init__.py 2010-06-18 13:10:56 UTC (rev 6531) @@ -7,65 +7,6 @@ from numpy import deprecate -from numpyio import packbits, unpackbits, bswap, fread, fwrite, \ - convert_objectarray - -fread = deprecate(fread, message=""" -scipy.io.fread can be replaced with NumPy I/O routines such as -np.load, np.fromfile as well as NumPy's memory-mapping capabilities. -""") - -fwrite = deprecate(fwrite, message=""" -scipy.io.fwrite can be replaced with NumPy I/O routines such as np.save, -np.savez and x.tofile. Also, files can be directly memory-mapped into NumPy -arrays which is often a better way of reading large files. -""") - -bswap = deprecate(bswap, message=""" -scipy.io.bswap can be replaced with the byteswap method on an array. -out = scipy.io.bswap(arr) --> out = arr.byteswap(True) -""") - -packbits = deprecate(packbits, message=""" -The functionality of scipy.io.packbits is now available as numpy.packbits -The calling convention is a bit different, as the 2-d case is no -longer specialized. - -However, you can simulate scipy.packbits by raveling the last 2 dimensions -of the array and calling numpy.packbits with an axis=-1 keyword: - -def scipy_packbits(inp): - a = np.asarray(inp) - if a.ndim < 2: - return np.packbits(a) - oldshape = a.shape - newshape = oldshape[:-2] + (oldshape[-2]*oldshape[-1],) - a = np.reshape(a, newshape) - return np.packbits(a, axis=-1).ravel() -""") - -unpackbits = deprecate(unpackbits, message=""" -The functionality of scipy.io.unpackbits is now available in numpy.unpackbits -The calling convention is different, however, as the 2-d case is no longer -specialized. - -Thus, the scipy.unpackbits behavior must be simulated using numpy.unpackbits. - -def scipy_unpackbits(inp, els_per_slice, out_type=None): - inp = np.asarray(inp) - num4els = ((els_per_slice-1) >> 3) + 1 - inp = np.reshape(inp, (-1,num4els)) - res = np.unpackbits(inp, axis=-1)[:,:els_per_slice] - return res.ravel() -""") - -convert_objectarray = deprecate(convert_objectarray, message=""" -The same functionality can be obtained using NumPy string arrays and the -.astype method (except for the optional missing value feature). -""") - -# end deprecated - # matfile read and write from matlab.mio import loadmat, savemat Deleted: branches/0.8.x/scipy/io/numpyiomodule.c =================================================================== --- branches/0.8.x/scipy/io/numpyiomodule.c 2010-06-18 13:10:38 UTC (rev 6530) +++ branches/0.8.x/scipy/io/numpyiomodule.c 2010-06-18 13:10:56 UTC (rev 6531) @@ -1,1011 +0,0 @@ -/* numpyio.c -- Version 0.9.9 - * - * Author: Travis E. Oliphant - * Date : March 1999 - * - * This file is a module for python that defines basically two functions for - * reading from and writing to a binary file. It also has some functions - * for byteswapping data and packing and unpacking bits. - * - * The data goes into a NumPy array object (multiarray) - * - * It is basically an implemetation of read and write with the data - * going directly into a NumPy array - * - * Permission is granted to use this program however you see fit, but I give - * no guarantees as to its usefulness or reliability. You assume full - * responsibility for using this program. - * - * Thanks to Michael A. Miller - * whose TableIO packages helped me learn how - * to write an extension package. I've adapted his Makefile as well. - */ - -#include "Python.h" /* Python header files */ -#include "numpy/arrayobject.h" -/* #include */ -#include - -void rbo(char *, int, int); -void packbits(char *, int, char *, int, int); -void unpackbits(char *, int, char *, int, int, int); -int is_little_endian(void); - -static PyObject *ErrorObject; /* locally-raised exception */ - -#define PYERR(message) do {PyErr_SetString(PyExc_ValueError, message); goto fail;} while(0) -#define DATA(arr) ((arr)->data) -#define DIMS(arr) ((arr)->dimensions) -#define STRIDES(arr) ((arr)->strides) -#define ELSIZE(arr) ((arr)->descr->elsize) -#define OBJECTTYPE(arr) ((arr)->descr->type_num) -#define BASEOBJ(arr) ((PyArrayObject *)((arr)->base)) -#define RANK(arr) ((arr)->nd) -#define ISCONTIGUOUS(m) ((m)->flags & NPY_CONTIGUOUS) - -#define PYSETERROR(message) \ -{ PyErr_SetString(ErrorObject, message); goto fail; } - -#define INCREMENT(ret_ind, nd, max_ind) \ -{ \ - int k; \ - k = (nd) - 1; \ - if (++(ret_ind)[k] >= (max_ind)[k]) { \ - while (k >= 0 && ((ret_ind)[k] >= (max_ind)[k]-1)) \ - (ret_ind)[k--] = 0; \ - if (k >= 0) (ret_ind)[k]++; \ - else (ret_ind)[0] = (max_ind)[0]; \ - } \ -} - -#define CALCINDEX(indx, nd_index, strides, ndim) \ -{ \ - int i; \ - \ - indx = 0; \ - for (i=0; i < (ndim); i++) \ - indx += nd_index[i]*strides[i]; \ -} - -static PyObject * - numpyio_fromfile(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyObject *file; - PyArrayObject *arr=NULL; - PyArray_Descr *indescr=NULL; - void *ibuff=NULL; - int myelsize; - int ibuff_cleared = 1; - long n,nread; - char read_type; - FILE *fp; - char dobyteswap = 0; - int swap_factor; - char out_type = 124; /* set to unused value */ - PyArray_VectorUnaryFunc *castfunc; - - if (!PyArg_ParseTuple( args, "Olc|cb" , &file, &n, &read_type, &out_type, &dobyteswap )) - return NULL; - - if (out_type == 124) - out_type = read_type; - - fp = PyFile_AsFile(file); - - if (fp == NULL) { - PYSETERROR("First argument must be an open file"); - } - - if (n <= 0) { - PYSETERROR("Second argument (number of bytes to read) must be positive."); - } - /* Make a 1-D NumPy array of type read_type with n elements */ - - if ((arr = (PyArrayObject *)PyArray_SimpleNew(1,(npy_intp*)&n,out_type)) == NULL) - return NULL; - - if (arr->descr->elsize == 0) { - PYSETERROR("Does not support variable types."); - } - - /* Read the data into the array from the file */ - if (out_type == read_type) { - ibuff = arr -> data; - myelsize = arr -> descr -> elsize; - } - else { /* Alocate a storage buffer for data read in */ - indescr = PyArray_DescrFromType((int ) read_type); - if (indescr == NULL) goto fail; - if (indescr->elsize == 0) { - PYSETERROR("Does not support variable types."); - } - if (PyTypeNum_ISEXTENDED(indescr->type_num)) { - PyErr_SetString(PyExc_ValueError, - "Does not support extended types."); - goto fail; - } - myelsize = indescr -> elsize; - ibuff = malloc(myelsize*n); - castfunc = indescr->f->cast[arr->descr->type_num]; - Py_DECREF(indescr); - indescr=NULL; - if (ibuff == NULL) - PYSETERROR("Could not allocate memory for type casting") - ibuff_cleared = 0; - } - - nread = fread(ibuff,myelsize,n,fp); - if (ferror(fp)) { - clearerr(fp); - PYSETERROR("There was an error reading from the file"); - } - - /* Check to see correct number of bytes were read. If not, then - resize the array to the number of bytes actually read in. - */ - - if (nread < n) { - fprintf(stderr,"Warning: %ld bytes requested, %ld bytes read.\n", n, nread); - arr->dimensions[0] = nread; - arr->data = realloc(arr->data,arr->descr->elsize*nread); - } - - if (dobyteswap) { - swap_factor = ((read_type=='F' || read_type=='D') ? 2 : 1); - rbo(ibuff,myelsize/swap_factor,nread*swap_factor); - } - - if (out_type != read_type) { /* We need to type_cast it */ - castfunc(ibuff, arr->data, nread, NULL, NULL); - free(ibuff); - ibuff_cleared = 1; - } - - return PyArray_Return(arr); - - fail: - Py_XDECREF(indescr); - if (!ibuff_cleared) free(ibuff); - Py_XDECREF(arr); - return NULL; - -} - -static int write_buffered_output(FILE *fp, PyArrayObject *arr, PyArray_Descr* outdescr, char *buffer, int buffer_size, int bswap) { - - /* INITIALIZE N-D index */ - - /* Loop over the N-D index filling the buffer with the data in arr - (indexed correctly using strides) - Each time dimension subdim is about to roll - write the buffer to disk and fill it again. */ - - char *buff_ptr, *output_ptr; - int nwrite, *nd_index, indx; - int buffer_size_bytes, elsize; - - buff_ptr = buffer; - nd_index = (int *)calloc(arr->nd,sizeof(int)); - if (NULL == nd_index) { - PyErr_SetString(ErrorObject,"Could not allocate memory for index array."); - return -1; - } - buffer_size_bytes = buffer_size * arr->descr->elsize; - while(nd_index[0] != arr->dimensions[0]) { - CALCINDEX(indx,nd_index,arr->strides,arr->nd); - memcpy(buff_ptr, arr->data+indx, arr->descr->elsize); - buff_ptr += arr->descr->elsize; - INCREMENT(nd_index,arr->nd,arr->dimensions); - if ((buff_ptr - buffer) >= buffer_size_bytes) { - buff_ptr = buffer; - - if (outdescr->type != arr->descr->type) { /* Cast to new type before writing */ - output_ptr = buffer + buffer_size_bytes; - (arr->descr->f->cast[outdescr->type_num])(buffer,output_ptr,buffer_size,NULL, NULL); - elsize = outdescr->elsize; - } - else { - output_ptr = buffer; - elsize = arr->descr->elsize; - } - if (bswap) { - rbo((char *)output_ptr, elsize, buffer_size); - } - - nwrite = fwrite(output_ptr, elsize, buffer_size, fp); - - if (ferror(fp)) { - clearerr(fp); - PyErr_SetString(ErrorObject,"There was an error writing to the file"); - return -1; - } - if (nwrite < buffer_size) { - fprintf(stderr,"Warning: %d of %d specified bytes written.\n",nwrite, buffer_size); - } - } - - } - return 0; -} - -static PyObject * - numpyio_tofile(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyObject *file; - PyArrayObject *arr = NULL; - PyObject *obj; - PyArray_Descr *outdescr=NULL; - void *obuff = NULL; - long n, k, nwrite, maxN, elsize_bytes; - int myelsize, buffer_size; - FILE *fp; - char *buffer = NULL; - char dobyteswap = 0; - int swap_factor = 1; - char ownalloc = 0; - char write_type = 124; - - if (!PyArg_ParseTuple( args, "OlO|cb" , &file, &n, &obj, &write_type, &dobyteswap)) - return NULL; - - fp = PyFile_AsFile(file); - - if (fp == NULL) { - PYSETERROR("First argument must be an open file"); - } - - if (!PyArray_Check(obj)) { - PYSETERROR("Third argument must be a NumPy array."); - } - - if (PyArray_ISEXTENDED(obj)) { - PYSETERROR("Does not support extended types."); - } - - maxN = PyArray_SIZE((PyArrayObject *)obj); - if (n > maxN) - PYSETERROR("The NumPy array does not have that many elements."); - - if (((PyArrayObject *)obj)->descr->type_num == PyArray_OBJECT) - PYSETERROR("Cannot write an object array."); - - if (!PyArray_ISCONTIGUOUS((PyArrayObject *)obj)) { - arr = (PyArrayObject *)PyArray_CopyFromObject(obj,((PyArrayObject *)obj) -> descr -> type_num, 0, 0); - if (NULL == arr) { /* Memory allocation failed - Write out buffered data using strides info */ - arr = (PyArrayObject *)obj; - Py_INCREF(arr); - if (write_type == 124) - write_type = arr -> descr -> type; - - if (write_type != arr -> descr -> type) { - outdescr = PyArray_DescrFromType((int) write_type); - if (outdescr == NULL) goto fail; - elsize_bytes = (outdescr->elsize + arr->descr->elsize); /* allocate space for buffer and casted buffer */ - } - else { - outdescr = arr->descr; - Py_INCREF(outdescr); - elsize_bytes = (arr->descr->elsize); - } - k = 0; - do { - k++; - buffer_size = PyArray_MultiplyList(arr->dimensions + k, arr->nd - k); - buffer = (char *)malloc(elsize_bytes*buffer_size); - } - while ((NULL == buffer) && (k < arr->nd - 1)); - - if (NULL == buffer) /* Still NULL no size was small enough */ - PYSETERROR("Could not allocate memory for any attempted output buffer size."); - - /* Write a buffered output */ - - if (write_buffered_output(fp, (PyArrayObject *)obj, outdescr, buffer, buffer_size, dobyteswap) < 0) { - free(buffer); - goto fail; - } - free(buffer); - Py_DECREF(outdescr); - Py_DECREF(arr); - Py_INCREF(Py_None); - return Py_None; - } - } - else { - arr = (PyArrayObject *)obj; - Py_INCREF(arr); - } - - /* Write the array to file (low-level data transfer) */ - if (n > 0) { - - if (write_type == 124) /* Wasn't specified: use input type */ - write_type = arr -> descr -> type; - - if (write_type == arr -> descr -> type) { /* point output buffer to data */ - obuff = arr -> data; - myelsize = arr -> descr -> elsize; - } - else { - if ((outdescr = PyArray_DescrFromType((int ) write_type)) == NULL) - goto fail; - myelsize = outdescr -> elsize; - obuff = malloc(n*myelsize); - if (obuff == NULL) - PYSETERROR("Could not allocate memory for type-casting"); - ownalloc = 1; - (arr->descr->f->cast[(int)outdescr->type_num])(arr->data,obuff,n,NULL,NULL); - Py_DECREF(outdescr); - outdescr=NULL; - } - /* Write the data from the array to the file */ - if (dobyteswap) { - swap_factor = ((write_type=='F' || write_type=='D') ? 2 : 1); - rbo((char *)obuff,myelsize/swap_factor,n*swap_factor); - } - - nwrite = fwrite(obuff,myelsize,n,fp); - - if (dobyteswap) { /* Swap data in memory back if allocated obuff */ - if (write_type == arr -> descr -> type) /* otherwise we changed obuff only */ - rbo(arr->data,arr->descr->elsize/swap_factor,PyArray_SIZE(arr)*swap_factor); - } - - if (ferror(fp)) { - clearerr(fp); - PYSETERROR("There was an error writing to the file"); - } - if (nwrite < n) { - fprintf(stderr,"Warning: %ld of %ld specified bytes written.\n",nwrite,n); - } - } - - if (ownalloc == 1) { - free(obuff); - } - - Py_DECREF(arr); - Py_INCREF(Py_None); - return Py_None; - - fail: - Py_XDECREF(outdescr); - if (ownalloc == 1) free(obuff); - Py_XDECREF(arr); - return NULL; - -} - -static PyObject * - numpyio_byteswap(PyObject *self, PyObject *args) /* args: number of bytes and type */ -{ - PyArrayObject *arr = NULL; - PyObject *obj; - int type; - - if (!PyArg_ParseTuple( args, "O" , &obj)) - return NULL; - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - rbo(arr->data,arr->descr->elsize,PyArray_SIZE(arr)); - - return PyArray_Return(arr); -} - -static PyObject * - numpyio_pack(PyObject *self, PyObject *args) /* args: in */ -{ - PyArrayObject *arr = NULL, *out = NULL; - PyObject *obj; - int els_per_slice; - int out_size; - int type; - - if (!PyArg_ParseTuple( args, "O" , &obj)) - return NULL; - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - if (arr->descr->type_num > PyArray_LONG) - PYSETERROR("Expecting an input array of integer type (no floats)."); - - /* Get size information from input array and make a 1-D output array of bytes */ - - els_per_slice = arr->dimensions[arr->nd - 1]; - if (arr->nd > 1) - els_per_slice = els_per_slice * arr->dimensions[arr->nd - 2]; - - out_size = (PyArray_SIZE(arr)/els_per_slice)*ceil ( (float) els_per_slice / 8); - - if ((out = (PyArrayObject *)PyArray_SimpleNew(1,&out_size,PyArray_UBYTE))==NULL) { - goto fail; - } - - packbits(arr->data,arr->descr->elsize,out->data,PyArray_SIZE(arr),els_per_slice); - - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(arr); - return NULL; - -} - -static PyObject * - numpyio_unpack(PyObject *self, PyObject *args) /* args: in, out_type */ -{ - PyArrayObject *arr = NULL, *out=NULL; - PyObject *obj; - int els_per_slice, arrsize; - int out_size, type; - char out_type = 'b'; - - if (!PyArg_ParseTuple( args, "Oi|c" , &obj, &els_per_slice, &out_type)) - return NULL; - - if (els_per_slice < 1) - PYSETERROR("Second argument is elements_per_slice and it must be >= 1."); - - type = PyArray_ObjectType(obj,0); - if ((arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj,type,0,0)) == NULL) - return NULL; - - arrsize = PyArray_SIZE(arr); - - if ((arrsize % (int) (ceil( (float) els_per_slice / 8))) != 0) - PYSETERROR("That cannot be the number of elements per slice for this array size."); - - if (arr->descr->type_num > PyArray_LONG) - PYSETERROR("Can only unpack arrays that are of integer type."); - - /* Make an 1-D output array of type out_type */ - - out_size = els_per_slice * arrsize / ceil( (float) els_per_slice / 8); - - if ((out = (PyArrayObject *)PyArray_SimpleNew(1,&out_size,out_type))==NULL) - goto fail; - - if (out->descr->type_num > PyArray_LONG) { - PYSETERROR("Can only unpack bits into integer type."); - } - - unpackbits(arr->data,arr->descr->elsize,out->data,out->descr->elsize,out_size,els_per_slice); - - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(out); - Py_XDECREF(arr); - return NULL; -} - - -static char fread_doc[] = -"g = numpyio.fread( fid, Num, read_type { mem_type, byteswap})\n\n" -" fid = open file pointer object (i.e. from fid = open('filename') )\n" -" Num = number of elements to read of type read_type\n" -" read_type = a character in 'cb1silfdFD' (PyArray types)\n" -" describing how to interpret bytes on disk.\nOPTIONAL\n" -" mem_type = a character (PyArray type) describing what kind of\n" -" PyArray to return in g. Default = read_type\n" -" byteswap = 0 for no byteswapping or a 1 to byteswap (to handle\n" -" different endianness). Default = 0."; - -static char fwrite_doc[] = -"numpyio.fwrite( fid, Num, myarray { write_type, byteswap} )\n\n" -" fid = open file stream\n" -" Num = number of elements to write\n" -" myarray = NumPy array holding the data to write (will be\n" -" written as if ravel(myarray) was passed)\nOPTIONAL\n" -" write_type = character ('cb1silfdFD') describing how to write the\n" -" data (what datatype to use) Default = type of\n" -" myarray.\n" -" byteswap = 0 or 1 to determine if byteswapping occurs on write.\n" -" Default = 0."; - -static char bswap_doc[] = -" out = numpyio.bswap(myarray)\n\n" -" myarray = an array whose elements you want to byteswap.\n" -" out = a reference to byteswapped myarray.\n\n" -" This does an inplace byte-swap so that myarray is changed in\n" -" memory."; - -static char packbits_doc[] = -"out = numpyio.packbits(myarray)\n\n" -" myarray = an array whose (assumed binary) elements you want to\n" -" pack into bits (must be of integer type, 'cb1sl')\n\n" -" This routine packs the elements of a binary-valued dataset into a\n" -" 1-D NumPy array of type PyArray_UBYTE ('b') whose bits correspond to\n" -" the logical (0 or nonzero) value of the input elements. \n\n" -" If myarray has more dimensions than 2 it packs each slice (rows*columns)\n" -" separately. The number of elements per slice (rows*columns) is\n" -" important to know to be able to unpack the data later.\n\n" -" Example:\n" -" >>> a = array([[[1,0,1],\n" -" ... [0,1,0]],\n" -" ... [[1,1,0],\n" -" ... [0,0,1]]])\n" -" >>> b = numpyio.packbits(a)\n" -" >>> b\n" -" array([168, 196], 'b')\n\n" -" Note that 168 = 128 + 32 + 8\n" -" 196 = 128 + 64 + 4"; - -static char unpackbits_doc[] = -"out = numpyio.unpackbits(myarray, elements_per_slice {, out_type} )\n\n" -" myarray = Array of integer type ('cb1sl') whose least\n" -" significant byte is a bit-field for the\n" -" resulting output array.\n\n" -" elements_per_slice = Necessary for interpretation of myarray.\n" -" This is how many elements in the\n " -" rows*columns of original packed structure.\n\nOPTIONAL\n" -" out_type = The type of output array to populate with 1's\n" -" and 0's. Must be an integer type.\n\n\nThe output array\n" -" will be a 1-D array of 1's and zero's"; - - -#define BUFSIZE 256 -/* Convert a Python string object to a complex number */ -static int convert_from_object(PyObject *obj, Py_complex *cnum) -{ - PyObject *res=NULL, *elobj=NULL; - PyObject *newstr=NULL, *finalobj=NULL, *valobj=NULL; - char strbuffer[2*BUFSIZE]; - char *xptr, *elptr; - char *newstrbuff, thischar; - char buffer[BUFSIZE]; - char validnum[] = "0123456789.eE+-"; - int validlen = 15; - int inegflag = 1; - int rnegflag = 1; - int n, k, m, i, elN, size, state, count; - double val; - - if (!PyString_Check(obj)) return -1; - - /* strip string */ - newstr = PyObject_CallMethod(obj, "strip", NULL); - if (newstr == NULL) goto fail; - - /* Replace any 'e+' or 'e-' */ - size = PyString_GET_SIZE(newstr); - newstrbuff = PyString_AsString(newstr); - if (newstrbuff == NULL) goto fail; - if (size > 2*BUFSIZE) PYERR("String too large."); - - state = 0; - count = 0; - for (k=0; k BUFSIZE)) - PYSETERROR("String too large."); - - /* Replace back the + and - and strip away invalid characters */ - elptr = PyString_AsString(elobj); - m = 0; - for (n=0; n < elN; n++) { - thischar = elptr[n]; - if (thischar == '\254') - buffer[m++] = '+'; - else if (thischar == '\253') - buffer[m++] = '-'; - else { - for (i=0; i< validlen; i++) { - if (thischar == validnum[i]) break; - } - if (i < validlen) buffer[m++] = thischar; - } - } - finalobj = PyString_FromStringAndSize(buffer, m); - if (finalobj == NULL) goto fail; - valobj = PyFloat_FromString(finalobj, NULL); /* Try to make a float */ - if (valobj == NULL) goto fail; - val = PyFloat_AsDouble(valobj); - if (PyErr_Occurred()) goto fail; - Py_DECREF(finalobj); - Py_DECREF(valobj); - Py_DECREF(elobj); - if (k==0) { - cnum->real = val*rnegflag; - } - else { - cnum->imag = val*inegflag; - } - - } - Py_DECREF(newstr); - Py_DECREF(res); - return 0; - - fail: - Py_XDECREF(res); - Py_XDECREF(elobj); - Py_XDECREF(newstr); - Py_XDECREF(finalobj); - Py_XDECREF(valobj); - return -1; -} - - - -static int PyTypeFromChar(char ctype) -{ - switch(ctype) { - case 'c': return PyArray_CHAR; - case 'b': return PyArray_UBYTE; - case '1': return PyArray_BYTE; - case 's': return PyArray_SHORT; - case 'i': return PyArray_INT; -#ifdef PyArray_UNSIGNED_TYPES - case 'u': return PyArray_UINT; - case 'w': return PyArray_USHORT; -#endif - case 'l': return PyArray_LONG; - case 'f': return PyArray_FLOAT; - case 'd': return PyArray_DOUBLE; - case 'F': return PyArray_CFLOAT; - case 'D': return PyArray_CDOUBLE; - case 'O': return PyArray_OBJECT; - } - return PyArray_NOTYPE; -} - - -static PyObject * - numpyio_convert_objects(PyObject *self, PyObject *args) -{ - PyObject *obj = NULL, *missing_val = NULL; - PyArrayObject *arr = NULL, *out=NULL; - PyArrayObject *missing_arr = NULL; - PyArray_Descr *descr; - PyObject *builtins, *dict; - char out_type; - int int_type, i, err; - char *outptr; - PyObject **arrptr; - PyObject *numobj=NULL; - PyObject *comp_obj; - Py_complex numc; - PyArray_VectorUnaryFunc *funcptr; - - if (!PyArg_ParseTuple( args, "Oc|O" , &obj, &out_type, &missing_val)) - return NULL; - - if (missing_val == NULL) { - missing_val = PyInt_FromLong(0); - } - else { - Py_INCREF(missing_val); /* Increment missing_val for later DECREF */ - } - - int_type = PyTypeFromChar(out_type); - if ((int_type == PyArray_NOTYPE) || (int_type == PyArray_OBJECT) || \ - PyTypeNum_ISEXTENDED(int_type)) - PYERR("Invalid output type."); - - missing_arr = (PyArrayObject *)PyArray_ContiguousFromObject(missing_val, - int_type, 0, 0); - Py_DECREF(missing_val); - missing_val = NULL; /* So later later failures don't decrement it */ - - if ((missing_arr == NULL)) goto fail; - if ((RANK(missing_arr) > 0)) PYERR("Missing value must be as scalar"); - - arr = (PyArrayObject *)PyArray_ContiguousFromObject(obj, PyArray_OBJECT, - 0, 0); - if (arr == NULL) goto fail; - - out = (PyArrayObject *)PyArray_SimpleNew(RANK(arr), DIMS(arr), int_type); - if (out == NULL) goto fail; - - /* Get the builtin_functions from the builtin module */ - builtins = PyImport_AddModule("__builtin__"); - if (builtins == NULL) goto fail; - - dict = PyModule_GetDict(builtins); - comp_obj = PyDict_GetItemString(dict, "complex"); - if (comp_obj == NULL) goto fail; - - /* get_complex = PyDict_GetItemString(dict, "complex"); - get_float = PyDict_GetItemString(dict, "float"); - get_int = PyDict_GetItemString(dict, "int"); - if ((get_complex == NULL) || (get_float == NULL) || (get_int == NULL) ) goto fail; - */ - /* - get_complex_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "complex")); - get_float_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "float")); - get_int_self = PyCFunction_GetSelf(PyDict_GetItemString(dict, "int")); - */ - - /* Loop through arr and convert each element and place in out */ - i = PyArray_Size((PyObject *)arr); - arrptr = ((PyObject **)DATA(arr)) - 1; - outptr = (DATA(out)) - ELSIZE(out); - - descr = PyArray_DescrFromType(PyArray_CDOUBLE); - funcptr = descr->f->cast[int_type]; - Py_DECREF(descr); - - while (i--) { - outptr += ELSIZE(out); - arrptr += 1; - numc.real = 0; - numc.imag = 0; - numobj = PyObject_CallFunction(comp_obj, "O", *arrptr); - if (numobj != NULL) { - numc = PyComplex_AsCComplex(numobj); - Py_DECREF(numobj); - } - if (PyErr_Occurred()) { /* Use our own homegrown converter... */ - PyErr_Clear(); - err = convert_from_object(*arrptr, &numc); - if (PyErr_Occurred()) PyErr_Clear(); - if (err < 0) { /* Nothing works fill with missing value... */ - memcpy(outptr, DATA(missing_arr), ELSIZE(out)); - } - } - /* Place numc into the array */ - funcptr((void *)&(numc.real), (void *)outptr, 1, NULL, NULL); - } - - Py_DECREF(missing_arr); - Py_DECREF(arr); - return PyArray_Return(out); - - fail: - Py_XDECREF(out); - Py_XDECREF(arr); - Py_XDECREF(missing_arr); - Py_XDECREF(missing_val); - return NULL; -} - - -static char convert_objects_doc[] = -"convert_objectarray(myarray, arraytype{, missing_value} ) -> out \n\n" -" myarray = Sequence of strings.\n" -" arraytype = Type of output array.\n" -" missing_value = Value to insert when conversion fails."; - -/* *************************************************************************** */ -/* Method registration table: name-string -> function-pointer */ - -static struct PyMethodDef numpyio_methods[] = { - {"fread", numpyio_fromfile, 1, fread_doc}, - {"fwrite", numpyio_tofile, 1, fwrite_doc}, - {"bswap", numpyio_byteswap, 1, bswap_doc}, - {"packbits", numpyio_pack, 1, packbits_doc}, - {"unpackbits", numpyio_unpack, 1, unpackbits_doc}, - {"convert_objectarray", numpyio_convert_objects, 1, convert_objects_doc}, - {NULL, NULL} -}; - -PyMODINIT_FUNC initnumpyio(void) -{ - PyObject *m, *d; - - import_array(); /* allows multiarray to be a shared library (I think) */ - /* Should be defined in arrayobject.h */ - - /* create the module and add the functions */ - m = Py_InitModule("numpyio", numpyio_methods); /* registration hook */ - - /* add symbolic constants to the module */ - d = PyModule_GetDict(m); - ErrorObject = Py_BuildValue("s", "numpyio.error"); /* export exception */ - PyDict_SetItemString(d, "error", ErrorObject); /* add more if need */ - -} - -/**********************************************************/ -/* */ -/* SYNOPSIS: rbo(data, bpe, nel) ; */ -/* where: */ -/* nel..... number of array elements */ -/* data.... pointer to the first byte in the */ -/* array */ -/* bpe..... bytes per array element */ -/* */ -/* PURPOSE: convert data from little to big endian (and */ -/* visa-versa) */ -/* */ -/**********************************************************/ - -void rbo(char * data, int bpe, int nel) -{ - int nswaps, i,j; /* number of swaps to make per element */ - char tmp; /* temporary storage for swapping */ - long int p1, p2; /* indexes for elements to be swapped */ - - nswaps = bpe / 2; /* divide element size by two */ - if (nswaps == 0) return; /* return if it is a byte array */ - - p1 = 0; - for ( i=0; i 0); /* add to this bit if the input value is non-zero */ - } - if (index == out_bytes - 1) build <<= (8-remain); - /* printf("Here: %d %d %d %d\n",build,slice,index,maxi); - */ - *(outptr++) = build; - } - } - return; -} - - -void unpackbits( - char In[], - int in_element_size, - char Out[], - int element_size, - int total_elements, - int els_per_slice - ) -{ - unsigned char mask; - int i,index,slice,slices,out_bytes; - int maxi, remain; - char *outptr,*inptr; - - outptr = Out; - inptr = In; - if (is_little_endian()) { - fprintf(stderr,"This is a little-endian machine.\n"); - } - else { - fprintf(stderr,"This is a big-endian machine.\n"); - outptr += (element_size - 1); - inptr += (in_element_size - 1); - } - slices = total_elements / els_per_slice; - out_bytes = ceil( (float) els_per_slice / 8); - remain = els_per_slice % 8; - if (remain == 0) remain = 8; - /* printf("Start: %d %d %d %d %d\n",inM,MN,slices,out_bytes,remain); - */ - for (slice = 0; slice < slices; slice++) { - for (index = 0; index < out_bytes; index++) { - maxi = (index != out_bytes - 1 ? 8 : remain); - mask = 128; - for (i = 0; i < maxi ; i++) { - *outptr = ((mask & (unsigned char)(*inptr)) > 0); - outptr += element_size; - mask >>= 1; - } - /* printf("Here: %d %d %d %d\n",build,slice,index,maxi); - */ - inptr += in_element_size; - } - } - return; -} - -int is_little_endian() -{ /* high low */ - short testnum = 1; /* If little endian it will be 0x00 0x01 */ - /* If big endian it will be 0x01 0x00 */ - void *testptr; - char *myptr; - - testptr = (void *)(&testnum); /* Assumes address gives low-byte in memory */ - myptr = (char*)testptr; - - return (*(myptr) == 1); - -} - - Modified: branches/0.8.x/scipy/io/setup.py =================================================================== --- branches/0.8.x/scipy/io/setup.py 2010-06-18 13:10:38 UTC (rev 6530) +++ branches/0.8.x/scipy/io/setup.py 2010-06-18 13:10:56 UTC (rev 6531) @@ -4,9 +4,6 @@ from numpy.distutils.misc_util import Configuration config = Configuration('io', parent_package, top_path) - config.add_extension('numpyio', - sources = ['numpyiomodule.c']) - config.add_data_dir('tests') config.add_data_dir('examples') config.add_data_dir('docs') From scipy-svn at scipy.org Fri Jun 18 09:11:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:11:16 -0500 (CDT) Subject: [Scipy-svn] r6532 - in branches/0.8.x/scipy/io: . examples Message-ID: <20100618131116.A399C39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:11:16 -0500 (Fri, 18 Jun 2010) New Revision: 6532 Removed: branches/0.8.x/scipy/io/examples/read_array_demo1.py branches/0.8.x/scipy/io/examples/test.txt Modified: branches/0.8.x/scipy/io/setup.py branches/0.8.x/scipy/io/setupscons.py Log: Remove example using removed functions from scipy.io. Deleted: branches/0.8.x/scipy/io/examples/read_array_demo1.py =================================================================== --- branches/0.8.x/scipy/io/examples/read_array_demo1.py 2010-06-18 13:10:56 UTC (rev 6531) +++ branches/0.8.x/scipy/io/examples/read_array_demo1.py 2010-06-18 13:11:16 UTC (rev 6532) @@ -1,58 +0,0 @@ -#========================================================================= -# NAME: read_array_demo1 -# -# DESCRIPTION: Examples to read 2 columns from a multicolumn ascii text -# file, skipping the first line of header. First example reads into -# 2 separate arrays. Second example reads into a single array. Data are -# then plotted. -# -# Here is the format of the file test.txt: -# -------- -# Some header to skip -# 1 2 3 -# 2 4 6 -# 3 6 9 -# 4 8 12 -# -# USAGE: -# python read_array_demo1.py -# -# PARAMETERS: -# -# DEPENDENCIES: -# matplotlib (pylab) -# test.txt -# -# -# AUTHOR: Simon J. Hook -# DATE : 09/23/2005 -# -# MODIFICATION HISTORY: -# -# COMMENT: -# -#============================================================================ - -from scipy import * -from scipy.io import read_array -from pylab import * - -def main(): - - # First example, read first and second column from ascii file. Skip first - # line of header. - # Note use of (1,-1) in lines to skip first line and then read to end of file - # Note use of (0,) in columns to pick first column, since its a tuple need trailing comma - x=read_array("test.txt",lines=(1,-1), columns=(0,)) - y=read_array("test.txt",lines=(1,-1), columns=(1,)) - - #Second example, read the file into a single arry - z=read_array("test.txt",lines=(1,-1), columns=(0,2)) - - # Plot the data - plot(x,y,'r--',z[:,0],z[:,1]) - show() - -# The one and only main function -if __name__ == "__main__": - main() Deleted: branches/0.8.x/scipy/io/examples/test.txt =================================================================== --- branches/0.8.x/scipy/io/examples/test.txt 2010-06-18 13:10:56 UTC (rev 6531) +++ branches/0.8.x/scipy/io/examples/test.txt 2010-06-18 13:11:16 UTC (rev 6532) @@ -1,5 +0,0 @@ -some header to skip -1 2 3 -2 4 6 -3 6 9 -4 8 12 \ No newline at end of file Modified: branches/0.8.x/scipy/io/setup.py =================================================================== --- branches/0.8.x/scipy/io/setup.py 2010-06-18 13:10:56 UTC (rev 6531) +++ branches/0.8.x/scipy/io/setup.py 2010-06-18 13:11:16 UTC (rev 6532) @@ -5,7 +5,6 @@ config = Configuration('io', parent_package, top_path) config.add_data_dir('tests') - config.add_data_dir('examples') config.add_data_dir('docs') config.add_subpackage('matlab') config.add_subpackage('arff') Modified: branches/0.8.x/scipy/io/setupscons.py =================================================================== --- branches/0.8.x/scipy/io/setupscons.py 2010-06-18 13:10:56 UTC (rev 6531) +++ branches/0.8.x/scipy/io/setupscons.py 2010-06-18 13:11:16 UTC (rev 6532) @@ -7,7 +7,6 @@ config.add_sconscript('SConstruct') config.add_data_dir('tests') - config.add_data_dir('examples') config.add_data_dir('docs') config.add_subpackage('matlab') config.add_subpackage('arff') From scipy-svn at scipy.org Fri Jun 18 09:11:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:11:33 -0500 (CDT) Subject: [Scipy-svn] r6533 - branches/0.8.x/scipy/io Message-ID: <20100618131133.65AFD39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:11:33 -0500 (Fri, 18 Jun 2010) New Revision: 6533 Modified: branches/0.8.x/scipy/io/SConscript Log: Remove numpyiomodule from io SConscript file. Modified: branches/0.8.x/scipy/io/SConscript =================================================================== --- branches/0.8.x/scipy/io/SConscript 2010-06-18 13:11:16 UTC (rev 6532) +++ branches/0.8.x/scipy/io/SConscript 2010-06-18 13:11:33 UTC (rev 6533) @@ -3,5 +3,3 @@ from numscons import GetNumpyEnvironment env = GetNumpyEnvironment(ARGUMENTS) - -env.NumpyPythonExtension('numpyio', source = 'numpyiomodule.c') From scipy-svn at scipy.org Fri Jun 18 09:11:48 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:11:48 -0500 (CDT) Subject: [Scipy-svn] r6534 - branches/0.8.x/scipy/io Message-ID: <20100618131148.2F21A39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:11:47 -0500 (Fri, 18 Jun 2010) New Revision: 6534 Modified: branches/0.8.x/scipy/io/setupscons.py Log: BUG: Correctly build io.matlab extensions with numscons. Modified: branches/0.8.x/scipy/io/setupscons.py =================================================================== --- branches/0.8.x/scipy/io/setupscons.py 2010-06-18 13:11:33 UTC (rev 6533) +++ branches/0.8.x/scipy/io/setupscons.py 2010-06-18 13:11:47 UTC (rev 6534) @@ -2,7 +2,8 @@ def configuration(parent_package='',top_path=None): from numpy.distutils.misc_util import Configuration - config = Configuration('io', parent_package, top_path) + config = Configuration('io', parent_package, top_path, + setup_name = 'setupscons.py') config.add_sconscript('SConstruct') From scipy-svn at scipy.org Fri Jun 18 09:12:06 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:12:06 -0500 (CDT) Subject: [Scipy-svn] r6535 - in branches/0.8.x/scipy/io: . tests Message-ID: <20100618131206.1D7DC39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 08:12:05 -0500 (Fri, 18 Jun 2010) New Revision: 6535 Modified: branches/0.8.x/scipy/io/recaster.py branches/0.8.x/scipy/io/tests/test_recaster.py Log: Deprecate io.recaster module. Modified: branches/0.8.x/scipy/io/recaster.py =================================================================== --- branches/0.8.x/scipy/io/recaster.py 2010-06-18 13:11:47 UTC (rev 6534) +++ branches/0.8.x/scipy/io/recaster.py 2010-06-18 13:12:05 UTC (rev 6535) @@ -5,9 +5,20 @@ """ from numpy import * +from numpy.lib.utils import deprecate +# deprecated in 0.8, will be removed in 0.9. + at deprecate def sctype_attributes(): - ''' Return dictionary describing numpy scalar types ''' + """Return dictionary describing numpy scalar types + + .. deprecated:: sctype_attributes is deprecated in scipy 0.8 and + will be removed in scipy 0.9. + """ + return _sctype_attributes() + + +def _sctype_attributes(): d_dict = {} for sc_type in ('complex','float'): t_list = sctypes[sc_type] @@ -46,9 +57,13 @@ class RecastError(ValueError): pass +# deprecated in 0.8, will be removed in 0.9. class Recaster(object): ''' Class to recast arrays to one of acceptable scalar types + .. deprecated:: Recaster is deprecated in scipy 0.8 and will be + removed in scipy 0.9. + Initialization specifies acceptable types (ATs) Implements recast method - returns array that may be of different @@ -58,7 +73,7 @@ specified in options at object creation. ''' - _sctype_attributes = sctype_attributes() + _sctype_attributes = _sctype_attributes() _k = 2**10 _option_defaults = { 'only_if_none': { @@ -107,6 +122,7 @@ } } + @deprecate def __init__(self, sctype_list=None, sctype_tols=None, recast_options='only_if_none'): Modified: branches/0.8.x/scipy/io/tests/test_recaster.py =================================================================== --- branches/0.8.x/scipy/io/tests/test_recaster.py 2010-06-18 13:11:47 UTC (rev 6534) +++ branches/0.8.x/scipy/io/tests/test_recaster.py 2010-06-18 13:12:05 UTC (rev 6535) @@ -1,3 +1,5 @@ +import warnings + import numpy as np from numpy.testing import * @@ -167,5 +169,7 @@ assert dtt is outp, \ 'Expected %s from %s, got %s' % (outp, inp, dtt) +warnings.simplefilter('ignore', category=DeprecationWarning) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Fri Jun 18 09:37:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:37:23 -0500 (CDT) Subject: [Scipy-svn] r6536 - branches/0.8.x/doc/release Message-ID: <20100618133723.2773839CAEE@scipy.org> Author: rgommers Date: 2010-06-18 08:37:22 -0500 (Fri, 18 Jun 2010) New Revision: 6536 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst Log: DOC: Update release notes with removed and deprecated code in scipy.io. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-18 13:12:05 UTC (rev 6535) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-18 13:37:22 UTC (rev 6536) @@ -74,6 +74,7 @@ * Passing the coefficients of a polynomial as the argument `f0` to `signal.chirp` is deprecated. Use the function `signal.sweep_poly` instead. +* The `io.recaster` module has been deprecated and will be removed in 0.9.0. New features ============ @@ -218,4 +219,19 @@ The module `scipy.misc.limits` was removed. +scipy.io +-------- +The IO code in both NumPy and SciPy is being extensively +reworked. NumPy will be where basic code for reading and writing NumPy +arrays is located, while SciPy will house file readers and writers for +various data formats (data, audio, video, images, matlab, etc.). + +Several functions in ``scipy.io`` are removed in the 0.8.0 release including: +``npfile``, ``save``, ``load``, ``create_module``, ``create_shelf``, +``objload``, ``objsave``, ``fopen``, ``read_array``, ``write_array``, +``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, and +``convert_objectarray``. Some of these functions have been replaced by NumPy's +raw reading and writing capabilities, memory-mapping capabilities, or array +methods. Others have been moved from SciPy to NumPy, since basic array reading +and writing capability is now handled by NumPy. From scipy-svn at scipy.org Fri Jun 18 09:59:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 08:59:30 -0500 (CDT) Subject: [Scipy-svn] r6537 - branches/0.8.x/scipy/signal/tests Message-ID: <20100618135930.1499339CAEE@scipy.org> Author: rgommers Date: 2010-06-18 08:59:29 -0500 (Fri, 18 Jun 2010) New Revision: 6537 Modified: branches/0.8.x/scipy/signal/tests/test_ltisys.py Log: TST: filter test warning in signal.test_ltisys in 0.8.x branch. Modified: branches/0.8.x/scipy/signal/tests/test_ltisys.py =================================================================== --- branches/0.8.x/scipy/signal/tests/test_ltisys.py 2010-06-18 13:37:22 UTC (rev 6536) +++ branches/0.8.x/scipy/signal/tests/test_ltisys.py 2010-06-18 13:59:29 UTC (rev 6537) @@ -1,3 +1,5 @@ +import warnings + import numpy as np from numpy.testing import assert_almost_equal, assert_equal, run_module_suite @@ -2,2 +4,4 @@ from scipy.signal.ltisys import ss2tf, lsim2, impulse2, step2, lti +# import BadCoefficients so we can filter the warning for lsim2.test_05 +from scipy.signal import BadCoefficients @@ -64,6 +68,7 @@ # This test triggers a "BadCoefficients" warning from scipy.signal.filter_design, # but the test passes. I think the warning is related to the incomplete handling # of multi-input systems in scipy.signal. + warnings.simplefilter("ignore", BadCoefficients) # A system with two state variables, two inputs, and one output. A = np.array([[-1.0, 0.0], [0.0, -2.0]]) From scipy-svn at scipy.org Fri Jun 18 10:14:58 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 09:14:58 -0500 (CDT) Subject: [Scipy-svn] r6538 - branches/0.8.x/scipy/stats/tests Message-ID: <20100618141458.02A2239CAF2@scipy.org> Author: rgommers Date: 2010-06-18 09:14:57 -0500 (Fri, 18 Jun 2010) New Revision: 6538 Modified: branches/0.8.x/scipy/stats/tests/test_morestats.py Log: TST: filter test warning in test_morestats in 0.8.x branch. Modified: branches/0.8.x/scipy/stats/tests/test_morestats.py =================================================================== --- branches/0.8.x/scipy/stats/tests/test_morestats.py 2010-06-18 13:59:29 UTC (rev 6537) +++ branches/0.8.x/scipy/stats/tests/test_morestats.py 2010-06-18 14:14:57 UTC (rev 6538) @@ -1,9 +1,10 @@ # Author: Travis Oliphant, 2002 # +import warnings + from numpy.testing import * - import scipy.stats as stats import numpy as np @@ -122,5 +123,8 @@ assert_array_almost_equal(stats.mood(x1,x1**2), (-1.3830857299399906, 0.16663858066771478), 11) +# First Anssari test yields this warning +warnings.filterwarnings("ignore", "Ties preclude use of exact statistic") + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Fri Jun 18 10:38:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 09:38:19 -0500 (CDT) Subject: [Scipy-svn] r6539 - branches/0.8.x/scipy/interpolate/tests Message-ID: <20100618143819.BFB9539CAE9@scipy.org> Author: rgommers Date: 2010-06-18 09:38:19 -0500 (Fri, 18 Jun 2010) New Revision: 6539 Modified: branches/0.8.x/scipy/interpolate/tests/test_fitpack.py Log: TST: filter test warnings for interpolate.fitpack2 tests in 0.8.x branch. Modified: branches/0.8.x/scipy/interpolate/tests/test_fitpack.py =================================================================== --- branches/0.8.x/scipy/interpolate/tests/test_fitpack.py 2010-06-18 14:14:57 UTC (rev 6538) +++ branches/0.8.x/scipy/interpolate/tests/test_fitpack.py 2010-06-18 14:38:19 UTC (rev 6539) @@ -12,6 +12,8 @@ """ #import libwadpy +import warnings + from numpy.testing import * from numpy import array, diff from scipy.interpolate.fitpack2 import UnivariateSpline, LSQBivariateSpline, \ @@ -163,5 +165,9 @@ assert_almost_equal(zi, zi2) +# filter test_bilinearity and test_integral warnings +warnings.filterwarnings("ignore", "\nThe coefficients of the spline returned") +warnings.filterwarnings("ignore", "\nThe required storage space exceeds") + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Fri Jun 18 11:34:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 10:34:00 -0500 (CDT) Subject: [Scipy-svn] r6540 - in trunk/scipy/io: . tests Message-ID: <20100618153400.ADCAD39CAE9@scipy.org> Author: rgommers Date: 2010-06-18 10:34:00 -0500 (Fri, 18 Jun 2010) New Revision: 6540 Modified: trunk/scipy/io/netcdf.py trunk/scipy/io/tests/test_netcdf.py Log: BUG: netcdf_file.flush() was trying to access non-existing attribute. Modified: trunk/scipy/io/netcdf.py =================================================================== --- trunk/scipy/io/netcdf.py 2010-06-18 14:38:19 UTC (rev 6539) +++ trunk/scipy/io/netcdf.py 2010-06-18 15:34:00 UTC (rev 6540) @@ -4,7 +4,7 @@ This module implements the Scientific.IO.NetCDF API to read and create NetCDF files. The same API is also used in the PyNIO and pynetcdf modules, allowing these modules to be used interchangebly when working -with NetCDF files. The major advantage of ``scipy.io.netcdf`` over other +with NetCDF files. The major advantage of ``scipy.io.netcdf`` over other modules is that it doesn't require the code to be linked to the NetCDF libraries as the other modules do. @@ -28,7 +28,7 @@ and they are stored at the end of the file per record, ie A[0], B[0], ..., A[1], B[1], ..., etc, - + so that new data can be appended to the file without changing its original structure. Non-record data are padded to a 4n bytes boundary. Record data are also padded, unless there is exactly one record variable in the file, @@ -86,7 +86,7 @@ from numpy import little_endian as LITTLE_ENDIAN -ABSENT = '\x00\x00\x00\x00\x00\x00\x00\x00' +ABSENT = '\x00\x00\x00\x00\x00\x00\x00\x00' ZERO = '\x00\x00\x00\x00' NC_BYTE = '\x00\x00\x00\x01' NC_CHAR = '\x00\x00\x00\x02' @@ -193,7 +193,7 @@ def close(self): if not self.fp.closed: try: - self.flush() + self.flush() finally: self.fp.close() __del__ = close @@ -203,7 +203,7 @@ self._dims.append(name) def createVariable(self, name, type, dimensions): - shape = tuple([self.dimensions[dim] for dim in dimensions]) + shape = tuple([self.dimensions[dim] for dim in dimensions]) shape_ = tuple([dim or 0 for dim in shape]) # replace None with 0 for numpy if isinstance(type, basestring): type = dtype(type) @@ -216,7 +216,7 @@ return self.variables[name] def flush(self): - if self.mode is 'w': + if hasattr(self, 'mode') and self.mode is 'w': self._write() sync = flush @@ -266,7 +266,7 @@ self.fp.write(NC_VARIABLE) self._pack_int(len(self.variables)) - # Sort variables non-recs first, then recs. We use a DSU + # Sort variables non-recs first, then recs. We use a DSU # since some people use pupynere with Python 2.3.x. deco = [ (v._shape and not v.isrec, k) for (k, v) in self.variables.items() ] deco.sort() @@ -321,7 +321,7 @@ def _write_var_data(self, name): var = self.variables[name] - + # Set begin in file header. the_beguine = self.fp.tell() self.fp.seek(var._begin) @@ -330,7 +330,7 @@ # Write data. if not var.isrec: - self.fp.write(var.data.tostring()) + self.fp.write(var.data.tostring()) count = var.data.size * var.data.itemsize self.fp.write('0' * (var._vsize - count)) else: # record variable @@ -379,7 +379,7 @@ dtype_ = '>%s' % typecode if size > 1: dtype_ += str(size) - values = asarray(values, dtype=dtype_) + values = asarray(values, dtype=dtype_) self.fp.write(nc_type) @@ -527,7 +527,7 @@ dimensions = [] shape = [] dims = self._unpack_int() - + for i in range(dims): dimid = self._unpack_int() dimname = self._dims[dimid] @@ -565,7 +565,7 @@ values = fromstring(values, dtype='>%s%d' % (typecode, size)) if values.shape == (1,): values = values[0] else: - values = values.rstrip('\x00') + values = values.rstrip('\x00') return values def _pack_begin(self, begin): Modified: trunk/scipy/io/tests/test_netcdf.py =================================================================== --- trunk/scipy/io/tests/test_netcdf.py 2010-06-18 14:38:19 UTC (rev 6539) +++ trunk/scipy/io/tests/test_netcdf.py 2010-06-18 15:34:00 UTC (rev 6540) @@ -38,8 +38,8 @@ yield assert_equal, str(time.units), 'days since 2008-01-01' yield assert_equal, time.shape, (N_EG_ELS,) yield assert_equal, time[-1], N_EG_ELS-1 - + def test_read_write_files(): # test round trip for example file cwd = os.getcwd() @@ -118,4 +118,4 @@ for fname in glob(pjoin(TEST_DATA_PATH, '*.nc')): f = netcdf_file(fname, 'r') f = netcdf_file(fname, 'r', mmap=False) - + From scipy-svn at scipy.org Fri Jun 18 11:36:37 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 10:36:37 -0500 (CDT) Subject: [Scipy-svn] r6541 - in branches/0.8.x/scipy/io: . tests Message-ID: <20100618153637.ABAF639CAFF@scipy.org> Author: rgommers Date: 2010-06-18 10:36:37 -0500 (Fri, 18 Jun 2010) New Revision: 6541 Modified: branches/0.8.x/scipy/io/netcdf.py branches/0.8.x/scipy/io/tests/test_netcdf.py Log: BUG: netcdf_file.flush() was trying to access non-existing attribute. Backport of r6540. Modified: branches/0.8.x/scipy/io/netcdf.py =================================================================== --- branches/0.8.x/scipy/io/netcdf.py 2010-06-18 15:34:00 UTC (rev 6540) +++ branches/0.8.x/scipy/io/netcdf.py 2010-06-18 15:36:37 UTC (rev 6541) @@ -4,7 +4,7 @@ This module implements the Scientific.IO.NetCDF API to read and create NetCDF files. The same API is also used in the PyNIO and pynetcdf modules, allowing these modules to be used interchangebly when working -with NetCDF files. The major advantage of ``scipy.io.netcdf`` over other +with NetCDF files. The major advantage of ``scipy.io.netcdf`` over other modules is that it doesn't require the code to be linked to the NetCDF libraries as the other modules do. @@ -28,7 +28,7 @@ and they are stored at the end of the file per record, ie A[0], B[0], ..., A[1], B[1], ..., etc, - + so that new data can be appended to the file without changing its original structure. Non-record data are padded to a 4n bytes boundary. Record data are also padded, unless there is exactly one record variable in the file, @@ -86,7 +86,7 @@ from numpy import little_endian as LITTLE_ENDIAN -ABSENT = '\x00\x00\x00\x00\x00\x00\x00\x00' +ABSENT = '\x00\x00\x00\x00\x00\x00\x00\x00' ZERO = '\x00\x00\x00\x00' NC_BYTE = '\x00\x00\x00\x01' NC_CHAR = '\x00\x00\x00\x02' @@ -193,7 +193,7 @@ def close(self): if not self.fp.closed: try: - self.flush() + self.flush() finally: self.fp.close() __del__ = close @@ -203,7 +203,7 @@ self._dims.append(name) def createVariable(self, name, type, dimensions): - shape = tuple([self.dimensions[dim] for dim in dimensions]) + shape = tuple([self.dimensions[dim] for dim in dimensions]) shape_ = tuple([dim or 0 for dim in shape]) # replace None with 0 for numpy if isinstance(type, basestring): type = dtype(type) @@ -216,7 +216,7 @@ return self.variables[name] def flush(self): - if self.mode is 'w': + if hasattr(self, 'mode') and self.mode is 'w': self._write() sync = flush @@ -266,7 +266,7 @@ self.fp.write(NC_VARIABLE) self._pack_int(len(self.variables)) - # Sort variables non-recs first, then recs. We use a DSU + # Sort variables non-recs first, then recs. We use a DSU # since some people use pupynere with Python 2.3.x. deco = [ (v._shape and not v.isrec, k) for (k, v) in self.variables.items() ] deco.sort() @@ -321,7 +321,7 @@ def _write_var_data(self, name): var = self.variables[name] - + # Set begin in file header. the_beguine = self.fp.tell() self.fp.seek(var._begin) @@ -330,7 +330,7 @@ # Write data. if not var.isrec: - self.fp.write(var.data.tostring()) + self.fp.write(var.data.tostring()) count = var.data.size * var.data.itemsize self.fp.write('0' * (var._vsize - count)) else: # record variable @@ -379,7 +379,7 @@ dtype_ = '>%s' % typecode if size > 1: dtype_ += str(size) - values = asarray(values, dtype=dtype_) + values = asarray(values, dtype=dtype_) self.fp.write(nc_type) @@ -527,7 +527,7 @@ dimensions = [] shape = [] dims = self._unpack_int() - + for i in range(dims): dimid = self._unpack_int() dimname = self._dims[dimid] @@ -565,7 +565,7 @@ values = fromstring(values, dtype='>%s%d' % (typecode, size)) if values.shape == (1,): values = values[0] else: - values = values.rstrip('\x00') + values = values.rstrip('\x00') return values def _pack_begin(self, begin): Modified: branches/0.8.x/scipy/io/tests/test_netcdf.py =================================================================== --- branches/0.8.x/scipy/io/tests/test_netcdf.py 2010-06-18 15:34:00 UTC (rev 6540) +++ branches/0.8.x/scipy/io/tests/test_netcdf.py 2010-06-18 15:36:37 UTC (rev 6541) @@ -38,8 +38,8 @@ yield assert_equal, str(time.units), 'days since 2008-01-01' yield assert_equal, time.shape, (N_EG_ELS,) yield assert_equal, time[-1], N_EG_ELS-1 - + def test_read_write_files(): # test round trip for example file cwd = os.getcwd() @@ -118,4 +118,4 @@ for fname in glob(pjoin(TEST_DATA_PATH, '*.nc')): f = netcdf_file(fname, 'r') f = netcdf_file(fname, 'r', mmap=False) - + From scipy-svn at scipy.org Fri Jun 18 15:39:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 14:39:19 -0500 (CDT) Subject: [Scipy-svn] r6542 - trunk/scipy/optimize Message-ID: <20100618193919.0D66339CAE9@scipy.org> Author: rgommers Date: 2010-06-18 14:39:18 -0500 (Fri, 18 Jun 2010) New Revision: 6542 Modified: trunk/scipy/optimize/minpack.py Log: BUG: leastsq returned a scalar instead of array for single fit param. Fixes #1204. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-18 15:36:37 UTC (rev 6541) +++ trunk/scipy/optimize/minpack.py 2010-06-18 19:39:18 UTC (rev 6542) @@ -308,9 +308,6 @@ except KeyError: raise errors['unknown'][1](errors['unknown'][0]) - if n == 1: - retval = (retval[0][0],) + retval[1:] - mesg = errors[info][0] if full_output: cov_x = None From scipy-svn at scipy.org Sat Jun 19 00:18:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 18 Jun 2010 23:18:21 -0500 (CDT) Subject: [Scipy-svn] r6543 - branches/0.8.x/scipy/optimize Message-ID: <20100619041821.1311239CAEE@scipy.org> Author: rgommers Date: 2010-06-18 23:18:20 -0500 (Fri, 18 Jun 2010) New Revision: 6543 Modified: branches/0.8.x/scipy/optimize/minpack.py Log: BUG: leastsq returned a scalar instead of array for single fit param. Fixes #1204. Backport of r6542. Modified: branches/0.8.x/scipy/optimize/minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/minpack.py 2010-06-18 19:39:18 UTC (rev 6542) +++ branches/0.8.x/scipy/optimize/minpack.py 2010-06-19 04:18:20 UTC (rev 6543) @@ -319,9 +319,6 @@ except KeyError: raise errors['unknown'][1](errors['unknown'][0]) - if n == 1: - retval = (retval[0][0],) + retval[1:] - mesg = errors[info][0] if full_output: cov_x = None From scipy-svn at scipy.org Sat Jun 19 16:03:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 19 Jun 2010 15:03:22 -0500 (CDT) Subject: [Scipy-svn] r6544 - trunk/scipy/signal Message-ID: <20100619200322.5D98739CAE6@scipy.org> Author: warren.weckesser Date: 2010-06-19 15:03:22 -0500 (Sat, 19 Jun 2010) New Revision: 6544 Added: trunk/scipy/signal/fir_filter_design.py Modified: trunk/scipy/signal/__init__.py trunk/scipy/signal/filter_design.py trunk/scipy/signal/signaltools.py Log: REF: Start a separate module for functions related to FIR filter design by moving a couple functions from filter_design.py to fir_filter_design.py Modified: trunk/scipy/signal/__init__.py =================================================================== --- trunk/scipy/signal/__init__.py 2010-06-19 04:18:20 UTC (rev 6543) +++ trunk/scipy/signal/__init__.py 2010-06-19 20:03:22 UTC (rev 6544) @@ -8,6 +8,7 @@ from waveforms import * from bsplines import * from filter_design import * +from fir_filter_design import * from ltisys import * from windows import * from signaltools import * Modified: trunk/scipy/signal/filter_design.py =================================================================== --- trunk/scipy/signal/filter_design.py 2010-06-19 04:18:20 UTC (rev 6543) +++ trunk/scipy/signal/filter_design.py 2010-06-19 20:03:22 UTC (rev 6544) @@ -1542,72 +1542,4 @@ 'h' : 'highpass' } -def kaiserord(ripple, width): - """Design a Kaiser window to limit ripple and width of transition region. - - Parameters - ---------- - ripple -- positive number specifying maximum ripple in passband (dB) - and minimum ripple in stopband - width -- width of transition region (normalized so that 1 corresponds - to pi radians / sample) - - Returns - ------- - N, beta -- the order and beta parameter for the kaiser window. - - signal.kaiser(N,beta,sym=0) returns the window as does - signal.get_window(beta,N) - signal.get_window(('kaiser',beta),N) - - Uses the empirical equations discovered by Kaiser. - - Oppenheim, Schafer, "Discrete-Time Signal Processing,", p.475-476. - """ - A = abs(ripple) # in case somebody is confused as to what's meant - if (A>50): - beta = 0.1102*(A-8.7) - elif (A>21): - beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) - else: - beta = 0.0 - N = (A-8)/2.285/(pi*width) - return ceil(N), beta - -def firwin(N, cutoff, width=None, window='hamming'): - """ - FIR Filter Design using windowed ideal filter method. - - Parameters - ---------- - N -- order of filter (number of taps) - cutoff -- cutoff frequency of filter (normalized so that 1 corresponds to - Nyquist or pi radians / sample) - - width -- if width is not None, then assume it is the approximate width of - the transition region (normalized so that 1 corresonds to pi) - for use in kaiser FIR filter design. - window -- desired window to use. See get_window for a list - of windows and required parameters. - - Returns - ------- - h -- coefficients of length N fir filter. - - """ - - from signaltools import get_window - if isinstance(width,float): - A = 2.285*N*width + 8 - if (A < 21): beta = 0.0 - elif (A <= 50): beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) - else: beta = 0.1102*(A-8.7) - window=('kaiser',beta) - - win = get_window(window,N,fftbins=1) - alpha = N//2 - m = numpy.arange(0,N) - h = win*special.sinc(cutoff*(m-alpha)) - return h / numpy.sum(h,axis=0) - warnings.simplefilter("always", BadCoefficients) Copied: trunk/scipy/signal/fir_filter_design.py (from rev 6543, trunk/scipy/signal/filter_design.py) =================================================================== --- trunk/scipy/signal/fir_filter_design.py (rev 0) +++ trunk/scipy/signal/fir_filter_design.py 2010-06-19 20:03:22 UTC (rev 6544) @@ -0,0 +1,74 @@ +"""Functions for FIR filter design.""" + +import numpy +from numpy import pi, ceil +from scipy import special + + +def kaiserord(ripple, width): + """Design a Kaiser window to limit ripple and width of transition region. + + Parameters + ---------- + ripple -- positive number specifying maximum ripple in passband (dB) + and minimum ripple in stopband + width -- width of transition region (normalized so that 1 corresponds + to pi radians / sample) + + Returns + ------- + N, beta -- the order and beta parameter for the kaiser window. + + signal.kaiser(N,beta,sym=0) returns the window as does + signal.get_window(beta,N) + signal.get_window(('kaiser',beta),N) + + Uses the empirical equations discovered by Kaiser. + + Oppenheim, Schafer, "Discrete-Time Signal Processing,", p.475-476. + """ + A = abs(ripple) # in case somebody is confused as to what's meant + if (A>50): + beta = 0.1102*(A-8.7) + elif (A>21): + beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) + else: + beta = 0.0 + N = (A-8)/2.285/(pi*width) + return ceil(N), beta + +def firwin(N, cutoff, width=None, window='hamming'): + """ + FIR Filter Design using windowed ideal filter method. + + Parameters + ---------- + N -- order of filter (number of taps) + cutoff -- cutoff frequency of filter (normalized so that 1 corresponds to + Nyquist or pi radians / sample) + + width -- if width is not None, then assume it is the approximate width of + the transition region (normalized so that 1 corresonds to pi) + for use in kaiser FIR filter design. + window -- desired window to use. See get_window for a list + of windows and required parameters. + + Returns + ------- + h -- coefficients of length N fir filter. + + """ + + from signaltools import get_window + if isinstance(width,float): + A = 2.285*N*width + 8 + if (A < 21): beta = 0.0 + elif (A <= 50): beta = 0.5842*(A-21)**0.4 + 0.07886*(A-21) + else: beta = 0.1102*(A-8.7) + window=('kaiser',beta) + + win = get_window(window,N,fftbins=1) + alpha = N//2 + m = numpy.arange(0,N) + h = win*special.sinc(cutoff*(m-alpha)) + return h / numpy.sum(h,axis=0) Modified: trunk/scipy/signal/signaltools.py =================================================================== --- trunk/scipy/signal/signaltools.py 2010-06-19 04:18:20 UTC (rev 6543) +++ trunk/scipy/signal/signaltools.py 2010-06-19 20:03:22 UTC (rev 6544) @@ -1284,7 +1284,8 @@ return flipud(y[edge-1:-edge+1]) -from scipy.signal.filter_design import cheby1, firwin +from scipy.signal.filter_design import cheby1 +from scipy.signal.fir_filter_design import firwin def decimate(x, q, n=None, ftype='iir', axis=-1): """downsample the signal x by an integer factor q, using an order n filter From scipy-svn at scipy.org Sun Jun 20 13:52:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 12:52:12 -0500 (CDT) Subject: [Scipy-svn] r6545 - trunk/doc/source/tutorial Message-ID: <20100620175212.4F81239CAEA@scipy.org> Author: warren.weckesser Date: 2010-06-20 12:52:12 -0500 (Sun, 20 Jun 2010) New Revision: 6545 Modified: trunk/doc/source/tutorial/linalg.rst Log: DOC: linalg tutorial: added a short section about some of the special matrices. Modified: trunk/doc/source/tutorial/linalg.rst =================================================================== --- trunk/doc/source/tutorial/linalg.rst 2010-06-19 20:03:22 UTC (rev 6544) +++ trunk/doc/source/tutorial/linalg.rst 2010-06-20 17:52:12 UTC (rev 6545) @@ -823,3 +823,32 @@ Note how, by virtue of how matrix analytic functions are defined, the Bessel function has acted on the matrix eigenvalues. + +Special matrices +---------------- + +SciPy and NumPy provide several functions for creating special matrices +that are frequently used in engineering and science. + +==================== ========================= ========================================================= +Type Function Description +==================== ========================= ========================================================= +block diagonal `scipy.linalg.block_diag` Create a block diagonal matrix from the provided arrays. +-------------------- ------------------------- --------------------------------------------------------- +circulant `scipy.linalg.circulant` Construct a circulant matrix. +-------------------- ------------------------- --------------------------------------------------------- +companion `scipy.linalg.companion` Create a companion matrix. +-------------------- ------------------------- --------------------------------------------------------- +Hadamard `scipy.linalg.hadamard` Construct a Hadamard matrix. +-------------------- ------------------------- --------------------------------------------------------- +Hankel `scipy.linalg.hankel` Construct a Hankel matrix. +-------------------- ------------------------- --------------------------------------------------------- +Leslie `scipy.linalg.leslie` Create a Leslie matrix. +-------------------- ------------------------- --------------------------------------------------------- +Toeplitz `scipy.linalg.toeplitz` Construct a Toeplitz matrix. +-------------------- ------------------------- --------------------------------------------------------- +Van der Monde `numpy.vander` Generate a Van der Monde matrix. +==================== ========================= ========================================================= + + +For examples of the use of these functions, see their respective docstrings. \ No newline at end of file From scipy-svn at scipy.org Sun Jun 20 18:40:38 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 17:40:38 -0500 (CDT) Subject: [Scipy-svn] r6546 - trunk/scipy/special/tests Message-ID: <20100620224038.8E08039CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 17:40:38 -0500 (Sun, 20 Jun 2010) New Revision: 6546 Modified: trunk/scipy/special/tests/test_mpmath.py Log: ENH: special: stick with the current convention for hyp2f1 a=c=negative integer, and enable a corresponding mpmath test Addresses #1149 Modified: trunk/scipy/special/tests/test_mpmath.py =================================================================== --- trunk/scipy/special/tests/test_mpmath.py 2010-06-20 17:52:12 UTC (rev 6545) +++ trunk/scipy/special/tests/test_mpmath.py 2010-06-20 22:40:38 UTC (rev 6546) @@ -52,15 +52,14 @@ # hyp2f1 #------------------------------------------------------------------------------ - at mpmath_check('0.12') - at dec.knownfailureif(True, - "Currently, special.hyp2f1 uses a *different* convention from mpmath and Mathematica for the cases a=c or b=c negative integers") + at mpmath_check('0.14') def test_hyp2f1_strange_points(): pts = [ - (2,-1,-1,3), - (2,-2,-2,3), + (2,-1,-1,0.7), + (2,-2,-2,0.7), ] - dataset = [p + (float(mpmath.hyp2f1(*p)),) for p in pts] + kw = dict(eliminate=True) + dataset = [p + (float(mpmath.hyp2f1(*p, **kw)),) for p in pts] dataset = np.array(dataset, dtype=np.float_) FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-10).check() From scipy-svn at scipy.org Sun Jun 20 18:41:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 17:41:00 -0500 (CDT) Subject: [Scipy-svn] r6547 - trunk/scipy/special/tests Message-ID: <20100620224100.F087839CB25@scipy.org> Author: ptvirtan Date: 2010-06-20 17:41:00 -0500 (Sun, 20 Jun 2010) New Revision: 6547 Modified: trunk/scipy/special/tests/testutils.py Log: ENH: special: add assert_func_equal to clean up the way dataset tests are implemented Modified: trunk/scipy/special/tests/testutils.py =================================================================== --- trunk/scipy/special/tests/testutils.py 2010-06-20 22:40:38 UTC (rev 6546) +++ trunk/scipy/special/tests/testutils.py 2010-06-20 22:41:00 UTC (rev 6547) @@ -6,6 +6,9 @@ import scipy.special as sc +__all__ = ['with_special_errors', 'assert_tol_equal', 'assert_func_equal', + 'FuncData'] + #------------------------------------------------------------------------------ # Enable convergence and loss of precision warnings -- turn off one by one #------------------------------------------------------------------------------ @@ -46,6 +49,39 @@ # error reports #------------------------------------------------------------------------------ +def assert_func_equal(func, results, points, rtol=None, atol=None, + param_filter=None, knownfailure=None, + vectorized=True, dtype=None): + if hasattr(points, 'next'): + # it's a generator + points = list(points) + + points = np.asarray(points) + if points.ndim == 1: + points = points[:,None] + + if hasattr(results, '__name__'): + # function + if vectorized: + results = results(*tuple(points.T)) + else: + results = np.array([results(*tuple(p)) for p in points]) + if results.dtype == object: + try: + results = results.astype(float) + except TypeError: + results = results.astype(complex) + else: + results = np.asarray(results) + + npoints = points.shape[1] + + data = np.c_[points, results] + fdata = FuncData(func, data, range(npoints), range(npoints, data.shape[1]), + rtol=rtol, atol=atol, param_filter=param_filter, + knownfailure=knownfailure) + fdata.check() + class FuncData(object): """ Data set for checking a special function. From scipy-svn at scipy.org Sun Jun 20 18:41:15 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 17:41:15 -0500 (CDT) Subject: [Scipy-svn] r6548 - trunk/scipy/special/specfun Message-ID: <20100620224115.2A7BD39CB20@scipy.org> Author: ptvirtan Date: 2010-06-20 17:41:14 -0500 (Sun, 20 Jun 2010) New Revision: 6548 Modified: trunk/scipy/special/specfun/specfun.f Log: BUG: special: adjust complex erf switchover radius to improve accuracy (addresses #683) Modified: trunk/scipy/special/specfun/specfun.f =================================================================== --- trunk/scipy/special/specfun/specfun.f 2010-06-20 22:41:00 UTC (rev 6547) +++ trunk/scipy/special/specfun/specfun.f 2010-06-20 22:41:14 UTC (rev 6548) @@ -2453,7 +2453,18 @@ IF (DBLE(Z).LT.0.0) THEN Z1=-Z ENDIF - IF (A0.LE.5.8D0) THEN +C +C Cutoff radius R = 4.36; determined by balancing rounding error +C and asymptotic expansion error, see below. +C +C The resulting maximum global accuracy expected is around 1e-8 +C + IF (A0.LE.4.36D0) THEN +C +C Rounding error in the Taylor expansion is roughly +C +C ~ R*R * EPSILON * R**(2 R**2) / (2 R**2 Gamma(R**2 + 1/2)) +C CS=Z1 CR=Z1 DO 10 K=1,120 @@ -2465,7 +2476,15 @@ ELSE CL=1.0D0/Z1 CR=CL - DO 20 K=1,13 +C +C Asymptotic series; maximum K must be at most ~ R^2. +C +C The maximum accuracy obtainable from this expansion is roughly +C +C ~ Gamma(2R**2 + 2) / ( +C (2 R**2)**(R**2 + 1/2) Gamma(R**2 + 3/2) 2**(R**2 + 1/2)) +C + DO 20 K=1,20 CR=-CR*(K-0.5D0)/(Z1*Z1) CL=CL+CR IF (CDABS(CR/CL).LT.1.0D-15) GO TO 25 From scipy-svn at scipy.org Sun Jun 20 18:41:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 17:41:30 -0500 (CDT) Subject: [Scipy-svn] r6549 - trunk/scipy/special/tests Message-ID: <20100620224130.CACF539CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 17:41:30 -0500 (Sun, 20 Jun 2010) New Revision: 6549 Modified: trunk/scipy/special/tests/test_mpmath.py Log: TST: special: add test for complex erf Modified: trunk/scipy/special/tests/test_mpmath.py =================================================================== --- trunk/scipy/special/tests/test_mpmath.py 2010-06-20 22:41:14 UTC (rev 6548) +++ trunk/scipy/special/tests/test_mpmath.py 2010-06-20 22:41:30 UTC (rev 6549) @@ -151,3 +151,24 @@ ds[4] = float(mpmath.hyp2f1(*tuple(ds[:4]))) FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-9).check() + +#------------------------------------------------------------------------------ +# erf (complex) +#------------------------------------------------------------------------------ + + at mpmath_check('0.14') +def test_erf_complex(): + # need to increase mpmath precision for this test + old_dps, old_prec = mpmath.mp.dps, mpmath.mp.prec + try: + mpmath.mp.dps = 70 + x1, y1 = np.meshgrid(np.linspace(-10, 1, 11), np.linspace(-10, 1, 11)) + x2, y2 = np.meshgrid(np.logspace(-10, .8, 11), np.logspace(-10, .8, 11)) + points = np.r_[x1.ravel(),x2.ravel()] + 1j*np.r_[y1.ravel(),y2.ravel()] + + # note that the global accuracy of our complex erf algorithm is limited + # roughly to 2e-8 + assert_func_equal(sc.erf, mpmath.erf, points, vectorized=False, + rtol=2e-8) + finally: + mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec From scipy-svn at scipy.org Sun Jun 20 19:47:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 18:47:33 -0500 (CDT) Subject: [Scipy-svn] r6550 - trunk/scipy/special/tests Message-ID: <20100620234733.7B95339CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 18:47:33 -0500 (Sun, 20 Jun 2010) New Revision: 6550 Modified: trunk/scipy/special/tests/test_mpmath.py Log: TST: special: fix mpmath-based tests to pass on Python 2.4 Modified: trunk/scipy/special/tests/test_mpmath.py =================================================================== --- trunk/scipy/special/tests/test_mpmath.py 2010-06-20 22:41:30 UTC (rev 6549) +++ trunk/scipy/special/tests/test_mpmath.py 2010-06-20 23:47:33 UTC (rev 6550) @@ -42,7 +42,7 @@ for r in np.logspace(-99, 2, 10): for p in np.linspace(0, 2*np.pi, 30): z = r*np.exp(1j*p) - dataset.append((z, mpmath.ei(z))) + dataset.append((z, complex(mpmath.ei(z)))) dataset = np.array(dataset, dtype=np.complex_) FuncData(sc.expi, dataset, 0, 1).check() @@ -168,7 +168,7 @@ # note that the global accuracy of our complex erf algorithm is limited # roughly to 2e-8 - assert_func_equal(sc.erf, mpmath.erf, points, vectorized=False, - rtol=2e-8) + assert_func_equal(sc.erf, lambda x: complex(mpmath.erf(x)), points, + vectorized=False, rtol=2e-8) finally: mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec From scipy-svn at scipy.org Sun Jun 20 19:49:43 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 18:49:43 -0500 (CDT) Subject: [Scipy-svn] r6551 - branches/0.8.x/scipy/special/tests Message-ID: <20100620234943.E7D9B39CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 18:49:43 -0500 (Sun, 20 Jun 2010) New Revision: 6551 Modified: branches/0.8.x/scipy/special/tests/testutils.py Log: ENH: special: add assert_func_equal to clean up the way dataset tests are implemented (cherry picked from commit r6547) Modified: branches/0.8.x/scipy/special/tests/testutils.py =================================================================== --- branches/0.8.x/scipy/special/tests/testutils.py 2010-06-20 23:47:33 UTC (rev 6550) +++ branches/0.8.x/scipy/special/tests/testutils.py 2010-06-20 23:49:43 UTC (rev 6551) @@ -6,6 +6,9 @@ import scipy.special as sc +__all__ = ['with_special_errors', 'assert_tol_equal', 'assert_func_equal', + 'FuncData'] + #------------------------------------------------------------------------------ # Enable convergence and loss of precision warnings -- turn off one by one #------------------------------------------------------------------------------ @@ -46,6 +49,39 @@ # error reports #------------------------------------------------------------------------------ +def assert_func_equal(func, results, points, rtol=None, atol=None, + param_filter=None, knownfailure=None, + vectorized=True, dtype=None): + if hasattr(points, 'next'): + # it's a generator + points = list(points) + + points = np.asarray(points) + if points.ndim == 1: + points = points[:,None] + + if hasattr(results, '__name__'): + # function + if vectorized: + results = results(*tuple(points.T)) + else: + results = np.array([results(*tuple(p)) for p in points]) + if results.dtype == object: + try: + results = results.astype(float) + except TypeError: + results = results.astype(complex) + else: + results = np.asarray(results) + + npoints = points.shape[1] + + data = np.c_[points, results] + fdata = FuncData(func, data, range(npoints), range(npoints, data.shape[1]), + rtol=rtol, atol=atol, param_filter=param_filter, + knownfailure=knownfailure) + fdata.check() + class FuncData(object): """ Data set for checking a special function. From scipy-svn at scipy.org Sun Jun 20 19:49:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 18:49:56 -0500 (CDT) Subject: [Scipy-svn] r6552 - branches/0.8.x/scipy/special/specfun Message-ID: <20100620234956.D238539CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 18:49:56 -0500 (Sun, 20 Jun 2010) New Revision: 6552 Modified: branches/0.8.x/scipy/special/specfun/specfun.f Log: BUG: special: adjust complex erf switchover radius to improve accuracy (addresses #683) (cherry picked from commit r6548) Modified: branches/0.8.x/scipy/special/specfun/specfun.f =================================================================== --- branches/0.8.x/scipy/special/specfun/specfun.f 2010-06-20 23:49:43 UTC (rev 6551) +++ branches/0.8.x/scipy/special/specfun/specfun.f 2010-06-20 23:49:56 UTC (rev 6552) @@ -2453,7 +2453,18 @@ IF (DBLE(Z).LT.0.0) THEN Z1=-Z ENDIF - IF (A0.LE.5.8D0) THEN +C +C Cutoff radius R = 4.36; determined by balancing rounding error +C and asymptotic expansion error, see below. +C +C The resulting maximum global accuracy expected is around 1e-8 +C + IF (A0.LE.4.36D0) THEN +C +C Rounding error in the Taylor expansion is roughly +C +C ~ R*R * EPSILON * R**(2 R**2) / (2 R**2 Gamma(R**2 + 1/2)) +C CS=Z1 CR=Z1 DO 10 K=1,120 @@ -2465,7 +2476,15 @@ ELSE CL=1.0D0/Z1 CR=CL - DO 20 K=1,13 +C +C Asymptotic series; maximum K must be at most ~ R^2. +C +C The maximum accuracy obtainable from this expansion is roughly +C +C ~ Gamma(2R**2 + 2) / ( +C (2 R**2)**(R**2 + 1/2) Gamma(R**2 + 3/2) 2**(R**2 + 1/2)) +C + DO 20 K=1,20 CR=-CR*(K-0.5D0)/(Z1*Z1) CL=CL+CR IF (CDABS(CR/CL).LT.1.0D-15) GO TO 25 From scipy-svn at scipy.org Sun Jun 20 19:50:09 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 20 Jun 2010 18:50:09 -0500 (CDT) Subject: [Scipy-svn] r6553 - branches/0.8.x/scipy/special/tests Message-ID: <20100620235009.1F0F339CAEA@scipy.org> Author: ptvirtan Date: 2010-06-20 18:50:09 -0500 (Sun, 20 Jun 2010) New Revision: 6553 Modified: branches/0.8.x/scipy/special/tests/test_mpmath.py Log: TST: special: add test for complex erf (cherry picked from commits r6549, r6550) Modified: branches/0.8.x/scipy/special/tests/test_mpmath.py =================================================================== --- branches/0.8.x/scipy/special/tests/test_mpmath.py 2010-06-20 23:49:56 UTC (rev 6552) +++ branches/0.8.x/scipy/special/tests/test_mpmath.py 2010-06-20 23:50:09 UTC (rev 6553) @@ -42,7 +42,7 @@ for r in np.logspace(-99, 2, 10): for p in np.linspace(0, 2*np.pi, 30): z = r*np.exp(1j*p) - dataset.append((z, mpmath.ei(z))) + dataset.append((z, complex(mpmath.ei(z)))) dataset = np.array(dataset, dtype=np.complex_) FuncData(sc.expi, dataset, 0, 1).check() @@ -152,3 +152,24 @@ ds[4] = float(mpmath.hyp2f1(*tuple(ds[:4]))) FuncData(sc.hyp2f1, dataset, (0,1,2,3), 4, rtol=1e-9).check() + +#------------------------------------------------------------------------------ +# erf (complex) +#------------------------------------------------------------------------------ + + at mpmath_check('0.14') +def test_erf_complex(): + # need to increase mpmath precision for this test + old_dps, old_prec = mpmath.mp.dps, mpmath.mp.prec + try: + mpmath.mp.dps = 70 + x1, y1 = np.meshgrid(np.linspace(-10, 1, 11), np.linspace(-10, 1, 11)) + x2, y2 = np.meshgrid(np.logspace(-10, .8, 11), np.logspace(-10, .8, 11)) + points = np.r_[x1.ravel(),x2.ravel()] + 1j*np.r_[y1.ravel(),y2.ravel()] + + # note that the global accuracy of our complex erf algorithm is limited + # roughly to 2e-8 + assert_func_equal(sc.erf, lambda x: complex(mpmath.erf(x)), points, + vectorized=False, rtol=2e-8) + finally: + mpmath.mp.dps, mpmath.mp.prec = old_dps, old_prec From scipy-svn at scipy.org Mon Jun 21 11:53:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 10:53:30 -0500 (CDT) Subject: [Scipy-svn] r6554 - in trunk/scipy/optimize: . tests Message-ID: <20100621155330.D72DB39CAF6@scipy.org> Author: oliphant Date: 2010-06-21 10:53:30 -0500 (Mon, 21 Jun 2010) New Revision: 6554 Modified: trunk/scipy/optimize/minpack.py trunk/scipy/optimize/tests/test_minpack.py Log: Add tests for curve fit. Fix fsolve to be consistent with leastsq (i.e. don't special-case the n==1 call, but always return an array). Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-20 23:50:09 UTC (rev 6553) +++ trunk/scipy/optimize/minpack.py 2010-06-21 15:53:30 UTC (rev 6554) @@ -151,9 +151,6 @@ except KeyError: raise errors['unknown'][1](errors['unknown'][0]) - if n == 1: - retval = (retval[0][0],) + retval[1:] - if full_output: try: return retval + (errors[info][0],) # Return all + the message @@ -405,6 +402,7 @@ else: func = _weighted_general_function args += (1.0/asarray(sigma),) + res = leastsq(func, p0, args=args, full_output=1, **kw) (popt, pcov, infodict, errmsg, ier) = res Modified: trunk/scipy/optimize/tests/test_minpack.py =================================================================== --- trunk/scipy/optimize/tests/test_minpack.py 2010-06-20 23:50:09 UTC (rev 6553) +++ trunk/scipy/optimize/tests/test_minpack.py 2010-06-21 15:53:30 UTC (rev 6554) @@ -7,7 +7,7 @@ from numpy import array, float64 from scipy import optimize -from scipy.optimize.minpack import fsolve, leastsq +from scipy.optimize.minpack import fsolve, leastsq, curve_fit class TestFSolve(TestCase): def pressure_network(self, flow_rates, Qtot, k): @@ -122,5 +122,31 @@ assert_(ier in (1,2,3,4), 'solution not found: %s'%mesg) assert_array_equal(p0, p0_copy) +class TestCurveFit(TestCase): + def setUp(self): + self.y = array([1.0, 3.2, 9.5, 13.7]) + self.x = array([1.0, 2.0, 3.0, 4.0]) + + def test_one_argument(self): + def func(x,a): + return x**a + popt, pcov = curve_fit(func, self.x, self.y) + assert len(popt)==1 + assert pcov.shape==(1,1) + assert_almost_equal(popt[0], 1.9149, decimal=4) + assert_almost_equal(pcov[0,0], 0.0016, decimal=4) + + def test_two_argument(self): + def func(x, a, b): + return b*x**a + popt, pcov = curve_fit(func, self.x, self.y) + assert len(popt)==2 + assert pcov.shape==(2,2) + assert_array_almost_equal(popt, [1.7989, 1.1642], decimal=4) + assert_array_almost_equal(pcov, [[0.0852, -0.1260],[-0.1260, 0.1912]], decimal=4) + + + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Mon Jun 21 12:02:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 11:02:08 -0500 (CDT) Subject: [Scipy-svn] r6555 - trunk/scipy/optimize Message-ID: <20100621160208.2FC5239CAEC@scipy.org> Author: oliphant Date: 2010-06-21 11:02:08 -0500 (Mon, 21 Jun 2010) New Revision: 6555 Modified: trunk/scipy/optimize/minpack.py Log: Fix curve_fit to not raise an error unless an error actually exists. Modified: trunk/scipy/optimize/minpack.py =================================================================== --- trunk/scipy/optimize/minpack.py 2010-06-21 15:53:30 UTC (rev 6554) +++ trunk/scipy/optimize/minpack.py 2010-06-21 16:02:08 UTC (rev 6555) @@ -406,7 +406,7 @@ res = leastsq(func, p0, args=args, full_output=1, **kw) (popt, pcov, infodict, errmsg, ier) = res - if ier != 1: + if ier not in [1,2,3,4]: msg = "Optimal parameters not found: " + errmsg raise RuntimeError(msg) From scipy-svn at scipy.org Mon Jun 21 12:11:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 11:11:54 -0500 (CDT) Subject: [Scipy-svn] r6556 - branches/0.8.x/scipy/stats Message-ID: <20100621161154.E35DD39CAEC@scipy.org> Author: oliphant Date: 2010-06-21 11:11:54 -0500 (Mon, 21 Jun 2010) New Revision: 6556 Modified: branches/0.8.x/scipy/stats/distributions.py Log: Update nnlf method documentation in stats. Modified: branches/0.8.x/scipy/stats/distributions.py =================================================================== --- branches/0.8.x/scipy/stats/distributions.py 2010-06-21 16:02:08 UTC (rev 6555) +++ branches/0.8.x/scipy/stats/distributions.py 2010-06-21 16:11:54 UTC (rev 6556) @@ -1251,6 +1251,24 @@ return -sum(log(self._pdf(x, *args)),axis=0) def nnlf(self, theta, x): + """Negative log likelihood function. + + This function should be minimized to produce maximum likelihood estimates (MLE). + + Paramters + --------- + theta : array-like + Parameters that the log-likelihood function depends on (shape, loc, scale) + where loc and scale are always the last two parameters. + x : array-like + The value of x to evaluate the log-likelihood function at (the observed data). + + Returns + ------- + nnlf : float + For an array of x values, this reeturns the sum (along axis=0) of the log-likelihood + (i.e. assumes independent observations). + """ # - sum (log pdf(x, theta),axis=0) # where theta are the parameters (including loc and scale) # From scipy-svn at scipy.org Mon Jun 21 12:18:02 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 11:18:02 -0500 (CDT) Subject: [Scipy-svn] r6557 - branches/0.8.x/scipy/optimize Message-ID: <20100621161802.14E0F39CAEC@scipy.org> Author: oliphant Date: 2010-06-21 11:18:01 -0500 (Mon, 21 Jun 2010) New Revision: 6557 Modified: branches/0.8.x/scipy/optimize/minpack.py Log: Make 0.8.x branch also have consistent fsolve and leastsq interfaces. Modified: branches/0.8.x/scipy/optimize/minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/minpack.py 2010-06-21 16:11:54 UTC (rev 6556) +++ branches/0.8.x/scipy/optimize/minpack.py 2010-06-21 16:18:01 UTC (rev 6557) @@ -157,9 +157,6 @@ except KeyError: raise errors['unknown'][1](errors['unknown'][0]) - if n == 1: - retval = (retval[0][0],) + retval[1:] - if full_output: try: return retval + (errors[info][0],) # Return all + the message From scipy-svn at scipy.org Mon Jun 21 12:20:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 11:20:41 -0500 (CDT) Subject: [Scipy-svn] r6558 - in branches/0.8.x/scipy/optimize: . tests Message-ID: <20100621162041.7F68039CAEC@scipy.org> Author: oliphant Date: 2010-06-21 11:20:41 -0500 (Mon, 21 Jun 2010) New Revision: 6558 Modified: branches/0.8.x/scipy/optimize/minpack.py branches/0.8.x/scipy/optimize/tests/test_minpack.py Log: Fix up curve_fit in the 0.8.x branch and add a test in that branch. Modified: branches/0.8.x/scipy/optimize/minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/minpack.py 2010-06-21 16:18:01 UTC (rev 6557) +++ branches/0.8.x/scipy/optimize/minpack.py 2010-06-21 16:20:41 UTC (rev 6558) @@ -416,7 +416,7 @@ res = leastsq(func, p0, args=args, full_output=1, **kw) (popt, pcov, infodict, errmsg, ier) = res - if ier != 1: + if ier not in [1,2,3,4]: msg = "Optimal parameters not found: " + errmsg raise RuntimeError(msg) Modified: branches/0.8.x/scipy/optimize/tests/test_minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/tests/test_minpack.py 2010-06-21 16:18:01 UTC (rev 6557) +++ branches/0.8.x/scipy/optimize/tests/test_minpack.py 2010-06-21 16:20:41 UTC (rev 6558) @@ -7,7 +7,7 @@ from numpy import array, float64 from scipy import optimize -from scipy.optimize.minpack import fsolve, leastsq +from scipy.optimize.minpack import fsolve, leastsq, curve_fit class TestFSolve(TestCase): def pressure_network(self, flow_rates, Qtot, k): @@ -122,5 +122,31 @@ assert_(ier in (1,2,3,4), 'solution not found: %s'%mesg) assert_array_equal(p0, p0_copy) +class TestCurveFit(TestCase): + def setUp(self): + self.y = array([1.0, 3.2, 9.5, 13.7]) + self.x = array([1.0, 2.0, 3.0, 4.0]) + + def test_one_argument(self): + def func(x,a): + return x**a + popt, pcov = curve_fit(func, self.x, self.y) + assert len(popt)==1 + assert pcov.shape==(1,1) + assert_almost_equal(popt[0], 1.9149, decimal=4) + assert_almost_equal(pcov[0,0], 0.0016, decimal=4) + + def test_two_argument(self): + def func(x, a, b): + return b*x**a + popt, pcov = curve_fit(func, self.x, self.y) + assert len(popt)==2 + assert pcov.shape==(2,2) + assert_array_almost_equal(popt, [1.7989, 1.1642], decimal=4) + assert_array_almost_equal(pcov, [[0.0852, -0.1260],[-0.1260, 0.1912]], decimal=4) + + + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Mon Jun 21 15:42:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 14:42:59 -0500 (CDT) Subject: [Scipy-svn] r6559 - in trunk/scipy/optimize: . tests Message-ID: <20100621194259.EE36339CAEA@scipy.org> Author: warren.weckesser Date: 2010-06-21 14:42:59 -0500 (Mon, 21 Jun 2010) New Revision: 6559 Modified: trunk/scipy/optimize/tests/test_zeros.py trunk/scipy/optimize/zeros.py Log: BUG: optimize: add missing import of warnings tp zeros.py. Modified: trunk/scipy/optimize/tests/test_zeros.py =================================================================== --- trunk/scipy/optimize/tests/test_zeros.py 2010-06-21 16:20:41 UTC (rev 6558) +++ trunk/scipy/optimize/tests/test_zeros.py 2010-06-21 19:42:59 UTC (rev 6559) @@ -2,7 +2,8 @@ from math import sqrt -from numpy.testing import * +from numpy.testing import TestCase, assert_almost_equal, assert_warns, \ + run_module_suite from scipy.optimize import zeros as cc @@ -28,6 +29,10 @@ def test_brenth(self): self.run_check(cc.brenth, 'brenth') + def test_deriv_zero_warning(self): + func = lambda x: x**2 + dfunc = lambda x: 2*x + assert_warns(RuntimeWarning, cc.newton, func, 0.0, dfunc) if __name__ == '__main__' : run_module_suite() Modified: trunk/scipy/optimize/zeros.py =================================================================== --- trunk/scipy/optimize/zeros.py 2010-06-21 16:20:41 UTC (rev 6558) +++ trunk/scipy/optimize/zeros.py 2010-06-21 19:42:59 UTC (rev 6559) @@ -1,3 +1,6 @@ + +import warnings + import _zeros from numpy import finfo @@ -95,7 +98,7 @@ p0 = x0 for iter in range(maxiter): myargs = (p0,) + args - fval = func(*myargs) + # fval = func(*myargs) fder = fprime(*myargs) if fder == 0: msg = "derivative was zero." From scipy-svn at scipy.org Mon Jun 21 15:45:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 14:45:51 -0500 (CDT) Subject: [Scipy-svn] r6560 - trunk/scipy/optimize Message-ID: <20100621194551.144FF39CAEA@scipy.org> Author: warren.weckesser Date: 2010-06-21 14:45:50 -0500 (Mon, 21 Jun 2010) New Revision: 6560 Modified: trunk/scipy/optimize/zeros.py Log: Removed commmented line. Modified: trunk/scipy/optimize/zeros.py =================================================================== --- trunk/scipy/optimize/zeros.py 2010-06-21 19:42:59 UTC (rev 6559) +++ trunk/scipy/optimize/zeros.py 2010-06-21 19:45:50 UTC (rev 6560) @@ -98,7 +98,6 @@ p0 = x0 for iter in range(maxiter): myargs = (p0,) + args - # fval = func(*myargs) fder = fprime(*myargs) if fder == 0: msg = "derivative was zero." From scipy-svn at scipy.org Mon Jun 21 16:55:39 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 21 Jun 2010 15:55:39 -0500 (CDT) Subject: [Scipy-svn] r6561 - trunk/scipy/optimize Message-ID: <20100621205539.39F7439CAEA@scipy.org> Author: warren.weckesser Date: 2010-06-21 15:55:39 -0500 (Mon, 21 Jun 2010) New Revision: 6561 Modified: trunk/scipy/optimize/zeros.py Log: Tiny code optimization. Modified: trunk/scipy/optimize/zeros.py =================================================================== --- trunk/scipy/optimize/zeros.py 2010-06-21 19:45:50 UTC (rev 6560) +++ trunk/scipy/optimize/zeros.py 2010-06-21 20:55:39 UTC (rev 6561) @@ -103,7 +103,7 @@ msg = "derivative was zero." warnings.warn(msg, RuntimeWarning) return p0 - p = p0 - func(*myargs)/fprime(*myargs) + p = p0 - func(*myargs) / fder if abs(p - p0) < tol: return p p0 = p From scipy-svn at scipy.org Wed Jun 16 12:37:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 11:37:26 -0500 (CDT) Subject: [Scipy-svn] r6511 - in trunk/scipy: io/matlab spatial stats Message-ID: <20100616163726.CFB1E39CAF2@scipy.org> Author: matthew.brett at gmail.com Date: 2010-06-16 11:37:26 -0500 (Wed, 16 Jun 2010) New Revision: 6511 Modified: trunk/scipy/io/matlab/mio_utils.c trunk/scipy/io/matlab/streams.c trunk/scipy/spatial/ckdtree.c trunk/scipy/stats/vonmises_cython.c Log: MISC - updated old Cython generated C files with Cython 0.12.1 Modified: trunk/scipy/io/matlab/mio_utils.c =================================================================== --- trunk/scipy/io/matlab/mio_utils.c 2010-06-16 15:21:49 UTC (rev 6510) +++ trunk/scipy/io/matlab/mio_utils.c 2010-06-16 16:37:26 UTC (rev 6511) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Wed Jun 9 11:39:04 2010 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:30:35 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -17,6 +18,7 @@ #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -26,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -34,20 +38,19 @@ #define PyVarObject_HEAD_INIT(type, size) \ PyObject_HEAD_INIT(type) size, #define PyType_Modified(t) - #define PyBytes_CheckExact PyString_CheckExact typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -61,22 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type #define PyString_Type PyUnicode_Type #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -91,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -111,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -120,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -139,12 +158,14 @@ #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ @@ -166,8 +187,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -231,9 +252,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -281,68 +302,11 @@ #endif #endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< float > __pyx_t_float_complex; - #else - typedef float _Complex __pyx_t_float_complex; - #endif -#else - typedef struct { float real, imag; } __pyx_t_float_complex; +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj #endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - #else - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); - #endif -#else - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< double > __pyx_t_double_complex; - #else - typedef double _Complex __pyx_t_double_complex; - #endif -#else - typedef struct { double real, imag; } __pyx_t_double_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); - #endif -#else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - typedef ::std::complex< long double > __pyx_t_long_double_complex; - #else - typedef long double _Complex __pyx_t_long_double_complex; - #endif -#else - typedef struct { long double real, imag; } __pyx_t_long_double_complex; -#endif - -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); - #else - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); - #endif -#else - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double, long double); -#endif - -/* Type declarations */ - typedef npy_int8 __pyx_t_5numpy_int8_t; typedef npy_int16 __pyx_t_5numpy_int16_t; @@ -363,14 +327,14 @@ typedef npy_float64 __pyx_t_5numpy_float64_t; -typedef __pyx_t_float_complex __pyx_t_5numpy_complex64_t; - -typedef __pyx_t_double_complex __pyx_t_5numpy_complex128_t; - typedef npy_long __pyx_t_5numpy_int_t; typedef npy_longlong __pyx_t_5numpy_long_t; +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + typedef npy_ulong __pyx_t_5numpy_uint_t; typedef npy_ulonglong __pyx_t_5numpy_ulong_t; @@ -381,6 +345,28 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + typedef npy_cfloat __pyx_t_5numpy_cfloat_t; typedef npy_cdouble __pyx_t_5numpy_cdouble_t; @@ -389,38 +375,54 @@ typedef npy_cdouble __pyx_t_5numpy_complex_t; -#ifdef CYTHON_REFNANNY -typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*NewContext)(const char*, int, const char*); - void (*FinishContext)(void**); -} __Pyx_RefnannyAPIStruct; -static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; -#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") -#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) -#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) -#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) #else -#define __Pyx_INCREF(r) Py_INCREF(r) -#define __Pyx_DECREF(r) Py_DECREF(r) -#define __Pyx_GOTREF(r) -#define __Pyx_GIVEREF(r) -#define __Pyx_XDECREF(r) Py_XDECREF(r) -#define __Pyx_SetupRefcountContext(name) -#define __Pyx_FinishRefcountContext() + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) #endif /* CYTHON_REFNANNY */ #define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) #define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) -static INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; if (!j) return NULL; r = PyObject_GetItem(o, j); @@ -433,7 +435,7 @@ __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { PyObject *r = PyList_GET_ITEM(o, i); @@ -453,7 +455,7 @@ __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { if (likely(o != Py_None)) { if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { PyObject *r = PyTuple_GET_ITEM(o, i); @@ -474,7 +476,7 @@ __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ __Pyx_GetItemInt_Generic(o, to_py_func(i))) -static INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { PyObject *r; if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); @@ -493,16 +495,16 @@ return r; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); -static INLINE void __Pyx_RaiseTooManyValuesError(void); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ -static INLINE void __Pyx_RaiseNoneNotIterableError(void); +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ @@ -513,7 +515,7 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); #if CYTHON_CCOMPLEX #ifdef __cplusplus @@ -528,6 +530,16 @@ #define __Pyx_CIMAG(z) ((z).imag) #endif +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + #if CYTHON_CCOMPLEX #define __Pyx_c_eqf(a, b) ((a)==(b)) #define __Pyx_c_sumf(a, b) ((a)+(b)) @@ -536,7 +548,7 @@ #define __Pyx_c_quotf(a, b) ((a)/(b)) #define __Pyx_c_negf(a) (-(a)) #ifdef __cplusplus - #define __Pyx_c_is_zerof(z) ((z)==0.0) + #define __Pyx_c_is_zerof(z) ((z)==(float)0) #define __Pyx_c_conjf(z) (::std::conj(z)) /*#define __Pyx_c_absf(z) (::std::abs(z))*/ #else @@ -545,17 +557,19 @@ /*#define __Pyx_c_absf(z) (cabsf(z))*/ #endif #else - static INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); - static INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); - static INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); - /*static INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ #endif +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + #if CYTHON_CCOMPLEX #define __Pyx_c_eq(a, b) ((a)==(b)) #define __Pyx_c_sum(a, b) ((a)+(b)) @@ -564,7 +578,7 @@ #define __Pyx_c_quot(a, b) ((a)/(b)) #define __Pyx_c_neg(a) (-(a)) #ifdef __cplusplus - #define __Pyx_c_is_zero(z) ((z)==0.0) + #define __Pyx_c_is_zero(z) ((z)==(double)0) #define __Pyx_c_conj(z) (::std::conj(z)) /*#define __Pyx_c_abs(z) (::std::abs(z))*/ #else @@ -573,83 +587,55 @@ /*#define __Pyx_c_abs(z) (cabs(z))*/ #endif #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); - /*static INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ #endif -#if CYTHON_CCOMPLEX - #define __Pyx_c_eql(a, b) ((a)==(b)) - #define __Pyx_c_suml(a, b) ((a)+(b)) - #define __Pyx_c_diffl(a, b) ((a)-(b)) - #define __Pyx_c_prodl(a, b) ((a)*(b)) - #define __Pyx_c_quotl(a, b) ((a)/(b)) - #define __Pyx_c_negl(a) (-(a)) - #ifdef __cplusplus - #define __Pyx_c_is_zerol(z) ((z)==0.0) - #define __Pyx_c_conjl(z) (::std::conj(z)) - /*#define __Pyx_c_absl(z) (::std::abs(z))*/ - #else - #define __Pyx_c_is_zerol(z) ((z)==0) - #define __Pyx_c_conjl(z) (conjl(z)) - /*#define __Pyx_c_absl(z) (cabsl(z))*/ - #endif -#else - static INLINE int __Pyx_c_eql(__pyx_t_long_double_complex, __pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_suml(__pyx_t_long_double_complex, __pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_diffl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_prodl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_quotl(__pyx_t_long_double_complex, __pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_negl(__pyx_t_long_double_complex); - static INLINE int __Pyx_c_is_zerol(__pyx_t_long_double_complex); - static INLINE __pyx_t_long_double_complex __Pyx_c_conjl(__pyx_t_long_double_complex); - /*static INLINE long double __Pyx_c_absl(__pyx_t_long_double_complex);*/ -#endif +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -static INLINE char __Pyx_PyInt_AsChar(PyObject *); +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -static INLINE short __Pyx_PyInt_AsShort(PyObject *); +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -static INLINE int __Pyx_PyInt_AsInt(PyObject *); +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -static INLINE long __Pyx_PyInt_AsLong(PyObject *); +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - static void __Pyx_WriteUnraisable(const char *name); /*proto*/ -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ @@ -658,7 +644,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from python_buffer */ -/* Module declarations from python_object */ +/* Module declarations from python_ref */ /* Module declarations from stdlib */ @@ -673,12 +659,14 @@ static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from scipy.io.matlab.mio_utils */ static size_t __pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *, int __pyx_skip_dispatch); /*proto*/ @@ -693,15 +681,13 @@ static PyObject *__pyx_builtin_RuntimeError; static char __pyx_k_1[] = "ndarray is not C contiguous"; static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = ">"; -static char __pyx_k_4[] = "<"; -static char __pyx_k_5[] = "Non-native byte order not supported"; -static char __pyx_k_6[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_7[] = "Format string allocated too short, see comment in numpy.pxd"; -static char __pyx_k_8[] = "Format string allocated too short."; -static char __pyx_k_9[] = " Utilities for generic processing of return arrays from read\n"; -static char __pyx_k_10[] = "squeeze_element (line 17)"; -static char __pyx_k_11[] = "chars_to_strings (line 30)"; +static char __pyx_k_3[] = "Non-native byte order not supported"; +static char __pyx_k_4[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_5[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_6[] = "Format string allocated too short."; +static char __pyx_k_7[] = " Utilities for generic processing of return arrays from read\n"; +static char __pyx_k_8[] = "squeeze_element (line 17)"; +static char __pyx_k_9[] = "chars_to_strings (line 30)"; static char __pyx_k__B[] = "B"; static char __pyx_k__H[] = "H"; static char __pyx_k__I[] = "I"; @@ -723,6 +709,7 @@ static char __pyx_k__buf[] = "buf"; static char __pyx_k__obj[] = "obj"; static char __pyx_k__str[] = "str"; +static char __pyx_k__base[] = "base"; static char __pyx_k__item[] = "item"; static char __pyx_k__ndim[] = "ndim"; static char __pyx_k__size[] = "size"; @@ -753,21 +740,20 @@ static char __pyx_k__chars_to_strings[] = "chars_to_strings"; static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; static PyObject *__pyx_kp_u_1; -static PyObject *__pyx_kp_u_10; -static PyObject *__pyx_kp_u_11; static PyObject *__pyx_kp_u_2; -static PyObject *__pyx_kp_s_3; -static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_4; static PyObject *__pyx_kp_u_5; static PyObject *__pyx_kp_u_6; -static PyObject *__pyx_kp_u_7; static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; static PyObject *__pyx_n_s__RuntimeError; static PyObject *__pyx_n_s__ValueError; static PyObject *__pyx_n_s____main__; static PyObject *__pyx_n_s____test__; static PyObject *__pyx_n_s__array; static PyObject *__pyx_n_s__ascontiguousarray; +static PyObject *__pyx_n_s__base; static PyObject *__pyx_n_s__buf; static PyObject *__pyx_n_s__byteorder; static PyObject *__pyx_n_s__chars_to_strings; @@ -797,7 +783,7 @@ static PyObject *__pyx_n_s__view; static PyObject *__pyx_int_15; -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -814,10 +800,10 @@ int __pyx_t_2; PyObject *__pyx_t_3 = NULL; size_t __pyx_t_4; - __Pyx_SetupRefcountContext("cproduct"); + __Pyx_RefNannySetupContext("cproduct"); __Pyx_INCREF(__pyx_v_tup); - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":10 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -826,7 +812,7 @@ */ __pyx_v_res = 1; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":12 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -837,7 +823,7 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":13 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< @@ -851,7 +837,7 @@ __pyx_v_res *= __pyx_t_4; } - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":14 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -869,11 +855,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_tup); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -885,7 +871,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct(PyObject *__pyx_self, PyObject *__pyx_v_tup) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("cproduct"); + __Pyx_RefNannySetupContext("cproduct"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_f_5scipy_2io_6matlab_9mio_utils_cproduct(__pyx_v_tup, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -902,11 +888,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -923,10 +909,10 @@ PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; int __pyx_t_6; - __Pyx_SetupRefcountContext("squeeze_element"); + __Pyx_RefNannySetupContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":22 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: # <<<<<<<<<<<<<< @@ -940,7 +926,7 @@ __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":23 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: * return np.array([]) # <<<<<<<<<<<<<< @@ -971,7 +957,7 @@ } __pyx_L3:; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":24 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":24 * if not arr.size: * return np.array([]) * arr = np.squeeze(arr) # <<<<<<<<<<<<<< @@ -992,12 +978,12 @@ __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - if (!(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_4) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_4, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":25 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":25 * return np.array([]) * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< @@ -1019,7 +1005,7 @@ } if (__pyx_t_6) { - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":26 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":26 * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() # <<<<<<<<<<<<<< @@ -1039,7 +1025,7 @@ } __pyx_L4:; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":27 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":27 * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() * return arr # <<<<<<<<<<<<<< @@ -1062,11 +1048,11 @@ __pyx_L0:; __Pyx_DECREF((PyObject *)__pyx_v_arr); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -1079,7 +1065,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element(PyObject *__pyx_self, PyObject *__pyx_v_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("squeeze_element"); + __Pyx_RefNannySetupContext("squeeze_element"); __pyx_self = __pyx_self; if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_arr), __pyx_ptype_5numpy_ndarray, 1, "arr", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 17; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_XDECREF(__pyx_r); @@ -1097,11 +1083,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1121,22 +1107,22 @@ PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - __Pyx_SetupRefcountContext("chars_to_strings"); + __Pyx_RefNannySetupContext("chars_to_strings"); __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape */ - if (!(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_v_in_arr) == Py_None) || likely(__Pyx_TypeTest(__pyx_v_in_arr, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":45 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1145,7 +1131,7 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< @@ -1154,7 +1140,7 @@ */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< @@ -1163,7 +1149,7 @@ */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] * cdef object new_dt_str * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< @@ -1173,7 +1159,7 @@ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":50 * cdef object new_dt_str * if last_dim == 0: # deal with empty array case * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< @@ -1192,7 +1178,7 @@ } /*else*/ { - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":52 * new_dt_str = arr.dtype.str * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< @@ -1227,7 +1213,7 @@ } __pyx_L3:; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":54 * new_dt_str = arr.dtype.str[:-1] + str(last_dim) * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< @@ -1248,12 +1234,12 @@ __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 54; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":55 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":55 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< @@ -1270,12 +1256,12 @@ __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_2) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 55; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_arr)); __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":56 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< @@ -1297,7 +1283,7 @@ __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_r = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -1315,11 +1301,11 @@ __Pyx_DECREF(__pyx_v_new_dt_str); __Pyx_DECREF(__pyx_v_in_arr); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1332,7 +1318,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_9mio_utils_chars_to_strings(PyObject *__pyx_self, PyObject *__pyx_v_in_arr) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("chars_to_strings"); + __Pyx_RefNannySetupContext("chars_to_strings"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_9mio_utils_chars_to_strings(__pyx_v_in_arr, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1349,11 +1335,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":158 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1375,21 +1361,21 @@ int __pyx_v_hasfields; int __pyx_r; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - int __pyx_t_5; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; int __pyx_t_6; int __pyx_t_7; int __pyx_t_8; char *__pyx_t_9; - __Pyx_SetupRefcountContext("__getbuffer__"); + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); __Pyx_GIVEREF(__pyx_v_info->obj); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":164 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1398,7 +1384,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":165 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1407,7 +1393,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":167 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1416,7 +1402,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":169 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1426,7 +1412,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":170 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1438,7 +1424,7 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":172 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1449,60 +1435,63 @@ } __pyx_L5:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":174 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") */ - if (((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS)) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":175 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + __pyx_t_3 = __pyx_t_1; } - if (__pyx_t_1) { + if (__pyx_t_3) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":176 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_INCREF(((PyObject *)__pyx_kp_u_1)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_1)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_1)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_1)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":178 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") */ - if (((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS)) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":179 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1510,34 +1499,35 @@ * */ __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; } else { - __pyx_t_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + __pyx_t_2 = __pyx_t_3; } - if (__pyx_t_1) { + if (__pyx_t_2) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":180 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_2)); __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":182 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1546,7 +1536,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":183 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1555,17 +1545,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":184 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_t_4 = __pyx_v_copy_shape; - if (__pyx_t_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1574,7 +1564,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":188 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1583,18 +1573,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":189 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - __pyx_t_4 = __pyx_v_ndim; - for (__pyx_t_5 = 0; __pyx_t_5 < __pyx_t_4; __pyx_t_5+=1) { - __pyx_v_i = __pyx_t_5; + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":190 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1603,7 +1593,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":191 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1616,7 +1606,7 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1625,7 +1615,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1636,7 +1626,7 @@ } __pyx_L8:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":195 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1645,7 +1635,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1654,7 +1644,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":197 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1663,7 +1653,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":200 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1672,7 +1662,7 @@ */ __pyx_v_f = NULL; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1682,7 +1672,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1691,21 +1681,23 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - if ((!__pyx_v_hasfields)) { - __pyx_t_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; } else { - __pyx_t_1 = (!__pyx_v_hasfields); + __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1721,7 +1713,7 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1736,7 +1728,7 @@ } __pyx_L11:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":214 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1746,7 +1738,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":215 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1755,77 +1747,64 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_2 = PyInt_FromLong(__pyx_v_descr->byteorder); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, ((PyObject *)__pyx_kp_s_3), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 216; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); if (__pyx_t_1) { - __pyx_t_6 = __pyx_v_little_endian; - __pyx_t_7 = __pyx_t_6; + __pyx_t_2 = __pyx_v_little_endian; } else { - __pyx_t_7 = __pyx_t_1; + __pyx_t_2 = __pyx_t_1; } - if (!__pyx_t_7) { + if (!__pyx_t_2) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_descr->byteorder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_4), Py_EQ); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_1 = __Pyx_PyObject_IsTrue(__pyx_t_2); if (unlikely(__pyx_t_1 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 217; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); if (__pyx_t_1) { - __pyx_t_6 = (!__pyx_v_little_endian); - __pyx_t_8 = __pyx_t_6; + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; } else { __pyx_t_8 = __pyx_t_1; } __pyx_t_1 = __pyx_t_8; } else { - __pyx_t_1 = __pyx_t_7; + __pyx_t_1 = __pyx_t_2; } if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_Raise(__pyx_t_3, 0, 0); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L13; } __pyx_L13:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -1838,7 +1817,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1851,7 +1830,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":221 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1864,7 +1843,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1877,7 +1856,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1890,7 +1869,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1903,7 +1882,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1916,7 +1895,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1929,7 +1908,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":227 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1942,7 +1921,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":228 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1955,7 +1934,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1968,7 +1947,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1981,7 +1960,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":231 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1994,7 +1973,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":232 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -2007,7 +1986,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":233 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -2020,7 +1999,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2033,7 +2012,7 @@ goto __pyx_L14; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":235 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2047,33 +2026,33 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":237 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_2, 0, 0); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 237; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L14:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2082,7 +2061,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":239 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2095,7 +2074,7 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2104,7 +2083,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":242 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2113,7 +2092,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2122,17 +2101,17 @@ */ __pyx_v_offset = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< * f[0] = 0 # Terminate format string * */ - __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 244; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2146,8 +2125,8 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); __pyx_r = -1; __Pyx_GOTREF(__pyx_v_info->obj); @@ -2161,11 +2140,11 @@ __pyx_L2:; __Pyx_XDECREF((PyObject *)__pyx_v_descr); __Pyx_DECREF((PyObject *)__pyx_v_self); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2176,10 +2155,10 @@ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { int __pyx_t_1; - __Pyx_SetupRefcountContext("__releasebuffer__"); + __Pyx_RefNannySetupContext("__releasebuffer__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2189,7 +2168,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2201,7 +2180,7 @@ } __pyx_L5:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2211,7 +2190,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2224,10 +2203,10 @@ __pyx_L6:; __Pyx_DECREF((PyObject *)__pyx_v_self); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":704 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2235,12 +2214,12 @@ * */ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("PyArray_MultiIterNew1"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":705 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2248,7 +2227,7 @@ * cdef inline object PyArray_MultiIterNew2(a, b): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 705; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2262,11 +2241,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":707 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2274,12 +2253,12 @@ * */ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("PyArray_MultiIterNew2"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":708 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2287,7 +2266,7 @@ * cdef inline object PyArray_MultiIterNew3(a, b, c): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 708; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2301,11 +2280,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":710 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2313,12 +2292,12 @@ * */ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("PyArray_MultiIterNew3"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":711 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2326,7 +2305,7 @@ * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 711; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2340,11 +2319,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":713 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2352,12 +2331,12 @@ * */ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("PyArray_MultiIterNew4"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":714 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2365,7 +2344,7 @@ * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 714; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2379,11 +2358,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":716 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2391,12 +2370,12 @@ * */ -static INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("PyArray_MultiIterNew5"); + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":717 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2404,7 +2383,7 @@ * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 717; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_r = __pyx_t_1; __pyx_t_1 = 0; @@ -2418,11 +2397,11 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":719 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2430,7 +2409,7 @@ * # string. The new location in the format string is returned. */ -static INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { PyArray_Descr *__pyx_v_child; int __pyx_v_endian_detector; int __pyx_v_little_endian; @@ -2449,7 +2428,7 @@ int __pyx_t_8; int __pyx_t_9; char *__pyx_t_10; - __Pyx_SetupRefcountContext("_util_dtypestring"); + __Pyx_RefNannySetupContext("_util_dtypestring"); __Pyx_INCREF((PyObject *)__pyx_v_descr); __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); @@ -2457,7 +2436,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":726 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2466,7 +2445,7 @@ */ __pyx_v_endian_detector = 1; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":727 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2475,7 +2454,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":730 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2485,7 +2464,7 @@ if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); } else { - PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 730; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } for (;;) { if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; @@ -2494,21 +2473,21 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":731 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< * child, new_offset = fields * */ - __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - if (!(likely(PyTuple_CheckExact(__pyx_t_3)) || (__pyx_t_3) == Py_None || (PyErr_Format(PyExc_TypeError, "Expected tuple, got %s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 731; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_v_fields)); __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":732 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2518,7 +2497,7 @@ if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { PyObject* tuple = ((PyObject *)__pyx_v_fields); __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); __Pyx_DECREF(((PyObject *)__pyx_v_child)); __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); @@ -2528,127 +2507,114 @@ __pyx_t_4 = 0; } else { __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 732; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":734 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * */ - __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 734; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":735 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< * * if ((child.byteorder == '>' and little_endian) or */ - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); - PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_7)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); - __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_5)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L5; } __pyx_L5:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":737 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->byteorder); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, ((PyObject *)__pyx_kp_s_3), Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 737; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); if (__pyx_t_6) { __pyx_t_7 = __pyx_v_little_endian; - __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_8 = __pyx_t_6; + __pyx_t_7 = __pyx_t_6; } - if (!__pyx_t_8) { + if (!__pyx_t_7) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":738 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< * raise ValueError(u"Non-native byte order not supported") * # One could encode it in the format string and have Cython */ - __pyx_t_5 = PyInt_FromLong(__pyx_v_child->byteorder); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, ((PyObject *)__pyx_kp_s_4), Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 738; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); if (__pyx_t_6) { - __pyx_t_7 = (!__pyx_v_little_endian); - __pyx_t_9 = __pyx_t_7; + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; } else { __pyx_t_9 = __pyx_t_6; } __pyx_t_6 = __pyx_t_9; } else { - __pyx_t_6 = __pyx_t_8; + __pyx_t_6 = __pyx_t_7; } if (__pyx_t_6) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":739 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< * # One could encode it in the format string and have Cython * # complain instead, BUT: < and > in format strings also imply */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_5)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_5)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_5)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 739; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":749 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2656,16 +2622,16 @@ * f += 1 */ while (1) { - __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 749; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":750 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2674,7 +2640,7 @@ */ (__pyx_v_f[0]) = 120; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":751 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2683,7 +2649,7 @@ */ __pyx_v_f += 1; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":752 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2693,7 +2659,7 @@ (__pyx_v_offset[0]) += 1; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":754 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2702,7 +2668,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -2712,20 +2678,20 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":757 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") */ - __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 757; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_v_t); __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -2735,288 +2701,288 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< * * # Until ticket #99 is fixed, use integers to avoid warnings */ - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); - PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_8)); - __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); - __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_Raise(__pyx_t_5, 0, 0); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L10; } __pyx_L10:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" */ - __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 98; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":763 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" */ - __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 763; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 66; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" */ - __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 764; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 104; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" */ - __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 72; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":766 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" */ - __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 766; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 105; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" */ - __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 767; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 73; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 108; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":769 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 769; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 76; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 770; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 113; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":771 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 771; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 81; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":772 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 772; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 102; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":773 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 773; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 100; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":774 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 774; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 103; goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":775 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 775; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -3025,19 +2991,19 @@ goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":776 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 776; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -3046,19 +3012,19 @@ goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: */ - __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 777; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 90; @@ -3067,19 +3033,19 @@ goto __pyx_L11; } - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 778; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (__pyx_t_6) { (__pyx_v_f[0]) = 79; @@ -3087,30 +3053,30 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":780 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * f += 1 * else: */ - __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_6), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_4), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_5); PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 780; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } __pyx_L11:; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3122,21 +3088,21 @@ } /*else*/ { - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< * return f * */ - __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_10; } __pyx_L9:; } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3162,10 +3128,149 @@ __Pyx_DECREF(__pyx_v_new_offset); __Pyx_DECREF(__pyx_v_t); __Pyx_DECREF((PyObject *)__pyx_v_descr); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 + * + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: + */ + +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: + */ + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! + */ + __pyx_v_baseptr = NULL; + goto __pyx_L3; + } + /*else*/ { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) + */ + Py_INCREF(__pyx_v_base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr + * + */ + Py_XDECREF(__pyx_v_arr->base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; + } + /*else*/ { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + static struct PyMethodDef __pyx_methods[] = { {__Pyx_NAMESTR("cproduct"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_cproduct, METH_O, __Pyx_DOCSTR(0)}, {__Pyx_NAMESTR("squeeze_element"), (PyCFunction)__pyx_pf_5scipy_2io_6matlab_9mio_utils_squeeze_element, METH_O, __Pyx_DOCSTR(__pyx_doc_5scipy_2io_6matlab_9mio_utils_squeeze_element)}, @@ -3179,7 +3284,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("mio_utils"), - __Pyx_DOCSTR(__pyx_k_9), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_7), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3191,21 +3296,20 @@ static __Pyx_StringTabEntry __pyx_string_tab[] = { {&__pyx_kp_u_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 1, 0, 0}, - {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, - {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, - {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, - {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, - {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, {&__pyx_n_s__array, __pyx_k__array, sizeof(__pyx_k__array), 0, 0, 1, 1}, {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, {&__pyx_n_s__chars_to_strings, __pyx_k__chars_to_strings, sizeof(__pyx_k__chars_to_strings), 0, 0, 1, 1}, @@ -3237,8 +3341,8 @@ }; static int __Pyx_InitCachedBuiltins(void) { __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 12; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 735; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3263,18 +3367,18 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { PyErr_Clear(); - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); - if (!__Pyx_Refnanny) - Py_FatalError("failed to import refnanny module"); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_mio_utils(void)", __LINE__, __FILE__); #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3290,7 +3394,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_9), 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("mio_utils"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_7), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -3312,15 +3416,15 @@ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject)); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject)); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 134; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject)); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 797; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":5 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< @@ -3332,7 +3436,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/Users/stefan/src/scipy/scipy/io/matlab/mio_utils.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":1 * # -*- python -*- like file # <<<<<<<<<<<<<< * ''' Utilities for generic processing of return arrays from read * ''' @@ -3344,19 +3448,19 @@ __pyx_t_3 = __Pyx_GetAttrString(__pyx_t_2, "__doc__"); __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_10), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_8), __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyObject_GetAttr(__pyx_m, __pyx_n_s__chars_to_strings); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = __Pyx_GetAttrString(__pyx_t_3, "__doc__"); __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_11), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyDict_SetItem(__pyx_t_1, ((PyObject *)__pyx_kp_u_9), __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "/Users/stefan/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) @@ -3374,7 +3478,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.mio_utils"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -3394,19 +3498,19 @@ } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { PyErr_Format(PyExc_SystemError, "Missing type object"); return 0; } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) + if (likely(PyObject_TypeCheck(obj, type))) return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); return 0; } -static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { PyErr_Format(PyExc_ValueError, #if PY_VERSION_HEX < 0x02050000 "need more than %d value%s to unpack", (int)index, @@ -3416,7 +3520,7 @@ (index == 1) ? "" : "s"); } -static INLINE void __Pyx_RaiseTooManyValuesError(void) { +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } @@ -3443,7 +3547,7 @@ return -1; } -static INLINE void __Pyx_RaiseNoneNotIterableError(void) { +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); } @@ -3518,85 +3622,90 @@ return result; } -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { - /**/ if (sizeof(npy_intp) < sizeof(long)) - return PyInt_FromLong((long)val); - else if (sizeof(npy_intp) == sizeof(long)) - return (((npy_intp)-1) < ((npy_intp)0)) ? - PyInt_FromLong((long)val) : - PyLong_FromUnsignedLong((unsigned long)val); - else /* (sizeof(npy_intp) > sizeof(long)) */ - return (((npy_intp)-1) < ((npy_intp)0)) ? - PyLong_FromLongLong((PY_LONG_LONG)val) : - PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); +static CYTHON_INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp val) { + const npy_intp neg_one = (npy_intp)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(npy_intp) < sizeof(long)) { + return PyInt_FromLong((long)val); + } else if (sizeof(npy_intp) == sizeof(long)) { + if (is_unsigned) + return PyLong_FromUnsignedLong((unsigned long)val); + else + return PyInt_FromLong((long)val); + } else { /* (sizeof(npy_intp) > sizeof(long)) */ + if (is_unsigned) + return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)val); + else + return PyLong_FromLongLong((PY_LONG_LONG)val); + } } #if CYTHON_CCOMPLEX #ifdef __cplusplus - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return ::std::complex< float >(x, y); } #else - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { return x + y*(__pyx_t_float_complex)_Complex_I; } #endif #else - static INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { __pyx_t_float_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { __pyx_t_float_complex z; float denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { return (a.real == 0) && (a.imag == 0); } - static INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { __pyx_t_float_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { #if HAVE_HYPOT return hypotf(z.real, z.imag); #else @@ -3608,70 +3717,70 @@ #if CYTHON_CCOMPLEX #ifdef __cplusplus - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return ::std::complex< double >(x, y); } #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { return x + y*(__pyx_t_double_complex)_Complex_I; } #endif #else - static INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { __pyx_t_double_complex z; - z.real = x; - z.imag = y; - return z; + z.real = x; + z.imag = y; + return z; } #endif #if CYTHON_CCOMPLEX #else - static INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { return (a.real == b.real) && (a.imag == b.imag); } - static INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real + b.real; z.imag = a.imag + b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real - b.real; z.imag = a.imag - b.imag; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; z.real = a.real * b.real - a.imag * b.imag; z.imag = a.real * b.imag + a.imag * b.real; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { __pyx_t_double_complex z; double denom = b.real * b.real + b.imag * b.imag; z.real = (a.real * b.real + a.imag * b.imag) / denom; z.imag = (a.imag * b.real - a.real * b.imag) / denom; return z; } - static INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = -a.real; z.imag = -a.imag; return z; } - static INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { return (a.real == 0) && (a.imag == 0); } - static INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { __pyx_t_double_complex z; z.real = a.real; z.imag = -a.imag; return z; } /* - static INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { #if HAVE_HYPOT return hypot(z.real, z.imag); #else @@ -3681,81 +3790,34 @@ */ #endif -#if CYTHON_CCOMPLEX - #ifdef __cplusplus - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { - return ::std::complex< long double >(x, y); - } - #else - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { - return x + y*(__pyx_t_long_double_complex)_Complex_I; - } - #endif -#else - static INLINE __pyx_t_long_double_complex __pyx_t_long_double_complex_from_parts(long double x, long double y) { - __pyx_t_long_double_complex z; - z.real = x; - z.imag = y; - return z; - } -#endif +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); -#if CYTHON_CCOMPLEX -#else - static INLINE int __Pyx_c_eql(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { - return (a.real == b.real) && (a.imag == b.imag); - } - static INLINE __pyx_t_long_double_complex __Pyx_c_suml(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { - __pyx_t_long_double_complex z; - z.real = a.real + b.real; - z.imag = a.imag + b.imag; - return z; - } - static INLINE __pyx_t_long_double_complex __Pyx_c_diffl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { - __pyx_t_long_double_complex z; - z.real = a.real - b.real; - z.imag = a.imag - b.imag; - return z; - } - static INLINE __pyx_t_long_double_complex __Pyx_c_prodl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { - __pyx_t_long_double_complex z; - z.real = a.real * b.real - a.imag * b.imag; - z.imag = a.real * b.imag + a.imag * b.real; - return z; - } - static INLINE __pyx_t_long_double_complex __Pyx_c_quotl(__pyx_t_long_double_complex a, __pyx_t_long_double_complex b) { - __pyx_t_long_double_complex z; - long double denom = b.real * b.real + b.imag * b.imag; - z.real = (a.real * b.real + a.imag * b.imag) / denom; - z.imag = (a.imag * b.real - a.real * b.imag) / denom; - return z; - } - static INLINE __pyx_t_long_double_complex __Pyx_c_negl(__pyx_t_long_double_complex a) { - __pyx_t_long_double_complex z; - z.real = -a.real; - z.imag = -a.imag; - return z; - } - static INLINE int __Pyx_c_is_zerol(__pyx_t_long_double_complex a) { - return (a.real == 0) && (a.imag == 0); - } - static INLINE __pyx_t_long_double_complex __Pyx_c_conjl(__pyx_t_long_double_complex a) { - __pyx_t_long_double_complex z; - z.real = a.real; - z.imag = -a.imag; - return z; - } -/* - static INLINE long double __Pyx_c_absl(__pyx_t_long_double_complex z) { -#if HAVE_HYPOT - return hypotl(z.real, z.imag); -#else - return sqrtl(z.real*z.real + z.imag*z.imag); -#endif - } -*/ -#endif + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3811,6 +3873,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3820,57 +3883,59 @@ return; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); +#else /* Python 3+ */ -#if PY_MAJOR_VERSION >= 3 - /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ - if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - PyErr_NormalizeException(&type, &value, &tb); - PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); - tstate->exc_type = 0; - tstate->exc_value = 0; - tstate->exc_traceback = 0; - PyException_SetContext(value, tmp_value); - Py_DECREF(tmp_type); - Py_XDECREF(tmp_tb); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } -#endif + if (value == Py_None) + value = 0; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; + PyErr_SetObject(type, value); - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -3881,13 +3946,15 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -3898,13 +3965,15 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -3915,13 +3984,15 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((char)-1) > ((char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -3932,13 +4003,15 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((short)-1) > ((short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -3949,13 +4022,15 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((int)-1) > ((int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -3966,13 +4041,15 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -3983,13 +4060,15 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -4000,13 +4079,15 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -4017,11 +4098,13 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -4030,14 +4113,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((unsigned long)-1) < ((unsigned long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4048,11 +4133,13 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -4061,14 +4148,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4079,11 +4168,13 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((long)-1) > ((long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -4092,14 +4183,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((long)-1) < ((long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4110,11 +4203,13 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -4123,14 +4218,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4141,11 +4238,13 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -4154,14 +4253,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((signed long)-1) < ((signed long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4172,11 +4273,13 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -4185,14 +4288,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4224,11 +4329,12 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -4253,9 +4359,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -4391,13 +4503,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -4443,7 +4555,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -4452,7 +4564,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -4466,7 +4578,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: trunk/scipy/io/matlab/streams.c =================================================================== --- trunk/scipy/io/matlab/streams.c 2010-06-16 15:21:49 UTC (rev 6510) +++ trunk/scipy/io/matlab/streams.c 2010-06-16 16:37:26 UTC (rev 6511) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Tue Jan 5 22:26:04 2010 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:30:36 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -15,7 +16,9 @@ #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -25,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -35,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -59,22 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type - #define PyString_CheckExact PyBytes_CheckExact + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -89,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -109,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -118,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -135,24 +156,20 @@ #include "stdlib.h" #include "fileobject.h" #include "cStringIO.h" -#define __PYX_USE_C99_COMPLEX defined(_Complex_I) - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -static int __pyx_skip_dispatch = 0; - - /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 @@ -169,8 +186,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -234,9 +251,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -266,101 +283,9 @@ static const char **__pyx_f; -#ifdef CYTHON_REFNANNY -typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*NewContext)(const char*, int, const char*); - void (*FinishContext)(void**); -} __Pyx_RefnannyAPIStruct; -static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; -#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") -#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) -#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) -#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) -#else -#define __Pyx_INCREF(r) Py_INCREF(r) -#define __Pyx_DECREF(r) Py_DECREF(r) -#define __Pyx_GOTREF(r) -#define __Pyx_GIVEREF(r) -#define __Pyx_XDECREF(r) Py_XDECREF(r) -#define __Pyx_SetupRefcountContext(name) -#define __Pyx_FinishRefcountContext() -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - /* Type declarations */ -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":6 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":6 * cdef object fobj * * cpdef int seek(self, long int offset, int whence=*) except -1 # <<<<<<<<<<<<<< @@ -373,7 +298,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":9 * cpdef long int tell(self) except -1 * cdef int read_into(self, void *buf, size_t n) except -1 * cdef object read_string(self, size_t n, void **pp, int copy=*) # <<<<<<<<<<<<<< @@ -386,7 +311,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -399,7 +324,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":109 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -412,7 +337,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -425,7 +350,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":173 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":173 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -438,7 +363,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -452,7 +377,7 @@ PyObject *fobj; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":87 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":87 * * * cdef class cStringStream(GenericStream): # <<<<<<<<<<<<<< @@ -464,7 +389,7 @@ struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream __pyx_base; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":125 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":125 * * * cdef class FileStream(GenericStream): # <<<<<<<<<<<<<< @@ -478,7 +403,7 @@ }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":47 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":47 * * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -495,7 +420,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":125 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":125 * * * cdef class FileStream(GenericStream): # <<<<<<<<<<<<<< @@ -509,7 +434,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_FileStream; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":87 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":87 * * * cdef class cStringStream(GenericStream): # <<<<<<<<<<<<<< @@ -521,11 +446,119 @@ struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream __pyx_base; }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_cStringStream; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from python_ref */ + /* Module declarations from python_string */ /* Module declarations from scipy.io.matlab.pyalloc */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t, void **); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t, void **); /*proto*/ /* Module declarations from __builtin__ */ /* Module declarations from scipy.io.matlab.streams */ @@ -539,53 +572,45 @@ int __pyx_module_is_main_scipy__io__matlab__streams = 0; /* Implementation of scipy.io.matlab.streams */ -static char __pyx_k___main__[] = "__main__"; -static PyObject *__pyx_kp___main__; -static char __pyx_k___init__[] = "__init__"; -static PyObject *__pyx_kp___init__; -static char __pyx_k_seek[] = "seek"; -static PyObject *__pyx_kp_seek; -static char __pyx_k_tell[] = "tell"; -static PyObject *__pyx_kp_tell; -static char __pyx_k_read[] = "read"; -static PyObject *__pyx_kp_read; -static char __pyx_k_make_stream[] = "make_stream"; -static PyObject *__pyx_kp_make_stream; -static char __pyx_k_fobj[] = "fobj"; -static PyObject *__pyx_kp_fobj; -static char __pyx_k_offset[] = "offset"; -static PyObject *__pyx_kp_offset; -static char __pyx_k_whence[] = "whence"; -static PyObject *__pyx_kp_whence; -static char __pyx_k_n_bytes[] = "n_bytes"; -static PyObject *__pyx_kp_n_bytes; -static char __pyx_k_st[] = "st"; -static PyObject *__pyx_kp_st; -static char __pyx_k_n[] = "n"; -static PyObject *__pyx_kp_n; -static char __pyx_k_IOError[] = "IOError"; -static PyObject *__pyx_kp_IOError; -static char __pyx_k_9[] = "A"; -static PyObject *__pyx_kp_9; static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_kp_1; static char __pyx_k_1[] = "could not read bytes"; -static PyObject *__pyx_kp_2; -static char __pyx_k_2[] = "could not read bytes"; -static PyObject *__pyx_kp_3; -static char __pyx_k_3[] = "could not read bytes"; -static PyObject *__pyx_kp_4; -static char __pyx_k_4[] = "could not read bytes"; -static PyObject *__pyx_kp_5; -static char __pyx_k_5[] = "Failed seek"; -static PyObject *__pyx_kp_6; -static char __pyx_k_6[] = "Could not read bytes"; -static PyObject *__pyx_kp_7; -static char __pyx_k_7[] = "could not read bytes"; -static PyObject *__pyx_kp_8; -static char __pyx_k_8[] = " "; +static char __pyx_k_2[] = "Failed seek"; +static char __pyx_k_3[] = "Could not read bytes"; +static char __pyx_k_4[] = " "; +static char __pyx_k__A[] = "A"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__st[] = "st"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__fobj[] = "fobj"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__whence[] = "whence"; +static char __pyx_k__IOError[] = "IOError"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k__read_into[] = "read_into"; +static char __pyx_k__read_string[] = "read_string"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_n_s__A; +static PyObject *__pyx_n_s__IOError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__fobj; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_into; +static PyObject *__pyx_n_s__read_string; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__st; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_n_s__whence; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":49 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":49 * cdef class GenericStream: * * def __init__(self, fobj): # <<<<<<<<<<<<<< @@ -597,8 +622,8 @@ static int __pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fobj = 0; int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fobj,0}; - __Pyx_SetupRefcountContext("__init__"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fobj,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -609,7 +634,7 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_fobj); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fobj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } @@ -630,7 +655,7 @@ return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":50 * * def __init__(self, fobj): * self.fobj = fobj # <<<<<<<<<<<<<< @@ -644,11 +669,11 @@ ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj = __pyx_v_fobj; __pyx_r = 0; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":52 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":52 * self.fobj = fobj * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -658,15 +683,14 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); int __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_SetupRefcountContext("seek"); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; @@ -676,61 +700,61 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":53 * * cpdef int seek(self, long int offset, int whence=0) except -1: * self.fobj.seek(offset, whence) # <<<<<<<<<<<<<< * return 0 * */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":54 * cpdef int seek(self, long int offset, int whence=0) except -1: * self.fobj.seek(offset, whence) * return 0 # <<<<<<<<<<<<<< @@ -743,19 +767,18 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":52 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":52 * self.fobj = fobj * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -768,11 +791,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -784,12 +807,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -800,10 +823,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -819,28 +842,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":56 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":56 * return 0 * * cpdef long int tell(self) except -1: # <<<<<<<<<<<<<< @@ -851,60 +874,58 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static long __pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_tell(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, int __pyx_skip_dispatch) { long __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("tell"); + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_RefNannySetupContext("tell"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_tell); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell)) { - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":57 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":57 * * cpdef long int tell(self) except -1: * return self.fobj.tell() # <<<<<<<<<<<<<< * * def read(self, n_bytes): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.tell"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":56 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":56 * return 0 * * cpdef long int tell(self) except -1: # <<<<<<<<<<<<<< @@ -917,7 +938,7 @@ PyObject *__pyx_r = NULL; long __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_SetupRefcountContext("tell"); + __Pyx_RefNannySetupContext("tell"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->tell(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -934,11 +955,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":59 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":59 * return self.fobj.tell() * * def read(self, n_bytes): # <<<<<<<<<<<<<< @@ -952,9 +973,9 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read"); + __Pyx_RefNannySetupContext("read"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":60 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":60 * * def read(self, n_bytes): * return self.fobj.read(n_bytes) # <<<<<<<<<<<<<< @@ -962,17 +983,17 @@ * cdef int read_into(self, void *buf, size_t n) except -1: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n_bytes); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n_bytes); __Pyx_GIVEREF(__pyx_v_n_bytes); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; @@ -987,11 +1008,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":62 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":62 * return self.fobj.read(n_bytes) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -1006,46 +1027,49 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; - __Pyx_SetupRefcountContext("read_into"); + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":66 * ''' * cdef char* d_ptr * data = self.fobj.read(n) # <<<<<<<<<<<<<< * if PyString_Size(data) != n: * raise IOError('could not read bytes') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":67 * cdef char* d_ptr * data = self.fobj.read(n) * if PyString_Size(data) != n: # <<<<<<<<<<<<<< * raise IOError('could not read bytes') * return -1 */ - __pyx_t_4 = (PyString_Size(__pyx_v_data) != __pyx_v_n); - if (__pyx_t_4) { + __pyx_t_4 = PyString_Size(__pyx_v_data); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 != __pyx_v_n); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":68 * data = self.fobj.read(n) * if PyString_Size(data) != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1053,18 +1077,18 @@ * d_ptr = data */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); - __Pyx_GIVEREF(__pyx_kp_1); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":69 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":69 * if PyString_Size(data) != n: * raise IOError('could not read bytes') * return -1 # <<<<<<<<<<<<<< @@ -1077,17 +1101,17 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":70 * raise IOError('could not read bytes') * return -1 * d_ptr = data # <<<<<<<<<<<<<< * memcpy(buf, d_ptr, n) * return 0 */ - __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_d_ptr = __pyx_t_5; + __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_d_ptr = __pyx_t_6; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":71 * return -1 * d_ptr = data * memcpy(buf, d_ptr, n) # <<<<<<<<<<<<<< @@ -1096,7 +1120,7 @@ */ memcpy(__pyx_v_buf, __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":72 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":72 * d_ptr = data * memcpy(buf, d_ptr, n) * return 0 # <<<<<<<<<<<<<< @@ -1116,11 +1140,12 @@ __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(__pyx_v_data); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":74 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":74 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -1129,57 +1154,60 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); PyObject *__pyx_v_data; PyObject *__pyx_v_d_copy = 0; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_SetupRefcountContext("read_string"); + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":76 * cdef object read_string(self, size_t n, void **pp, int copy=True): * ''' Make new memory, wrap with object ''' * data = self.fobj.read(n) # <<<<<<<<<<<<<< * if PyString_Size(data) != n: * raise IOError('could not read bytes') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":77 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":77 * ''' Make new memory, wrap with object ''' * data = self.fobj.read(n) * if PyString_Size(data) != n: # <<<<<<<<<<<<<< * raise IOError('could not read bytes') * if copy != True: */ - __pyx_t_4 = (PyString_Size(__pyx_v_data) != __pyx_v_n); - if (__pyx_t_4) { + __pyx_t_4 = PyString_Size(__pyx_v_data); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 != __pyx_v_n); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":78 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":78 * data = self.fobj.read(n) * if PyString_Size(data) != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1187,13 +1215,13 @@ * pp[0] = PyString_AS_STRING(data) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_2); - __Pyx_GIVEREF(__pyx_kp_2); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1201,17 +1229,17 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":79 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":79 * if PyString_Size(data) != n: * raise IOError('could not read bytes') * if copy != True: # <<<<<<<<<<<<<< * pp[0] = PyString_AS_STRING(data) * return data */ - __pyx_t_4 = (__pyx_v_copy != 1); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_copy != 1); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":80 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":80 * raise IOError('could not read bytes') * if copy != True: * pp[0] = PyString_AS_STRING(data) # <<<<<<<<<<<<<< @@ -1220,7 +1248,7 @@ */ (__pyx_v_pp[0]) = ((void *)PyString_AS_STRING(__pyx_v_data)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":81 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":81 * if copy != True: * pp[0] = PyString_AS_STRING(data) * return data # <<<<<<<<<<<<<< @@ -1235,7 +1263,7 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":82 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":82 * pp[0] = PyString_AS_STRING(data) * return data * cdef object d_copy = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -1247,7 +1275,7 @@ __pyx_v_d_copy = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":83 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":83 * return data * cdef object d_copy = pyalloc_v(n, pp) * memcpy(pp[0], PyString_AS_STRING(data), n) # <<<<<<<<<<<<<< @@ -1256,7 +1284,7 @@ */ memcpy((__pyx_v_pp[0]), PyString_AS_STRING(__pyx_v_data), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":84 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":84 * cdef object d_copy = pyalloc_v(n, pp) * memcpy(pp[0], PyString_AS_STRING(data), n) * return d_copy # <<<<<<<<<<<<<< @@ -1279,12 +1307,13 @@ __pyx_L0:; __Pyx_DECREF(__pyx_v_data); __Pyx_XDECREF(__pyx_v_d_copy); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1294,68 +1323,73 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_13cStringStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13cStringStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); char *__pyx_v_ptr; int __pyx_r; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_2; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - __Pyx_SetupRefcountContext("seek"); + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_9; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":91 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":91 * cpdef int seek(self, long int offset, int whence=0) except -1: * cdef char *ptr * if whence == 1 and offset >=0: # forward, from here # <<<<<<<<<<<<<< * StringIO_cread(self.fobj, &ptr, offset) * return 0 */ - if ((__pyx_v_whence == 1)) { - __pyx_t_5 = (__pyx_v_offset >= 0); + __pyx_t_6 = (__pyx_v_whence == 1); + if (__pyx_t_6) { + __pyx_t_7 = (__pyx_v_offset >= 0); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_5 = (__pyx_v_whence == 1); + __pyx_t_8 = __pyx_t_6; } - if (__pyx_t_5) { + if (__pyx_t_8) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":92 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":92 * cdef char *ptr * if whence == 1 and offset >=0: # forward, from here * StringIO_cread(self.fobj, &ptr, offset) # <<<<<<<<<<<<<< @@ -1364,7 +1398,7 @@ */ PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_ptr), __pyx_v_offset); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":93 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":93 * if whence == 1 and offset >=0: # forward, from here * StringIO_cread(self.fobj, &ptr, offset) * return 0 # <<<<<<<<<<<<<< @@ -1377,17 +1411,17 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":95 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":95 * return 0 * else: # use python interface * return GenericStream.seek(self, offset, whence) # <<<<<<<<<<<<<< * * cdef int read_into(self, void *buf, size_t n) except -1: */ - __pyx_2.__pyx_n = 1; - __pyx_2.whence = __pyx_v_whence; - __pyx_t_4 = __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_4; + __pyx_t_9.__pyx_n = 1; + __pyx_t_9.whence = __pyx_v_whence; + __pyx_t_5 = __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_9); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_5; goto __pyx_L0; } __pyx_L3:; @@ -1395,18 +1429,19 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1419,11 +1454,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -1435,12 +1470,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -1451,10 +1486,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1470,28 +1505,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":97 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":97 * return GenericStream.seek(self, offset, whence) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -1506,9 +1541,10 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_into"); + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":103 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":103 * size_t n_red * char* d_ptr * n_red = StringIO_cread(self.fobj, &d_ptr, n) # <<<<<<<<<<<<<< @@ -1517,7 +1553,7 @@ */ __pyx_v_n_red = PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":104 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":104 * char* d_ptr * n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: # <<<<<<<<<<<<<< @@ -1527,7 +1563,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":105 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":105 * n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1535,13 +1571,13 @@ * return 0 */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_3); - __Pyx_GIVEREF(__pyx_kp_3); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1549,7 +1585,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":106 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":106 * if n_red != n: * raise IOError('could not read bytes') * memcpy(buf, d_ptr, n) # <<<<<<<<<<<<<< @@ -1558,7 +1594,7 @@ */ memcpy(__pyx_v_buf, ((void *)__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":107 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":107 * raise IOError('could not read bytes') * memcpy(buf, d_ptr, n) * return 0 # <<<<<<<<<<<<<< @@ -1576,11 +1612,12 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.read_into"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":109 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -1589,7 +1626,7 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_13cStringStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13cStringStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); char *__pyx_v_d_ptr; PyObject *__pyx_v_obj; size_t __pyx_v_n_red; @@ -1597,15 +1634,16 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_string"); + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":117 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":117 * char *d_ptr * object obj * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) # <<<<<<<<<<<<<< @@ -1614,7 +1652,7 @@ */ __pyx_v_n_red = PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":118 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":118 * object obj * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: # <<<<<<<<<<<<<< @@ -1624,7 +1662,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":119 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":119 * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1632,13 +1670,13 @@ * memcpy(pp[0], d_ptr, n) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_4); - __Pyx_GIVEREF(__pyx_kp_4); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1646,7 +1684,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":120 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":120 * if n_red != n: * raise IOError('could not read bytes') * obj = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -1659,7 +1697,7 @@ __pyx_v_obj = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":121 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":121 * raise IOError('could not read bytes') * obj = pyalloc_v(n, pp) * memcpy(pp[0], d_ptr, n) # <<<<<<<<<<<<<< @@ -1668,7 +1706,7 @@ */ memcpy((__pyx_v_pp[0]), __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":122 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":122 * obj = pyalloc_v(n, pp) * memcpy(pp[0], d_ptr, n) * return obj # <<<<<<<<<<<<<< @@ -1689,12 +1727,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_obj); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":128 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":128 * cdef FILE* file * * def __init__(self, fobj): # <<<<<<<<<<<<<< @@ -1706,8 +1745,8 @@ static int __pyx_pf_5scipy_2io_6matlab_7streams_10FileStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fobj = 0; int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fobj,0}; - __Pyx_SetupRefcountContext("__init__"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fobj,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -1718,7 +1757,7 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_fobj); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fobj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } @@ -1739,7 +1778,7 @@ return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":129 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":129 * * def __init__(self, fobj): * self.fobj = fobj # <<<<<<<<<<<<<< @@ -1752,7 +1791,7 @@ __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.fobj); ((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.fobj = __pyx_v_fobj; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":130 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":130 * def __init__(self, fobj): * self.fobj = fobj * self.file = PyFile_AsFile(fobj) # <<<<<<<<<<<<<< @@ -1762,11 +1801,11 @@ ((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->file = PyFile_AsFile(__pyx_v_fobj); __pyx_r = 0; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1776,52 +1815,53 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_10FileStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_10FileStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); int __pyx_v_ret; int __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_SetupRefcountContext("seek"); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":152 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":152 * ret : int * ''' * ret = fseek(self.file, offset, whence) # <<<<<<<<<<<<<< @@ -1830,36 +1870,36 @@ */ __pyx_v_ret = fseek(__pyx_v_self->file, __pyx_v_offset, __pyx_v_whence); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":153 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":153 * ''' * ret = fseek(self.file, offset, whence) * if ret: # <<<<<<<<<<<<<< * raise IOError('Failed seek') * return -1 */ - __pyx_t_4 = __pyx_v_ret; - if (__pyx_t_4) { + __pyx_t_5 = __pyx_v_ret; + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":154 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":154 * ret = fseek(self.file, offset, whence) * if ret: * raise IOError('Failed seek') # <<<<<<<<<<<<<< * return -1 * return ret */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_5); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); - __Pyx_GIVEREF(__pyx_kp_5); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":155 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":155 * if ret: * raise IOError('Failed seek') * return -1 # <<<<<<<<<<<<<< @@ -1872,7 +1912,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":156 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":156 * raise IOError('Failed seek') * return -1 * return ret # <<<<<<<<<<<<<< @@ -1885,18 +1925,19 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1909,11 +1950,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -1925,12 +1966,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -1941,10 +1982,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1960,28 +2001,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":158 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":158 * return ret * * cpdef long int tell(self): # <<<<<<<<<<<<<< @@ -1992,29 +2033,29 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static long __pyx_f_5scipy_2io_6matlab_7streams_10FileStream_tell(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, int __pyx_skip_dispatch) { long __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - __Pyx_SetupRefcountContext("tell"); + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_RefNannySetupContext("tell"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_tell); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell)) { - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":159 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":159 * * cpdef long int tell(self): * return ftell(self.file) # <<<<<<<<<<<<<< @@ -2027,16 +2068,16 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.tell"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":158 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":158 * return ret * * cpdef long int tell(self): # <<<<<<<<<<<<<< @@ -2049,7 +2090,7 @@ PyObject *__pyx_r = NULL; long __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_SetupRefcountContext("tell"); + __Pyx_RefNannySetupContext("tell"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.tell(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2066,11 +2107,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":161 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":161 * return ftell(self.file) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -2084,9 +2125,10 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_into"); + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":167 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":167 * size_t n_red * char* d_ptr * n_red = fread(buf, 1, n, self.file) # <<<<<<<<<<<<<< @@ -2095,7 +2137,7 @@ */ __pyx_v_n_red = fread(__pyx_v_buf, 1, __pyx_v_n, __pyx_v_self->file); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":168 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":168 * char* d_ptr * n_red = fread(buf, 1, n, self.file) * if n_red != n: # <<<<<<<<<<<<<< @@ -2105,7 +2147,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":169 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":169 * n_red = fread(buf, 1, n, self.file) * if n_red != n: * raise IOError('Could not read bytes') # <<<<<<<<<<<<<< @@ -2113,18 +2155,18 @@ * return 0 */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_6); - __Pyx_GIVEREF(__pyx_kp_6); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":170 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":170 * if n_red != n: * raise IOError('Could not read bytes') * return -1 # <<<<<<<<<<<<<< @@ -2137,7 +2179,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":171 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":171 * raise IOError('Could not read bytes') * return -1 * return 0 # <<<<<<<<<<<<<< @@ -2155,11 +2197,12 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.read_into"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":173 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":173 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -2168,21 +2211,22 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_10FileStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_10FileStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); PyObject *__pyx_v_obj = 0; size_t __pyx_v_n_red; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_string"); + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":175 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":175 * cdef object read_string(self, size_t n, void **pp, int copy=True): * ''' Make new memory, wrap with object ''' * cdef object obj = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -2194,7 +2238,7 @@ __pyx_v_obj = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":176 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":176 * ''' Make new memory, wrap with object ''' * cdef object obj = pyalloc_v(n, pp) * cdef size_t n_red = fread(pp[0], 1, n, self.file) # <<<<<<<<<<<<<< @@ -2203,7 +2247,7 @@ */ __pyx_v_n_red = fread((__pyx_v_pp[0]), 1, __pyx_v_n, __pyx_v_self->file); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":177 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":177 * cdef object obj = pyalloc_v(n, pp) * cdef size_t n_red = fread(pp[0], 1, n, self.file) * if n_red != n: # <<<<<<<<<<<<<< @@ -2213,7 +2257,7 @@ __pyx_t_2 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":178 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":178 * cdef size_t n_red = fread(pp[0], 1, n, self.file) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -2221,13 +2265,13 @@ * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_7); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_7); - __Pyx_GIVEREF(__pyx_kp_7); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2235,7 +2279,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":179 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":179 * if n_red != n: * raise IOError('could not read bytes') * return obj # <<<<<<<<<<<<<< @@ -2256,12 +2300,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":182 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":182 * * * def _read_into(GenericStream st, size_t n): # <<<<<<<<<<<<<< @@ -2280,8 +2325,8 @@ PyObject *__pyx_t_2 = NULL; char *__pyx_t_3; int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_st,&__pyx_kp_n,0}; - __Pyx_SetupRefcountContext("_read_into"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__st,&__pyx_n_s__n,0}; + __Pyx_RefNannySetupContext("_read_into"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); @@ -2294,11 +2339,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_st); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__st); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_read_into", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -2325,7 +2370,7 @@ __pyx_v_my_str = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_st), __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream, 1, "st", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":185 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":185 * # for testing only. Use st.read instead * cdef char * d_ptr * my_str = ' ' * n # <<<<<<<<<<<<<< @@ -2334,14 +2379,14 @@ */ __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_kp_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_4), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_my_str); __pyx_v_my_str = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":186 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":186 * cdef char * d_ptr * my_str = ' ' * n * d_ptr = my_str # <<<<<<<<<<<<<< @@ -2351,7 +2396,7 @@ __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_d_ptr = __pyx_t_3; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":187 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":187 * my_str = ' ' * n * d_ptr = my_str * st.read_into(d_ptr, n) # <<<<<<<<<<<<<< @@ -2360,7 +2405,7 @@ */ __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_into(__pyx_v_st, __pyx_v_d_ptr, __pyx_v_n); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":188 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":188 * d_ptr = my_str * st.read_into(d_ptr, n) * return my_str # <<<<<<<<<<<<<< @@ -2382,11 +2427,11 @@ __pyx_L0:; __Pyx_DECREF(__pyx_v_my_str); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":191 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":191 * * * def _read_string(GenericStream st, size_t n): # <<<<<<<<<<<<<< @@ -2403,12 +2448,12 @@ PyObject *__pyx_v_my_str; char *__pyx_v_mys_ptr; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_1; PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - char *__pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_st,&__pyx_kp_n,0}; - __Pyx_SetupRefcountContext("_read_string"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__st,&__pyx_n_s__n,0}; + __Pyx_RefNannySetupContext("_read_string"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); @@ -2421,11 +2466,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_st); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__st); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -2452,21 +2497,21 @@ __pyx_v_my_str = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_st), __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream, 1, "st", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":194 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":194 * # for testing only. Use st.read instead * cdef char *d_ptr * cdef object obj = st.read_string(n, &d_ptr, True) # <<<<<<<<<<<<<< * my_str = 'A' * n * cdef char *mys_ptr = my_str */ - __pyx_1.__pyx_n = 1; - __pyx_1.copy = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_string(__pyx_v_st, __pyx_v_n, ((void **)(&__pyx_v_d_ptr)), &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.copy = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_string(__pyx_v_st, __pyx_v_n, ((void **)(&__pyx_v_d_ptr)), &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_obj = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":195 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":195 * cdef char *d_ptr * cdef object obj = st.read_string(n, &d_ptr, True) * my_str = 'A' * n # <<<<<<<<<<<<<< @@ -2475,24 +2520,24 @@ */ __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_kp_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_n_s__A), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_my_str); - __pyx_v_my_str = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_my_str = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":196 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":196 * cdef object obj = st.read_string(n, &d_ptr, True) * my_str = 'A' * n * cdef char *mys_ptr = my_str # <<<<<<<<<<<<<< * memcpy(mys_ptr, d_ptr, n) * return my_str */ - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_mys_ptr = __pyx_t_3; + __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_mys_ptr = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":197 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":197 * my_str = 'A' * n * cdef char *mys_ptr = my_str * memcpy(mys_ptr, d_ptr, n) # <<<<<<<<<<<<<< @@ -2501,7 +2546,7 @@ */ memcpy(__pyx_v_mys_ptr, __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":198 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":198 * cdef char *mys_ptr = my_str * memcpy(mys_ptr, d_ptr, n) * return my_str # <<<<<<<<<<<<<< @@ -2517,18 +2562,18 @@ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams._read_string"); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); __Pyx_DECREF(__pyx_v_my_str); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":201 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":201 * * * cpdef GenericStream make_stream(object fobj): # <<<<<<<<<<<<<< @@ -2542,9 +2587,12 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("make_stream"); + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("make_stream"); + __Pyx_INCREF(__pyx_v_fobj); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":204 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":204 * ''' Make stream of correct type for file-like `fobj` * ''' * if isinstance(fobj, file): # <<<<<<<<<<<<<< @@ -2554,7 +2602,7 @@ __pyx_t_1 = PyObject_TypeCheck(__pyx_v_fobj, ((PyTypeObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_file))); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":205 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":205 * ''' * if isinstance(fobj, file): * return FileStream(fobj) # <<<<<<<<<<<<<< @@ -2563,35 +2611,36 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_FileStream)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_FileStream)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L3; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":206 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":206 * if isinstance(fobj, file): * return FileStream(fobj) * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): # <<<<<<<<<<<<<< * return cStringStream(fobj) * return GenericStream(fobj) */ - if (!PycStringIO_InputCheck(__pyx_v_fobj)) { - __pyx_t_1 = PycStringIO_OutputCheck(__pyx_v_fobj); + __pyx_t_1 = PycStringIO_InputCheck(__pyx_v_fobj); + if (!__pyx_t_1) { + __pyx_t_4 = PycStringIO_OutputCheck(__pyx_v_fobj); + __pyx_t_5 = __pyx_t_4; } else { - __pyx_t_1 = PycStringIO_InputCheck(__pyx_v_fobj); + __pyx_t_5 = __pyx_t_1; } - if (__pyx_t_1) { + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":207 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":207 * return FileStream(fobj) * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): * return cStringStream(fobj) # <<<<<<<<<<<<<< @@ -2600,14 +2649,13 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_cStringStream)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_cStringStream)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -2615,7 +2663,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":208 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":208 * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): * return cStringStream(fobj) * return GenericStream(fobj) # <<<<<<<<<<<<<< @@ -2624,14 +2672,13 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -2644,12 +2691,13 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.make_stream"); __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF(__pyx_v_fobj); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":201 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":201 * * * cpdef GenericStream make_stream(object fobj): # <<<<<<<<<<<<<< @@ -2662,7 +2710,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_make_stream(PyObject *__pyx_self, PyObject *__pyx_v_fobj) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("make_stream"); + __Pyx_RefNannySetupContext("make_stream"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_7streams_make_stream(__pyx_v_fobj, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2679,11 +2727,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":8 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":8 * * # Function to allocate, wrap memory via Python string creation * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): # <<<<<<<<<<<<<< @@ -2691,13 +2739,13 @@ * pp[0] = PyString_AS_STRING(ob) */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t __pyx_v_n, void **__pyx_v_pp) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t __pyx_v_n, void **__pyx_v_pp) { PyObject *__pyx_v_ob = 0; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("pyalloc_v"); + __Pyx_RefNannySetupContext("pyalloc_v"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":9 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":9 * # Function to allocate, wrap memory via Python string creation * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): * cdef object ob = PyString_FromStringAndSize(NULL, n) # <<<<<<<<<<<<<< @@ -2709,7 +2757,7 @@ __pyx_v_ob = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":10 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":10 * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): * cdef object ob = PyString_FromStringAndSize(NULL, n) * pp[0] = PyString_AS_STRING(ob) # <<<<<<<<<<<<<< @@ -2718,7 +2766,7 @@ */ (__pyx_v_pp[0]) = ((void *)PyString_AS_STRING(__pyx_v_ob)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":11 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":11 * cdef object ob = PyString_FromStringAndSize(NULL, n) * pp[0] = PyString_AS_STRING(ob) * return ob # <<<<<<<<<<<<<< @@ -2739,7 +2787,7 @@ __pyx_L0:; __Pyx_XDECREF(__pyx_v_ob); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream __pyx_vtable_5scipy_2io_6matlab_7streams_GenericStream; @@ -2929,6 +2977,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream __pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream; @@ -3090,6 +3142,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream __pyx_vtable_5scipy_2io_6matlab_7streams_FileStream; @@ -3252,6 +3308,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -3278,32 +3338,28 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, - {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 1, 1, 1}, - {&__pyx_kp_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 1, 1, 1}, - {&__pyx_kp_read, __pyx_k_read, sizeof(__pyx_k_read), 1, 1, 1}, - {&__pyx_kp_make_stream, __pyx_k_make_stream, sizeof(__pyx_k_make_stream), 1, 1, 1}, - {&__pyx_kp_fobj, __pyx_k_fobj, sizeof(__pyx_k_fobj), 1, 1, 1}, - {&__pyx_kp_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 1, 1, 1}, - {&__pyx_kp_whence, __pyx_k_whence, sizeof(__pyx_k_whence), 1, 1, 1}, - {&__pyx_kp_n_bytes, __pyx_k_n_bytes, sizeof(__pyx_k_n_bytes), 1, 1, 1}, - {&__pyx_kp_st, __pyx_k_st, sizeof(__pyx_k_st), 1, 1, 1}, - {&__pyx_kp_n, __pyx_k_n, sizeof(__pyx_k_n), 1, 1, 1}, - {&__pyx_kp_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 1, 1, 1}, - {&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0}, - {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, - {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, - {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0}, - {&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, + {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__fobj, __pyx_k__fobj, sizeof(__pyx_k__fobj), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_into, __pyx_k__read_into, sizeof(__pyx_k__read_into), 0, 0, 1, 1}, + {&__pyx_n_s__read_string, __pyx_k__read_string, sizeof(__pyx_k__read_string), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__st, __pyx_k__st, sizeof(__pyx_k__st), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {&__pyx_n_s__whence, __pyx_k__whence, sizeof(__pyx_k__whence), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_kp_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3324,19 +3380,18 @@ PyMODINIT_FUNC PyInit_streams(void) #endif { - PyObject *__pyx_1 = 0; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { PyErr_Clear(); - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); - if (!__Pyx_Refnanny) - Py_FatalError("failed to import refnanny module"); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_streams(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_streams(void)", __LINE__, __FILE__); #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3363,14 +3418,13 @@ __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_scipy__io__matlab__streams) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ if (__Pyx_ExportFunction("make_stream", (void (*)(void))__pyx_f_5scipy_2io_6matlab_7streams_make_stream, "struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *(PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3391,7 +3445,7 @@ if (__Pyx_SetVtable(__pyx_type_5scipy_2io_6matlab_7streams_GenericStream.tp_dict, __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "GenericStream", (PyObject *)&__pyx_type_5scipy_2io_6matlab_7streams_GenericStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream = &__pyx_type_5scipy_2io_6matlab_7streams_GenericStream; - __pyx_ptype_5scipy_2io_6matlab_7streams_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject)); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_file)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5scipy_2io_6matlab_7streams_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_file)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_5scipy_2io_6matlab_7streams_cStringStream = &__pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream; __pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream.__pyx_base = *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; #if PY_MAJOR_VERSION >= 3 @@ -3430,7 +3484,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":44 * * # initialize cStringIO * PycString_IMPORT # <<<<<<<<<<<<<< @@ -3439,14 +3493,13 @@ */ PycString_IMPORT; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":1 * # -*- python -*- or rather like # <<<<<<<<<<<<<< * * cdef class GenericStream: */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); if (__pyx_m) { __Pyx_AddTraceback("init scipy.io.matlab.streams"); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -3454,7 +3507,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.streams"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -3595,18 +3648,6 @@ return -1; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { @@ -3635,6 +3676,34 @@ return result; } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3690,6 +3759,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3699,57 +3769,59 @@ return; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); +#else /* Python 3+ */ -#if PY_MAJOR_VERSION >= 3 - /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ - if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - PyErr_NormalizeException(&type, &value, &tb); - PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); - tstate->exc_type = 0; - tstate->exc_value = 0; - tstate->exc_traceback = 0; - PyException_SetContext(value, tmp_value); - Py_DECREF(tmp_type); - Py_XDECREF(tmp_tb); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } -#endif + if (value == Py_None) + value = 0; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; + PyErr_SetObject(type, value); - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -3760,13 +3832,15 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -3777,13 +3851,15 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -3794,13 +3870,15 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((char)-1) > ((char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -3811,13 +3889,15 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((short)-1) > ((short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -3828,13 +3908,15 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((int)-1) > ((int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -3845,13 +3927,15 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -3862,13 +3946,15 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -3879,13 +3965,15 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -3896,11 +3984,13 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -3909,14 +3999,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((unsigned long)-1) < ((unsigned long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3927,11 +4019,13 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -3940,14 +4034,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3958,11 +4054,13 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((long)-1) > ((long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -3971,14 +4069,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((long)-1) < ((long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3989,11 +4089,13 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -4002,14 +4104,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4020,11 +4124,13 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -4033,14 +4139,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((signed long)-1) < ((signed long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4051,11 +4159,13 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -4064,14 +4174,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4083,11 +4195,6 @@ } static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { -#if PY_VERSION_HEX < 0x02050000 - char *api = (char *)"__pyx_capi__"; -#else - const char *api = "__pyx_capi__"; -#endif PyObject *d = 0; PyObject *cobj = 0; union { @@ -4095,19 +4202,22 @@ void *p; } tmp; - - d = PyObject_GetAttrString(__pyx_m, api); + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); if (!d) { PyErr_Clear(); d = PyDict_New(); if (!d) goto bad; Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, api, d) < 0) + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) goto bad; } tmp.fp = f; +#if PY_VERSION_HEX < 0x03010000 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#else + cobj = PyCapsule_New(tmp.p, sig, 0); +#endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) @@ -4122,32 +4232,31 @@ } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -4172,9 +4281,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -4281,7 +4396,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -4289,10 +4404,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -4306,13 +4425,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -4358,7 +4477,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -4367,7 +4486,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -4381,7 +4500,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: trunk/scipy/spatial/ckdtree.c =================================================================== --- trunk/scipy/spatial/ckdtree.c 2010-06-16 15:21:49 UTC (rev 6510) +++ trunk/scipy/spatial/ckdtree.c 2010-06-16 16:37:26 UTC (rev 6511) @@ -1,8 +1,12 @@ -/* Generated by Cython 0.10.3 on Thu Mar 12 23:38:09 2009 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:30:37 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -11,16 +15,22 @@ #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -30,22 +40,21 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 - #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -55,21 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -84,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -98,9 +122,30 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -109,54 +154,111 @@ #include #define __PYX_HAVE_API__scipy__spatial__ckdtree #include "stdlib.h" +#include "stdio.h" #include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif +#endif -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define INLINE +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif -static int __pyx_skip_dispatch = 0; +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif -/* Type Conversion Predeclarations */ +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) #endif +#endif -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -174,103 +276,37 @@ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static const char* __Pyx_DescribeTokenInFormatString(const char* ts); /*proto*/ -static const char* __Pyx_CheckTypestring_double(const char* ts); /*proto*/ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ -static const char* __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ - -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { - PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) - r = PySequence_GetItem(o, i); - else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - } - return r; -} -static const char* __Pyx_CheckTypestring_int(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_int(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj #endif -Py_ssize_t __Pyx_zeros[] = {0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - -/* Type declarations */ - typedef npy_int8 __pyx_t_5numpy_int8_t; typedef npy_int16 __pyx_t_5numpy_int16_t; @@ -295,6 +331,10 @@ typedef npy_longlong __pyx_t_5numpy_long_t; +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + typedef npy_ulong __pyx_t_5numpy_uint_t; typedef npy_ulonglong __pyx_t_5numpy_ulong_t; @@ -305,13 +345,37 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + typedef npy_cfloat __pyx_t_5numpy_cfloat_t; typedef npy_cdouble __pyx_t_5numpy_cdouble_t; typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":15 +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":15 * * # priority queue * cdef union heapcontents: # <<<<<<<<<<<<<< @@ -324,7 +388,7 @@ char *ptrdata; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":19 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":19 * char* ptrdata * * cdef struct heapitem: # <<<<<<<<<<<<<< @@ -337,7 +401,7 @@ union __pyx_t_5scipy_7spatial_7ckdtree_heapcontents contents; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":23 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":23 * heapcontents contents * * cdef struct heap: # <<<<<<<<<<<<<< @@ -351,7 +415,7 @@ int space; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":139 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":139 * * # Tree structure * cdef struct innernode: # <<<<<<<<<<<<<< @@ -367,7 +431,7 @@ struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *greater; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":145 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":145 * innernode* less * innernode* greater * cdef struct leafnode: # <<<<<<<<<<<<<< @@ -382,7 +446,7 @@ int end_idx; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":153 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":153 * # this is the standard trick for variable-size arrays: * # malloc sizeof(nodeinfo)+self.m*sizeof(double) bytes. * cdef struct nodeinfo: # <<<<<<<<<<<<<< @@ -395,7 +459,7 @@ double side_distances[0]; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":157 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":157 * double side_distances[0] * * cdef class cKDTree: # <<<<<<<<<<<<<< @@ -427,157 +491,569 @@ void (*__query)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, double *, int *, double *, int, double, double, double); }; static struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *__pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0, 0}; +Py_ssize_t __Pyx_minusones[] = {-1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from python_buffer */ +/* Module declarations from python_ref */ + /* Module declarations from stdlib */ +/* Module declarations from stdio */ + /* Module declarations from numpy */ /* Module declarations from numpy */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from scipy.spatial.ckdtree */ static PyTypeObject *__pyx_ptype_5scipy_7spatial_7ckdtree_cKDTree = 0; static double __pyx_v_5scipy_7spatial_7ckdtree_infinity; -static double __pyx_k_24; -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem); /*proto*/ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappeek(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapremove(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappop(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double, double); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *, double *, double, int, double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double, double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *, double *, double, int, double); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "numpy.int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), 'I' }; +#define __Pyx_MODULE_NAME "scipy.spatial.ckdtree" +int __pyx_module_is_main_scipy__spatial__ckdtree = 0; - /* Implementation of scipy.spatial.ckdtree */ -static PyObject *__pyx_int_0; -static char __pyx_k___init__[] = "__init__"; -static PyObject *__pyx_kp___init__; -static char __pyx_k___dealloc__[] = "__dealloc__"; -static PyObject *__pyx_kp___dealloc__; -static char __pyx_k_query[] = "query"; -static PyObject *__pyx_kp_query; -static char __pyx_k_data[] = "data"; -static PyObject *__pyx_kp_data; -static char __pyx_k_leafsize[] = "leafsize"; -static PyObject *__pyx_kp_leafsize; -static char __pyx_k_x[] = "x"; -static PyObject *__pyx_kp_x; -static char __pyx_k_k[] = "k"; -static PyObject *__pyx_kp_k; -static char __pyx_k_eps[] = "eps"; -static PyObject *__pyx_kp_eps; -static char __pyx_k_p[] = "p"; -static PyObject *__pyx_kp_p; -static char __pyx_k_23[] = "distance_upper_bound"; -static PyObject *__pyx_kp_23; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_kdtree[] = "kdtree"; -static PyObject *__pyx_kp_kdtree; -static char __pyx_k_inf[] = "inf"; -static PyObject *__pyx_kp_inf; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; -static PyObject *__pyx_kp_ascontiguousarray; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_float[] = "float"; -static PyObject *__pyx_kp_float; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; -static char __pyx_k_amax[] = "amax"; -static PyObject *__pyx_kp_amax; -static char __pyx_k_axis[] = "axis"; -static PyObject *__pyx_kp_axis; -static char __pyx_k_amin[] = "amin"; -static PyObject *__pyx_kp_amin; -static char __pyx_k_arange[] = "arange"; -static PyObject *__pyx_kp_arange; -static char __pyx_k_27[] = "int32"; -static PyObject *__pyx_kp_27; -static char __pyx_k_asarray[] = "asarray"; -static PyObject *__pyx_kp_asarray; -static char __pyx_k_astype[] = "astype"; -static PyObject *__pyx_kp_astype; -static char __pyx_k_newaxis[] = "newaxis"; -static PyObject *__pyx_kp_newaxis; -static char __pyx_k_prod[] = "prod"; -static PyObject *__pyx_kp_prod; -static char __pyx_k_reshape[] = "reshape"; -static PyObject *__pyx_kp_reshape; -static char __pyx_k_empty[] = "empty"; -static PyObject *__pyx_kp_empty; -static char __pyx_k_fill[] = "fill"; -static PyObject *__pyx_kp_fill; -static char __pyx_k_30[] = "i"; -static PyObject *__pyx_kp_30; static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_kp_25; -static char __pyx_k_25[] = "Heap containing %d items cannot be resized to %d"; -static PyObject *__pyx_kp_26; -static char __pyx_k_26[] = "leafsize must be at least 1"; -static PyObject *__pyx_kp_28; -static PyObject *__pyx_kp_29; -static char __pyx_k_28[] = "x must consist of vectors of length %d but has shape %s"; -static char __pyx_k_29[] = "Only p-norms with 1<=p<=infinity permitted"; -static char __pyx_k___getbuffer__[] = "__getbuffer__"; -static PyObject *__pyx_kp___getbuffer__; -static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; -static PyObject *__pyx_kp___releasebuffer__; -static char __pyx_k_info[] = "info"; -static PyObject *__pyx_kp_info; -static char __pyx_k_flags[] = "flags"; -static PyObject *__pyx_kp_flags; -static char __pyx_k_iteritems[] = "iteritems"; -static PyObject *__pyx_kp_iteritems; -static char __pyx_k_next[] = "next"; -static PyObject *__pyx_kp_next; -static char __pyx_k_StopIteration[] = "StopIteration"; -static PyObject *__pyx_kp_StopIteration; -static char __pyx_k_pop[] = "pop"; -static PyObject *__pyx_kp_pop; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_RuntimeError; -static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_2; -static PyObject *__pyx_kp_20; -static PyObject *__pyx_kp_21; -static PyObject *__pyx_kp_22; -static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "b"; -static char __pyx_k_4[] = "B"; -static char __pyx_k_5[] = "h"; -static char __pyx_k_6[] = "H"; -static char __pyx_k_7[] = "i"; -static char __pyx_k_8[] = "I"; -static char __pyx_k_9[] = "l"; -static char __pyx_k_10[] = "L"; -static char __pyx_k_11[] = "q"; -static char __pyx_k_12[] = "Q"; -static char __pyx_k_13[] = "f"; -static char __pyx_k_14[] = "d"; -static char __pyx_k_15[] = "g"; -static char __pyx_k_16[] = "Zf"; -static char __pyx_k_17[] = "Zd"; -static char __pyx_k_18[] = "Zg"; -static char __pyx_k_19[] = "O"; -static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_21[] = "Format string allocated too short."; -static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_1[] = "Heap containing %d items cannot be resized to %d"; +static char __pyx_k_2[] = "leafsize must be at least 1"; +static char __pyx_k_3[] = "distance_upper_bound"; +static char __pyx_k_5[] = "x must consist of vectors of length %d but has shape %s"; +static char __pyx_k_6[] = "Only p-norms with 1<=p<=infinity permitted"; +static char __pyx_k_7[] = "ndarray is not C contiguous"; +static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_12[] = "Format string allocated too short."; +static char __pyx_k_13[] = "cKDTree.__init__ (line 195)"; +static char __pyx_k_14[] = "cKDTree.query (line 516)"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__k[] = "k"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__m[] = "m"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__p[] = "p"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__eps[] = "eps"; +static char __pyx_k__inf[] = "inf"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__amax[] = "amax"; +static char __pyx_k__amin[] = "amin"; +static char __pyx_k__axis[] = "axis"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__fill[] = "fill"; +static char __pyx_k__heap[] = "heap"; +static char __pyx_k__less[] = "less"; +static char __pyx_k__mins[] = "mins"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__node[] = "node"; +static char __pyx_k__prod[] = "prod"; +static char __pyx_k__tree[] = "tree"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__int32[] = "int32"; +static char __pyx_k__maxes[] = "maxes"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__query[] = "query"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__space[] = "space"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__arange[] = "arange"; +static char __pyx_k__astype[] = "astype"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__kdtree[] = "kdtree"; +static char __pyx_k____build[] = "__build"; +static char __pyx_k____query[] = "__query"; +static char __pyx_k__asarray[] = "asarray"; +static char __pyx_k__cKDTree[] = "cKDTree"; +static char __pyx_k__end_idx[] = "end_idx"; +static char __pyx_k__greater[] = "greater"; +static char __pyx_k__indices[] = "indices"; +static char __pyx_k__intdata[] = "intdata"; +static char __pyx_k__newaxis[] = "newaxis"; +static char __pyx_k__ptrdata[] = "ptrdata"; +static char __pyx_k__reshape[] = "reshape"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__contents[] = "contents"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__leafsize[] = "leafsize"; +static char __pyx_k__priority[] = "priority"; +static char __pyx_k__raw_data[] = "raw_data"; +static char __pyx_k__raw_mins[] = "raw_mins"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__raw_maxes[] = "raw_maxes"; +static char __pyx_k__split_dim[] = "split_dim"; +static char __pyx_k__start_idx[] = "start_idx"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k____free_tree[] = "__free_tree"; +static char __pyx_k__raw_indices[] = "raw_indices"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__side_distances[] = "side_distances"; +static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____build; +static PyObject *__pyx_n_s____free_tree; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____query; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__amax; +static PyObject *__pyx_n_s__amin; +static PyObject *__pyx_n_s__arange; +static PyObject *__pyx_n_s__asarray; +static PyObject *__pyx_n_s__ascontiguousarray; +static PyObject *__pyx_n_s__astype; +static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__cKDTree; +static PyObject *__pyx_n_s__contents; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__end_idx; +static PyObject *__pyx_n_s__eps; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__fill; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__greater; +static PyObject *__pyx_n_s__heap; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__indices; +static PyObject *__pyx_n_s__inf; +static PyObject *__pyx_n_s__int32; +static PyObject *__pyx_n_s__intdata; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__kdtree; +static PyObject *__pyx_n_s__leafsize; +static PyObject *__pyx_n_s__less; +static PyObject *__pyx_n_s__m; +static PyObject *__pyx_n_s__maxes; +static PyObject *__pyx_n_s__mins; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__newaxis; +static PyObject *__pyx_n_s__node; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__priority; +static PyObject *__pyx_n_s__prod; +static PyObject *__pyx_n_s__ptrdata; +static PyObject *__pyx_n_s__query; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__raw_data; +static PyObject *__pyx_n_s__raw_indices; +static PyObject *__pyx_n_s__raw_maxes; +static PyObject *__pyx_n_s__raw_mins; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__side_distances; +static PyObject *__pyx_n_s__space; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__split_dim; +static PyObject *__pyx_n_s__start_idx; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__tree; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; +static double __pyx_k_4; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":28 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":28 * int space * * cdef inline heapcreate(heap* self,int initial_size): # <<<<<<<<<<<<<< @@ -585,10 +1061,11 @@ * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_initial_size) { - PyObject *__pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_initial_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("heapcreate"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":29 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":29 * * cdef inline heapcreate(heap* self,int initial_size): * self.space = initial_size # <<<<<<<<<<<<<< @@ -597,7 +1074,7 @@ */ __pyx_v_self->space = __pyx_v_initial_size; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":30 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":30 * cdef inline heapcreate(heap* self,int initial_size): * self.space = initial_size * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) # <<<<<<<<<<<<<< @@ -606,7 +1083,7 @@ */ __pyx_v_self->heap = ((struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem)) * __pyx_v_self->space))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":31 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":31 * self.space = initial_size * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) * self.n=0 # <<<<<<<<<<<<<< @@ -615,11 +1092,13 @@ */ __pyx_v_self->n = 0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":33 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":33 * self.n=0 * * cdef inline heapdestroy(heap* self): # <<<<<<<<<<<<<< @@ -627,10 +1106,11 @@ * */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { - PyObject *__pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("heapdestroy"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":34 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":34 * * cdef inline heapdestroy(heap* self): * stdlib.free(self.heap) # <<<<<<<<<<<<<< @@ -639,11 +1119,13 @@ */ free(__pyx_v_self->heap); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":36 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":36 * stdlib.free(self.heap) * * cdef inline heapresize(heap* self, int new_space): # <<<<<<<<<<<<<< @@ -651,53 +1133,62 @@ * raise ValueError("Heap containing %d items cannot be resized to %d" % (self.n, new_space)) */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_new_space) { - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_t_1 = NULL; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_new_space) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("heapresize"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":37 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":37 * * cdef inline heapresize(heap* self, int new_space): * if new_spacen); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_new_space < __pyx_v_self->n); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":38 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":38 * cdef inline heapresize(heap* self, int new_space): * if new_spacestdlib.realloc(self.heap,new_space*sizeof(heapitem)) */ - __pyx_2 = PyInt_FromLong(__pyx_v_self->n); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyInt_FromLong(__pyx_v_new_space); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3); - __pyx_2 = 0; - __pyx_3 = 0; - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_25, ((PyObject *)__pyx_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_new_space); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":39 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":39 * if new_spacespace = __pyx_v_new_space; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":40 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":40 * raise ValueError("Heap containing %d items cannot be resized to %d" % (self.n, new_space)) * self.space = new_space * self.heap = stdlib.realloc(self.heap,new_space*sizeof(heapitem)) # <<<<<<<<<<<<<< @@ -715,19 +1206,21 @@ */ __pyx_v_self->heap = ((struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem *)realloc(((void *)__pyx_v_self->heap), (__pyx_v_new_space * (sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem))))); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.spatial.ckdtree.heapresize"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":42 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":42 * self.heap = stdlib.realloc(self.heap,new_space*sizeof(heapitem)) * * cdef inline heappush(heap* self, heapitem item): # <<<<<<<<<<<<<< @@ -735,14 +1228,17 @@ * cdef heapitem t */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_item) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_item) { int __pyx_v_i; struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_t; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("heappush"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":46 * cdef heapitem t * * self.n += 1 # <<<<<<<<<<<<<< @@ -751,30 +1247,31 @@ */ __pyx_v_self->n += 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":47 * * self.n += 1 * if self.n>self.space: # <<<<<<<<<<<<<< * heapresize(self,2*self.space+1) * */ - __pyx_1 = (__pyx_v_self->n > __pyx_v_self->space); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_self->n > __pyx_v_self->space); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":48 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":48 * self.n += 1 * if self.n>self.space: * heapresize(self,2*self.space+1) # <<<<<<<<<<<<<< * * i = self.n-1 */ - __pyx_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((2 * __pyx_v_self->space) + 1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((2 * __pyx_v_self->space) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":50 * heapresize(self,2*self.space+1) * * i = self.n-1 # <<<<<<<<<<<<<< @@ -783,7 +1280,7 @@ */ __pyx_v_i = (__pyx_v_self->n - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":51 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":51 * * i = self.n-1 * self.heap[i] = item # <<<<<<<<<<<<<< @@ -792,7 +1289,7 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_item; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":52 * i = self.n-1 * self.heap[i] = item * while i>0 and self.heap[i].priority 0); - if (__pyx_1) { - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority < (__pyx_v_self->heap[((__pyx_v_i - 1) / 2)]).priority); + __pyx_t_1 = (__pyx_v_i > 0); + if (__pyx_t_1) { + __pyx_t_3 = ((__pyx_v_self->heap[__pyx_v_i]).priority < (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]).priority); + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_1; } - if (!__pyx_1) break; + if (!__pyx_t_4) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":53 * self.heap[i] = item * while i>0 and self.heap[i].priorityheap[((__pyx_v_i - 1) / 2)]); + __pyx_v_t = (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":54 * while i>0 and self.heap[i].priorityheap[((__pyx_v_i - 1) / 2)]) = (__pyx_v_self->heap[__pyx_v_i]); + (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]) = (__pyx_v_self->heap[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":55 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":55 * t = self.heap[(i-1)//2] * self.heap[(i-1)//2] = self.heap[i] * self.heap[i] = t # <<<<<<<<<<<<<< @@ -833,27 +1333,29 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":56 * self.heap[(i-1)//2] = self.heap[i] * self.heap[i] = t * i = (i-1)//2 # <<<<<<<<<<<<<< * * cdef heapitem heappeek(heap* self): */ - __pyx_v_i = ((__pyx_v_i - 1) / 2); + __pyx_v_i = __Pyx_div_long((__pyx_v_i - 1), 2); } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.heappush"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":58 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":58 * i = (i-1)//2 * * cdef heapitem heappeek(heap* self): # <<<<<<<<<<<<<< @@ -863,8 +1365,9 @@ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappeek(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_r; + __Pyx_RefNannySetupContext("heappeek"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":59 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":59 * * cdef heapitem heappeek(heap* self): * return self.heap[0] # <<<<<<<<<<<<<< @@ -875,10 +1378,11 @@ goto __pyx_L0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":61 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":61 * return self.heap[0] * * cdef heapremove(heap* self): # <<<<<<<<<<<<<< @@ -892,11 +1396,15 @@ int __pyx_v_j; int __pyx_v_k; int __pyx_v_l; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("heapremove"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":65 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":65 * cdef int i, j, k, l * * self.heap[0] = self.heap[self.n-1] # <<<<<<<<<<<<<< @@ -905,7 +1413,7 @@ */ (__pyx_v_self->heap[0]) = (__pyx_v_self->heap[(__pyx_v_self->n - 1)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":66 * * self.heap[0] = self.heap[self.n-1] * self.n -= 1 # <<<<<<<<<<<<<< @@ -914,33 +1422,37 @@ */ __pyx_v_self->n -= 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":67 * self.heap[0] = self.heap[self.n-1] * self.n -= 1 * if self.n < self.space//4 and self.space>40: #FIXME: magic number # <<<<<<<<<<<<<< * heapresize(self,self.space//2+1) * */ - __pyx_1 = (__pyx_v_self->n < (__pyx_v_self->space / 4)); - if (__pyx_1) { - __pyx_1 = (__pyx_v_self->space > 40); + __pyx_t_1 = (__pyx_v_self->n < __Pyx_div_long(__pyx_v_self->space, 4)); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_self->space > 40); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":68 * self.n -= 1 * if self.n < self.space//4 and self.space>40: #FIXME: magic number * heapresize(self,self.space//2+1) # <<<<<<<<<<<<<< * * i=0 */ - __pyx_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((__pyx_v_self->space / 2) + 1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_4 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, (__Pyx_div_long(__pyx_v_self->space, 2) + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":70 * heapresize(self,self.space//2+1) * * i=0 # <<<<<<<<<<<<<< @@ -949,7 +1461,7 @@ */ __pyx_v_i = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":71 * * i=0 * j=1 # <<<<<<<<<<<<<< @@ -958,7 +1470,7 @@ */ __pyx_v_j = 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":72 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":72 * i=0 * j=1 * k=2 # <<<<<<<<<<<<<< @@ -967,7 +1479,7 @@ */ __pyx_v_k = 2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":73 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":73 * j=1 * k=2 * while ((jn); - if (__pyx_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":74 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":74 * k=2 * while ((j self.heap[j].priority or # <<<<<<<<<<<<<< * k self.heap[k].priority)): */ - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_j]).priority); + __pyx_t_3 = (__pyx_v_j < __pyx_v_self->n); + if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_j]).priority); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (!__pyx_1) { + if (!__pyx_t_2) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":75 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":75 * while ((j self.heap[j].priority or * k self.heap[k].priority)): * if kself.heap[k].priority: */ - __pyx_1 = (__pyx_v_k < __pyx_v_self->n); - if (__pyx_1) { + __pyx_t_3 = (__pyx_v_k < __pyx_v_self->n); + if (__pyx_t_3) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":76 * self.heap[i].priority > self.heap[j].priority or * k self.heap[k].priority)): # <<<<<<<<<<<<<< * if kself.heap[k].priority: * l = k */ - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_5 = __pyx_t_1; + } else { + __pyx_t_5 = __pyx_t_3; } + __pyx_t_3 = __pyx_t_5; + } else { + __pyx_t_3 = __pyx_t_2; } - if (!__pyx_1) break; + if (!__pyx_t_3) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":77 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":77 * k self.heap[k].priority)): * if kself.heap[k].priority: # <<<<<<<<<<<<<< * l = k * else: */ - __pyx_1 = (__pyx_v_k < __pyx_v_self->n); - if (__pyx_1) { - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_j]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_3 = (__pyx_v_k < __pyx_v_self->n); + if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_self->heap[__pyx_v_j]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_5 = __pyx_t_2; + } else { + __pyx_t_5 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":78 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":78 * self.heap[i].priority > self.heap[k].priority)): * if kself.heap[k].priority: * l = k # <<<<<<<<<<<<<< @@ -1036,7 +1560,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":80 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":80 * l = k * else: * l = j # <<<<<<<<<<<<<< @@ -1047,7 +1571,7 @@ } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":81 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":81 * else: * l = j * t = self.heap[l] # <<<<<<<<<<<<<< @@ -1056,7 +1580,7 @@ */ __pyx_v_t = (__pyx_v_self->heap[__pyx_v_l]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":82 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":82 * l = j * t = self.heap[l] * self.heap[l] = self.heap[i] # <<<<<<<<<<<<<< @@ -1065,7 +1589,7 @@ */ (__pyx_v_self->heap[__pyx_v_l]) = (__pyx_v_self->heap[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":83 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":83 * t = self.heap[l] * self.heap[l] = self.heap[i] * self.heap[i] = t # <<<<<<<<<<<<<< @@ -1074,7 +1598,7 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":84 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":84 * self.heap[l] = self.heap[i] * self.heap[i] = t * i = l # <<<<<<<<<<<<<< @@ -1083,7 +1607,7 @@ */ __pyx_v_i = __pyx_v_l; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":85 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":85 * self.heap[i] = t * i = l * j = 2*i+1 # <<<<<<<<<<<<<< @@ -1092,7 +1616,7 @@ */ __pyx_v_j = ((2 * __pyx_v_i) + 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":86 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":86 * i = l * j = 2*i+1 * k = 2*i+2 # <<<<<<<<<<<<<< @@ -1102,17 +1626,19 @@ __pyx_v_k = ((2 * __pyx_v_i) + 2); } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.spatial.ckdtree.heapremove"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":88 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":88 * k = 2*i+2 * * cdef heapitem heappop(heap* self): # <<<<<<<<<<<<<< @@ -1123,9 +1649,10 @@ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappop(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_it; struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_r; - PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("heappop"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":90 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":90 * cdef heapitem heappop(heap* self): * cdef heapitem it * it = heappeek(self) # <<<<<<<<<<<<<< @@ -1134,17 +1661,18 @@ */ __pyx_v_it = __pyx_f_5scipy_7spatial_7ckdtree_heappeek(__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":91 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":91 * cdef heapitem it * it = heappeek(self) * heapremove(self) # <<<<<<<<<<<<<< * return it * */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapremove(__pyx_v_self); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapremove(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":92 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":92 * it = heappeek(self) * heapremove(self) * return it # <<<<<<<<<<<<<< @@ -1156,13 +1684,14 @@ goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("scipy.spatial.ckdtree.heappop"); __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":99 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":99 * * # utility functions * cdef inline double dmax(double x, double y): # <<<<<<<<<<<<<< @@ -1170,21 +1699,22 @@ * return x */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double __pyx_v_x, double __pyx_v_y) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double __pyx_v_x, double __pyx_v_y) { double __pyx_r; - int __pyx_1; + int __pyx_t_1; + __Pyx_RefNannySetupContext("dmax"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":100 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":100 * # utility functions * cdef inline double dmax(double x, double y): * if x>y: # <<<<<<<<<<<<<< * return x * else: */ - __pyx_1 = (__pyx_v_x > __pyx_v_y); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_x > __pyx_v_y); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":101 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":101 * cdef inline double dmax(double x, double y): * if x>y: * return x # <<<<<<<<<<<<<< @@ -1197,7 +1727,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":103 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":103 * return x * else: * return y # <<<<<<<<<<<<<< @@ -1211,10 +1741,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":104 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":104 * else: * return y * cdef inline double dabs(double x): # <<<<<<<<<<<<<< @@ -1222,21 +1753,22 @@ * return x */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double __pyx_v_x) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double __pyx_v_x) { double __pyx_r; - int __pyx_1; + int __pyx_t_1; + __Pyx_RefNannySetupContext("dabs"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":105 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":105 * return y * cdef inline double dabs(double x): * if x>0: # <<<<<<<<<<<<<< * return x * else: */ - __pyx_1 = (__pyx_v_x > 0); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_x > 0); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":106 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":106 * cdef inline double dabs(double x): * if x>0: * return x # <<<<<<<<<<<<<< @@ -1249,7 +1781,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":108 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":108 * return x * else: * return -x # <<<<<<<<<<<<<< @@ -1263,10 +1795,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":109 * else: * return -x * cdef inline double _distance_p(double*x,double*y,double p,int k,double upperbound): # <<<<<<<<<<<<<< @@ -1274,13 +1807,16 @@ * */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *__pyx_v_x, double *__pyx_v_y, double __pyx_v_p, int __pyx_v_k, double __pyx_v_upperbound) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *__pyx_v_x, double *__pyx_v_y, double __pyx_v_p, int __pyx_v_k, double __pyx_v_upperbound) { int __pyx_v_i; double __pyx_v_r; double __pyx_r; - int __pyx_1; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("_distance_p"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":118 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":118 * cdef int i * cdef double r * r = 0 # <<<<<<<<<<<<<< @@ -1289,26 +1825,28 @@ */ __pyx_v_r = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":119 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":119 * cdef double r * r = 0 * if p==infinity: # <<<<<<<<<<<<<< * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) */ - __pyx_1 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":120 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":120 * r = 0 * if p==infinity: * for i in range(k): # <<<<<<<<<<<<<< * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":121 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":121 * if p==infinity: * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) # <<<<<<<<<<<<<< @@ -1317,17 +1855,17 @@ */ __pyx_v_r = __pyx_f_5scipy_7spatial_7ckdtree_dmax(__pyx_v_r, __pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i])))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":122 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":122 * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: # <<<<<<<<<<<<<< * return r * elif p==1: */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":123 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":123 * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1343,26 +1881,28 @@ goto __pyx_L3; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":124 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":124 * if r>upperbound: * return r * elif p==1: # <<<<<<<<<<<<<< * for i in range(k): * r += dabs(x[i]-y[i]) */ - __pyx_1 = (__pyx_v_p == 1); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == 1); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":125 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":125 * return r * elif p==1: * for i in range(k): # <<<<<<<<<<<<<< * r += dabs(x[i]-y[i]) * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":126 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":126 * elif p==1: * for i in range(k): * r += dabs(x[i]-y[i]) # <<<<<<<<<<<<<< @@ -1371,17 +1911,17 @@ */ __pyx_v_r += __pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i]))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":127 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":127 * for i in range(k): * r += dabs(x[i]-y[i]) * if r>upperbound: # <<<<<<<<<<<<<< * return r * else: */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":128 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":128 * r += dabs(x[i]-y[i]) * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1398,16 +1938,18 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":130 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":130 * return r * else: * for i in range(k): # <<<<<<<<<<<<<< * r += dabs(x[i]-y[i])**p * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":131 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":131 * else: * for i in range(k): * r += dabs(x[i]-y[i])**p # <<<<<<<<<<<<<< @@ -1416,17 +1958,17 @@ */ __pyx_v_r += pow(__pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i]))), __pyx_v_p); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":132 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":132 * for i in range(k): * r += dabs(x[i]-y[i])**p * if r>upperbound: # <<<<<<<<<<<<<< * return r * return r */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":133 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":133 * r += dabs(x[i]-y[i])**p * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1442,7 +1984,7 @@ } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":134 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":134 * if r>upperbound: * return r * return r # <<<<<<<<<<<<<< @@ -1454,10 +1996,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":195 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":195 * cdef object indices * cdef np.int32_t* raw_indices * def __init__(cKDTree self, data, int leafsize=10): # <<<<<<<<<<<<<< @@ -1489,27 +2032,27 @@ Py_ssize_t __pyx_bstride_0_inner_mins = 0; Py_ssize_t __pyx_bshape_0_inner_mins = 0; int __pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - int __pyx_6; - int __pyx_7; - PyObject *__pyx_8 = 0; - PyArrayObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_leafsize,0}; - __pyx_v_leafsize = 10; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + PyArrayObject *__pyx_t_15 = NULL; + PyArrayObject *__pyx_t_16 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__leafsize,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -1518,20 +2061,28 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__leafsize); + if (unlikely(value)) { values[1] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_leafsize = __pyx_PyInt_int(values[1]); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_leafsize = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_leafsize = ((int)10); } } else { + __pyx_v_leafsize = ((int)10); switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_leafsize = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_leafsize = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; @@ -1544,88 +2095,105 @@ __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__init__"); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_v_inner_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_maxes = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_mins = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_data); + __pyx_v_inner_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_maxes = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_mins = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_inner_data.buf = NULL; __pyx_bstruct_inner_maxes.buf = NULL; __pyx_bstruct_inner_mins.buf = NULL; __pyx_bstruct_inner_indices.buf = NULL; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":214 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":214 * cdef np.ndarray[double, ndim=1] inner_mins * cdef np.ndarray[np.int32_t, ndim=1] inner_indices * self.data = np.ascontiguousarray(data,dtype=np.float) # <<<<<<<<<<<<<< * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_data); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_data); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_float); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data = __pyx_4; - __pyx_4 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data = __pyx_t_5; + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":215 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":215 * cdef np.ndarray[np.int32_t, ndim=1] inner_indices * self.data = np.ascontiguousarray(data,dtype=np.float) * self.n, self.m = np.shape(self.data) # <<<<<<<<<<<<<< * self.leafsize = leafsize * if self.leafsize<1: */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_1, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { - PyObject* tuple = __pyx_3; - __pyx_5 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_5); - __pyx_6 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_6; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_6; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_t_6; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_t_7; + } else { + __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_EndUnpack(__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_t_7; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_t_6; } - else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_6; - __pyx_2 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_6; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":216 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":216 * self.data = np.ascontiguousarray(data,dtype=np.float) * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize # <<<<<<<<<<<<<< @@ -1634,166 +2202,213 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize = __pyx_v_leafsize; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":217 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":217 * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize * if self.leafsize<1: # <<<<<<<<<<<<<< * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) */ - __pyx_7 = (((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize < 1); - if (__pyx_7) { + __pyx_t_8 = (((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize < 1); + if (__pyx_t_8) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":218 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":218 * self.leafsize = leafsize * if self.leafsize<1: * raise ValueError("leafsize must be at least 1") # <<<<<<<<<<<<<< * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) */ - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_26); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_kp_26); - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":219 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":219 * if self.leafsize<1: * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) # <<<<<<<<<<<<<< * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_amax); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_5), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes = __pyx_5; - __pyx_5 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__amax); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":220 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":220 * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) # <<<<<<<<<<<<<< * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_amin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_5), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins = __pyx_5; - __pyx_5 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__amin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins = __pyx_t_5; + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":221 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":221 * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) # <<<<<<<<<<<<<< * * inner_data = self.data */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_arange); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5); - __pyx_5 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_8 = PyObject_GetAttr(__pyx_5, __pyx_kp_27); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_8); __pyx_8 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_8 = PyTuple_New(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_8, 0, __pyx_5); - __pyx_5 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_8), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices = __pyx_1; - __pyx_1 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices = __pyx_t_9; + __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":223 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":223 * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) * * inner_data = self.data # <<<<<<<<<<<<<< * self.raw_data = inner_data.data * inner_maxes = self.maxes */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_1, &__pyx_bstruct_inner_data, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_data, &__pyx_bstruct_inner_data, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_data, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_data, (PyObject*)__pyx_v_inner_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13); } + } + __pyx_bstride_0_inner_data = __pyx_bstruct_inner_data.strides[0]; __pyx_bstride_1_inner_data = __pyx_bstruct_inner_data.strides[1]; + __pyx_bshape_0_inner_data = __pyx_bstruct_inner_data.shape[0]; __pyx_bshape_1_inner_data = __pyx_bstruct_inner_data.shape[1]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_data = __pyx_bstruct_inner_data.strides[0]; __pyx_bstride_1_inner_data = __pyx_bstruct_inner_data.strides[1]; - __pyx_bshape_0_inner_data = __pyx_bstruct_inner_data.shape[0]; __pyx_bshape_1_inner_data = __pyx_bstruct_inner_data.shape[1]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - Py_DECREF(((PyObject *)__pyx_v_inner_data)); + __pyx_t_10 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_data)); __pyx_v_inner_data = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":224 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":224 * * inner_data = self.data * self.raw_data = inner_data.data # <<<<<<<<<<<<<< @@ -1802,36 +2417,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_data = ((double *)__pyx_v_inner_data->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":225 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":225 * inner_data = self.data * self.raw_data = inner_data.data * inner_maxes = self.maxes # <<<<<<<<<<<<<< * self.raw_maxes = inner_maxes.data * inner_mins = self.mins */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_maxes); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_6, &__pyx_bstruct_inner_maxes, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_maxes, &__pyx_bstruct_inner_maxes, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_maxes); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_maxes, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_maxes, (PyObject*)__pyx_v_inner_maxes, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11); } + } + __pyx_bstride_0_inner_maxes = __pyx_bstruct_inner_maxes.strides[0]; + __pyx_bshape_0_inner_maxes = __pyx_bstruct_inner_maxes.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_maxes = __pyx_bstruct_inner_maxes.strides[0]; - __pyx_bshape_0_inner_maxes = __pyx_bstruct_inner_maxes.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - Py_DECREF(((PyObject *)__pyx_v_inner_maxes)); + __pyx_t_14 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_maxes)); __pyx_v_inner_maxes = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":226 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":226 * self.raw_data = inner_data.data * inner_maxes = self.maxes * self.raw_maxes = inner_maxes.data # <<<<<<<<<<<<<< @@ -1840,36 +2457,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_maxes = ((double *)__pyx_v_inner_maxes->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":227 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":227 * inner_maxes = self.maxes * self.raw_maxes = inner_maxes.data * inner_mins = self.mins # <<<<<<<<<<<<<< * self.raw_mins = inner_mins.data * inner_indices = self.indices */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_7, &__pyx_bstruct_inner_mins, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_mins, &__pyx_bstruct_inner_mins, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_mins, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_mins, (PyObject*)__pyx_v_inner_mins, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13); } + } + __pyx_bstride_0_inner_mins = __pyx_bstruct_inner_mins.strides[0]; + __pyx_bshape_0_inner_mins = __pyx_bstruct_inner_mins.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_mins = __pyx_bstruct_inner_mins.strides[0]; - __pyx_bshape_0_inner_mins = __pyx_bstruct_inner_mins.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - Py_DECREF(((PyObject *)__pyx_v_inner_mins)); + __pyx_t_15 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_mins)); __pyx_v_inner_mins = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":228 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":228 * self.raw_maxes = inner_maxes.data * inner_mins = self.mins * self.raw_mins = inner_mins.data # <<<<<<<<<<<<<< @@ -1878,36 +2497,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_mins = ((double *)__pyx_v_inner_mins->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":229 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":229 * inner_mins = self.mins * self.raw_mins = inner_mins.data * inner_indices = self.indices # <<<<<<<<<<<<<< * self.raw_indices = inner_indices.data * */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); - __pyx_t_2 = __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_8, &__pyx_bstruct_inner_indices, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_inner_indices, &__pyx_bstruct_inner_indices, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_indices, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_indices, (PyObject*)__pyx_v_inner_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11); } + } + __pyx_bstride_0_inner_indices = __pyx_bstruct_inner_indices.strides[0]; + __pyx_bshape_0_inner_indices = __pyx_bstruct_inner_indices.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_indices = __pyx_bstruct_inner_indices.strides[0]; - __pyx_bshape_0_inner_indices = __pyx_bstruct_inner_indices.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - Py_DECREF(((PyObject *)__pyx_v_inner_indices)); + __pyx_t_16 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_indices)); __pyx_v_inner_indices = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":230 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":230 * self.raw_mins = inner_mins.data * inner_indices = self.indices * self.raw_indices = inner_indices.data # <<<<<<<<<<<<<< @@ -1916,7 +2537,7 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_indices = ((__pyx_t_5numpy_int32_t *)__pyx_v_inner_indices->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":232 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":232 * self.raw_indices = inner_indices.data * * self.tree = self.__build(0, self.n, self.raw_maxes, self.raw_mins) # <<<<<<<<<<<<<< @@ -1928,12 +2549,12 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_8); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); @@ -1950,14 +2571,17 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); __pyx_L2:; - Py_DECREF(__pyx_v_inner_data); - Py_DECREF(__pyx_v_inner_maxes); - Py_DECREF(__pyx_v_inner_mins); - Py_DECREF(__pyx_v_inner_indices); + __Pyx_DECREF((PyObject *)__pyx_v_inner_data); + __Pyx_DECREF((PyObject *)__pyx_v_inner_maxes); + __Pyx_DECREF((PyObject *)__pyx_v_inner_mins); + __Pyx_DECREF((PyObject *)__pyx_v_inner_indices); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_data); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":234 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":234 * self.tree = self.__build(0, self.n, self.raw_maxes, self.raw_mins) * * cdef innernode* __build(cKDTree self, int start_idx, int end_idx, double* maxes, double* mins): # <<<<<<<<<<<<<< @@ -1980,21 +2604,24 @@ double __pyx_v_maxval; double *__pyx_v_mids; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_r; - int __pyx_1; - int __pyx_2; - long __pyx_3; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + long __pyx_t_4; + __Pyx_RefNannySetupContext("__build"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":240 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":240 * cdef double size, split, minval, maxval * cdef double*mids * if end_idx-start_idx<=self.leafsize: # <<<<<<<<<<<<<< * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 */ - __pyx_1 = ((__pyx_v_end_idx - __pyx_v_start_idx) <= __pyx_v_self->leafsize); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_end_idx - __pyx_v_start_idx) <= __pyx_v_self->leafsize); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":241 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":241 * cdef double*mids * if end_idx-start_idx<=self.leafsize: * n = stdlib.malloc(sizeof(leafnode)) # <<<<<<<<<<<<<< @@ -2003,7 +2630,7 @@ */ __pyx_v_n = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":242 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":242 * if end_idx-start_idx<=self.leafsize: * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 # <<<<<<<<<<<<<< @@ -2012,7 +2639,7 @@ */ __pyx_v_n->split_dim = -1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":243 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":243 * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 * n.start_idx = start_idx # <<<<<<<<<<<<<< @@ -2021,7 +2648,7 @@ */ __pyx_v_n->start_idx = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":244 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":244 * n.split_dim = -1 * n.start_idx = start_idx * n.end_idx = end_idx # <<<<<<<<<<<<<< @@ -2030,7 +2657,7 @@ */ __pyx_v_n->end_idx = __pyx_v_end_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":245 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":245 * n.start_idx = start_idx * n.end_idx = end_idx * return n # <<<<<<<<<<<<<< @@ -2043,7 +2670,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":247 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":247 * return n * else: * d = 0 # <<<<<<<<<<<<<< @@ -2052,7 +2679,7 @@ */ __pyx_v_d = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":248 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":248 * else: * d = 0 * size = 0 # <<<<<<<<<<<<<< @@ -2061,27 +2688,28 @@ */ __pyx_v_size = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":249 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":249 * d = 0 * size = 0 * for i in range(self.m): # <<<<<<<<<<<<<< * if maxes[i]-mins[i] > size: * d = i */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":250 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":250 * size = 0 * for i in range(self.m): * if maxes[i]-mins[i] > size: # <<<<<<<<<<<<<< * d = i * size = maxes[i]-mins[i] */ - __pyx_1 = (((__pyx_v_maxes[__pyx_v_i]) - (__pyx_v_mins[__pyx_v_i])) > __pyx_v_size); - if (__pyx_1) { + __pyx_t_1 = (((__pyx_v_maxes[__pyx_v_i]) - (__pyx_v_mins[__pyx_v_i])) > __pyx_v_size); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":251 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":251 * for i in range(self.m): * if maxes[i]-mins[i] > size: * d = i # <<<<<<<<<<<<<< @@ -2090,7 +2718,7 @@ */ __pyx_v_d = __pyx_v_i; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":252 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":252 * if maxes[i]-mins[i] > size: * d = i * size = maxes[i]-mins[i] # <<<<<<<<<<<<<< @@ -2103,7 +2731,7 @@ __pyx_L6:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":253 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":253 * d = i * size = maxes[i]-mins[i] * maxval = maxes[d] # <<<<<<<<<<<<<< @@ -2112,7 +2740,7 @@ */ __pyx_v_maxval = (__pyx_v_maxes[__pyx_v_d]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":254 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":254 * size = maxes[i]-mins[i] * maxval = maxes[d] * minval = mins[d] # <<<<<<<<<<<<<< @@ -2121,17 +2749,17 @@ */ __pyx_v_minval = (__pyx_v_mins[__pyx_v_d]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":255 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":255 * maxval = maxes[d] * minval = mins[d] * if maxval==minval: # <<<<<<<<<<<<<< * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) */ - __pyx_1 = (__pyx_v_maxval == __pyx_v_minval); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_maxval == __pyx_v_minval); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":257 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":257 * if maxval==minval: * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) # <<<<<<<<<<<<<< @@ -2140,7 +2768,7 @@ */ __pyx_v_n = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":258 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":258 * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 # <<<<<<<<<<<<<< @@ -2149,7 +2777,7 @@ */ __pyx_v_n->split_dim = -1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":259 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":259 * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 * n.start_idx = start_idx # <<<<<<<<<<<<<< @@ -2158,7 +2786,7 @@ */ __pyx_v_n->start_idx = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":260 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":260 * n.split_dim = -1 * n.start_idx = start_idx * n.end_idx = end_idx # <<<<<<<<<<<<<< @@ -2167,7 +2795,7 @@ */ __pyx_v_n->end_idx = __pyx_v_end_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":261 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":261 * n.start_idx = start_idx * n.end_idx = end_idx * return n # <<<<<<<<<<<<<< @@ -2180,7 +2808,7 @@ } __pyx_L7:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":263 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":263 * return n * * split = (maxval+minval)/2 # <<<<<<<<<<<<<< @@ -2189,7 +2817,7 @@ */ __pyx_v_split = ((__pyx_v_maxval + __pyx_v_minval) / 2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":265 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":265 * split = (maxval+minval)/2 * * p = start_idx # <<<<<<<<<<<<<< @@ -2198,7 +2826,7 @@ */ __pyx_v_p = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":266 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":266 * * p = start_idx * q = end_idx-1 # <<<<<<<<<<<<<< @@ -2207,7 +2835,7 @@ */ __pyx_v_q = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":267 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":267 * p = start_idx * q = end_idx-1 * while p<=q: # <<<<<<<<<<<<<< @@ -2215,20 +2843,20 @@ * p+=1 */ while (1) { - __pyx_1 = (__pyx_v_p <= __pyx_v_q); - if (!__pyx_1) break; + __pyx_t_1 = (__pyx_v_p <= __pyx_v_q); + if (!__pyx_t_1) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":268 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":268 * q = end_idx-1 * while p<=q: * if self.raw_data[self.raw_indices[p]*self.m+d]=split: */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_p]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_p]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":269 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":269 * while p<=q: * if self.raw_data[self.raw_indices[p]*self.m+d]=split: # <<<<<<<<<<<<<< * q-=1 * else: */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_q]) * __pyx_v_self->m) + __pyx_v_d)]) >= __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_q]) * __pyx_v_self->m) + __pyx_v_d)]) >= __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":271 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":271 * p+=1 * elif self.raw_data[self.raw_indices[q]*self.m+d]>=split: * q-=1 # <<<<<<<<<<<<<< @@ -2261,7 +2889,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":273 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":273 * q-=1 * else: * t = self.raw_indices[p] # <<<<<<<<<<<<<< @@ -2270,7 +2898,7 @@ */ __pyx_v_t = (__pyx_v_self->raw_indices[__pyx_v_p]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":274 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":274 * else: * t = self.raw_indices[p] * self.raw_indices[p] = self.raw_indices[q] # <<<<<<<<<<<<<< @@ -2279,7 +2907,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_p]) = (__pyx_v_self->raw_indices[__pyx_v_q]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":275 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":275 * t = self.raw_indices[p] * self.raw_indices[p] = self.raw_indices[q] * self.raw_indices[q] = t # <<<<<<<<<<<<<< @@ -2288,7 +2916,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_q]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":276 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":276 * self.raw_indices[p] = self.raw_indices[q] * self.raw_indices[q] = t * p+=1 # <<<<<<<<<<<<<< @@ -2297,7 +2925,7 @@ */ __pyx_v_p += 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":277 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":277 * self.raw_indices[q] = t * p+=1 * q-=1 # <<<<<<<<<<<<<< @@ -2309,17 +2937,17 @@ __pyx_L10:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":280 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":280 * * # slide midpoint if necessary * if p==start_idx: # <<<<<<<<<<<<<< * # no points less than split * j = start_idx */ - __pyx_1 = (__pyx_v_p == __pyx_v_start_idx); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_start_idx); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":282 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":282 * if p==start_idx: * # no points less than split * j = start_idx # <<<<<<<<<<<<<< @@ -2328,7 +2956,7 @@ */ __pyx_v_j = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":283 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":283 * # no points less than split * j = start_idx * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2337,26 +2965,28 @@ */ __pyx_v_split = (__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_j]) * __pyx_v_self->m) + __pyx_v_d)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":284 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":284 * j = start_idx * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx+1, end_idx): # <<<<<<<<<<<<<< * if self.raw_data[self.raw_indices[i]*self.m+d]raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":286 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":286 * for i in range(start_idx+1, end_idx): * if self.raw_data[self.raw_indices[i]*self.m+d]raw_indices[__pyx_v_start_idx]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":289 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":289 * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[start_idx] * self.raw_indices[start_idx] = self.raw_indices[j] # <<<<<<<<<<<<<< @@ -2396,7 +3026,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_start_idx]) = (__pyx_v_self->raw_indices[__pyx_v_j]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":290 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":290 * t = self.raw_indices[start_idx] * self.raw_indices[start_idx] = self.raw_indices[j] * self.raw_indices[j] = t # <<<<<<<<<<<<<< @@ -2405,7 +3035,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_j]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":291 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":291 * self.raw_indices[start_idx] = self.raw_indices[j] * self.raw_indices[j] = t * p = start_idx+1 # <<<<<<<<<<<<<< @@ -2414,7 +3044,7 @@ */ __pyx_v_p = (__pyx_v_start_idx + 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":292 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":292 * self.raw_indices[j] = t * p = start_idx+1 * q = start_idx # <<<<<<<<<<<<<< @@ -2425,17 +3055,17 @@ goto __pyx_L11; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":293 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":293 * p = start_idx+1 * q = start_idx * elif p==end_idx: # <<<<<<<<<<<<<< * # no points greater than split * j = end_idx-1 */ - __pyx_1 = (__pyx_v_p == __pyx_v_end_idx); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_end_idx); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":295 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":295 * elif p==end_idx: * # no points greater than split * j = end_idx-1 # <<<<<<<<<<<<<< @@ -2444,7 +3074,7 @@ */ __pyx_v_j = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":296 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":296 * # no points greater than split * j = end_idx-1 * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2453,27 +3083,28 @@ */ __pyx_v_split = (__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_j]) * __pyx_v_self->m) + __pyx_v_d)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":297 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":297 * j = end_idx-1 * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx, end_idx-1): # <<<<<<<<<<<<<< * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i */ - __pyx_3 = (__pyx_v_end_idx - 1); - for (__pyx_v_i = __pyx_v_start_idx; __pyx_v_i < __pyx_3; __pyx_v_i+=1) { + __pyx_t_4 = (__pyx_v_end_idx - 1); + for (__pyx_t_2 = __pyx_v_start_idx; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":298 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":298 * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx, end_idx-1): * if self.raw_data[self.raw_indices[i]*self.m+d]>split: # <<<<<<<<<<<<<< * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) > __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) > __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":299 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":299 * for i in range(start_idx, end_idx-1): * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i # <<<<<<<<<<<<<< @@ -2482,7 +3113,7 @@ */ __pyx_v_j = __pyx_v_i; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":300 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":300 * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2495,7 +3126,7 @@ __pyx_L17:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":301 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":301 * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[end_idx-1] # <<<<<<<<<<<<<< @@ -2504,7 +3135,7 @@ */ __pyx_v_t = (__pyx_v_self->raw_indices[(__pyx_v_end_idx - 1)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":302 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":302 * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[end_idx-1] * self.raw_indices[end_idx-1] = self.raw_indices[j] # <<<<<<<<<<<<<< @@ -2513,7 +3144,7 @@ */ (__pyx_v_self->raw_indices[(__pyx_v_end_idx - 1)]) = (__pyx_v_self->raw_indices[__pyx_v_j]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":303 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":303 * t = self.raw_indices[end_idx-1] * self.raw_indices[end_idx-1] = self.raw_indices[j] * self.raw_indices[j] = t # <<<<<<<<<<<<<< @@ -2522,7 +3153,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_j]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":304 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":304 * self.raw_indices[end_idx-1] = self.raw_indices[j] * self.raw_indices[j] = t * p = end_idx-1 # <<<<<<<<<<<<<< @@ -2531,7 +3162,7 @@ */ __pyx_v_p = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":305 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":305 * self.raw_indices[j] = t * p = end_idx-1 * q = end_idx-2 # <<<<<<<<<<<<<< @@ -2543,7 +3174,7 @@ } __pyx_L11:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":308 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":308 * * # construct new node representation * ni = stdlib.malloc(sizeof(innernode)) # <<<<<<<<<<<<<< @@ -2552,7 +3183,7 @@ */ __pyx_v_ni = ((struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_innernode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":310 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":310 * ni = stdlib.malloc(sizeof(innernode)) * * mids = stdlib.malloc(sizeof(double)*self.m) # <<<<<<<<<<<<<< @@ -2561,17 +3192,18 @@ */ __pyx_v_mids = ((double *)malloc(((sizeof(double)) * __pyx_v_self->m))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":311 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":311 * * mids = stdlib.malloc(sizeof(double)*self.m) * for i in range(self.m): # <<<<<<<<<<<<<< * mids[i] = maxes[i] * mids[d] = split */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":312 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":312 * mids = stdlib.malloc(sizeof(double)*self.m) * for i in range(self.m): * mids[i] = maxes[i] # <<<<<<<<<<<<<< @@ -2581,7 +3213,7 @@ (__pyx_v_mids[__pyx_v_i]) = (__pyx_v_maxes[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":313 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":313 * for i in range(self.m): * mids[i] = maxes[i] * mids[d] = split # <<<<<<<<<<<<<< @@ -2590,7 +3222,7 @@ */ (__pyx_v_mids[__pyx_v_d]) = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":314 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":314 * mids[i] = maxes[i] * mids[d] = split * ni.less = self.__build(start_idx,p,mids,mins) # <<<<<<<<<<<<<< @@ -2599,17 +3231,18 @@ */ __pyx_v_ni->less = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__build(__pyx_v_self, __pyx_v_start_idx, __pyx_v_p, __pyx_v_mids, __pyx_v_mins); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":316 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":316 * ni.less = self.__build(start_idx,p,mids,mins) * * for i in range(self.m): # <<<<<<<<<<<<<< * mids[i] = mins[i] * mids[d] = split */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":317 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":317 * * for i in range(self.m): * mids[i] = mins[i] # <<<<<<<<<<<<<< @@ -2619,7 +3252,7 @@ (__pyx_v_mids[__pyx_v_i]) = (__pyx_v_mins[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":318 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":318 * for i in range(self.m): * mids[i] = mins[i] * mids[d] = split # <<<<<<<<<<<<<< @@ -2628,7 +3261,7 @@ */ (__pyx_v_mids[__pyx_v_d]) = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":319 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":319 * mids[i] = mins[i] * mids[d] = split * ni.greater = self.__build(p,end_idx,maxes,mids) # <<<<<<<<<<<<<< @@ -2637,7 +3270,7 @@ */ __pyx_v_ni->greater = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__build(__pyx_v_self, __pyx_v_p, __pyx_v_end_idx, __pyx_v_maxes, __pyx_v_mids); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":321 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":321 * ni.greater = self.__build(p,end_idx,maxes,mids) * * stdlib.free(mids) # <<<<<<<<<<<<<< @@ -2646,7 +3279,7 @@ */ free(__pyx_v_mids); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":323 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":323 * stdlib.free(mids) * * ni.split_dim = d # <<<<<<<<<<<<<< @@ -2655,7 +3288,7 @@ */ __pyx_v_ni->split_dim = __pyx_v_d; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":324 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":324 * * ni.split_dim = d * ni.split = split # <<<<<<<<<<<<<< @@ -2664,7 +3297,7 @@ */ __pyx_v_ni->split = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":326 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":326 * ni.split = split * * return ni # <<<<<<<<<<<<<< @@ -2678,10 +3311,12 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":328 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":328 * return ni * * cdef __free_tree(cKDTree self, innernode* node): # <<<<<<<<<<<<<< @@ -2690,44 +3325,48 @@ */ static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_node) { - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__free_tree"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":329 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":329 * * cdef __free_tree(cKDTree self, innernode* node): * if node.split_dim!=-1: # <<<<<<<<<<<<<< * self.__free_tree(node.less) * self.__free_tree(node.greater) */ - __pyx_1 = (__pyx_v_node->split_dim != -1); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_node->split_dim != -1); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":330 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":330 * cdef __free_tree(cKDTree self, innernode* node): * if node.split_dim!=-1: * self.__free_tree(node.less) # <<<<<<<<<<<<<< * self.__free_tree(node.greater) * stdlib.free(node) */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->less); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":331 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":331 * if node.split_dim!=-1: * self.__free_tree(node.less) * self.__free_tree(node.greater) # <<<<<<<<<<<<<< * stdlib.free(node) * */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->greater); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":332 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":332 * self.__free_tree(node.less) * self.__free_tree(node.greater) * stdlib.free(node) # <<<<<<<<<<<<<< @@ -2736,17 +3375,20 @@ */ free(__pyx_v_node); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__free_tree"); __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":334 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":334 * stdlib.free(node) * * def __dealloc__(cKDTree self): # <<<<<<<<<<<<<< @@ -2756,20 +3398,22 @@ static void __pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree___dealloc__(PyObject *__pyx_v_self) { - int __pyx_1; - PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":335 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":335 * * def __dealloc__(cKDTree self): * if (self.tree) == 0: # <<<<<<<<<<<<<< * # should happen only if __init__ was never called * return */ - __pyx_1 = (((int)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree) == 0); - if (__pyx_1) { + __pyx_t_1 = (((int)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree) == 0); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":337 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":337 * if (self.tree) == 0: * # should happen only if __init__ was never called * return # <<<<<<<<<<<<<< @@ -2781,24 +3425,27 @@ } __pyx_L5:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":338 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":338 * # should happen only if __init__ was never called * return * self.__free_tree(self.tree) # <<<<<<<<<<<<<< * * cdef void __query(cKDTree self, */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__free_tree(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__free_tree(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__dealloc__"); __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":340 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":340 * self.__free_tree(self.tree) * * cdef void __query(cKDTree self, # <<<<<<<<<<<<<< @@ -2824,31 +3471,41 @@ struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_inode; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_near; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_far; - PyObject *__pyx_1 = 0; - int __pyx_2; - int __pyx_3; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + double __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("__query"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":371 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":371 * # distances between the nearest side of the cell and the target * # the head node of the cell * heapcreate(&q,12) # <<<<<<<<<<<<<< * * # priority queue for the nearest neighbors */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_q), 12); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_q), 12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":376 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":376 * # furthest known neighbor first * # entries are (-distance**p, i) * heapcreate(&neighbors,k) # <<<<<<<<<<<<<< * * # set up first nodeinfo */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_neighbors), __pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_neighbors), __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":379 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":379 * * # set up first nodeinfo * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) # <<<<<<<<<<<<<< @@ -2857,7 +3514,7 @@ */ __pyx_v_inf = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo)) + (__pyx_v_self->m * (sizeof(double)))))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":380 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":380 * # set up first nodeinfo * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * inf.node = self.tree # <<<<<<<<<<<<<< @@ -2866,17 +3523,18 @@ */ __pyx_v_inf->node = __pyx_v_self->tree; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":381 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":381 * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * inf.node = self.tree * for i in range(self.m): # <<<<<<<<<<<<<< * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":382 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":382 * inf.node = self.tree * for i in range(self.m): * inf.side_distances[i] = 0 # <<<<<<<<<<<<<< @@ -2885,7 +3543,7 @@ */ (__pyx_v_inf->side_distances[__pyx_v_i]) = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":383 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":383 * for i in range(self.m): * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] # <<<<<<<<<<<<<< @@ -2894,17 +3552,17 @@ */ __pyx_v_t = ((__pyx_v_x[__pyx_v_i]) - (__pyx_v_self->raw_maxes[__pyx_v_i])); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":384 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":384 * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] * if t>inf.side_distances[i]: # <<<<<<<<<<<<<< * inf.side_distances[i] = t * else: */ - __pyx_3 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); - if (__pyx_3) { + __pyx_t_4 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":385 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":385 * t = x[i]-self.raw_maxes[i] * if t>inf.side_distances[i]: * inf.side_distances[i] = t # <<<<<<<<<<<<<< @@ -2916,7 +3574,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":387 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":387 * inf.side_distances[i] = t * else: * t = self.raw_mins[i]-x[i] # <<<<<<<<<<<<<< @@ -2925,17 +3583,17 @@ */ __pyx_v_t = ((__pyx_v_self->raw_mins[__pyx_v_i]) - (__pyx_v_x[__pyx_v_i])); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":388 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":388 * else: * t = self.raw_mins[i]-x[i] * if t>inf.side_distances[i]: # <<<<<<<<<<<<<< * inf.side_distances[i] = t * if p!=1 and p!=infinity: */ - __pyx_3 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); - if (__pyx_3) { + __pyx_t_4 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":389 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":389 * t = self.raw_mins[i]-x[i] * if t>inf.side_distances[i]: * inf.side_distances[i] = t # <<<<<<<<<<<<<< @@ -2949,20 +3607,23 @@ } __pyx_L5:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":390 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":390 * if t>inf.side_distances[i]: * inf.side_distances[i] = t * if p!=1 and p!=infinity: # <<<<<<<<<<<<<< * inf.side_distances[i]=inf.side_distances[i]**p * */ - __pyx_3 = (__pyx_v_p != 1); - if (__pyx_3) { - __pyx_3 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_4 = (__pyx_v_p != 1); + if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_4; } - if (__pyx_3) { + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":391 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":391 * inf.side_distances[i] = t * if p!=1 and p!=infinity: * inf.side_distances[i]=inf.side_distances[i]**p # <<<<<<<<<<<<<< @@ -2975,36 +3636,37 @@ __pyx_L7:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":394 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":394 * * # compute first distance * min_distance = 0. # <<<<<<<<<<<<<< * for i in range(self.m): * if p==infinity: */ - __pyx_v_min_distance = 0.; + __pyx_v_min_distance = 0.0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":395 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":395 * # compute first distance * min_distance = 0. * for i in range(self.m): # <<<<<<<<<<<<<< * if p==infinity: * min_distance = dmax(min_distance,inf.side_distances[i]) */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":396 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":396 * min_distance = 0. * for i in range(self.m): * if p==infinity: # <<<<<<<<<<<<<< * min_distance = dmax(min_distance,inf.side_distances[i]) * else: */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":397 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":397 * for i in range(self.m): * if p==infinity: * min_distance = dmax(min_distance,inf.side_distances[i]) # <<<<<<<<<<<<<< @@ -3016,7 +3678,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":399 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":399 * min_distance = dmax(min_distance,inf.side_distances[i]) * else: * min_distance += inf.side_distances[i] # <<<<<<<<<<<<<< @@ -3028,17 +3690,17 @@ __pyx_L10:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":402 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":402 * * # fiddle approximation factor * if eps==0: # <<<<<<<<<<<<<< * epsfac=1 * elif p==infinity: */ - __pyx_3 = (__pyx_v_eps == 0); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_eps == 0); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":403 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":403 * # fiddle approximation factor * if eps==0: * epsfac=1 # <<<<<<<<<<<<<< @@ -3049,53 +3711,66 @@ goto __pyx_L11; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":404 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":404 * if eps==0: * epsfac=1 * elif p==infinity: # <<<<<<<<<<<<<< * epsfac = 1/(1+eps) * else: */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":405 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":405 * epsfac=1 * elif p==infinity: * epsfac = 1/(1+eps) # <<<<<<<<<<<<<< * else: * epsfac = 1/(1+eps)**p */ - __pyx_v_epsfac = (1 / (1 + __pyx_v_eps)); + __pyx_t_7 = (1 + __pyx_v_eps); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_epsfac = (1 / __pyx_t_7); goto __pyx_L11; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":407 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":407 * epsfac = 1/(1+eps) * else: * epsfac = 1/(1+eps)**p # <<<<<<<<<<<<<< * * # internally we represent all distances as distance**p */ - __pyx_v_epsfac = (1 / pow((1 + __pyx_v_eps), __pyx_v_p)); + __pyx_t_7 = pow((1 + __pyx_v_eps), __pyx_v_p); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_epsfac = (1 / __pyx_t_7); } __pyx_L11:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":410 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":410 * * # internally we represent all distances as distance**p * if p!=infinity and distance_upper_bound!=infinity: # <<<<<<<<<<<<<< * distance_upper_bound = distance_upper_bound**p * */ - __pyx_3 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { - __pyx_3 = (__pyx_v_distance_upper_bound != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_6 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { + __pyx_t_4 = (__pyx_v_distance_upper_bound != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_6; } - if (__pyx_3) { + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":411 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":411 * # internally we represent all distances as distance**p * if p!=infinity and distance_upper_bound!=infinity: * distance_upper_bound = distance_upper_bound**p # <<<<<<<<<<<<<< @@ -3107,7 +3782,7 @@ } __pyx_L12:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":413 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":413 * distance_upper_bound = distance_upper_bound**p * * while True: # <<<<<<<<<<<<<< @@ -3115,20 +3790,20 @@ * node = inf.node */ while (1) { - __pyx_3 = 1; - if (!__pyx_3) break; + __pyx_t_5 = 1; + if (!__pyx_t_5) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":414 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":414 * * while True: * if inf.node.split_dim==-1: # <<<<<<<<<<<<<< * node = inf.node * */ - __pyx_3 = (__pyx_v_inf->node->split_dim == -1); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_inf->node->split_dim == -1); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":415 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":415 * while True: * if inf.node.split_dim==-1: * node = inf.node # <<<<<<<<<<<<<< @@ -3137,17 +3812,18 @@ */ __pyx_v_node = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)__pyx_v_inf->node); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":418 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":418 * * # brute-force * for i in range(node.start_idx,node.end_idx): # <<<<<<<<<<<<<< * d = _distance_p( * self.raw_data+self.raw_indices[i]*self.m, */ - __pyx_2 = __pyx_v_node->end_idx; - for (__pyx_v_i = __pyx_v_node->start_idx; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_node->end_idx; + for (__pyx_t_3 = __pyx_v_node->start_idx; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":421 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":421 * d = _distance_p( * self.raw_data+self.raw_indices[i]*self.m, * x,p,self.m,distance_upper_bound) # <<<<<<<<<<<<<< @@ -3156,40 +3832,41 @@ */ __pyx_v_d = __pyx_f_5scipy_7spatial_7ckdtree__distance_p((__pyx_v_self->raw_data + ((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m)), __pyx_v_x, __pyx_v_p, __pyx_v_self->m, __pyx_v_distance_upper_bound); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":423 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":423 * x,p,self.m,distance_upper_bound) * * if draw_indices[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":429 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":429 * neighbor.priority = -d * neighbor.contents.intdata = self.raw_indices[i] * heappush(&neighbors,neighbor) # <<<<<<<<<<<<<< * * # adjust upper bound for efficiency */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_neighbors), __pyx_v_neighbor); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_neighbors), __pyx_v_neighbor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":432 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":432 * * # adjust upper bound for efficiency * if neighbors.n==k: # <<<<<<<<<<<<<< * distance_upper_bound = -heappeek(&neighbors).priority * # done with this node, get another */ - __pyx_3 = (__pyx_v_neighbors.n == __pyx_v_k); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_neighbors.n == __pyx_v_k); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":433 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":433 * # adjust upper bound for efficiency * if neighbors.n==k: * distance_upper_bound = -heappeek(&neighbors).priority # <<<<<<<<<<<<<< @@ -3243,7 +3921,7 @@ __pyx_L18:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":435 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":435 * distance_upper_bound = -heappeek(&neighbors).priority * # done with this node, get another * stdlib.free(inf) # <<<<<<<<<<<<<< @@ -3252,29 +3930,29 @@ */ free(__pyx_v_inf); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":436 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":436 * # done with this node, get another * stdlib.free(inf) * if q.n==0: # <<<<<<<<<<<<<< * # no more nodes to visit * break */ - __pyx_3 = (__pyx_v_q.n == 0); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_q.n == 0); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":438 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":438 * if q.n==0: * # no more nodes to visit * break # <<<<<<<<<<<<<< * else: * it = heappop(&q) */ - goto __pyx_L14; + goto __pyx_L14_break; goto __pyx_L21; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":440 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":440 * break * else: * it = heappop(&q) # <<<<<<<<<<<<<< @@ -3283,7 +3961,7 @@ */ __pyx_v_it = __pyx_f_5scipy_7spatial_7ckdtree_heappop((&__pyx_v_q)); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":441 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":441 * else: * it = heappop(&q) * inf = it.contents.ptrdata # <<<<<<<<<<<<<< @@ -3292,7 +3970,7 @@ */ __pyx_v_inf = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)__pyx_v_it.contents.ptrdata); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":442 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":442 * it = heappop(&q) * inf = it.contents.ptrdata * min_distance = it.priority # <<<<<<<<<<<<<< @@ -3306,7 +3984,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":444 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":444 * min_distance = it.priority * else: * inode = inf.node # <<<<<<<<<<<<<< @@ -3315,17 +3993,17 @@ */ __pyx_v_inode = ((struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *)__pyx_v_inf->node); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":449 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":449 * # but since the distance_upper_bound decreases, we might get * # here even if the cell's too far * if min_distance>distance_upper_bound*epsfac: # <<<<<<<<<<<<<< * # since this is the nearest cell, we're done, bail out * stdlib.free(inf) */ - __pyx_3 = (__pyx_v_min_distance > (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_min_distance > (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":451 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":451 * if min_distance>distance_upper_bound*epsfac: * # since this is the nearest cell, we're done, bail out * stdlib.free(inf) # <<<<<<<<<<<<<< @@ -3334,17 +4012,18 @@ */ free(__pyx_v_inf); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":453 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":453 * stdlib.free(inf) * # free all the nodes still on the heap * for i in range(q.n): # <<<<<<<<<<<<<< * stdlib.free(q.heap[i].contents.ptrdata) * break */ - __pyx_2 = __pyx_v_q.n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_q.n; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":454 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":454 * # free all the nodes still on the heap * for i in range(q.n): * stdlib.free(q.heap[i].contents.ptrdata) # <<<<<<<<<<<<<< @@ -3354,29 +4033,29 @@ free((__pyx_v_q.heap[__pyx_v_i]).contents.ptrdata); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":455 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":455 * for i in range(q.n): * stdlib.free(q.heap[i].contents.ptrdata) * break # <<<<<<<<<<<<<< * * # set up children for searching */ - goto __pyx_L14; + goto __pyx_L14_break; goto __pyx_L22; } __pyx_L22:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":458 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":458 * * # set up children for searching * if x[inode.split_dim]split_dim]) < __pyx_v_inode->split); - if (__pyx_3) { + __pyx_t_5 = ((__pyx_v_x[__pyx_v_inode->split_dim]) < __pyx_v_inode->split); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":459 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":459 * # set up children for searching * if x[inode.split_dim]less; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":460 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":460 * if x[inode.split_dim]greater; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":463 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":463 * else: * near = inode.greater * far = inode.less # <<<<<<<<<<<<<< @@ -3417,7 +4096,7 @@ } __pyx_L25:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":468 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":468 * # we're going here next, so no point pushing it on the queue * # no need to recompute the distance or the side_distances * inf.node = near # <<<<<<<<<<<<<< @@ -3426,7 +4105,7 @@ */ __pyx_v_inf->node = __pyx_v_near; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":473 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":473 * # on the split value; compute its distance and side_distances * # and push it on the queue if it's near enough * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) # <<<<<<<<<<<<<< @@ -3435,7 +4114,7 @@ */ __pyx_v_inf2 = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo)) + (__pyx_v_self->m * (sizeof(double)))))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":474 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":474 * # and push it on the queue if it's near enough * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * it2.contents.ptrdata = inf2 # <<<<<<<<<<<<<< @@ -3444,7 +4123,7 @@ */ __pyx_v_it2.contents.ptrdata = ((char *)__pyx_v_inf2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":475 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":475 * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * it2.contents.ptrdata = inf2 * inf2.node = far # <<<<<<<<<<<<<< @@ -3453,17 +4132,18 @@ */ __pyx_v_inf2->node = __pyx_v_far; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":477 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":477 * inf2.node = far * # most side distances unchanged * for i in range(self.m): # <<<<<<<<<<<<<< * inf2.side_distances[i] = inf.side_distances[i] * */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":478 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":478 * # most side distances unchanged * for i in range(self.m): * inf2.side_distances[i] = inf.side_distances[i] # <<<<<<<<<<<<<< @@ -3473,17 +4153,17 @@ (__pyx_v_inf2->side_distances[__pyx_v_i]) = (__pyx_v_inf->side_distances[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":482 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":482 * # one side distance changes * # we can adjust the minimum distance without recomputing * if p == infinity: # <<<<<<<<<<<<<< * # we never use side_distances in the l_infinity case * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":485 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":485 * # we never use side_distances in the l_infinity case * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) # <<<<<<<<<<<<<< @@ -3494,17 +4174,17 @@ goto __pyx_L28; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":486 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":486 * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) * elif p == 1: # <<<<<<<<<<<<<< * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] */ - __pyx_3 = (__pyx_v_p == 1); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_p == 1); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":487 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":487 * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) * elif p == 1: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) # <<<<<<<<<<<<<< @@ -3513,7 +4193,7 @@ */ (__pyx_v_inf2->side_distances[__pyx_v_inode->split_dim]) = __pyx_f_5scipy_7spatial_7ckdtree_dabs((__pyx_v_inode->split - (__pyx_v_x[__pyx_v_inode->split_dim]))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":488 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":488 * elif p == 1: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] # <<<<<<<<<<<<<< @@ -3525,7 +4205,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":490 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":490 * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] * else: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim])**p # <<<<<<<<<<<<<< @@ -3534,7 +4214,7 @@ */ (__pyx_v_inf2->side_distances[__pyx_v_inode->split_dim]) = pow(__pyx_f_5scipy_7spatial_7ckdtree_dabs((__pyx_v_inode->split - (__pyx_v_x[__pyx_v_inode->split_dim]))), __pyx_v_p); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":491 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":491 * else: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim])**p * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] # <<<<<<<<<<<<<< @@ -3545,7 +4225,7 @@ } __pyx_L28:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":493 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":493 * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] * * it2.priority = far_min_distance # <<<<<<<<<<<<<< @@ -3554,30 +4234,31 @@ */ __pyx_v_it2.priority = __pyx_v_far_min_distance; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":497 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":497 * * # far child might be too far, if so, don't bother pushing it * if far_min_distance<=distance_upper_bound*epsfac: # <<<<<<<<<<<<<< * heappush(&q,it2) * else: */ - __pyx_3 = (__pyx_v_far_min_distance <= (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_far_min_distance <= (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":498 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":498 * # far child might be too far, if so, don't bother pushing it * if far_min_distance<=distance_upper_bound*epsfac: * heappush(&q,it2) # <<<<<<<<<<<<<< * else: * stdlib.free(inf2) */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_q), __pyx_v_it2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_q), __pyx_v_it2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L29; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":500 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":500 * heappush(&q,it2) * else: * stdlib.free(inf2) # <<<<<<<<<<<<<< @@ -3586,7 +4267,7 @@ */ free(__pyx_v_inf2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":502 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":502 * stdlib.free(inf2) * # just in case * it2.contents.ptrdata = 0 # <<<<<<<<<<<<<< @@ -3599,18 +4280,58 @@ } __pyx_L15:; } - __pyx_L14:; + __pyx_L14_break:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":505 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":505 * * # fill output arrays with sorted neighbors * for i in range(neighbors.n-1,-1,-1): # <<<<<<<<<<<<<< * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata */ - for (__pyx_v_i = (__pyx_v_neighbors.n - 1); __pyx_v_i > -1; __pyx_v_i-=1) { + __pyx_t_1 = PyInt_FromLong((__pyx_v_neighbors.n - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_8 = 0; __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_8 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":506 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":506 * # fill output arrays with sorted neighbors * for i in range(neighbors.n-1,-1,-1): * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced # <<<<<<<<<<<<<< @@ -3619,7 +4340,7 @@ */ __pyx_v_neighbor = __pyx_f_5scipy_7spatial_7ckdtree_heappop((&__pyx_v_neighbors)); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":507 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":507 * for i in range(neighbors.n-1,-1,-1): * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata # <<<<<<<<<<<<<< @@ -3628,20 +4349,23 @@ */ (__pyx_v_result_indices[__pyx_v_i]) = __pyx_v_neighbor.contents.intdata; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":508 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":508 * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata * if p==1 or p==infinity: # <<<<<<<<<<<<<< * result_distances[i] = -neighbor.priority * else: */ - __pyx_3 = (__pyx_v_p == 1); - if (!__pyx_3) { - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_5 = (__pyx_v_p == 1); + if (!__pyx_t_5) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_4 = __pyx_t_6; + } else { + __pyx_t_4 = __pyx_t_5; } - if (__pyx_3) { + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":509 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":509 * result_indices[i] = neighbor.contents.intdata * if p==1 or p==infinity: * result_distances[i] = -neighbor.priority # <<<<<<<<<<<<<< @@ -3653,46 +4377,56 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":511 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":511 * result_distances[i] = -neighbor.priority * else: * result_distances[i] = (-neighbor.priority)**(1./p) # <<<<<<<<<<<<<< * * heapdestroy(&q) */ - (__pyx_v_result_distances[__pyx_v_i]) = pow((-__pyx_v_neighbor.priority), (1. / __pyx_v_p)); + if (unlikely(__pyx_v_p == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_result_distances[__pyx_v_i]) = pow((-__pyx_v_neighbor.priority), (1.0 / __pyx_v_p)); } __pyx_L32:; } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":513 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":513 * result_distances[i] = (-neighbor.priority)**(1./p) * * heapdestroy(&q) # <<<<<<<<<<<<<< * heapdestroy(&neighbors) * */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_q)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_9 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_q)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":514 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":514 * * heapdestroy(&q) * heapdestroy(&neighbors) # <<<<<<<<<<<<<< * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_neighbors)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_9 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_neighbors)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("scipy.spatial.ckdtree.cKDTree.__query"); __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":516 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":516 * heapdestroy(&neighbors) * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, # <<<<<<<<<<<<<< @@ -3730,34 +4464,31 @@ Py_ssize_t __pyx_bstride_1_dd = 0; Py_ssize_t __pyx_bshape_0_dd = 0; Py_ssize_t __pyx_bshape_1_dd = 0; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - Py_ssize_t __pyx_6 = 0; - PyObject *__pyx_7 = 0; - int __pyx_8; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - PyArrayObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_6; PyArrayObject *__pyx_t_7 = NULL; - long __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_x,&__pyx_kp_k,&__pyx_kp_eps,&__pyx_kp_p,&__pyx_kp_23,0}; - __pyx_v_k = 1; - __pyx_v_eps = ((double)0); - __pyx_v_p = ((double)2); - __pyx_v_distance_upper_bound = __pyx_k_24; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__k,&__pyx_n_s__eps,&__pyx_n_s__p,&__pyx_n_s_3,0}; + __Pyx_RefNannySetupContext("query"); if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[5] = {0,0,0,0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -3769,32 +4500,64 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_3); + if (unlikely(value)) { values[4] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_x = values[0]; if (values[1]) { - __pyx_v_k = __pyx_PyInt_int(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_k = ((int)1); } if (values[2]) { - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[2]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_eps = ((double)0); } if (values[3]) { - __pyx_v_p = __pyx_PyFloat_AsDouble(values[3]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_p = ((double)2); } if (values[4]) { - __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(values[4]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_distance_upper_bound == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_distance_upper_bound = __pyx_k_4; } } else { + __pyx_v_k = ((int)1); + __pyx_v_eps = ((double)0); + __pyx_v_p = ((double)2); + __pyx_v_distance_upper_bound = __pyx_k_4; switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: __pyx_v_p = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_k = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 5: __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_distance_upper_bound == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: __pyx_v_p = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_k = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; @@ -3807,472 +4570,585 @@ __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.query"); return NULL; __pyx_L4_argument_unpacking_done:; - Py_INCREF(__pyx_v_x); - __pyx_v_ii = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_dd = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_xx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_single = Py_None; Py_INCREF(Py_None); - __pyx_v_retshape = Py_None; Py_INCREF(Py_None); - __pyx_v_n = Py_None; Py_INCREF(Py_None); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_x); + __pyx_v_ii = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_dd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_xx = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_single = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_retshape = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_n = Py_None; __Pyx_INCREF(Py_None); __pyx_bstruct_ii.buf = NULL; __pyx_bstruct_dd.buf = NULL; __pyx_bstruct_xx.buf = NULL; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":558 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":558 * cdef np.ndarray[double, ndim=2] xx * cdef int c * x = np.asarray(x).astype(np.float) # <<<<<<<<<<<<<< * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_astype); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_float); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":559 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":559 * cdef int c * x = np.asarray(x).astype(np.float) * if np.shape(x)[-1] != self.m: # <<<<<<<<<<<<<< * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_shape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_1 = __Pyx_GetItemInt(__pyx_2, -1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_4) { + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":560 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":560 * x = np.asarray(x).astype(np.float) * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) # <<<<<<<<<<<<<< * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") */ - __pyx_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_5 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5); - __pyx_1 = 0; - __pyx_5 = 0; - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_28, ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_1, 0, 0); - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":561 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":561 * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: # <<<<<<<<<<<<<< * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: */ - __pyx_4 = (__pyx_v_p < 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_p < 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":562 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":562 * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") # <<<<<<<<<<<<<< * if len(x.shape)==1: * single = True */ - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_29); - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_kp_29); - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":563 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":563 * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: # <<<<<<<<<<<<<< * single = True * x = x[np.newaxis,:] */ - __pyx_3 = PyObject_GetAttr(__pyx_v_x, __pyx_kp_shape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Length(__pyx_3); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = (__pyx_6 == 1); - if (__pyx_4) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (__pyx_t_6 == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":564 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":564 * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: * single = True # <<<<<<<<<<<<<< * x = x[np.newaxis,:] * else: */ - __pyx_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_single); - __pyx_v_single = __pyx_1; - __pyx_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_single); + __pyx_v_single = __pyx_t_1; + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":565 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":565 * if len(x.shape)==1: * single = True * x = x[np.newaxis,:] # <<<<<<<<<<<<<< * else: * single = False */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_newaxis); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_3); - __pyx_2 = 0; - __pyx_3 = 0; - __pyx_5 = PyObject_GetItem(__pyx_v_x, ((PyObject *)__pyx_1)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_5; - __pyx_5 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_v_x, __pyx_t_3); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L8; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":567 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":567 * x = x[np.newaxis,:] * else: * single = False # <<<<<<<<<<<<<< * retshape = np.shape(x)[:-1] * n = np.prod(retshape) */ - __pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_single); - __pyx_v_single = __pyx_2; - __pyx_2 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_single); + __pyx_v_single = __pyx_t_1; + __pyx_t_1 = 0; } __pyx_L8:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":568 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":568 * else: * single = False * retshape = np.shape(x)[:-1] # <<<<<<<<<<<<<< * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_shape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_3 = PySequence_GetSlice(__pyx_2, 0, -1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_retshape); - __pyx_v_retshape = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySequence_GetSlice(__pyx_t_5, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_retshape); + __pyx_v_retshape = __pyx_t_1; + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":569 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":569 * single = False * retshape = np.shape(x)[:-1] * n = np.prod(retshape) # <<<<<<<<<<<<<< * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_prod); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_retshape); - __pyx_3 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__prod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":570 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":570 * retshape = np.shape(x)[:-1] * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) # <<<<<<<<<<<<<< * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_reshape); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); - __pyx_2 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_3)); - __pyx_3 = 0; - __pyx_2 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_2, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_5); { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_xx, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_v_xx, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } + } + __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; + __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; - __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = 0; - Py_DECREF(((PyObject *)__pyx_v_xx)); - __pyx_v_xx = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_xx)); + __pyx_v_xx = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":571 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":571 * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) # <<<<<<<<<<<<<< * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_xx)); - PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_xx)); - __pyx_2 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_2, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_xx)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_xx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_xx)); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_xx, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_1); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_v_xx, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } + } + __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; + __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; - __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = 0; - Py_DECREF(((PyObject *)__pyx_v_xx)); - __pyx_v_xx = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_xx)); + __pyx_v_xx = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":572 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":572 * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) # <<<<<<<<<<<<<< * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_kp_empty); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1); - __pyx_1 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_2)); - __pyx_2 = 0; - __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyObject_GetAttr(__pyx_2, __pyx_kp_float); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_5, ((PyObject *)__pyx_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_6, &__pyx_bstruct_dd, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyArrayObject *)__pyx_t_12); { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_dd, &__pyx_bstruct_dd, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dd, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dd, (PyObject*)__pyx_v_dd, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } + } + __pyx_bstride_0_dd = __pyx_bstruct_dd.strides[0]; __pyx_bstride_1_dd = __pyx_bstruct_dd.strides[1]; + __pyx_bshape_0_dd = __pyx_bstruct_dd.shape[0]; __pyx_bshape_1_dd = __pyx_bstruct_dd.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_dd = __pyx_bstruct_dd.strides[0]; __pyx_bstride_1_dd = __pyx_bstruct_dd.strides[1]; - __pyx_bshape_0_dd = __pyx_bstruct_dd.shape[0]; __pyx_bshape_1_dd = __pyx_bstruct_dd.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = 0; - Py_DECREF(((PyObject *)__pyx_v_dd)); - __pyx_v_dd = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_dd)); + __pyx_v_dd = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":573 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":573 * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) # <<<<<<<<<<<<<< * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) */ - __pyx_7 = PyObject_GetAttr(((PyObject *)__pyx_v_dd), __pyx_kp_fill); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyFloat_FromDouble(__pyx_v_5scipy_7spatial_7ckdtree_infinity); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); - __pyx_5 = 0; - __pyx_1 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_dd), __pyx_n_s__fill); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_5scipy_7spatial_7ckdtree_infinity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_12, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":574 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":574 * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') # <<<<<<<<<<<<<< * ii.fill(self.n) * for c in range(n): */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_empty); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_7 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_7); - __pyx_7 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_3)); - __pyx_3 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_kp_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyEval_CallObjectWithKeywords(__pyx_5, ((PyObject *)__pyx_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_7, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_7); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); - __pyx_t_3 = __Pyx_GetBuffer_int((PyObject*)__pyx_t_7, &__pyx_bstruct_ii, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__i)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((PyArrayObject *)__pyx_t_5); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1); - if (unlikely(__Pyx_GetBuffer_int((PyObject*)__pyx_v_ii, &__pyx_bstruct_ii, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_1); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ii, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ii, (PyObject*)__pyx_v_ii, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } + } + __pyx_bstride_0_ii = __pyx_bstruct_ii.strides[0]; __pyx_bstride_1_ii = __pyx_bstruct_ii.strides[1]; + __pyx_bshape_0_ii = __pyx_bstruct_ii.shape[0]; __pyx_bshape_1_ii = __pyx_bstruct_ii.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_ii = __pyx_bstruct_ii.strides[0]; __pyx_bstride_1_ii = __pyx_bstruct_ii.strides[1]; - __pyx_bshape_0_ii = __pyx_bstruct_ii.shape[0]; __pyx_bshape_1_ii = __pyx_bstruct_ii.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = 0; - Py_DECREF(((PyObject *)__pyx_v_ii)); - __pyx_v_ii = ((PyArrayObject *)__pyx_7); - __pyx_7 = 0; + __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_ii)); + __pyx_v_ii = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":575 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":575 * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) # <<<<<<<<<<<<<< * for c in range(n): * self.__query( */ - __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_ii), __pyx_kp_fill); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_5); - __pyx_5 = 0; - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_ii), __pyx_n_s__fill); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":576 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":576 * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) * for c in range(n): # <<<<<<<<<<<<<< * self.__query( * (dd.data)+c*k, */ - __pyx_8 = __pyx_PyInt_int(__pyx_v_n); if (unlikely((__pyx_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_c = 0; __pyx_v_c < __pyx_8; __pyx_v_c+=1) { + __pyx_t_15 = __Pyx_PyInt_AsLong(__pyx_v_n); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_15; __pyx_t_8+=1) { + __pyx_v_c = __pyx_t_8; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":584 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":584 * eps, * p, * distance_upper_bound) # <<<<<<<<<<<<<< @@ -4282,93 +5158,105 @@ ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__query(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), (((double *)__pyx_v_dd->data) + (__pyx_v_c * __pyx_v_k)), (((int *)__pyx_v_ii->data) + (__pyx_v_c * __pyx_v_k)), (((double *)__pyx_v_xx->data) + (__pyx_v_c * ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m)), __pyx_v_k, __pyx_v_eps, __pyx_v_p, __pyx_v_distance_upper_bound); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":585 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":585 * p, * distance_upper_bound) * if single: # <<<<<<<<<<<<<< * if k==1: * return dd[0,0], ii[0,0] */ - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_single); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_4) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_single); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":586 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":586 * distance_upper_bound) * if single: * if k==1: # <<<<<<<<<<<<<< * return dd[0,0], ii[0,0] * else: */ - __pyx_4 = (__pyx_v_k == 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_k == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":587 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":587 * if single: * if k==1: * return dd[0,0], ii[0,0] # <<<<<<<<<<<<<< * else: * return dd[0], ii[0] */ - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_3 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_dd; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_dd)) __pyx_t_3 = 0; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_1_dd; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 1; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_dd)) __pyx_t_3 = 1; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_8 = -1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_bshape_0_dd; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_dd)) __pyx_t_8 = 0; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_bshape_1_dd; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_dd)) __pyx_t_8 = 1; + if (unlikely(__pyx_t_8 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_8); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_7 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_bstruct_dd.buf, __pyx_t_8, __pyx_bstride_0_dd, __pyx_t_9, __pyx_bstride_1_dd))); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_3 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_ii; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_ii)) __pyx_t_3 = 0; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_1_ii; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_3 = 1; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_ii)) __pyx_t_3 = 1; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_bstruct_dd.buf, __pyx_t_16, __pyx_bstride_0_dd, __pyx_t_17, __pyx_bstride_1_dd))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = 0; + __pyx_t_19 = 0; + __pyx_t_8 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_0_ii; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_ii)) __pyx_t_8 = 0; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_1_ii; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_ii)) __pyx_t_8 = 1; + if (unlikely(__pyx_t_8 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_8); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_5 = PyInt_FromLong((*__Pyx_BufPtrStrided2d(int *, __pyx_bstruct_ii.buf, __pyx_t_10, __pyx_bstride_0_ii, __pyx_t_11, __pyx_bstride_1_ii))); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_7); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5); - __pyx_7 = 0; - __pyx_5 = 0; - __pyx_r = ((PyObject *)__pyx_3); - __pyx_3 = 0; + __pyx_t_3 = PyInt_FromLong((*__Pyx_BufPtrStrided2d(int *, __pyx_bstruct_ii.buf, __pyx_t_18, __pyx_bstride_0_ii, __pyx_t_19, __pyx_bstride_1_ii))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_12 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; goto __pyx_L12; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":589 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":589 * return dd[0,0], ii[0,0] * else: * return dd[0], ii[0] # <<<<<<<<<<<<<< * else: * if k==1: */ - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dd), 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ii), 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_2); - __pyx_1 = 0; - __pyx_2 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dd), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ii), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; goto __pyx_L0; } __pyx_L12:; @@ -4376,132 +5264,180 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":591 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":591 * return dd[0], ii[0] * else: * if k==1: # <<<<<<<<<<<<<< * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) * else: */ - __pyx_4 = (__pyx_v_k == 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_k == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":592 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":592 * else: * if k==1: * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) # <<<<<<<<<<<<<< * else: * return np.reshape(dd,retshape+(k,)), np.reshape(ii,retshape+(k,)) */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_reshape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(Py_Ellipsis); - PyTuple_SET_ITEM(__pyx_1, 0, Py_Ellipsis); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_int_0); - __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_dd), ((PyObject *)__pyx_1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2); - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_v_retshape); - __pyx_2 = 0; - __pyx_5 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_reshape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(Py_Ellipsis); - PyTuple_SET_ITEM(__pyx_3, 0, Py_Ellipsis); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0); - __pyx_7 = PyObject_GetItem(((PyObject *)__pyx_v_ii), ((PyObject *)__pyx_3)); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_7); - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_retshape); - __pyx_7 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_5); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_3); - __pyx_5 = 0; - __pyx_3 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(Py_Ellipsis); + PyTuple_SET_ITEM(__pyx_t_12, 0, Py_Ellipsis); + __Pyx_GIVEREF(Py_Ellipsis); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_dd), __pyx_t_12); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(Py_Ellipsis); + PyTuple_SET_ITEM(__pyx_t_12, 0, Py_Ellipsis); + __Pyx_GIVEREF(Py_Ellipsis); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ii), __pyx_t_12); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":594 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":594 * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) * else: * return np.reshape(dd,retshape+(k,)), np.reshape(ii,retshape+(k,)) # <<<<<<<<<<<<<< * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_reshape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); - __pyx_5 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_retshape, ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_dd)); - PyTuple_SET_ITEM(__pyx_7, 0, ((PyObject *)__pyx_v_dd)); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_reshape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_1); - __pyx_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_retshape, ((PyObject *)__pyx_7)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_5 = PyTuple_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_ii)); - PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ii)); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_1); - __pyx_2 = 0; - __pyx_1 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Add(__pyx_v_retshape, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dd)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dd)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dd)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_v_retshape, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_ii)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ii)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ii)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; } __pyx_L13:; } __pyx_L11:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_7); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); @@ -4516,17 +5452,20 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); __pyx_L2:; - Py_DECREF(__pyx_v_ii); - Py_DECREF(__pyx_v_dd); - Py_DECREF(__pyx_v_xx); - Py_DECREF(__pyx_v_single); - Py_DECREF(__pyx_v_retshape); - Py_DECREF(__pyx_v_n); - Py_DECREF(__pyx_v_x); + __Pyx_DECREF((PyObject *)__pyx_v_ii); + __Pyx_DECREF((PyObject *)__pyx_v_dd); + __Pyx_DECREF((PyObject *)__pyx_v_xx); + __Pyx_DECREF(__pyx_v_single); + __Pyx_DECREF(__pyx_v_retshape); + __Pyx_DECREF(__pyx_v_n); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":50 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -4539,47 +5478,67 @@ int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; - PyObject *__pyx_v_stack; + int __pyx_v_offset; int __pyx_v_hasfields; - PyObject *__pyx_v_iterator; int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_7 = 0; - Py_ssize_t __pyx_8 = 0; - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; Py_INCREF(Py_None); - __pyx_v_stack = ((PyObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_iterator = Py_None; Py_INCREF(Py_None); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":56 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":58 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ - __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_1) { + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":59 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -4591,7 +5550,7 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":61 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -4602,88 +5561,100 @@ } __pyx_L5:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":63 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":64 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":65 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":67 - * raise ValueError("ndarray is not C contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":68 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_2) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":69 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":71 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -4691,7 +5662,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":72 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -4700,17 +5671,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":73 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_4 = __pyx_v_copy_shape; - if (__pyx_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":76 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -4719,7 +5690,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":77 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -4728,16 +5699,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":78 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i+=1) { + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":79 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -4746,7 +5719,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":80 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -4759,7 +5732,7 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":82 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -4768,7 +5741,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":83 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -4779,7 +5752,7 @@ } __pyx_L8:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":84 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -4788,7 +5761,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":85 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -4797,7 +5770,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":86 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -4806,7 +5779,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":89 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -4815,309 +5788,411 @@ */ __pyx_v_f = NULL; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":90 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack - * + * cdef int offset */ - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":93 - * cdef list stack + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * - * # Ugly hack warning: + * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":103 - * # functions). + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { - __pyx_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; } - if (__pyx_1) { + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":105 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ - Py_INCREF(Py_None); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L11; } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":108 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - Py_INCREF(__pyx_v_self); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L11:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":110 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if t == NPY_BYTE: f = "b" + * if ((descr.byteorder == '>' and little_endian) or */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":111 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":112 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = __pyx_k_3; - break; - case NPY_UBYTE: + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":113 - * t = descr.type_num + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_v_f = __pyx_k_4; - break; - case NPY_SHORT: + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":114 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_v_f = __pyx_k_5; - break; - case NPY_USHORT: + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":115 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_v_f = __pyx_k_6; - break; - case NPY_INT: + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":116 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_v_f = __pyx_k_7; - break; - case NPY_UINT: + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":117 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_v_f = __pyx_k_8; - break; - case NPY_LONG: + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":118 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_v_f = __pyx_k_9; - break; - case NPY_ULONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":119 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_v_f = __pyx_k_10; - break; - case NPY_LONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":120 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_v_f = __pyx_k_11; - break; - case NPY_ULONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":121 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_v_f = __pyx_k_12; - break; - case NPY_FLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":122 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_v_f = __pyx_k_13; - break; - case NPY_DOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":123 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_v_f = __pyx_k_14; - break; - case NPY_LONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":124 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_v_f = __pyx_k_15; - break; - case NPY_CFLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":125 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_v_f = __pyx_k_16; - break; - case NPY_CDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":126 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_v_f = __pyx_k_17; - break; - case NPY_CLONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":127 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_v_f = __pyx_k_18; - break; - case NPY_OBJECT: + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":128 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_v_f = __pyx_k_19; - break; - default: + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":130 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_20, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_L14:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":131 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":132 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: - * info.format = stdlib.malloc(255) # static size + * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; @@ -5125,647 +6200,1201 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":134 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: - * info.format = stdlib.malloc(255) # static size # <<<<<<<<<<<<<< - * f = info.format - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":135 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: - * info.format = stdlib.malloc(255) # static size - * f = info.format # <<<<<<<<<<<<<< - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string * */ - __pyx_v_f = __pyx_v_info->format; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":136 - * info.format = stdlib.malloc(255) # static size - * f = info.format - * stack = [iter(descr.fields.iteritems())] # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * - * while True: + * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_3 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyList_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_stack)); - __pyx_v_stack = __pyx_2; - __pyx_2 = 0; + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":138 - * stack = [iter(descr.fields.iteritems())] + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 + * f[0] = 0 # Terminate format string * - * while True: # <<<<<<<<<<<<<< - * iterator = stack[-1] - * descr = None + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) */ - while (1) { - __pyx_1 = 1; - if (!__pyx_1) break; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":139 +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * - * while True: - * iterator = stack[-1] # <<<<<<<<<<<<<< - * descr = None - * while descr is None: + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":140 - * while True: - * iterator = stack[-1] - * descr = None # <<<<<<<<<<<<<< - * while descr is None: - * try: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) */ - Py_INCREF(Py_None); - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)Py_None); + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":141 - * iterator = stack[-1] - * descr = None - * while descr is None: # <<<<<<<<<<<<<< - * try: - * descr = iterator.next()[1][0] + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block */ - while (1) { - __pyx_1 = (((PyObject *)__pyx_v_descr) == Py_None); - if (!__pyx_1) break; + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":142 - * descr = None - * while descr is None: - * try: # <<<<<<<<<<<<<< - * descr = iterator.next()[1][0] - * except StopIteration: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - /*try:*/ { + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":143 - * while descr is None: - * try: - * descr = iterator.next()[1][0] # <<<<<<<<<<<<<< - * except StopIteration: - * stack.pop() + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ - __pyx_2 = PyObject_GetAttr(__pyx_v_iterator, __pyx_kp_next); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetItemInt(__pyx_3, 1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)__pyx_3); - __pyx_3 = 0; - } - Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L22_try; - __pyx_L17_error:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":144 - * try: - * descr = iterator.next()[1][0] - * except StopIteration: # <<<<<<<<<<<<<< - * stack.pop() - * if len(stack) > 0: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_4 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_4) { - __Pyx_AddTraceback("numpy.__getbuffer__"); - if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":145 - * descr = iterator.next()[1][0] - * except StopIteration: - * stack.pop() # <<<<<<<<<<<<<< - * if len(stack) > 0: - * f[0] = 125 #"}" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * */ - __pyx_6 = PyObject_GetAttr(((PyObject *)__pyx_v_stack), __pyx_kp_pop); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_7 = PyObject_Call(__pyx_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":146 - * except StopIteration: - * stack.pop() - * if len(stack) > 0: # <<<<<<<<<<<<<< - * f[0] = 125 #"}" - * f += 1 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_8 = PyObject_Length(((PyObject *)__pyx_v_stack)); if (unlikely(__pyx_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_1 = (__pyx_8 > 0); - if (__pyx_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":147 - * stack.pop() - * if len(stack) > 0: - * f[0] = 125 #"}" # <<<<<<<<<<<<<< - * f += 1 - * iterator = stack[-1] + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * */ - (__pyx_v_f[0]) = 125; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":148 - * if len(stack) > 0: - * f[0] = 125 #"}" - * f += 1 # <<<<<<<<<<<<<< - * iterator = stack[-1] - * else: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_v_f += 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":149 - * f[0] = 125 #"}" - * f += 1 - * iterator = stack[-1] # <<<<<<<<<<<<<< - * else: - * f[0] = 0 # Terminate string! + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ - __pyx_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_6; - __pyx_6 = 0; - goto __pyx_L23; - } - /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":151 - * iterator = stack[-1] - * else: - * f[0] = 0 # Terminate string! # <<<<<<<<<<<<<< - * return +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - (__pyx_v_f[0]) = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":152 - * else: - * f[0] = 0 # Terminate string! - * return # <<<<<<<<<<<<<< + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * hasfields = PyDataType_HASFIELDS(descr) + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_r = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L20_except_return; - } - __pyx_L23:; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L18_exception_handled; - } - __pyx_L19_except_error:; - Py_XDECREF(__pyx_save_exc_type); - Py_XDECREF(__pyx_save_exc_value); - Py_XDECREF(__pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L20_except_return:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L0; - __pyx_L18_exception_handled:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L22_try:; - } + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":154 - * return + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * - * hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * if not hasfields: - * t = descr.type_num + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":155 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 * - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_v_f += 1; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":156 - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize */ - __pyx_v_t = __pyx_v_descr->type_num; + (__pyx_v_offset[0]) += 1; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":157 - * if not hasfields: - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + * offset[0] += 1 * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): */ - __pyx_1 = ((__pyx_v_f - __pyx_v_info->format) > 240); - if (__pyx_1) { + (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":158 - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + * offset[0] += child.itemsize * - * # Until ticket #99 is fixed, use integers to avoid warnings + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: */ - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_21); - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_kp_21); - __pyx_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __Pyx_Raise(__pyx_6, 0, 0); - Py_DECREF(__pyx_6); __pyx_6 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L25; - } - __pyx_L25:; + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":161 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") */ - switch (__pyx_v_t) { - case NPY_BYTE: - (__pyx_v_f[0]) = 98; - break; - case NPY_UBYTE: + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":162 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * */ - (__pyx_v_f[0]) = 66; - break; - case NPY_SHORT: + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":163 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings */ - (__pyx_v_f[0]) = 104; - break; - case NPY_USHORT: + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":164 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" */ - (__pyx_v_f[0]) = 72; - break; - case NPY_INT: + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":165 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" */ - (__pyx_v_f[0]) = 105; - break; - case NPY_UINT: + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":166 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" */ - (__pyx_v_f[0]) = 73; - break; - case NPY_LONG: + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":167 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" */ - (__pyx_v_f[0]) = 108; - break; - case NPY_ULONG: + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":168 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" */ - (__pyx_v_f[0]) = 76; - break; - case NPY_LONGLONG: + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":169 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" */ - (__pyx_v_f[0]) = 113; - break; - case NPY_ULONGLONG: + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":170 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - (__pyx_v_f[0]) = 81; - break; - case NPY_FLOAT: + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":171 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - (__pyx_v_f[0]) = 102; - break; - case NPY_DOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":172 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - (__pyx_v_f[0]) = 100; - break; - case NPY_LONGDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":173 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - (__pyx_v_f[0]) = 103; - break; - case NPY_CFLOAT: + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":174 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - break; - case NPY_CDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":175 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - break; - case NPY_CLONGDOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":176 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - break; - case NPY_OBJECT: + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":177 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - (__pyx_v_f[0]) = 79; - break; - default: + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":179 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_22, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":180 - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * f[0] = 84 #"T" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; __pyx_v_f += 1; - goto __pyx_L24; + goto __pyx_L11; } - /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":182 - * f += 1 - * else: - * f[0] = 84 #"T" # <<<<<<<<<<<<<< - * f[1] = 123 #"{" - * f += 2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - (__pyx_v_f[0]) = 84; + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":183 - * else: - * f[0] = 84 #"T" - * f[1] = 123 #"{" # <<<<<<<<<<<<<< - * f += 2 - * stack.append(iter(descr.fields.iteritems())) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: */ - (__pyx_v_f[1]) = 123; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":184 - * f[0] = 84 #"T" - * f[1] = 123 #"{" - * f += 2 # <<<<<<<<<<<<<< - * stack.append(iter(descr.fields.iteritems())) - * + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 2; + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":185 - * f[1] = 123 #"{" - * f += 2 - * stack.append(iter(descr.fields.iteritems())) # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f * - * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_7 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyObject_GetIter(__pyx_6); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyList_Append(((PyObject *)__pyx_v_stack), __pyx_2); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - __pyx_L24:; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } + __pyx_L9:; } - __pyx_L12:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); - Py_XDECREF(__pyx_7); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - Py_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { Py_DECREF(Py_None); __pyx_v_info->obj = NULL; } - __pyx_L2:; - Py_XDECREF(__pyx_v_descr); - Py_DECREF(__pyx_v_stack); - Py_DECREF(__pyx_v_iterator); + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":187 - * stack.append(iter(descr.fields.iteritems())) +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_1; - int __pyx_2; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":188 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: */ - __pyx_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":189 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! */ - free(__pyx_v_info->format); - goto __pyx_L5; + __pyx_v_baseptr = NULL; + goto __pyx_L3; } - __pyx_L5:; + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":190 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) */ - __pyx_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_2) { + Py_INCREF(__pyx_v_base); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":191 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr * */ - free(__pyx_v_info->strides); - goto __pyx_L6; + Py_XDECREF(__pyx_v_arr->base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; } - __pyx_L6:; + /*else*/ { + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } static struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree; @@ -5837,17 +7466,17 @@ } static struct PyMethodDef __pyx_methods_5scipy_7spatial_7ckdtree_cKDTree[] = { - {"query", (PyCFunction)__pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree_query, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5scipy_7spatial_7ckdtree_7cKDTree_query}, + {__Pyx_NAMESTR("query"), (PyCFunction)__pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree_query, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5scipy_7spatial_7ckdtree_7cKDTree_query)}, {0, 0, 0, 0} }; static struct PyMemberDef __pyx_members_5scipy_7spatial_7ckdtree_cKDTree[] = { - {"data", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, data), READONLY, 0}, - {"n", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, n), READONLY, 0}, - {"m", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, m), READONLY, 0}, - {"leafsize", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, leafsize), READONLY, 0}, - {"maxes", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, maxes), READONLY, 0}, - {"mins", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, mins), READONLY, 0}, + {(char *)"data", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, data), READONLY, 0}, + {(char *)"n", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, n), READONLY, 0}, + {(char *)"m", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, m), READONLY, 0}, + {(char *)"leafsize", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, leafsize), READONLY, 0}, + {(char *)"maxes", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, maxes), READONLY, 0}, + {(char *)"mins", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, mins), READONLY, 0}, {0, 0, 0, 0, 0} }; @@ -5875,7 +7504,11 @@ 0, /*nb_coerce*/ #endif 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else 0, /*nb_long*/ + #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ @@ -5947,7 +7580,7 @@ PyTypeObject __pyx_type_5scipy_7spatial_7ckdtree_cKDTree = { PyVarObject_HEAD_INIT(0, 0) - "scipy.spatial.ckdtree.cKDTree", /*tp_name*/ + __Pyx_NAMESTR("scipy.spatial.ckdtree.cKDTree"), /*tp_name*/ sizeof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5scipy_7spatial_7ckdtree_cKDTree, /*tp_dealloc*/ @@ -5966,7 +7599,7 @@ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_cKDTree, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "kd-tree for quick nearest-neighbor lookup\n\n This class provides an index into a set of k-dimensional points\n which can be used to rapidly look up the nearest neighbors of any\n point. \n\n The algorithm used is described in Maneewongvatana and Mount 1999. \n The general idea is that the kd-tree is a binary trie, each of whose\n nodes represents an axis-aligned hyperrectangle. Each node specifies\n an axis and splits the set of points based on whether their coordinate\n along that axis is greater than or less than a particular value. \n\n During construction, the axis and splitting point are chosen by the \n \"sliding midpoint\" rule, which ensures that the cells do not all\n become long and thin. \n\n The tree can be queried for the r closest neighbors of any given point \n (optionally returning only those within some maximum distance of the \n point). It can also be queried, with a substantial gain in efficiency, \n for the r approximate closest neighbors.\n\n For large dimensions (20 is already large) do not expect this to run \n significantly faster than brute force. High-dimensional nearest-neighbor\n queries are a substantial open problem in computer science.\n ", /*tp_doc*/ + __Pyx_DOCSTR("kd-tree for quick nearest-neighbor lookup\n\n This class provides an index into a set of k-dimensional points\n which can be used to rapidly look up the nearest neighbors of any\n point. \n\n The algorithm used is described in Maneewongvatana and Mount 1999. \n The general idea is that the kd-tree is a binary trie, each of whose\n nodes represents an axis-aligned hyperrectangle. Each node specifies\n an axis and splits the set of points based on whether their coordinate\n along that axis is greater than or less than a particular value. \n\n During construction, the axis and splitting point are chosen by the \n \"sliding midpoint\" rule, which ensures that the cells do not all\n become long and thin. \n\n The tree can be queried for the r closest neighbors of any given point \n (optionally returning only those within some maximum distance of the \n point). It can also be queried, with a substantial gain in efficiency, \n for the r approximate closest neighbors.\n\n For large dimensions (20 is already large) do not expect this to run \n significantly faster than brute force. High-dimensional nearest-neighbor\n queries are a substantial open problem in computer science.\n "), /*tp_doc*/ __pyx_tp_traverse_5scipy_7spatial_7ckdtree_cKDTree, /*tp_traverse*/ __pyx_tp_clear_5scipy_7spatial_7ckdtree_cKDTree, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -5991,6 +7624,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -6002,7 +7639,7 @@ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "ckdtree", + __Pyx_NAMESTR("ckdtree"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -6014,70 +7651,111 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp___dealloc__, __pyx_k___dealloc__, sizeof(__pyx_k___dealloc__), 1, 1, 1}, - {&__pyx_kp_query, __pyx_k_query, sizeof(__pyx_k_query), 1, 1, 1}, - {&__pyx_kp_data, __pyx_k_data, sizeof(__pyx_k_data), 1, 1, 1}, - {&__pyx_kp_leafsize, __pyx_k_leafsize, sizeof(__pyx_k_leafsize), 1, 1, 1}, - {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, - {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, - {&__pyx_kp_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 1, 1, 1}, - {&__pyx_kp_p, __pyx_k_p, sizeof(__pyx_k_p), 1, 1, 1}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_kdtree, __pyx_k_kdtree, sizeof(__pyx_k_kdtree), 1, 1, 1}, - {&__pyx_kp_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_float, __pyx_k_float, sizeof(__pyx_k_float), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp_amax, __pyx_k_amax, sizeof(__pyx_k_amax), 1, 1, 1}, - {&__pyx_kp_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 1, 1, 1}, - {&__pyx_kp_amin, __pyx_k_amin, sizeof(__pyx_k_amin), 1, 1, 1}, - {&__pyx_kp_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 1, 1, 1}, - {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 1, 1, 1}, - {&__pyx_kp_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 1, 1, 1}, - {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1}, - {&__pyx_kp_newaxis, __pyx_k_newaxis, sizeof(__pyx_k_newaxis), 1, 1, 1}, - {&__pyx_kp_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 1, 1, 1}, - {&__pyx_kp_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 1, 1, 1}, - {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1}, - {&__pyx_kp_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 1, 1, 1}, - {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, - {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 0}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, - {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, - {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, - {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, - {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0}, - {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0}, - {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____build, __pyx_k____build, sizeof(__pyx_k____build), 0, 0, 1, 1}, + {&__pyx_n_s____free_tree, __pyx_k____free_tree, sizeof(__pyx_k____free_tree), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____query, __pyx_k____query, sizeof(__pyx_k____query), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__amax, __pyx_k__amax, sizeof(__pyx_k__amax), 0, 0, 1, 1}, + {&__pyx_n_s__amin, __pyx_k__amin, sizeof(__pyx_k__amin), 0, 0, 1, 1}, + {&__pyx_n_s__arange, __pyx_k__arange, sizeof(__pyx_k__arange), 0, 0, 1, 1}, + {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, + {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__cKDTree, __pyx_k__cKDTree, sizeof(__pyx_k__cKDTree), 0, 0, 1, 1}, + {&__pyx_n_s__contents, __pyx_k__contents, sizeof(__pyx_k__contents), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__end_idx, __pyx_k__end_idx, sizeof(__pyx_k__end_idx), 0, 0, 1, 1}, + {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__greater, __pyx_k__greater, sizeof(__pyx_k__greater), 0, 0, 1, 1}, + {&__pyx_n_s__heap, __pyx_k__heap, sizeof(__pyx_k__heap), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, + {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, + {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, + {&__pyx_n_s__intdata, __pyx_k__intdata, sizeof(__pyx_k__intdata), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__kdtree, __pyx_k__kdtree, sizeof(__pyx_k__kdtree), 0, 0, 1, 1}, + {&__pyx_n_s__leafsize, __pyx_k__leafsize, sizeof(__pyx_k__leafsize), 0, 0, 1, 1}, + {&__pyx_n_s__less, __pyx_k__less, sizeof(__pyx_k__less), 0, 0, 1, 1}, + {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1}, + {&__pyx_n_s__maxes, __pyx_k__maxes, sizeof(__pyx_k__maxes), 0, 0, 1, 1}, + {&__pyx_n_s__mins, __pyx_k__mins, sizeof(__pyx_k__mins), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__newaxis, __pyx_k__newaxis, sizeof(__pyx_k__newaxis), 0, 0, 1, 1}, + {&__pyx_n_s__node, __pyx_k__node, sizeof(__pyx_k__node), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__priority, __pyx_k__priority, sizeof(__pyx_k__priority), 0, 0, 1, 1}, + {&__pyx_n_s__prod, __pyx_k__prod, sizeof(__pyx_k__prod), 0, 0, 1, 1}, + {&__pyx_n_s__ptrdata, __pyx_k__ptrdata, sizeof(__pyx_k__ptrdata), 0, 0, 1, 1}, + {&__pyx_n_s__query, __pyx_k__query, sizeof(__pyx_k__query), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__raw_data, __pyx_k__raw_data, sizeof(__pyx_k__raw_data), 0, 0, 1, 1}, + {&__pyx_n_s__raw_indices, __pyx_k__raw_indices, sizeof(__pyx_k__raw_indices), 0, 0, 1, 1}, + {&__pyx_n_s__raw_maxes, __pyx_k__raw_maxes, sizeof(__pyx_k__raw_maxes), 0, 0, 1, 1}, + {&__pyx_n_s__raw_mins, __pyx_k__raw_mins, sizeof(__pyx_k__raw_mins), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__side_distances, __pyx_k__side_distances, sizeof(__pyx_k__side_distances), 0, 0, 1, 1}, + {&__pyx_n_s__space, __pyx_k__space, sizeof(__pyx_k__space), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__split_dim, __pyx_k__split_dim, sizeof(__pyx_k__split_dim), 0, 0, 1, 1}, + {&__pyx_n_s__start_idx, __pyx_k__start_idx, sizeof(__pyx_k__start_idx), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -6091,17 +7769,38 @@ PyMODINIT_FUNC PyInit_ckdtree(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - double __pyx_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + double __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ckdtree(void)", __LINE__, __FILE__); + #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ - __pyx_init_filenames(); - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("ckdtree", __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ckdtree"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -6109,92 +7808,145 @@ #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_scipy__spatial__ckdtree) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree = &__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__build = (struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *(*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, int, int, double *, double *))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___build; + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__free_tree = (PyObject *(*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree; + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__query = (void (*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, double *, int *, double *, int, double, double, double))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___query; + #else *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__build = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___build; *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__free_tree = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree; *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__query = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___query; + #endif if (PyType_Ready(&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_5scipy_7spatial_7ckdtree_cKDTree.tp_dict, __pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttrString(__pyx_m, "cKDTree", (PyObject *)&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "cKDTree", (PyObject *)&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_7spatial_7ckdtree_cKDTree = &__pyx_type_5scipy_7spatial_7ckdtree_cKDTree; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":3 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":3 * # Copyright Anne M. Archibald 2008 * # Released under the scipy license * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * cimport stdlib */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":7 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":7 * cimport stdlib * * import kdtree # <<<<<<<<<<<<<< * * cdef double infinity = np.inf */ - __pyx_1 = __Pyx_Import(__pyx_kp_kdtree, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_kdtree, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__kdtree), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__kdtree, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":9 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":9 * import kdtree * * cdef double infinity = np.inf # <<<<<<<<<<<<<< * * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_inf); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_5scipy_7spatial_7ckdtree_infinity = __pyx_3; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_5scipy_7spatial_7ckdtree_infinity = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":517 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":517 * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, * double distance_upper_bound=infinity): # <<<<<<<<<<<<<< * """query the kd-tree for nearest neighbors * */ - __pyx_k_24 = __pyx_v_5scipy_7spatial_7ckdtree_infinity; + __pyx_k_4 = __pyx_v_5scipy_7spatial_7ckdtree_infinity; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/stdlib.pxd":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":1 + * # Copyright Anne M. Archibald 2008 # <<<<<<<<<<<<<< + * # Released under the scipy license + * import numpy as np + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__cKDTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_13), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__cKDTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__query); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_14), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * - * cdef extern from "stdlib.h": # <<<<<<<<<<<<<< - * ctypedef unsigned long size_t + * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) + * void *malloc(size_t size) */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + if (__pyx_m) { + __Pyx_AddTraceback("init scipy.spatial.ckdtree"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scipy.spatial.ckdtree"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - __Pyx_AddTraceback("scipy.spatial.ckdtree"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -6208,6 +7960,13 @@ __pyx_f = __pyx_filenames; } +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -6265,18 +8024,17 @@ PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; } else { - name = argnames; - while (*name && (**name != key)) name++; - if (*name) { - if (name < first_kw_arg) goto arg_passed_twice; - values[name-argnames] = value; + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 @@ -6284,8 +8042,7 @@ PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) break; + _PyString_Eq(**name, key)) break; #endif } if (*name) { @@ -6299,8 +8056,7 @@ PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) goto arg_passed_twice; + _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { @@ -6333,159 +8089,461 @@ return -1; } -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); } -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { - while (1) { - switch (*ts) { - case '@': - case 10: - case 13: - case ' ': - ++ts; - break; - case '=': - case '<': - case '>': - case '!': - PyErr_SetString(PyExc_ValueError, "Buffer acquisition error: Only native byte order, size and alignment supported."); - return NULL; - default: - return ts; +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; } } -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - expected_ndim, buffer->ndim); +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; } -static const char* __Pyx_DescribeTokenInFormatString(const char* ts) { - switch (*ts) { - case 'b': return "char"; - case 'B': return "unsigned char"; - case 'h': return "short"; - case 'H': return "unsigned short"; - case 'i': return "int"; - case 'I': return "unsigned int"; - case 'l': return "long"; - case 'L': return "unsigned long"; - case 'q': return "long long"; - case 'Q': return "unsigned long long"; - case 'f': return "float"; - case 'd': return "double"; - case 'g': return "long double"; - case 'Z': switch (*(ts+1)) { - case 'f': return "complex float"; - case 'd': return "complex double"; - case 'g': return "complex long double"; - default: return "unparseable format string"; - } +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 0: return "end"; default: return "unparseable format string"; } } -static const char* __Pyx_CheckTypestring_double(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(double) == sizeof(float) && (double)-1 < 0); break; - case 'd': ok = (sizeof(double) == sizeof(double) && (double)-1 < 0); break; - case 'g': ok = (sizeof(double) == sizeof(long double) && (double)-1 < 0); break; - default: ok = 0; +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected double, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - ++ts; - return ts; +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } - -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); - goto fail; +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); } - if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_double(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; } - } else { - if (buf->itemsize != sizeof(double)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; } -static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} -static const char* __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'b': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(char) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'h': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(short) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'i': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(int) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'l': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(long) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'q': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(long long) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - default: ok = 0; +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected numpy.int32_t, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; - } - ++ts; - return ts; } - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None) { __Pyx_ZeroBuffer(buf); return 0; @@ -6493,37 +8551,44 @@ buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); goto fail; } if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(__pyx_t_5numpy_int32_t)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -6538,7 +8603,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -6550,70 +8615,26 @@ } -static const char* __Pyx_CheckTypestring_int(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'b': ok = (sizeof(int) == sizeof(char) && (int)-1 < 0); break; - case 'h': ok = (sizeof(int) == sizeof(short) && (int)-1 < 0); break; - case 'i': ok = (sizeof(int) == sizeof(int) && (int)-1 < 0); break; - case 'l': ok = (sizeof(int) == sizeof(long) && (int)-1 < 0); break; - case 'q': ok = (sizeof(int) == sizeof(long long) && (int)-1 < 0); break; - default: ok = 0; - } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected int, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; - } - ++ts; - return ts; - } - -static int __Pyx_GetBuffer_int(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); - goto fail; - } - if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_int(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(int)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -}static void __Pyx_RaiseBufferIndexError(int axis) { +static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -6645,7 +8666,7 @@ PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -6662,8 +8683,8 @@ empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -6679,6 +8700,7 @@ return result; } +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -6734,6 +8756,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6743,100 +8766,581 @@ return; } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d values to unpack", (int)index); - #else - "need more than %zd values to unpack", index); - #endif +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - return item; + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - return -1; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); } -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - __Pyx_ErrFetch(type, value, tb); - PyErr_NormalizeException(type, value, tb); - if (PyErr_Occurred()) - goto bad; - Py_INCREF(*type); - Py_INCREF(*value); - Py_INCREF(*tb); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - return 0; -bad: - Py_XDECREF(*type); - Py_XDECREF(*value); - Py_XDECREF(*tb); - return -1; +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; @@ -6856,32 +9360,31 @@ } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -6906,9 +9409,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -6950,7 +9459,6 @@ PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; - PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; @@ -6977,12 +9485,6 @@ if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; - #if PY_MAJOR_VERSION < 3 - empty_string = PyString_FromStringAndSize("", 0); - #else - empty_string = PyBytes_FromStringAndSize("", 0); - #endif - if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 @@ -6991,7 +9493,7 @@ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ - empty_string, /*PyObject *code,*/ + __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ @@ -7000,7 +9502,7 @@ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ - empty_string /*PyObject *lnotab*/ + __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( @@ -7015,7 +9517,6 @@ bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); - Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7023,7 +9524,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -7031,10 +9532,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -7048,221 +9553,92 @@ /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; } -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; } - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif } -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; } -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - +#endif /* Py_PYTHON_H */ Modified: trunk/scipy/stats/vonmises_cython.c =================================================================== --- trunk/scipy/stats/vonmises_cython.c 2010-06-16 15:21:49 UTC (rev 6510) +++ trunk/scipy/stats/vonmises_cython.c 2010-06-16 16:37:26 UTC (rev 6511) @@ -1,8 +1,12 @@ -/* Generated by Cython 0.10.3 on Tue Nov 17 16:14:26 2009 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:30:38 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -11,16 +15,22 @@ #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -30,22 +40,21 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 - #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -55,21 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -84,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -98,9 +122,30 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -108,56 +153,113 @@ #endif #include #define __PYX_HAVE_API__scipy__stats__vonmises_cython -#include "math.h" #include "stdlib.h" +#include "stdio.h" #include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif +#endif -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define INLINE +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif -static int __pyx_skip_dispatch = 0; +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif -/* Type Conversion Predeclarations */ +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) #endif +#endif -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -175,12 +277,151 @@ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ @@ -188,42 +429,124 @@ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static const char* __Pyx_DescribeTokenInFormatString(const char* ts); /*proto*/ -static const char* __Pyx_CheckTypestring_double(const char* ts); /*proto*/ -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); + } else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); } return r; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); @@ -239,201 +562,297 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -/* Type declarations */ +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -typedef npy_int8 __pyx_t_5numpy_int8_t; +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -typedef npy_int16 __pyx_t_5numpy_int16_t; +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -typedef npy_int32 __pyx_t_5numpy_int32_t; +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -typedef npy_int64 __pyx_t_5numpy_int64_t; +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -typedef npy_uint8 __pyx_t_5numpy_uint8_t; +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -typedef npy_uint16 __pyx_t_5numpy_uint16_t; +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -typedef npy_uint32 __pyx_t_5numpy_uint32_t; +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -typedef npy_uint64 __pyx_t_5numpy_uint64_t; +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -typedef npy_float32 __pyx_t_5numpy_float32_t; +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -typedef npy_float64 __pyx_t_5numpy_float64_t; +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -typedef npy_long __pyx_t_5numpy_int_t; +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -typedef npy_longlong __pyx_t_5numpy_long_t; +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ -typedef npy_ulong __pyx_t_5numpy_uint_t; +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -typedef npy_double __pyx_t_5numpy_float_t; +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ -typedef npy_double __pyx_t_5numpy_double_t; +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from python_buffer */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* Module declarations from python_ref */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* Module declarations from stdlib */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* Module declarations from stdio */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* Module declarations from python_buffer */ - -/* Module declarations from stdlib */ - /* Module declarations from numpy */ /* Module declarations from numpy */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from cython */ /* Module declarations from scipy.stats.vonmises_cython */ static double __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series(double, double, unsigned int); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), 'R' }; +#define __Pyx_MODULE_NAME "scipy.stats.vonmises_cython" +int __pyx_module_is_main_scipy__stats__vonmises_cython = 0; - /* Implementation of scipy.stats.vonmises_cython */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "von_mises_cdf_normalapprox"; +static char __pyx_k_2[] = "ndarray is not C contiguous"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_4[] = "Non-native byte order not supported"; +static char __pyx_k_5[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_6[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_7[] = "Format string allocated too short."; +static char __pyx_k_8[] = "scipy.stats"; +static char __pyx_k_9[] = "scipy.special"; +static char __pyx_k_10[] = "numpy.testing"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__k[] = "k"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__C1[] = "C1"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__i0[] = "i0"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__pi[] = "pi"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__cdf[] = "cdf"; +static char __pyx_k__exp[] = "exp"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__sin[] = "sin"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__norm[] = "norm"; +static char __pyx_k__sqrt[] = "sqrt"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__round[] = "round"; +static char __pyx_k__scipy[] = "scipy"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__stats[] = "stats"; +static char __pyx_k__astype[] = "astype"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__asarray[] = "asarray"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__atleast_1d[] = "atleast_1d"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__broadcast_arrays[] = "broadcast_arrays"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_n_s_10; +static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_n_s_8; +static PyObject *__pyx_n_s_9; +static PyObject *__pyx_n_s__C1; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__asarray; +static PyObject *__pyx_n_s__astype; +static PyObject *__pyx_n_s__atleast_1d; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__broadcast_arrays; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__cdf; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__exp; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__i0; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__norm; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__pi; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__round; +static PyObject *__pyx_n_s__scipy; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__sin; +static PyObject *__pyx_n_s__sqrt; +static PyObject *__pyx_n_s__stats; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_int_0; static PyObject *__pyx_int_2; -static PyObject *__pyx_int_24; static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; static PyObject *__pyx_int_16; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_0; -static char __pyx_k_k[] = "k"; -static PyObject *__pyx_kp_k; -static char __pyx_k_x[] = "x"; -static PyObject *__pyx_kp_x; -static char __pyx_k_23[] = "C1"; -static PyObject *__pyx_kp_23; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_24[] = "scipy.stats"; -static PyObject *__pyx_kp_24; -static char __pyx_k_scipy[] = "scipy"; -static PyObject *__pyx_kp_scipy; -static char __pyx_k_25[] = "scipy.special"; -static PyObject *__pyx_kp_25; -static char __pyx_k_i0[] = "i0"; -static PyObject *__pyx_kp_i0; -static char __pyx_k_26[] = "numpy.testing"; -static PyObject *__pyx_kp_26; -static char __pyx_k_pi[] = "pi"; -static PyObject *__pyx_kp_pi; -static char __pyx_k_sqrt[] = "sqrt"; -static PyObject *__pyx_kp_sqrt; -static char __pyx_k_exp[] = "exp"; -static PyObject *__pyx_kp_exp; -static char __pyx_k_sin[] = "sin"; -static PyObject *__pyx_kp_sin; -static char __pyx_k_stats[] = "stats"; -static PyObject *__pyx_kp_stats; -static char __pyx_k_norm[] = "norm"; -static PyObject *__pyx_kp_norm; -static char __pyx_k_cdf[] = "cdf"; -static PyObject *__pyx_kp_cdf; -static char __pyx_k_asarray[] = "asarray"; -static PyObject *__pyx_kp_asarray; -static char __pyx_k_ndim[] = "ndim"; -static PyObject *__pyx_kp_ndim; -static char __pyx_k_27[] = "atleast_1d"; -static PyObject *__pyx_kp_27; -static char __pyx_k_round[] = "round"; -static PyObject *__pyx_kp_round; -static char __pyx_k_broadcast_arrays[] = "broadcast_arrays"; -static PyObject *__pyx_kp_broadcast_arrays; -static char __pyx_k_empty[] = "empty"; -static PyObject *__pyx_kp_empty; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_float[] = "float"; -static PyObject *__pyx_kp_float; -static char __pyx_k_astype[] = "astype"; -static PyObject *__pyx_kp_astype; -static char __pyx_k_28[] = "von_mises_cdf_normalapprox"; -static PyObject *__pyx_kp_28; -static char __pyx_k___getbuffer__[] = "__getbuffer__"; -static PyObject *__pyx_kp___getbuffer__; -static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; -static PyObject *__pyx_kp___releasebuffer__; -static char __pyx_k_info[] = "info"; -static PyObject *__pyx_kp_info; -static char __pyx_k_flags[] = "flags"; -static PyObject *__pyx_kp_flags; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_iteritems[] = "iteritems"; -static PyObject *__pyx_kp_iteritems; -static char __pyx_k_next[] = "next"; -static PyObject *__pyx_kp_next; -static char __pyx_k_StopIteration[] = "StopIteration"; -static PyObject *__pyx_kp_StopIteration; -static char __pyx_k_pop[] = "pop"; -static PyObject *__pyx_kp_pop; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_RuntimeError; -static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_2; -static PyObject *__pyx_kp_20; -static PyObject *__pyx_kp_21; -static PyObject *__pyx_kp_22; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "b"; -static char __pyx_k_4[] = "B"; -static char __pyx_k_5[] = "h"; -static char __pyx_k_6[] = "H"; -static char __pyx_k_7[] = "i"; -static char __pyx_k_8[] = "I"; -static char __pyx_k_9[] = "l"; -static char __pyx_k_10[] = "L"; -static char __pyx_k_11[] = "q"; -static char __pyx_k_12[] = "Q"; -static char __pyx_k_13[] = "f"; -static char __pyx_k_14[] = "d"; -static char __pyx_k_15[] = "g"; -static char __pyx_k_16[] = "Zf"; -static char __pyx_k_17[] = "Zd"; -static char __pyx_k_18[] = "Zg"; -static char __pyx_k_19[] = "O"; -static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_21[] = "Format string allocated too short."; -static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)"; +static PyObject *__pyx_int_24; -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":12 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":12 * * * cdef double von_mises_cdf_series(double k,double x,unsigned int p): # <<<<<<<<<<<<<< @@ -450,17 +869,18 @@ double __pyx_v_V; unsigned int __pyx_v_n; double __pyx_r; - double __pyx_1; - double __pyx_2; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + double __pyx_t_5; + double __pyx_t_6; + unsigned long __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("von_mises_cdf_series"); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":15 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":15 * cdef double s, c, sn, cn, R, V * cdef unsigned int n * s = sin(x) # <<<<<<<<<<<<<< @@ -469,7 +889,7 @@ */ __pyx_v_s = sin(__pyx_v_x); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":16 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":16 * cdef unsigned int n * s = sin(x) * c = cos(x) # <<<<<<<<<<<<<< @@ -478,7 +898,7 @@ */ __pyx_v_c = cos(__pyx_v_x); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":17 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":17 * s = sin(x) * c = cos(x) * sn = sin(p*x) # <<<<<<<<<<<<<< @@ -487,7 +907,7 @@ */ __pyx_v_sn = sin((__pyx_v_p * __pyx_v_x)); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":18 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":18 * c = cos(x) * sn = sin(p*x) * cn = cos(p*x) # <<<<<<<<<<<<<< @@ -496,7 +916,7 @@ */ __pyx_v_cn = cos((__pyx_v_p * __pyx_v_x)); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":19 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":19 * sn = sin(p*x) * cn = cos(p*x) * R = 0 # <<<<<<<<<<<<<< @@ -505,7 +925,7 @@ */ __pyx_v_R = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":20 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":20 * cn = cos(p*x) * R = 0 * V = 0 # <<<<<<<<<<<<<< @@ -514,95 +934,163 @@ */ __pyx_v_V = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":21 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":21 * R = 0 * V = 0 * for n in range(p-1,0,-1): # <<<<<<<<<<<<<< * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) */ - for (__pyx_v_n = (__pyx_v_p - 1); __pyx_v_n > 0; __pyx_v_n-=1) { + __pyx_t_2 = PyLong_FromUnsignedLong((__pyx_v_p - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_4; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":22 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":22 * V = 0 * for n in range(p-1,0,-1): * sn, cn = sn*c - cn*s, cn*c + sn*s # <<<<<<<<<<<<<< * R = 1./(2*n/k + R) * V = R*(sn/n+V) */ - __pyx_1 = ((__pyx_v_sn * __pyx_v_c) - (__pyx_v_cn * __pyx_v_s)); - __pyx_2 = ((__pyx_v_cn * __pyx_v_c) + (__pyx_v_sn * __pyx_v_s)); - __pyx_v_sn = __pyx_1; - __pyx_v_cn = __pyx_2; + __pyx_t_5 = ((__pyx_v_sn * __pyx_v_c) - (__pyx_v_cn * __pyx_v_s)); + __pyx_t_6 = ((__pyx_v_cn * __pyx_v_c) + (__pyx_v_sn * __pyx_v_s)); + __pyx_v_sn = __pyx_t_5; + __pyx_v_cn = __pyx_t_6; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":23 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":23 * for n in range(p-1,0,-1): * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) # <<<<<<<<<<<<<< * V = R*(sn/n+V) * */ - __pyx_v_R = (1. / (((2 * __pyx_v_n) / __pyx_v_k) + __pyx_v_R)); + __pyx_t_7 = (2 * __pyx_v_n); + if (unlikely(__pyx_v_k == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = ((__pyx_t_7 / __pyx_v_k) + __pyx_v_R); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_R = (1.0 / __pyx_t_6); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":24 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":24 * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) * V = R*(sn/n+V) # <<<<<<<<<<<<<< * * return 0.5+x/(2*np.pi) + V/np.pi */ + if (unlikely(__pyx_v_n == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_V = (__pyx_v_R * ((__pyx_v_sn / __pyx_v_n) + __pyx_v_V)); } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":26 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":26 * V = R*(sn/n+V) * * return 0.5+x/(2*np.pi) + V/np.pi # <<<<<<<<<<<<<< * * def von_mises_cdf_normalapprox(k,x,C1): */ - __pyx_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_GetAttr(__pyx_5, __pyx_kp_pi); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_5 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyObject_GetAttr(__pyx_6, __pyx_kp_pi); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_5, __pyx_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_1 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_1; + __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__pi); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Multiply(__pyx_int_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("scipy.stats.vonmises_cython.von_mises_cdf_series"); __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":28 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":28 * return 0.5+x/(2*np.pi) + V/np.pi * * def von_mises_cdf_normalapprox(k,x,C1): # <<<<<<<<<<<<<< @@ -619,22 +1107,19 @@ PyObject *__pyx_v_z; PyObject *__pyx_v_C; PyObject *__pyx_v_chi; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_k,&__pyx_kp_x,&__pyx_kp_23,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__x,&__pyx_n_s__C1,0}; + __Pyx_RefNannySetupContext("von_mises_cdf_normalapprox"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -644,17 +1129,17 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf_normalapprox", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_23); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C1); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf_normalapprox", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -680,193 +1165,256 @@ __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf_normalapprox"); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_b = Py_None; Py_INCREF(Py_None); - __pyx_v_z = Py_None; Py_INCREF(Py_None); - __pyx_v_C = Py_None; Py_INCREF(Py_None); - __pyx_v_chi = Py_None; Py_INCREF(Py_None); + __pyx_v_b = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_z = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_chi = Py_None; __Pyx_INCREF(Py_None); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":29 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":29 * * def von_mises_cdf_normalapprox(k,x,C1): * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) # <<<<<<<<<<<<<< * z = b*np.sin(x/2.) * C = 24*k */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_sqrt); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_pi); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_int_2, __pyx_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_t_1); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_exp); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_k); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_i0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__i0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":30 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":30 * def von_mises_cdf_normalapprox(k,x,C1): * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) * z = b*np.sin(x/2.) # <<<<<<<<<<<<<< * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_sin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_2 = PyFloat_FromDouble(2.); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_v_b, __pyx_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_v_z); - __pyx_v_z = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_v_b, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_z); + __pyx_v_z = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":31 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":31 * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) * z = b*np.sin(x/2.) * C = 24*k # <<<<<<<<<<<<<< * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 * return scipy.stats.norm.cdf(z) */ - __pyx_t_2 = PyNumber_Multiply(__pyx_int_24, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_int_24, __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_C); + __pyx_v_C = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":32 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":32 * z = b*np.sin(x/2.) * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 # <<<<<<<<<<<<<< * return scipy.stats.norm.cdf(z) * */ - __pyx_t_2 = PyNumber_Power(__pyx_v_z, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_v_C, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = PyFloat_FromDouble(3.); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyNumber_Power(__pyx_v_z, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_v_C, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_4, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyFloat_FromDouble((7 / 4.)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyNumber_Multiply(__pyx_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_3 = PyFloat_FromDouble((167. / 2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_v_C, __pyx_v_C1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_int_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(__pyx_v_z, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_v_chi); - __pyx_v_chi = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyFloat_FromDouble((7 / 4.0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyFloat_FromDouble((167.0 / 2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_v_C, __pyx_v_C1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_v_z, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_chi); + __pyx_v_chi = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":33 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":33 * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 * return scipy.stats.norm.cdf(z) # <<<<<<<<<<<<<< * * cimport cython */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_scipy); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_kp_stats); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_norm); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_cdf); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_z); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_z); - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_r = __pyx_2; - __pyx_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__stats); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__cdf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_z); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_z); + __Pyx_GIVEREF(__pyx_v_z); + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf_normalapprox"); __pyx_r = NULL; __pyx_L0:; - Py_DECREF(__pyx_v_b); - Py_DECREF(__pyx_v_z); - Py_DECREF(__pyx_v_C); - Py_DECREF(__pyx_v_chi); + __Pyx_DECREF(__pyx_v_b); + __Pyx_DECREF(__pyx_v_z); + __Pyx_DECREF(__pyx_v_C); + __Pyx_DECREF(__pyx_v_chi); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":37 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":37 * cimport cython * @cython.boundscheck(False) * def von_mises_cdf(k,x): # <<<<<<<<<<<<<< @@ -904,38 +1452,40 @@ Py_buffer __pyx_bstruct_temp_ks; Py_ssize_t __pyx_bstride_0_temp_ks = 0; Py_ssize_t __pyx_bshape_0_temp_ks = 0; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - double __pyx_5; - double __pyx_6; - double __pyx_7; - double __pyx_8; - PyObject *__pyx_9 = 0; - PyObject *__pyx_10 = 0; - Py_ssize_t __pyx_11 = 0; - int __pyx_12; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - unsigned int __pyx_t_6; - unsigned int __pyx_t_7; - unsigned int __pyx_t_8; - unsigned int __pyx_t_9; - unsigned int __pyx_t_10; - unsigned int __pyx_t_11; - unsigned int __pyx_t_12; - unsigned int __pyx_t_13; - unsigned int __pyx_t_14; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_k,&__pyx_kp_x,0}; + double __pyx_t_5; + double __pyx_t_6; + double __pyx_t_7; + double __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + Py_ssize_t __pyx_t_16; + unsigned int __pyx_t_17; + unsigned int __pyx_t_18; + unsigned int __pyx_t_19; + unsigned int __pyx_t_20; + unsigned int __pyx_t_21; + unsigned int __pyx_t_22; + unsigned int __pyx_t_23; + unsigned int __pyx_t_24; + unsigned int __pyx_t_25; + unsigned int __pyx_t_26; + int __pyx_t_27; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__x,0}; + __Pyx_RefNannySetupContext("von_mises_cdf"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -944,11 +1494,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -972,150 +1522,188 @@ __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf"); return NULL; __pyx_L4_argument_unpacking_done:; - Py_INCREF(__pyx_v_k); - Py_INCREF(__pyx_v_x); - __pyx_v_temp = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_temp_xs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_temp_ks = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_zerodim = Py_None; Py_INCREF(Py_None); - __pyx_v_ix = Py_None; Py_INCREF(Py_None); - __pyx_v_bx = Py_None; Py_INCREF(Py_None); - __pyx_v_bk = Py_None; Py_INCREF(Py_None); - __pyx_v_result = Py_None; Py_INCREF(Py_None); - __pyx_v_c_small_k = Py_None; Py_INCREF(Py_None); + __Pyx_INCREF(__pyx_v_k); + __Pyx_INCREF(__pyx_v_x); + __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_temp_xs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_temp_ks = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_zerodim = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ix = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_bx = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_bk = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_c_small_k = Py_None; __Pyx_INCREF(Py_None); __pyx_bstruct_temp.buf = NULL; __pyx_bstruct_temp_xs.buf = NULL; __pyx_bstruct_temp_ks.buf = NULL; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":42 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":42 * cdef double a1, a2, a3, a4, C1, CK * #k,x = np.broadcast_arrays(np.asarray(k),np.asarray(x)) * k = np.asarray(k) # <<<<<<<<<<<<<< * x = np.asarray(x) * zerodim = k.ndim==0 and x.ndim==0 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":43 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":43 * #k,x = np.broadcast_arrays(np.asarray(k),np.asarray(x)) * k = np.asarray(k) * x = np.asarray(x) # <<<<<<<<<<<<<< * zerodim = k.ndim==0 and x.ndim==0 * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_asarray); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_2; - __pyx_2 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":44 * k = np.asarray(k) * x = np.asarray(x) * zerodim = k.ndim==0 and x.ndim==0 # <<<<<<<<<<<<<< * * k = np.atleast_1d(k) */ - __pyx_3 = PyObject_GetAttr(__pyx_v_k, __pyx_kp_ndim); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_3, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_4) { - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_v_x, __pyx_kp_ndim); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_k, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; } - Py_DECREF(__pyx_v_zerodim); - __pyx_v_zerodim = __pyx_1; - __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_zerodim); + __pyx_v_zerodim = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":46 * zerodim = k.ndim==0 and x.ndim==0 * * k = np.atleast_1d(k) # <<<<<<<<<<<<<< * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_27); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_3; - __pyx_3 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":47 * * k = np.atleast_1d(k) * x = np.atleast_1d(x) # <<<<<<<<<<<<<< * ix = np.round(x/(2*np.pi)) * x = x-ix*2*np.pi */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_27); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_2; - __pyx_2 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":48 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":48 * k = np.atleast_1d(k) * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) # <<<<<<<<<<<<<< * x = x-ix*2*np.pi * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_round); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_pi); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__round); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(__pyx_v_ix); - __pyx_v_ix = __pyx_1; - __pyx_1 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ix); + __pyx_v_ix = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":49 * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) * x = x-ix*2*np.pi # <<<<<<<<<<<<<< @@ -1123,19 +1711,24 @@ * # These values should give 12 decimal digits */ __pyx_t_2 = PyNumber_Multiply(__pyx_v_ix, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_pi); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":52 * * # These values should give 12 decimal digits * CK=50 # <<<<<<<<<<<<<< @@ -1144,314 +1737,358 @@ */ __pyx_v_CK = 50; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":53 * # These values should give 12 decimal digits * CK=50 * a1, a2, a3, a4 = [28., 0.5, 100., 5.0] # <<<<<<<<<<<<<< * C1 = 50.1 * */ - __pyx_5 = 28.; - __pyx_6 = 0.5; - __pyx_7 = 100.; - __pyx_8 = 5.0; - __pyx_v_a1 = __pyx_5; - __pyx_v_a2 = __pyx_6; - __pyx_v_a3 = __pyx_7; - __pyx_v_a4 = __pyx_8; + __pyx_t_5 = 28.0; + __pyx_t_6 = 0.5; + __pyx_t_7 = 100.0; + __pyx_t_8 = 5.0; + __pyx_v_a1 = __pyx_t_5; + __pyx_v_a2 = __pyx_t_6; + __pyx_v_a3 = __pyx_t_7; + __pyx_v_a4 = __pyx_t_8; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":54 * CK=50 * a1, a2, a3, a4 = [28., 0.5, 100., 5.0] * C1 = 50.1 # <<<<<<<<<<<<<< * * bx, bk = np.broadcast_arrays(x,k) */ - __pyx_v_C1 = 50.1; + __pyx_v_C1 = 50.100000000000001; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":56 * C1 = 50.1 * * bx, bk = np.broadcast_arrays(x,k) # <<<<<<<<<<<<<< * result = np.empty(bx.shape,dtype=np.float) * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_broadcast_arrays); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x); - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_k); - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (PyTuple_CheckExact(__pyx_1) && PyTuple_GET_SIZE(__pyx_1) == 2) { - PyObject* tuple = __pyx_1; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_bx); - __pyx_v_bx = __pyx_2; - __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_bk); - __pyx_v_bk = __pyx_2; - __pyx_2 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__broadcast_arrays); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_bx); + __pyx_v_bx = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_bk); + __pyx_v_bk = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_bx); + __pyx_v_bx = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_bk); + __pyx_v_bk = __pyx_t_3; + __pyx_t_3 = 0; } - else { - __pyx_3 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_3, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_bx); - __pyx_v_bx = __pyx_2; - __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_3, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_bk); - __pyx_v_bk = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":57 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":57 * * bx, bk = np.broadcast_arrays(x,k) * result = np.empty(bx.shape,dtype=np.float) # <<<<<<<<<<<<<< * * c_small_k = bk(1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) */ - __pyx_10 = PyObject_GetItem(__pyx_v_bk, __pyx_v_c_small_k); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_10, __pyx_kp_astype); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_10); __pyx_10 = 0; - __pyx_9 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_9, __pyx_kp_float); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_9); __pyx_9 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - __pyx_2 = 0; - __pyx_10 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_10, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyArrayObject *)__pyx_10); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); - __pyx_t_4 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_3, &__pyx_bstruct_temp_ks, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_4 < 0)) + __pyx_t_1 = PyObject_GetItem(__pyx_v_bk, __pyx_v_c_small_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_temp_ks, &__pyx_bstruct_temp_ks, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_1, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); + __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_temp_ks, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_12 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp_ks, (PyObject*)__pyx_v_temp_ks, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15); } + } + __pyx_bstride_0_temp_ks = __pyx_bstruct_temp_ks.strides[0]; + __pyx_bshape_0_temp_ks = __pyx_bstruct_temp_ks.shape[0]; + if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_temp_ks = __pyx_bstruct_temp_ks.strides[0]; - __pyx_bshape_0_temp_ks = __pyx_bstruct_temp_ks.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_temp_ks)); - __pyx_v_temp_ks = ((PyArrayObject *)__pyx_10); - __pyx_10 = 0; + __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_temp_ks)); + __pyx_v_temp_ks = ((PyArrayObject *)__pyx_t_10); + __pyx_t_10 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":63 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":63 * temp_xs = bx[c_small_k].astype(np.float) * temp_ks = bk[c_small_k].astype(np.float) * for i in range(len(temp)): # <<<<<<<<<<<<<< * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) */ - __pyx_11 = PyObject_Length(((PyObject *)__pyx_v_temp)); if (unlikely(__pyx_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_i = 0; __pyx_v_i < __pyx_11; __pyx_v_i+=1) { + __pyx_t_16 = PyObject_Length(((PyObject *)__pyx_v_temp)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":64 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":64 * temp_ks = bk[c_small_k].astype(np.float) * for i in range(len(temp)): * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) # <<<<<<<<<<<<<< * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_i; - __pyx_v_p = ((int)(((1 + __pyx_v_a1) + (__pyx_v_a2 * (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_6, __pyx_bstride_0_temp_ks)))) - (__pyx_v_a3 / ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_7, __pyx_bstride_0_temp_ks)) + __pyx_v_a4)))); + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_i; + __pyx_t_8 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_19, __pyx_bstride_0_temp_ks)) + __pyx_v_a4); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_p = ((int)(((1 + __pyx_v_a1) + (__pyx_v_a2 * (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_18, __pyx_bstride_0_temp_ks)))) - (__pyx_v_a3 / __pyx_t_8))); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":65 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":65 * for i in range(len(temp)): * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) # <<<<<<<<<<<<<< * if temp[i]<0: * temp[i]=0 */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_10, __pyx_bstride_0_temp) = __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_8, __pyx_bstride_0_temp_ks)), (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_xs.buf, __pyx_t_9, __pyx_bstride_0_temp_xs)), __pyx_v_p); + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_22, __pyx_bstride_0_temp) = __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_20, __pyx_bstride_0_temp_ks)), (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_xs.buf, __pyx_t_21, __pyx_bstride_0_temp_xs)), __pyx_v_p); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":66 * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: # <<<<<<<<<<<<<< * temp[i]=0 * elif temp[i]>1: */ - __pyx_t_11 = __pyx_v_i; - __pyx_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_11, __pyx_bstride_0_temp)) < 0); - if (__pyx_4) { + __pyx_t_23 = __pyx_v_i; + __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_23, __pyx_bstride_0_temp)) < 0); + if (__pyx_t_4) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":67 * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: * temp[i]=0 # <<<<<<<<<<<<<< * elif temp[i]>1: * temp[i]=1 */ - __pyx_t_12 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_12, __pyx_bstride_0_temp) = 0; + __pyx_t_24 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_24, __pyx_bstride_0_temp) = 0; goto __pyx_L8; } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":68 * if temp[i]<0: * temp[i]=0 * elif temp[i]>1: # <<<<<<<<<<<<<< * temp[i]=1 * result[c_small_k] = temp */ - __pyx_t_13 = __pyx_v_i; - __pyx_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_13, __pyx_bstride_0_temp)) > 1); - if (__pyx_4) { + __pyx_t_25 = __pyx_v_i; + __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_25, __pyx_bstride_0_temp)) > 1); + if (__pyx_t_4) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":69 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":69 * temp[i]=0 * elif temp[i]>1: * temp[i]=1 # <<<<<<<<<<<<<< * result[c_small_k] = temp * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) */ - __pyx_t_14 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_14, __pyx_bstride_0_temp) = 1; + __pyx_t_26 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_26, __pyx_bstride_0_temp) = 1; goto __pyx_L8; } __pyx_L8:; } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":70 * elif temp[i]>1: * temp[i]=1 * result[c_small_k] = temp # <<<<<<<<<<<<<< @@ -1460,84 +2097,101 @@ */ if (PyObject_SetItem(__pyx_v_result, __pyx_v_c_small_k, ((PyObject *)__pyx_v_temp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":71 * temp[i]=1 * result[c_small_k] = temp * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) # <<<<<<<<<<<<<< * * if not zerodim: */ - __pyx_9 = __Pyx_GetName(__pyx_m, __pyx_kp_28); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetItem(__pyx_v_bk, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_10 = PyObject_GetItem(__pyx_v_bx, __pyx_3); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyFloat_FromDouble(__pyx_v_C1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_10); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_2); - __pyx_1 = 0; - __pyx_10 = 0; - __pyx_2 = 0; - __pyx_1 = PyObject_Call(__pyx_9, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_9); __pyx_9 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_10 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetItem(__pyx_v_result, __pyx_10, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_10); __pyx_10 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_v_bk, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetItem(__pyx_v_bx, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_C1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyObject_SetItem(__pyx_v_result, __pyx_t_9, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":73 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":73 * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) * * if not zerodim: # <<<<<<<<<<<<<< * return result+ix * else: */ - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_zerodim); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_12 = (!__pyx_4); - if (__pyx_12) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_zerodim); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = (!__pyx_t_4); + if (__pyx_t_27) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":74 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":74 * * if not zerodim: * return result+ix # <<<<<<<<<<<<<< * else: * return (result+ix)[0] */ - __pyx_t_5 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L9; } /*else*/ { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":76 * return result+ix * else: * return (result+ix)[0] # <<<<<<<<<<<<<< */ - __pyx_t_5 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(__pyx_t_5, 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_2; - __pyx_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; goto __pyx_L0; } __pyx_L9:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_9); - Py_XDECREF(__pyx_10); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); @@ -1552,21 +2206,23 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_xs); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); __pyx_L2:; - Py_DECREF(__pyx_v_temp); - Py_DECREF(__pyx_v_temp_xs); - Py_DECREF(__pyx_v_temp_ks); - Py_DECREF(__pyx_v_zerodim); - Py_DECREF(__pyx_v_ix); - Py_DECREF(__pyx_v_bx); - Py_DECREF(__pyx_v_bk); - Py_DECREF(__pyx_v_result); - Py_DECREF(__pyx_v_c_small_k); - Py_DECREF(__pyx_v_k); - Py_DECREF(__pyx_v_x); + __Pyx_DECREF((PyObject *)__pyx_v_temp); + __Pyx_DECREF((PyObject *)__pyx_v_temp_xs); + __Pyx_DECREF((PyObject *)__pyx_v_temp_ks); + __Pyx_DECREF(__pyx_v_zerodim); + __Pyx_DECREF(__pyx_v_ix); + __Pyx_DECREF(__pyx_v_bx); + __Pyx_DECREF(__pyx_v_bk); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_c_small_k); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":50 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1579,47 +2235,67 @@ int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; - PyObject *__pyx_v_stack; + int __pyx_v_offset; int __pyx_v_hasfields; - PyObject *__pyx_v_iterator; int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_7 = 0; - Py_ssize_t __pyx_8 = 0; - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; Py_INCREF(Py_None); - __pyx_v_stack = ((PyObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_iterator = Py_None; Py_INCREF(Py_None); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":56 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":58 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ - __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_1) { + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":59 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1631,7 +2307,7 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":61 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1642,88 +2318,100 @@ } __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":63 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":64 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":65 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":67 - * raise ValueError("ndarray is not C contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":68 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":69 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":71 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -1731,7 +2419,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":72 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1740,17 +2428,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":73 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_4 = __pyx_v_copy_shape; - if (__pyx_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":76 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1759,7 +2447,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":77 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1768,16 +2456,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":78 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i+=1) { + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":79 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1786,7 +2476,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":80 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1799,7 +2489,7 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":82 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1808,7 +2498,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":83 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1819,7 +2509,7 @@ } __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":84 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1828,7 +2518,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":85 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1837,7 +2527,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":86 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1846,7 +2536,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":89 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1855,309 +2545,411 @@ */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":90 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack - * + * cdef int offset */ - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":93 - * cdef list stack + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * - * # Ugly hack warning: + * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":103 - * # functions). + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { - __pyx_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; } - if (__pyx_1) { + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":105 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ - Py_INCREF(Py_None); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":108 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - Py_INCREF(__pyx_v_self); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L11:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":110 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if t == NPY_BYTE: f = "b" + * if ((descr.byteorder == '>' and little_endian) or */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":111 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":112 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = __pyx_k_3; - break; - case NPY_UBYTE: + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":113 - * t = descr.type_num + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_v_f = __pyx_k_4; - break; - case NPY_SHORT: + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":114 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_v_f = __pyx_k_5; - break; - case NPY_USHORT: + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":115 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_v_f = __pyx_k_6; - break; - case NPY_INT: + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":116 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_v_f = __pyx_k_7; - break; - case NPY_UINT: + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":117 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_v_f = __pyx_k_8; - break; - case NPY_LONG: + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":118 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_v_f = __pyx_k_9; - break; - case NPY_ULONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":119 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_v_f = __pyx_k_10; - break; - case NPY_LONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":120 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_v_f = __pyx_k_11; - break; - case NPY_ULONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":121 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_v_f = __pyx_k_12; - break; - case NPY_FLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":122 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_v_f = __pyx_k_13; - break; - case NPY_DOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":123 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_v_f = __pyx_k_14; - break; - case NPY_LONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":124 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_v_f = __pyx_k_15; - break; - case NPY_CFLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":125 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_v_f = __pyx_k_16; - break; - case NPY_CDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":126 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_v_f = __pyx_k_17; - break; - case NPY_CLONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":127 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_v_f = __pyx_k_18; - break; - case NPY_OBJECT: + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":128 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_v_f = __pyx_k_19; - break; - default: + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":130 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_20, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_5), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_L14:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":131 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":132 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: - * info.format = stdlib.malloc(255) # static size + * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; @@ -2165,652 +2957,1206 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":134 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: - * info.format = stdlib.malloc(255) # static size # <<<<<<<<<<<<<< - * f = info.format - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":135 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: - * info.format = stdlib.malloc(255) # static size - * f = info.format # <<<<<<<<<<<<<< - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string * */ - __pyx_v_f = __pyx_v_info->format; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":136 - * info.format = stdlib.malloc(255) # static size - * f = info.format - * stack = [iter(descr.fields.iteritems())] # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * - * while True: + * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_3 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyList_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_stack)); - __pyx_v_stack = __pyx_2; - __pyx_2 = 0; + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":138 - * stack = [iter(descr.fields.iteritems())] + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 + * f[0] = 0 # Terminate format string * - * while True: # <<<<<<<<<<<<<< - * iterator = stack[-1] - * descr = None + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) */ - while (1) { - __pyx_1 = 1; - if (!__pyx_1) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":139 +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * - * while True: - * iterator = stack[-1] # <<<<<<<<<<<<<< - * descr = None - * while descr is None: + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":140 - * while True: - * iterator = stack[-1] - * descr = None # <<<<<<<<<<<<<< - * while descr is None: - * try: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) */ - Py_INCREF(Py_None); - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)Py_None); + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":141 - * iterator = stack[-1] - * descr = None - * while descr is None: # <<<<<<<<<<<<<< - * try: - * descr = iterator.next()[1][0] + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block */ - while (1) { - __pyx_1 = (((PyObject *)__pyx_v_descr) == Py_None); - if (!__pyx_1) break; + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":142 - * descr = None - * while descr is None: - * try: # <<<<<<<<<<<<<< - * descr = iterator.next()[1][0] - * except StopIteration: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - /*try:*/ { + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":143 - * while descr is None: - * try: - * descr = iterator.next()[1][0] # <<<<<<<<<<<<<< - * except StopIteration: - * stack.pop() + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ - __pyx_2 = PyObject_GetAttr(__pyx_v_iterator, __pyx_kp_next); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetItemInt(__pyx_3, 1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)__pyx_3); - __pyx_3 = 0; - } - Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L22_try; - __pyx_L17_error:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":144 - * try: - * descr = iterator.next()[1][0] - * except StopIteration: # <<<<<<<<<<<<<< - * stack.pop() - * if len(stack) > 0: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_4 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_4) { - __Pyx_AddTraceback("numpy.__getbuffer__"); - if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":145 - * descr = iterator.next()[1][0] - * except StopIteration: - * stack.pop() # <<<<<<<<<<<<<< - * if len(stack) > 0: - * f[0] = 125 #"}" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * */ - __pyx_6 = PyObject_GetAttr(((PyObject *)__pyx_v_stack), __pyx_kp_pop); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_7 = PyObject_Call(__pyx_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":146 - * except StopIteration: - * stack.pop() - * if len(stack) > 0: # <<<<<<<<<<<<<< - * f[0] = 125 #"}" - * f += 1 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_8 = PyObject_Length(((PyObject *)__pyx_v_stack)); if (unlikely(__pyx_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_1 = (__pyx_8 > 0); - if (__pyx_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":147 - * stack.pop() - * if len(stack) > 0: - * f[0] = 125 #"}" # <<<<<<<<<<<<<< - * f += 1 - * iterator = stack[-1] + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * */ - (__pyx_v_f[0]) = 125; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":148 - * if len(stack) > 0: - * f[0] = 125 #"}" - * f += 1 # <<<<<<<<<<<<<< - * iterator = stack[-1] - * else: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_v_f += 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":149 - * f[0] = 125 #"}" - * f += 1 - * iterator = stack[-1] # <<<<<<<<<<<<<< - * else: - * f[0] = 0 # Terminate string! + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ - __pyx_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_6; - __pyx_6 = 0; - goto __pyx_L23; - } - /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":151 - * iterator = stack[-1] - * else: - * f[0] = 0 # Terminate string! # <<<<<<<<<<<<<< - * return +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - (__pyx_v_f[0]) = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":152 - * else: - * f[0] = 0 # Terminate string! - * return # <<<<<<<<<<<<<< + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * hasfields = PyDataType_HASFIELDS(descr) + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_r = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L20_except_return; - } - __pyx_L23:; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L18_exception_handled; - } - __pyx_L19_except_error:; - Py_XDECREF(__pyx_save_exc_type); - Py_XDECREF(__pyx_save_exc_value); - Py_XDECREF(__pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L20_except_return:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L0; - __pyx_L18_exception_handled:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L22_try:; - } + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":154 - * return + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * - * hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * if not hasfields: - * t = descr.type_num + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":155 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 * - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_v_f += 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":156 - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize */ - __pyx_v_t = __pyx_v_descr->type_num; + (__pyx_v_offset[0]) += 1; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":157 - * if not hasfields: - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + * offset[0] += 1 * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): */ - __pyx_1 = ((__pyx_v_f - __pyx_v_info->format) > 240); - if (__pyx_1) { + (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":158 - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + * offset[0] += child.itemsize * - * # Until ticket #99 is fixed, use integers to avoid warnings + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: */ - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_21); - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_kp_21); - __pyx_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __Pyx_Raise(__pyx_6, 0, 0); - Py_DECREF(__pyx_6); __pyx_6 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L25; - } - __pyx_L25:; + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":161 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") */ - switch (__pyx_v_t) { - case NPY_BYTE: - (__pyx_v_f[0]) = 98; - break; - case NPY_UBYTE: + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":162 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * */ - (__pyx_v_f[0]) = 66; - break; - case NPY_SHORT: + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":163 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings */ - (__pyx_v_f[0]) = 104; - break; - case NPY_USHORT: + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":164 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" */ - (__pyx_v_f[0]) = 72; - break; - case NPY_INT: + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":165 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" */ - (__pyx_v_f[0]) = 105; - break; - case NPY_UINT: + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":166 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" */ - (__pyx_v_f[0]) = 73; - break; - case NPY_LONG: + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":167 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" */ - (__pyx_v_f[0]) = 108; - break; - case NPY_ULONG: + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":168 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" */ - (__pyx_v_f[0]) = 76; - break; - case NPY_LONGLONG: + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":169 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" */ - (__pyx_v_f[0]) = 113; - break; - case NPY_ULONGLONG: + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":170 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - (__pyx_v_f[0]) = 81; - break; - case NPY_FLOAT: + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":171 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - (__pyx_v_f[0]) = 102; - break; - case NPY_DOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":172 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - (__pyx_v_f[0]) = 100; - break; - case NPY_LONGDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":173 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - (__pyx_v_f[0]) = 103; - break; - case NPY_CFLOAT: + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":174 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - break; - case NPY_CDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":175 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - break; - case NPY_CLONGDOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":176 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - break; - case NPY_OBJECT: + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":177 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - (__pyx_v_f[0]) = 79; - break; - default: + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":179 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_22, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":180 - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * f[0] = 84 #"T" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; __pyx_v_f += 1; - goto __pyx_L24; + goto __pyx_L11; } - /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":182 - * f += 1 - * else: - * f[0] = 84 #"T" # <<<<<<<<<<<<<< - * f[1] = 123 #"{" - * f += 2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - (__pyx_v_f[0]) = 84; + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":183 - * else: - * f[0] = 84 #"T" - * f[1] = 123 #"{" # <<<<<<<<<<<<<< - * f += 2 - * stack.append(iter(descr.fields.iteritems())) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: */ - (__pyx_v_f[1]) = 123; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_5), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":184 - * f[0] = 84 #"T" - * f[1] = 123 #"{" - * f += 2 # <<<<<<<<<<<<<< - * stack.append(iter(descr.fields.iteritems())) - * + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 2; + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":185 - * f[1] = 123 #"{" - * f += 2 - * stack.append(iter(descr.fields.iteritems())) # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f * - * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_7 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyObject_GetIter(__pyx_6); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyList_Append(((PyObject *)__pyx_v_stack), __pyx_2); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - __pyx_L24:; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } + __pyx_L9:; } - __pyx_L12:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); - Py_XDECREF(__pyx_7); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - Py_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { Py_DECREF(Py_None); __pyx_v_info->obj = NULL; } - __pyx_L2:; - Py_XDECREF(__pyx_v_descr); - Py_DECREF(__pyx_v_stack); - Py_DECREF(__pyx_v_iterator); + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 - * stack.append(iter(descr.fields.iteritems())) +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_1; - int __pyx_2; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":188 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: */ - __pyx_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":189 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! */ - free(__pyx_v_info->format); - goto __pyx_L5; + __pyx_v_baseptr = NULL; + goto __pyx_L3; } - __pyx_L5:; + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":190 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) */ - __pyx_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_2) { + Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":191 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr * */ - free(__pyx_v_info->strides); - goto __pyx_L6; + Py_XDECREF(__pyx_v_arr->base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; } - __pyx_L6:; + /*else*/ { + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } static struct PyMethodDef __pyx_methods[] = { - {"von_mises_cdf_normalapprox", (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf_normalapprox, METH_VARARGS|METH_KEYWORDS, 0}, - {"von_mises_cdf", (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf, METH_VARARGS|METH_KEYWORDS, 0}, + {__Pyx_NAMESTR("von_mises_cdf_normalapprox"), (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf_normalapprox, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("von_mises_cdf"), (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -2819,7 +4165,7 @@ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "vonmises_cython", + __Pyx_NAMESTR("vonmises_cython"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -2831,68 +4177,79 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, - {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_24, __pyx_k_24, sizeof(__pyx_k_24), 1, 1, 1}, - {&__pyx_kp_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 1, 1}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 1, 1, 1}, - {&__pyx_kp_i0, __pyx_k_i0, sizeof(__pyx_k_i0), 1, 1, 1}, - {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 1, 1, 1}, - {&__pyx_kp_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 1, 1, 1}, - {&__pyx_kp_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 1, 1, 1}, - {&__pyx_kp_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 1, 1, 1}, - {&__pyx_kp_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 1, 1, 1}, - {&__pyx_kp_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 1, 1, 1}, - {&__pyx_kp_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 1, 1, 1}, - {&__pyx_kp_cdf, __pyx_k_cdf, sizeof(__pyx_k_cdf), 1, 1, 1}, - {&__pyx_kp_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 1, 1, 1}, - {&__pyx_kp_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 1, 1, 1}, - {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 1, 1, 1}, - {&__pyx_kp_round, __pyx_k_round, sizeof(__pyx_k_round), 1, 1, 1}, - {&__pyx_kp_broadcast_arrays, __pyx_k_broadcast_arrays, sizeof(__pyx_k_broadcast_arrays), 1, 1, 1}, - {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_float, __pyx_k_float, sizeof(__pyx_k_float), 1, 1, 1}, - {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 1, 1, 1}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, - {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, - {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, - {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0}, - {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0}, - {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1}, + {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1}, + {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1}, + {&__pyx_n_s__C1, __pyx_k__C1, sizeof(__pyx_k__C1), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, + {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__atleast_1d, __pyx_k__atleast_1d, sizeof(__pyx_k__atleast_1d), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__broadcast_arrays, __pyx_k__broadcast_arrays, sizeof(__pyx_k__broadcast_arrays), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__cdf, __pyx_k__cdf, sizeof(__pyx_k__cdf), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__exp, __pyx_k__exp, sizeof(__pyx_k__exp), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__i0, __pyx_k__i0, sizeof(__pyx_k__i0), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__norm, __pyx_k__norm, sizeof(__pyx_k__norm), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, + {&__pyx_n_s__scipy, __pyx_k__scipy, sizeof(__pyx_k__scipy), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__sin, __pyx_k__sin, sizeof(__pyx_k__sin), 0, 0, 1, 1}, + {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, + {&__pyx_n_s__stats, __pyx_k__stats, sizeof(__pyx_k__stats), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -2906,16 +4263,36 @@ PyMODINIT_FUNC PyInit_vonmises_cython(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_vonmises_cython(void)", __LINE__, __FILE__); + #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ - __pyx_init_filenames(); - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("vonmises_cython", __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("vonmises_cython"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -2923,86 +4300,115 @@ #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_scipy__stats__vonmises_cython) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":1 * import numpy as np # <<<<<<<<<<<<<< * import scipy.stats * from scipy.special import i0 */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":2 * import numpy as np * import scipy.stats # <<<<<<<<<<<<<< * from scipy.special import i0 * import numpy.testing */ - __pyx_1 = __Pyx_Import(__pyx_kp_24, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_scipy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_8), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scipy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":3 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":3 * import numpy as np * import scipy.stats * from scipy.special import i0 # <<<<<<<<<<<<<< * import numpy.testing * cimport numpy as np */ - __pyx_1 = PyList_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_i0); - PyList_SET_ITEM(__pyx_1, 0, __pyx_kp_i0); - __pyx_2 = __Pyx_Import(__pyx_kp_25, ((PyObject *)__pyx_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_i0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_i0, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i0)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__i0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__i0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__i0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":4 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":4 * import scipy.stats * from scipy.special import i0 * import numpy.testing # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_2 = __Pyx_Import(__pyx_kp_26, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_numpy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_10), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/stdlib.pxd":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":1 + * import numpy as np # <<<<<<<<<<<<<< + * import scipy.stats + * from scipy.special import i0 + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * - * cdef extern from "stdlib.h": # <<<<<<<<<<<<<< - * ctypedef unsigned long size_t + * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) + * void *malloc(size_t size) */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init scipy.stats.vonmises_cython"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scipy.stats.vonmises_cython"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - __Pyx_AddTraceback("scipy.stats.vonmises_cython"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -3073,18 +4479,17 @@ PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; } else { - name = argnames; - while (*name && (**name != key)) name++; - if (*name) { - if (name < first_kw_arg) goto arg_passed_twice; - values[name-argnames] = value; + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 @@ -3092,8 +4497,7 @@ PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) break; + _PyString_Eq(**name, key)) break; #endif } if (*name) { @@ -3107,8 +4511,7 @@ PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) goto arg_passed_twice; + _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { @@ -3141,95 +4544,461 @@ return -1; } -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); } -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { - while (1) { - switch (*ts) { - case '@': - case 10: - case 13: - case ' ': - ++ts; - break; - case '=': - case '<': - case '>': - case '!': - PyErr_SetString(PyExc_ValueError, "Buffer acquisition error: Only native byte order, size and alignment supported."); - return NULL; - default: - return ts; +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; } } -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - expected_ndim, buffer->ndim); +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; } -static const char* __Pyx_DescribeTokenInFormatString(const char* ts) { - switch (*ts) { - case 'b': return "char"; - case 'B': return "unsigned char"; - case 'h': return "short"; - case 'H': return "unsigned short"; - case 'i': return "int"; - case 'I': return "unsigned int"; - case 'l': return "long"; - case 'L': return "unsigned long"; - case 'q': return "long long"; - case 'Q': return "unsigned long long"; - case 'f': return "float"; - case 'd': return "double"; - case 'g': return "long double"; - case 'Z': switch (*(ts+1)) { - case 'f': return "complex float"; - case 'd': return "complex double"; - case 'g': return "complex long double"; - default: return "unparseable format string"; - } +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 0: return "end"; default: return "unparseable format string"; } } -static const char* __Pyx_CheckTypestring_double(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(double) == sizeof(float) && (double)-1 < 0); break; - case 'd': ok = (sizeof(double) == sizeof(double) && (double)-1 < 0); break; - case 'g': ok = (sizeof(double) == sizeof(long double) && (double)-1 < 0); break; - default: ok = 0; +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected double, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - ++ts; - return ts; +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; + } + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; + } + return 0; +} + +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + + } + } +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None) { __Pyx_ZeroBuffer(buf); return 0; @@ -3237,36 +5006,37 @@ buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); goto fail; } if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_double(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(double)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + static void __Pyx_RaiseBufferFallbackError(void) { PyErr_Format(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); @@ -3274,7 +5044,7 @@ -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -3289,7 +5059,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -3301,6 +5071,20 @@ } +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -3332,7 +5116,7 @@ PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -3349,8 +5133,8 @@ empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -3366,70 +5150,157 @@ return result; } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d values to unpack", (int)index); - #else - "need more than %zd values to unpack", index); - #endif - } +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } - return item; -} + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - return -1; +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3485,6 +5356,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3494,36 +5366,431 @@ return; } -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - __Pyx_ErrFetch(type, value, tb); - PyErr_NormalizeException(type, value, tb); - if (PyErr_Occurred()) +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); goto bad; - Py_INCREF(*type); - Py_INCREF(*value); - Py_INCREF(*tb); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - return 0; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + bad: - Py_XDECREF(*type); - Py_XDECREF(*value); - Py_XDECREF(*tb); - return -1; + return; } +#endif +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; @@ -3545,11 +5812,12 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -3574,9 +5842,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -3618,7 +5892,6 @@ PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; - PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; @@ -3645,12 +5918,6 @@ if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; - #if PY_MAJOR_VERSION < 3 - empty_string = PyString_FromStringAndSize("", 0); - #else - empty_string = PyBytes_FromStringAndSize("", 0); - #endif - if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 @@ -3659,7 +5926,7 @@ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ - empty_string, /*PyObject *code,*/ + __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ @@ -3668,7 +5935,7 @@ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ - empty_string /*PyObject *lnotab*/ + __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( @@ -3683,7 +5950,6 @@ bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); - Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -3691,7 +5957,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -3699,10 +5965,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -3716,221 +5986,92 @@ /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; } -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; } - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif } -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; } -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - +#endif /* Py_PYTHON_H */ From scipy-svn at scipy.org Wed Jun 16 12:43:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 16 Jun 2010 11:43:41 -0500 (CDT) Subject: [Scipy-svn] r6512 - in branches/0.8.x/scipy: io/matlab spatial stats Message-ID: <20100616164341.C46CA39CAE7@scipy.org> Author: matthew.brett at gmail.com Date: 2010-06-16 11:43:41 -0500 (Wed, 16 Jun 2010) New Revision: 6512 Modified: branches/0.8.x/scipy/io/matlab/mio_utils.c branches/0.8.x/scipy/io/matlab/streams.c branches/0.8.x/scipy/spatial/ckdtree.c branches/0.8.x/scipy/stats/vonmises_cython.c Log: MISC - updated old Cython generated C files with Cython 0.12.1 Modified: branches/0.8.x/scipy/io/matlab/mio_utils.c =================================================================== --- branches/0.8.x/scipy/io/matlab/mio_utils.c 2010-06-16 16:37:26 UTC (rev 6511) +++ branches/0.8.x/scipy/io/matlab/mio_utils.c 2010-06-16 16:43:41 UTC (rev 6512) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.12.1 on Thu May 27 17:30:06 2010 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:42:35 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -783,7 +783,7 @@ static PyObject *__pyx_n_s__view; static PyObject *__pyx_int_15; -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -803,7 +803,7 @@ __Pyx_RefNannySetupContext("cproduct"); __Pyx_INCREF(__pyx_v_tup); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":10 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":10 * * cpdef size_t cproduct(tup): * cdef size_t res = 1 # <<<<<<<<<<<<<< @@ -812,7 +812,7 @@ */ __pyx_v_res = 1; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":12 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":12 * cdef size_t res = 1 * cdef int i * for i in range(len(tup)): # <<<<<<<<<<<<<< @@ -823,7 +823,7 @@ for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { __pyx_v_i = __pyx_t_2; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":13 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":13 * cdef int i * for i in range(len(tup)): * res *= tup[i] # <<<<<<<<<<<<<< @@ -837,7 +837,7 @@ __pyx_v_res *= __pyx_t_4; } - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":14 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":14 * for i in range(len(tup)): * res *= tup[i] * return res # <<<<<<<<<<<<<< @@ -859,7 +859,7 @@ return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":9 * * * cpdef size_t cproduct(tup): # <<<<<<<<<<<<<< @@ -892,7 +892,7 @@ return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -912,7 +912,7 @@ __Pyx_RefNannySetupContext("squeeze_element"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":22 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":22 * The returned object may not be an ndarray - for example if we do * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: # <<<<<<<<<<<<<< @@ -926,7 +926,7 @@ __pyx_t_3 = (!__pyx_t_2); if (__pyx_t_3) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":23 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":23 * ``arr.item`` to return a ``mat_struct`` object from a struct array ''' * if not arr.size: * return np.array([]) # <<<<<<<<<<<<<< @@ -957,7 +957,7 @@ } __pyx_L3:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":24 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":24 * if not arr.size: * return np.array([]) * arr = np.squeeze(arr) # <<<<<<<<<<<<<< @@ -983,7 +983,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_4); __pyx_t_4 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":25 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":25 * return np.array([]) * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar # <<<<<<<<<<<<<< @@ -1005,7 +1005,7 @@ } if (__pyx_t_6) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":26 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":26 * arr = np.squeeze(arr) * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() # <<<<<<<<<<<<<< @@ -1025,7 +1025,7 @@ } __pyx_L4:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":27 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":27 * if not arr.shape and arr.dtype.isbuiltin: # 0d coverted to scalar * return arr.item() * return arr # <<<<<<<<<<<<<< @@ -1052,7 +1052,7 @@ return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":17 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":17 * * * cpdef object squeeze_element(cnp.ndarray arr): # <<<<<<<<<<<<<< @@ -1087,7 +1087,7 @@ return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1111,7 +1111,7 @@ __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_new_dt_str = Py_None; __Pyx_INCREF(Py_None); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":44 * ``arr`` * ''' * cdef cnp.ndarray arr = in_arr # <<<<<<<<<<<<<< @@ -1122,7 +1122,7 @@ __Pyx_INCREF(__pyx_v_in_arr); __pyx_v_arr = ((PyArrayObject *)__pyx_v_in_arr); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":45 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":45 * ''' * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim # <<<<<<<<<<<<<< @@ -1131,7 +1131,7 @@ */ __pyx_v_ndim = __pyx_v_arr->nd; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":46 * cdef cnp.ndarray arr = in_arr * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape # <<<<<<<<<<<<<< @@ -1140,7 +1140,7 @@ */ __pyx_v_dims = __pyx_v_arr->dimensions; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":47 * cdef int ndim = arr.ndim * cdef cnp.npy_intp *dims = arr.shape * cdef cnp.npy_intp last_dim = dims[ndim-1] # <<<<<<<<<<<<<< @@ -1149,7 +1149,7 @@ */ __pyx_v_last_dim = (__pyx_v_dims[(__pyx_v_ndim - 1)]); - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":49 * cdef cnp.npy_intp last_dim = dims[ndim-1] * cdef object new_dt_str * if last_dim == 0: # deal with empty array case # <<<<<<<<<<<<<< @@ -1159,7 +1159,7 @@ __pyx_t_1 = (__pyx_v_last_dim == 0); if (__pyx_t_1) { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":50 * cdef object new_dt_str * if last_dim == 0: # deal with empty array case * new_dt_str = arr.dtype.str # <<<<<<<<<<<<<< @@ -1178,7 +1178,7 @@ } /*else*/ { - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":52 * new_dt_str = arr.dtype.str * else: # make new dtype string with N appended * new_dt_str = arr.dtype.str[:-1] + str(last_dim) # <<<<<<<<<<<<<< @@ -1213,7 +1213,7 @@ } __pyx_L3:; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":54 * new_dt_str = arr.dtype.str[:-1] + str(last_dim) * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) # <<<<<<<<<<<<<< @@ -1239,7 +1239,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":55 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":55 * # Copy to deal with F ordered arrays * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) # <<<<<<<<<<<<<< @@ -1261,7 +1261,7 @@ __pyx_v_arr = ((PyArrayObject *)__pyx_t_2); __pyx_t_2 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":56 * arr = np.ascontiguousarray(arr) * arr = arr.view(new_dt_str) * return arr.reshape(in_arr.shape[:-1]) # <<<<<<<<<<<<<< @@ -1305,7 +1305,7 @@ return __pyx_r; } -/* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":30 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":30 * * * cpdef cnp.ndarray chars_to_strings(in_arr): # <<<<<<<<<<<<<< @@ -1339,7 +1339,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":187 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1375,7 +1375,7 @@ __Pyx_GIVEREF(__pyx_v_info->obj); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":193 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -1384,7 +1384,7 @@ */ __pyx_v_endian_detector = 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":194 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 * cdef int copy_shape, i, ndim * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -1393,7 +1393,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":196 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 * cdef bint little_endian = ((&endian_detector)[0] != 0) * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< @@ -1402,7 +1402,7 @@ */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":198 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -1412,7 +1412,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":199 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1424,7 +1424,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":201 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1435,7 +1435,7 @@ } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":203 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1445,7 +1445,7 @@ __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":204 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1459,7 +1459,7 @@ } if (__pyx_t_3) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":205 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< @@ -1481,7 +1481,7 @@ } __pyx_L6:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":207 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< @@ -1491,7 +1491,7 @@ __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); if (__pyx_t_3) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":208 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< @@ -1505,7 +1505,7 @@ } if (__pyx_t_2) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":209 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< @@ -1527,7 +1527,7 @@ } __pyx_L7:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":211 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< @@ -1536,7 +1536,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":212 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1545,7 +1545,7 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":213 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< @@ -1555,7 +1555,7 @@ __pyx_t_6 = __pyx_v_copy_shape; if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":216 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1564,7 +1564,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":217 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1573,7 +1573,7 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":218 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< @@ -1584,7 +1584,7 @@ for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { __pyx_v_i = __pyx_t_7; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":219 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1593,7 +1593,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":220 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1606,7 +1606,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":222 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1615,7 +1615,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":223 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1626,7 +1626,7 @@ } __pyx_L8:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":224 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1635,7 +1635,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":225 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1644,7 +1644,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":226 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1653,7 +1653,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":229 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1662,7 +1662,7 @@ */ __pyx_v_f = NULL; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":230 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< @@ -1672,7 +1672,7 @@ __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":234 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< @@ -1681,7 +1681,7 @@ */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":236 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< @@ -1697,7 +1697,7 @@ } if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":238 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< @@ -1713,7 +1713,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":241 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< @@ -1728,7 +1728,7 @@ } __pyx_L11:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":243 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< @@ -1738,7 +1738,7 @@ __pyx_t_1 = (!__pyx_v_hasfields); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":244 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< @@ -1747,7 +1747,7 @@ */ __pyx_v_t = __pyx_v_descr->type_num; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":245 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -1762,7 +1762,7 @@ } if (!__pyx_t_2) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":246 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 * t = descr.type_num * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -1782,7 +1782,7 @@ } if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":247 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 * if ((descr.byteorder == '>' and little_endian) or * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -1804,7 +1804,7 @@ } __pyx_L13:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":248 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 * (descr.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< @@ -1817,7 +1817,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":249 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< @@ -1830,7 +1830,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":250 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< @@ -1843,7 +1843,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":251 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< @@ -1856,7 +1856,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":252 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< @@ -1869,7 +1869,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":253 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< @@ -1882,7 +1882,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":254 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< @@ -1895,7 +1895,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":255 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< @@ -1908,7 +1908,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":256 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< @@ -1921,7 +1921,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":257 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< @@ -1934,7 +1934,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":258 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< @@ -1947,7 +1947,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":259 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< @@ -1960,7 +1960,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":260 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< @@ -1973,7 +1973,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":261 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< @@ -1986,7 +1986,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":262 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< @@ -1999,7 +1999,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":263 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< @@ -2012,7 +2012,7 @@ goto __pyx_L14; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":264 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< @@ -2026,7 +2026,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":266 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -2052,7 +2052,7 @@ } __pyx_L14:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":267 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< @@ -2061,7 +2061,7 @@ */ __pyx_v_info->format = __pyx_v_f; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":268 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< @@ -2074,7 +2074,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":270 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< @@ -2083,7 +2083,7 @@ */ __pyx_v_info->format = ((char *)malloc(255)); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":271 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< @@ -2092,7 +2092,7 @@ */ (__pyx_v_info->format[0]) = '^'; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":272 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 * info.format = stdlib.malloc(_buffer_format_string_len) * info.format[0] = '^' # Native data types, manual alignment * offset = 0 # <<<<<<<<<<<<<< @@ -2101,7 +2101,7 @@ */ __pyx_v_offset = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":275 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 * f = _util_dtypestring(descr, info.format + 1, * info.format + _buffer_format_string_len, * &offset) # <<<<<<<<<<<<<< @@ -2111,7 +2111,7 @@ __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_f = __pyx_t_9; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":276 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 * info.format + _buffer_format_string_len, * &offset) * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< @@ -2144,7 +2144,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":278 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 * f[0] = 0 # Terminate format string * * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< @@ -2158,7 +2158,7 @@ __Pyx_RefNannySetupContext("__releasebuffer__"); __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":279 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< @@ -2168,7 +2168,7 @@ __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":280 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 * def __releasebuffer__(ndarray self, Py_buffer* info): * if PyArray_HASFIELDS(self): * stdlib.free(info.format) # <<<<<<<<<<<<<< @@ -2180,7 +2180,7 @@ } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":281 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 * if PyArray_HASFIELDS(self): * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< @@ -2190,7 +2190,7 @@ __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":282 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 * stdlib.free(info.format) * if sizeof(npy_intp) != sizeof(Py_ssize_t): * stdlib.free(info.strides) # <<<<<<<<<<<<<< @@ -2206,7 +2206,7 @@ __Pyx_RefNannyFinishContext(); } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":755 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 * ctypedef npy_cdouble complex_t * * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< @@ -2219,7 +2219,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":756 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 * * cdef inline object PyArray_MultiIterNew1(a): * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< @@ -2245,7 +2245,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":758 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 * return PyArray_MultiIterNew(1, a) * * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< @@ -2258,7 +2258,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":759 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 * * cdef inline object PyArray_MultiIterNew2(a, b): * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< @@ -2284,7 +2284,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":761 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 * return PyArray_MultiIterNew(2, a, b) * * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< @@ -2297,7 +2297,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":762 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 * * cdef inline object PyArray_MultiIterNew3(a, b, c): * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< @@ -2323,7 +2323,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":764 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 * return PyArray_MultiIterNew(3, a, b, c) * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< @@ -2336,7 +2336,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":765 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * * cdef inline object PyArray_MultiIterNew4(a, b, c, d): * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< @@ -2362,7 +2362,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":767 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 * return PyArray_MultiIterNew(4, a, b, c, d) * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< @@ -2375,7 +2375,7 @@ PyObject *__pyx_t_1 = NULL; __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":768 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 * * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< @@ -2401,7 +2401,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":770 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 * return PyArray_MultiIterNew(5, a, b, c, d, e) * * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< @@ -2436,7 +2436,7 @@ __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":777 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 * cdef int delta_offset * cdef tuple i * cdef int endian_detector = 1 # <<<<<<<<<<<<<< @@ -2445,7 +2445,7 @@ */ __pyx_v_endian_detector = 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":778 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 * cdef tuple i * cdef int endian_detector = 1 * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< @@ -2454,7 +2454,7 @@ */ __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":781 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 * cdef tuple fields * * for childname in descr.names: # <<<<<<<<<<<<<< @@ -2473,7 +2473,7 @@ __pyx_v_childname = __pyx_t_3; __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":782 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 * * for childname in descr.names: * fields = descr.fields[childname] # <<<<<<<<<<<<<< @@ -2487,7 +2487,7 @@ __pyx_v_fields = ((PyObject *)__pyx_t_3); __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":783 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 * for childname in descr.names: * fields = descr.fields[childname] * child, new_offset = fields # <<<<<<<<<<<<<< @@ -2510,7 +2510,7 @@ {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":785 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 * child, new_offset = fields * * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< @@ -2535,7 +2535,7 @@ __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":786 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 * * if (end - f) - (new_offset - offset[0]) < 15: * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< @@ -2557,7 +2557,7 @@ } __pyx_L5:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":788 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") * * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< @@ -2572,7 +2572,7 @@ } if (!__pyx_t_7) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":789 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 * * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< @@ -2592,7 +2592,7 @@ } if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":790 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 * if ((child.byteorder == '>' and little_endian) or * (child.byteorder == '<' and not little_endian)): * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< @@ -2614,7 +2614,7 @@ } __pyx_L6:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":800 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * * # Output padding bytes * while offset[0] < new_offset: # <<<<<<<<<<<<<< @@ -2631,7 +2631,7 @@ __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; if (!__pyx_t_6) break; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":801 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 * # Output padding bytes * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< @@ -2640,7 +2640,7 @@ */ (__pyx_v_f[0]) = 120; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":802 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 * while offset[0] < new_offset: * f[0] = 120 # "x"; pad byte * f += 1 # <<<<<<<<<<<<<< @@ -2649,7 +2649,7 @@ */ __pyx_v_f += 1; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":803 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 * f[0] = 120 # "x"; pad byte * f += 1 * offset[0] += 1 # <<<<<<<<<<<<<< @@ -2659,7 +2659,7 @@ (__pyx_v_offset[0]) += 1; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":805 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 * offset[0] += 1 * * offset[0] += child.itemsize # <<<<<<<<<<<<<< @@ -2668,7 +2668,7 @@ */ (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":807 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 * offset[0] += child.itemsize * * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< @@ -2678,7 +2678,7 @@ __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":808 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * * if not PyDataType_HASFIELDS(child): * t = child.type_num # <<<<<<<<<<<<<< @@ -2691,7 +2691,7 @@ __pyx_v_t = __pyx_t_3; __pyx_t_3 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":809 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 * if not PyDataType_HASFIELDS(child): * t = child.type_num * if end - f < 5: # <<<<<<<<<<<<<< @@ -2701,7 +2701,7 @@ __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); if (__pyx_t_6) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":810 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 * t = child.type_num * if end - f < 5: * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< @@ -2723,7 +2723,7 @@ } __pyx_L10:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":813 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 * * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< @@ -2742,7 +2742,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":814 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 * # Until ticket #99 is fixed, use integers to avoid warnings * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< @@ -2761,7 +2761,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":815 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 * if t == NPY_BYTE: f[0] = 98 #"b" * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< @@ -2780,7 +2780,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":816 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 * elif t == NPY_UBYTE: f[0] = 66 #"B" * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< @@ -2799,7 +2799,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":817 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 * elif t == NPY_SHORT: f[0] = 104 #"h" * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< @@ -2818,7 +2818,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":818 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 * elif t == NPY_USHORT: f[0] = 72 #"H" * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< @@ -2837,7 +2837,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":819 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 * elif t == NPY_INT: f[0] = 105 #"i" * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< @@ -2856,7 +2856,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":820 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 * elif t == NPY_UINT: f[0] = 73 #"I" * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< @@ -2875,7 +2875,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":821 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 * elif t == NPY_LONG: f[0] = 108 #"l" * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< @@ -2894,7 +2894,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":822 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 * elif t == NPY_ULONG: f[0] = 76 #"L" * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< @@ -2913,7 +2913,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":823 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 * elif t == NPY_LONGLONG: f[0] = 113 #"q" * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< @@ -2932,7 +2932,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":824 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< @@ -2951,7 +2951,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":825 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 * elif t == NPY_FLOAT: f[0] = 102 #"f" * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< @@ -2970,7 +2970,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":826 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 * elif t == NPY_DOUBLE: f[0] = 100 #"d" * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< @@ -2991,7 +2991,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":827 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< @@ -3012,7 +3012,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":828 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< @@ -3033,7 +3033,7 @@ goto __pyx_L11; } - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":829 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< @@ -3053,7 +3053,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":831 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 * elif t == NPY_OBJECT: f[0] = 79 #"O" * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< @@ -3076,7 +3076,7 @@ } __pyx_L11:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":832 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 * else: * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * f += 1 # <<<<<<<<<<<<<< @@ -3088,7 +3088,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":836 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 * # Cython ignores struct boundary information ("T{...}"), * # so don't output it * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< @@ -3102,7 +3102,7 @@ } __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":837 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 * # so don't output it * f = _util_dtypestring(child, f, end, offset) * return f # <<<<<<<<<<<<<< @@ -3132,7 +3132,7 @@ return __pyx_r; } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":952 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 * * * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< @@ -3147,7 +3147,7 @@ __Pyx_INCREF((PyObject *)__pyx_v_arr); __Pyx_INCREF(__pyx_v_base); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":954 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 * cdef inline void set_array_base(ndarray arr, object base): * cdef PyObject* baseptr * if base is None: # <<<<<<<<<<<<<< @@ -3157,7 +3157,7 @@ __pyx_t_1 = (__pyx_v_base == Py_None); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":955 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 * cdef PyObject* baseptr * if base is None: * baseptr = NULL # <<<<<<<<<<<<<< @@ -3169,7 +3169,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":957 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 * baseptr = NULL * else: * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< @@ -3178,7 +3178,7 @@ */ Py_INCREF(__pyx_v_base); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":958 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 * else: * Py_INCREF(base) # important to do this before decref below! * baseptr = base # <<<<<<<<<<<<<< @@ -3189,7 +3189,7 @@ } __pyx_L3:; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":959 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 * Py_INCREF(base) # important to do this before decref below! * baseptr = base * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< @@ -3198,7 +3198,7 @@ */ Py_XDECREF(__pyx_v_arr->base); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":960 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 * baseptr = base * Py_XDECREF(arr.base) * arr.base = baseptr # <<<<<<<<<<<<<< @@ -3212,7 +3212,7 @@ __Pyx_RefNannyFinishContext(); } -/* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":962 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 * arr.base = baseptr * * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< @@ -3226,7 +3226,7 @@ __Pyx_RefNannySetupContext("get_array_base"); __Pyx_INCREF((PyObject *)__pyx_v_arr); - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":963 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 * * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: # <<<<<<<<<<<<<< @@ -3236,7 +3236,7 @@ __pyx_t_1 = (__pyx_v_arr->base == NULL); if (__pyx_t_1) { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":964 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 * cdef inline object get_array_base(ndarray arr): * if arr.base is NULL: * return None # <<<<<<<<<<<<<< @@ -3251,7 +3251,7 @@ } /*else*/ { - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\numpy.pxd":966 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 * return None * else: * return arr.base # <<<<<<<<<<<<<< @@ -3424,7 +3424,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":5 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":5 * ''' * * import numpy as np # <<<<<<<<<<<<<< @@ -3436,7 +3436,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 5; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "C:\home\matthew\dev_trees\scipy-work\scipy\io\matlab\mio_utils.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/mio_utils.pyx":1 * # -*- python -*- like file # <<<<<<<<<<<<<< * ''' Utilities for generic processing of return arrays from read * ''' @@ -3460,7 +3460,7 @@ if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_1)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - /* "C:\Python25\lib\site-packages\cython-0.12.1-py2.5-win32.egg\Cython\Includes\stdlib.pxd":2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) Modified: branches/0.8.x/scipy/io/matlab/streams.c =================================================================== --- branches/0.8.x/scipy/io/matlab/streams.c 2010-06-16 16:37:26 UTC (rev 6511) +++ branches/0.8.x/scipy/io/matlab/streams.c 2010-06-16 16:43:41 UTC (rev 6512) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Tue Jan 5 22:26:04 2010 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:42:35 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -6,6 +6,7 @@ #ifndef Py_PYTHON_H #error Python headers needed to compile C extensions, please install development version of Python. #else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -15,7 +16,9 @@ #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX @@ -25,7 +28,9 @@ #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -35,17 +40,17 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 @@ -59,22 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type - #define PyString_CheckExact PyBytes_CheckExact + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -89,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -109,6 +128,7 @@ #else #define _USE_MATH_DEFINES #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) @@ -118,6 +138,7 @@ #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) #endif + #if PY_VERSION_HEX < 0x02050000 #define __Pyx_NAMESTR(n) ((char *)(n)) #define __Pyx_DOCSTR(n) ((char *)(n)) @@ -135,24 +156,20 @@ #include "stdlib.h" #include "fileobject.h" #include "cStringIO.h" -#define __PYX_USE_C99_COMPLEX defined(_Complex_I) - -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline -#else -#define INLINE +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ - -static int __pyx_skip_dispatch = 0; - - /* Type Conversion Predeclarations */ #if PY_MAJOR_VERSION < 3 @@ -169,8 +186,8 @@ #define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) #define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject*); -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); #if !defined(T_PYSSIZET) #if PY_VERSION_HEX < 0x02050000 @@ -234,9 +251,9 @@ #endif #endif -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) @@ -266,101 +283,9 @@ static const char **__pyx_f; -#ifdef CYTHON_REFNANNY -typedef struct { - void (*INCREF)(void*, PyObject*, int); - void (*DECREF)(void*, PyObject*, int); - void (*GOTREF)(void*, PyObject*, int); - void (*GIVEREF)(void*, PyObject*, int); - void* (*NewContext)(const char*, int, const char*); - void (*FinishContext)(void**); -} __Pyx_RefnannyAPIStruct; -static __Pyx_RefnannyAPIStruct *__Pyx_Refnanny = NULL; -#define __Pyx_ImportRefcountAPI(name) (__Pyx_RefnannyAPIStruct *) PyCObject_Import((char *)name, (char *)"RefnannyAPI") -#define __Pyx_INCREF(r) __Pyx_Refnanny->INCREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_DECREF(r) __Pyx_Refnanny->DECREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GOTREF(r) __Pyx_Refnanny->GOTREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_GIVEREF(r) __Pyx_Refnanny->GIVEREF(__pyx_refchk, (PyObject *)(r), __LINE__) -#define __Pyx_XDECREF(r) if((r) == NULL) ; else __Pyx_DECREF(r) -#define __Pyx_SetupRefcountContext(name) void* __pyx_refchk = __Pyx_Refnanny->NewContext((name), __LINE__, __FILE__) -#define __Pyx_FinishRefcountContext() __Pyx_Refnanny->FinishContext(&__pyx_refchk) -#else -#define __Pyx_INCREF(r) Py_INCREF(r) -#define __Pyx_DECREF(r) Py_DECREF(r) -#define __Pyx_GOTREF(r) -#define __Pyx_GIVEREF(r) -#define __Pyx_XDECREF(r) Py_XDECREF(r) -#define __Pyx_SetupRefcountContext(name) -#define __Pyx_FinishRefcountContext() -#endif /* CYTHON_REFNANNY */ -#define __Pyx_XGIVEREF(r) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) - -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ - -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ - -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, - const char *name, int exact); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); - -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); - -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); - -static INLINE char __Pyx_PyInt_AsChar(PyObject *); - -static INLINE short __Pyx_PyInt_AsShort(PyObject *); - -static INLINE int __Pyx_PyInt_AsInt(PyObject *); - -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); - -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); - -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); - -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); - -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); - -static INLINE long __Pyx_PyInt_AsLong(PyObject *); - -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); - -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); - -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); - -static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - /* Type declarations */ -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":6 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":6 * cdef object fobj * * cpdef int seek(self, long int offset, int whence=*) except -1 # <<<<<<<<<<<<<< @@ -373,7 +298,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":9 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":9 * cpdef long int tell(self) except -1 * cdef int read_into(self, void *buf, size_t n) except -1 * cdef object read_string(self, size_t n, void **pp, int copy=*) # <<<<<<<<<<<<<< @@ -386,7 +311,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -399,7 +324,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":109 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -412,7 +337,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -425,7 +350,7 @@ int whence; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":173 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":173 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -438,7 +363,7 @@ int copy; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":3 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":3 * # -*- python -*- or rather like * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -452,7 +377,7 @@ PyObject *fobj; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":87 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":87 * * * cdef class cStringStream(GenericStream): # <<<<<<<<<<<<<< @@ -464,7 +389,7 @@ struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream __pyx_base; }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":125 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":125 * * * cdef class FileStream(GenericStream): # <<<<<<<<<<<<<< @@ -478,7 +403,7 @@ }; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":47 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":47 * * * cdef class GenericStream: # <<<<<<<<<<<<<< @@ -495,7 +420,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":125 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":125 * * * cdef class FileStream(GenericStream): # <<<<<<<<<<<<<< @@ -509,7 +434,7 @@ static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_FileStream; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":87 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":87 * * * cdef class cStringStream(GenericStream): # <<<<<<<<<<<<<< @@ -521,11 +446,119 @@ struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream __pyx_base; }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *__pyx_vtabptr_5scipy_2io_6matlab_7streams_cStringStream; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, + const char *name, int exact); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from python_ref */ + /* Module declarations from python_string */ /* Module declarations from scipy.io.matlab.pyalloc */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t, void **); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t, void **); /*proto*/ /* Module declarations from __builtin__ */ /* Module declarations from scipy.io.matlab.streams */ @@ -539,53 +572,45 @@ int __pyx_module_is_main_scipy__io__matlab__streams = 0; /* Implementation of scipy.io.matlab.streams */ -static char __pyx_k___main__[] = "__main__"; -static PyObject *__pyx_kp___main__; -static char __pyx_k___init__[] = "__init__"; -static PyObject *__pyx_kp___init__; -static char __pyx_k_seek[] = "seek"; -static PyObject *__pyx_kp_seek; -static char __pyx_k_tell[] = "tell"; -static PyObject *__pyx_kp_tell; -static char __pyx_k_read[] = "read"; -static PyObject *__pyx_kp_read; -static char __pyx_k_make_stream[] = "make_stream"; -static PyObject *__pyx_kp_make_stream; -static char __pyx_k_fobj[] = "fobj"; -static PyObject *__pyx_kp_fobj; -static char __pyx_k_offset[] = "offset"; -static PyObject *__pyx_kp_offset; -static char __pyx_k_whence[] = "whence"; -static PyObject *__pyx_kp_whence; -static char __pyx_k_n_bytes[] = "n_bytes"; -static PyObject *__pyx_kp_n_bytes; -static char __pyx_k_st[] = "st"; -static PyObject *__pyx_kp_st; -static char __pyx_k_n[] = "n"; -static PyObject *__pyx_kp_n; -static char __pyx_k_IOError[] = "IOError"; -static PyObject *__pyx_kp_IOError; -static char __pyx_k_9[] = "A"; -static PyObject *__pyx_kp_9; static PyObject *__pyx_builtin_IOError; -static PyObject *__pyx_kp_1; static char __pyx_k_1[] = "could not read bytes"; -static PyObject *__pyx_kp_2; -static char __pyx_k_2[] = "could not read bytes"; -static PyObject *__pyx_kp_3; -static char __pyx_k_3[] = "could not read bytes"; -static PyObject *__pyx_kp_4; -static char __pyx_k_4[] = "could not read bytes"; -static PyObject *__pyx_kp_5; -static char __pyx_k_5[] = "Failed seek"; -static PyObject *__pyx_kp_6; -static char __pyx_k_6[] = "Could not read bytes"; -static PyObject *__pyx_kp_7; -static char __pyx_k_7[] = "could not read bytes"; -static PyObject *__pyx_kp_8; -static char __pyx_k_8[] = " "; +static char __pyx_k_2[] = "Failed seek"; +static char __pyx_k_3[] = "Could not read bytes"; +static char __pyx_k_4[] = " "; +static char __pyx_k__A[] = "A"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__st[] = "st"; +static char __pyx_k__file[] = "file"; +static char __pyx_k__fobj[] = "fobj"; +static char __pyx_k__read[] = "read"; +static char __pyx_k__seek[] = "seek"; +static char __pyx_k__tell[] = "tell"; +static char __pyx_k__offset[] = "offset"; +static char __pyx_k__whence[] = "whence"; +static char __pyx_k__IOError[] = "IOError"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k__read_into[] = "read_into"; +static char __pyx_k__read_string[] = "read_string"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_kp_s_3; +static PyObject *__pyx_kp_s_4; +static PyObject *__pyx_n_s__A; +static PyObject *__pyx_n_s__IOError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s__file; +static PyObject *__pyx_n_s__fobj; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__offset; +static PyObject *__pyx_n_s__read; +static PyObject *__pyx_n_s__read_into; +static PyObject *__pyx_n_s__read_string; +static PyObject *__pyx_n_s__seek; +static PyObject *__pyx_n_s__st; +static PyObject *__pyx_n_s__tell; +static PyObject *__pyx_n_s__whence; -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":49 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":49 * cdef class GenericStream: * * def __init__(self, fobj): # <<<<<<<<<<<<<< @@ -597,8 +622,8 @@ static int __pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fobj = 0; int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fobj,0}; - __Pyx_SetupRefcountContext("__init__"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fobj,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -609,7 +634,7 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_fobj); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fobj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } @@ -630,7 +655,7 @@ return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":50 * * def __init__(self, fobj): * self.fobj = fobj # <<<<<<<<<<<<<< @@ -644,11 +669,11 @@ ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj = __pyx_v_fobj; __pyx_r = 0; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":52 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":52 * self.fobj = fobj * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -658,15 +683,14 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); int __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - __Pyx_SetupRefcountContext("seek"); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; @@ -676,61 +700,61 @@ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":53 * * cpdef int seek(self, long int offset, int whence=0) except -1: * self.fobj.seek(offset, whence) # <<<<<<<<<<<<<< * return 0 * */ - __pyx_t_2 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_seek); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_1 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __pyx_t_4 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); __pyx_t_3 = 0; - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_t_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 53; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":54 * cpdef int seek(self, long int offset, int whence=0) except -1: * self.fobj.seek(offset, whence) * return 0 # <<<<<<<<<<<<<< @@ -743,19 +767,18 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); - __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":52 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":52 * self.fobj = fobj * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -768,11 +791,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -784,12 +807,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -800,10 +823,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -819,28 +842,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 52; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":56 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":56 * return 0 * * cpdef long int tell(self) except -1: # <<<<<<<<<<<<<< @@ -851,60 +874,58 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static long __pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_tell(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, int __pyx_skip_dispatch) { long __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("tell"); + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_RefNannySetupContext("tell"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_tell); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell)) { - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13GenericStream_tell)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":57 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":57 * * cpdef long int tell(self) except -1: * return self.fobj.tell() # <<<<<<<<<<<<<< * * def read(self, n_bytes): */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_3); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_t_2; + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 57; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.io.matlab.streams.GenericStream.tell"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":56 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":56 * return 0 * * cpdef long int tell(self) except -1: # <<<<<<<<<<<<<< @@ -917,7 +938,7 @@ PyObject *__pyx_r = NULL; long __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_SetupRefcountContext("tell"); + __Pyx_RefNannySetupContext("tell"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->__pyx_vtab)->tell(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -934,11 +955,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":59 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":59 * return self.fobj.tell() * * def read(self, n_bytes): # <<<<<<<<<<<<<< @@ -952,9 +973,9 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read"); + __Pyx_RefNannySetupContext("read"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":60 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":60 * * def read(self, n_bytes): * return self.fobj.read(n_bytes) # <<<<<<<<<<<<<< @@ -962,17 +983,17 @@ * cdef int read_into(self, void *buf, size_t n) except -1: */ __Pyx_XDECREF(__pyx_r); - __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self)->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n_bytes); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n_bytes); __Pyx_GIVEREF(__pyx_v_n_bytes); - __pyx_t_3 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 60; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; @@ -987,11 +1008,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":62 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":62 * return self.fobj.read(n_bytes) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -1006,46 +1027,49 @@ PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - char *__pyx_t_5; - __Pyx_SetupRefcountContext("read_into"); + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + char *__pyx_t_6; + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":66 * ''' * cdef char* d_ptr * data = self.fobj.read(n) # <<<<<<<<<<<<<< * if PyString_Size(data) != n: * raise IOError('could not read bytes') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 66; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":67 * cdef char* d_ptr * data = self.fobj.read(n) * if PyString_Size(data) != n: # <<<<<<<<<<<<<< * raise IOError('could not read bytes') * return -1 */ - __pyx_t_4 = (PyString_Size(__pyx_v_data) != __pyx_v_n); - if (__pyx_t_4) { + __pyx_t_4 = PyString_Size(__pyx_v_data); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 67; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 != __pyx_v_n); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":68 * data = self.fobj.read(n) * if PyString_Size(data) != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1053,18 +1077,18 @@ * d_ptr = data */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_1); - __Pyx_GIVEREF(__pyx_kp_1); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":69 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":69 * if PyString_Size(data) != n: * raise IOError('could not read bytes') * return -1 # <<<<<<<<<<<<<< @@ -1077,17 +1101,17 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":70 * raise IOError('could not read bytes') * return -1 * d_ptr = data # <<<<<<<<<<<<<< * memcpy(buf, d_ptr, n) * return 0 */ - __pyx_t_5 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_5) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_d_ptr = __pyx_t_5; + __pyx_t_6 = __Pyx_PyBytes_AsString(__pyx_v_data); if (unlikely((!__pyx_t_6) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_d_ptr = __pyx_t_6; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":71 * return -1 * d_ptr = data * memcpy(buf, d_ptr, n) # <<<<<<<<<<<<<< @@ -1096,7 +1120,7 @@ */ memcpy(__pyx_v_buf, __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":72 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":72 * d_ptr = data * memcpy(buf, d_ptr, n) * return 0 # <<<<<<<<<<<<<< @@ -1116,11 +1140,12 @@ __pyx_r = -1; __pyx_L0:; __Pyx_DECREF(__pyx_v_data); - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":74 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":74 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -1129,57 +1154,60 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_13GenericStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); PyObject *__pyx_v_data; PyObject *__pyx_v_d_copy = 0; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_SetupRefcountContext("read_string"); + Py_ssize_t __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_data = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":76 * cdef object read_string(self, size_t n, void **pp, int copy=True): * ''' Make new memory, wrap with object ''' * data = self.fobj.read(n) # <<<<<<<<<<<<<< * if PyString_Size(data) != n: * raise IOError('could not read bytes') */ - __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_kp_read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(__pyx_v_self->fobj, __pyx_n_s__read); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_t_2 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_data); __pyx_v_data = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":77 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":77 * ''' Make new memory, wrap with object ''' * data = self.fobj.read(n) * if PyString_Size(data) != n: # <<<<<<<<<<<<<< * raise IOError('could not read bytes') * if copy != True: */ - __pyx_t_4 = (PyString_Size(__pyx_v_data) != __pyx_v_n); - if (__pyx_t_4) { + __pyx_t_4 = PyString_Size(__pyx_v_data); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 77; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = (__pyx_t_4 != __pyx_v_n); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":78 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":78 * data = self.fobj.read(n) * if PyString_Size(data) != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1187,13 +1215,13 @@ * pp[0] = PyString_AS_STRING(data) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_2); - __Pyx_GIVEREF(__pyx_kp_2); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 78; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1201,17 +1229,17 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":79 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":79 * if PyString_Size(data) != n: * raise IOError('could not read bytes') * if copy != True: # <<<<<<<<<<<<<< * pp[0] = PyString_AS_STRING(data) * return data */ - __pyx_t_4 = (__pyx_v_copy != 1); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_copy != 1); + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":80 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":80 * raise IOError('could not read bytes') * if copy != True: * pp[0] = PyString_AS_STRING(data) # <<<<<<<<<<<<<< @@ -1220,7 +1248,7 @@ */ (__pyx_v_pp[0]) = ((void *)PyString_AS_STRING(__pyx_v_data)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":81 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":81 * if copy != True: * pp[0] = PyString_AS_STRING(data) * return data # <<<<<<<<<<<<<< @@ -1235,7 +1263,7 @@ } __pyx_L4:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":82 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":82 * pp[0] = PyString_AS_STRING(data) * return data * cdef object d_copy = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -1247,7 +1275,7 @@ __pyx_v_d_copy = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":83 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":83 * return data * cdef object d_copy = pyalloc_v(n, pp) * memcpy(pp[0], PyString_AS_STRING(data), n) # <<<<<<<<<<<<<< @@ -1256,7 +1284,7 @@ */ memcpy((__pyx_v_pp[0]), PyString_AS_STRING(__pyx_v_data), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":84 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":84 * cdef object d_copy = pyalloc_v(n, pp) * memcpy(pp[0], PyString_AS_STRING(data), n) * return d_copy # <<<<<<<<<<<<<< @@ -1279,12 +1307,13 @@ __pyx_L0:; __Pyx_DECREF(__pyx_v_data); __Pyx_XDECREF(__pyx_v_d_copy); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1294,68 +1323,73 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_13cStringStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13cStringStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); char *__pyx_v_ptr; int __pyx_r; - PyObject *__pyx_1 = 0; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_2; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; + PyObject *__pyx_t_4 = NULL; int __pyx_t_5; - __Pyx_SetupRefcountContext("seek"); + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_9; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_13cStringStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":91 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":91 * cpdef int seek(self, long int offset, int whence=0) except -1: * cdef char *ptr * if whence == 1 and offset >=0: # forward, from here # <<<<<<<<<<<<<< * StringIO_cread(self.fobj, &ptr, offset) * return 0 */ - if ((__pyx_v_whence == 1)) { - __pyx_t_5 = (__pyx_v_offset >= 0); + __pyx_t_6 = (__pyx_v_whence == 1); + if (__pyx_t_6) { + __pyx_t_7 = (__pyx_v_offset >= 0); + __pyx_t_8 = __pyx_t_7; } else { - __pyx_t_5 = (__pyx_v_whence == 1); + __pyx_t_8 = __pyx_t_6; } - if (__pyx_t_5) { + if (__pyx_t_8) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":92 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":92 * cdef char *ptr * if whence == 1 and offset >=0: # forward, from here * StringIO_cread(self.fobj, &ptr, offset) # <<<<<<<<<<<<<< @@ -1364,7 +1398,7 @@ */ PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_ptr), __pyx_v_offset); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":93 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":93 * if whence == 1 and offset >=0: # forward, from here * StringIO_cread(self.fobj, &ptr, offset) * return 0 # <<<<<<<<<<<<<< @@ -1377,17 +1411,17 @@ } /*else*/ { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":95 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":95 * return 0 * else: # use python interface * return GenericStream.seek(self, offset, whence) # <<<<<<<<<<<<<< * * cdef int read_into(self, void *buf, size_t n) except -1: */ - __pyx_2.__pyx_n = 1; - __pyx_2.whence = __pyx_v_whence; - __pyx_t_4 = __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_2); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_4; + __pyx_t_9.__pyx_n = 1; + __pyx_t_9.whence = __pyx_v_whence; + __pyx_t_5 = __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream->seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_9); if (unlikely(__pyx_t_5 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 95; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_r = __pyx_t_5; goto __pyx_L0; } __pyx_L3:; @@ -1395,18 +1429,19 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":89 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":89 * cdef class cStringStream(GenericStream): * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1419,11 +1454,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -1435,12 +1470,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -1451,10 +1486,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1470,28 +1505,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 89; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":97 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":97 * return GenericStream.seek(self, offset, whence) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -1506,9 +1541,10 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_into"); + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":103 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":103 * size_t n_red * char* d_ptr * n_red = StringIO_cread(self.fobj, &d_ptr, n) # <<<<<<<<<<<<<< @@ -1517,7 +1553,7 @@ */ __pyx_v_n_red = PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":104 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":104 * char* d_ptr * n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: # <<<<<<<<<<<<<< @@ -1527,7 +1563,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":105 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":105 * n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1535,13 +1571,13 @@ * return 0 */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_3); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_3); - __Pyx_GIVEREF(__pyx_kp_3); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1549,7 +1585,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":106 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":106 * if n_red != n: * raise IOError('could not read bytes') * memcpy(buf, d_ptr, n) # <<<<<<<<<<<<<< @@ -1558,7 +1594,7 @@ */ memcpy(__pyx_v_buf, ((void *)__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":107 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":107 * raise IOError('could not read bytes') * memcpy(buf, d_ptr, n) * return 0 # <<<<<<<<<<<<<< @@ -1576,11 +1612,12 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.cStringStream.read_into"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":109 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -1589,7 +1626,7 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_13cStringStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_cStringStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13cStringStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); char *__pyx_v_d_ptr; PyObject *__pyx_v_obj; size_t __pyx_v_n_red; @@ -1597,15 +1634,16 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_string"); + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); __pyx_v_obj = Py_None; __Pyx_INCREF(Py_None); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":117 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":117 * char *d_ptr * object obj * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) # <<<<<<<<<<<<<< @@ -1614,7 +1652,7 @@ */ __pyx_v_n_red = PycStringIO->cread(__pyx_v_self->__pyx_base.fobj, (&__pyx_v_d_ptr), __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":118 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":118 * object obj * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: # <<<<<<<<<<<<<< @@ -1624,7 +1662,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":119 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":119 * cdef size_t n_red = StringIO_cread(self.fobj, &d_ptr, n) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -1632,13 +1670,13 @@ * memcpy(pp[0], d_ptr, n) */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_4); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_4); - __Pyx_GIVEREF(__pyx_kp_4); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -1646,7 +1684,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":120 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":120 * if n_red != n: * raise IOError('could not read bytes') * obj = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -1659,7 +1697,7 @@ __pyx_v_obj = __pyx_t_3; __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":121 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":121 * raise IOError('could not read bytes') * obj = pyalloc_v(n, pp) * memcpy(pp[0], d_ptr, n) # <<<<<<<<<<<<<< @@ -1668,7 +1706,7 @@ */ memcpy((__pyx_v_pp[0]), __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":122 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":122 * obj = pyalloc_v(n, pp) * memcpy(pp[0], d_ptr, n) * return obj # <<<<<<<<<<<<<< @@ -1689,12 +1727,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_DECREF(__pyx_v_obj); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":128 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":128 * cdef FILE* file * * def __init__(self, fobj): # <<<<<<<<<<<<<< @@ -1706,8 +1745,8 @@ static int __pyx_pf_5scipy_2io_6matlab_7streams_10FileStream___init__(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds) { PyObject *__pyx_v_fobj = 0; int __pyx_r; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_fobj,0}; - __Pyx_SetupRefcountContext("__init__"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__fobj,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[1] = {0}; @@ -1718,7 +1757,7 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_fobj); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__fobj); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; } @@ -1739,7 +1778,7 @@ return -1; __pyx_L4_argument_unpacking_done:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":129 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":129 * * def __init__(self, fobj): * self.fobj = fobj # <<<<<<<<<<<<<< @@ -1752,7 +1791,7 @@ __Pyx_DECREF(((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.fobj); ((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.fobj = __pyx_v_fobj; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":130 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":130 * def __init__(self, fobj): * self.fobj = fobj * self.file = PyFile_AsFile(fobj) # <<<<<<<<<<<<<< @@ -1762,11 +1801,11 @@ ((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->file = PyFile_AsFile(__pyx_v_fobj); __pyx_r = 0; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1776,52 +1815,53 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek(PyObject *__pyx_v_self, PyObject *__pyx_args, PyObject *__pyx_kwds); /*proto*/ static int __pyx_f_5scipy_2io_6matlab_7streams_10FileStream_seek(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, long __pyx_v_offset, int __pyx_skip_dispatch, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_10FileStream_seek *__pyx_optional_args) { - int __pyx_v_whence = 0; + int __pyx_v_whence = ((int)0); int __pyx_v_ret; int __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - int __pyx_t_4; - __Pyx_SetupRefcountContext("seek"); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("seek"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_whence = __pyx_optional_args->whence; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_seek); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek)) { - __pyx_t_1 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__seek); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_seek)) { + __pyx_t_2 = PyInt_FromLong(__pyx_v_offset); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_whence); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_1 = 0; + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_4 = __Pyx_PyInt_AsInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_4; + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_5 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":152 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":152 * ret : int * ''' * ret = fseek(self.file, offset, whence) # <<<<<<<<<<<<<< @@ -1830,36 +1870,36 @@ */ __pyx_v_ret = fseek(__pyx_v_self->file, __pyx_v_offset, __pyx_v_whence); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":153 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":153 * ''' * ret = fseek(self.file, offset, whence) * if ret: # <<<<<<<<<<<<<< * raise IOError('Failed seek') * return -1 */ - __pyx_t_4 = __pyx_v_ret; - if (__pyx_t_4) { + __pyx_t_5 = __pyx_v_ret; + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":154 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":154 * ret = fseek(self.file, offset, whence) * if ret: * raise IOError('Failed seek') # <<<<<<<<<<<<<< * return -1 * return ret */ - __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_5); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_5); - __Pyx_GIVEREF(__pyx_kp_5); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 154; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":155 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":155 * if ret: * raise IOError('Failed seek') * return -1 # <<<<<<<<<<<<<< @@ -1872,7 +1912,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":156 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":156 * raise IOError('Failed seek') * return -1 * return ret # <<<<<<<<<<<<<< @@ -1885,18 +1925,19 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.seek"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":132 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":132 * self.file = PyFile_AsFile(fobj) * * cpdef int seek(self, long int offset, int whence=0) except -1: # <<<<<<<<<<<<<< @@ -1909,11 +1950,11 @@ long __pyx_v_offset; int __pyx_v_whence; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_1; int __pyx_t_1; - PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_offset,&__pyx_kp_whence,0}; - __Pyx_SetupRefcountContext("seek"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_seek __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__offset,&__pyx_n_s__whence,0}; + __Pyx_RefNannySetupContext("seek"); if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; @@ -1925,12 +1966,12 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_offset); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__offset); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: if (kw_args > 1) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_whence); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__whence); if (unlikely(value)) { values[1] = value; kw_args--; } } } @@ -1941,10 +1982,10 @@ if (values[1]) { __pyx_v_whence = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); } } else { - __pyx_v_whence = 0; + __pyx_v_whence = ((int)0); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: __pyx_v_whence = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_whence == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_offset = __Pyx_PyInt_AsLong(PyTuple_GET_ITEM(__pyx_args, 0)); if (unlikely((__pyx_v_offset == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -1960,28 +2001,28 @@ return NULL; __pyx_L4_argument_unpacking_done:; __Pyx_XDECREF(__pyx_r); - __pyx_1.__pyx_n = 1; - __pyx_1.whence = __pyx_v_whence; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.whence = __pyx_v_whence; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.seek(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), __pyx_v_offset, 1, &__pyx_t_2); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.seek"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":158 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":158 * return ret * * cpdef long int tell(self): # <<<<<<<<<<<<<< @@ -1992,29 +2033,29 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell(PyObject *__pyx_v_self, PyObject *unused); /*proto*/ static long __pyx_f_5scipy_2io_6matlab_7streams_10FileStream_tell(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, int __pyx_skip_dispatch) { long __pyx_r; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; - long __pyx_t_2; - __Pyx_SetupRefcountContext("tell"); + PyObject *__pyx_t_2 = NULL; + long __pyx_t_3; + __Pyx_RefNannySetupContext("tell"); /* Check if called by wrapper */ if (unlikely(__pyx_skip_dispatch)) ; /* Check if overriden in Python */ else if (unlikely(Py_TYPE(((PyObject *)__pyx_v_self))->tp_dictoffset != 0)) { - __pyx_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_kp_tell); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (!PyCFunction_Check(__pyx_1) || (PyCFunction_GET_FUNCTION(__pyx_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell)) { - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyInt_AsLong(__pyx_t_1); if (unlikely((__pyx_t_2 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_GetAttr(((PyObject *)__pyx_v_self), __pyx_n_s__tell); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (!PyCFunction_Check(__pyx_t_1) || (PyCFunction_GET_FUNCTION(__pyx_t_1) != (void *)&__pyx_pf_5scipy_2io_6matlab_7streams_10FileStream_tell)) { + __pyx_t_2 = PyObject_Call(__pyx_t_1, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_PyInt_AsLong(__pyx_t_2); if (unlikely((__pyx_t_3 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_3; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; goto __pyx_L0; } - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":159 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":159 * * cpdef long int tell(self): * return ftell(self.file) # <<<<<<<<<<<<<< @@ -2027,16 +2068,16 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.tell"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":158 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":158 * return ret * * cpdef long int tell(self): # <<<<<<<<<<<<<< @@ -2049,7 +2090,7 @@ PyObject *__pyx_r = NULL; long __pyx_t_1; PyObject *__pyx_t_2 = NULL; - __Pyx_SetupRefcountContext("tell"); + __Pyx_RefNannySetupContext("tell"); __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream *)((struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *)__pyx_v_self)->__pyx_base.__pyx_vtab)->__pyx_base.tell(((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_self), 1); if (unlikely(__pyx_t_1 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_t_2 = PyInt_FromLong(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2066,11 +2107,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":161 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":161 * return ftell(self.file) * * cdef int read_into(self, void *buf, size_t n) except -1: # <<<<<<<<<<<<<< @@ -2084,9 +2125,10 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_into"); + __Pyx_RefNannySetupContext("read_into"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":167 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":167 * size_t n_red * char* d_ptr * n_red = fread(buf, 1, n, self.file) # <<<<<<<<<<<<<< @@ -2095,7 +2137,7 @@ */ __pyx_v_n_red = fread(__pyx_v_buf, 1, __pyx_v_n, __pyx_v_self->file); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":168 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":168 * char* d_ptr * n_red = fread(buf, 1, n, self.file) * if n_red != n: # <<<<<<<<<<<<<< @@ -2105,7 +2147,7 @@ __pyx_t_1 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":169 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":169 * n_red = fread(buf, 1, n, self.file) * if n_red != n: * raise IOError('Could not read bytes') # <<<<<<<<<<<<<< @@ -2113,18 +2155,18 @@ * return 0 */ __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - __Pyx_INCREF(__pyx_kp_6); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_kp_6); - __Pyx_GIVEREF(__pyx_kp_6); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_3)); + PyTuple_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_kp_s_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_3)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 169; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":170 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":170 * if n_red != n: * raise IOError('Could not read bytes') * return -1 # <<<<<<<<<<<<<< @@ -2137,7 +2179,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":171 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":171 * raise IOError('Could not read bytes') * return -1 * return 0 # <<<<<<<<<<<<<< @@ -2155,11 +2197,12 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.FileStream.read_into"); __pyx_r = -1; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":173 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":173 * return 0 * * cdef object read_string(self, size_t n, void **pp, int copy=True): # <<<<<<<<<<<<<< @@ -2168,21 +2211,22 @@ */ static PyObject *__pyx_f_5scipy_2io_6matlab_7streams_10FileStream_read_string(struct __pyx_obj_5scipy_2io_6matlab_7streams_FileStream *__pyx_v_self, size_t __pyx_v_n, void **__pyx_v_pp, struct __pyx_opt_args_5scipy_2io_6matlab_7streams_10FileStream_read_string *__pyx_optional_args) { - int __pyx_v_copy = 1; + int __pyx_v_copy = ((int)1); PyObject *__pyx_v_obj = 0; size_t __pyx_v_n_red; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; int __pyx_t_2; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("read_string"); + __Pyx_RefNannySetupContext("read_string"); if (__pyx_optional_args) { if (__pyx_optional_args->__pyx_n > 0) { __pyx_v_copy = __pyx_optional_args->copy; } } + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":175 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":175 * cdef object read_string(self, size_t n, void **pp, int copy=True): * ''' Make new memory, wrap with object ''' * cdef object obj = pyalloc_v(n, pp) # <<<<<<<<<<<<<< @@ -2194,7 +2238,7 @@ __pyx_v_obj = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":176 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":176 * ''' Make new memory, wrap with object ''' * cdef object obj = pyalloc_v(n, pp) * cdef size_t n_red = fread(pp[0], 1, n, self.file) # <<<<<<<<<<<<<< @@ -2203,7 +2247,7 @@ */ __pyx_v_n_red = fread((__pyx_v_pp[0]), 1, __pyx_v_n, __pyx_v_self->file); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":177 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":177 * cdef object obj = pyalloc_v(n, pp) * cdef size_t n_red = fread(pp[0], 1, n, self.file) * if n_red != n: # <<<<<<<<<<<<<< @@ -2213,7 +2257,7 @@ __pyx_t_2 = (__pyx_v_n_red != __pyx_v_n); if (__pyx_t_2) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":178 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":178 * cdef size_t n_red = fread(pp[0], 1, n, self.file) * if n_red != n: * raise IOError('could not read bytes') # <<<<<<<<<<<<<< @@ -2221,13 +2265,13 @@ * */ __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_7); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_kp_7); - __Pyx_GIVEREF(__pyx_kp_7); - __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_IOError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_Raise(__pyx_t_3, 0, 0); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2235,7 +2279,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":179 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":179 * if n_red != n: * raise IOError('could not read bytes') * return obj # <<<<<<<<<<<<<< @@ -2256,12 +2300,13 @@ __pyx_r = 0; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); + __Pyx_DECREF((PyObject *)__pyx_v_self); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":182 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":182 * * * def _read_into(GenericStream st, size_t n): # <<<<<<<<<<<<<< @@ -2280,8 +2325,8 @@ PyObject *__pyx_t_2 = NULL; char *__pyx_t_3; int __pyx_t_4; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_st,&__pyx_kp_n,0}; - __Pyx_SetupRefcountContext("_read_into"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__st,&__pyx_n_s__n,0}; + __Pyx_RefNannySetupContext("_read_into"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); @@ -2294,11 +2339,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_st); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__st); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_read_into", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -2325,7 +2370,7 @@ __pyx_v_my_str = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_st), __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream, 1, "st", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":185 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":185 * # for testing only. Use st.read instead * cdef char * d_ptr * my_str = ' ' * n # <<<<<<<<<<<<<< @@ -2334,14 +2379,14 @@ */ __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_kp_8, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(((PyObject *)__pyx_kp_s_4), __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_my_str); __pyx_v_my_str = __pyx_t_2; __pyx_t_2 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":186 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":186 * cdef char * d_ptr * my_str = ' ' * n * d_ptr = my_str # <<<<<<<<<<<<<< @@ -2351,7 +2396,7 @@ __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 186; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_v_d_ptr = __pyx_t_3; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":187 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":187 * my_str = ' ' * n * d_ptr = my_str * st.read_into(d_ptr, n) # <<<<<<<<<<<<<< @@ -2360,7 +2405,7 @@ */ __pyx_t_4 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_into(__pyx_v_st, __pyx_v_d_ptr, __pyx_v_n); if (unlikely(__pyx_t_4 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 187; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":188 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":188 * d_ptr = my_str * st.read_into(d_ptr, n) * return my_str # <<<<<<<<<<<<<< @@ -2382,11 +2427,11 @@ __pyx_L0:; __Pyx_DECREF(__pyx_v_my_str); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":191 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":191 * * * def _read_string(GenericStream st, size_t n): # <<<<<<<<<<<<<< @@ -2403,12 +2448,12 @@ PyObject *__pyx_v_my_str; char *__pyx_v_mys_ptr; PyObject *__pyx_r = NULL; - struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_1; PyObject *__pyx_t_1 = NULL; - PyObject *__pyx_t_2 = NULL; - char *__pyx_t_3; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_st,&__pyx_kp_n,0}; - __Pyx_SetupRefcountContext("_read_string"); + struct __pyx_opt_args_5scipy_2io_6matlab_7streams_13GenericStream_read_string __pyx_t_2; + PyObject *__pyx_t_3 = NULL; + char *__pyx_t_4; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__st,&__pyx_n_s__n,0}; + __Pyx_RefNannySetupContext("_read_string"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); @@ -2421,11 +2466,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_st); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__st); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("_read_string", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -2452,21 +2497,21 @@ __pyx_v_my_str = Py_None; __Pyx_INCREF(Py_None); if (unlikely(!__Pyx_ArgTypeTest(((PyObject *)__pyx_v_st), __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream, 1, "st", 0))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 191; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":194 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":194 * # for testing only. Use st.read instead * cdef char *d_ptr * cdef object obj = st.read_string(n, &d_ptr, True) # <<<<<<<<<<<<<< * my_str = 'A' * n * cdef char *mys_ptr = my_str */ - __pyx_1.__pyx_n = 1; - __pyx_1.copy = 1; - __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_string(__pyx_v_st, __pyx_v_n, ((void **)(&__pyx_v_d_ptr)), &__pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2.__pyx_n = 1; + __pyx_t_2.copy = 1; + __pyx_t_1 = ((struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_v_st->__pyx_vtab)->read_string(__pyx_v_st, __pyx_v_n, ((void **)(&__pyx_v_d_ptr)), &__pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __pyx_v_obj = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":195 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":195 * cdef char *d_ptr * cdef object obj = st.read_string(n, &d_ptr, True) * my_str = 'A' * n # <<<<<<<<<<<<<< @@ -2475,24 +2520,24 @@ */ __pyx_t_1 = __Pyx_PyInt_FromSize_t(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Multiply(__pyx_kp_9, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Multiply(((PyObject *)__pyx_n_s__A), __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_my_str); - __pyx_v_my_str = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_v_my_str = __pyx_t_3; + __pyx_t_3 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":196 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":196 * cdef object obj = st.read_string(n, &d_ptr, True) * my_str = 'A' * n * cdef char *mys_ptr = my_str # <<<<<<<<<<<<<< * memcpy(mys_ptr, d_ptr, n) * return my_str */ - __pyx_t_3 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_3) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_v_mys_ptr = __pyx_t_3; + __pyx_t_4 = __Pyx_PyBytes_AsString(__pyx_v_my_str); if (unlikely((!__pyx_t_4) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_mys_ptr = __pyx_t_4; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":197 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":197 * my_str = 'A' * n * cdef char *mys_ptr = my_str * memcpy(mys_ptr, d_ptr, n) # <<<<<<<<<<<<<< @@ -2501,7 +2546,7 @@ */ memcpy(__pyx_v_mys_ptr, __pyx_v_d_ptr, __pyx_v_n); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":198 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":198 * cdef char *mys_ptr = my_str * memcpy(mys_ptr, d_ptr, n) * return my_str # <<<<<<<<<<<<<< @@ -2517,18 +2562,18 @@ goto __pyx_L0; __pyx_L1_error:; __Pyx_XDECREF(__pyx_t_1); - __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.io.matlab.streams._read_string"); __pyx_r = NULL; __pyx_L0:; __Pyx_XDECREF(__pyx_v_obj); __Pyx_DECREF(__pyx_v_my_str); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":201 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":201 * * * cpdef GenericStream make_stream(object fobj): # <<<<<<<<<<<<<< @@ -2542,9 +2587,12 @@ int __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - __Pyx_SetupRefcountContext("make_stream"); + int __pyx_t_4; + int __pyx_t_5; + __Pyx_RefNannySetupContext("make_stream"); + __Pyx_INCREF(__pyx_v_fobj); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":204 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":204 * ''' Make stream of correct type for file-like `fobj` * ''' * if isinstance(fobj, file): # <<<<<<<<<<<<<< @@ -2554,7 +2602,7 @@ __pyx_t_1 = PyObject_TypeCheck(__pyx_v_fobj, ((PyTypeObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_file))); if (__pyx_t_1) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":205 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":205 * ''' * if isinstance(fobj, file): * return FileStream(fobj) # <<<<<<<<<<<<<< @@ -2563,35 +2611,36 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_FileStream)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_FileStream)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; goto __pyx_L3; } - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":206 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":206 * if isinstance(fobj, file): * return FileStream(fobj) * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): # <<<<<<<<<<<<<< * return cStringStream(fobj) * return GenericStream(fobj) */ - if (!PycStringIO_InputCheck(__pyx_v_fobj)) { - __pyx_t_1 = PycStringIO_OutputCheck(__pyx_v_fobj); + __pyx_t_1 = PycStringIO_InputCheck(__pyx_v_fobj); + if (!__pyx_t_1) { + __pyx_t_4 = PycStringIO_OutputCheck(__pyx_v_fobj); + __pyx_t_5 = __pyx_t_4; } else { - __pyx_t_1 = PycStringIO_InputCheck(__pyx_v_fobj); + __pyx_t_5 = __pyx_t_1; } - if (__pyx_t_1) { + if (__pyx_t_5) { - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":207 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":207 * return FileStream(fobj) * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): * return cStringStream(fobj) # <<<<<<<<<<<<<< @@ -2600,14 +2649,13 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_cStringStream)), ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_cStringStream)), __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - if (!(__Pyx_TypeTest(__pyx_t_2, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 207; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; @@ -2615,7 +2663,7 @@ } __pyx_L3:; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":208 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":208 * elif PycStringIO_InputCheck(fobj) or PycStringIO_OutputCheck(fobj): * return cStringStream(fobj) * return GenericStream(fobj) # <<<<<<<<<<<<<< @@ -2624,14 +2672,13 @@ */ __Pyx_XDECREF(((PyObject *)__pyx_r)); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_fobj); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_fobj); __Pyx_GIVEREF(__pyx_v_fobj); - __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)), ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(((PyObject *)((PyObject*)__pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream)), __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - if (!(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 208; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = ((struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *)__pyx_t_3); __pyx_t_3 = 0; goto __pyx_L0; @@ -2644,12 +2691,13 @@ __Pyx_AddTraceback("scipy.io.matlab.streams.make_stream"); __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF(__pyx_v_fobj); __Pyx_XGIVEREF((PyObject *)__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":201 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":201 * * * cpdef GenericStream make_stream(object fobj): # <<<<<<<<<<<<<< @@ -2662,7 +2710,7 @@ static PyObject *__pyx_pf_5scipy_2io_6matlab_7streams_make_stream(PyObject *__pyx_self, PyObject *__pyx_v_fobj) { PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("make_stream"); + __Pyx_RefNannySetupContext("make_stream"); __pyx_self = __pyx_self; __Pyx_XDECREF(__pyx_r); __pyx_t_1 = ((PyObject *)__pyx_f_5scipy_2io_6matlab_7streams_make_stream(__pyx_v_fobj, 0)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 201; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -2679,11 +2727,11 @@ __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":8 +/* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":8 * * # Function to allocate, wrap memory via Python string creation * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): # <<<<<<<<<<<<<< @@ -2691,13 +2739,13 @@ * pp[0] = PyString_AS_STRING(ob) */ -static INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t __pyx_v_n, void **__pyx_v_pp) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_2io_6matlab_7pyalloc_pyalloc_v(Py_ssize_t __pyx_v_n, void **__pyx_v_pp) { PyObject *__pyx_v_ob = 0; PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - __Pyx_SetupRefcountContext("pyalloc_v"); + __Pyx_RefNannySetupContext("pyalloc_v"); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":9 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":9 * # Function to allocate, wrap memory via Python string creation * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): * cdef object ob = PyString_FromStringAndSize(NULL, n) # <<<<<<<<<<<<<< @@ -2709,7 +2757,7 @@ __pyx_v_ob = __pyx_t_1; __pyx_t_1 = 0; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":10 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":10 * cdef inline object pyalloc_v(Py_ssize_t n, void **pp): * cdef object ob = PyString_FromStringAndSize(NULL, n) * pp[0] = PyString_AS_STRING(ob) # <<<<<<<<<<<<<< @@ -2718,7 +2766,7 @@ */ (__pyx_v_pp[0]) = ((void *)PyString_AS_STRING(__pyx_v_ob)); - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/pyalloc.pxd":11 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/pyalloc.pxd":11 * cdef object ob = PyString_FromStringAndSize(NULL, n) * pp[0] = PyString_AS_STRING(ob) * return ob # <<<<<<<<<<<<<< @@ -2739,7 +2787,7 @@ __pyx_L0:; __Pyx_XDECREF(__pyx_v_ob); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_GenericStream __pyx_vtable_5scipy_2io_6matlab_7streams_GenericStream; @@ -2929,6 +2977,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_cStringStream __pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream; @@ -3090,6 +3142,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct __pyx_vtabstruct_5scipy_2io_6matlab_7streams_FileStream __pyx_vtable_5scipy_2io_6matlab_7streams_FileStream; @@ -3252,6 +3308,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -3278,32 +3338,28 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, - {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp_seek, __pyx_k_seek, sizeof(__pyx_k_seek), 1, 1, 1}, - {&__pyx_kp_tell, __pyx_k_tell, sizeof(__pyx_k_tell), 1, 1, 1}, - {&__pyx_kp_read, __pyx_k_read, sizeof(__pyx_k_read), 1, 1, 1}, - {&__pyx_kp_make_stream, __pyx_k_make_stream, sizeof(__pyx_k_make_stream), 1, 1, 1}, - {&__pyx_kp_fobj, __pyx_k_fobj, sizeof(__pyx_k_fobj), 1, 1, 1}, - {&__pyx_kp_offset, __pyx_k_offset, sizeof(__pyx_k_offset), 1, 1, 1}, - {&__pyx_kp_whence, __pyx_k_whence, sizeof(__pyx_k_whence), 1, 1, 1}, - {&__pyx_kp_n_bytes, __pyx_k_n_bytes, sizeof(__pyx_k_n_bytes), 1, 1, 1}, - {&__pyx_kp_st, __pyx_k_st, sizeof(__pyx_k_st), 1, 1, 1}, - {&__pyx_kp_n, __pyx_k_n, sizeof(__pyx_k_n), 1, 1, 1}, - {&__pyx_kp_IOError, __pyx_k_IOError, sizeof(__pyx_k_IOError), 1, 1, 1}, - {&__pyx_kp_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 0}, - {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 0}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 0}, - {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 0}, - {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 0, 0}, - {&__pyx_kp_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_kp_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 0}, + {&__pyx_kp_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 0}, + {&__pyx_n_s__A, __pyx_k__A, sizeof(__pyx_k__A), 0, 0, 1, 1}, + {&__pyx_n_s__IOError, __pyx_k__IOError, sizeof(__pyx_k__IOError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s__file, __pyx_k__file, sizeof(__pyx_k__file), 0, 0, 1, 1}, + {&__pyx_n_s__fobj, __pyx_k__fobj, sizeof(__pyx_k__fobj), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__offset, __pyx_k__offset, sizeof(__pyx_k__offset), 0, 0, 1, 1}, + {&__pyx_n_s__read, __pyx_k__read, sizeof(__pyx_k__read), 0, 0, 1, 1}, + {&__pyx_n_s__read_into, __pyx_k__read_into, sizeof(__pyx_k__read_into), 0, 0, 1, 1}, + {&__pyx_n_s__read_string, __pyx_k__read_string, sizeof(__pyx_k__read_string), 0, 0, 1, 1}, + {&__pyx_n_s__seek, __pyx_k__seek, sizeof(__pyx_k__seek), 0, 0, 1, 1}, + {&__pyx_n_s__st, __pyx_k__st, sizeof(__pyx_k__st), 0, 0, 1, 1}, + {&__pyx_n_s__tell, __pyx_k__tell, sizeof(__pyx_k__tell), 0, 0, 1, 1}, + {&__pyx_n_s__whence, __pyx_k__whence, sizeof(__pyx_k__whence), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_kp_IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_IOError = __Pyx_GetName(__pyx_b, __pyx_n_s__IOError); if (!__pyx_builtin_IOError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; @@ -3324,19 +3380,18 @@ PyMODINIT_FUNC PyInit_streams(void) #endif { - PyObject *__pyx_1 = 0; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { PyErr_Clear(); - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("Cython.Runtime.refnanny"); - if (!__Pyx_Refnanny) - Py_FatalError("failed to import refnanny module"); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); } - __pyx_refchk = __Pyx_Refnanny->NewContext("PyMODINIT_FUNC PyInit_streams(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_streams(void)", __LINE__, __FILE__); #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} #if PY_MAJOR_VERSION < 3 __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3363,14 +3418,13 @@ __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__pyx_module_is_main_scipy__io__matlab__streams) { - if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_kp___main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; } - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ if (__Pyx_ExportFunction("make_stream", (void (*)(void))__pyx_f_5scipy_2io_6matlab_7streams_make_stream, "struct __pyx_obj_5scipy_2io_6matlab_7streams_GenericStream *(PyObject *, int __pyx_skip_dispatch)") < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} @@ -3391,7 +3445,7 @@ if (__Pyx_SetVtable(__pyx_type_5scipy_2io_6matlab_7streams_GenericStream.tp_dict, __pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetAttrString(__pyx_m, "GenericStream", (PyObject *)&__pyx_type_5scipy_2io_6matlab_7streams_GenericStream) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_2io_6matlab_7streams_GenericStream = &__pyx_type_5scipy_2io_6matlab_7streams_GenericStream; - __pyx_ptype_5scipy_2io_6matlab_7streams_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject)); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_file)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5scipy_2io_6matlab_7streams_file = __Pyx_ImportType(__Pyx_BUILTIN_MODULE_NAME, "file", sizeof(PyFileObject), 0); if (unlikely(!__pyx_ptype_5scipy_2io_6matlab_7streams_file)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_vtabptr_5scipy_2io_6matlab_7streams_cStringStream = &__pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream; __pyx_vtable_5scipy_2io_6matlab_7streams_cStringStream.__pyx_base = *__pyx_vtabptr_5scipy_2io_6matlab_7streams_GenericStream; #if PY_MAJOR_VERSION >= 3 @@ -3430,7 +3484,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pyx":44 * * # initialize cStringIO * PycString_IMPORT # <<<<<<<<<<<<<< @@ -3439,14 +3493,13 @@ */ PycString_IMPORT; - /* "/Users/mb312/scipybuild/scipy/scipy/io/matlab/streams.pxd":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/io/matlab/streams.pxd":1 * # -*- python -*- or rather like # <<<<<<<<<<<<<< * * cdef class GenericStream: */ goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); if (__pyx_m) { __Pyx_AddTraceback("init scipy.io.matlab.streams"); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -3454,7 +3507,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.io.matlab.streams"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -3595,18 +3648,6 @@ return -1; } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; - } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} - static int __Pyx_ArgTypeTest(PyObject *obj, PyTypeObject *type, int none_allowed, const char *name, int exact) { @@ -3635,6 +3676,34 @@ return result; } +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); + + tmp_type = tstate->curexc_type; + tmp_value = tstate->curexc_value; + tmp_tb = tstate->curexc_traceback; + tstate->curexc_type = type; + tstate->curexc_value = value; + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_type); + Py_XDECREF(tmp_value); + Py_XDECREF(tmp_tb); +} + +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { + PyThreadState *tstate = PyThreadState_GET(); + *type = tstate->curexc_type; + *value = tstate->curexc_value; + *tb = tstate->curexc_traceback; + + tstate->curexc_type = 0; + tstate->curexc_value = 0; + tstate->curexc_traceback = 0; +} + + +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3690,6 +3759,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3699,57 +3769,59 @@ return; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); +#else /* Python 3+ */ -#if PY_MAJOR_VERSION >= 3 - /* Note: this is a temporary work-around to prevent crashes in Python 3.0 */ - if ((tstate->exc_type != NULL) & (tstate->exc_type != Py_None)) { - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - PyErr_NormalizeException(&type, &value, &tb); - PyErr_NormalizeException(&tmp_type, &tmp_value, &tmp_tb); - tstate->exc_type = 0; - tstate->exc_value = 0; - tstate->exc_traceback = 0; - PyException_SetContext(value, tmp_value); - Py_DECREF(tmp_type); - Py_XDECREF(tmp_tb); +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; } -#endif + if (value == Py_None) + value = 0; - tmp_type = tstate->curexc_type; - tmp_value = tstate->curexc_value; - tmp_tb = tstate->curexc_traceback; - tstate->curexc_type = type; - tstate->curexc_value = value; - tstate->curexc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->curexc_type; - *value = tstate->curexc_value; - *tb = tstate->curexc_traceback; + PyErr_SetObject(type, value); - tstate->curexc_type = 0; - tstate->curexc_value = 0; - tstate->curexc_traceback = 0; + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif - -static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned char)-1) > ((unsigned char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned char" : "value too large to convert to unsigned char"); } @@ -3760,13 +3832,15 @@ return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned short)-1) > ((unsigned short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned short" : "value too large to convert to unsigned short"); } @@ -3777,13 +3851,15 @@ return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(unsigned int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(unsigned int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((unsigned int)-1) > ((unsigned int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to unsigned int" : "value too large to convert to unsigned int"); } @@ -3794,13 +3870,15 @@ return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE char __Pyx_PyInt_AsChar(PyObject* x) { +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((char)-1) > ((char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to char" : "value too large to convert to char"); } @@ -3811,13 +3889,15 @@ return (char)__Pyx_PyInt_AsLong(x); } -static INLINE short __Pyx_PyInt_AsShort(PyObject* x) { +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((short)-1) > ((short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to short" : "value too large to convert to short"); } @@ -3828,13 +3908,15 @@ return (short)__Pyx_PyInt_AsLong(x); } -static INLINE int __Pyx_PyInt_AsInt(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((int)-1) > ((int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to int" : "value too large to convert to int"); } @@ -3845,13 +3927,15 @@ return (int)__Pyx_PyInt_AsLong(x); } -static INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed char) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed char)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed char)-1) > ((signed char)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed char" : "value too large to convert to signed char"); } @@ -3862,13 +3946,15 @@ return (signed char)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed short) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed short)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed short)-1) > ((signed short)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed short" : "value too large to convert to signed short"); } @@ -3879,13 +3965,15 @@ return (signed short)__Pyx_PyInt_AsSignedLong(x); } -static INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; if (sizeof(signed int) < sizeof(long)) { long val = __Pyx_PyInt_AsLong(x); if (unlikely(val != (long)(signed int)val)) { if (!unlikely(val == -1 && PyErr_Occurred())) { PyErr_SetString(PyExc_OverflowError, - (((signed int)-1) > ((signed int)0) && unlikely(val < 0)) ? + (is_unsigned && unlikely(val < 0)) ? "can't convert negative value to signed int" : "value too large to convert to signed int"); } @@ -3896,11 +3984,13 @@ return (signed int)__Pyx_PyInt_AsSignedLong(x); } -static INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned long"); return (unsigned long)-1; @@ -3909,14 +3999,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned long)-1) > ((unsigned long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned long"); - return (unsigned long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((unsigned long)-1) < ((unsigned long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { unsigned long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3927,11 +4019,13 @@ } } -static INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to unsigned PY_LONG_LONG"); return (unsigned PY_LONG_LONG)-1; @@ -3940,14 +4034,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((unsigned PY_LONG_LONG)-1) > ((unsigned PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to unsigned PY_LONG_LONG"); - return (unsigned PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((unsigned PY_LONG_LONG)-1) < ((unsigned PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { unsigned PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3958,11 +4054,13 @@ } } -static INLINE long __Pyx_PyInt_AsLong(PyObject* x) { +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((long)-1) > ((long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to long"); return (long)-1; @@ -3971,14 +4069,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((long)-1) > ((long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to long"); - return (long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((long)-1) < ((long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -3989,11 +4089,13 @@ } } -static INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to PY_LONG_LONG"); return (PY_LONG_LONG)-1; @@ -4002,14 +4104,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((PY_LONG_LONG)-1) > ((PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to PY_LONG_LONG"); - return (PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((PY_LONG_LONG)-1) < ((PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4020,11 +4124,13 @@ } } -static INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed long)-1) > ((signed long)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed long"); return (signed long)-1; @@ -4033,14 +4139,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed long)-1) > ((signed long)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed long"); - return (signed long)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); } - return (((signed long)-1) < ((signed long)0)) ? - PyLong_AsLong(x) : - PyLong_AsUnsignedLong(x); } else { signed long val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4051,11 +4159,13 @@ } } -static INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; #if PY_VERSION_HEX < 0x03000000 if (likely(PyInt_Check(x))) { long val = PyInt_AS_LONG(x); - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(val < 0)) { + if (is_unsigned && unlikely(val < 0)) { PyErr_SetString(PyExc_OverflowError, "can't convert negative value to signed PY_LONG_LONG"); return (signed PY_LONG_LONG)-1; @@ -4064,14 +4174,16 @@ } else #endif if (likely(PyLong_Check(x))) { - if (((signed PY_LONG_LONG)-1) > ((signed PY_LONG_LONG)0) && unlikely(Py_SIZE(x) < 0)) { - PyErr_SetString(PyExc_OverflowError, - "can't convert negative value to signed PY_LONG_LONG"); - return (signed PY_LONG_LONG)-1; + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); } - return (((signed PY_LONG_LONG)-1) < ((signed PY_LONG_LONG)0)) ? - PyLong_AsLongLong(x) : - PyLong_AsUnsignedLongLong(x); } else { signed PY_LONG_LONG val; PyObject *tmp = __Pyx_PyNumber_Int(x); @@ -4083,11 +4195,6 @@ } static int __Pyx_ExportFunction(const char *name, void (*f)(void), const char *sig) { -#if PY_VERSION_HEX < 0x02050000 - char *api = (char *)"__pyx_capi__"; -#else - const char *api = "__pyx_capi__"; -#endif PyObject *d = 0; PyObject *cobj = 0; union { @@ -4095,19 +4202,22 @@ void *p; } tmp; - - d = PyObject_GetAttrString(__pyx_m, api); + d = PyObject_GetAttrString(__pyx_m, (char *)"__pyx_capi__"); if (!d) { PyErr_Clear(); d = PyDict_New(); if (!d) goto bad; Py_INCREF(d); - if (PyModule_AddObject(__pyx_m, api, d) < 0) + if (PyModule_AddObject(__pyx_m, (char *)"__pyx_capi__", d) < 0) goto bad; } tmp.fp = f; +#if PY_VERSION_HEX < 0x03010000 cobj = PyCObject_FromVoidPtrAndDesc(tmp.p, (void *)sig, 0); +#else + cobj = PyCapsule_New(tmp.p, sig, 0); +#endif if (!cobj) goto bad; if (PyDict_SetItemString(d, name, cobj) < 0) @@ -4122,32 +4232,31 @@ } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -4172,9 +4281,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -4281,7 +4396,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -4289,10 +4404,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -4306,13 +4425,13 @@ /* Type Conversion Functions */ -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { PyNumberMethods *m; const char *name = NULL; PyObject *res = NULL; @@ -4358,7 +4477,7 @@ return res; } -static INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { Py_ssize_t ival; PyObject* x = PyNumber_Index(b); if (!x) return -1; @@ -4367,7 +4486,7 @@ return ival; } -static INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { #if PY_VERSION_HEX < 0x02050000 if (ival <= LONG_MAX) return PyInt_FromLong((long)ival); @@ -4381,7 +4500,7 @@ #endif } -static INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { return (size_t)-1; Modified: branches/0.8.x/scipy/spatial/ckdtree.c =================================================================== --- branches/0.8.x/scipy/spatial/ckdtree.c 2010-06-16 16:37:26 UTC (rev 6511) +++ branches/0.8.x/scipy/spatial/ckdtree.c 2010-06-16 16:43:41 UTC (rev 6512) @@ -1,8 +1,12 @@ -/* Generated by Cython 0.10.3 on Thu Mar 12 23:38:09 2009 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:42:36 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -11,16 +15,22 @@ #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -30,22 +40,21 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 - #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -55,21 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -84,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -98,9 +122,30 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -109,54 +154,111 @@ #include #define __PYX_HAVE_API__scipy__spatial__ckdtree #include "stdlib.h" +#include "stdio.h" #include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif +#endif -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define INLINE +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif -static int __pyx_skip_dispatch = 0; +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif -/* Type Conversion Predeclarations */ +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) #endif +#endif -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -174,103 +276,37 @@ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; -static void __Pyx_RaiseDoubleKeywordsError( - const char* func_name, PyObject* kw_name); /*proto*/ -static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, - Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif -static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static const char* __Pyx_DescribeTokenInFormatString(const char* ts); /*proto*/ -static const char* __Pyx_CheckTypestring_double(const char* ts); /*proto*/ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ - -static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ -static const char* __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ - -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { - PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { - r = PyList_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { - r = PyTuple_GET_ITEM(o, i); - Py_INCREF(r); - } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) - r = PySequence_GetItem(o, i); - else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); - } - return r; -} -static const char* __Pyx_CheckTypestring_int(const char* ts); /*proto*/ - -static int __Pyx_GetBuffer_int(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ -static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ -#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) -#if PY_MAJOR_VERSION < 3 -static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); -static void __Pyx_ReleaseBuffer(Py_buffer *view); -#else -#define __Pyx_GetBuffer PyObject_GetBuffer -#define __Pyx_ReleaseBuffer PyBuffer_Release +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj #endif -Py_ssize_t __Pyx_zeros[] = {0, 0}; -Py_ssize_t __Pyx_minusones[] = {-1, -1}; - -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ - -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ - -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ - -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ - -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ - -static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ - -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ - -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ - -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ - -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - -/* Type declarations */ - typedef npy_int8 __pyx_t_5numpy_int8_t; typedef npy_int16 __pyx_t_5numpy_int16_t; @@ -295,6 +331,10 @@ typedef npy_longlong __pyx_t_5numpy_long_t; +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + typedef npy_ulong __pyx_t_5numpy_uint_t; typedef npy_ulonglong __pyx_t_5numpy_ulong_t; @@ -305,13 +345,37 @@ typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + typedef npy_cfloat __pyx_t_5numpy_cfloat_t; typedef npy_cdouble __pyx_t_5numpy_cdouble_t; typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":15 +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":15 * * # priority queue * cdef union heapcontents: # <<<<<<<<<<<<<< @@ -324,7 +388,7 @@ char *ptrdata; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":19 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":19 * char* ptrdata * * cdef struct heapitem: # <<<<<<<<<<<<<< @@ -337,7 +401,7 @@ union __pyx_t_5scipy_7spatial_7ckdtree_heapcontents contents; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":23 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":23 * heapcontents contents * * cdef struct heap: # <<<<<<<<<<<<<< @@ -351,7 +415,7 @@ int space; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":139 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":139 * * # Tree structure * cdef struct innernode: # <<<<<<<<<<<<<< @@ -367,7 +431,7 @@ struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *greater; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":145 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":145 * innernode* less * innernode* greater * cdef struct leafnode: # <<<<<<<<<<<<<< @@ -382,7 +446,7 @@ int end_idx; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":153 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":153 * # this is the standard trick for variable-size arrays: * # malloc sizeof(nodeinfo)+self.m*sizeof(double) bytes. * cdef struct nodeinfo: # <<<<<<<<<<<<<< @@ -395,7 +459,7 @@ double side_distances[0]; }; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":157 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":157 * double side_distances[0] * * cdef class cKDTree: # <<<<<<<<<<<<<< @@ -427,157 +491,569 @@ void (*__query)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, double *, int *, double *, int, double, double, double); }; static struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *__pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + +static CYTHON_INLINE long __Pyx_div_long(long, long); /* proto */ + +static void __Pyx_RaiseDoubleKeywordsError( + const char* func_name, PyObject* kw_name); /*proto*/ + +static void __Pyx_RaiseArgtupleInvalid(const char* func_name, int exact, + Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ + +static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); + +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + +static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { + PyObject *r; + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { + r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + } + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { + r = PySequence_GetItem(o, i); + } + else { + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); + } + return r; +} +static void __Pyx_RaiseBufferIndexError(int axis); /*proto*/ +#define __Pyx_BufPtrStrided2d(type, buf, i0, s0, i1, s1) (type)((char*)buf + i0 * s0 + i1 * s1) + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ +#if PY_MAJOR_VERSION < 3 +static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); +static void __Pyx_ReleaseBuffer(Py_buffer *view); +#else +#define __Pyx_GetBuffer PyObject_GetBuffer +#define __Pyx_ReleaseBuffer PyBuffer_Release +#endif + +Py_ssize_t __Pyx_zeros[] = {0, 0}; +Py_ssize_t __Pyx_minusones[] = {-1, -1}; + +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ + +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif + +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif + +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif + +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); + +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); + +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); + +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ + +static int __Pyx_SetVtable(PyObject *dict, void *vtable); /*proto*/ + +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ + +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ + +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ + +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ /* Module declarations from python_buffer */ +/* Module declarations from python_ref */ + /* Module declarations from stdlib */ +/* Module declarations from stdio */ + /* Module declarations from numpy */ /* Module declarations from numpy */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from scipy.spatial.ckdtree */ static PyTypeObject *__pyx_ptype_5scipy_7spatial_7ckdtree_cKDTree = 0; static double __pyx_v_5scipy_7spatial_7ckdtree_infinity; -static double __pyx_k_24; -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ -static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, int); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem); /*proto*/ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappeek(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapremove(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappop(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double, double); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double); /*proto*/ -static double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *, double *, double, int, double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double, double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double); /*proto*/ +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *, double *, double, int, double); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), 'R' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t = { "numpy.int32_t", NULL, sizeof(__pyx_t_5numpy_int32_t), 'I' }; +static __Pyx_TypeInfo __Pyx_TypeInfo_int = { "int", NULL, sizeof(int), 'I' }; +#define __Pyx_MODULE_NAME "scipy.spatial.ckdtree" +int __pyx_module_is_main_scipy__spatial__ckdtree = 0; - /* Implementation of scipy.spatial.ckdtree */ -static PyObject *__pyx_int_0; -static char __pyx_k___init__[] = "__init__"; -static PyObject *__pyx_kp___init__; -static char __pyx_k___dealloc__[] = "__dealloc__"; -static PyObject *__pyx_kp___dealloc__; -static char __pyx_k_query[] = "query"; -static PyObject *__pyx_kp_query; -static char __pyx_k_data[] = "data"; -static PyObject *__pyx_kp_data; -static char __pyx_k_leafsize[] = "leafsize"; -static PyObject *__pyx_kp_leafsize; -static char __pyx_k_x[] = "x"; -static PyObject *__pyx_kp_x; -static char __pyx_k_k[] = "k"; -static PyObject *__pyx_kp_k; -static char __pyx_k_eps[] = "eps"; -static PyObject *__pyx_kp_eps; -static char __pyx_k_p[] = "p"; -static PyObject *__pyx_kp_p; -static char __pyx_k_23[] = "distance_upper_bound"; -static PyObject *__pyx_kp_23; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_kdtree[] = "kdtree"; -static PyObject *__pyx_kp_kdtree; -static char __pyx_k_inf[] = "inf"; -static PyObject *__pyx_kp_inf; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_ascontiguousarray[] = "ascontiguousarray"; -static PyObject *__pyx_kp_ascontiguousarray; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_float[] = "float"; -static PyObject *__pyx_kp_float; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; -static char __pyx_k_amax[] = "amax"; -static PyObject *__pyx_kp_amax; -static char __pyx_k_axis[] = "axis"; -static PyObject *__pyx_kp_axis; -static char __pyx_k_amin[] = "amin"; -static PyObject *__pyx_kp_amin; -static char __pyx_k_arange[] = "arange"; -static PyObject *__pyx_kp_arange; -static char __pyx_k_27[] = "int32"; -static PyObject *__pyx_kp_27; -static char __pyx_k_asarray[] = "asarray"; -static PyObject *__pyx_kp_asarray; -static char __pyx_k_astype[] = "astype"; -static PyObject *__pyx_kp_astype; -static char __pyx_k_newaxis[] = "newaxis"; -static PyObject *__pyx_kp_newaxis; -static char __pyx_k_prod[] = "prod"; -static PyObject *__pyx_kp_prod; -static char __pyx_k_reshape[] = "reshape"; -static PyObject *__pyx_kp_reshape; -static char __pyx_k_empty[] = "empty"; -static PyObject *__pyx_kp_empty; -static char __pyx_k_fill[] = "fill"; -static PyObject *__pyx_kp_fill; -static char __pyx_k_30[] = "i"; -static PyObject *__pyx_kp_30; static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_kp_25; -static char __pyx_k_25[] = "Heap containing %d items cannot be resized to %d"; -static PyObject *__pyx_kp_26; -static char __pyx_k_26[] = "leafsize must be at least 1"; -static PyObject *__pyx_kp_28; -static PyObject *__pyx_kp_29; -static char __pyx_k_28[] = "x must consist of vectors of length %d but has shape %s"; -static char __pyx_k_29[] = "Only p-norms with 1<=p<=infinity permitted"; -static char __pyx_k___getbuffer__[] = "__getbuffer__"; -static PyObject *__pyx_kp___getbuffer__; -static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; -static PyObject *__pyx_kp___releasebuffer__; -static char __pyx_k_info[] = "info"; -static PyObject *__pyx_kp_info; -static char __pyx_k_flags[] = "flags"; -static PyObject *__pyx_kp_flags; -static char __pyx_k_iteritems[] = "iteritems"; -static PyObject *__pyx_kp_iteritems; -static char __pyx_k_next[] = "next"; -static PyObject *__pyx_kp_next; -static char __pyx_k_StopIteration[] = "StopIteration"; -static PyObject *__pyx_kp_StopIteration; -static char __pyx_k_pop[] = "pop"; -static PyObject *__pyx_kp_pop; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_RuntimeError; -static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_2; -static PyObject *__pyx_kp_20; -static PyObject *__pyx_kp_21; -static PyObject *__pyx_kp_22; -static PyObject *__pyx_builtin_StopIteration; +static PyObject *__pyx_builtin_range; static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "b"; -static char __pyx_k_4[] = "B"; -static char __pyx_k_5[] = "h"; -static char __pyx_k_6[] = "H"; -static char __pyx_k_7[] = "i"; -static char __pyx_k_8[] = "I"; -static char __pyx_k_9[] = "l"; -static char __pyx_k_10[] = "L"; -static char __pyx_k_11[] = "q"; -static char __pyx_k_12[] = "Q"; -static char __pyx_k_13[] = "f"; -static char __pyx_k_14[] = "d"; -static char __pyx_k_15[] = "g"; -static char __pyx_k_16[] = "Zf"; -static char __pyx_k_17[] = "Zd"; -static char __pyx_k_18[] = "Zg"; -static char __pyx_k_19[] = "O"; -static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_21[] = "Format string allocated too short."; -static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_1[] = "Heap containing %d items cannot be resized to %d"; +static char __pyx_k_2[] = "leafsize must be at least 1"; +static char __pyx_k_3[] = "distance_upper_bound"; +static char __pyx_k_5[] = "x must consist of vectors of length %d but has shape %s"; +static char __pyx_k_6[] = "Only p-norms with 1<=p<=infinity permitted"; +static char __pyx_k_7[] = "ndarray is not C contiguous"; +static char __pyx_k_8[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_9[] = "Non-native byte order not supported"; +static char __pyx_k_10[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_11[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_12[] = "Format string allocated too short."; +static char __pyx_k_13[] = "cKDTree.__init__ (line 195)"; +static char __pyx_k_14[] = "cKDTree.query (line 516)"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__k[] = "k"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__m[] = "m"; +static char __pyx_k__n[] = "n"; +static char __pyx_k__p[] = "p"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__eps[] = "eps"; +static char __pyx_k__inf[] = "inf"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__amax[] = "amax"; +static char __pyx_k__amin[] = "amin"; +static char __pyx_k__axis[] = "axis"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__data[] = "data"; +static char __pyx_k__fill[] = "fill"; +static char __pyx_k__heap[] = "heap"; +static char __pyx_k__less[] = "less"; +static char __pyx_k__mins[] = "mins"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__node[] = "node"; +static char __pyx_k__prod[] = "prod"; +static char __pyx_k__tree[] = "tree"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__int32[] = "int32"; +static char __pyx_k__maxes[] = "maxes"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__query[] = "query"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__space[] = "space"; +static char __pyx_k__split[] = "split"; +static char __pyx_k__arange[] = "arange"; +static char __pyx_k__astype[] = "astype"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__kdtree[] = "kdtree"; +static char __pyx_k____build[] = "__build"; +static char __pyx_k____query[] = "__query"; +static char __pyx_k__asarray[] = "asarray"; +static char __pyx_k__cKDTree[] = "cKDTree"; +static char __pyx_k__end_idx[] = "end_idx"; +static char __pyx_k__greater[] = "greater"; +static char __pyx_k__indices[] = "indices"; +static char __pyx_k__intdata[] = "intdata"; +static char __pyx_k__newaxis[] = "newaxis"; +static char __pyx_k__ptrdata[] = "ptrdata"; +static char __pyx_k__reshape[] = "reshape"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____init__[] = "__init__"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__contents[] = "contents"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__leafsize[] = "leafsize"; +static char __pyx_k__priority[] = "priority"; +static char __pyx_k__raw_data[] = "raw_data"; +static char __pyx_k__raw_mins[] = "raw_mins"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__raw_maxes[] = "raw_maxes"; +static char __pyx_k__split_dim[] = "split_dim"; +static char __pyx_k__start_idx[] = "start_idx"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k____free_tree[] = "__free_tree"; +static char __pyx_k__raw_indices[] = "raw_indices"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__side_distances[] = "side_distances"; +static char __pyx_k__ascontiguousarray[] = "ascontiguousarray"; +static PyObject *__pyx_kp_s_1; +static PyObject *__pyx_kp_u_10; +static PyObject *__pyx_kp_u_11; +static PyObject *__pyx_kp_u_12; +static PyObject *__pyx_kp_u_13; +static PyObject *__pyx_kp_u_14; +static PyObject *__pyx_kp_s_2; +static PyObject *__pyx_n_s_3; +static PyObject *__pyx_kp_s_5; +static PyObject *__pyx_kp_s_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_kp_u_8; +static PyObject *__pyx_kp_u_9; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____build; +static PyObject *__pyx_n_s____free_tree; +static PyObject *__pyx_n_s____init__; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____query; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__amax; +static PyObject *__pyx_n_s__amin; +static PyObject *__pyx_n_s__arange; +static PyObject *__pyx_n_s__asarray; +static PyObject *__pyx_n_s__ascontiguousarray; +static PyObject *__pyx_n_s__astype; +static PyObject *__pyx_n_s__axis; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__cKDTree; +static PyObject *__pyx_n_s__contents; +static PyObject *__pyx_n_s__data; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__end_idx; +static PyObject *__pyx_n_s__eps; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__fill; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__greater; +static PyObject *__pyx_n_s__heap; +static PyObject *__pyx_n_s__i; +static PyObject *__pyx_n_s__indices; +static PyObject *__pyx_n_s__inf; +static PyObject *__pyx_n_s__int32; +static PyObject *__pyx_n_s__intdata; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__kdtree; +static PyObject *__pyx_n_s__leafsize; +static PyObject *__pyx_n_s__less; +static PyObject *__pyx_n_s__m; +static PyObject *__pyx_n_s__maxes; +static PyObject *__pyx_n_s__mins; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__newaxis; +static PyObject *__pyx_n_s__node; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__priority; +static PyObject *__pyx_n_s__prod; +static PyObject *__pyx_n_s__ptrdata; +static PyObject *__pyx_n_s__query; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__raw_data; +static PyObject *__pyx_n_s__raw_indices; +static PyObject *__pyx_n_s__raw_maxes; +static PyObject *__pyx_n_s__raw_mins; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__reshape; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__side_distances; +static PyObject *__pyx_n_s__space; +static PyObject *__pyx_n_s__split; +static PyObject *__pyx_n_s__split_dim; +static PyObject *__pyx_n_s__start_idx; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__tree; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_int_0; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; +static double __pyx_k_4; -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":28 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":28 * int space * * cdef inline heapcreate(heap* self,int initial_size): # <<<<<<<<<<<<<< @@ -585,10 +1061,11 @@ * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_initial_size) { - PyObject *__pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapcreate(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_initial_size) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("heapcreate"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":29 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":29 * * cdef inline heapcreate(heap* self,int initial_size): * self.space = initial_size # <<<<<<<<<<<<<< @@ -597,7 +1074,7 @@ */ __pyx_v_self->space = __pyx_v_initial_size; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":30 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":30 * cdef inline heapcreate(heap* self,int initial_size): * self.space = initial_size * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) # <<<<<<<<<<<<<< @@ -606,7 +1083,7 @@ */ __pyx_v_self->heap = ((struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem)) * __pyx_v_self->space))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":31 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":31 * self.space = initial_size * self.heap = stdlib.malloc(sizeof(heapitem)*self.space) * self.n=0 # <<<<<<<<<<<<<< @@ -615,11 +1092,13 @@ */ __pyx_v_self->n = 0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":33 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":33 * self.n=0 * * cdef inline heapdestroy(heap* self): # <<<<<<<<<<<<<< @@ -627,10 +1106,11 @@ * */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { - PyObject *__pyx_r; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapdestroy(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { + PyObject *__pyx_r = NULL; + __Pyx_RefNannySetupContext("heapdestroy"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":34 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":34 * * cdef inline heapdestroy(heap* self): * stdlib.free(self.heap) # <<<<<<<<<<<<<< @@ -639,11 +1119,13 @@ */ free(__pyx_v_self->heap); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":36 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":36 * stdlib.free(self.heap) * * cdef inline heapresize(heap* self, int new_space): # <<<<<<<<<<<<<< @@ -651,53 +1133,62 @@ * raise ValueError("Heap containing %d items cannot be resized to %d" % (self.n, new_space)) */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_new_space) { - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_t_1 = NULL; +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heapresize(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, int __pyx_v_new_space) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + __Pyx_RefNannySetupContext("heapresize"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":37 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":37 * * cdef inline heapresize(heap* self, int new_space): * if new_spacen); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_new_space < __pyx_v_self->n); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":38 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":38 * cdef inline heapresize(heap* self, int new_space): * if new_spacestdlib.realloc(self.heap,new_space*sizeof(heapitem)) */ - __pyx_2 = PyInt_FromLong(__pyx_v_self->n); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyInt_FromLong(__pyx_v_new_space); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyTuple_New(2); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_4, 1, __pyx_3); - __pyx_2 = 0; - __pyx_3 = 0; - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_25, ((PyObject *)__pyx_4)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_2 = PyInt_FromLong(__pyx_v_self->n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyInt_FromLong(__pyx_v_new_space); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyTuple_New(2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_4, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_1), __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":39 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":39 * if new_spacespace = __pyx_v_new_space; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":40 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":40 * raise ValueError("Heap containing %d items cannot be resized to %d" % (self.n, new_space)) * self.space = new_space * self.heap = stdlib.realloc(self.heap,new_space*sizeof(heapitem)) # <<<<<<<<<<<<<< @@ -715,19 +1206,21 @@ */ __pyx_v_self->heap = ((struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem *)realloc(((void *)__pyx_v_self->heap), (__pyx_v_new_space * (sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem))))); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.spatial.ckdtree.heapresize"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":42 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":42 * self.heap = stdlib.realloc(self.heap,new_space*sizeof(heapitem)) * * cdef inline heappush(heap* self, heapitem item): # <<<<<<<<<<<<<< @@ -735,14 +1228,17 @@ * cdef heapitem t */ -static INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_item) { +static CYTHON_INLINE PyObject *__pyx_f_5scipy_7spatial_7ckdtree_heappush(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_item) { int __pyx_v_i; struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_t; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + int __pyx_t_3; + int __pyx_t_4; + __Pyx_RefNannySetupContext("heappush"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":46 * cdef heapitem t * * self.n += 1 # <<<<<<<<<<<<<< @@ -751,30 +1247,31 @@ */ __pyx_v_self->n += 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":47 * * self.n += 1 * if self.n>self.space: # <<<<<<<<<<<<<< * heapresize(self,2*self.space+1) * */ - __pyx_1 = (__pyx_v_self->n > __pyx_v_self->space); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_self->n > __pyx_v_self->space); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":48 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":48 * self.n += 1 * if self.n>self.space: * heapresize(self,2*self.space+1) # <<<<<<<<<<<<<< * * i = self.n-1 */ - __pyx_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((2 * __pyx_v_self->space) + 1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((2 * __pyx_v_self->space) + 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":50 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":50 * heapresize(self,2*self.space+1) * * i = self.n-1 # <<<<<<<<<<<<<< @@ -783,7 +1280,7 @@ */ __pyx_v_i = (__pyx_v_self->n - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":51 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":51 * * i = self.n-1 * self.heap[i] = item # <<<<<<<<<<<<<< @@ -792,7 +1289,7 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_item; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":52 * i = self.n-1 * self.heap[i] = item * while i>0 and self.heap[i].priority 0); - if (__pyx_1) { - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority < (__pyx_v_self->heap[((__pyx_v_i - 1) / 2)]).priority); + __pyx_t_1 = (__pyx_v_i > 0); + if (__pyx_t_1) { + __pyx_t_3 = ((__pyx_v_self->heap[__pyx_v_i]).priority < (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]).priority); + __pyx_t_4 = __pyx_t_3; + } else { + __pyx_t_4 = __pyx_t_1; } - if (!__pyx_1) break; + if (!__pyx_t_4) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":53 * self.heap[i] = item * while i>0 and self.heap[i].priorityheap[((__pyx_v_i - 1) / 2)]); + __pyx_v_t = (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":54 * while i>0 and self.heap[i].priorityheap[((__pyx_v_i - 1) / 2)]) = (__pyx_v_self->heap[__pyx_v_i]); + (__pyx_v_self->heap[__Pyx_div_long((__pyx_v_i - 1), 2)]) = (__pyx_v_self->heap[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":55 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":55 * t = self.heap[(i-1)//2] * self.heap[(i-1)//2] = self.heap[i] * self.heap[i] = t # <<<<<<<<<<<<<< @@ -833,27 +1333,29 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":56 * self.heap[(i-1)//2] = self.heap[i] * self.heap[i] = t * i = (i-1)//2 # <<<<<<<<<<<<<< * * cdef heapitem heappeek(heap* self): */ - __pyx_v_i = ((__pyx_v_i - 1) / 2); + __pyx_v_i = __Pyx_div_long((__pyx_v_i - 1), 2); } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.heappush"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":58 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":58 * i = (i-1)//2 * * cdef heapitem heappeek(heap* self): # <<<<<<<<<<<<<< @@ -863,8 +1365,9 @@ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappeek(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_r; + __Pyx_RefNannySetupContext("heappeek"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":59 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":59 * * cdef heapitem heappeek(heap* self): * return self.heap[0] # <<<<<<<<<<<<<< @@ -875,10 +1378,11 @@ goto __pyx_L0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":61 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":61 * return self.heap[0] * * cdef heapremove(heap* self): # <<<<<<<<<<<<<< @@ -892,11 +1396,15 @@ int __pyx_v_j; int __pyx_v_k; int __pyx_v_l; - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + __Pyx_RefNannySetupContext("heapremove"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":65 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":65 * cdef int i, j, k, l * * self.heap[0] = self.heap[self.n-1] # <<<<<<<<<<<<<< @@ -905,7 +1413,7 @@ */ (__pyx_v_self->heap[0]) = (__pyx_v_self->heap[(__pyx_v_self->n - 1)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":66 * * self.heap[0] = self.heap[self.n-1] * self.n -= 1 # <<<<<<<<<<<<<< @@ -914,33 +1422,37 @@ */ __pyx_v_self->n -= 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":67 * self.heap[0] = self.heap[self.n-1] * self.n -= 1 * if self.n < self.space//4 and self.space>40: #FIXME: magic number # <<<<<<<<<<<<<< * heapresize(self,self.space//2+1) * */ - __pyx_1 = (__pyx_v_self->n < (__pyx_v_self->space / 4)); - if (__pyx_1) { - __pyx_1 = (__pyx_v_self->space > 40); + __pyx_t_1 = (__pyx_v_self->n < __Pyx_div_long(__pyx_v_self->space, 4)); + if (__pyx_t_1) { + __pyx_t_2 = (__pyx_v_self->space > 40); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":68 * self.n -= 1 * if self.n < self.space//4 and self.space>40: #FIXME: magic number * heapresize(self,self.space//2+1) # <<<<<<<<<<<<<< * * i=0 */ - __pyx_2 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, ((__pyx_v_self->space / 2) + 1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_4 = __pyx_f_5scipy_7spatial_7ckdtree_heapresize(__pyx_v_self, (__Pyx_div_long(__pyx_v_self->space, 2) + 1)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 68; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":70 * heapresize(self,self.space//2+1) * * i=0 # <<<<<<<<<<<<<< @@ -949,7 +1461,7 @@ */ __pyx_v_i = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":71 * * i=0 * j=1 # <<<<<<<<<<<<<< @@ -958,7 +1470,7 @@ */ __pyx_v_j = 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":72 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":72 * i=0 * j=1 * k=2 # <<<<<<<<<<<<<< @@ -967,7 +1479,7 @@ */ __pyx_v_k = 2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":73 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":73 * j=1 * k=2 * while ((jn); - if (__pyx_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":74 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":74 * k=2 * while ((j self.heap[j].priority or # <<<<<<<<<<<<<< * k self.heap[k].priority)): */ - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_j]).priority); + __pyx_t_3 = (__pyx_v_j < __pyx_v_self->n); + if (__pyx_t_3) { + __pyx_t_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_j]).priority); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (!__pyx_1) { + if (!__pyx_t_2) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":75 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":75 * while ((j self.heap[j].priority or * k self.heap[k].priority)): * if kself.heap[k].priority: */ - __pyx_1 = (__pyx_v_k < __pyx_v_self->n); - if (__pyx_1) { + __pyx_t_3 = (__pyx_v_k < __pyx_v_self->n); + if (__pyx_t_3) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":76 * self.heap[i].priority > self.heap[j].priority or * k self.heap[k].priority)): # <<<<<<<<<<<<<< * if kself.heap[k].priority: * l = k */ - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_1 = ((__pyx_v_self->heap[__pyx_v_i]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_5 = __pyx_t_1; + } else { + __pyx_t_5 = __pyx_t_3; } + __pyx_t_3 = __pyx_t_5; + } else { + __pyx_t_3 = __pyx_t_2; } - if (!__pyx_1) break; + if (!__pyx_t_3) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":77 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":77 * k self.heap[k].priority)): * if kself.heap[k].priority: # <<<<<<<<<<<<<< * l = k * else: */ - __pyx_1 = (__pyx_v_k < __pyx_v_self->n); - if (__pyx_1) { - __pyx_1 = ((__pyx_v_self->heap[__pyx_v_j]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_3 = (__pyx_v_k < __pyx_v_self->n); + if (__pyx_t_3) { + __pyx_t_2 = ((__pyx_v_self->heap[__pyx_v_j]).priority > (__pyx_v_self->heap[__pyx_v_k]).priority); + __pyx_t_5 = __pyx_t_2; + } else { + __pyx_t_5 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":78 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":78 * self.heap[i].priority > self.heap[k].priority)): * if kself.heap[k].priority: * l = k # <<<<<<<<<<<<<< @@ -1036,7 +1560,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":80 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":80 * l = k * else: * l = j # <<<<<<<<<<<<<< @@ -1047,7 +1571,7 @@ } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":81 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":81 * else: * l = j * t = self.heap[l] # <<<<<<<<<<<<<< @@ -1056,7 +1580,7 @@ */ __pyx_v_t = (__pyx_v_self->heap[__pyx_v_l]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":82 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":82 * l = j * t = self.heap[l] * self.heap[l] = self.heap[i] # <<<<<<<<<<<<<< @@ -1065,7 +1589,7 @@ */ (__pyx_v_self->heap[__pyx_v_l]) = (__pyx_v_self->heap[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":83 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":83 * t = self.heap[l] * self.heap[l] = self.heap[i] * self.heap[i] = t # <<<<<<<<<<<<<< @@ -1074,7 +1598,7 @@ */ (__pyx_v_self->heap[__pyx_v_i]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":84 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":84 * self.heap[l] = self.heap[i] * self.heap[i] = t * i = l # <<<<<<<<<<<<<< @@ -1083,7 +1607,7 @@ */ __pyx_v_i = __pyx_v_l; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":85 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":85 * self.heap[i] = t * i = l * j = 2*i+1 # <<<<<<<<<<<<<< @@ -1092,7 +1616,7 @@ */ __pyx_v_j = ((2 * __pyx_v_i) + 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":86 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":86 * i = l * j = 2*i+1 * k = 2*i+2 # <<<<<<<<<<<<<< @@ -1102,17 +1626,19 @@ __pyx_v_k = ((2 * __pyx_v_i) + 2); } - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.spatial.ckdtree.heapremove"); __pyx_r = 0; __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":88 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":88 * k = 2*i+2 * * cdef heapitem heappop(heap* self): # <<<<<<<<<<<<<< @@ -1123,9 +1649,10 @@ static struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_f_5scipy_7spatial_7ckdtree_heappop(struct __pyx_t_5scipy_7spatial_7ckdtree_heap *__pyx_v_self) { struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_v_it; struct __pyx_t_5scipy_7spatial_7ckdtree_heapitem __pyx_r; - PyObject *__pyx_1 = 0; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("heappop"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":90 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":90 * cdef heapitem heappop(heap* self): * cdef heapitem it * it = heappeek(self) # <<<<<<<<<<<<<< @@ -1134,17 +1661,18 @@ */ __pyx_v_it = __pyx_f_5scipy_7spatial_7ckdtree_heappeek(__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":91 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":91 * cdef heapitem it * it = heappeek(self) * heapremove(self) # <<<<<<<<<<<<<< * return it * */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapremove(__pyx_v_self); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapremove(__pyx_v_self); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 91; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":92 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":92 * it = heappeek(self) * heapremove(self) * return it # <<<<<<<<<<<<<< @@ -1156,13 +1684,14 @@ goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); __Pyx_WriteUnraisable("scipy.spatial.ckdtree.heappop"); __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":99 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":99 * * # utility functions * cdef inline double dmax(double x, double y): # <<<<<<<<<<<<<< @@ -1170,21 +1699,22 @@ * return x */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double __pyx_v_x, double __pyx_v_y) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dmax(double __pyx_v_x, double __pyx_v_y) { double __pyx_r; - int __pyx_1; + int __pyx_t_1; + __Pyx_RefNannySetupContext("dmax"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":100 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":100 * # utility functions * cdef inline double dmax(double x, double y): * if x>y: # <<<<<<<<<<<<<< * return x * else: */ - __pyx_1 = (__pyx_v_x > __pyx_v_y); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_x > __pyx_v_y); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":101 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":101 * cdef inline double dmax(double x, double y): * if x>y: * return x # <<<<<<<<<<<<<< @@ -1197,7 +1727,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":103 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":103 * return x * else: * return y # <<<<<<<<<<<<<< @@ -1211,10 +1741,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":104 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":104 * else: * return y * cdef inline double dabs(double x): # <<<<<<<<<<<<<< @@ -1222,21 +1753,22 @@ * return x */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double __pyx_v_x) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree_dabs(double __pyx_v_x) { double __pyx_r; - int __pyx_1; + int __pyx_t_1; + __Pyx_RefNannySetupContext("dabs"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":105 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":105 * return y * cdef inline double dabs(double x): * if x>0: # <<<<<<<<<<<<<< * return x * else: */ - __pyx_1 = (__pyx_v_x > 0); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_x > 0); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":106 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":106 * cdef inline double dabs(double x): * if x>0: * return x # <<<<<<<<<<<<<< @@ -1249,7 +1781,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":108 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":108 * return x * else: * return -x # <<<<<<<<<<<<<< @@ -1263,10 +1795,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":109 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":109 * else: * return -x * cdef inline double _distance_p(double*x,double*y,double p,int k,double upperbound): # <<<<<<<<<<<<<< @@ -1274,13 +1807,16 @@ * */ -static INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *__pyx_v_x, double *__pyx_v_y, double __pyx_v_p, int __pyx_v_k, double __pyx_v_upperbound) { +static CYTHON_INLINE double __pyx_f_5scipy_7spatial_7ckdtree__distance_p(double *__pyx_v_x, double *__pyx_v_y, double __pyx_v_p, int __pyx_v_k, double __pyx_v_upperbound) { int __pyx_v_i; double __pyx_v_r; double __pyx_r; - int __pyx_1; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + __Pyx_RefNannySetupContext("_distance_p"); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":118 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":118 * cdef int i * cdef double r * r = 0 # <<<<<<<<<<<<<< @@ -1289,26 +1825,28 @@ */ __pyx_v_r = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":119 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":119 * cdef double r * r = 0 * if p==infinity: # <<<<<<<<<<<<<< * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) */ - __pyx_1 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":120 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":120 * r = 0 * if p==infinity: * for i in range(k): # <<<<<<<<<<<<<< * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":121 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":121 * if p==infinity: * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) # <<<<<<<<<<<<<< @@ -1317,17 +1855,17 @@ */ __pyx_v_r = __pyx_f_5scipy_7spatial_7ckdtree_dmax(__pyx_v_r, __pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i])))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":122 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":122 * for i in range(k): * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: # <<<<<<<<<<<<<< * return r * elif p==1: */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":123 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":123 * r = dmax(r,dabs(x[i]-y[i])) * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1343,26 +1881,28 @@ goto __pyx_L3; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":124 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":124 * if r>upperbound: * return r * elif p==1: # <<<<<<<<<<<<<< * for i in range(k): * r += dabs(x[i]-y[i]) */ - __pyx_1 = (__pyx_v_p == 1); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == 1); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":125 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":125 * return r * elif p==1: * for i in range(k): # <<<<<<<<<<<<<< * r += dabs(x[i]-y[i]) * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":126 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":126 * elif p==1: * for i in range(k): * r += dabs(x[i]-y[i]) # <<<<<<<<<<<<<< @@ -1371,17 +1911,17 @@ */ __pyx_v_r += __pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i]))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":127 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":127 * for i in range(k): * r += dabs(x[i]-y[i]) * if r>upperbound: # <<<<<<<<<<<<<< * return r * else: */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":128 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":128 * r += dabs(x[i]-y[i]) * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1398,16 +1938,18 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":130 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":130 * return r * else: * for i in range(k): # <<<<<<<<<<<<<< * r += dabs(x[i]-y[i])**p * if r>upperbound: */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_k; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_k; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":131 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":131 * else: * for i in range(k): * r += dabs(x[i]-y[i])**p # <<<<<<<<<<<<<< @@ -1416,17 +1958,17 @@ */ __pyx_v_r += pow(__pyx_f_5scipy_7spatial_7ckdtree_dabs(((__pyx_v_x[__pyx_v_i]) - (__pyx_v_y[__pyx_v_i]))), __pyx_v_p); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":132 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":132 * for i in range(k): * r += dabs(x[i]-y[i])**p * if r>upperbound: # <<<<<<<<<<<<<< * return r * return r */ - __pyx_1 = (__pyx_v_r > __pyx_v_upperbound); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_r > __pyx_v_upperbound); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":133 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":133 * r += dabs(x[i]-y[i])**p * if r>upperbound: * return r # <<<<<<<<<<<<<< @@ -1442,7 +1984,7 @@ } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":134 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":134 * if r>upperbound: * return r * return r # <<<<<<<<<<<<<< @@ -1454,10 +1996,11 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":195 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":195 * cdef object indices * cdef np.int32_t* raw_indices * def __init__(cKDTree self, data, int leafsize=10): # <<<<<<<<<<<<<< @@ -1489,27 +2032,27 @@ Py_ssize_t __pyx_bstride_0_inner_mins = 0; Py_ssize_t __pyx_bshape_0_inner_mins = 0; int __pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - int __pyx_6; - int __pyx_7; - PyObject *__pyx_8 = 0; - PyArrayObject *__pyx_t_1 = NULL; - int __pyx_t_2; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; - PyArrayObject *__pyx_t_7 = NULL; - PyArrayObject *__pyx_t_8 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_data,&__pyx_kp_leafsize,0}; - __pyx_v_leafsize = 10; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyArrayObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + PyArrayObject *__pyx_t_15 = NULL; + PyArrayObject *__pyx_t_16 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__data,&__pyx_n_s__leafsize,0}; + __Pyx_RefNannySetupContext("__init__"); if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -1518,20 +2061,28 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_data); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__data); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__leafsize); + if (unlikely(value)) { values[1] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "__init__") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_data = values[0]; if (values[1]) { - __pyx_v_leafsize = __pyx_PyInt_int(values[1]); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_leafsize = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_leafsize = ((int)10); } } else { + __pyx_v_leafsize = ((int)10); switch (PyTuple_GET_SIZE(__pyx_args)) { - case 2: __pyx_v_leafsize = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_leafsize = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_leafsize == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_data = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; @@ -1544,88 +2095,105 @@ __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__init__"); return -1; __pyx_L4_argument_unpacking_done:; - __pyx_v_inner_data = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_maxes = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_mins = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_inner_indices = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_data); + __pyx_v_inner_data = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_maxes = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_mins = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_inner_indices = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); __pyx_bstruct_inner_data.buf = NULL; __pyx_bstruct_inner_maxes.buf = NULL; __pyx_bstruct_inner_mins.buf = NULL; __pyx_bstruct_inner_indices.buf = NULL; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":214 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":214 * cdef np.ndarray[double, ndim=1] inner_mins * cdef np.ndarray[np.int32_t, ndim=1] inner_indices * self.data = np.ascontiguousarray(data,dtype=np.float) # <<<<<<<<<<<<<< * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_data); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_data); - __pyx_3 = PyDict_New(); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_4, __pyx_kp_float); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - if (PyDict_SetItem(__pyx_3, __pyx_kp_dtype, __pyx_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_2, ((PyObject *)__pyx_1), ((PyObject *)__pyx_3)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data = __pyx_4; - __pyx_4 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_data); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_data); + __Pyx_GIVEREF(__pyx_v_data); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__float); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_5) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 214; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data = __pyx_t_5; + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":215 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":215 * cdef np.ndarray[np.int32_t, ndim=1] inner_indices * self.data = np.ascontiguousarray(data,dtype=np.float) * self.n, self.m = np.shape(self.data) # <<<<<<<<<<<<<< * self.leafsize = leafsize * if self.leafsize<1: */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_1, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (PyTuple_CheckExact(__pyx_3) && PyTuple_GET_SIZE(__pyx_3) == 2) { - PyObject* tuple = __pyx_3; - __pyx_5 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_5); - __pyx_6 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_6; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_6; - Py_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { + PyObject* tuple = __pyx_t_1; + __pyx_t_5 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_5); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_t_6; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_t_7; + } else { + __pyx_t_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_5 = __Pyx_UnpackItem(__pyx_t_2, 0); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_7 = __Pyx_PyInt_AsInt(__pyx_t_5); if (unlikely((__pyx_t_7 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_2, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_6 = __Pyx_PyInt_AsInt(__pyx_t_3); if (unlikely((__pyx_t_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__Pyx_EndUnpack(__pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_t_7; + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_t_6; } - else { - __pyx_4 = PyObject_GetIter(__pyx_3); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = __Pyx_UnpackItem(__pyx_4, 0); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __pyx_PyInt_int(__pyx_5); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n = __pyx_6; - __pyx_2 = __Pyx_UnpackItem(__pyx_4, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __pyx_PyInt_int(__pyx_2); if (unlikely((__pyx_6 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m = __pyx_6; - if (__Pyx_EndUnpack(__pyx_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 215; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":216 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":216 * self.data = np.ascontiguousarray(data,dtype=np.float) * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize # <<<<<<<<<<<<<< @@ -1634,166 +2202,213 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize = __pyx_v_leafsize; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":217 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":217 * self.n, self.m = np.shape(self.data) * self.leafsize = leafsize * if self.leafsize<1: # <<<<<<<<<<<<<< * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) */ - __pyx_7 = (((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize < 1); - if (__pyx_7) { + __pyx_t_8 = (((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->leafsize < 1); + if (__pyx_t_8) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":218 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":218 * self.leafsize = leafsize * if self.leafsize<1: * raise ValueError("leafsize must be at least 1") # <<<<<<<<<<<<<< * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) */ - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_26); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_kp_26); - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_2)); + PyTuple_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_kp_s_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_2)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 218; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":219 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":219 * if self.leafsize<1: * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) # <<<<<<<<<<<<<< * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_amax); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_5), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_4); - __pyx_4 = 0; - __pyx_5 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes = __pyx_5; - __pyx_5 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__amax); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 219; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_GIVEREF(__pyx_t_4); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes = __pyx_t_4; + __pyx_t_4 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":220 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":220 * raise ValueError("leafsize must be at least 1") * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) # <<<<<<<<<<<<<< * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_amin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - PyTuple_SET_ITEM(__pyx_5, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_axis, __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_5), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_5 = PyObject_Call(__pyx_4, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins = __pyx_5; - __pyx_5 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_4, __pyx_n_s__amin); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_GIVEREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__axis), __pyx_int_0) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_4, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 220; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins = __pyx_t_5; + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":221 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":221 * self.maxes = np.ascontiguousarray(np.amax(self.data,axis=0)) * self.mins = np.ascontiguousarray(np.amin(self.data,axis=0)) * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) # <<<<<<<<<<<<<< * * inner_data = self.data */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_2, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_arange); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_5); - __pyx_5 = 0; - __pyx_4 = PyDict_New(); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_8 = PyObject_GetAttr(__pyx_5, __pyx_kp_27); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - if (PyDict_SetItem(__pyx_4, __pyx_kp_dtype, __pyx_8) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_8); __pyx_8 = 0; - __pyx_5 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_2), ((PyObject *)__pyx_4)); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_8 = PyTuple_New(1); if (unlikely(!__pyx_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_8, 0, __pyx_5); - __pyx_5 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_8), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_8)); __pyx_8 = 0; - Py_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices = __pyx_1; - __pyx_1 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__arange); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyDict_New(); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_5)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__int32); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyDict_SetItem(__pyx_t_5, ((PyObject *)__pyx_n_s__dtype), __pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyEval_CallObjectWithKeywords(__pyx_t_2, __pyx_t_4, ((PyObject *)__pyx_t_5)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_9); + __Pyx_GIVEREF(__pyx_t_9); + __pyx_t_9 = 0; + __pyx_t_9 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 221; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GIVEREF(__pyx_t_9); + __Pyx_GOTREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + __Pyx_DECREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices = __pyx_t_9; + __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":223 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":223 * self.indices = np.ascontiguousarray(np.arange(self.n,dtype=np.int32)) * * inner_data = self.data # <<<<<<<<<<<<<< * self.raw_data = inner_data.data * inner_maxes = self.maxes */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_1, &__pyx_bstruct_inner_data, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_10 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_data, &__pyx_bstruct_inner_data, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_data, (PyObject*)__pyx_t_10, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_data, (PyObject*)__pyx_v_inner_data, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13); } + } + __pyx_bstride_0_inner_data = __pyx_bstruct_inner_data.strides[0]; __pyx_bstride_1_inner_data = __pyx_bstruct_inner_data.strides[1]; + __pyx_bshape_0_inner_data = __pyx_bstruct_inner_data.shape[0]; __pyx_bshape_1_inner_data = __pyx_bstruct_inner_data.shape[1]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_data = __pyx_bstruct_inner_data.strides[0]; __pyx_bstride_1_inner_data = __pyx_bstruct_inner_data.strides[1]; - __pyx_bshape_0_inner_data = __pyx_bstruct_inner_data.shape[0]; __pyx_bshape_1_inner_data = __pyx_bstruct_inner_data.shape[1]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 223; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - Py_DECREF(((PyObject *)__pyx_v_inner_data)); + __pyx_t_10 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_data)); __pyx_v_inner_data = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":224 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":224 * * inner_data = self.data * self.raw_data = inner_data.data # <<<<<<<<<<<<<< @@ -1802,36 +2417,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_data = ((double *)__pyx_v_inner_data->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":225 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":225 * inner_data = self.data * self.raw_data = inner_data.data * inner_maxes = self.maxes # <<<<<<<<<<<<<< * self.raw_maxes = inner_maxes.data * inner_mins = self.mins */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_maxes); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_6, &__pyx_bstruct_inner_maxes, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_maxes, &__pyx_bstruct_inner_maxes, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_maxes); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_maxes, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_maxes, (PyObject*)__pyx_v_inner_maxes, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11); } + } + __pyx_bstride_0_inner_maxes = __pyx_bstruct_inner_maxes.strides[0]; + __pyx_bshape_0_inner_maxes = __pyx_bstruct_inner_maxes.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_maxes = __pyx_bstruct_inner_maxes.strides[0]; - __pyx_bshape_0_inner_maxes = __pyx_bstruct_inner_maxes.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 225; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - Py_DECREF(((PyObject *)__pyx_v_inner_maxes)); + __pyx_t_14 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_maxes)); __pyx_v_inner_maxes = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->maxes); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":226 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":226 * self.raw_data = inner_data.data * inner_maxes = self.maxes * self.raw_maxes = inner_maxes.data # <<<<<<<<<<<<<< @@ -1840,36 +2457,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_maxes = ((double *)__pyx_v_inner_maxes->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":227 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":227 * inner_maxes = self.maxes * self.raw_maxes = inner_maxes.data * inner_mins = self.mins # <<<<<<<<<<<<<< * self.raw_mins = inner_mins.data * inner_indices = self.indices */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); - __pyx_t_2 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_7, &__pyx_bstruct_inner_mins, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_15 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); { - PyErr_Fetch(&__pyx_t_3, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_inner_mins, &__pyx_bstruct_inner_mins, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_3); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_3, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_mins, (PyObject*)__pyx_t_15, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_12, &__pyx_t_13); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_mins, (PyObject*)__pyx_v_inner_mins, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_13); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_12, __pyx_t_13); } + } + __pyx_bstride_0_inner_mins = __pyx_bstruct_inner_mins.strides[0]; + __pyx_bshape_0_inner_mins = __pyx_bstruct_inner_mins.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_mins = __pyx_bstruct_inner_mins.strides[0]; - __pyx_bshape_0_inner_mins = __pyx_bstruct_inner_mins.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 227; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - Py_DECREF(((PyObject *)__pyx_v_inner_mins)); + __pyx_t_15 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_mins)); __pyx_v_inner_mins = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->mins); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":228 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":228 * self.raw_maxes = inner_maxes.data * inner_mins = self.mins * self.raw_mins = inner_mins.data # <<<<<<<<<<<<<< @@ -1878,36 +2497,38 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_mins = ((double *)__pyx_v_inner_mins->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":229 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":229 * inner_mins = self.mins * self.raw_mins = inner_mins.data * inner_indices = self.indices # <<<<<<<<<<<<<< * self.raw_indices = inner_indices.data * */ - if (!(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); - __pyx_t_2 = __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_t_8, &__pyx_bstruct_inner_indices, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_2 < 0)) + if (!(likely(((((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices) == Py_None) || likely(__Pyx_TypeTest(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_16 = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_3); - if (unlikely(__Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t((PyObject*)__pyx_v_inner_indices, &__pyx_bstruct_inner_indices, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_3); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_3); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); + __pyx_t_6 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_indices, (PyObject*)__pyx_t_16, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_6 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_12, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_inner_indices, (PyObject*)__pyx_v_inner_indices, &__Pyx_TypeInfo_nn___pyx_t_5numpy_int32_t, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_12); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_12, __pyx_t_11); } + } + __pyx_bstride_0_inner_indices = __pyx_bstruct_inner_indices.strides[0]; + __pyx_bshape_0_inner_indices = __pyx_bstruct_inner_indices.shape[0]; + if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_inner_indices = __pyx_bstruct_inner_indices.strides[0]; - __pyx_bshape_0_inner_indices = __pyx_bstruct_inner_indices.shape[0]; - if (unlikely(__pyx_t_2 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 229; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_8 = 0; - Py_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - Py_DECREF(((PyObject *)__pyx_v_inner_indices)); + __pyx_t_16 = 0; + __Pyx_INCREF(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); + __Pyx_DECREF(((PyObject *)__pyx_v_inner_indices)); __pyx_v_inner_indices = ((PyArrayObject *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->indices); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":230 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":230 * self.raw_mins = inner_mins.data * inner_indices = self.indices * self.raw_indices = inner_indices.data # <<<<<<<<<<<<<< @@ -1916,7 +2537,7 @@ */ ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->raw_indices = ((__pyx_t_5numpy_int32_t *)__pyx_v_inner_indices->data); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":232 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":232 * self.raw_indices = inner_indices.data * * self.tree = self.__build(0, self.n, self.raw_maxes, self.raw_mins) # <<<<<<<<<<<<<< @@ -1928,12 +2549,12 @@ __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_8); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_9); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_indices); @@ -1950,14 +2571,17 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_data); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_inner_mins); __pyx_L2:; - Py_DECREF(__pyx_v_inner_data); - Py_DECREF(__pyx_v_inner_maxes); - Py_DECREF(__pyx_v_inner_mins); - Py_DECREF(__pyx_v_inner_indices); + __Pyx_DECREF((PyObject *)__pyx_v_inner_data); + __Pyx_DECREF((PyObject *)__pyx_v_inner_maxes); + __Pyx_DECREF((PyObject *)__pyx_v_inner_mins); + __Pyx_DECREF((PyObject *)__pyx_v_inner_indices); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_data); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":234 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":234 * self.tree = self.__build(0, self.n, self.raw_maxes, self.raw_mins) * * cdef innernode* __build(cKDTree self, int start_idx, int end_idx, double* maxes, double* mins): # <<<<<<<<<<<<<< @@ -1980,21 +2604,24 @@ double __pyx_v_maxval; double *__pyx_v_mids; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_r; - int __pyx_1; - int __pyx_2; - long __pyx_3; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + long __pyx_t_4; + __Pyx_RefNannySetupContext("__build"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":240 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":240 * cdef double size, split, minval, maxval * cdef double*mids * if end_idx-start_idx<=self.leafsize: # <<<<<<<<<<<<<< * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 */ - __pyx_1 = ((__pyx_v_end_idx - __pyx_v_start_idx) <= __pyx_v_self->leafsize); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_end_idx - __pyx_v_start_idx) <= __pyx_v_self->leafsize); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":241 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":241 * cdef double*mids * if end_idx-start_idx<=self.leafsize: * n = stdlib.malloc(sizeof(leafnode)) # <<<<<<<<<<<<<< @@ -2003,7 +2630,7 @@ */ __pyx_v_n = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":242 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":242 * if end_idx-start_idx<=self.leafsize: * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 # <<<<<<<<<<<<<< @@ -2012,7 +2639,7 @@ */ __pyx_v_n->split_dim = -1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":243 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":243 * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 * n.start_idx = start_idx # <<<<<<<<<<<<<< @@ -2021,7 +2648,7 @@ */ __pyx_v_n->start_idx = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":244 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":244 * n.split_dim = -1 * n.start_idx = start_idx * n.end_idx = end_idx # <<<<<<<<<<<<<< @@ -2030,7 +2657,7 @@ */ __pyx_v_n->end_idx = __pyx_v_end_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":245 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":245 * n.start_idx = start_idx * n.end_idx = end_idx * return n # <<<<<<<<<<<<<< @@ -2043,7 +2670,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":247 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":247 * return n * else: * d = 0 # <<<<<<<<<<<<<< @@ -2052,7 +2679,7 @@ */ __pyx_v_d = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":248 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":248 * else: * d = 0 * size = 0 # <<<<<<<<<<<<<< @@ -2061,27 +2688,28 @@ */ __pyx_v_size = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":249 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":249 * d = 0 * size = 0 * for i in range(self.m): # <<<<<<<<<<<<<< * if maxes[i]-mins[i] > size: * d = i */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":250 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":250 * size = 0 * for i in range(self.m): * if maxes[i]-mins[i] > size: # <<<<<<<<<<<<<< * d = i * size = maxes[i]-mins[i] */ - __pyx_1 = (((__pyx_v_maxes[__pyx_v_i]) - (__pyx_v_mins[__pyx_v_i])) > __pyx_v_size); - if (__pyx_1) { + __pyx_t_1 = (((__pyx_v_maxes[__pyx_v_i]) - (__pyx_v_mins[__pyx_v_i])) > __pyx_v_size); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":251 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":251 * for i in range(self.m): * if maxes[i]-mins[i] > size: * d = i # <<<<<<<<<<<<<< @@ -2090,7 +2718,7 @@ */ __pyx_v_d = __pyx_v_i; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":252 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":252 * if maxes[i]-mins[i] > size: * d = i * size = maxes[i]-mins[i] # <<<<<<<<<<<<<< @@ -2103,7 +2731,7 @@ __pyx_L6:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":253 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":253 * d = i * size = maxes[i]-mins[i] * maxval = maxes[d] # <<<<<<<<<<<<<< @@ -2112,7 +2740,7 @@ */ __pyx_v_maxval = (__pyx_v_maxes[__pyx_v_d]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":254 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":254 * size = maxes[i]-mins[i] * maxval = maxes[d] * minval = mins[d] # <<<<<<<<<<<<<< @@ -2121,17 +2749,17 @@ */ __pyx_v_minval = (__pyx_v_mins[__pyx_v_d]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":255 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":255 * maxval = maxes[d] * minval = mins[d] * if maxval==minval: # <<<<<<<<<<<<<< * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) */ - __pyx_1 = (__pyx_v_maxval == __pyx_v_minval); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_maxval == __pyx_v_minval); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":257 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":257 * if maxval==minval: * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) # <<<<<<<<<<<<<< @@ -2140,7 +2768,7 @@ */ __pyx_v_n = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":258 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":258 * # all points are identical; warn user? * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 # <<<<<<<<<<<<<< @@ -2149,7 +2777,7 @@ */ __pyx_v_n->split_dim = -1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":259 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":259 * n = stdlib.malloc(sizeof(leafnode)) * n.split_dim = -1 * n.start_idx = start_idx # <<<<<<<<<<<<<< @@ -2158,7 +2786,7 @@ */ __pyx_v_n->start_idx = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":260 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":260 * n.split_dim = -1 * n.start_idx = start_idx * n.end_idx = end_idx # <<<<<<<<<<<<<< @@ -2167,7 +2795,7 @@ */ __pyx_v_n->end_idx = __pyx_v_end_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":261 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":261 * n.start_idx = start_idx * n.end_idx = end_idx * return n # <<<<<<<<<<<<<< @@ -2180,7 +2808,7 @@ } __pyx_L7:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":263 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":263 * return n * * split = (maxval+minval)/2 # <<<<<<<<<<<<<< @@ -2189,7 +2817,7 @@ */ __pyx_v_split = ((__pyx_v_maxval + __pyx_v_minval) / 2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":265 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":265 * split = (maxval+minval)/2 * * p = start_idx # <<<<<<<<<<<<<< @@ -2198,7 +2826,7 @@ */ __pyx_v_p = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":266 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":266 * * p = start_idx * q = end_idx-1 # <<<<<<<<<<<<<< @@ -2207,7 +2835,7 @@ */ __pyx_v_q = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":267 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":267 * p = start_idx * q = end_idx-1 * while p<=q: # <<<<<<<<<<<<<< @@ -2215,20 +2843,20 @@ * p+=1 */ while (1) { - __pyx_1 = (__pyx_v_p <= __pyx_v_q); - if (!__pyx_1) break; + __pyx_t_1 = (__pyx_v_p <= __pyx_v_q); + if (!__pyx_t_1) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":268 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":268 * q = end_idx-1 * while p<=q: * if self.raw_data[self.raw_indices[p]*self.m+d]=split: */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_p]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_p]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":269 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":269 * while p<=q: * if self.raw_data[self.raw_indices[p]*self.m+d]=split: # <<<<<<<<<<<<<< * q-=1 * else: */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_q]) * __pyx_v_self->m) + __pyx_v_d)]) >= __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_q]) * __pyx_v_self->m) + __pyx_v_d)]) >= __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":271 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":271 * p+=1 * elif self.raw_data[self.raw_indices[q]*self.m+d]>=split: * q-=1 # <<<<<<<<<<<<<< @@ -2261,7 +2889,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":273 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":273 * q-=1 * else: * t = self.raw_indices[p] # <<<<<<<<<<<<<< @@ -2270,7 +2898,7 @@ */ __pyx_v_t = (__pyx_v_self->raw_indices[__pyx_v_p]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":274 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":274 * else: * t = self.raw_indices[p] * self.raw_indices[p] = self.raw_indices[q] # <<<<<<<<<<<<<< @@ -2279,7 +2907,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_p]) = (__pyx_v_self->raw_indices[__pyx_v_q]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":275 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":275 * t = self.raw_indices[p] * self.raw_indices[p] = self.raw_indices[q] * self.raw_indices[q] = t # <<<<<<<<<<<<<< @@ -2288,7 +2916,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_q]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":276 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":276 * self.raw_indices[p] = self.raw_indices[q] * self.raw_indices[q] = t * p+=1 # <<<<<<<<<<<<<< @@ -2297,7 +2925,7 @@ */ __pyx_v_p += 1; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":277 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":277 * self.raw_indices[q] = t * p+=1 * q-=1 # <<<<<<<<<<<<<< @@ -2309,17 +2937,17 @@ __pyx_L10:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":280 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":280 * * # slide midpoint if necessary * if p==start_idx: # <<<<<<<<<<<<<< * # no points less than split * j = start_idx */ - __pyx_1 = (__pyx_v_p == __pyx_v_start_idx); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_start_idx); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":282 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":282 * if p==start_idx: * # no points less than split * j = start_idx # <<<<<<<<<<<<<< @@ -2328,7 +2956,7 @@ */ __pyx_v_j = __pyx_v_start_idx; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":283 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":283 * # no points less than split * j = start_idx * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2337,26 +2965,28 @@ */ __pyx_v_split = (__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_j]) * __pyx_v_self->m) + __pyx_v_d)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":284 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":284 * j = start_idx * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx+1, end_idx): # <<<<<<<<<<<<<< * if self.raw_data[self.raw_indices[i]*self.m+d]raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) < __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":286 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":286 * for i in range(start_idx+1, end_idx): * if self.raw_data[self.raw_indices[i]*self.m+d]raw_indices[__pyx_v_start_idx]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":289 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":289 * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[start_idx] * self.raw_indices[start_idx] = self.raw_indices[j] # <<<<<<<<<<<<<< @@ -2396,7 +3026,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_start_idx]) = (__pyx_v_self->raw_indices[__pyx_v_j]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":290 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":290 * t = self.raw_indices[start_idx] * self.raw_indices[start_idx] = self.raw_indices[j] * self.raw_indices[j] = t # <<<<<<<<<<<<<< @@ -2405,7 +3035,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_j]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":291 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":291 * self.raw_indices[start_idx] = self.raw_indices[j] * self.raw_indices[j] = t * p = start_idx+1 # <<<<<<<<<<<<<< @@ -2414,7 +3044,7 @@ */ __pyx_v_p = (__pyx_v_start_idx + 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":292 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":292 * self.raw_indices[j] = t * p = start_idx+1 * q = start_idx # <<<<<<<<<<<<<< @@ -2425,17 +3055,17 @@ goto __pyx_L11; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":293 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":293 * p = start_idx+1 * q = start_idx * elif p==end_idx: # <<<<<<<<<<<<<< * # no points greater than split * j = end_idx-1 */ - __pyx_1 = (__pyx_v_p == __pyx_v_end_idx); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_p == __pyx_v_end_idx); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":295 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":295 * elif p==end_idx: * # no points greater than split * j = end_idx-1 # <<<<<<<<<<<<<< @@ -2444,7 +3074,7 @@ */ __pyx_v_j = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":296 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":296 * # no points greater than split * j = end_idx-1 * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2453,27 +3083,28 @@ */ __pyx_v_split = (__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_j]) * __pyx_v_self->m) + __pyx_v_d)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":297 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":297 * j = end_idx-1 * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx, end_idx-1): # <<<<<<<<<<<<<< * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i */ - __pyx_3 = (__pyx_v_end_idx - 1); - for (__pyx_v_i = __pyx_v_start_idx; __pyx_v_i < __pyx_3; __pyx_v_i+=1) { + __pyx_t_4 = (__pyx_v_end_idx - 1); + for (__pyx_t_2 = __pyx_v_start_idx; __pyx_t_2 < __pyx_t_4; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":298 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":298 * split = self.raw_data[self.raw_indices[j]*self.m+d] * for i in range(start_idx, end_idx-1): * if self.raw_data[self.raw_indices[i]*self.m+d]>split: # <<<<<<<<<<<<<< * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] */ - __pyx_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) > __pyx_v_split); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_self->raw_data[(((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m) + __pyx_v_d)]) > __pyx_v_split); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":299 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":299 * for i in range(start_idx, end_idx-1): * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i # <<<<<<<<<<<<<< @@ -2482,7 +3113,7 @@ */ __pyx_v_j = __pyx_v_i; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":300 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":300 * if self.raw_data[self.raw_indices[i]*self.m+d]>split: * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] # <<<<<<<<<<<<<< @@ -2495,7 +3126,7 @@ __pyx_L17:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":301 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":301 * j = i * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[end_idx-1] # <<<<<<<<<<<<<< @@ -2504,7 +3135,7 @@ */ __pyx_v_t = (__pyx_v_self->raw_indices[(__pyx_v_end_idx - 1)]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":302 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":302 * split = self.raw_data[self.raw_indices[j]*self.m+d] * t = self.raw_indices[end_idx-1] * self.raw_indices[end_idx-1] = self.raw_indices[j] # <<<<<<<<<<<<<< @@ -2513,7 +3144,7 @@ */ (__pyx_v_self->raw_indices[(__pyx_v_end_idx - 1)]) = (__pyx_v_self->raw_indices[__pyx_v_j]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":303 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":303 * t = self.raw_indices[end_idx-1] * self.raw_indices[end_idx-1] = self.raw_indices[j] * self.raw_indices[j] = t # <<<<<<<<<<<<<< @@ -2522,7 +3153,7 @@ */ (__pyx_v_self->raw_indices[__pyx_v_j]) = __pyx_v_t; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":304 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":304 * self.raw_indices[end_idx-1] = self.raw_indices[j] * self.raw_indices[j] = t * p = end_idx-1 # <<<<<<<<<<<<<< @@ -2531,7 +3162,7 @@ */ __pyx_v_p = (__pyx_v_end_idx - 1); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":305 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":305 * self.raw_indices[j] = t * p = end_idx-1 * q = end_idx-2 # <<<<<<<<<<<<<< @@ -2543,7 +3174,7 @@ } __pyx_L11:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":308 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":308 * * # construct new node representation * ni = stdlib.malloc(sizeof(innernode)) # <<<<<<<<<<<<<< @@ -2552,7 +3183,7 @@ */ __pyx_v_ni = ((struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *)malloc((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_innernode)))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":310 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":310 * ni = stdlib.malloc(sizeof(innernode)) * * mids = stdlib.malloc(sizeof(double)*self.m) # <<<<<<<<<<<<<< @@ -2561,17 +3192,18 @@ */ __pyx_v_mids = ((double *)malloc(((sizeof(double)) * __pyx_v_self->m))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":311 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":311 * * mids = stdlib.malloc(sizeof(double)*self.m) * for i in range(self.m): # <<<<<<<<<<<<<< * mids[i] = maxes[i] * mids[d] = split */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":312 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":312 * mids = stdlib.malloc(sizeof(double)*self.m) * for i in range(self.m): * mids[i] = maxes[i] # <<<<<<<<<<<<<< @@ -2581,7 +3213,7 @@ (__pyx_v_mids[__pyx_v_i]) = (__pyx_v_maxes[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":313 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":313 * for i in range(self.m): * mids[i] = maxes[i] * mids[d] = split # <<<<<<<<<<<<<< @@ -2590,7 +3222,7 @@ */ (__pyx_v_mids[__pyx_v_d]) = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":314 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":314 * mids[i] = maxes[i] * mids[d] = split * ni.less = self.__build(start_idx,p,mids,mins) # <<<<<<<<<<<<<< @@ -2599,17 +3231,18 @@ */ __pyx_v_ni->less = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__build(__pyx_v_self, __pyx_v_start_idx, __pyx_v_p, __pyx_v_mids, __pyx_v_mins); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":316 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":316 * ni.less = self.__build(start_idx,p,mids,mins) * * for i in range(self.m): # <<<<<<<<<<<<<< * mids[i] = mins[i] * mids[d] = split */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":317 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":317 * * for i in range(self.m): * mids[i] = mins[i] # <<<<<<<<<<<<<< @@ -2619,7 +3252,7 @@ (__pyx_v_mids[__pyx_v_i]) = (__pyx_v_mins[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":318 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":318 * for i in range(self.m): * mids[i] = mins[i] * mids[d] = split # <<<<<<<<<<<<<< @@ -2628,7 +3261,7 @@ */ (__pyx_v_mids[__pyx_v_d]) = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":319 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":319 * mids[i] = mins[i] * mids[d] = split * ni.greater = self.__build(p,end_idx,maxes,mids) # <<<<<<<<<<<<<< @@ -2637,7 +3270,7 @@ */ __pyx_v_ni->greater = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__build(__pyx_v_self, __pyx_v_p, __pyx_v_end_idx, __pyx_v_maxes, __pyx_v_mids); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":321 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":321 * ni.greater = self.__build(p,end_idx,maxes,mids) * * stdlib.free(mids) # <<<<<<<<<<<<<< @@ -2646,7 +3279,7 @@ */ free(__pyx_v_mids); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":323 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":323 * stdlib.free(mids) * * ni.split_dim = d # <<<<<<<<<<<<<< @@ -2655,7 +3288,7 @@ */ __pyx_v_ni->split_dim = __pyx_v_d; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":324 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":324 * * ni.split_dim = d * ni.split = split # <<<<<<<<<<<<<< @@ -2664,7 +3297,7 @@ */ __pyx_v_ni->split = __pyx_v_split; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":326 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":326 * ni.split = split * * return ni # <<<<<<<<<<<<<< @@ -2678,10 +3311,12 @@ __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":328 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":328 * return ni * * cdef __free_tree(cKDTree self, innernode* node): # <<<<<<<<<<<<<< @@ -2690,44 +3325,48 @@ */ static PyObject *__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *__pyx_v_self, struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_node) { - PyObject *__pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; + PyObject *__pyx_r = NULL; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__free_tree"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":329 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":329 * * cdef __free_tree(cKDTree self, innernode* node): * if node.split_dim!=-1: # <<<<<<<<<<<<<< * self.__free_tree(node.less) * self.__free_tree(node.greater) */ - __pyx_1 = (__pyx_v_node->split_dim != -1); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_node->split_dim != -1); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":330 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":330 * cdef __free_tree(cKDTree self, innernode* node): * if node.split_dim!=-1: * self.__free_tree(node.less) # <<<<<<<<<<<<<< * self.__free_tree(node.greater) * stdlib.free(node) */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->less); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->less); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 330; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":331 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":331 * if node.split_dim!=-1: * self.__free_tree(node.less) * self.__free_tree(node.greater) # <<<<<<<<<<<<<< * stdlib.free(node) * */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->greater); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self->__pyx_vtab)->__free_tree(__pyx_v_self, __pyx_v_node->greater); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 331; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L3; } __pyx_L3:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":332 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":332 * self.__free_tree(node.less) * self.__free_tree(node.greater) * stdlib.free(node) # <<<<<<<<<<<<<< @@ -2736,17 +3375,20 @@ */ free(__pyx_v_node); - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__free_tree"); __pyx_r = 0; __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":334 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":334 * stdlib.free(node) * * def __dealloc__(cKDTree self): # <<<<<<<<<<<<<< @@ -2756,20 +3398,22 @@ static void __pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree___dealloc__(PyObject *__pyx_v_self); /*proto*/ static void __pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree___dealloc__(PyObject *__pyx_v_self) { - int __pyx_1; - PyObject *__pyx_2 = 0; + int __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + __Pyx_RefNannySetupContext("__dealloc__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":335 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":335 * * def __dealloc__(cKDTree self): * if (self.tree) == 0: # <<<<<<<<<<<<<< * # should happen only if __init__ was never called * return */ - __pyx_1 = (((int)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree) == 0); - if (__pyx_1) { + __pyx_t_1 = (((int)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree) == 0); + if (__pyx_t_1) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":337 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":337 * if (self.tree) == 0: * # should happen only if __init__ was never called * return # <<<<<<<<<<<<<< @@ -2781,24 +3425,27 @@ } __pyx_L5:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":338 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":338 * # should happen only if __init__ was never called * return * self.__free_tree(self.tree) # <<<<<<<<<<<<<< * * cdef void __query(cKDTree self, */ - __pyx_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__free_tree(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__free_tree(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->tree); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 338; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); + __Pyx_XDECREF(__pyx_t_2); __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.__dealloc__"); __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":340 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":340 * self.__free_tree(self.tree) * * cdef void __query(cKDTree self, # <<<<<<<<<<<<<< @@ -2824,31 +3471,41 @@ struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_inode; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_near; struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *__pyx_v_far; - PyObject *__pyx_1 = 0; - int __pyx_2; - int __pyx_3; + PyObject *__pyx_t_1 = NULL; + int __pyx_t_2; + int __pyx_t_3; + int __pyx_t_4; + int __pyx_t_5; + int __pyx_t_6; + double __pyx_t_7; + Py_ssize_t __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("__query"); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":371 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":371 * # distances between the nearest side of the cell and the target * # the head node of the cell * heapcreate(&q,12) # <<<<<<<<<<<<<< * * # priority queue for the nearest neighbors */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_q), 12); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_q), 12); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 371; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":376 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":376 * # furthest known neighbor first * # entries are (-distance**p, i) * heapcreate(&neighbors,k) # <<<<<<<<<<<<<< * * # set up first nodeinfo */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_neighbors), __pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapcreate((&__pyx_v_neighbors), __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 376; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":379 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":379 * * # set up first nodeinfo * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) # <<<<<<<<<<<<<< @@ -2857,7 +3514,7 @@ */ __pyx_v_inf = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo)) + (__pyx_v_self->m * (sizeof(double)))))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":380 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":380 * # set up first nodeinfo * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * inf.node = self.tree # <<<<<<<<<<<<<< @@ -2866,17 +3523,18 @@ */ __pyx_v_inf->node = __pyx_v_self->tree; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":381 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":381 * inf = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * inf.node = self.tree * for i in range(self.m): # <<<<<<<<<<<<<< * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":382 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":382 * inf.node = self.tree * for i in range(self.m): * inf.side_distances[i] = 0 # <<<<<<<<<<<<<< @@ -2885,7 +3543,7 @@ */ (__pyx_v_inf->side_distances[__pyx_v_i]) = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":383 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":383 * for i in range(self.m): * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] # <<<<<<<<<<<<<< @@ -2894,17 +3552,17 @@ */ __pyx_v_t = ((__pyx_v_x[__pyx_v_i]) - (__pyx_v_self->raw_maxes[__pyx_v_i])); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":384 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":384 * inf.side_distances[i] = 0 * t = x[i]-self.raw_maxes[i] * if t>inf.side_distances[i]: # <<<<<<<<<<<<<< * inf.side_distances[i] = t * else: */ - __pyx_3 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); - if (__pyx_3) { + __pyx_t_4 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":385 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":385 * t = x[i]-self.raw_maxes[i] * if t>inf.side_distances[i]: * inf.side_distances[i] = t # <<<<<<<<<<<<<< @@ -2916,7 +3574,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":387 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":387 * inf.side_distances[i] = t * else: * t = self.raw_mins[i]-x[i] # <<<<<<<<<<<<<< @@ -2925,17 +3583,17 @@ */ __pyx_v_t = ((__pyx_v_self->raw_mins[__pyx_v_i]) - (__pyx_v_x[__pyx_v_i])); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":388 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":388 * else: * t = self.raw_mins[i]-x[i] * if t>inf.side_distances[i]: # <<<<<<<<<<<<<< * inf.side_distances[i] = t * if p!=1 and p!=infinity: */ - __pyx_3 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); - if (__pyx_3) { + __pyx_t_4 = (__pyx_v_t > (__pyx_v_inf->side_distances[__pyx_v_i])); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":389 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":389 * t = self.raw_mins[i]-x[i] * if t>inf.side_distances[i]: * inf.side_distances[i] = t # <<<<<<<<<<<<<< @@ -2949,20 +3607,23 @@ } __pyx_L5:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":390 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":390 * if t>inf.side_distances[i]: * inf.side_distances[i] = t * if p!=1 and p!=infinity: # <<<<<<<<<<<<<< * inf.side_distances[i]=inf.side_distances[i]**p * */ - __pyx_3 = (__pyx_v_p != 1); - if (__pyx_3) { - __pyx_3 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_4 = (__pyx_v_p != 1); + if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_6 = __pyx_t_5; + } else { + __pyx_t_6 = __pyx_t_4; } - if (__pyx_3) { + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":391 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":391 * inf.side_distances[i] = t * if p!=1 and p!=infinity: * inf.side_distances[i]=inf.side_distances[i]**p # <<<<<<<<<<<<<< @@ -2975,36 +3636,37 @@ __pyx_L7:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":394 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":394 * * # compute first distance * min_distance = 0. # <<<<<<<<<<<<<< * for i in range(self.m): * if p==infinity: */ - __pyx_v_min_distance = 0.; + __pyx_v_min_distance = 0.0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":395 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":395 * # compute first distance * min_distance = 0. * for i in range(self.m): # <<<<<<<<<<<<<< * if p==infinity: * min_distance = dmax(min_distance,inf.side_distances[i]) */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":396 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":396 * min_distance = 0. * for i in range(self.m): * if p==infinity: # <<<<<<<<<<<<<< * min_distance = dmax(min_distance,inf.side_distances[i]) * else: */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":397 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":397 * for i in range(self.m): * if p==infinity: * min_distance = dmax(min_distance,inf.side_distances[i]) # <<<<<<<<<<<<<< @@ -3016,7 +3678,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":399 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":399 * min_distance = dmax(min_distance,inf.side_distances[i]) * else: * min_distance += inf.side_distances[i] # <<<<<<<<<<<<<< @@ -3028,17 +3690,17 @@ __pyx_L10:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":402 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":402 * * # fiddle approximation factor * if eps==0: # <<<<<<<<<<<<<< * epsfac=1 * elif p==infinity: */ - __pyx_3 = (__pyx_v_eps == 0); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_eps == 0); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":403 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":403 * # fiddle approximation factor * if eps==0: * epsfac=1 # <<<<<<<<<<<<<< @@ -3049,53 +3711,66 @@ goto __pyx_L11; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":404 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":404 * if eps==0: * epsfac=1 * elif p==infinity: # <<<<<<<<<<<<<< * epsfac = 1/(1+eps) * else: */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":405 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":405 * epsfac=1 * elif p==infinity: * epsfac = 1/(1+eps) # <<<<<<<<<<<<<< * else: * epsfac = 1/(1+eps)**p */ - __pyx_v_epsfac = (1 / (1 + __pyx_v_eps)); + __pyx_t_7 = (1 + __pyx_v_eps); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 405; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_epsfac = (1 / __pyx_t_7); goto __pyx_L11; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":407 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":407 * epsfac = 1/(1+eps) * else: * epsfac = 1/(1+eps)**p # <<<<<<<<<<<<<< * * # internally we represent all distances as distance**p */ - __pyx_v_epsfac = (1 / pow((1 + __pyx_v_eps), __pyx_v_p)); + __pyx_t_7 = pow((1 + __pyx_v_eps), __pyx_v_p); + if (unlikely(__pyx_t_7 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 407; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_epsfac = (1 / __pyx_t_7); } __pyx_L11:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":410 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":410 * * # internally we represent all distances as distance**p * if p!=infinity and distance_upper_bound!=infinity: # <<<<<<<<<<<<<< * distance_upper_bound = distance_upper_bound**p * */ - __pyx_3 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { - __pyx_3 = (__pyx_v_distance_upper_bound != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_6 = (__pyx_v_p != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_6) { + __pyx_t_4 = (__pyx_v_distance_upper_bound != __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_5 = __pyx_t_4; + } else { + __pyx_t_5 = __pyx_t_6; } - if (__pyx_3) { + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":411 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":411 * # internally we represent all distances as distance**p * if p!=infinity and distance_upper_bound!=infinity: * distance_upper_bound = distance_upper_bound**p # <<<<<<<<<<<<<< @@ -3107,7 +3782,7 @@ } __pyx_L12:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":413 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":413 * distance_upper_bound = distance_upper_bound**p * * while True: # <<<<<<<<<<<<<< @@ -3115,20 +3790,20 @@ * node = inf.node */ while (1) { - __pyx_3 = 1; - if (!__pyx_3) break; + __pyx_t_5 = 1; + if (!__pyx_t_5) break; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":414 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":414 * * while True: * if inf.node.split_dim==-1: # <<<<<<<<<<<<<< * node = inf.node * */ - __pyx_3 = (__pyx_v_inf->node->split_dim == -1); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_inf->node->split_dim == -1); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":415 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":415 * while True: * if inf.node.split_dim==-1: * node = inf.node # <<<<<<<<<<<<<< @@ -3137,17 +3812,18 @@ */ __pyx_v_node = ((struct __pyx_t_5scipy_7spatial_7ckdtree_leafnode *)__pyx_v_inf->node); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":418 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":418 * * # brute-force * for i in range(node.start_idx,node.end_idx): # <<<<<<<<<<<<<< * d = _distance_p( * self.raw_data+self.raw_indices[i]*self.m, */ - __pyx_2 = __pyx_v_node->end_idx; - for (__pyx_v_i = __pyx_v_node->start_idx; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_node->end_idx; + for (__pyx_t_3 = __pyx_v_node->start_idx; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":421 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":421 * d = _distance_p( * self.raw_data+self.raw_indices[i]*self.m, * x,p,self.m,distance_upper_bound) # <<<<<<<<<<<<<< @@ -3156,40 +3832,41 @@ */ __pyx_v_d = __pyx_f_5scipy_7spatial_7ckdtree__distance_p((__pyx_v_self->raw_data + ((__pyx_v_self->raw_indices[__pyx_v_i]) * __pyx_v_self->m)), __pyx_v_x, __pyx_v_p, __pyx_v_self->m, __pyx_v_distance_upper_bound); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":423 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":423 * x,p,self.m,distance_upper_bound) * * if draw_indices[__pyx_v_i]); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":429 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":429 * neighbor.priority = -d * neighbor.contents.intdata = self.raw_indices[i] * heappush(&neighbors,neighbor) # <<<<<<<<<<<<<< * * # adjust upper bound for efficiency */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_neighbors), __pyx_v_neighbor); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_neighbors), __pyx_v_neighbor); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 429; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":432 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":432 * * # adjust upper bound for efficiency * if neighbors.n==k: # <<<<<<<<<<<<<< * distance_upper_bound = -heappeek(&neighbors).priority * # done with this node, get another */ - __pyx_3 = (__pyx_v_neighbors.n == __pyx_v_k); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_neighbors.n == __pyx_v_k); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":433 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":433 * # adjust upper bound for efficiency * if neighbors.n==k: * distance_upper_bound = -heappeek(&neighbors).priority # <<<<<<<<<<<<<< @@ -3243,7 +3921,7 @@ __pyx_L18:; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":435 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":435 * distance_upper_bound = -heappeek(&neighbors).priority * # done with this node, get another * stdlib.free(inf) # <<<<<<<<<<<<<< @@ -3252,29 +3930,29 @@ */ free(__pyx_v_inf); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":436 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":436 * # done with this node, get another * stdlib.free(inf) * if q.n==0: # <<<<<<<<<<<<<< * # no more nodes to visit * break */ - __pyx_3 = (__pyx_v_q.n == 0); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_q.n == 0); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":438 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":438 * if q.n==0: * # no more nodes to visit * break # <<<<<<<<<<<<<< * else: * it = heappop(&q) */ - goto __pyx_L14; + goto __pyx_L14_break; goto __pyx_L21; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":440 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":440 * break * else: * it = heappop(&q) # <<<<<<<<<<<<<< @@ -3283,7 +3961,7 @@ */ __pyx_v_it = __pyx_f_5scipy_7spatial_7ckdtree_heappop((&__pyx_v_q)); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":441 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":441 * else: * it = heappop(&q) * inf = it.contents.ptrdata # <<<<<<<<<<<<<< @@ -3292,7 +3970,7 @@ */ __pyx_v_inf = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)__pyx_v_it.contents.ptrdata); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":442 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":442 * it = heappop(&q) * inf = it.contents.ptrdata * min_distance = it.priority # <<<<<<<<<<<<<< @@ -3306,7 +3984,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":444 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":444 * min_distance = it.priority * else: * inode = inf.node # <<<<<<<<<<<<<< @@ -3315,17 +3993,17 @@ */ __pyx_v_inode = ((struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *)__pyx_v_inf->node); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":449 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":449 * # but since the distance_upper_bound decreases, we might get * # here even if the cell's too far * if min_distance>distance_upper_bound*epsfac: # <<<<<<<<<<<<<< * # since this is the nearest cell, we're done, bail out * stdlib.free(inf) */ - __pyx_3 = (__pyx_v_min_distance > (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_min_distance > (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":451 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":451 * if min_distance>distance_upper_bound*epsfac: * # since this is the nearest cell, we're done, bail out * stdlib.free(inf) # <<<<<<<<<<<<<< @@ -3334,17 +4012,18 @@ */ free(__pyx_v_inf); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":453 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":453 * stdlib.free(inf) * # free all the nodes still on the heap * for i in range(q.n): # <<<<<<<<<<<<<< * stdlib.free(q.heap[i].contents.ptrdata) * break */ - __pyx_2 = __pyx_v_q.n; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_q.n; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":454 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":454 * # free all the nodes still on the heap * for i in range(q.n): * stdlib.free(q.heap[i].contents.ptrdata) # <<<<<<<<<<<<<< @@ -3354,29 +4033,29 @@ free((__pyx_v_q.heap[__pyx_v_i]).contents.ptrdata); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":455 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":455 * for i in range(q.n): * stdlib.free(q.heap[i].contents.ptrdata) * break # <<<<<<<<<<<<<< * * # set up children for searching */ - goto __pyx_L14; + goto __pyx_L14_break; goto __pyx_L22; } __pyx_L22:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":458 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":458 * * # set up children for searching * if x[inode.split_dim]split_dim]) < __pyx_v_inode->split); - if (__pyx_3) { + __pyx_t_5 = ((__pyx_v_x[__pyx_v_inode->split_dim]) < __pyx_v_inode->split); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":459 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":459 * # set up children for searching * if x[inode.split_dim]less; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":460 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":460 * if x[inode.split_dim]greater; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":463 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":463 * else: * near = inode.greater * far = inode.less # <<<<<<<<<<<<<< @@ -3417,7 +4096,7 @@ } __pyx_L25:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":468 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":468 * # we're going here next, so no point pushing it on the queue * # no need to recompute the distance or the side_distances * inf.node = near # <<<<<<<<<<<<<< @@ -3426,7 +4105,7 @@ */ __pyx_v_inf->node = __pyx_v_near; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":473 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":473 * # on the split value; compute its distance and side_distances * # and push it on the queue if it's near enough * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) # <<<<<<<<<<<<<< @@ -3435,7 +4114,7 @@ */ __pyx_v_inf2 = ((struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo *)malloc(((sizeof(struct __pyx_t_5scipy_7spatial_7ckdtree_nodeinfo)) + (__pyx_v_self->m * (sizeof(double)))))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":474 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":474 * # and push it on the queue if it's near enough * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * it2.contents.ptrdata = inf2 # <<<<<<<<<<<<<< @@ -3444,7 +4123,7 @@ */ __pyx_v_it2.contents.ptrdata = ((char *)__pyx_v_inf2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":475 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":475 * inf2 = stdlib.malloc(sizeof(nodeinfo)+self.m*sizeof(double)) * it2.contents.ptrdata = inf2 * inf2.node = far # <<<<<<<<<<<<<< @@ -3453,17 +4132,18 @@ */ __pyx_v_inf2->node = __pyx_v_far; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":477 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":477 * inf2.node = far * # most side distances unchanged * for i in range(self.m): # <<<<<<<<<<<<<< * inf2.side_distances[i] = inf.side_distances[i] * */ - __pyx_2 = __pyx_v_self->m; - for (__pyx_v_i = 0; __pyx_v_i < __pyx_2; __pyx_v_i+=1) { + __pyx_t_2 = __pyx_v_self->m; + for (__pyx_t_3 = 0; __pyx_t_3 < __pyx_t_2; __pyx_t_3+=1) { + __pyx_v_i = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":478 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":478 * # most side distances unchanged * for i in range(self.m): * inf2.side_distances[i] = inf.side_distances[i] # <<<<<<<<<<<<<< @@ -3473,17 +4153,17 @@ (__pyx_v_inf2->side_distances[__pyx_v_i]) = (__pyx_v_inf->side_distances[__pyx_v_i]); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":482 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":482 * # one side distance changes * # we can adjust the minimum distance without recomputing * if p == infinity: # <<<<<<<<<<<<<< * # we never use side_distances in the l_infinity case * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) */ - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":485 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":485 * # we never use side_distances in the l_infinity case * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) # <<<<<<<<<<<<<< @@ -3494,17 +4174,17 @@ goto __pyx_L28; } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":486 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":486 * # inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) * elif p == 1: # <<<<<<<<<<<<<< * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] */ - __pyx_3 = (__pyx_v_p == 1); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_p == 1); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":487 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":487 * far_min_distance = dmax(min_distance, dabs(inode.split-x[inode.split_dim])) * elif p == 1: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) # <<<<<<<<<<<<<< @@ -3513,7 +4193,7 @@ */ (__pyx_v_inf2->side_distances[__pyx_v_inode->split_dim]) = __pyx_f_5scipy_7spatial_7ckdtree_dabs((__pyx_v_inode->split - (__pyx_v_x[__pyx_v_inode->split_dim]))); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":488 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":488 * elif p == 1: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim]) * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] # <<<<<<<<<<<<<< @@ -3525,7 +4205,7 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":490 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":490 * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] * else: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim])**p # <<<<<<<<<<<<<< @@ -3534,7 +4214,7 @@ */ (__pyx_v_inf2->side_distances[__pyx_v_inode->split_dim]) = pow(__pyx_f_5scipy_7spatial_7ckdtree_dabs((__pyx_v_inode->split - (__pyx_v_x[__pyx_v_inode->split_dim]))), __pyx_v_p); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":491 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":491 * else: * inf2.side_distances[inode.split_dim] = dabs(inode.split-x[inode.split_dim])**p * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] # <<<<<<<<<<<<<< @@ -3545,7 +4225,7 @@ } __pyx_L28:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":493 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":493 * far_min_distance = min_distance - inf.side_distances[inode.split_dim] + inf2.side_distances[inode.split_dim] * * it2.priority = far_min_distance # <<<<<<<<<<<<<< @@ -3554,30 +4234,31 @@ */ __pyx_v_it2.priority = __pyx_v_far_min_distance; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":497 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":497 * * # far child might be too far, if so, don't bother pushing it * if far_min_distance<=distance_upper_bound*epsfac: # <<<<<<<<<<<<<< * heappush(&q,it2) * else: */ - __pyx_3 = (__pyx_v_far_min_distance <= (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); - if (__pyx_3) { + __pyx_t_5 = (__pyx_v_far_min_distance <= (__pyx_v_distance_upper_bound * __pyx_v_epsfac)); + if (__pyx_t_5) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":498 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":498 * # far child might be too far, if so, don't bother pushing it * if far_min_distance<=distance_upper_bound*epsfac: * heappush(&q,it2) # <<<<<<<<<<<<<< * else: * stdlib.free(inf2) */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_q), __pyx_v_it2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __pyx_f_5scipy_7spatial_7ckdtree_heappush((&__pyx_v_q), __pyx_v_it2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 498; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; goto __pyx_L29; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":500 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":500 * heappush(&q,it2) * else: * stdlib.free(inf2) # <<<<<<<<<<<<<< @@ -3586,7 +4267,7 @@ */ free(__pyx_v_inf2); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":502 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":502 * stdlib.free(inf2) * # just in case * it2.contents.ptrdata = 0 # <<<<<<<<<<<<<< @@ -3599,18 +4280,58 @@ } __pyx_L15:; } - __pyx_L14:; + __pyx_L14_break:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":505 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":505 * * # fill output arrays with sorted neighbors * for i in range(neighbors.n-1,-1,-1): # <<<<<<<<<<<<<< * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata */ - for (__pyx_v_i = (__pyx_v_neighbors.n - 1); __pyx_v_i > -1; __pyx_v_i-=1) { + __pyx_t_1 = PyInt_FromLong((__pyx_v_neighbors.n - 1)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_builtin_range, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + if (PyList_CheckExact(__pyx_t_1) || PyTuple_CheckExact(__pyx_t_1)) { + __pyx_t_8 = 0; __pyx_t_9 = __pyx_t_1; __Pyx_INCREF(__pyx_t_9); + } else { + __pyx_t_8 = -1; __pyx_t_9 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + } + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_9))) { + if (__pyx_t_8 >= PyList_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyList_GET_ITEM(__pyx_t_9, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; + } else if (likely(PyTuple_CheckExact(__pyx_t_9))) { + if (__pyx_t_8 >= PyTuple_GET_SIZE(__pyx_t_9)) break; + __pyx_t_1 = PyTuple_GET_ITEM(__pyx_t_9, __pyx_t_8); __Pyx_INCREF(__pyx_t_1); __pyx_t_8++; + } else { + __pyx_t_1 = PyIter_Next(__pyx_t_9); + if (!__pyx_t_1) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_1); + } + __pyx_t_2 = __Pyx_PyInt_AsInt(__pyx_t_1); if (unlikely((__pyx_t_2 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 505; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_v_i = __pyx_t_2; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":506 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":506 * # fill output arrays with sorted neighbors * for i in range(neighbors.n-1,-1,-1): * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced # <<<<<<<<<<<<<< @@ -3619,7 +4340,7 @@ */ __pyx_v_neighbor = __pyx_f_5scipy_7spatial_7ckdtree_heappop((&__pyx_v_neighbors)); - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":507 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":507 * for i in range(neighbors.n-1,-1,-1): * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata # <<<<<<<<<<<<<< @@ -3628,20 +4349,23 @@ */ (__pyx_v_result_indices[__pyx_v_i]) = __pyx_v_neighbor.contents.intdata; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":508 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":508 * neighbor = heappop(&neighbors) # FIXME: neighbors may be realloced * result_indices[i] = neighbor.contents.intdata * if p==1 or p==infinity: # <<<<<<<<<<<<<< * result_distances[i] = -neighbor.priority * else: */ - __pyx_3 = (__pyx_v_p == 1); - if (!__pyx_3) { - __pyx_3 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_5 = (__pyx_v_p == 1); + if (!__pyx_t_5) { + __pyx_t_6 = (__pyx_v_p == __pyx_v_5scipy_7spatial_7ckdtree_infinity); + __pyx_t_4 = __pyx_t_6; + } else { + __pyx_t_4 = __pyx_t_5; } - if (__pyx_3) { + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":509 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":509 * result_indices[i] = neighbor.contents.intdata * if p==1 or p==infinity: * result_distances[i] = -neighbor.priority # <<<<<<<<<<<<<< @@ -3653,46 +4377,56 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":511 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":511 * result_distances[i] = -neighbor.priority * else: * result_distances[i] = (-neighbor.priority)**(1./p) # <<<<<<<<<<<<<< * * heapdestroy(&q) */ - (__pyx_v_result_distances[__pyx_v_i]) = pow((-__pyx_v_neighbor.priority), (1. / __pyx_v_p)); + if (unlikely(__pyx_v_p == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 511; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + (__pyx_v_result_distances[__pyx_v_i]) = pow((-__pyx_v_neighbor.priority), (1.0 / __pyx_v_p)); } __pyx_L32:; } + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":513 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":513 * result_distances[i] = (-neighbor.priority)**(1./p) * * heapdestroy(&q) # <<<<<<<<<<<<<< * heapdestroy(&neighbors) * */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_q)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_9 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_q)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 513; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":514 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":514 * * heapdestroy(&q) * heapdestroy(&neighbors) # <<<<<<<<<<<<<< * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, */ - __pyx_1 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_neighbors)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_9 = __pyx_f_5scipy_7spatial_7ckdtree_heapdestroy((&__pyx_v_neighbors)); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 514; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("scipy.spatial.ckdtree.cKDTree.__query"); __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); } -/* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":516 +/* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":516 * heapdestroy(&neighbors) * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, # <<<<<<<<<<<<<< @@ -3730,34 +4464,31 @@ Py_ssize_t __pyx_bstride_1_dd = 0; Py_ssize_t __pyx_bshape_0_dd = 0; Py_ssize_t __pyx_bshape_1_dd = 0; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - Py_ssize_t __pyx_6 = 0; - PyObject *__pyx_7 = 0; - int __pyx_8; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; - PyArrayObject *__pyx_t_2 = NULL; - int __pyx_t_3; - PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + int __pyx_t_4; PyObject *__pyx_t_5 = NULL; - PyArrayObject *__pyx_t_6 = NULL; + Py_ssize_t __pyx_t_6; PyArrayObject *__pyx_t_7 = NULL; - long __pyx_t_8; - long __pyx_t_9; - long __pyx_t_10; - long __pyx_t_11; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_x,&__pyx_kp_k,&__pyx_kp_eps,&__pyx_kp_p,&__pyx_kp_23,0}; - __pyx_v_k = 1; - __pyx_v_eps = ((double)0); - __pyx_v_p = ((double)2); - __pyx_v_distance_upper_bound = __pyx_k_24; + int __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyObject *__pyx_t_11 = NULL; + PyObject *__pyx_t_12 = NULL; + PyArrayObject *__pyx_t_13 = NULL; + PyArrayObject *__pyx_t_14 = NULL; + long __pyx_t_15; + long __pyx_t_16; + long __pyx_t_17; + long __pyx_t_18; + long __pyx_t_19; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__x,&__pyx_n_s__k,&__pyx_n_s__eps,&__pyx_n_s__p,&__pyx_n_s_3,0}; + __Pyx_RefNannySetupContext("query"); if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[5] = {0,0,0,0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: values[4] = PyTuple_GET_ITEM(__pyx_args, 4); case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); @@ -3769,32 +4500,64 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; + case 1: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); + if (unlikely(value)) { values[1] = value; kw_args--; } + } + case 2: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__eps); + if (unlikely(value)) { values[2] = value; kw_args--; } + } + case 3: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); + if (unlikely(value)) { values[3] = value; kw_args--; } + } + case 4: + if (kw_args > 1) { + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s_3); + if (unlikely(value)) { values[4] = value; kw_args--; } + } } if (unlikely(kw_args > 0)) { if (unlikely(__Pyx_ParseOptionalKeywords(__pyx_kwds, __pyx_pyargnames, 0, values, PyTuple_GET_SIZE(__pyx_args), "query") < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } __pyx_v_x = values[0]; if (values[1]) { - __pyx_v_k = __pyx_PyInt_int(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_k = __Pyx_PyInt_AsInt(values[1]); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_k = ((int)1); } if (values[2]) { - __pyx_v_eps = __pyx_PyFloat_AsDouble(values[2]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_eps = __pyx_PyFloat_AsDouble(values[2]); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_eps = ((double)0); } if (values[3]) { - __pyx_v_p = __pyx_PyFloat_AsDouble(values[3]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_p = __pyx_PyFloat_AsDouble(values[3]); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_p = ((double)2); } if (values[4]) { - __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(values[4]); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(values[4]); if (unlikely((__pyx_v_distance_upper_bound == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + } else { + __pyx_v_distance_upper_bound = __pyx_k_4; } } else { + __pyx_v_k = ((int)1); + __pyx_v_eps = ((double)0); + __pyx_v_p = ((double)2); + __pyx_v_distance_upper_bound = __pyx_k_4; switch (PyTuple_GET_SIZE(__pyx_args)) { - case 5: __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 4: __pyx_v_p = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 3: __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} - case 2: __pyx_v_k = __pyx_PyInt_int(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 5: __pyx_v_distance_upper_bound = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 4)); if (unlikely((__pyx_v_distance_upper_bound == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 517; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 4: __pyx_v_p = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 3)); if (unlikely((__pyx_v_p == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 3: __pyx_v_eps = __pyx_PyFloat_AsDouble(PyTuple_GET_ITEM(__pyx_args, 2)); if (unlikely((__pyx_v_eps == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} + case 2: __pyx_v_k = __Pyx_PyInt_AsInt(PyTuple_GET_ITEM(__pyx_args, 1)); if (unlikely((__pyx_v_k == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 516; __pyx_clineno = __LINE__; goto __pyx_L3_error;} case 1: __pyx_v_x = PyTuple_GET_ITEM(__pyx_args, 0); break; default: goto __pyx_L5_argtuple_error; @@ -3807,472 +4570,585 @@ __Pyx_AddTraceback("scipy.spatial.ckdtree.cKDTree.query"); return NULL; __pyx_L4_argument_unpacking_done:; - Py_INCREF(__pyx_v_x); - __pyx_v_ii = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_dd = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_xx = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_single = Py_None; Py_INCREF(Py_None); - __pyx_v_retshape = Py_None; Py_INCREF(Py_None); - __pyx_v_n = Py_None; Py_INCREF(Py_None); + __Pyx_INCREF((PyObject *)__pyx_v_self); + __Pyx_INCREF(__pyx_v_x); + __pyx_v_ii = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_dd = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_xx = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_single = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_retshape = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_n = Py_None; __Pyx_INCREF(Py_None); __pyx_bstruct_ii.buf = NULL; __pyx_bstruct_dd.buf = NULL; __pyx_bstruct_xx.buf = NULL; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":558 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":558 * cdef np.ndarray[double, ndim=2] xx * cdef int c * x = np.asarray(x).astype(np.float) # <<<<<<<<<<<<<< * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_astype); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_float); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_3); - __pyx_3 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__astype); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__float); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 558; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":559 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":559 * cdef int c * x = np.asarray(x).astype(np.float) * if np.shape(x)[-1] != self.m: # <<<<<<<<<<<<<< * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_shape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_1 = __Pyx_GetItemInt(__pyx_2, -1, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_RichCompare(__pyx_1, __pyx_3, Py_NE); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_2); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (__pyx_4) { + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetItemInt(__pyx_t_1, -1, sizeof(long), PyInt_FromLong); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_t_1, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 559; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":560 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":560 * x = np.asarray(x).astype(np.float) * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) # <<<<<<<<<<<<<< * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") */ - __pyx_1 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_shape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_5 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_5); - __pyx_1 = 0; - __pyx_5 = 0; - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_28, ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_1 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_1, 0, 0); - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_5 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_3 = 0; + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Remainder(((PyObject *)__pyx_kp_s_5), __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 560; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":561 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":561 * if np.shape(x)[-1] != self.m: * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: # <<<<<<<<<<<<<< * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: */ - __pyx_4 = (__pyx_v_p < 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_p < 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":562 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":562 * raise ValueError("x must consist of vectors of length %d but has shape %s" % (self.m, np.shape(x))) * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") # <<<<<<<<<<<<<< * if len(x.shape)==1: * single = True */ - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_29); - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_kp_29); - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_6)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_s_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_6)); + __pyx_t_1 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_1, 0, 0); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 562; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":563 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":563 * if p<1: * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: # <<<<<<<<<<<<<< * single = True * x = x[np.newaxis,:] */ - __pyx_3 = PyObject_GetAttr(__pyx_v_x, __pyx_kp_shape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Length(__pyx_3); if (unlikely(__pyx_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = (__pyx_6 == 1); - if (__pyx_4) { + __pyx_t_1 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__shape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_6 = PyObject_Length(__pyx_t_1); if (unlikely(__pyx_t_6 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 563; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_4 = (__pyx_t_6 == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":564 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":564 * raise ValueError("Only p-norms with 1<=p<=infinity permitted") * if len(x.shape)==1: * single = True # <<<<<<<<<<<<<< * x = x[np.newaxis,:] * else: */ - __pyx_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_single); - __pyx_v_single = __pyx_1; - __pyx_1 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 564; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_single); + __pyx_v_single = __pyx_t_1; + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":565 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":565 * if len(x.shape)==1: * single = True * x = x[np.newaxis,:] # <<<<<<<<<<<<<< * else: * single = False */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_5, __pyx_kp_newaxis); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_3 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_3); - __pyx_2 = 0; - __pyx_3 = 0; - __pyx_5 = PyObject_GetItem(__pyx_v_x, ((PyObject *)__pyx_1)); if (!__pyx_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_5; - __pyx_5 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__newaxis); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySlice_New(Py_None, Py_None, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetItem(__pyx_v_x, __pyx_t_3); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 565; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L8; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":567 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":567 * x = x[np.newaxis,:] * else: * single = False # <<<<<<<<<<<<<< * retshape = np.shape(x)[:-1] * n = np.prod(retshape) */ - __pyx_2 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_single); - __pyx_v_single = __pyx_2; - __pyx_2 = 0; + __pyx_t_1 = __Pyx_PyBool_FromLong(0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 567; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_single); + __pyx_v_single = __pyx_t_1; + __pyx_t_1 = 0; } __pyx_L8:; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":568 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":568 * else: * single = False * retshape = np.shape(x)[:-1] # <<<<<<<<<<<<<< * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_3, __pyx_kp_shape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_5 = PyTuple_New(1); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_5, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_3 = PySequence_GetSlice(__pyx_2, 0, -1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_v_retshape); - __pyx_v_retshape = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__shape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PySequence_GetSlice(__pyx_t_5, 0, -1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 568; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_retshape); + __pyx_v_retshape = __pyx_t_1; + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":569 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":569 * single = False * retshape = np.shape(x)[:-1] * n = np.prod(retshape) # <<<<<<<<<<<<<< * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_prod); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_retshape); - __pyx_3 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__prod); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_3 = PyObject_Call(__pyx_t_5, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 569; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_n); + __pyx_v_n = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":570 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":570 * retshape = np.shape(x)[:-1] * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) # <<<<<<<<<<<<<< * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_1, __pyx_kp_reshape); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_2); - __pyx_2 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_x); - PyTuple_SET_ITEM(__pyx_1, 1, ((PyObject *)__pyx_3)); - __pyx_3 = 0; - __pyx_2 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_2, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_5); { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_xx, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_v_xx, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } + } + __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; + __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; - __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 570; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = 0; - Py_DECREF(((PyObject *)__pyx_v_xx)); - __pyx_v_xx = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_xx)); + __pyx_v_xx = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":571 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":571 * n = np.prod(retshape) * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) # <<<<<<<<<<<<<< * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_kp_ascontiguousarray); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_xx)); - PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_v_xx)); - __pyx_2 = PyObject_Call(__pyx_5, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_2, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__ascontiguousarray); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_xx)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_xx)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_xx)); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (!(likely(((__pyx_t_1) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_1, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_7 = ((PyArrayObject *)__pyx_t_1); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_xx, &__pyx_bstruct_xx, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_1); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_t_7, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_xx, (PyObject*)__pyx_v_xx, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } + } + __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; + __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_xx = __pyx_bstruct_xx.strides[0]; __pyx_bstride_1_xx = __pyx_bstruct_xx.strides[1]; - __pyx_bshape_0_xx = __pyx_bstruct_xx.shape[0]; __pyx_bshape_1_xx = __pyx_bstruct_xx.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 571; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = 0; - Py_DECREF(((PyObject *)__pyx_v_xx)); - __pyx_v_xx = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_7 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_xx)); + __pyx_v_xx = ((PyArrayObject *)__pyx_t_1); + __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":572 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":572 * xx = np.reshape(x,(n,self.m)) * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) # <<<<<<<<<<<<<< * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_3, __pyx_kp_empty); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_1); - __pyx_1 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, ((PyObject *)__pyx_2)); - __pyx_2 = 0; - __pyx_1 = PyDict_New(); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyObject_GetAttr(__pyx_2, __pyx_kp_float); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (PyDict_SetItem(__pyx_1, __pyx_kp_dtype, __pyx_7) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyEval_CallObjectWithKeywords(__pyx_5, ((PyObject *)__pyx_3), ((PyObject *)__pyx_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - if (!(__Pyx_TypeTest(__pyx_2, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = ((PyArrayObject *)__pyx_2); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); - __pyx_t_3 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_6, &__pyx_bstruct_dd, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__empty); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyDict_New(); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_12 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__float); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__dtype), __pyx_t_12) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyEval_CallObjectWithKeywords(__pyx_t_5, __pyx_t_1, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + if (!(likely(((__pyx_t_12) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_12, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_13 = ((PyArrayObject *)__pyx_t_12); { - PyErr_Fetch(&__pyx_t_1, &__pyx_t_4, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_dd, &__pyx_bstruct_dd, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_1, __pyx_t_4, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_dd, (PyObject*)__pyx_t_13, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_9, &__pyx_t_10, &__pyx_t_11); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_dd, (PyObject*)__pyx_v_dd, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_9); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_11); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_9, __pyx_t_10, __pyx_t_11); } + } + __pyx_bstride_0_dd = __pyx_bstruct_dd.strides[0]; __pyx_bstride_1_dd = __pyx_bstruct_dd.strides[1]; + __pyx_bshape_0_dd = __pyx_bstruct_dd.shape[0]; __pyx_bshape_1_dd = __pyx_bstruct_dd.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_dd = __pyx_bstruct_dd.strides[0]; __pyx_bstride_1_dd = __pyx_bstruct_dd.strides[1]; - __pyx_bshape_0_dd = __pyx_bstruct_dd.shape[0]; __pyx_bshape_1_dd = __pyx_bstruct_dd.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 572; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = 0; - Py_DECREF(((PyObject *)__pyx_v_dd)); - __pyx_v_dd = ((PyArrayObject *)__pyx_2); - __pyx_2 = 0; + __pyx_t_13 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_dd)); + __pyx_v_dd = ((PyArrayObject *)__pyx_t_12); + __pyx_t_12 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":573 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":573 * xx = np.ascontiguousarray(xx) * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) # <<<<<<<<<<<<<< * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) */ - __pyx_7 = PyObject_GetAttr(((PyObject *)__pyx_v_dd), __pyx_kp_fill); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyFloat_FromDouble(__pyx_v_5scipy_7spatial_7ckdtree_infinity); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); - __pyx_5 = 0; - __pyx_1 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_12 = PyObject_GetAttr(((PyObject *)__pyx_v_dd), __pyx_n_s__fill); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyFloat_FromDouble(__pyx_v_5scipy_7spatial_7ckdtree_infinity); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_12, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 573; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":574 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":574 * dd = np.empty((n,k),dtype=np.float) * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') # <<<<<<<<<<<<<< * ii.fill(self.n) * for c in range(n): */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyObject_GetAttr(__pyx_2, __pyx_kp_empty); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_7 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_n); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_7); - __pyx_7 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, ((PyObject *)__pyx_3)); - __pyx_3 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyDict_SetItem(__pyx_2, __pyx_kp_dtype, __pyx_kp_30) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyEval_CallObjectWithKeywords(__pyx_5, ((PyObject *)__pyx_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_7, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = ((PyArrayObject *)__pyx_7); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); - __pyx_t_3 = __Pyx_GetBuffer_int((PyObject*)__pyx_t_7, &__pyx_bstruct_ii, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0); - if (unlikely(__pyx_t_3 < 0)) + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__empty); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_v_n); + __Pyx_GIVEREF(__pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyDict_New(); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_12)); + if (PyDict_SetItem(__pyx_t_12, ((PyObject *)__pyx_n_s__dtype), ((PyObject *)__pyx_n_s__i)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_12)); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_12)); __pyx_t_12 = 0; + if (!(likely(((__pyx_t_5) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_5, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_14 = ((PyArrayObject *)__pyx_t_5); { - PyErr_Fetch(&__pyx_t_5, &__pyx_t_4, &__pyx_t_1); - if (unlikely(__Pyx_GetBuffer_int((PyObject*)__pyx_v_ii, &__pyx_bstruct_ii, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0) == -1)) { - Py_XDECREF(__pyx_t_5); Py_XDECREF(__pyx_t_4); Py_XDECREF(__pyx_t_1); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_5, __pyx_t_4, __pyx_t_1); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); + __pyx_t_8 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_ii, (PyObject*)__pyx_t_14, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack); + if (unlikely(__pyx_t_8 < 0)) { + PyErr_Fetch(&__pyx_t_11, &__pyx_t_10, &__pyx_t_9); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_ii, (PyObject*)__pyx_v_ii, &__Pyx_TypeInfo_int, PyBUF_FORMAT| PyBUF_STRIDES, 2, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_11); Py_XDECREF(__pyx_t_10); Py_XDECREF(__pyx_t_9); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_11, __pyx_t_10, __pyx_t_9); } + } + __pyx_bstride_0_ii = __pyx_bstruct_ii.strides[0]; __pyx_bstride_1_ii = __pyx_bstruct_ii.strides[1]; + __pyx_bshape_0_ii = __pyx_bstruct_ii.shape[0]; __pyx_bshape_1_ii = __pyx_bstruct_ii.shape[1]; + if (unlikely(__pyx_t_8 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_ii = __pyx_bstruct_ii.strides[0]; __pyx_bstride_1_ii = __pyx_bstruct_ii.strides[1]; - __pyx_bshape_0_ii = __pyx_bstruct_ii.shape[0]; __pyx_bshape_1_ii = __pyx_bstruct_ii.shape[1]; - if (unlikely(__pyx_t_3 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 574; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_7 = 0; - Py_DECREF(((PyObject *)__pyx_v_ii)); - __pyx_v_ii = ((PyArrayObject *)__pyx_7); - __pyx_7 = 0; + __pyx_t_14 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_ii)); + __pyx_v_ii = ((PyArrayObject *)__pyx_t_5); + __pyx_t_5 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":575 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":575 * dd.fill(infinity) * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) # <<<<<<<<<<<<<< * for c in range(n): * self.__query( */ - __pyx_3 = PyObject_GetAttr(((PyObject *)__pyx_v_ii), __pyx_kp_fill); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_5); - __pyx_5 = 0; - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_5 = PyObject_GetAttr(((PyObject *)__pyx_v_ii), __pyx_n_s__fill); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_12 = PyInt_FromLong(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->n); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_5, __pyx_t_3, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 575; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":576 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":576 * ii = np.empty((n,k),dtype='i') * ii.fill(self.n) * for c in range(n): # <<<<<<<<<<<<<< * self.__query( * (dd.data)+c*k, */ - __pyx_8 = __pyx_PyInt_int(__pyx_v_n); if (unlikely((__pyx_8 == (int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_c = 0; __pyx_v_c < __pyx_8; __pyx_v_c+=1) { + __pyx_t_15 = __Pyx_PyInt_AsLong(__pyx_v_n); if (unlikely((__pyx_t_15 == (long)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 576; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_8 = 0; __pyx_t_8 < __pyx_t_15; __pyx_t_8+=1) { + __pyx_v_c = __pyx_t_8; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":584 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":584 * eps, * p, * distance_upper_bound) # <<<<<<<<<<<<<< @@ -4282,93 +5158,105 @@ ((struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree *)((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->__pyx_vtab)->__query(((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self), (((double *)__pyx_v_dd->data) + (__pyx_v_c * __pyx_v_k)), (((int *)__pyx_v_ii->data) + (__pyx_v_c * __pyx_v_k)), (((double *)__pyx_v_xx->data) + (__pyx_v_c * ((struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *)__pyx_v_self)->m)), __pyx_v_k, __pyx_v_eps, __pyx_v_p, __pyx_v_distance_upper_bound); } - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":585 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":585 * p, * distance_upper_bound) * if single: # <<<<<<<<<<<<<< * if k==1: * return dd[0,0], ii[0,0] */ - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_single); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_4) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_single); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 585; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":586 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":586 * distance_upper_bound) * if single: * if k==1: # <<<<<<<<<<<<<< * return dd[0,0], ii[0,0] * else: */ - __pyx_4 = (__pyx_v_k == 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_k == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":587 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":587 * if single: * if k==1: * return dd[0,0], ii[0,0] # <<<<<<<<<<<<<< * else: * return dd[0], ii[0] */ - __pyx_t_8 = 0; - __pyx_t_9 = 0; - __pyx_t_3 = -1; - if (__pyx_t_8 < 0) { - __pyx_t_8 += __pyx_bshape_0_dd; - if (unlikely(__pyx_t_8 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_8 >= __pyx_bshape_0_dd)) __pyx_t_3 = 0; - if (__pyx_t_9 < 0) { - __pyx_t_9 += __pyx_bshape_1_dd; - if (unlikely(__pyx_t_9 < 0)) __pyx_t_3 = 1; - } else if (unlikely(__pyx_t_9 >= __pyx_bshape_1_dd)) __pyx_t_3 = 1; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_16 = 0; + __pyx_t_17 = 0; + __pyx_t_8 = -1; + if (__pyx_t_16 < 0) { + __pyx_t_16 += __pyx_bshape_0_dd; + if (unlikely(__pyx_t_16 < 0)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_16 >= __pyx_bshape_0_dd)) __pyx_t_8 = 0; + if (__pyx_t_17 < 0) { + __pyx_t_17 += __pyx_bshape_1_dd; + if (unlikely(__pyx_t_17 < 0)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_17 >= __pyx_bshape_1_dd)) __pyx_t_8 = 1; + if (unlikely(__pyx_t_8 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_8); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_7 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_bstruct_dd.buf, __pyx_t_8, __pyx_bstride_0_dd, __pyx_t_9, __pyx_bstride_1_dd))); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_10 = 0; - __pyx_t_11 = 0; - __pyx_t_3 = -1; - if (__pyx_t_10 < 0) { - __pyx_t_10 += __pyx_bshape_0_ii; - if (unlikely(__pyx_t_10 < 0)) __pyx_t_3 = 0; - } else if (unlikely(__pyx_t_10 >= __pyx_bshape_0_ii)) __pyx_t_3 = 0; - if (__pyx_t_11 < 0) { - __pyx_t_11 += __pyx_bshape_1_ii; - if (unlikely(__pyx_t_11 < 0)) __pyx_t_3 = 1; - } else if (unlikely(__pyx_t_11 >= __pyx_bshape_1_ii)) __pyx_t_3 = 1; - if (unlikely(__pyx_t_3 != -1)) { - __Pyx_RaiseBufferIndexError(__pyx_t_3); - {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_12 = PyFloat_FromDouble((*__Pyx_BufPtrStrided2d(double *, __pyx_bstruct_dd.buf, __pyx_t_16, __pyx_bstride_0_dd, __pyx_t_17, __pyx_bstride_1_dd))); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_18 = 0; + __pyx_t_19 = 0; + __pyx_t_8 = -1; + if (__pyx_t_18 < 0) { + __pyx_t_18 += __pyx_bshape_0_ii; + if (unlikely(__pyx_t_18 < 0)) __pyx_t_8 = 0; + } else if (unlikely(__pyx_t_18 >= __pyx_bshape_0_ii)) __pyx_t_8 = 0; + if (__pyx_t_19 < 0) { + __pyx_t_19 += __pyx_bshape_1_ii; + if (unlikely(__pyx_t_19 < 0)) __pyx_t_8 = 1; + } else if (unlikely(__pyx_t_19 >= __pyx_bshape_1_ii)) __pyx_t_8 = 1; + if (unlikely(__pyx_t_8 != -1)) { + __Pyx_RaiseBufferIndexError(__pyx_t_8); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_5 = PyInt_FromLong((*__Pyx_BufPtrStrided2d(int *, __pyx_bstruct_ii.buf, __pyx_t_10, __pyx_bstride_0_ii, __pyx_t_11, __pyx_bstride_1_ii))); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_7); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_5); - __pyx_7 = 0; - __pyx_5 = 0; - __pyx_r = ((PyObject *)__pyx_3); - __pyx_3 = 0; + __pyx_t_3 = PyInt_FromLong((*__Pyx_BufPtrStrided2d(int *, __pyx_bstruct_ii.buf, __pyx_t_18, __pyx_bstride_0_ii, __pyx_t_19, __pyx_bstride_1_ii))); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 587; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_12 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; goto __pyx_L12; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":589 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":589 * return dd[0,0], ii[0,0] * else: * return dd[0], ii[0] # <<<<<<<<<<<<<< * else: * if k==1: */ - __pyx_1 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dd), 0, 0); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ii), 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_2); - __pyx_1 = 0; - __pyx_2 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_5 = __Pyx_GetItemInt(((PyObject *)__pyx_v_dd), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_ii), 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 589; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_5 = 0; + __pyx_t_3 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; goto __pyx_L0; } __pyx_L12:; @@ -4376,132 +5264,180 @@ } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":591 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":591 * return dd[0], ii[0] * else: * if k==1: # <<<<<<<<<<<<<< * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) * else: */ - __pyx_4 = (__pyx_v_k == 1); - if (__pyx_4) { + __pyx_t_4 = (__pyx_v_k == 1); + if (__pyx_t_4) { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":592 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":592 * else: * if k==1: * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) # <<<<<<<<<<<<<< * else: * return np.reshape(dd,retshape+(k,)), np.reshape(ii,retshape+(k,)) */ - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_reshape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(Py_Ellipsis); - PyTuple_SET_ITEM(__pyx_1, 0, Py_Ellipsis); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_int_0); - __pyx_2 = PyObject_GetItem(((PyObject *)__pyx_v_dd), ((PyObject *)__pyx_1)); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2); - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_v_retshape); - __pyx_2 = 0; - __pyx_5 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_reshape); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = PyTuple_New(2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(Py_Ellipsis); - PyTuple_SET_ITEM(__pyx_3, 0, Py_Ellipsis); - Py_INCREF(__pyx_int_0); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_int_0); - __pyx_7 = PyObject_GetItem(((PyObject *)__pyx_v_ii), ((PyObject *)__pyx_3)); if (!__pyx_7) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_1 = PyTuple_New(2); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_7); - Py_INCREF(__pyx_v_retshape); - PyTuple_SET_ITEM(__pyx_1, 1, __pyx_v_retshape); - __pyx_7 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_5); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_3); - __pyx_5 = 0; - __pyx_3 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(Py_Ellipsis); + PyTuple_SET_ITEM(__pyx_t_12, 0, Py_Ellipsis); + __Pyx_GIVEREF(Py_Ellipsis); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_5 = PyObject_GetItem(((PyObject *)__pyx_v_dd), __pyx_t_12); if (!__pyx_t_5) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_INCREF(Py_Ellipsis); + PyTuple_SET_ITEM(__pyx_t_12, 0, Py_Ellipsis); + __Pyx_GIVEREF(Py_Ellipsis); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __pyx_t_1 = PyObject_GetItem(((PyObject *)__pyx_v_ii), __pyx_t_12); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_retshape); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_v_retshape); + __Pyx_GIVEREF(__pyx_v_retshape); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_12, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyTuple_New(2); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 592; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_12, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_12, 1, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_5 = 0; + __pyx_t_1 = 0; + __pyx_r = __pyx_t_12; + __pyx_t_12 = 0; goto __pyx_L0; goto __pyx_L13; } /*else*/ { - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":594 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":594 * return np.reshape(dd[...,0],retshape), np.reshape(ii[...,0],retshape) * else: * return np.reshape(dd,retshape+(k,)), np.reshape(ii,retshape+(k,)) # <<<<<<<<<<<<<< * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_reshape); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_5); - __pyx_5 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_retshape, ((PyObject *)__pyx_3)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_dd)); - PyTuple_SET_ITEM(__pyx_7, 0, ((PyObject *)__pyx_v_dd)); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_5, __pyx_kp_reshape); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_1 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_1); - __pyx_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_v_retshape, ((PyObject *)__pyx_7)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __pyx_5 = PyTuple_New(2); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(((PyObject *)__pyx_v_ii)); - PyTuple_SET_ITEM(__pyx_5, 0, ((PyObject *)__pyx_v_ii)); - PyTuple_SET_ITEM(__pyx_5, 1, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_5), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_5)); __pyx_5 = 0; - __pyx_7 = PyTuple_New(2); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_2); - PyTuple_SET_ITEM(__pyx_7, 1, __pyx_1); - __pyx_2 = 0; - __pyx_1 = 0; - __pyx_r = ((PyObject *)__pyx_7); - __pyx_7 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_12 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_12, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_12); __pyx_t_12 = 0; + __pyx_t_12 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyNumber_Add(__pyx_v_retshape, __pyx_t_5); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_v_dd)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_v_dd)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_dd)); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + __pyx_t_12 = 0; + __pyx_t_12 = PyObject_Call(__pyx_t_1, __pyx_t_5, NULL); if (unlikely(!__pyx_t_12)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_12); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__reshape); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyInt_FromLong(__pyx_v_k); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_v_retshape, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_v_ii)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_v_ii)); + __Pyx_GIVEREF(((PyObject *)__pyx_v_ii)); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_5 = 0; + __pyx_t_5 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 594; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_12); + __Pyx_GIVEREF(__pyx_t_12); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_5); + __Pyx_GIVEREF(__pyx_t_5); + __pyx_t_12 = 0; + __pyx_t_5 = 0; + __pyx_r = __pyx_t_3; + __pyx_t_3 = 0; goto __pyx_L0; } __pyx_L13:; } __pyx_L11:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_7); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_12); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_ii); @@ -4516,17 +5452,20 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_xx); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_dd); __pyx_L2:; - Py_DECREF(__pyx_v_ii); - Py_DECREF(__pyx_v_dd); - Py_DECREF(__pyx_v_xx); - Py_DECREF(__pyx_v_single); - Py_DECREF(__pyx_v_retshape); - Py_DECREF(__pyx_v_n); - Py_DECREF(__pyx_v_x); + __Pyx_DECREF((PyObject *)__pyx_v_ii); + __Pyx_DECREF((PyObject *)__pyx_v_dd); + __Pyx_DECREF((PyObject *)__pyx_v_xx); + __Pyx_DECREF(__pyx_v_single); + __Pyx_DECREF(__pyx_v_retshape); + __Pyx_DECREF(__pyx_v_n); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":50 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -4539,47 +5478,67 @@ int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; - PyObject *__pyx_v_stack; + int __pyx_v_offset; int __pyx_v_hasfields; - PyObject *__pyx_v_iterator; int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_7 = 0; - Py_ssize_t __pyx_8 = 0; - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; Py_INCREF(Py_None); - __pyx_v_stack = ((PyObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_iterator = Py_None; Py_INCREF(Py_None); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":56 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":58 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ - __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_1) { + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":59 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -4591,7 +5550,7 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":61 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -4602,88 +5561,100 @@ } __pyx_L5:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":63 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":64 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":65 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":67 - * raise ValueError("ndarray is not C contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":68 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_2) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":69 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_8)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_8)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_8)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":71 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -4691,7 +5662,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":72 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -4700,17 +5671,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":73 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_4 = __pyx_v_copy_shape; - if (__pyx_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":76 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -4719,7 +5690,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":77 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -4728,16 +5699,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":78 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i+=1) { + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":79 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -4746,7 +5719,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":80 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -4759,7 +5732,7 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":82 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -4768,7 +5741,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":83 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -4779,7 +5752,7 @@ } __pyx_L8:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":84 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -4788,7 +5761,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":85 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -4797,7 +5770,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":86 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -4806,7 +5779,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":89 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -4815,309 +5788,411 @@ */ __pyx_v_f = NULL; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":90 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack - * + * cdef int offset */ - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":93 - * cdef list stack + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * - * # Ugly hack warning: + * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":103 - * # functions). + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { - __pyx_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; } - if (__pyx_1) { + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":105 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ - Py_INCREF(Py_None); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L11; } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":108 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - Py_INCREF(__pyx_v_self); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L11:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":110 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if t == NPY_BYTE: f = "b" + * if ((descr.byteorder == '>' and little_endian) or */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":111 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":112 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = __pyx_k_3; - break; - case NPY_UBYTE: + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":113 - * t = descr.type_num + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_v_f = __pyx_k_4; - break; - case NPY_SHORT: + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":114 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_v_f = __pyx_k_5; - break; - case NPY_USHORT: + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":115 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_v_f = __pyx_k_6; - break; - case NPY_INT: + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":116 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_v_f = __pyx_k_7; - break; - case NPY_UINT: + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":117 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_v_f = __pyx_k_8; - break; - case NPY_LONG: + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":118 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_v_f = __pyx_k_9; - break; - case NPY_ULONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":119 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_v_f = __pyx_k_10; - break; - case NPY_LONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":120 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_v_f = __pyx_k_11; - break; - case NPY_ULONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":121 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_v_f = __pyx_k_12; - break; - case NPY_FLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":122 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_v_f = __pyx_k_13; - break; - case NPY_DOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":123 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_v_f = __pyx_k_14; - break; - case NPY_LONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":124 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_v_f = __pyx_k_15; - break; - case NPY_CFLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":125 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_v_f = __pyx_k_16; - break; - case NPY_CDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":126 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_v_f = __pyx_k_17; - break; - case NPY_CLONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":127 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_v_f = __pyx_k_18; - break; - case NPY_OBJECT: + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":128 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_v_f = __pyx_k_19; - break; - default: + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":130 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_20, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_L14:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":131 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":132 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: - * info.format = stdlib.malloc(255) # static size + * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; @@ -5125,647 +6200,1201 @@ } /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":134 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: - * info.format = stdlib.malloc(255) # static size # <<<<<<<<<<<<<< - * f = info.format - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":135 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: - * info.format = stdlib.malloc(255) # static size - * f = info.format # <<<<<<<<<<<<<< - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string * */ - __pyx_v_f = __pyx_v_info->format; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":136 - * info.format = stdlib.malloc(255) # static size - * f = info.format - * stack = [iter(descr.fields.iteritems())] # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * - * while True: + * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_3 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyList_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_stack)); - __pyx_v_stack = __pyx_2; - __pyx_2 = 0; + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":138 - * stack = [iter(descr.fields.iteritems())] + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 + * f[0] = 0 # Terminate format string * - * while True: # <<<<<<<<<<<<<< - * iterator = stack[-1] - * descr = None + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) */ - while (1) { - __pyx_1 = 1; - if (!__pyx_1) break; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":139 +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * - * while True: - * iterator = stack[-1] # <<<<<<<<<<<<<< - * descr = None - * while descr is None: + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":140 - * while True: - * iterator = stack[-1] - * descr = None # <<<<<<<<<<<<<< - * while descr is None: - * try: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) */ - Py_INCREF(Py_None); - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)Py_None); + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":141 - * iterator = stack[-1] - * descr = None - * while descr is None: # <<<<<<<<<<<<<< - * try: - * descr = iterator.next()[1][0] + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block */ - while (1) { - __pyx_1 = (((PyObject *)__pyx_v_descr) == Py_None); - if (!__pyx_1) break; + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":142 - * descr = None - * while descr is None: - * try: # <<<<<<<<<<<<<< - * descr = iterator.next()[1][0] - * except StopIteration: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - /*try:*/ { + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":143 - * while descr is None: - * try: - * descr = iterator.next()[1][0] # <<<<<<<<<<<<<< - * except StopIteration: - * stack.pop() + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ - __pyx_2 = PyObject_GetAttr(__pyx_v_iterator, __pyx_kp_next); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetItemInt(__pyx_3, 1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)__pyx_3); - __pyx_3 = 0; - } - Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L22_try; - __pyx_L17_error:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":144 - * try: - * descr = iterator.next()[1][0] - * except StopIteration: # <<<<<<<<<<<<<< - * stack.pop() - * if len(stack) > 0: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_4 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_4) { - __Pyx_AddTraceback("numpy.__getbuffer__"); - if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":145 - * descr = iterator.next()[1][0] - * except StopIteration: - * stack.pop() # <<<<<<<<<<<<<< - * if len(stack) > 0: - * f[0] = 125 #"}" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * */ - __pyx_6 = PyObject_GetAttr(((PyObject *)__pyx_v_stack), __pyx_kp_pop); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_7 = PyObject_Call(__pyx_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":146 - * except StopIteration: - * stack.pop() - * if len(stack) > 0: # <<<<<<<<<<<<<< - * f[0] = 125 #"}" - * f += 1 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_8 = PyObject_Length(((PyObject *)__pyx_v_stack)); if (unlikely(__pyx_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_1 = (__pyx_8 > 0); - if (__pyx_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":147 - * stack.pop() - * if len(stack) > 0: - * f[0] = 125 #"}" # <<<<<<<<<<<<<< - * f += 1 - * iterator = stack[-1] + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * */ - (__pyx_v_f[0]) = 125; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":148 - * if len(stack) > 0: - * f[0] = 125 #"}" - * f += 1 # <<<<<<<<<<<<<< - * iterator = stack[-1] - * else: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_v_f += 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":149 - * f[0] = 125 #"}" - * f += 1 - * iterator = stack[-1] # <<<<<<<<<<<<<< - * else: - * f[0] = 0 # Terminate string! + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ - __pyx_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_6; - __pyx_6 = 0; - goto __pyx_L23; - } - /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":151 - * iterator = stack[-1] - * else: - * f[0] = 0 # Terminate string! # <<<<<<<<<<<<<< - * return +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - (__pyx_v_f[0]) = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":152 - * else: - * f[0] = 0 # Terminate string! - * return # <<<<<<<<<<<<<< + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * hasfields = PyDataType_HASFIELDS(descr) + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_r = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L20_except_return; - } - __pyx_L23:; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L18_exception_handled; - } - __pyx_L19_except_error:; - Py_XDECREF(__pyx_save_exc_type); - Py_XDECREF(__pyx_save_exc_value); - Py_XDECREF(__pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L20_except_return:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L0; - __pyx_L18_exception_handled:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L22_try:; - } + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_11)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_11)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_11)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":154 - * return + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_9)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_9)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_9)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * - * hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * if not hasfields: - * t = descr.type_num + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":155 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 * - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_v_f += 1; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":156 - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize */ - __pyx_v_t = __pyx_v_descr->type_num; + (__pyx_v_offset[0]) += 1; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":157 - * if not hasfields: - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + * offset[0] += 1 * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): */ - __pyx_1 = ((__pyx_v_f - __pyx_v_info->format) > 240); - if (__pyx_1) { + (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":158 - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + * offset[0] += child.itemsize * - * # Until ticket #99 is fixed, use integers to avoid warnings + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: */ - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_21); - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_kp_21); - __pyx_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __Pyx_Raise(__pyx_6, 0, 0); - Py_DECREF(__pyx_6); __pyx_6 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L25; - } - __pyx_L25:; + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":161 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") */ - switch (__pyx_v_t) { - case NPY_BYTE: - (__pyx_v_f[0]) = 98; - break; - case NPY_UBYTE: + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":162 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * */ - (__pyx_v_f[0]) = 66; - break; - case NPY_SHORT: + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":163 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings */ - (__pyx_v_f[0]) = 104; - break; - case NPY_USHORT: + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_12)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_12)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_12)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":164 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" */ - (__pyx_v_f[0]) = 72; - break; - case NPY_INT: + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":165 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" */ - (__pyx_v_f[0]) = 105; - break; - case NPY_UINT: + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":166 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" */ - (__pyx_v_f[0]) = 73; - break; - case NPY_LONG: + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":167 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" */ - (__pyx_v_f[0]) = 108; - break; - case NPY_ULONG: + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":168 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" */ - (__pyx_v_f[0]) = 76; - break; - case NPY_LONGLONG: + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":169 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" */ - (__pyx_v_f[0]) = 113; - break; - case NPY_ULONGLONG: + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":170 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - (__pyx_v_f[0]) = 81; - break; - case NPY_FLOAT: + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":171 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - (__pyx_v_f[0]) = 102; - break; - case NPY_DOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":172 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - (__pyx_v_f[0]) = 100; - break; - case NPY_LONGDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":173 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - (__pyx_v_f[0]) = 103; - break; - case NPY_CFLOAT: + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":174 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - break; - case NPY_CDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":175 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - break; - case NPY_CLONGDOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":176 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - break; - case NPY_OBJECT: + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":177 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - (__pyx_v_f[0]) = 79; - break; - default: + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":179 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_22, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":180 - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * f[0] = 84 #"T" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; __pyx_v_f += 1; - goto __pyx_L24; + goto __pyx_L11; } - /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":182 - * f += 1 - * else: - * f[0] = 84 #"T" # <<<<<<<<<<<<<< - * f[1] = 123 #"{" - * f += 2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - (__pyx_v_f[0]) = 84; + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":183 - * else: - * f[0] = 84 #"T" - * f[1] = 123 #"{" # <<<<<<<<<<<<<< - * f += 2 - * stack.append(iter(descr.fields.iteritems())) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: */ - (__pyx_v_f[1]) = 123; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_10), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":184 - * f[0] = 84 #"T" - * f[1] = 123 #"{" - * f += 2 # <<<<<<<<<<<<<< - * stack.append(iter(descr.fields.iteritems())) - * + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 2; + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":185 - * f[1] = 123 #"{" - * f += 2 - * stack.append(iter(descr.fields.iteritems())) # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f * - * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_7 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyObject_GetIter(__pyx_6); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyList_Append(((PyObject *)__pyx_v_stack), __pyx_2); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - __pyx_L24:; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } + __pyx_L9:; } - __pyx_L12:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); - Py_XDECREF(__pyx_7); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - Py_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { Py_DECREF(Py_None); __pyx_v_info->obj = NULL; } - __pyx_L2:; - Py_XDECREF(__pyx_v_descr); - Py_DECREF(__pyx_v_stack); - Py_DECREF(__pyx_v_iterator); + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":187 - * stack.append(iter(descr.fields.iteritems())) +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_1; - int __pyx_2; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":188 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: */ - __pyx_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":189 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! */ - free(__pyx_v_info->format); - goto __pyx_L5; + __pyx_v_baseptr = NULL; + goto __pyx_L3; } - __pyx_L5:; + /*else*/ { - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":190 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) */ - __pyx_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_2) { + Py_INCREF(__pyx_v_base); - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/numpy.pxd":191 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr * */ - free(__pyx_v_info->strides); - goto __pyx_L6; + Py_XDECREF(__pyx_v_arr->base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; } - __pyx_L6:; + /*else*/ { + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } static struct __pyx_vtabstruct_5scipy_7spatial_7ckdtree_cKDTree __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree; @@ -5837,17 +7466,17 @@ } static struct PyMethodDef __pyx_methods_5scipy_7spatial_7ckdtree_cKDTree[] = { - {"query", (PyCFunction)__pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree_query, METH_VARARGS|METH_KEYWORDS, __pyx_doc_5scipy_7spatial_7ckdtree_7cKDTree_query}, + {__Pyx_NAMESTR("query"), (PyCFunction)__pyx_pf_5scipy_7spatial_7ckdtree_7cKDTree_query, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(__pyx_doc_5scipy_7spatial_7ckdtree_7cKDTree_query)}, {0, 0, 0, 0} }; static struct PyMemberDef __pyx_members_5scipy_7spatial_7ckdtree_cKDTree[] = { - {"data", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, data), READONLY, 0}, - {"n", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, n), READONLY, 0}, - {"m", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, m), READONLY, 0}, - {"leafsize", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, leafsize), READONLY, 0}, - {"maxes", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, maxes), READONLY, 0}, - {"mins", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, mins), READONLY, 0}, + {(char *)"data", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, data), READONLY, 0}, + {(char *)"n", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, n), READONLY, 0}, + {(char *)"m", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, m), READONLY, 0}, + {(char *)"leafsize", T_INT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, leafsize), READONLY, 0}, + {(char *)"maxes", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, maxes), READONLY, 0}, + {(char *)"mins", T_OBJECT, offsetof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree, mins), READONLY, 0}, {0, 0, 0, 0, 0} }; @@ -5875,7 +7504,11 @@ 0, /*nb_coerce*/ #endif 0, /*nb_int*/ + #if PY_MAJOR_VERSION >= 3 + 0, /*reserved*/ + #else 0, /*nb_long*/ + #endif 0, /*nb_float*/ #if PY_MAJOR_VERSION < 3 0, /*nb_oct*/ @@ -5947,7 +7580,7 @@ PyTypeObject __pyx_type_5scipy_7spatial_7ckdtree_cKDTree = { PyVarObject_HEAD_INIT(0, 0) - "scipy.spatial.ckdtree.cKDTree", /*tp_name*/ + __Pyx_NAMESTR("scipy.spatial.ckdtree.cKDTree"), /*tp_name*/ sizeof(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree), /*tp_basicsize*/ 0, /*tp_itemsize*/ __pyx_tp_dealloc_5scipy_7spatial_7ckdtree_cKDTree, /*tp_dealloc*/ @@ -5966,7 +7599,7 @@ 0, /*tp_setattro*/ &__pyx_tp_as_buffer_cKDTree, /*tp_as_buffer*/ Py_TPFLAGS_DEFAULT|Py_TPFLAGS_CHECKTYPES|Py_TPFLAGS_BASETYPE|Py_TPFLAGS_HAVE_NEWBUFFER|Py_TPFLAGS_HAVE_GC, /*tp_flags*/ - "kd-tree for quick nearest-neighbor lookup\n\n This class provides an index into a set of k-dimensional points\n which can be used to rapidly look up the nearest neighbors of any\n point. \n\n The algorithm used is described in Maneewongvatana and Mount 1999. \n The general idea is that the kd-tree is a binary trie, each of whose\n nodes represents an axis-aligned hyperrectangle. Each node specifies\n an axis and splits the set of points based on whether their coordinate\n along that axis is greater than or less than a particular value. \n\n During construction, the axis and splitting point are chosen by the \n \"sliding midpoint\" rule, which ensures that the cells do not all\n become long and thin. \n\n The tree can be queried for the r closest neighbors of any given point \n (optionally returning only those within some maximum distance of the \n point). It can also be queried, with a substantial gain in efficiency, \n for the r approximate closest neighbors.\n\n For large dimensions (20 is already large) do not expect this to run \n significantly faster than brute force. High-dimensional nearest-neighbor\n queries are a substantial open problem in computer science.\n ", /*tp_doc*/ + __Pyx_DOCSTR("kd-tree for quick nearest-neighbor lookup\n\n This class provides an index into a set of k-dimensional points\n which can be used to rapidly look up the nearest neighbors of any\n point. \n\n The algorithm used is described in Maneewongvatana and Mount 1999. \n The general idea is that the kd-tree is a binary trie, each of whose\n nodes represents an axis-aligned hyperrectangle. Each node specifies\n an axis and splits the set of points based on whether their coordinate\n along that axis is greater than or less than a particular value. \n\n During construction, the axis and splitting point are chosen by the \n \"sliding midpoint\" rule, which ensures that the cells do not all\n become long and thin. \n\n The tree can be queried for the r closest neighbors of any given point \n (optionally returning only those within some maximum distance of the \n point). It can also be queried, with a substantial gain in efficiency, \n for the r approximate closest neighbors.\n\n For large dimensions (20 is already large) do not expect this to run \n significantly faster than brute force. High-dimensional nearest-neighbor\n queries are a substantial open problem in computer science.\n "), /*tp_doc*/ __pyx_tp_traverse_5scipy_7spatial_7ckdtree_cKDTree, /*tp_traverse*/ __pyx_tp_clear_5scipy_7spatial_7ckdtree_cKDTree, /*tp_clear*/ 0, /*tp_richcompare*/ @@ -5991,6 +7624,10 @@ 0, /*tp_cache*/ 0, /*tp_subclasses*/ 0, /*tp_weaklist*/ + 0, /*tp_del*/ + #if PY_VERSION_HEX >= 0x02060000 + 0, /*tp_version_tag*/ + #endif }; static struct PyMethodDef __pyx_methods[] = { @@ -6002,7 +7639,7 @@ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "ckdtree", + __Pyx_NAMESTR("ckdtree"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -6014,70 +7651,111 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___init__, __pyx_k___init__, sizeof(__pyx_k___init__), 1, 1, 1}, - {&__pyx_kp___dealloc__, __pyx_k___dealloc__, sizeof(__pyx_k___dealloc__), 1, 1, 1}, - {&__pyx_kp_query, __pyx_k_query, sizeof(__pyx_k_query), 1, 1, 1}, - {&__pyx_kp_data, __pyx_k_data, sizeof(__pyx_k_data), 1, 1, 1}, - {&__pyx_kp_leafsize, __pyx_k_leafsize, sizeof(__pyx_k_leafsize), 1, 1, 1}, - {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, - {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, - {&__pyx_kp_eps, __pyx_k_eps, sizeof(__pyx_k_eps), 1, 1, 1}, - {&__pyx_kp_p, __pyx_k_p, sizeof(__pyx_k_p), 1, 1, 1}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_kdtree, __pyx_k_kdtree, sizeof(__pyx_k_kdtree), 1, 1, 1}, - {&__pyx_kp_inf, __pyx_k_inf, sizeof(__pyx_k_inf), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_ascontiguousarray, __pyx_k_ascontiguousarray, sizeof(__pyx_k_ascontiguousarray), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_float, __pyx_k_float, sizeof(__pyx_k_float), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp_amax, __pyx_k_amax, sizeof(__pyx_k_amax), 1, 1, 1}, - {&__pyx_kp_axis, __pyx_k_axis, sizeof(__pyx_k_axis), 1, 1, 1}, - {&__pyx_kp_amin, __pyx_k_amin, sizeof(__pyx_k_amin), 1, 1, 1}, - {&__pyx_kp_arange, __pyx_k_arange, sizeof(__pyx_k_arange), 1, 1, 1}, - {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 1, 1, 1}, - {&__pyx_kp_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 1, 1, 1}, - {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1}, - {&__pyx_kp_newaxis, __pyx_k_newaxis, sizeof(__pyx_k_newaxis), 1, 1, 1}, - {&__pyx_kp_prod, __pyx_k_prod, sizeof(__pyx_k_prod), 1, 1, 1}, - {&__pyx_kp_reshape, __pyx_k_reshape, sizeof(__pyx_k_reshape), 1, 1, 1}, - {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1}, - {&__pyx_kp_fill, __pyx_k_fill, sizeof(__pyx_k_fill), 1, 1, 1}, - {&__pyx_kp_30, __pyx_k_30, sizeof(__pyx_k_30), 0, 1, 0}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 0, 0, 0}, - {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 0, 0, 0}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 0, 0, 0}, - {&__pyx_kp_29, __pyx_k_29, sizeof(__pyx_k_29), 0, 0, 0}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, - {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, - {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, - {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0}, - {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0}, - {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_kp_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 0}, + {&__pyx_kp_u_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 1, 0, 0}, + {&__pyx_kp_u_11, __pyx_k_11, sizeof(__pyx_k_11), 0, 1, 0, 0}, + {&__pyx_kp_u_12, __pyx_k_12, sizeof(__pyx_k_12), 0, 1, 0, 0}, + {&__pyx_kp_u_13, __pyx_k_13, sizeof(__pyx_k_13), 0, 1, 0, 0}, + {&__pyx_kp_u_14, __pyx_k_14, sizeof(__pyx_k_14), 0, 1, 0, 0}, + {&__pyx_kp_s_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 1, 0}, + {&__pyx_n_s_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 0, 1, 1}, + {&__pyx_kp_s_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 0, 1, 0}, + {&__pyx_kp_s_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 0, 1, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_kp_u_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 1, 0, 0}, + {&__pyx_kp_u_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 1, 0, 0}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____build, __pyx_k____build, sizeof(__pyx_k____build), 0, 0, 1, 1}, + {&__pyx_n_s____free_tree, __pyx_k____free_tree, sizeof(__pyx_k____free_tree), 0, 0, 1, 1}, + {&__pyx_n_s____init__, __pyx_k____init__, sizeof(__pyx_k____init__), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____query, __pyx_k____query, sizeof(__pyx_k____query), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__amax, __pyx_k__amax, sizeof(__pyx_k__amax), 0, 0, 1, 1}, + {&__pyx_n_s__amin, __pyx_k__amin, sizeof(__pyx_k__amin), 0, 0, 1, 1}, + {&__pyx_n_s__arange, __pyx_k__arange, sizeof(__pyx_k__arange), 0, 0, 1, 1}, + {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, + {&__pyx_n_s__ascontiguousarray, __pyx_k__ascontiguousarray, sizeof(__pyx_k__ascontiguousarray), 0, 0, 1, 1}, + {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__axis, __pyx_k__axis, sizeof(__pyx_k__axis), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__cKDTree, __pyx_k__cKDTree, sizeof(__pyx_k__cKDTree), 0, 0, 1, 1}, + {&__pyx_n_s__contents, __pyx_k__contents, sizeof(__pyx_k__contents), 0, 0, 1, 1}, + {&__pyx_n_s__data, __pyx_k__data, sizeof(__pyx_k__data), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__end_idx, __pyx_k__end_idx, sizeof(__pyx_k__end_idx), 0, 0, 1, 1}, + {&__pyx_n_s__eps, __pyx_k__eps, sizeof(__pyx_k__eps), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__fill, __pyx_k__fill, sizeof(__pyx_k__fill), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__greater, __pyx_k__greater, sizeof(__pyx_k__greater), 0, 0, 1, 1}, + {&__pyx_n_s__heap, __pyx_k__heap, sizeof(__pyx_k__heap), 0, 0, 1, 1}, + {&__pyx_n_s__i, __pyx_k__i, sizeof(__pyx_k__i), 0, 0, 1, 1}, + {&__pyx_n_s__indices, __pyx_k__indices, sizeof(__pyx_k__indices), 0, 0, 1, 1}, + {&__pyx_n_s__inf, __pyx_k__inf, sizeof(__pyx_k__inf), 0, 0, 1, 1}, + {&__pyx_n_s__int32, __pyx_k__int32, sizeof(__pyx_k__int32), 0, 0, 1, 1}, + {&__pyx_n_s__intdata, __pyx_k__intdata, sizeof(__pyx_k__intdata), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__kdtree, __pyx_k__kdtree, sizeof(__pyx_k__kdtree), 0, 0, 1, 1}, + {&__pyx_n_s__leafsize, __pyx_k__leafsize, sizeof(__pyx_k__leafsize), 0, 0, 1, 1}, + {&__pyx_n_s__less, __pyx_k__less, sizeof(__pyx_k__less), 0, 0, 1, 1}, + {&__pyx_n_s__m, __pyx_k__m, sizeof(__pyx_k__m), 0, 0, 1, 1}, + {&__pyx_n_s__maxes, __pyx_k__maxes, sizeof(__pyx_k__maxes), 0, 0, 1, 1}, + {&__pyx_n_s__mins, __pyx_k__mins, sizeof(__pyx_k__mins), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__newaxis, __pyx_k__newaxis, sizeof(__pyx_k__newaxis), 0, 0, 1, 1}, + {&__pyx_n_s__node, __pyx_k__node, sizeof(__pyx_k__node), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__priority, __pyx_k__priority, sizeof(__pyx_k__priority), 0, 0, 1, 1}, + {&__pyx_n_s__prod, __pyx_k__prod, sizeof(__pyx_k__prod), 0, 0, 1, 1}, + {&__pyx_n_s__ptrdata, __pyx_k__ptrdata, sizeof(__pyx_k__ptrdata), 0, 0, 1, 1}, + {&__pyx_n_s__query, __pyx_k__query, sizeof(__pyx_k__query), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__raw_data, __pyx_k__raw_data, sizeof(__pyx_k__raw_data), 0, 0, 1, 1}, + {&__pyx_n_s__raw_indices, __pyx_k__raw_indices, sizeof(__pyx_k__raw_indices), 0, 0, 1, 1}, + {&__pyx_n_s__raw_maxes, __pyx_k__raw_maxes, sizeof(__pyx_k__raw_maxes), 0, 0, 1, 1}, + {&__pyx_n_s__raw_mins, __pyx_k__raw_mins, sizeof(__pyx_k__raw_mins), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__reshape, __pyx_k__reshape, sizeof(__pyx_k__reshape), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__side_distances, __pyx_k__side_distances, sizeof(__pyx_k__side_distances), 0, 0, 1, 1}, + {&__pyx_n_s__space, __pyx_k__space, sizeof(__pyx_k__space), 0, 0, 1, 1}, + {&__pyx_n_s__split, __pyx_k__split, sizeof(__pyx_k__split), 0, 0, 1, 1}, + {&__pyx_n_s__split_dim, __pyx_k__split_dim, sizeof(__pyx_k__split_dim), 0, 0, 1, 1}, + {&__pyx_n_s__start_idx, __pyx_k__start_idx, sizeof(__pyx_k__start_idx), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__tree, __pyx_k__tree, sizeof(__pyx_k__tree), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 38; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -6091,17 +7769,38 @@ PyMODINIT_FUNC PyInit_ckdtree(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - double __pyx_3; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + double __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_ckdtree(void)", __LINE__, __FILE__); + #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ - __pyx_init_filenames(); - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("ckdtree", __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("ckdtree"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -6109,92 +7808,145 @@ #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_scipy__spatial__ckdtree) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ __pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree = &__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree; + #if PY_MAJOR_VERSION >= 3 + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__build = (struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *(*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, int, int, double *, double *))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___build; + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__free_tree = (PyObject *(*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, struct __pyx_t_5scipy_7spatial_7ckdtree_innernode *))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree; + __pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__query = (void (*)(struct __pyx_obj_5scipy_7spatial_7ckdtree_cKDTree *, double *, int *, double *, int, double, double, double))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___query; + #else *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__build = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___build; *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__free_tree = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___free_tree; *(void(**)(void))&__pyx_vtable_5scipy_7spatial_7ckdtree_cKDTree.__query = (void(*)(void))__pyx_f_5scipy_7spatial_7ckdtree_7cKDTree___query; + #endif if (PyType_Ready(&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} if (__Pyx_SetVtable(__pyx_type_5scipy_7spatial_7ckdtree_cKDTree.tp_dict, __pyx_vtabptr_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttrString(__pyx_m, "cKDTree", (PyObject *)&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__Pyx_SetAttrString(__pyx_m, "cKDTree", (PyObject *)&__pyx_type_5scipy_7spatial_7ckdtree_cKDTree) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __pyx_ptype_5scipy_7spatial_7ckdtree_cKDTree = &__pyx_type_5scipy_7spatial_7ckdtree_cKDTree; /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":3 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":3 * # Copyright Anne M. Archibald 2008 * # Released under the scipy license * import numpy as np # <<<<<<<<<<<<<< * cimport numpy as np * cimport stdlib */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":7 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":7 * cimport stdlib * * import kdtree # <<<<<<<<<<<<<< * * cdef double infinity = np.inf */ - __pyx_1 = __Pyx_Import(__pyx_kp_kdtree, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_kdtree, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__kdtree), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__kdtree, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 7; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":9 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":9 * import kdtree * * cdef double infinity = np.inf # <<<<<<<<<<<<<< * * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_inf); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_3 = __pyx_PyFloat_AsDouble(__pyx_2); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_v_5scipy_7spatial_7ckdtree_infinity = __pyx_3; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__inf); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_3 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_3 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 9; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_5scipy_7spatial_7ckdtree_infinity = __pyx_t_3; - /* "/usr/data/david/src/dsp/scipy/trunk/scipy/spatial/ckdtree.pyx":517 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":517 * * def query(cKDTree self, object x, int k=1, double eps=0, double p=2, * double distance_upper_bound=infinity): # <<<<<<<<<<<<<< * """query the kd-tree for nearest neighbors * */ - __pyx_k_24 = __pyx_v_5scipy_7spatial_7ckdtree_infinity; + __pyx_k_4 = __pyx_v_5scipy_7spatial_7ckdtree_infinity; - /* "/usr/data/david/local/lib64/python2.4/site-packages/Cython/Includes/stdlib.pxd":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/spatial/ckdtree.pyx":1 + * # Copyright Anne M. Archibald 2008 # <<<<<<<<<<<<<< + * # Released under the scipy license + * import numpy as np + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__cKDTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s____init__); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_13), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_m, __pyx_n_s__cKDTree); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__query); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetAttrString(__pyx_t_4, "__doc__"); + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_kp_u_14), __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * - * cdef extern from "stdlib.h": # <<<<<<<<<<<<<< - * ctypedef unsigned long size_t + * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) + * void *malloc(size_t size) */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_4); + if (__pyx_m) { + __Pyx_AddTraceback("init scipy.spatial.ckdtree"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scipy.spatial.ckdtree"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - __Pyx_AddTraceback("scipy.spatial.ckdtree"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -6208,6 +7960,13 @@ __pyx_f = __pyx_filenames; } +static CYTHON_INLINE long __Pyx_div_long(long a, long b) { + long q = a / b; + long r = a - q*b; + q -= ((r != 0) & ((r ^ b) < 0)); + return q; +} + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name) @@ -6265,18 +8024,17 @@ PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; } else { - name = argnames; - while (*name && (**name != key)) name++; - if (*name) { - if (name < first_kw_arg) goto arg_passed_twice; - values[name-argnames] = value; + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 @@ -6284,8 +8042,7 @@ PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) break; + _PyString_Eq(**name, key)) break; #endif } if (*name) { @@ -6299,8 +8056,7 @@ PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) goto arg_passed_twice; + _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { @@ -6333,159 +8089,461 @@ return -1; } -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); } -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { - while (1) { - switch (*ts) { - case '@': - case 10: - case 13: - case ' ': - ++ts; - break; - case '=': - case '<': - case '>': - case '!': - PyErr_SetString(PyExc_ValueError, "Buffer acquisition error: Only native byte order, size and alignment supported."); - return NULL; - default: - return ts; +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; } } -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - expected_ndim, buffer->ndim); +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; } -static const char* __Pyx_DescribeTokenInFormatString(const char* ts) { - switch (*ts) { - case 'b': return "char"; - case 'B': return "unsigned char"; - case 'h': return "short"; - case 'H': return "unsigned short"; - case 'i': return "int"; - case 'I': return "unsigned int"; - case 'l': return "long"; - case 'L': return "unsigned long"; - case 'q': return "long long"; - case 'Q': return "unsigned long long"; - case 'f': return "float"; - case 'd': return "double"; - case 'g': return "long double"; - case 'Z': switch (*(ts+1)) { - case 'f': return "complex float"; - case 'd': return "complex double"; - case 'g': return "complex long double"; - default: return "unparseable format string"; - } +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 0: return "end"; default: return "unparseable format string"; } } -static const char* __Pyx_CheckTypestring_double(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(double) == sizeof(float) && (double)-1 < 0); break; - case 'd': ok = (sizeof(double) == sizeof(double) && (double)-1 < 0); break; - case 'g': ok = (sizeof(double) == sizeof(long double) && (double)-1 < 0); break; - default: ok = 0; +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected double, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - ++ts; - return ts; +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } - -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); - goto fail; +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); } - if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_double(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; + + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; } - } else { - if (buf->itemsize != sizeof(double)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; } -static void __Pyx_RaiseBufferFallbackError(void) { - PyErr_Format(PyExc_ValueError, - "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); -} -static const char* __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'b': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(char) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'h': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(short) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'i': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(int) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'l': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(long) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - case 'q': ok = (sizeof(__pyx_t_5numpy_int32_t) == sizeof(long long) && (__pyx_t_5numpy_int32_t)-1 < 0); break; - default: ok = 0; +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected numpy.int32_t, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; - } - ++ts; - return ts; } - -static int __Pyx_GetBuffer_nn___pyx_t_5numpy_int32_t(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None) { __Pyx_ZeroBuffer(buf); return 0; @@ -6493,37 +8551,44 @@ buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); goto fail; } if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_nn___pyx_t_5numpy_int32_t(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(__pyx_t_5numpy_int32_t)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + +static void __Pyx_RaiseBufferFallbackError(void) { + PyErr_Format(PyExc_ValueError, + "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); +} + + +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -6538,7 +8603,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -6550,70 +8615,26 @@ } -static const char* __Pyx_CheckTypestring_int(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'b': ok = (sizeof(int) == sizeof(char) && (int)-1 < 0); break; - case 'h': ok = (sizeof(int) == sizeof(short) && (int)-1 < 0); break; - case 'i': ok = (sizeof(int) == sizeof(int) && (int)-1 < 0); break; - case 'l': ok = (sizeof(int) == sizeof(long) && (int)-1 < 0); break; - case 'q': ok = (sizeof(int) == sizeof(long long) && (int)-1 < 0); break; - default: ok = 0; - } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected int, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; - } - ++ts; - return ts; - } - -static int __Pyx_GetBuffer_int(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; - if (obj == Py_None) { - __Pyx_ZeroBuffer(buf); - return 0; - } - buf->buf = NULL; - if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; - if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); - goto fail; - } - if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_int(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(int)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } - } - if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; - return 0; -fail:; - __Pyx_ZeroBuffer(buf); - return -1; -}static void __Pyx_RaiseBufferIndexError(int axis) { +static void __Pyx_RaiseBufferIndexError(int axis) { PyErr_Format(PyExc_IndexError, "Out of bounds on buffer access (axis %d)", axis); } +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -6645,7 +8666,7 @@ PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -6662,8 +8683,8 @@ empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -6679,6 +8700,7 @@ return result; } +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -6734,6 +8756,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -6743,100 +8766,581 @@ return; } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d values to unpack", (int)index); - #else - "need more than %zd values to unpack", index); - #endif +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); + goto bad; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; } - return item; + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + +bad: + return; } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - return -1; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); + } + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif + +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif + +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); } -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); } -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); } -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); } -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - __Pyx_ErrFetch(type, value, tb); - PyErr_NormalizeException(type, value, tb); - if (PyErr_Occurred()) - goto bad; - Py_INCREF(*type); - Py_INCREF(*value); - Py_INCREF(*tb); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - return 0; -bad: - Py_XDECREF(*type); - Py_XDECREF(*value); - Py_XDECREF(*tb); - return -1; +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); } +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; @@ -6856,32 +9360,31 @@ } static int __Pyx_SetVtable(PyObject *dict, void *vtable) { - PyObject *pycobj = 0; - int result; - - pycobj = PyCObject_FromVoidPtr(vtable, 0); - if (!pycobj) +#if PY_VERSION_HEX < 0x03010000 + PyObject *ob = PyCObject_FromVoidPtr(vtable, 0); +#else + PyObject *ob = PyCapsule_New(vtable, 0, 0); +#endif + if (!ob) goto bad; - if (PyDict_SetItemString(dict, "__pyx_vtable__", pycobj) < 0) + if (PyDict_SetItemString(dict, "__pyx_vtable__", ob) < 0) goto bad; - result = 0; - goto done; - + Py_DECREF(ob); + return 0; bad: - result = -1; -done: - Py_XDECREF(pycobj); - return result; + Py_XDECREF(ob); + return -1; } #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -6906,9 +9409,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -6950,7 +9459,6 @@ PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; - PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; @@ -6977,12 +9485,6 @@ if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; - #if PY_MAJOR_VERSION < 3 - empty_string = PyString_FromStringAndSize("", 0); - #else - empty_string = PyBytes_FromStringAndSize("", 0); - #endif - if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 @@ -6991,7 +9493,7 @@ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ - empty_string, /*PyObject *code,*/ + __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ @@ -7000,7 +9502,7 @@ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ - empty_string /*PyObject *lnotab*/ + __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( @@ -7015,7 +9517,6 @@ bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); - Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -7023,7 +9524,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -7031,10 +9532,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -7048,221 +9553,92 @@ /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; } -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; } - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif } -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; } -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - +#endif /* Py_PYTHON_H */ Modified: branches/0.8.x/scipy/stats/vonmises_cython.c =================================================================== --- branches/0.8.x/scipy/stats/vonmises_cython.c 2010-06-16 16:37:26 UTC (rev 6511) +++ branches/0.8.x/scipy/stats/vonmises_cython.c 2010-06-16 16:43:41 UTC (rev 6512) @@ -1,8 +1,12 @@ -/* Generated by Cython 0.10.3 on Tue Nov 17 16:14:26 2009 */ +/* Generated by Cython 0.12.1 on Wed Jun 16 17:42:37 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" #include "structmember.h" +#ifndef Py_PYTHON_H + #error Python headers needed to compile C extensions, please install development version of Python. +#else + #ifndef PY_LONG_LONG #define PY_LONG_LONG LONG_LONG #endif @@ -11,16 +15,22 @@ #endif #if PY_VERSION_HEX < 0x02040000 #define METH_COEXIST 0 + #define PyDict_CheckExact(op) (Py_TYPE(op) == &PyDict_Type) + #define PyDict_Contains(d,o) PySequence_Contains(d,o) #endif + #if PY_VERSION_HEX < 0x02050000 typedef int Py_ssize_t; #define PY_SSIZE_T_MAX INT_MAX #define PY_SSIZE_T_MIN INT_MIN + #define PY_FORMAT_SIZE_T "" #define PyInt_FromSsize_t(z) PyInt_FromLong(z) #define PyInt_AsSsize_t(o) PyInt_AsLong(o) #define PyNumber_Index(o) PyNumber_Int(o) #define PyIndex_Check(o) PyNumber_Check(o) + #define PyErr_WarnEx(category, message, stacklevel) PyErr_Warn(category, message) #endif + #if PY_VERSION_HEX < 0x02060000 #define Py_REFCNT(ob) (((PyObject*)(ob))->ob_refcnt) #define Py_TYPE(ob) (((PyObject*)(ob))->ob_type) @@ -30,22 +40,21 @@ #define PyType_Modified(t) typedef struct { - void *buf; - PyObject *obj; - Py_ssize_t len; - Py_ssize_t itemsize; - int readonly; - int ndim; - char *format; - Py_ssize_t *shape; - Py_ssize_t *strides; - Py_ssize_t *suboffsets; - void *internal; + void *buf; + PyObject *obj; + Py_ssize_t len; + Py_ssize_t itemsize; + int readonly; + int ndim; + char *format; + Py_ssize_t *shape; + Py_ssize_t *strides; + Py_ssize_t *suboffsets; + void *internal; } Py_buffer; #define PyBUF_SIMPLE 0 #define PyBUF_WRITABLE 0x0001 - #define PyBUF_LOCK 0x0002 #define PyBUF_FORMAT 0x0004 #define PyBUF_ND 0x0008 #define PyBUF_STRIDES (0x0010 | PyBUF_ND) @@ -55,21 +64,32 @@ #define PyBUF_INDIRECT (0x0100 | PyBUF_STRIDES) #endif + #if PY_MAJOR_VERSION < 3 #define __Pyx_BUILTIN_MODULE_NAME "__builtin__" #else #define __Pyx_BUILTIN_MODULE_NAME "builtins" #endif + #if PY_MAJOR_VERSION >= 3 #define Py_TPFLAGS_CHECKTYPES 0 #define Py_TPFLAGS_HAVE_INDEX 0 #endif + #if (PY_VERSION_HEX < 0x02060000) || (PY_MAJOR_VERSION >= 3) #define Py_TPFLAGS_HAVE_NEWBUFFER 0 #endif + #if PY_MAJOR_VERSION >= 3 #define PyBaseString_Type PyUnicode_Type - #define PyString_Type PyBytes_Type + #define PyString_Type PyUnicode_Type + #define PyString_CheckExact PyUnicode_CheckExact +#else + #define PyBytes_Type PyString_Type + #define PyBytes_CheckExact PyString_CheckExact +#endif + +#if PY_MAJOR_VERSION >= 3 #define PyInt_Type PyLong_Type #define PyInt_Check(op) PyLong_Check(op) #define PyInt_CheckExact(op) PyLong_CheckExact(op) @@ -84,13 +104,17 @@ #define PyInt_AsUnsignedLongMask PyLong_AsUnsignedLongMask #define PyInt_AsUnsignedLongLongMask PyLong_AsUnsignedLongLongMask #define __Pyx_PyNumber_Divide(x,y) PyNumber_TrueDivide(x,y) + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceTrueDivide(x,y) #else #define __Pyx_PyNumber_Divide(x,y) PyNumber_Divide(x,y) - #define PyBytes_Type PyString_Type + #define __Pyx_PyNumber_InPlaceDivide(x,y) PyNumber_InPlaceDivide(x,y) + #endif + #if PY_MAJOR_VERSION >= 3 #define PyMethod_New(func, self, klass) PyInstanceMethod_New(func) #endif + #if !defined(WIN32) && !defined(MS_WINDOWS) #ifndef __stdcall #define __stdcall @@ -98,9 +122,30 @@ #ifndef __cdecl #define __cdecl #endif + #ifndef __fastcall + #define __fastcall + #endif #else #define _USE_MATH_DEFINES #endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),((char *)(n))) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),((char *)(n)),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),((char *)(n))) +#else + #define __Pyx_GetAttrString(o,n) PyObject_GetAttrString((o),(n)) + #define __Pyx_SetAttrString(o,n,a) PyObject_SetAttrString((o),(n),(a)) + #define __Pyx_DelAttrString(o,n) PyObject_DelAttrString((o),(n)) +#endif + +#if PY_VERSION_HEX < 0x02050000 + #define __Pyx_NAMESTR(n) ((char *)(n)) + #define __Pyx_DOCSTR(n) ((char *)(n)) +#else + #define __Pyx_NAMESTR(n) (n) + #define __Pyx_DOCSTR(n) (n) +#endif #ifdef __cplusplus #define __PYX_EXTERN_C extern "C" #else @@ -108,56 +153,113 @@ #endif #include #define __PYX_HAVE_API__scipy__stats__vonmises_cython -#include "math.h" #include "stdlib.h" +#include "stdio.h" #include "numpy/arrayobject.h" +#include "numpy/ufuncobject.h" +#include "math.h" +#ifndef CYTHON_INLINE + #if defined(__GNUC__) + #define CYTHON_INLINE __inline__ + #elif defined(_MSC_VER) + #define CYTHON_INLINE __inline + #else + #define CYTHON_INLINE + #endif +#endif -#ifdef __GNUC__ -#define INLINE __inline__ -#elif _WIN32 -#define INLINE __inline +typedef struct {PyObject **p; char *s; const long n; const char* encoding; const char is_unicode; const char is_str; const char intern; } __Pyx_StringTabEntry; /*proto*/ + + +/* Type Conversion Predeclarations */ + +#if PY_MAJOR_VERSION < 3 +#define __Pyx_PyBytes_FromString PyString_FromString +#define __Pyx_PyBytes_FromStringAndSize PyString_FromStringAndSize +#define __Pyx_PyBytes_AsString PyString_AsString #else -#define INLINE +#define __Pyx_PyBytes_FromString PyBytes_FromString +#define __Pyx_PyBytes_FromStringAndSize PyBytes_FromStringAndSize +#define __Pyx_PyBytes_AsString PyBytes_AsString #endif -typedef struct {PyObject **p; char *s; long n; char is_unicode; char intern; char is_identifier;} __Pyx_StringTabEntry; /*proto*/ +#define __Pyx_PyBytes_FromUString(s) __Pyx_PyBytes_FromString((char*)s) +#define __Pyx_PyBytes_AsUString(s) ((unsigned char*) __Pyx_PyBytes_AsString(s)) +#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject*); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x); +#if !defined(T_PYSSIZET) +#if PY_VERSION_HEX < 0x02050000 +#define T_PYSSIZET T_INT +#elif !defined(T_LONGLONG) +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : -1)) +#else +#define T_PYSSIZET \ + ((sizeof(Py_ssize_t) == sizeof(int)) ? T_INT : \ + ((sizeof(Py_ssize_t) == sizeof(long)) ? T_LONG : \ + ((sizeof(Py_ssize_t) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))) +#endif +#endif -static int __pyx_skip_dispatch = 0; +#if !defined(T_ULONGLONG) +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : -1)))) +#else +#define __Pyx_T_UNSIGNED_INT(x) \ + ((sizeof(x) == sizeof(unsigned char)) ? T_UBYTE : \ + ((sizeof(x) == sizeof(unsigned short)) ? T_USHORT : \ + ((sizeof(x) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(x) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(x) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))))) +#endif +#if !defined(T_LONGLONG) +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : -1)))) +#else +#define __Pyx_T_SIGNED_INT(x) \ + ((sizeof(x) == sizeof(char)) ? T_BYTE : \ + ((sizeof(x) == sizeof(short)) ? T_SHORT : \ + ((sizeof(x) == sizeof(int)) ? T_INT : \ + ((sizeof(x) == sizeof(long)) ? T_LONG : \ + ((sizeof(x) == sizeof(PY_LONG_LONG)) ? T_LONGLONG : -1))))) +#endif -/* Type Conversion Predeclarations */ +#define __Pyx_T_FLOATING(x) \ + ((sizeof(x) == sizeof(float)) ? T_FLOAT : \ + ((sizeof(x) == sizeof(double)) ? T_DOUBLE : -1)) -#if PY_MAJOR_VERSION < 3 -#define __Pyx_PyBytes_FromString PyString_FromString -#define __Pyx_PyBytes_AsString PyString_AsString +#if !defined(T_SIZET) +#if !defined(T_ULONGLONG) +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : -1)) #else -#define __Pyx_PyBytes_FromString PyBytes_FromString -#define __Pyx_PyBytes_AsString PyBytes_AsString +#define T_SIZET \ + ((sizeof(size_t) == sizeof(unsigned int)) ? T_UINT : \ + ((sizeof(size_t) == sizeof(unsigned long)) ? T_ULONG : \ + ((sizeof(size_t) == sizeof(unsigned PY_LONG_LONG)) ? T_ULONGLONG : -1))) #endif +#endif -#define __Pyx_PyBool_FromLong(b) ((b) ? (Py_INCREF(Py_True), Py_True) : (Py_INCREF(Py_False), Py_False)) -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x); -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x); -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x); -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b); +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject*); +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t); +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject*); -#define __pyx_PyInt_AsLong(x) (PyInt_CheckExact(x) ? PyInt_AS_LONG(x) : PyInt_AsLong(x)) #define __pyx_PyFloat_AsDouble(x) (PyFloat_CheckExact(x) ? PyFloat_AS_DOUBLE(x) : PyFloat_AsDouble(x)) -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x); -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x); -static INLINE char __pyx_PyInt_char(PyObject* x); -static INLINE short __pyx_PyInt_short(PyObject* x); -static INLINE int __pyx_PyInt_int(PyObject* x); -static INLINE long __pyx_PyInt_long(PyObject* x); -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x); -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x); -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x); -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x); -static INLINE long double __pyx_PyInt_long_double(PyObject* x); + #ifdef __GNUC__ /* Test for GCC > 2.95 */ #if __GNUC__ > 2 || (__GNUC__ == 2 && (__GNUC_MINOR__ > 95)) @@ -175,12 +277,151 @@ static PyObject *__pyx_m; static PyObject *__pyx_b; static PyObject *__pyx_empty_tuple; +static PyObject *__pyx_empty_bytes; static int __pyx_lineno; static int __pyx_clineno = 0; static const char * __pyx_cfilenm= __FILE__; static const char *__pyx_filename; static const char **__pyx_f; + +#if !defined(CYTHON_CCOMPLEX) + #if defined(__cplusplus) + #define CYTHON_CCOMPLEX 1 + #elif defined(_Complex_I) + #define CYTHON_CCOMPLEX 1 + #else + #define CYTHON_CCOMPLEX 0 + #endif +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #include + #else + #include + #endif +#endif + +#if CYTHON_CCOMPLEX && !defined(__cplusplus) && defined(__sun__) && defined(__GNUC__) + #undef _Complex_I + #define _Complex_I 1.0fj +#endif + +typedef npy_int8 __pyx_t_5numpy_int8_t; + +typedef npy_int16 __pyx_t_5numpy_int16_t; + +typedef npy_int32 __pyx_t_5numpy_int32_t; + +typedef npy_int64 __pyx_t_5numpy_int64_t; + +typedef npy_uint8 __pyx_t_5numpy_uint8_t; + +typedef npy_uint16 __pyx_t_5numpy_uint16_t; + +typedef npy_uint32 __pyx_t_5numpy_uint32_t; + +typedef npy_uint64 __pyx_t_5numpy_uint64_t; + +typedef npy_float32 __pyx_t_5numpy_float32_t; + +typedef npy_float64 __pyx_t_5numpy_float64_t; + +typedef npy_long __pyx_t_5numpy_int_t; + +typedef npy_longlong __pyx_t_5numpy_long_t; + +typedef npy_intp __pyx_t_5numpy_intp_t; + +typedef npy_uintp __pyx_t_5numpy_uintp_t; + +typedef npy_ulong __pyx_t_5numpy_uint_t; + +typedef npy_ulonglong __pyx_t_5numpy_ulong_t; + +typedef npy_double __pyx_t_5numpy_float_t; + +typedef npy_double __pyx_t_5numpy_double_t; + +typedef npy_longdouble __pyx_t_5numpy_longdouble_t; + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< float > __pyx_t_float_complex; + #else + typedef float _Complex __pyx_t_float_complex; + #endif +#else + typedef struct { float real, imag; } __pyx_t_float_complex; +#endif + +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + typedef ::std::complex< double > __pyx_t_double_complex; + #else + typedef double _Complex __pyx_t_double_complex; + #endif +#else + typedef struct { double real, imag; } __pyx_t_double_complex; +#endif + +/* Type declarations */ + +typedef npy_cfloat __pyx_t_5numpy_cfloat_t; + +typedef npy_cdouble __pyx_t_5numpy_cdouble_t; + +typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; + +typedef npy_cdouble __pyx_t_5numpy_complex_t; + +#ifndef CYTHON_REFNANNY + #define CYTHON_REFNANNY 0 +#endif + +#if CYTHON_REFNANNY + typedef struct { + void (*INCREF)(void*, PyObject*, int); + void (*DECREF)(void*, PyObject*, int); + void (*GOTREF)(void*, PyObject*, int); + void (*GIVEREF)(void*, PyObject*, int); + void* (*SetupContext)(const char*, int, const char*); + void (*FinishContext)(void**); + } __Pyx_RefNannyAPIStruct; + static __Pyx_RefNannyAPIStruct *__Pyx_RefNanny = NULL; + static __Pyx_RefNannyAPIStruct * __Pyx_RefNannyImportAPI(const char *modname) { + PyObject *m = NULL, *p = NULL; + void *r = NULL; + m = PyImport_ImportModule((char *)modname); + if (!m) goto end; + p = PyObject_GetAttrString(m, (char *)"RefNannyAPI"); + if (!p) goto end; + r = PyLong_AsVoidPtr(p); + end: + Py_XDECREF(p); + Py_XDECREF(m); + return (__Pyx_RefNannyAPIStruct *)r; + } + #define __Pyx_RefNannySetupContext(name) void *__pyx_refnanny = __Pyx_RefNanny->SetupContext((name), __LINE__, __FILE__) + #define __Pyx_RefNannyFinishContext() __Pyx_RefNanny->FinishContext(&__pyx_refnanny) + #define __Pyx_INCREF(r) __Pyx_RefNanny->INCREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_DECREF(r) __Pyx_RefNanny->DECREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GOTREF(r) __Pyx_RefNanny->GOTREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_GIVEREF(r) __Pyx_RefNanny->GIVEREF(__pyx_refnanny, (PyObject *)(r), __LINE__) + #define __Pyx_XDECREF(r) do { if((r) != NULL) {__Pyx_DECREF(r);} } while(0) +#else + #define __Pyx_RefNannySetupContext(name) + #define __Pyx_RefNannyFinishContext() + #define __Pyx_INCREF(r) Py_INCREF(r) + #define __Pyx_DECREF(r) Py_DECREF(r) + #define __Pyx_GOTREF(r) + #define __Pyx_GIVEREF(r) + #define __Pyx_XDECREF(r) Py_XDECREF(r) +#endif /* CYTHON_REFNANNY */ +#define __Pyx_XGIVEREF(r) do { if((r) != NULL) {__Pyx_GIVEREF(r);} } while(0) +#define __Pyx_XGOTREF(r) do { if((r) != NULL) {__Pyx_GOTREF(r);} } while(0) + static void __Pyx_RaiseDoubleKeywordsError( const char* func_name, PyObject* kw_name); /*proto*/ @@ -188,42 +429,124 @@ Py_ssize_t num_min, Py_ssize_t num_max, Py_ssize_t num_found); /*proto*/ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf); /*proto*/ -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts); /*proto*/ -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim); /*proto*/ -static const char* __Pyx_DescribeTokenInFormatString(const char* ts); /*proto*/ -static const char* __Pyx_CheckTypestring_double(const char* ts); /*proto*/ -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast); /*proto*/ +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void); + +static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ +static int __Pyx_EndUnpack(PyObject *); /*proto*/ + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ + +/* Run-time type information about structs used with buffers */ +struct __Pyx_StructField_; + +typedef struct { + const char* name; /* for error messages only */ + struct __Pyx_StructField_* fields; + size_t size; /* sizeof(type) */ + char typegroup; /* _R_eal, _C_omplex, Signed _I_nt, _U_nsigned int, _S_truct, _P_ointer, _O_bject */ +} __Pyx_TypeInfo; + +typedef struct __Pyx_StructField_ { + __Pyx_TypeInfo* type; + const char* name; + size_t offset; +} __Pyx_StructField; + +typedef struct { + __Pyx_StructField* field; + size_t parent_offset; +} __Pyx_BufFmt_StackElem; + + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info); +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack); + static void __Pyx_RaiseBufferFallbackError(void); /*proto*/ #define __Pyx_BufPtrStrided1d(type, buf, i0, s0) (type)((char*)buf + i0 * s0) -static INLINE PyObject *__Pyx_GetItemInt(PyObject *o, Py_ssize_t i, int is_unsigned) { + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Generic(PyObject *o, PyObject* j) { PyObject *r; - if (PyList_CheckExact(o) && 0 <= i && i < PyList_GET_SIZE(o)) { + if (!j) return NULL; + r = PyObject_GetItem(o, j); + Py_DECREF(j); + return r; +} + + +#define __Pyx_GetItemInt_List(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_List_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_List_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyList_GET_SIZE(o)))) { + PyObject *r = PyList_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyList_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyList_GET_ITEM(o, PyList_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + +#define __Pyx_GetItemInt_Tuple(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Tuple_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Tuple_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + if (likely(o != Py_None)) { + if (likely((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { + PyObject *r = PyTuple_GET_ITEM(o, i); + Py_INCREF(r); + return r; + } + else if ((-PyTuple_GET_SIZE(o) <= i) & (i < 0)) { + PyObject *r = PyTuple_GET_ITEM(o, PyTuple_GET_SIZE(o) + i); + Py_INCREF(r); + return r; + } + } + return __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); +} + + +#define __Pyx_GetItemInt(o, i, size, to_py_func) ((size <= sizeof(Py_ssize_t)) ? \ + __Pyx_GetItemInt_Fast(o, i, size <= sizeof(long)) : \ + __Pyx_GetItemInt_Generic(o, to_py_func(i))) + +static CYTHON_INLINE PyObject *__Pyx_GetItemInt_Fast(PyObject *o, Py_ssize_t i, int fits_long) { + PyObject *r; + if (PyList_CheckExact(o) && ((0 <= i) & (i < PyList_GET_SIZE(o)))) { r = PyList_GET_ITEM(o, i); Py_INCREF(r); } - else if (PyTuple_CheckExact(o) && 0 <= i && i < PyTuple_GET_SIZE(o)) { + else if (PyTuple_CheckExact(o) && ((0 <= i) & (i < PyTuple_GET_SIZE(o)))) { r = PyTuple_GET_ITEM(o, i); Py_INCREF(r); } - else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0) || !is_unsigned)) + else if (Py_TYPE(o)->tp_as_sequence && Py_TYPE(o)->tp_as_sequence->sq_item && (likely(i >= 0))) { r = PySequence_GetItem(o, i); + } else { - PyObject *j = (likely(i >= 0) || !is_unsigned) ? PyInt_FromLong(i) : PyLong_FromUnsignedLongLong((sizeof(unsigned long long) > sizeof(Py_ssize_t) ? (1ULL << (sizeof(Py_ssize_t)*8)) : 0) + i); - if (!j) - return 0; - r = PyObject_GetItem(o, j); - Py_DECREF(j); + r = __Pyx_GetItemInt_Generic(o, fits_long ? PyInt_FromLong(i) : PyLong_FromLongLong(i)); } return r; } -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ + +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void); + +static void __Pyx_UnpackTupleError(PyObject *, Py_ssize_t index); /*proto*/ #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags); static void __Pyx_ReleaseBuffer(Py_buffer *view); @@ -239,201 +562,297 @@ static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ -static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ -static int __Pyx_EndUnpack(PyObject *); /*proto*/ +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + #define __Pyx_CREAL(z) ((z).real()) + #define __Pyx_CIMAG(z) ((z).imag()) + #else + #define __Pyx_CREAL(z) (__real__(z)) + #define __Pyx_CIMAG(z) (__imag__(z)) + #endif +#else + #define __Pyx_CREAL(z) ((z).real) + #define __Pyx_CIMAG(z) ((z).imag) +#endif -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type); /*proto*/ +#if defined(_WIN32) && defined(__cplusplus) && CYTHON_CCOMPLEX + #define __Pyx_SET_CREAL(z,x) ((z).real(x)) + #define __Pyx_SET_CIMAG(z,y) ((z).imag(y)) +#else + #define __Pyx_SET_CREAL(z,x) __Pyx_CREAL(z) = (x) + #define __Pyx_SET_CIMAG(z,y) __Pyx_CIMAG(z) = (y) +#endif -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float, float); -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eqf(a, b) ((a)==(b)) + #define __Pyx_c_sumf(a, b) ((a)+(b)) + #define __Pyx_c_difff(a, b) ((a)-(b)) + #define __Pyx_c_prodf(a, b) ((a)*(b)) + #define __Pyx_c_quotf(a, b) ((a)/(b)) + #define __Pyx_c_negf(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zerof(z) ((z)==(float)0) + #define __Pyx_c_conjf(z) (::std::conj(z)) + /*#define __Pyx_c_absf(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zerof(z) ((z)==0) + #define __Pyx_c_conjf(z) (conjf(z)) + /*#define __Pyx_c_absf(z) (cabsf(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex, __pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex); + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex); + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex); + /*static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex);*/ +#endif -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb); /*proto*/ +static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double, double); -static void __Pyx_WriteUnraisable(const char *name); /*proto*/ +#if CYTHON_CCOMPLEX + #define __Pyx_c_eq(a, b) ((a)==(b)) + #define __Pyx_c_sum(a, b) ((a)+(b)) + #define __Pyx_c_diff(a, b) ((a)-(b)) + #define __Pyx_c_prod(a, b) ((a)*(b)) + #define __Pyx_c_quot(a, b) ((a)/(b)) + #define __Pyx_c_neg(a) (-(a)) + #ifdef __cplusplus + #define __Pyx_c_is_zero(z) ((z)==(double)0) + #define __Pyx_c_conj(z) (::std::conj(z)) + /*#define __Pyx_c_abs(z) (::std::abs(z))*/ + #else + #define __Pyx_c_is_zero(z) ((z)==0) + #define __Pyx_c_conj(z) (conj(z)) + /*#define __Pyx_c_abs(z) (cabs(z))*/ + #endif +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex, __pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex); + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex); + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex); + /*static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex);*/ +#endif -static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size); /*proto*/ +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ -static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); -static void __Pyx_AddTraceback(const char *funcname); /*proto*/ +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); -static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject *); -/* Type declarations */ +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject *); -typedef npy_int8 __pyx_t_5numpy_int8_t; +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject *); -typedef npy_int16 __pyx_t_5numpy_int16_t; +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject *); -typedef npy_int32 __pyx_t_5numpy_int32_t; +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject *); -typedef npy_int64 __pyx_t_5numpy_int64_t; +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject *); -typedef npy_uint8 __pyx_t_5numpy_uint8_t; +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject *); -typedef npy_uint16 __pyx_t_5numpy_uint16_t; +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject *); -typedef npy_uint32 __pyx_t_5numpy_uint32_t; +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject *); -typedef npy_uint64 __pyx_t_5numpy_uint64_t; +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject *); -typedef npy_float32 __pyx_t_5numpy_float32_t; +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject *); -typedef npy_float64 __pyx_t_5numpy_float64_t; +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject *); -typedef npy_long __pyx_t_5numpy_int_t; +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject *); -typedef npy_longlong __pyx_t_5numpy_long_t; +static void __Pyx_WriteUnraisable(const char *name); /*proto*/ -typedef npy_ulong __pyx_t_5numpy_uint_t; +static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, long size, int strict); /*proto*/ -typedef npy_ulonglong __pyx_t_5numpy_ulong_t; +static PyObject *__Pyx_ImportModule(const char *name); /*proto*/ -typedef npy_double __pyx_t_5numpy_float_t; +static void __Pyx_AddTraceback(const char *funcname); /*proto*/ -typedef npy_double __pyx_t_5numpy_double_t; +static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ +/* Module declarations from python_buffer */ -typedef npy_longdouble __pyx_t_5numpy_longdouble_t; +/* Module declarations from python_ref */ -typedef npy_cfloat __pyx_t_5numpy_cfloat_t; +/* Module declarations from stdlib */ -typedef npy_cdouble __pyx_t_5numpy_cdouble_t; +/* Module declarations from stdio */ -typedef npy_clongdouble __pyx_t_5numpy_clongdouble_t; -/* Module declarations from python_buffer */ - -/* Module declarations from stdlib */ - /* Module declarations from numpy */ /* Module declarations from numpy */ static PyTypeObject *__pyx_ptype_5numpy_dtype = 0; +static PyTypeObject *__pyx_ptype_5numpy_flatiter = 0; +static PyTypeObject *__pyx_ptype_5numpy_broadcast = 0; static PyTypeObject *__pyx_ptype_5numpy_ndarray = 0; +static PyTypeObject *__pyx_ptype_5numpy_ufunc = 0; +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *, PyObject *, PyObject *, PyObject *, PyObject *); /*proto*/ +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *, char *, char *, int *); /*proto*/ +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *, PyObject *); /*proto*/ +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *); /*proto*/ /* Module declarations from cython */ /* Module declarations from scipy.stats.vonmises_cython */ static double __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series(double, double, unsigned int); /*proto*/ +static __Pyx_TypeInfo __Pyx_TypeInfo_double = { "double", NULL, sizeof(double), 'R' }; +#define __Pyx_MODULE_NAME "scipy.stats.vonmises_cython" +int __pyx_module_is_main_scipy__stats__vonmises_cython = 0; - /* Implementation of scipy.stats.vonmises_cython */ +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static PyObject *__pyx_builtin_RuntimeError; +static char __pyx_k_1[] = "von_mises_cdf_normalapprox"; +static char __pyx_k_2[] = "ndarray is not C contiguous"; +static char __pyx_k_3[] = "ndarray is not Fortran contiguous"; +static char __pyx_k_4[] = "Non-native byte order not supported"; +static char __pyx_k_5[] = "unknown dtype code in numpy.pxd (%d)"; +static char __pyx_k_6[] = "Format string allocated too short, see comment in numpy.pxd"; +static char __pyx_k_7[] = "Format string allocated too short."; +static char __pyx_k_8[] = "scipy.stats"; +static char __pyx_k_9[] = "scipy.special"; +static char __pyx_k_10[] = "numpy.testing"; +static char __pyx_k__B[] = "B"; +static char __pyx_k__H[] = "H"; +static char __pyx_k__I[] = "I"; +static char __pyx_k__L[] = "L"; +static char __pyx_k__O[] = "O"; +static char __pyx_k__Q[] = "Q"; +static char __pyx_k__b[] = "b"; +static char __pyx_k__d[] = "d"; +static char __pyx_k__f[] = "f"; +static char __pyx_k__g[] = "g"; +static char __pyx_k__h[] = "h"; +static char __pyx_k__i[] = "i"; +static char __pyx_k__k[] = "k"; +static char __pyx_k__l[] = "l"; +static char __pyx_k__q[] = "q"; +static char __pyx_k__x[] = "x"; +static char __pyx_k__C1[] = "C1"; +static char __pyx_k__Zd[] = "Zd"; +static char __pyx_k__Zf[] = "Zf"; +static char __pyx_k__Zg[] = "Zg"; +static char __pyx_k__i0[] = "i0"; +static char __pyx_k__np[] = "np"; +static char __pyx_k__pi[] = "pi"; +static char __pyx_k__buf[] = "buf"; +static char __pyx_k__cdf[] = "cdf"; +static char __pyx_k__exp[] = "exp"; +static char __pyx_k__obj[] = "obj"; +static char __pyx_k__sin[] = "sin"; +static char __pyx_k__base[] = "base"; +static char __pyx_k__ndim[] = "ndim"; +static char __pyx_k__norm[] = "norm"; +static char __pyx_k__sqrt[] = "sqrt"; +static char __pyx_k__descr[] = "descr"; +static char __pyx_k__dtype[] = "dtype"; +static char __pyx_k__empty[] = "empty"; +static char __pyx_k__float[] = "float"; +static char __pyx_k__names[] = "names"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__round[] = "round"; +static char __pyx_k__scipy[] = "scipy"; +static char __pyx_k__shape[] = "shape"; +static char __pyx_k__stats[] = "stats"; +static char __pyx_k__astype[] = "astype"; +static char __pyx_k__fields[] = "fields"; +static char __pyx_k__format[] = "format"; +static char __pyx_k__asarray[] = "asarray"; +static char __pyx_k__strides[] = "strides"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__itemsize[] = "itemsize"; +static char __pyx_k__readonly[] = "readonly"; +static char __pyx_k__type_num[] = "type_num"; +static char __pyx_k__byteorder[] = "byteorder"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__atleast_1d[] = "atleast_1d"; +static char __pyx_k__suboffsets[] = "suboffsets"; +static char __pyx_k__RuntimeError[] = "RuntimeError"; +static char __pyx_k__broadcast_arrays[] = "broadcast_arrays"; +static PyObject *__pyx_n_s_1; +static PyObject *__pyx_n_s_10; +static PyObject *__pyx_kp_u_2; +static PyObject *__pyx_kp_u_3; +static PyObject *__pyx_kp_u_4; +static PyObject *__pyx_kp_u_5; +static PyObject *__pyx_kp_u_6; +static PyObject *__pyx_kp_u_7; +static PyObject *__pyx_n_s_8; +static PyObject *__pyx_n_s_9; +static PyObject *__pyx_n_s__C1; +static PyObject *__pyx_n_s__RuntimeError; +static PyObject *__pyx_n_s__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s__asarray; +static PyObject *__pyx_n_s__astype; +static PyObject *__pyx_n_s__atleast_1d; +static PyObject *__pyx_n_s__base; +static PyObject *__pyx_n_s__broadcast_arrays; +static PyObject *__pyx_n_s__buf; +static PyObject *__pyx_n_s__byteorder; +static PyObject *__pyx_n_s__cdf; +static PyObject *__pyx_n_s__descr; +static PyObject *__pyx_n_s__dtype; +static PyObject *__pyx_n_s__empty; +static PyObject *__pyx_n_s__exp; +static PyObject *__pyx_n_s__fields; +static PyObject *__pyx_n_s__float; +static PyObject *__pyx_n_s__format; +static PyObject *__pyx_n_s__i0; +static PyObject *__pyx_n_s__itemsize; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__names; +static PyObject *__pyx_n_s__ndim; +static PyObject *__pyx_n_s__norm; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__obj; +static PyObject *__pyx_n_s__pi; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__readonly; +static PyObject *__pyx_n_s__round; +static PyObject *__pyx_n_s__scipy; +static PyObject *__pyx_n_s__shape; +static PyObject *__pyx_n_s__sin; +static PyObject *__pyx_n_s__sqrt; +static PyObject *__pyx_n_s__stats; +static PyObject *__pyx_n_s__strides; +static PyObject *__pyx_n_s__suboffsets; +static PyObject *__pyx_n_s__type_num; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_int_0; static PyObject *__pyx_int_2; -static PyObject *__pyx_int_24; static PyObject *__pyx_int_3; +static PyObject *__pyx_int_4; +static PyObject *__pyx_int_neg_1; +static PyObject *__pyx_int_15; static PyObject *__pyx_int_16; -static PyObject *__pyx_int_4; -static PyObject *__pyx_int_0; -static char __pyx_k_k[] = "k"; -static PyObject *__pyx_kp_k; -static char __pyx_k_x[] = "x"; -static PyObject *__pyx_kp_x; -static char __pyx_k_23[] = "C1"; -static PyObject *__pyx_kp_23; -static char __pyx_k_numpy[] = "numpy"; -static PyObject *__pyx_kp_numpy; -static char __pyx_k_np[] = "np"; -static PyObject *__pyx_kp_np; -static char __pyx_k_24[] = "scipy.stats"; -static PyObject *__pyx_kp_24; -static char __pyx_k_scipy[] = "scipy"; -static PyObject *__pyx_kp_scipy; -static char __pyx_k_25[] = "scipy.special"; -static PyObject *__pyx_kp_25; -static char __pyx_k_i0[] = "i0"; -static PyObject *__pyx_kp_i0; -static char __pyx_k_26[] = "numpy.testing"; -static PyObject *__pyx_kp_26; -static char __pyx_k_pi[] = "pi"; -static PyObject *__pyx_kp_pi; -static char __pyx_k_sqrt[] = "sqrt"; -static PyObject *__pyx_kp_sqrt; -static char __pyx_k_exp[] = "exp"; -static PyObject *__pyx_kp_exp; -static char __pyx_k_sin[] = "sin"; -static PyObject *__pyx_kp_sin; -static char __pyx_k_stats[] = "stats"; -static PyObject *__pyx_kp_stats; -static char __pyx_k_norm[] = "norm"; -static PyObject *__pyx_kp_norm; -static char __pyx_k_cdf[] = "cdf"; -static PyObject *__pyx_kp_cdf; -static char __pyx_k_asarray[] = "asarray"; -static PyObject *__pyx_kp_asarray; -static char __pyx_k_ndim[] = "ndim"; -static PyObject *__pyx_kp_ndim; -static char __pyx_k_27[] = "atleast_1d"; -static PyObject *__pyx_kp_27; -static char __pyx_k_round[] = "round"; -static PyObject *__pyx_kp_round; -static char __pyx_k_broadcast_arrays[] = "broadcast_arrays"; -static PyObject *__pyx_kp_broadcast_arrays; -static char __pyx_k_empty[] = "empty"; -static PyObject *__pyx_kp_empty; -static char __pyx_k_shape[] = "shape"; -static PyObject *__pyx_kp_shape; -static char __pyx_k_dtype[] = "dtype"; -static PyObject *__pyx_kp_dtype; -static char __pyx_k_float[] = "float"; -static PyObject *__pyx_kp_float; -static char __pyx_k_astype[] = "astype"; -static PyObject *__pyx_kp_astype; -static char __pyx_k_28[] = "von_mises_cdf_normalapprox"; -static PyObject *__pyx_kp_28; -static char __pyx_k___getbuffer__[] = "__getbuffer__"; -static PyObject *__pyx_kp___getbuffer__; -static char __pyx_k___releasebuffer__[] = "__releasebuffer__"; -static PyObject *__pyx_kp___releasebuffer__; -static char __pyx_k_info[] = "info"; -static PyObject *__pyx_kp_info; -static char __pyx_k_flags[] = "flags"; -static PyObject *__pyx_kp_flags; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_iteritems[] = "iteritems"; -static PyObject *__pyx_kp_iteritems; -static char __pyx_k_next[] = "next"; -static PyObject *__pyx_kp_next; -static char __pyx_k_StopIteration[] = "StopIteration"; -static PyObject *__pyx_kp_StopIteration; -static char __pyx_k_pop[] = "pop"; -static PyObject *__pyx_kp_pop; -static char __pyx_k_RuntimeError[] = "RuntimeError"; -static PyObject *__pyx_kp_RuntimeError; -static PyObject *__pyx_kp_1; -static PyObject *__pyx_kp_2; -static PyObject *__pyx_kp_20; -static PyObject *__pyx_kp_21; -static PyObject *__pyx_kp_22; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_builtin_StopIteration; -static PyObject *__pyx_builtin_RuntimeError; -static char __pyx_k_1[] = "ndarray is not C contiguous"; -static char __pyx_k_2[] = "ndarray is not Fortran contiguous"; -static char __pyx_k_3[] = "b"; -static char __pyx_k_4[] = "B"; -static char __pyx_k_5[] = "h"; -static char __pyx_k_6[] = "H"; -static char __pyx_k_7[] = "i"; -static char __pyx_k_8[] = "I"; -static char __pyx_k_9[] = "l"; -static char __pyx_k_10[] = "L"; -static char __pyx_k_11[] = "q"; -static char __pyx_k_12[] = "Q"; -static char __pyx_k_13[] = "f"; -static char __pyx_k_14[] = "d"; -static char __pyx_k_15[] = "g"; -static char __pyx_k_16[] = "Zf"; -static char __pyx_k_17[] = "Zd"; -static char __pyx_k_18[] = "Zg"; -static char __pyx_k_19[] = "O"; -static char __pyx_k_20[] = "unknown dtype code in numpy.pxd (%d)"; -static char __pyx_k_21[] = "Format string allocated too short."; -static char __pyx_k_22[] = "unknown dtype code in numpy.pxd (%d)"; +static PyObject *__pyx_int_24; -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":12 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":12 * * * cdef double von_mises_cdf_series(double k,double x,unsigned int p): # <<<<<<<<<<<<<< @@ -450,17 +869,18 @@ double __pyx_v_V; unsigned int __pyx_v_n; double __pyx_r; - double __pyx_1; - double __pyx_2; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_t_1 = NULL; + Py_ssize_t __pyx_t_1; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; + unsigned int __pyx_t_4; + double __pyx_t_5; + double __pyx_t_6; + unsigned long __pyx_t_7; + PyObject *__pyx_t_8 = NULL; + PyObject *__pyx_t_9 = NULL; + __Pyx_RefNannySetupContext("von_mises_cdf_series"); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":15 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":15 * cdef double s, c, sn, cn, R, V * cdef unsigned int n * s = sin(x) # <<<<<<<<<<<<<< @@ -469,7 +889,7 @@ */ __pyx_v_s = sin(__pyx_v_x); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":16 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":16 * cdef unsigned int n * s = sin(x) * c = cos(x) # <<<<<<<<<<<<<< @@ -478,7 +898,7 @@ */ __pyx_v_c = cos(__pyx_v_x); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":17 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":17 * s = sin(x) * c = cos(x) * sn = sin(p*x) # <<<<<<<<<<<<<< @@ -487,7 +907,7 @@ */ __pyx_v_sn = sin((__pyx_v_p * __pyx_v_x)); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":18 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":18 * c = cos(x) * sn = sin(p*x) * cn = cos(p*x) # <<<<<<<<<<<<<< @@ -496,7 +916,7 @@ */ __pyx_v_cn = cos((__pyx_v_p * __pyx_v_x)); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":19 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":19 * sn = sin(p*x) * cn = cos(p*x) * R = 0 # <<<<<<<<<<<<<< @@ -505,7 +925,7 @@ */ __pyx_v_R = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":20 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":20 * cn = cos(p*x) * R = 0 * V = 0 # <<<<<<<<<<<<<< @@ -514,95 +934,163 @@ */ __pyx_v_V = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":21 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":21 * R = 0 * V = 0 * for n in range(p-1,0,-1): # <<<<<<<<<<<<<< * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) */ - for (__pyx_v_n = (__pyx_v_p - 1); __pyx_v_n > 0; __pyx_v_n-=1) { + __pyx_t_2 = PyLong_FromUnsignedLong((__pyx_v_p - 1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __Pyx_INCREF(__pyx_int_0); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_int_0); + __Pyx_GIVEREF(__pyx_int_0); + __Pyx_INCREF(__pyx_int_neg_1); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_int_neg_1); + __Pyx_GIVEREF(__pyx_int_neg_1); + __pyx_t_2 = 0; + __pyx_t_2 = PyObject_Call(__pyx_builtin_range, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (PyList_CheckExact(__pyx_t_2) || PyTuple_CheckExact(__pyx_t_2)) { + __pyx_t_1 = 0; __pyx_t_3 = __pyx_t_2; __Pyx_INCREF(__pyx_t_3); + } else { + __pyx_t_1 = -1; __pyx_t_3 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + } + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + for (;;) { + if (likely(PyList_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyList_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyList_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else if (likely(PyTuple_CheckExact(__pyx_t_3))) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_3)) break; + __pyx_t_2 = PyTuple_GET_ITEM(__pyx_t_3, __pyx_t_1); __Pyx_INCREF(__pyx_t_2); __pyx_t_1++; + } else { + __pyx_t_2 = PyIter_Next(__pyx_t_3); + if (!__pyx_t_2) { + if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + break; + } + __Pyx_GOTREF(__pyx_t_2); + } + __pyx_t_4 = __Pyx_PyInt_AsUnsignedInt(__pyx_t_2); if (unlikely((__pyx_t_4 == (unsigned int)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_v_n = __pyx_t_4; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":22 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":22 * V = 0 * for n in range(p-1,0,-1): * sn, cn = sn*c - cn*s, cn*c + sn*s # <<<<<<<<<<<<<< * R = 1./(2*n/k + R) * V = R*(sn/n+V) */ - __pyx_1 = ((__pyx_v_sn * __pyx_v_c) - (__pyx_v_cn * __pyx_v_s)); - __pyx_2 = ((__pyx_v_cn * __pyx_v_c) + (__pyx_v_sn * __pyx_v_s)); - __pyx_v_sn = __pyx_1; - __pyx_v_cn = __pyx_2; + __pyx_t_5 = ((__pyx_v_sn * __pyx_v_c) - (__pyx_v_cn * __pyx_v_s)); + __pyx_t_6 = ((__pyx_v_cn * __pyx_v_c) + (__pyx_v_sn * __pyx_v_s)); + __pyx_v_sn = __pyx_t_5; + __pyx_v_cn = __pyx_t_6; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":23 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":23 * for n in range(p-1,0,-1): * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) # <<<<<<<<<<<<<< * V = R*(sn/n+V) * */ - __pyx_v_R = (1. / (((2 * __pyx_v_n) / __pyx_v_k) + __pyx_v_R)); + __pyx_t_7 = (2 * __pyx_v_n); + if (unlikely(__pyx_v_k == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_t_6 = ((__pyx_t_7 / __pyx_v_k) + __pyx_v_R); + if (unlikely(__pyx_t_6 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 23; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_R = (1.0 / __pyx_t_6); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":24 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":24 * sn, cn = sn*c - cn*s, cn*c + sn*s * R = 1./(2*n/k + R) * V = R*(sn/n+V) # <<<<<<<<<<<<<< * * return 0.5+x/(2*np.pi) + V/np.pi */ + if (unlikely(__pyx_v_n == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 24; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } __pyx_v_V = (__pyx_v_R * ((__pyx_v_sn / __pyx_v_n) + __pyx_v_V)); } + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":26 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":26 * V = R*(sn/n+V) * * return 0.5+x/(2*np.pi) + V/np.pi # <<<<<<<<<<<<<< * * def von_mises_cdf_normalapprox(k,x,C1): */ - __pyx_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_5 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_GetAttr(__pyx_5, __pyx_kp_pi); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_6); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_4, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Add(__pyx_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_5 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_4 = PyObject_GetAttr(__pyx_6, __pyx_kp_pi); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_5, __pyx_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_5); __pyx_5 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_1 = __pyx_PyFloat_AsDouble(__pyx_t_3); if (unlikely(PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_r = __pyx_1; + __pyx_t_3 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyFloat_FromDouble(__pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_8 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __pyx_t_9 = PyObject_GetAttr(__pyx_t_8, __pyx_n_s__pi); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Multiply(__pyx_int_2, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_8); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __pyx_t_8 = PyNumber_Add(__pyx_t_3, __pyx_t_9); if (unlikely(!__pyx_t_8)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_8); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyFloat_FromDouble(__pyx_v_V); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_9, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Add(__pyx_t_8, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_8); __pyx_t_8 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __pyx_PyFloat_AsDouble(__pyx_t_2); if (unlikely((__pyx_t_6 == (double)-1) && PyErr_Occurred())) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 26; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_6; goto __pyx_L0; __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_8); + __Pyx_XDECREF(__pyx_t_9); __Pyx_WriteUnraisable("scipy.stats.vonmises_cython.von_mises_cdf_series"); __pyx_r = 0; __pyx_L0:; + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":28 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":28 * return 0.5+x/(2*np.pi) + V/np.pi * * def von_mises_cdf_normalapprox(k,x,C1): # <<<<<<<<<<<<<< @@ -619,22 +1107,19 @@ PyObject *__pyx_v_z; PyObject *__pyx_v_C; PyObject *__pyx_v_chi; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - PyObject *__pyx_4 = 0; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; PyObject *__pyx_t_5 = NULL; PyObject *__pyx_t_6 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_k,&__pyx_kp_x,&__pyx_kp_23,0}; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__x,&__pyx_n_s__C1,0}; + __Pyx_RefNannySetupContext("von_mises_cdf_normalapprox"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); @@ -644,17 +1129,17 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf_normalapprox", 1, 3, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_23); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__C1); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf_normalapprox", 1, 3, 3, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 28; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -680,193 +1165,256 @@ __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf_normalapprox"); return NULL; __pyx_L4_argument_unpacking_done:; - __pyx_v_b = Py_None; Py_INCREF(Py_None); - __pyx_v_z = Py_None; Py_INCREF(Py_None); - __pyx_v_C = Py_None; Py_INCREF(Py_None); - __pyx_v_chi = Py_None; Py_INCREF(Py_None); + __pyx_v_b = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_z = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_C = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_chi = Py_None; __Pyx_INCREF(Py_None); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":29 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":29 * * def von_mises_cdf_normalapprox(k,x,C1): * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) # <<<<<<<<<<<<<< * z = b*np.sin(x/2.) * C = 24*k */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_sqrt); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_pi); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_int_2, __pyx_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_t_1); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sqrt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__pi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_exp); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_k); - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_3, __pyx_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_i0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__exp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__i0); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 29; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_b); + __pyx_v_b = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":30 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":30 * def von_mises_cdf_normalapprox(k,x,C1): * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) * z = b*np.sin(x/2.) # <<<<<<<<<<<<<< * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_4, __pyx_kp_sin); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_2 = PyFloat_FromDouble(2.); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_2); - __pyx_t_2 = 0; - __pyx_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_v_b, __pyx_4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - Py_DECREF(__pyx_v_z); - __pyx_v_z = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__sin); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_v_b, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_z); + __pyx_v_z = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":31 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":31 * b = np.sqrt(2/np.pi)*np.exp(k)/i0(k) * z = b*np.sin(x/2.) * C = 24*k # <<<<<<<<<<<<<< * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 * return scipy.stats.norm.cdf(z) */ - __pyx_t_2 = PyNumber_Multiply(__pyx_int_24, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_C); - __pyx_v_C = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_1 = PyNumber_Multiply(__pyx_int_24, __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 31; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_v_C); + __pyx_v_C = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":32 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":32 * z = b*np.sin(x/2.) * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 # <<<<<<<<<<<<<< * return scipy.stats.norm.cdf(z) * */ - __pyx_t_2 = PyNumber_Power(__pyx_v_z, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Subtract(__pyx_v_C, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_int_16); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = PyFloat_FromDouble(3.); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyNumber_Power(__pyx_v_z, __pyx_int_3, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_v_C, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_int_16); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyFloat_FromDouble(3.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_4, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyFloat_FromDouble((7 / 4.)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_4 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyNumber_Multiply(__pyx_1, __pyx_t_4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_3 = PyFloat_FromDouble((167. / 2)); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_5 = PyNumber_Add(__pyx_t_4, __pyx_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_v_C, __pyx_v_C1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_6 = PyNumber_Subtract(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_4); __pyx_t_4 = 0; - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Add(__pyx_t_6, __pyx_int_3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_5, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Subtract(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - Py_DECREF(__pyx_t_6); __pyx_t_6 = 0; - __pyx_t_6 = PyNumber_Subtract(__pyx_v_z, __pyx_t_3); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_3); __pyx_t_3 = 0; - Py_DECREF(__pyx_v_chi); - __pyx_v_chi = __pyx_t_6; - __pyx_t_6 = 0; + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyFloat_FromDouble((7 / 4.0)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Multiply(__pyx_t_2, __pyx_t_5); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_6); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyFloat_FromDouble((167.0 / 2)); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_3 = PyNumber_Add(__pyx_t_5, __pyx_t_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_v_C, __pyx_v_C1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_5 = PyNumber_Power(__pyx_v_z, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_int_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Power(__pyx_t_5, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_v_z, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 32; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_v_chi); + __pyx_v_chi = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":33 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":33 * C = 24*k * chi = z - z**3/((C-2*z**2-16)/3.-(z**4+7/4.*z**2+167./2)/(C+C1-z**2+3))**2 * return scipy.stats.norm.cdf(z) # <<<<<<<<<<<<<< * * cimport cython */ - __pyx_4 = __Pyx_GetName(__pyx_m, __pyx_kp_scipy); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_4, __pyx_kp_stats); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_4); __pyx_4 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_norm); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_cdf); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_4 = PyTuple_New(1); if (unlikely(!__pyx_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_z); - PyTuple_SET_ITEM(__pyx_4, 0, __pyx_v_z); - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_4), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_4)); __pyx_4 = 0; - __pyx_r = __pyx_2; - __pyx_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__scipy); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__stats); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_5, __pyx_n_s__norm); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__cdf); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_z); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_z); + __Pyx_GIVEREF(__pyx_v_z); + __pyx_t_1 = PyObject_Call(__pyx_t_5, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_4); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_XDECREF(__pyx_t_6); __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf_normalapprox"); __pyx_r = NULL; __pyx_L0:; - Py_DECREF(__pyx_v_b); - Py_DECREF(__pyx_v_z); - Py_DECREF(__pyx_v_C); - Py_DECREF(__pyx_v_chi); + __Pyx_DECREF(__pyx_v_b); + __Pyx_DECREF(__pyx_v_z); + __Pyx_DECREF(__pyx_v_C); + __Pyx_DECREF(__pyx_v_chi); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":37 +/* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":37 * cimport cython * @cython.boundscheck(False) * def von_mises_cdf(k,x): # <<<<<<<<<<<<<< @@ -904,38 +1452,40 @@ Py_buffer __pyx_bstruct_temp_ks; Py_ssize_t __pyx_bstride_0_temp_ks = 0; Py_ssize_t __pyx_bshape_0_temp_ks = 0; - PyObject *__pyx_r; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - double __pyx_5; - double __pyx_6; - double __pyx_7; - double __pyx_8; - PyObject *__pyx_9 = 0; - PyObject *__pyx_10 = 0; - Py_ssize_t __pyx_11 = 0; - int __pyx_12; + PyObject *__pyx_r = NULL; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - PyArrayObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_3 = NULL; int __pyx_t_4; - PyObject *__pyx_t_5 = NULL; - unsigned int __pyx_t_6; - unsigned int __pyx_t_7; - unsigned int __pyx_t_8; - unsigned int __pyx_t_9; - unsigned int __pyx_t_10; - unsigned int __pyx_t_11; - unsigned int __pyx_t_12; - unsigned int __pyx_t_13; - unsigned int __pyx_t_14; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_k,&__pyx_kp_x,0}; + double __pyx_t_5; + double __pyx_t_6; + double __pyx_t_7; + double __pyx_t_8; + PyObject *__pyx_t_9 = NULL; + PyObject *__pyx_t_10 = NULL; + PyArrayObject *__pyx_t_11 = NULL; + int __pyx_t_12; + PyObject *__pyx_t_13 = NULL; + PyObject *__pyx_t_14 = NULL; + PyObject *__pyx_t_15 = NULL; + Py_ssize_t __pyx_t_16; + unsigned int __pyx_t_17; + unsigned int __pyx_t_18; + unsigned int __pyx_t_19; + unsigned int __pyx_t_20; + unsigned int __pyx_t_21; + unsigned int __pyx_t_22; + unsigned int __pyx_t_23; + unsigned int __pyx_t_24; + unsigned int __pyx_t_25; + unsigned int __pyx_t_26; + int __pyx_t_27; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__k,&__pyx_n_s__x,0}; + __Pyx_RefNannySetupContext("von_mises_cdf"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { + Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[2] = {0,0}; - Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); switch (PyTuple_GET_SIZE(__pyx_args)) { case 2: values[1] = PyTuple_GET_ITEM(__pyx_args, 1); case 1: values[0] = PyTuple_GET_ITEM(__pyx_args, 0); @@ -944,11 +1494,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("von_mises_cdf", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 37; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -972,150 +1522,188 @@ __Pyx_AddTraceback("scipy.stats.vonmises_cython.von_mises_cdf"); return NULL; __pyx_L4_argument_unpacking_done:; - Py_INCREF(__pyx_v_k); - Py_INCREF(__pyx_v_x); - __pyx_v_temp = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_temp_xs = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_temp_ks = ((PyArrayObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_zerodim = Py_None; Py_INCREF(Py_None); - __pyx_v_ix = Py_None; Py_INCREF(Py_None); - __pyx_v_bx = Py_None; Py_INCREF(Py_None); - __pyx_v_bk = Py_None; Py_INCREF(Py_None); - __pyx_v_result = Py_None; Py_INCREF(Py_None); - __pyx_v_c_small_k = Py_None; Py_INCREF(Py_None); + __Pyx_INCREF(__pyx_v_k); + __Pyx_INCREF(__pyx_v_x); + __pyx_v_temp = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_temp_xs = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_temp_ks = ((PyArrayObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_zerodim = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_ix = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_bx = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_bk = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_result = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_c_small_k = Py_None; __Pyx_INCREF(Py_None); __pyx_bstruct_temp.buf = NULL; __pyx_bstruct_temp_xs.buf = NULL; __pyx_bstruct_temp_ks.buf = NULL; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":42 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":42 * cdef double a1, a2, a3, a4, C1, CK * #k,x = np.broadcast_arrays(np.asarray(k),np.asarray(x)) * k = np.asarray(k) # <<<<<<<<<<<<<< * x = np.asarray(x) * zerodim = k.ndim==0 and x.ndim==0 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_asarray); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__asarray); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 42; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":43 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":43 * #k,x = np.broadcast_arrays(np.asarray(k),np.asarray(x)) * k = np.asarray(k) * x = np.asarray(x) # <<<<<<<<<<<<<< * zerodim = k.ndim==0 and x.ndim==0 * */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_asarray); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_2; - __pyx_2 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__asarray); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 43; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":44 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":44 * k = np.asarray(k) * x = np.asarray(x) * zerodim = k.ndim==0 and x.ndim==0 # <<<<<<<<<<<<<< * * k = np.atleast_1d(k) */ - __pyx_3 = PyObject_GetAttr(__pyx_v_k, __pyx_kp_ndim); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_3, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_1); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (__pyx_4) { - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_v_x, __pyx_kp_ndim); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_RichCompare(__pyx_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_k, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_t_4) { + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_v_x, __pyx_n_s__ndim); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_1 = PyObject_RichCompare(__pyx_t_2, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 44; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __pyx_t_1; + __pyx_t_1 = 0; + } else { + __pyx_t_2 = __pyx_t_3; + __pyx_t_3 = 0; } - Py_DECREF(__pyx_v_zerodim); - __pyx_v_zerodim = __pyx_1; - __pyx_1 = 0; + __Pyx_DECREF(__pyx_v_zerodim); + __pyx_v_zerodim = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":46 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":46 * zerodim = k.ndim==0 and x.ndim==0 * * k = np.atleast_1d(k) # <<<<<<<<<<<<<< * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) */ - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_27); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_1 = PyTuple_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_1, 0, __pyx_v_k); - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_1), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - Py_DECREF(__pyx_v_k); - __pyx_v_k = __pyx_3; - __pyx_3 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 46; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_k); + __pyx_v_k = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":47 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":47 * * k = np.atleast_1d(k) * x = np.atleast_1d(x) # <<<<<<<<<<<<<< * ix = np.round(x/(2*np.pi)) * x = x-ix*2*np.pi */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_27); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_v_x); - __pyx_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_2; - __pyx_2 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__atleast_1d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 47; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":48 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":48 * k = np.atleast_1d(k) * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) # <<<<<<<<<<<<<< * x = x-ix*2*np.pi * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_round); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_pi); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__round); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - Py_DECREF(__pyx_v_ix); - __pyx_v_ix = __pyx_1; - __pyx_1 = 0; + __pyx_t_2 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 48; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_ix); + __pyx_v_ix = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":49 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":49 * x = np.atleast_1d(x) * ix = np.round(x/(2*np.pi)) * x = x-ix*2*np.pi # <<<<<<<<<<<<<< @@ -1123,19 +1711,24 @@ * # These values should give 12 decimal digits */ __pyx_t_2 = PyNumber_Multiply(__pyx_v_ix, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_3, __pyx_kp_pi); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_2); __pyx_t_2 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_1); __pyx_t_1 = 0; - Py_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_t_2; - __pyx_t_2 = 0; + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__pi); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Subtract(__pyx_v_x, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 49; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_x); + __pyx_v_x = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":52 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":52 * * # These values should give 12 decimal digits * CK=50 # <<<<<<<<<<<<<< @@ -1144,314 +1737,358 @@ */ __pyx_v_CK = 50; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":53 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":53 * # These values should give 12 decimal digits * CK=50 * a1, a2, a3, a4 = [28., 0.5, 100., 5.0] # <<<<<<<<<<<<<< * C1 = 50.1 * */ - __pyx_5 = 28.; - __pyx_6 = 0.5; - __pyx_7 = 100.; - __pyx_8 = 5.0; - __pyx_v_a1 = __pyx_5; - __pyx_v_a2 = __pyx_6; - __pyx_v_a3 = __pyx_7; - __pyx_v_a4 = __pyx_8; + __pyx_t_5 = 28.0; + __pyx_t_6 = 0.5; + __pyx_t_7 = 100.0; + __pyx_t_8 = 5.0; + __pyx_v_a1 = __pyx_t_5; + __pyx_v_a2 = __pyx_t_6; + __pyx_v_a3 = __pyx_t_7; + __pyx_v_a4 = __pyx_t_8; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":54 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":54 * CK=50 * a1, a2, a3, a4 = [28., 0.5, 100., 5.0] * C1 = 50.1 # <<<<<<<<<<<<<< * * bx, bk = np.broadcast_arrays(x,k) */ - __pyx_v_C1 = 50.1; + __pyx_v_C1 = 50.100000000000001; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":56 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":56 * C1 = 50.1 * * bx, bk = np.broadcast_arrays(x,k) # <<<<<<<<<<<<<< * result = np.empty(bx.shape,dtype=np.float) * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_broadcast_arrays); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = PyTuple_New(2); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_v_x); - Py_INCREF(__pyx_v_k); - PyTuple_SET_ITEM(__pyx_2, 1, __pyx_v_k); - __pyx_1 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - if (PyTuple_CheckExact(__pyx_1) && PyTuple_GET_SIZE(__pyx_1) == 2) { - PyObject* tuple = __pyx_1; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_bx); - __pyx_v_bx = __pyx_2; - __pyx_2 = 0; - __pyx_2 = PyTuple_GET_ITEM(tuple, 1); - Py_INCREF(__pyx_2); - Py_DECREF(__pyx_v_bk); - __pyx_v_bk = __pyx_2; - __pyx_2 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__broadcast_arrays); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_INCREF(__pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_x); + __Pyx_GIVEREF(__pyx_v_x); + __Pyx_INCREF(__pyx_v_k); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_k); + __Pyx_GIVEREF(__pyx_v_k); + __pyx_t_2 = PyObject_Call(__pyx_t_3, __pyx_t_1, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (PyTuple_CheckExact(__pyx_t_2) && likely(PyTuple_GET_SIZE(__pyx_t_2) == 2)) { + PyObject* tuple = __pyx_t_2; + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_v_bx); + __pyx_v_bx = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_bk); + __pyx_v_bk = __pyx_t_3; + __pyx_t_3 = 0; + } else { + __pyx_t_9 = PyObject_GetIter(__pyx_t_2); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_9, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_9, 1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (__Pyx_EndUnpack(__pyx_t_9) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_v_bx); + __pyx_v_bx = __pyx_t_1; + __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_v_bk); + __pyx_v_bk = __pyx_t_3; + __pyx_t_3 = 0; } - else { - __pyx_3 = PyObject_GetIter(__pyx_1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_3, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_bx); - __pyx_v_bx = __pyx_2; - __pyx_2 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_3, 1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_bk); - __pyx_v_bk = __pyx_2; - __pyx_2 = 0; - if (__Pyx_EndUnpack(__pyx_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 56; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":57 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":57 * * bx, bk = np.broadcast_arrays(x,k) * result = np.empty(bx.shape,dtype=np.float) # <<<<<<<<<<<<<< * * c_small_k = bk(1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) */ - __pyx_10 = PyObject_GetItem(__pyx_v_bk, __pyx_v_c_small_k); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetAttr(__pyx_10, __pyx_kp_astype); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_10); __pyx_10 = 0; - __pyx_9 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_GetAttr(__pyx_9, __pyx_kp_float); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_9); __pyx_9 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_2); - __pyx_2 = 0; - __pyx_10 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - if (!(__Pyx_TypeTest(__pyx_10, __pyx_ptype_5numpy_ndarray))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = ((PyArrayObject *)__pyx_10); - __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); - __pyx_t_4 = __Pyx_GetBuffer_double((PyObject*)__pyx_t_3, &__pyx_bstruct_temp_ks, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0); - if (unlikely(__pyx_t_4 < 0)) + __pyx_t_1 = PyObject_GetItem(__pyx_v_bk, __pyx_v_c_small_k); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__astype); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_10 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__float); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyTuple_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_10); + __Pyx_GIVEREF(__pyx_t_10); + __pyx_t_10 = 0; + __pyx_t_10 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + if (!(likely(((__pyx_t_10) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_10, __pyx_ptype_5numpy_ndarray))))) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_11 = ((PyArrayObject *)__pyx_t_10); { - PyErr_Fetch(&__pyx_t_2, &__pyx_t_1, &__pyx_t_5); - if (unlikely(__Pyx_GetBuffer_double((PyObject*)__pyx_v_temp_ks, &__pyx_bstruct_temp_ks, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0) == -1)) { - Py_XDECREF(__pyx_t_2); Py_XDECREF(__pyx_t_1); Py_XDECREF(__pyx_t_5); - __Pyx_RaiseBufferFallbackError(); - } else { - PyErr_Restore(__pyx_t_2, __pyx_t_1, __pyx_t_5); + __Pyx_BufFmt_StackElem __pyx_stack[1]; + __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); + __pyx_t_12 = __Pyx_GetBufferAndValidate(&__pyx_bstruct_temp_ks, (PyObject*)__pyx_t_11, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack); + if (unlikely(__pyx_t_12 < 0)) { + PyErr_Fetch(&__pyx_t_13, &__pyx_t_14, &__pyx_t_15); + if (unlikely(__Pyx_GetBufferAndValidate(&__pyx_bstruct_temp_ks, (PyObject*)__pyx_v_temp_ks, &__Pyx_TypeInfo_double, PyBUF_FORMAT| PyBUF_STRIDES, 1, 0, __pyx_stack) == -1)) { + Py_XDECREF(__pyx_t_13); Py_XDECREF(__pyx_t_14); Py_XDECREF(__pyx_t_15); + __Pyx_RaiseBufferFallbackError(); + } else { + PyErr_Restore(__pyx_t_13, __pyx_t_14, __pyx_t_15); } + } + __pyx_bstride_0_temp_ks = __pyx_bstruct_temp_ks.strides[0]; + __pyx_bshape_0_temp_ks = __pyx_bstruct_temp_ks.shape[0]; + if (unlikely(__pyx_t_12 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } - __pyx_bstride_0_temp_ks = __pyx_bstruct_temp_ks.strides[0]; - __pyx_bshape_0_temp_ks = __pyx_bstruct_temp_ks.shape[0]; - if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 62; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_temp_ks)); - __pyx_v_temp_ks = ((PyArrayObject *)__pyx_10); - __pyx_10 = 0; + __pyx_t_11 = 0; + __Pyx_DECREF(((PyObject *)__pyx_v_temp_ks)); + __pyx_v_temp_ks = ((PyArrayObject *)__pyx_t_10); + __pyx_t_10 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":63 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":63 * temp_xs = bx[c_small_k].astype(np.float) * temp_ks = bk[c_small_k].astype(np.float) * for i in range(len(temp)): # <<<<<<<<<<<<<< * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) */ - __pyx_11 = PyObject_Length(((PyObject *)__pyx_v_temp)); if (unlikely(__pyx_11 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - for (__pyx_v_i = 0; __pyx_v_i < __pyx_11; __pyx_v_i+=1) { + __pyx_t_16 = PyObject_Length(((PyObject *)__pyx_v_temp)); if (unlikely(__pyx_t_16 == -1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 63; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + for (__pyx_t_17 = 0; __pyx_t_17 < __pyx_t_16; __pyx_t_17+=1) { + __pyx_v_i = __pyx_t_17; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":64 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":64 * temp_ks = bk[c_small_k].astype(np.float) * for i in range(len(temp)): * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) # <<<<<<<<<<<<<< * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: */ - __pyx_t_6 = __pyx_v_i; - __pyx_t_7 = __pyx_v_i; - __pyx_v_p = ((int)(((1 + __pyx_v_a1) + (__pyx_v_a2 * (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_6, __pyx_bstride_0_temp_ks)))) - (__pyx_v_a3 / ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_7, __pyx_bstride_0_temp_ks)) + __pyx_v_a4)))); + __pyx_t_18 = __pyx_v_i; + __pyx_t_19 = __pyx_v_i; + __pyx_t_8 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_19, __pyx_bstride_0_temp_ks)) + __pyx_v_a4); + if (unlikely(__pyx_t_8 == 0)) { + PyErr_Format(PyExc_ZeroDivisionError, "float division"); + {__pyx_filename = __pyx_f[0]; __pyx_lineno = 64; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_v_p = ((int)(((1 + __pyx_v_a1) + (__pyx_v_a2 * (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_18, __pyx_bstride_0_temp_ks)))) - (__pyx_v_a3 / __pyx_t_8))); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":65 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":65 * for i in range(len(temp)): * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) # <<<<<<<<<<<<<< * if temp[i]<0: * temp[i]=0 */ - __pyx_t_8 = __pyx_v_i; - __pyx_t_9 = __pyx_v_i; - __pyx_t_10 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_10, __pyx_bstride_0_temp) = __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_8, __pyx_bstride_0_temp_ks)), (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_xs.buf, __pyx_t_9, __pyx_bstride_0_temp_xs)), __pyx_v_p); + __pyx_t_20 = __pyx_v_i; + __pyx_t_21 = __pyx_v_i; + __pyx_t_22 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_22, __pyx_bstride_0_temp) = __pyx_f_5scipy_5stats_15vonmises_cython_von_mises_cdf_series((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_ks.buf, __pyx_t_20, __pyx_bstride_0_temp_ks)), (*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp_xs.buf, __pyx_t_21, __pyx_bstride_0_temp_xs)), __pyx_v_p); - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":66 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":66 * p = (1+a1+a2*temp_ks[i]-a3/(temp_ks[i]+a4)) * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: # <<<<<<<<<<<<<< * temp[i]=0 * elif temp[i]>1: */ - __pyx_t_11 = __pyx_v_i; - __pyx_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_11, __pyx_bstride_0_temp)) < 0); - if (__pyx_4) { + __pyx_t_23 = __pyx_v_i; + __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_23, __pyx_bstride_0_temp)) < 0); + if (__pyx_t_4) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":67 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":67 * temp[i] = von_mises_cdf_series(temp_ks[i],temp_xs[i],p) * if temp[i]<0: * temp[i]=0 # <<<<<<<<<<<<<< * elif temp[i]>1: * temp[i]=1 */ - __pyx_t_12 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_12, __pyx_bstride_0_temp) = 0; + __pyx_t_24 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_24, __pyx_bstride_0_temp) = 0; goto __pyx_L8; } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":68 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":68 * if temp[i]<0: * temp[i]=0 * elif temp[i]>1: # <<<<<<<<<<<<<< * temp[i]=1 * result[c_small_k] = temp */ - __pyx_t_13 = __pyx_v_i; - __pyx_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_13, __pyx_bstride_0_temp)) > 1); - if (__pyx_4) { + __pyx_t_25 = __pyx_v_i; + __pyx_t_4 = ((*__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_25, __pyx_bstride_0_temp)) > 1); + if (__pyx_t_4) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":69 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":69 * temp[i]=0 * elif temp[i]>1: * temp[i]=1 # <<<<<<<<<<<<<< * result[c_small_k] = temp * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) */ - __pyx_t_14 = __pyx_v_i; - *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_14, __pyx_bstride_0_temp) = 1; + __pyx_t_26 = __pyx_v_i; + *__Pyx_BufPtrStrided1d(double *, __pyx_bstruct_temp.buf, __pyx_t_26, __pyx_bstride_0_temp) = 1; goto __pyx_L8; } __pyx_L8:; } - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":70 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":70 * elif temp[i]>1: * temp[i]=1 * result[c_small_k] = temp # <<<<<<<<<<<<<< @@ -1460,84 +2097,101 @@ */ if (PyObject_SetItem(__pyx_v_result, __pyx_v_c_small_k, ((PyObject *)__pyx_v_temp)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 70; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":71 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":71 * temp[i]=1 * result[c_small_k] = temp * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) # <<<<<<<<<<<<<< * * if not zerodim: */ - __pyx_9 = __Pyx_GetName(__pyx_m, __pyx_kp_28); if (unlikely(!__pyx_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_1 = PyObject_GetItem(__pyx_v_bk, __pyx_2); if (!__pyx_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_10 = PyObject_GetItem(__pyx_v_bx, __pyx_3); if (!__pyx_10) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = PyFloat_FromDouble(__pyx_v_C1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_3 = PyTuple_New(3); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_1); - PyTuple_SET_ITEM(__pyx_3, 1, __pyx_10); - PyTuple_SET_ITEM(__pyx_3, 2, __pyx_2); - __pyx_1 = 0; - __pyx_10 = 0; - __pyx_2 = 0; - __pyx_1 = PyObject_Call(__pyx_9, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_9); __pyx_9 = 0; - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __pyx_10 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetItem(__pyx_v_result, __pyx_10, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_10); __pyx_10 = 0; - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_10 = __Pyx_GetName(__pyx_m, __pyx_n_s_1); if (unlikely(!__pyx_t_10)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_10); + __pyx_t_1 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyObject_GetItem(__pyx_v_bk, __pyx_t_1); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyObject_GetItem(__pyx_v_bx, __pyx_t_1); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyFloat_FromDouble(__pyx_v_C1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = PyTuple_New(3); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + PyTuple_SET_ITEM(__pyx_t_9, 0, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_9, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_9, 2, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = 0; + __pyx_t_3 = 0; + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_10, __pyx_t_9, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_10); __pyx_t_10 = 0; + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __pyx_t_9 = PyNumber_Invert(__pyx_v_c_small_k); if (unlikely(!__pyx_t_9)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + if (PyObject_SetItem(__pyx_v_result, __pyx_t_9, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 71; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_9); __pyx_t_9 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":73 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":73 * result[~c_small_k] = von_mises_cdf_normalapprox(bk[~c_small_k],bx[~c_small_k],C1) * * if not zerodim: # <<<<<<<<<<<<<< * return result+ix * else: */ - __pyx_4 = __Pyx_PyObject_IsTrue(__pyx_v_zerodim); if (unlikely(__pyx_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_12 = (!__pyx_4); - if (__pyx_12) { + __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_v_zerodim); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 73; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_27 = (!__pyx_t_4); + if (__pyx_t_27) { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":74 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":74 * * if not zerodim: * return result+ix # <<<<<<<<<<<<<< * else: * return (result+ix)[0] */ - __pyx_t_5 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_r = __pyx_t_5; - __pyx_t_5 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 74; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; goto __pyx_L0; goto __pyx_L9; } /*else*/ { - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":76 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":76 * return result+ix * else: * return (result+ix)[0] # <<<<<<<<<<<<<< */ - __pyx_t_5 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = __Pyx_GetItemInt(__pyx_t_5, 0, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_r = __pyx_2; - __pyx_2 = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyNumber_Add(__pyx_v_result, __pyx_v_ix); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_9 = __Pyx_GetItemInt(__pyx_t_1, 0, sizeof(long), PyInt_FromLong); if (!__pyx_t_9) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 76; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_9); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_9; + __pyx_t_9 = 0; goto __pyx_L0; } __pyx_L9:; - __pyx_r = Py_None; Py_INCREF(Py_None); + __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_9); - Py_XDECREF(__pyx_10); + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_9); + __Pyx_XDECREF(__pyx_t_10); { PyObject *__pyx_type, *__pyx_value, *__pyx_tb; __Pyx_ErrFetch(&__pyx_type, &__pyx_value, &__pyx_tb); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp); @@ -1552,21 +2206,23 @@ __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_xs); __Pyx_SafeReleaseBuffer(&__pyx_bstruct_temp_ks); __pyx_L2:; - Py_DECREF(__pyx_v_temp); - Py_DECREF(__pyx_v_temp_xs); - Py_DECREF(__pyx_v_temp_ks); - Py_DECREF(__pyx_v_zerodim); - Py_DECREF(__pyx_v_ix); - Py_DECREF(__pyx_v_bx); - Py_DECREF(__pyx_v_bk); - Py_DECREF(__pyx_v_result); - Py_DECREF(__pyx_v_c_small_k); - Py_DECREF(__pyx_v_k); - Py_DECREF(__pyx_v_x); + __Pyx_DECREF((PyObject *)__pyx_v_temp); + __Pyx_DECREF((PyObject *)__pyx_v_temp_xs); + __Pyx_DECREF((PyObject *)__pyx_v_temp_ks); + __Pyx_DECREF(__pyx_v_zerodim); + __Pyx_DECREF(__pyx_v_ix); + __Pyx_DECREF(__pyx_v_bx); + __Pyx_DECREF(__pyx_v_bk); + __Pyx_DECREF(__pyx_v_result); + __Pyx_DECREF(__pyx_v_c_small_k); + __Pyx_DECREF(__pyx_v_k); + __Pyx_DECREF(__pyx_v_x); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":50 +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":187 * # experimental exception made for __getbuffer__ and __releasebuffer__ * # -- the details of this may change. * def __getbuffer__(ndarray self, Py_buffer* info, int flags): # <<<<<<<<<<<<<< @@ -1579,47 +2235,67 @@ int __pyx_v_copy_shape; int __pyx_v_i; int __pyx_v_ndim; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; int __pyx_v_t; char *__pyx_v_f; PyArray_Descr *__pyx_v_descr = 0; - PyObject *__pyx_v_stack; + int __pyx_v_offset; int __pyx_v_hasfields; - PyObject *__pyx_v_iterator; int __pyx_r; - int __pyx_1; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 0; - int __pyx_4; - PyObject *__pyx_5 = 0; - PyObject *__pyx_6 = 0; - PyObject *__pyx_7 = 0; - Py_ssize_t __pyx_8 = 0; - PyObject *__pyx_t_1 = NULL; + int __pyx_t_1; + int __pyx_t_2; + int __pyx_t_3; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + char *__pyx_t_9; + __Pyx_RefNannySetupContext("__getbuffer__"); if (__pyx_v_info == NULL) return 0; - __pyx_v_info->obj = Py_None; Py_INCREF(Py_None); - __pyx_v_stack = ((PyObject *)Py_None); Py_INCREF(Py_None); - __pyx_v_iterator = Py_None; Py_INCREF(Py_None); + __pyx_v_info->obj = Py_None; __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(__pyx_v_info->obj); + __Pyx_INCREF((PyObject *)__pyx_v_self); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":56 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":193 * # of flags * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":194 + * cdef int copy_shape, i, ndim + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * + * ndim = PyArray_NDIM(self) + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":196 + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * * ndim = PyArray_NDIM(self) # <<<<<<<<<<<<<< * * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ __pyx_v_ndim = PyArray_NDIM(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":58 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":198 * ndim = PyArray_NDIM(self) * * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< * copy_shape = 1 * else: */ - __pyx_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_1) { + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":59 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":199 * * if sizeof(npy_intp) != sizeof(Py_ssize_t): * copy_shape = 1 # <<<<<<<<<<<<<< @@ -1631,7 +2307,7 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":61 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":201 * copy_shape = 1 * else: * copy_shape = 0 # <<<<<<<<<<<<<< @@ -1642,88 +2318,100 @@ } __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":63 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":203 * copy_shape = 0 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_1 = ((__pyx_v_flags & PyBUF_C_CONTIGUOUS) == PyBUF_C_CONTIGUOUS); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":64 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":204 * * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not C contiguous") + * raise ValueError(u"ndarray is not C contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_2 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_C_CONTIGUOUS)); + __pyx_t_3 = __pyx_t_2; + } else { + __pyx_t_3 = __pyx_t_1; } - if (__pyx_1) { + if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":65 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":205 * if ((flags & pybuf.PyBUF_C_CONTIGUOUS == pybuf.PyBUF_C_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_C_CONTIGUOUS)): - * raise ValueError("ndarray is not C contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not C contiguous") # <<<<<<<<<<<<<< * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_1); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_1); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_2)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_2)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_2)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L6; } __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":67 - * raise ValueError("ndarray is not C contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":207 + * raise ValueError(u"ndarray is not C contiguous") * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) # <<<<<<<<<<<<<< * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") */ - __pyx_1 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); - if (__pyx_1) { + __pyx_t_3 = ((__pyx_v_flags & PyBUF_F_CONTIGUOUS) == PyBUF_F_CONTIGUOUS); + if (__pyx_t_3) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":68 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":208 * * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): # <<<<<<<<<<<<<< - * raise ValueError("ndarray is not Fortran contiguous") + * raise ValueError(u"ndarray is not Fortran contiguous") * */ - __pyx_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_1 = (!PyArray_CHKFLAGS(((PyArrayObject *)__pyx_v_self), NPY_F_CONTIGUOUS)); + __pyx_t_2 = __pyx_t_1; + } else { + __pyx_t_2 = __pyx_t_3; } - if (__pyx_1) { + if (__pyx_t_2) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":69 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":209 * if ((flags & pybuf.PyBUF_F_CONTIGUOUS == pybuf.PyBUF_F_CONTIGUOUS) * and not PyArray_CHKFLAGS(self, NPY_F_CONTIGUOUS)): - * raise ValueError("ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< + * raise ValueError(u"ndarray is not Fortran contiguous") # <<<<<<<<<<<<<< * * info.buf = PyArray_DATA(self) */ - __pyx_2 = PyTuple_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_2); - PyTuple_SET_ITEM(__pyx_2, 0, __pyx_kp_2); - __pyx_3 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_2), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __Pyx_Raise(__pyx_3, 0, 0); - Py_DECREF(__pyx_3); __pyx_3 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 69; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_3)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_3)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_3)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 209; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":71 - * raise ValueError("ndarray is not Fortran contiguous") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":211 + * raise ValueError(u"ndarray is not Fortran contiguous") * * info.buf = PyArray_DATA(self) # <<<<<<<<<<<<<< * info.ndim = ndim @@ -1731,7 +2419,7 @@ */ __pyx_v_info->buf = PyArray_DATA(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":72 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":212 * * info.buf = PyArray_DATA(self) * info.ndim = ndim # <<<<<<<<<<<<<< @@ -1740,17 +2428,17 @@ */ __pyx_v_info->ndim = __pyx_v_ndim; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":73 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":213 * info.buf = PyArray_DATA(self) * info.ndim = ndim * if copy_shape: # <<<<<<<<<<<<<< * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. */ - __pyx_4 = __pyx_v_copy_shape; - if (__pyx_4) { + __pyx_t_6 = __pyx_v_copy_shape; + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":76 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":216 * # Allocate new buffer for strides and shape info. This is allocated * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) # <<<<<<<<<<<<<< @@ -1759,7 +2447,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)malloc((((sizeof(Py_ssize_t)) * __pyx_v_ndim) * 2))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":77 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":217 * # as one block, strides first. * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim # <<<<<<<<<<<<<< @@ -1768,16 +2456,18 @@ */ __pyx_v_info->shape = (__pyx_v_info->strides + __pyx_v_ndim); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":78 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":218 * info.strides = stdlib.malloc(sizeof(Py_ssize_t) * ndim * 2) * info.shape = info.strides + ndim * for i in range(ndim): # <<<<<<<<<<<<<< * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] */ - for (__pyx_v_i = 0; __pyx_v_i < __pyx_v_ndim; __pyx_v_i+=1) { + __pyx_t_6 = __pyx_v_ndim; + for (__pyx_t_7 = 0; __pyx_t_7 < __pyx_t_6; __pyx_t_7+=1) { + __pyx_v_i = __pyx_t_7; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":79 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":219 * info.shape = info.strides + ndim * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] # <<<<<<<<<<<<<< @@ -1786,7 +2476,7 @@ */ (__pyx_v_info->strides[__pyx_v_i]) = (PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))[__pyx_v_i]); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":80 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":220 * for i in range(ndim): * info.strides[i] = PyArray_STRIDES(self)[i] * info.shape[i] = PyArray_DIMS(self)[i] # <<<<<<<<<<<<<< @@ -1799,7 +2489,7 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":82 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":222 * info.shape[i] = PyArray_DIMS(self)[i] * else: * info.strides = PyArray_STRIDES(self) # <<<<<<<<<<<<<< @@ -1808,7 +2498,7 @@ */ __pyx_v_info->strides = ((Py_ssize_t *)PyArray_STRIDES(((PyArrayObject *)__pyx_v_self))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":83 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":223 * else: * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) # <<<<<<<<<<<<<< @@ -1819,7 +2509,7 @@ } __pyx_L8:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":84 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":224 * info.strides = PyArray_STRIDES(self) * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL # <<<<<<<<<<<<<< @@ -1828,7 +2518,7 @@ */ __pyx_v_info->suboffsets = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":85 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":225 * info.shape = PyArray_DIMS(self) * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) # <<<<<<<<<<<<<< @@ -1837,7 +2527,7 @@ */ __pyx_v_info->itemsize = PyArray_ITEMSIZE(((PyArrayObject *)__pyx_v_self)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":86 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":226 * info.suboffsets = NULL * info.itemsize = PyArray_ITEMSIZE(self) * info.readonly = not PyArray_ISWRITEABLE(self) # <<<<<<<<<<<<<< @@ -1846,7 +2536,7 @@ */ __pyx_v_info->readonly = (!PyArray_ISWRITEABLE(((PyArrayObject *)__pyx_v_self))); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":89 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":229 * * cdef int t * cdef char* f = NULL # <<<<<<<<<<<<<< @@ -1855,309 +2545,411 @@ */ __pyx_v_f = NULL; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":90 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":230 * cdef int t * cdef char* f = NULL * cdef dtype descr = self.descr # <<<<<<<<<<<<<< * cdef list stack - * + * cdef int offset */ - Py_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); + __Pyx_INCREF(((PyObject *)((PyArrayObject *)__pyx_v_self)->descr)); __pyx_v_descr = ((PyArrayObject *)__pyx_v_self)->descr; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":93 - * cdef list stack + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":234 + * cdef int offset * * cdef bint hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< * - * # Ugly hack warning: + * if not hasfields and not copy_shape: */ __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":103 - * # functions). + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":236 + * cdef bint hasfields = PyDataType_HASFIELDS(descr) * * if not hasfields and not copy_shape: # <<<<<<<<<<<<<< * # do not call releasebuffer * info.obj = None */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { - __pyx_1 = (!__pyx_v_copy_shape); + __pyx_t_2 = (!__pyx_v_hasfields); + if (__pyx_t_2) { + __pyx_t_3 = (!__pyx_v_copy_shape); + __pyx_t_1 = __pyx_t_3; + } else { + __pyx_t_1 = __pyx_t_2; } - if (__pyx_1) { + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":105 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":238 * if not hasfields and not copy_shape: * # do not call releasebuffer * info.obj = None # <<<<<<<<<<<<<< * else: * # need to call releasebuffer */ - Py_INCREF(Py_None); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(Py_None); + __Pyx_GIVEREF(Py_None); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = Py_None; goto __pyx_L11; } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":108 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":241 * else: * # need to call releasebuffer * info.obj = self # <<<<<<<<<<<<<< * * if not hasfields: */ - Py_INCREF(__pyx_v_self); - Py_DECREF(__pyx_v_info->obj); + __Pyx_INCREF(__pyx_v_self); + __Pyx_GIVEREF(__pyx_v_self); + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = __pyx_v_self; } __pyx_L11:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":110 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":243 * info.obj = self * * if not hasfields: # <<<<<<<<<<<<<< * t = descr.type_num - * if t == NPY_BYTE: f = "b" + * if ((descr.byteorder == '>' and little_endian) or */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_t_1 = (!__pyx_v_hasfields); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":111 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":244 * * if not hasfields: * t = descr.type_num # <<<<<<<<<<<<<< - * if t == NPY_BYTE: f = "b" - * elif t == NPY_UBYTE: f = "B" + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): */ __pyx_v_t = __pyx_v_descr->type_num; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":112 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":245 * if not hasfields: * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '>'); + if (__pyx_t_1) { + __pyx_t_2 = __pyx_v_little_endian; + } else { + __pyx_t_2 = __pyx_t_1; + } + if (!__pyx_t_2) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":246 + * t = descr.type_num + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * if t == NPY_BYTE: f = "b" + */ + __pyx_t_1 = (__pyx_v_descr->byteorder == '<'); + if (__pyx_t_1) { + __pyx_t_3 = (!__pyx_v_little_endian); + __pyx_t_8 = __pyx_t_3; + } else { + __pyx_t_8 = __pyx_t_1; + } + __pyx_t_1 = __pyx_t_8; + } else { + __pyx_t_1 = __pyx_t_2; + } + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":247 + * if ((descr.byteorder == '>' and little_endian) or + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * if t == NPY_BYTE: f = "b" + * elif t == NPY_UBYTE: f = "B" + */ + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_t_4, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_4, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 247; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L13; + } + __pyx_L13:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":248 + * (descr.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" # <<<<<<<<<<<<<< * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" */ - switch (__pyx_v_t) { - case NPY_BYTE: - __pyx_v_f = __pyx_k_3; - break; - case NPY_UBYTE: + __pyx_t_1 = (__pyx_v_t == NPY_BYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__b; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":113 - * t = descr.type_num + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":249 + * raise ValueError(u"Non-native byte order not supported") * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" # <<<<<<<<<<<<<< * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" */ - __pyx_v_f = __pyx_k_4; - break; - case NPY_SHORT: + __pyx_t_1 = (__pyx_v_t == NPY_UBYTE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__B; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":114 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":250 * if t == NPY_BYTE: f = "b" * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" # <<<<<<<<<<<<<< * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" */ - __pyx_v_f = __pyx_k_5; - break; - case NPY_USHORT: + __pyx_t_1 = (__pyx_v_t == NPY_SHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__h; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":115 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":251 * elif t == NPY_UBYTE: f = "B" * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" # <<<<<<<<<<<<<< * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" */ - __pyx_v_f = __pyx_k_6; - break; - case NPY_INT: + __pyx_t_1 = (__pyx_v_t == NPY_USHORT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__H; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":116 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":252 * elif t == NPY_SHORT: f = "h" * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" # <<<<<<<<<<<<<< * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" */ - __pyx_v_f = __pyx_k_7; - break; - case NPY_UINT: + __pyx_t_1 = (__pyx_v_t == NPY_INT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__i; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":117 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":253 * elif t == NPY_USHORT: f = "H" * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" # <<<<<<<<<<<<<< * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" */ - __pyx_v_f = __pyx_k_8; - break; - case NPY_LONG: + __pyx_t_1 = (__pyx_v_t == NPY_UINT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__I; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":118 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":254 * elif t == NPY_INT: f = "i" * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" # <<<<<<<<<<<<<< * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" */ - __pyx_v_f = __pyx_k_9; - break; - case NPY_ULONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__l; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":119 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":255 * elif t == NPY_UINT: f = "I" * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" # <<<<<<<<<<<<<< * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" */ - __pyx_v_f = __pyx_k_10; - break; - case NPY_LONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_ULONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__L; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":120 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":256 * elif t == NPY_LONG: f = "l" * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" # <<<<<<<<<<<<<< * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" */ - __pyx_v_f = __pyx_k_11; - break; - case NPY_ULONGLONG: + __pyx_t_1 = (__pyx_v_t == NPY_LONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__q; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":121 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":257 * elif t == NPY_ULONG: f = "L" * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" # <<<<<<<<<<<<<< * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" */ - __pyx_v_f = __pyx_k_12; - break; - case NPY_FLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_ULONGLONG); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Q; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":122 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":258 * elif t == NPY_LONGLONG: f = "q" * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" # <<<<<<<<<<<<<< * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" */ - __pyx_v_f = __pyx_k_13; - break; - case NPY_DOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_FLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__f; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":123 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":259 * elif t == NPY_ULONGLONG: f = "Q" * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" # <<<<<<<<<<<<<< * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" */ - __pyx_v_f = __pyx_k_14; - break; - case NPY_LONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_DOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__d; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":124 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":260 * elif t == NPY_FLOAT: f = "f" * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" # <<<<<<<<<<<<<< * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" */ - __pyx_v_f = __pyx_k_15; - break; - case NPY_CFLOAT: + __pyx_t_1 = (__pyx_v_t == NPY_LONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__g; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":125 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":261 * elif t == NPY_DOUBLE: f = "d" * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" # <<<<<<<<<<<<<< * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" */ - __pyx_v_f = __pyx_k_16; - break; - case NPY_CDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CFLOAT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zf; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":126 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":262 * elif t == NPY_LONGDOUBLE: f = "g" * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" # <<<<<<<<<<<<<< * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" */ - __pyx_v_f = __pyx_k_17; - break; - case NPY_CLONGDOUBLE: + __pyx_t_1 = (__pyx_v_t == NPY_CDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zd; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":127 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":263 * elif t == NPY_CFLOAT: f = "Zf" * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" # <<<<<<<<<<<<<< * elif t == NPY_OBJECT: f = "O" * else: */ - __pyx_v_f = __pyx_k_18; - break; - case NPY_OBJECT: + __pyx_t_1 = (__pyx_v_t == NPY_CLONGDOUBLE); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__Zg; + goto __pyx_L14; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":128 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":264 * elif t == NPY_CDOUBLE: f = "Zd" * elif t == NPY_CLONGDOUBLE: f = "Zg" * elif t == NPY_OBJECT: f = "O" # <<<<<<<<<<<<<< * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - __pyx_v_f = __pyx_k_19; - break; - default: + __pyx_t_1 = (__pyx_v_t == NPY_OBJECT); + if (__pyx_t_1) { + __pyx_v_f = __pyx_k__O; + goto __pyx_L14; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":130 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":266 * elif t == NPY_OBJECT: f = "O" * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< * info.format = f * return */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_20, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_2, 0, 0); - Py_DECREF(__pyx_2); __pyx_2 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; + __pyx_t_5 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_5), __pyx_t_5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 266; __pyx_clineno = __LINE__; goto __pyx_L1_error;} } + __pyx_L14:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":131 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":267 * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f # <<<<<<<<<<<<<< * return * else: */ __pyx_v_info->format = __pyx_v_f; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":132 - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":268 + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) * info.format = f * return # <<<<<<<<<<<<<< * else: - * info.format = stdlib.malloc(255) # static size + * info.format = stdlib.malloc(_buffer_format_string_len) */ __pyx_r = 0; goto __pyx_L0; @@ -2165,652 +2957,1206 @@ } /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":134 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":270 * return * else: - * info.format = stdlib.malloc(255) # static size # <<<<<<<<<<<<<< - * f = info.format - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) # <<<<<<<<<<<<<< + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 */ __pyx_v_info->format = ((char *)malloc(255)); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":135 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":271 * else: - * info.format = stdlib.malloc(255) # static size - * f = info.format # <<<<<<<<<<<<<< - * stack = [iter(descr.fields.iteritems())] + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment # <<<<<<<<<<<<<< + * offset = 0 + * f = _util_dtypestring(descr, info.format + 1, + */ + (__pyx_v_info->format[0]) = '^'; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":272 + * info.format = stdlib.malloc(_buffer_format_string_len) + * info.format[0] = '^' # Native data types, manual alignment + * offset = 0 # <<<<<<<<<<<<<< + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + */ + __pyx_v_offset = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":275 + * f = _util_dtypestring(descr, info.format + 1, + * info.format + _buffer_format_string_len, + * &offset) # <<<<<<<<<<<<<< + * f[0] = 0 # Terminate format string * */ - __pyx_v_f = __pyx_v_info->format; + __pyx_t_9 = __pyx_f_5numpy__util_dtypestring(__pyx_v_descr, (__pyx_v_info->format + 1), (__pyx_v_info->format + 255), (&__pyx_v_offset)); if (unlikely(__pyx_t_9 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 273; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_9; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":136 - * info.format = stdlib.malloc(255) # static size - * f = info.format - * stack = [iter(descr.fields.iteritems())] # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":276 + * info.format + _buffer_format_string_len, + * &offset) + * f[0] = 0 # Terminate format string # <<<<<<<<<<<<<< * - * while True: + * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_3 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_2 = PyObject_Call(__pyx_3, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = PyObject_GetIter(__pyx_2); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyList_New(1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 136; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyList_SET_ITEM(__pyx_2, 0, __pyx_3); - __pyx_3 = 0; - Py_DECREF(((PyObject *)__pyx_v_stack)); - __pyx_v_stack = __pyx_2; - __pyx_2 = 0; + (__pyx_v_f[0]) = 0; + } + __pyx_L12:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":138 - * stack = [iter(descr.fields.iteritems())] + __pyx_r = 0; + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); + __pyx_r = -1; + __Pyx_GOTREF(__pyx_v_info->obj); + __Pyx_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; + goto __pyx_L2; + __pyx_L0:; + if (__pyx_v_info->obj == Py_None) { + __Pyx_GOTREF(Py_None); + __Pyx_DECREF(Py_None); __pyx_v_info->obj = NULL; + } + __pyx_L2:; + __Pyx_XDECREF((PyObject *)__pyx_v_descr); + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":278 + * f[0] = 0 # Terminate format string * - * while True: # <<<<<<<<<<<<<< - * iterator = stack[-1] - * descr = None + * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) */ - while (1) { - __pyx_1 = 1; - if (!__pyx_1) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":139 +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ +static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { + int __pyx_t_1; + __Pyx_RefNannySetupContext("__releasebuffer__"); + __Pyx_INCREF((PyObject *)__pyx_v_self); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":279 * - * while True: - * iterator = stack[-1] # <<<<<<<<<<<<<< - * descr = None - * while descr is None: + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): */ - __pyx_3 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_3; - __pyx_3 = 0; + __pyx_t_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":140 - * while True: - * iterator = stack[-1] - * descr = None # <<<<<<<<<<<<<< - * while descr is None: - * try: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":280 + * def __releasebuffer__(ndarray self, Py_buffer* info): + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) # <<<<<<<<<<<<<< + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) */ - Py_INCREF(Py_None); - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)Py_None); + free(__pyx_v_info->format); + goto __pyx_L5; + } + __pyx_L5:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":141 - * iterator = stack[-1] - * descr = None - * while descr is None: # <<<<<<<<<<<<<< - * try: - * descr = iterator.next()[1][0] + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":281 + * if PyArray_HASFIELDS(self): + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< + * stdlib.free(info.strides) + * # info.shape was stored after info.strides in the same block */ - while (1) { - __pyx_1 = (((PyObject *)__pyx_v_descr) == Py_None); - if (!__pyx_1) break; + __pyx_t_1 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":142 - * descr = None - * while descr is None: - * try: # <<<<<<<<<<<<<< - * descr = iterator.next()[1][0] - * except StopIteration: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":282 + * stdlib.free(info.format) + * if sizeof(npy_intp) != sizeof(Py_ssize_t): + * stdlib.free(info.strides) # <<<<<<<<<<<<<< + * # info.shape was stored after info.strides in the same block + * */ - { - PyObject *__pyx_save_exc_type, *__pyx_save_exc_value, *__pyx_save_exc_tb; - __Pyx_ExceptionSave(&__pyx_save_exc_type, &__pyx_save_exc_value, &__pyx_save_exc_tb); - /*try:*/ { + free(__pyx_v_info->strides); + goto __pyx_L6; + } + __pyx_L6:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":143 - * while descr is None: - * try: - * descr = iterator.next()[1][0] # <<<<<<<<<<<<<< - * except StopIteration: - * stack.pop() + __Pyx_DECREF((PyObject *)__pyx_v_self); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":755 + * ctypedef npy_cdouble complex_t + * + * cdef inline object PyArray_MultiIterNew1(a): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(1, a) + * */ - __pyx_2 = PyObject_GetAttr(__pyx_v_iterator, __pyx_kp_next); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - __pyx_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = __Pyx_GetItemInt(__pyx_3, 1, 0); if (!__pyx_2) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_3 = __Pyx_GetItemInt(__pyx_2, 0, 0); if (!__pyx_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - if (!(__Pyx_TypeTest(__pyx_3, __pyx_ptype_5numpy_dtype))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L17_error;} - Py_DECREF(((PyObject *)__pyx_v_descr)); - __pyx_v_descr = ((PyArray_Descr *)__pyx_3); - __pyx_3 = 0; - } - Py_XDECREF(__pyx_save_exc_type); __pyx_save_exc_type = 0; - Py_XDECREF(__pyx_save_exc_value); __pyx_save_exc_value = 0; - Py_XDECREF(__pyx_save_exc_tb); __pyx_save_exc_tb = 0; - goto __pyx_L22_try; - __pyx_L17_error:; - Py_XDECREF(__pyx_2); __pyx_2 = 0; - Py_XDECREF(__pyx_3); __pyx_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":144 - * try: - * descr = iterator.next()[1][0] - * except StopIteration: # <<<<<<<<<<<<<< - * stack.pop() - * if len(stack) > 0: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew1(PyObject *__pyx_v_a) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew1"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":756 + * + * cdef inline object PyArray_MultiIterNew1(a): + * return PyArray_MultiIterNew(1, a) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew2(a, b): */ - __pyx_4 = PyErr_ExceptionMatches(__pyx_builtin_StopIteration); - if (__pyx_4) { - __Pyx_AddTraceback("numpy.__getbuffer__"); - if (__Pyx_GetException(&__pyx_2, &__pyx_3, &__pyx_5) < 0) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(1, ((void *)__pyx_v_a)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 756; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":145 - * descr = iterator.next()[1][0] - * except StopIteration: - * stack.pop() # <<<<<<<<<<<<<< - * if len(stack) > 0: - * f[0] = 125 #"}" + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew1"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":758 + * return PyArray_MultiIterNew(1, a) + * + * cdef inline object PyArray_MultiIterNew2(a, b): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(2, a, b) + * */ - __pyx_6 = PyObject_GetAttr(((PyObject *)__pyx_v_stack), __pyx_kp_pop); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_7 = PyObject_Call(__pyx_6, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - Py_DECREF(__pyx_7); __pyx_7 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":146 - * except StopIteration: - * stack.pop() - * if len(stack) > 0: # <<<<<<<<<<<<<< - * f[0] = 125 #"}" - * f += 1 +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew2(PyObject *__pyx_v_a, PyObject *__pyx_v_b) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew2"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":759 + * + * cdef inline object PyArray_MultiIterNew2(a, b): + * return PyArray_MultiIterNew(2, a, b) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): */ - __pyx_8 = PyObject_Length(((PyObject *)__pyx_v_stack)); if (unlikely(__pyx_8 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 146; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - __pyx_1 = (__pyx_8 > 0); - if (__pyx_1) { + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(2, ((void *)__pyx_v_a), ((void *)__pyx_v_b)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 759; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":147 - * stack.pop() - * if len(stack) > 0: - * f[0] = 125 #"}" # <<<<<<<<<<<<<< - * f += 1 - * iterator = stack[-1] + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew2"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":761 + * return PyArray_MultiIterNew(2, a, b) + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(3, a, b, c) + * */ - (__pyx_v_f[0]) = 125; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":148 - * if len(stack) > 0: - * f[0] = 125 #"}" - * f += 1 # <<<<<<<<<<<<<< - * iterator = stack[-1] - * else: +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew3(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew3"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":762 + * + * cdef inline object PyArray_MultiIterNew3(a, b, c): + * return PyArray_MultiIterNew(3, a, b, c) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): */ - __pyx_v_f += 1; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(3, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 762; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":149 - * f[0] = 125 #"}" - * f += 1 - * iterator = stack[-1] # <<<<<<<<<<<<<< - * else: - * f[0] = 0 # Terminate string! + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew3"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":764 + * return PyArray_MultiIterNew(3, a, b, c) + * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(4, a, b, c, d) + * */ - __pyx_6 = __Pyx_GetItemInt(((PyObject *)__pyx_v_stack), -1, 0); if (!__pyx_6) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L19_except_error;} - Py_DECREF(__pyx_v_iterator); - __pyx_v_iterator = __pyx_6; - __pyx_6 = 0; - goto __pyx_L23; - } - /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":151 - * iterator = stack[-1] - * else: - * f[0] = 0 # Terminate string! # <<<<<<<<<<<<<< - * return +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew4(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew4"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":765 * + * cdef inline object PyArray_MultiIterNew4(a, b, c, d): + * return PyArray_MultiIterNew(4, a, b, c, d) # <<<<<<<<<<<<<< + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): */ - (__pyx_v_f[0]) = 0; + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(4, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 765; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":152 - * else: - * f[0] = 0 # Terminate string! - * return # <<<<<<<<<<<<<< + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew4"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":767 + * return PyArray_MultiIterNew(4, a, b, c, d) * - * hasfields = PyDataType_HASFIELDS(descr) + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): # <<<<<<<<<<<<<< + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * */ - __pyx_r = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L20_except_return; - } - __pyx_L23:; - Py_DECREF(__pyx_2); __pyx_2 = 0; - Py_DECREF(__pyx_3); __pyx_3 = 0; - Py_DECREF(__pyx_5); __pyx_5 = 0; - goto __pyx_L18_exception_handled; - } - __pyx_L19_except_error:; - Py_XDECREF(__pyx_save_exc_type); - Py_XDECREF(__pyx_save_exc_value); - Py_XDECREF(__pyx_save_exc_tb); - goto __pyx_L1_error; - __pyx_L20_except_return:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - goto __pyx_L0; - __pyx_L18_exception_handled:; - __Pyx_ExceptionReset(__pyx_save_exc_type, __pyx_save_exc_value, __pyx_save_exc_tb); - __pyx_L22_try:; - } + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_PyArray_MultiIterNew5(PyObject *__pyx_v_a, PyObject *__pyx_v_b, PyObject *__pyx_v_c, PyObject *__pyx_v_d, PyObject *__pyx_v_e) { + PyObject *__pyx_r = NULL; + PyObject *__pyx_t_1 = NULL; + __Pyx_RefNannySetupContext("PyArray_MultiIterNew5"); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":768 + * + * cdef inline object PyArray_MultiIterNew5(a, b, c, d, e): + * return PyArray_MultiIterNew(5, a, b, c, d, e) # <<<<<<<<<<<<<< + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: + */ + __Pyx_XDECREF(__pyx_r); + __pyx_t_1 = PyArray_MultiIterNew(5, ((void *)__pyx_v_a), ((void *)__pyx_v_b), ((void *)__pyx_v_c), ((void *)__pyx_v_d), ((void *)__pyx_v_e)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 768; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_r = __pyx_t_1; + __pyx_t_1 = 0; + goto __pyx_L0; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_AddTraceback("numpy.PyArray_MultiIterNew5"); + __pyx_r = 0; + __pyx_L0:; + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":770 + * return PyArray_MultiIterNew(5, a, b, c, d, e) + * + * cdef inline char* _util_dtypestring(dtype descr, char* f, char* end, int* offset) except NULL: # <<<<<<<<<<<<<< + * # Recursive utility function used in __getbuffer__ to get format + * # string. The new location in the format string is returned. + */ + +static CYTHON_INLINE char *__pyx_f_5numpy__util_dtypestring(PyArray_Descr *__pyx_v_descr, char *__pyx_v_f, char *__pyx_v_end, int *__pyx_v_offset) { + PyArray_Descr *__pyx_v_child; + int __pyx_v_endian_detector; + int __pyx_v_little_endian; + PyObject *__pyx_v_fields; + PyObject *__pyx_v_childname; + PyObject *__pyx_v_new_offset; + PyObject *__pyx_v_t; + char *__pyx_r; + Py_ssize_t __pyx_t_1; + PyObject *__pyx_t_2 = NULL; + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + PyObject *__pyx_t_5 = NULL; + int __pyx_t_6; + int __pyx_t_7; + int __pyx_t_8; + int __pyx_t_9; + char *__pyx_t_10; + __Pyx_RefNannySetupContext("_util_dtypestring"); + __Pyx_INCREF((PyObject *)__pyx_v_descr); + __pyx_v_child = ((PyArray_Descr *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_fields = ((PyObject *)Py_None); __Pyx_INCREF(Py_None); + __pyx_v_childname = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_new_offset = Py_None; __Pyx_INCREF(Py_None); + __pyx_v_t = Py_None; __Pyx_INCREF(Py_None); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":777 + * cdef int delta_offset + * cdef tuple i + * cdef int endian_detector = 1 # <<<<<<<<<<<<<< + * cdef bint little_endian = ((&endian_detector)[0] != 0) + * cdef tuple fields + */ + __pyx_v_endian_detector = 1; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":778 + * cdef tuple i + * cdef int endian_detector = 1 + * cdef bint little_endian = ((&endian_detector)[0] != 0) # <<<<<<<<<<<<<< + * cdef tuple fields + * + */ + __pyx_v_little_endian = ((((char *)(&__pyx_v_endian_detector))[0]) != 0); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":781 + * cdef tuple fields + * + * for childname in descr.names: # <<<<<<<<<<<<<< + * fields = descr.fields[childname] + * child, new_offset = fields + */ + if (likely(((PyObject *)__pyx_v_descr->names) != Py_None)) { + __pyx_t_1 = 0; __pyx_t_2 = ((PyObject *)__pyx_v_descr->names); __Pyx_INCREF(__pyx_t_2); + } else { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); {__pyx_filename = __pyx_f[1]; __pyx_lineno = 781; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + for (;;) { + if (__pyx_t_1 >= PyTuple_GET_SIZE(__pyx_t_2)) break; + __pyx_t_3 = PyTuple_GET_ITEM(__pyx_t_2, __pyx_t_1); __Pyx_INCREF(__pyx_t_3); __pyx_t_1++; + __Pyx_DECREF(__pyx_v_childname); + __pyx_v_childname = __pyx_t_3; + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":782 + * + * for childname in descr.names: + * fields = descr.fields[childname] # <<<<<<<<<<<<<< + * child, new_offset = fields + * + */ + __pyx_t_3 = PyObject_GetItem(__pyx_v_descr->fields, __pyx_v_childname); if (!__pyx_t_3) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + if (!(likely(PyTuple_CheckExact(__pyx_t_3))||((__pyx_t_3) == Py_None)||(PyErr_Format(PyExc_TypeError, "Expected tuple, got %.200s", Py_TYPE(__pyx_t_3)->tp_name), 0))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 782; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_v_fields)); + __pyx_v_fields = ((PyObject *)__pyx_t_3); + __pyx_t_3 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":783 + * for childname in descr.names: + * fields = descr.fields[childname] + * child, new_offset = fields # <<<<<<<<<<<<<< + * + * if (end - f) - (new_offset - offset[0]) < 15: + */ + if (likely(((PyObject *)__pyx_v_fields) != Py_None) && likely(PyTuple_GET_SIZE(((PyObject *)__pyx_v_fields)) == 2)) { + PyObject* tuple = ((PyObject *)__pyx_v_fields); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + if (!(likely(((__pyx_t_3) == Py_None) || likely(__Pyx_TypeTest(__pyx_t_3, __pyx_ptype_5numpy_dtype))))) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_4); + __Pyx_DECREF(((PyObject *)__pyx_v_child)); + __pyx_v_child = ((PyArray_Descr *)__pyx_t_3); + __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_v_new_offset); + __pyx_v_new_offset = __pyx_t_4; + __pyx_t_4 = 0; + } else { + __Pyx_UnpackTupleError(((PyObject *)__pyx_v_fields), 2); + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 783; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":785 + * child, new_offset = fields + * + * if (end - f) - (new_offset - offset[0]) < 15: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + */ + __pyx_t_4 = PyInt_FromLong((__pyx_v_end - __pyx_v_f)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyNumber_Subtract(__pyx_v_new_offset, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_5); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyObject_RichCompare(__pyx_t_3, __pyx_int_15, Py_LT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 785; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":786 + * + * if (end - f) - (new_offset - offset[0]) < 15: + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") # <<<<<<<<<<<<<< + * + * if ((child.byteorder == '>' and little_endian) or + */ + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_6)); + PyTuple_SET_ITEM(__pyx_t_5, 0, ((PyObject *)__pyx_kp_u_6)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_6)); + __pyx_t_3 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L5; + } + __pyx_L5:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":788 + * raise RuntimeError(u"Format string allocated too short, see comment in numpy.pxd") + * + * if ((child.byteorder == '>' and little_endian) or # <<<<<<<<<<<<<< + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '>'); + if (__pyx_t_6) { + __pyx_t_7 = __pyx_v_little_endian; + } else { + __pyx_t_7 = __pyx_t_6; + } + if (!__pyx_t_7) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":789 + * + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): # <<<<<<<<<<<<<< + * raise ValueError(u"Non-native byte order not supported") + * # One could encode it in the format string and have Cython + */ + __pyx_t_6 = (__pyx_v_child->byteorder == '<'); + if (__pyx_t_6) { + __pyx_t_8 = (!__pyx_v_little_endian); + __pyx_t_9 = __pyx_t_8; + } else { + __pyx_t_9 = __pyx_t_6; } + __pyx_t_6 = __pyx_t_9; + } else { + __pyx_t_6 = __pyx_t_7; + } + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":154 - * return + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":790 + * if ((child.byteorder == '>' and little_endian) or + * (child.byteorder == '<' and not little_endian)): + * raise ValueError(u"Non-native byte order not supported") # <<<<<<<<<<<<<< + * # One could encode it in the format string and have Cython + * # complain instead, BUT: < and > in format strings also imply + */ + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_4)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_4)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_4)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 790; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L6; + } + __pyx_L6:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":800 * - * hasfields = PyDataType_HASFIELDS(descr) # <<<<<<<<<<<<<< - * if not hasfields: - * t = descr.type_num + * # Output padding bytes + * while offset[0] < new_offset: # <<<<<<<<<<<<<< + * f[0] = 120 # "x"; pad byte + * f += 1 */ - __pyx_v_hasfields = PyDataType_HASFIELDS(__pyx_v_descr); + while (1) { + __pyx_t_5 = PyInt_FromLong((__pyx_v_offset[0])); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_v_new_offset, Py_LT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 800; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (!__pyx_t_6) break; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":155 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":801 + * # Output padding bytes + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte # <<<<<<<<<<<<<< + * f += 1 + * offset[0] += 1 + */ + (__pyx_v_f[0]) = 120; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":802 + * while offset[0] < new_offset: + * f[0] = 120 # "x"; pad byte + * f += 1 # <<<<<<<<<<<<<< + * offset[0] += 1 * - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: # <<<<<<<<<<<<<< - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well */ - __pyx_1 = (!__pyx_v_hasfields); - if (__pyx_1) { + __pyx_v_f += 1; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":156 - * hasfields = PyDataType_HASFIELDS(descr) - * if not hasfields: - * t = descr.type_num # <<<<<<<<<<<<<< - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":803 + * f[0] = 120 # "x"; pad byte + * f += 1 + * offset[0] += 1 # <<<<<<<<<<<<<< + * + * offset[0] += child.itemsize */ - __pyx_v_t = __pyx_v_descr->type_num; + (__pyx_v_offset[0]) += 1; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":157 - * if not hasfields: - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well # <<<<<<<<<<<<<< - * raise RuntimeError("Format string allocated too short.") + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":805 + * offset[0] += 1 * + * offset[0] += child.itemsize # <<<<<<<<<<<<<< + * + * if not PyDataType_HASFIELDS(child): */ - __pyx_1 = ((__pyx_v_f - __pyx_v_info->format) > 240); - if (__pyx_1) { + (__pyx_v_offset[0]) += __pyx_v_child->elsize; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":158 - * t = descr.type_num - * if f - info.format > 240: # this should leave room for "T{" and "}" as well - * raise RuntimeError("Format string allocated too short.") # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":807 + * offset[0] += child.itemsize * - * # Until ticket #99 is fixed, use integers to avoid warnings + * if not PyDataType_HASFIELDS(child): # <<<<<<<<<<<<<< + * t = child.type_num + * if end - f < 5: */ - __pyx_7 = PyTuple_New(1); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_21); - PyTuple_SET_ITEM(__pyx_7, 0, __pyx_kp_21); - __pyx_6 = PyObject_Call(__pyx_builtin_RuntimeError, ((PyObject *)__pyx_7), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_7)); __pyx_7 = 0; - __Pyx_Raise(__pyx_6, 0, 0); - Py_DECREF(__pyx_6); __pyx_6 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - goto __pyx_L25; - } - __pyx_L25:; + __pyx_t_6 = (!PyDataType_HASFIELDS(__pyx_v_child)); + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":161 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":808 * - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" + * if not PyDataType_HASFIELDS(child): + * t = child.type_num # <<<<<<<<<<<<<< + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") */ - switch (__pyx_v_t) { - case NPY_BYTE: - (__pyx_v_f[0]) = 98; - break; - case NPY_UBYTE: + __pyx_t_3 = PyInt_FromLong(__pyx_v_child->type_num); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 808; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_v_t); + __pyx_v_t = __pyx_t_3; + __pyx_t_3 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":162 - * # Until ticket #99 is fixed, use integers to avoid warnings - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":809 + * if not PyDataType_HASFIELDS(child): + * t = child.type_num + * if end - f < 5: # <<<<<<<<<<<<<< + * raise RuntimeError(u"Format string allocated too short.") + * */ - (__pyx_v_f[0]) = 66; - break; - case NPY_SHORT: + __pyx_t_6 = ((__pyx_v_end - __pyx_v_f) < 5); + if (__pyx_t_6) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":163 - * if t == NPY_BYTE: f[0] = 98 #"b" - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":810 + * t = child.type_num + * if end - f < 5: + * raise RuntimeError(u"Format string allocated too short.") # <<<<<<<<<<<<<< + * + * # Until ticket #99 is fixed, use integers to avoid warnings */ - (__pyx_v_f[0]) = 104; - break; - case NPY_USHORT: + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_u_7)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_u_7)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_u_7)); + __pyx_t_5 = PyObject_Call(__pyx_builtin_RuntimeError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_5, 0, 0); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 810; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + goto __pyx_L10; + } + __pyx_L10:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":164 - * elif t == NPY_UBYTE: f[0] = 66 #"B" - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":813 + * + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" # <<<<<<<<<<<<<< + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" */ - (__pyx_v_f[0]) = 72; - break; - case NPY_INT: + __pyx_t_5 = PyInt_FromLong(NPY_BYTE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 813; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 98; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":165 - * elif t == NPY_SHORT: f[0] = 104 #"h" - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":814 + * # Until ticket #99 is fixed, use integers to avoid warnings + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" # <<<<<<<<<<<<<< + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" */ - (__pyx_v_f[0]) = 105; - break; - case NPY_UINT: + __pyx_t_3 = PyInt_FromLong(NPY_UBYTE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 814; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 66; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":166 - * elif t == NPY_USHORT: f[0] = 72 #"H" - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":815 + * if t == NPY_BYTE: f[0] = 98 #"b" + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" # <<<<<<<<<<<<<< + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" */ - (__pyx_v_f[0]) = 73; - break; - case NPY_LONG: + __pyx_t_5 = PyInt_FromLong(NPY_SHORT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 815; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 104; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":167 - * elif t == NPY_INT: f[0] = 105 #"i" - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":816 + * elif t == NPY_UBYTE: f[0] = 66 #"B" + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" # <<<<<<<<<<<<<< + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" */ - (__pyx_v_f[0]) = 108; - break; - case NPY_ULONG: + __pyx_t_3 = PyInt_FromLong(NPY_USHORT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 816; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 72; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":168 - * elif t == NPY_UINT: f[0] = 73 #"I" - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":817 + * elif t == NPY_SHORT: f[0] = 104 #"h" + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" # <<<<<<<<<<<<<< + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" */ - (__pyx_v_f[0]) = 76; - break; - case NPY_LONGLONG: + __pyx_t_5 = PyInt_FromLong(NPY_INT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 817; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 105; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":169 - * elif t == NPY_LONG: f[0] = 108 #"l" - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":818 + * elif t == NPY_USHORT: f[0] = 72 #"H" + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" # <<<<<<<<<<<<<< + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" */ - (__pyx_v_f[0]) = 113; - break; - case NPY_ULONGLONG: + __pyx_t_3 = PyInt_FromLong(NPY_UINT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 818; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 73; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":170 - * elif t == NPY_ULONG: f[0] = 76 #"L" - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":819 + * elif t == NPY_INT: f[0] = 105 #"i" + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" # <<<<<<<<<<<<<< + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" */ - (__pyx_v_f[0]) = 81; - break; - case NPY_FLOAT: + __pyx_t_5 = PyInt_FromLong(NPY_LONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 819; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 108; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":171 - * elif t == NPY_LONGLONG: f[0] = 113 #"q" - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":820 + * elif t == NPY_UINT: f[0] = 73 #"I" + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" # <<<<<<<<<<<<<< + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" */ - (__pyx_v_f[0]) = 102; - break; - case NPY_DOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_ULONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 820; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 76; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":172 - * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":821 + * elif t == NPY_LONG: f[0] = 108 #"l" + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" # <<<<<<<<<<<<<< + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" */ - (__pyx_v_f[0]) = 100; - break; - case NPY_LONGDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_LONGLONG); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 821; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 113; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":173 - * elif t == NPY_FLOAT: f[0] = 102 #"f" - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":822 + * elif t == NPY_ULONG: f[0] = 76 #"L" + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" # <<<<<<<<<<<<<< + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" */ - (__pyx_v_f[0]) = 103; - break; - case NPY_CFLOAT: + __pyx_t_3 = PyInt_FromLong(NPY_ULONGLONG); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 822; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 81; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":174 - * elif t == NPY_DOUBLE: f[0] = 100 #"d" - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":823 + * elif t == NPY_LONGLONG: f[0] = 113 #"q" + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" # <<<<<<<<<<<<<< + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 102; - __pyx_v_f += 1; - break; - case NPY_CDOUBLE: + __pyx_t_5 = PyInt_FromLong(NPY_FLOAT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 823; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 102; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":175 - * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":824 + * elif t == NPY_ULONGLONG: f[0] = 81 #"Q" + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" # <<<<<<<<<<<<<< + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 100; - __pyx_v_f += 1; - break; - case NPY_CLONGDOUBLE: + __pyx_t_3 = PyInt_FromLong(NPY_DOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 824; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 100; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":176 - * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # <<<<<<<<<<<<<< - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":825 + * elif t == NPY_FLOAT: f[0] = 102 #"f" + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" # <<<<<<<<<<<<<< + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd */ - (__pyx_v_f[0]) = 90; - (__pyx_v_f[1]) = 103; - __pyx_v_f += 1; - break; - case NPY_OBJECT: + __pyx_t_5 = PyInt_FromLong(NPY_LONGDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 825; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 103; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":177 - * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 - * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 - * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":826 + * elif t == NPY_DOUBLE: f[0] = 100 #"d" + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf # <<<<<<<<<<<<<< + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg */ - (__pyx_v_f[0]) = 79; - break; - default: + __pyx_t_3 = PyInt_FromLong(NPY_CFLOAT); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 826; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 102; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":179 - * elif t == NPY_OBJECT: f[0] = 79 #"O" - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< - * f += 1 - * else: + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":827 + * elif t == NPY_LONGDOUBLE: f[0] = 103 #"g" + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd # <<<<<<<<<<<<<< + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" */ - __pyx_2 = PyInt_FromLong(__pyx_v_t); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyNumber_Remainder(__pyx_kp_22, __pyx_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_3 = PyTuple_New(1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - PyTuple_SET_ITEM(__pyx_3, 0, __pyx_t_1); - __pyx_t_1 = 0; - __pyx_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_3), NULL); if (unlikely(!__pyx_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_3)); __pyx_3 = 0; - __Pyx_Raise(__pyx_5, 0, 0); - Py_DECREF(__pyx_5); __pyx_5 = 0; - {__pyx_filename = __pyx_f[1]; __pyx_lineno = 179; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - break; - } + __pyx_t_5 = PyInt_FromLong(NPY_CDOUBLE); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 827; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 100; + __pyx_v_f += 1; + goto __pyx_L11; + } - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":180 - * else: - * raise ValueError("unknown dtype code in numpy.pxd (%d)" % t) - * f += 1 # <<<<<<<<<<<<<< - * else: - * f[0] = 84 #"T" + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":828 + * elif t == NPY_CFLOAT: f[0] = 90; f[1] = 102; f += 1 # Zf + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg # <<<<<<<<<<<<<< + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: */ + __pyx_t_3 = PyInt_FromLong(NPY_CLONGDOUBLE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyObject_RichCompare(__pyx_v_t, __pyx_t_3, Py_EQ); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_5); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 828; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 90; + (__pyx_v_f[1]) = 103; __pyx_v_f += 1; - goto __pyx_L24; + goto __pyx_L11; } - /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":182 - * f += 1 - * else: - * f[0] = 84 #"T" # <<<<<<<<<<<<<< - * f[1] = 123 #"{" - * f += 2 + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":829 + * elif t == NPY_CDOUBLE: f[0] = 90; f[1] = 100; f += 1 # Zd + * elif t == NPY_CLONGDOUBLE: f[0] = 90; f[1] = 103; f += 1 # Zg + * elif t == NPY_OBJECT: f[0] = 79 #"O" # <<<<<<<<<<<<<< + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) */ - (__pyx_v_f[0]) = 84; + __pyx_t_5 = PyInt_FromLong(NPY_OBJECT); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_3 = PyObject_RichCompare(__pyx_v_t, __pyx_t_5, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_6 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_6 < 0)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 829; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + if (__pyx_t_6) { + (__pyx_v_f[0]) = 79; + goto __pyx_L11; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":183 - * else: - * f[0] = 84 #"T" - * f[1] = 123 #"{" # <<<<<<<<<<<<<< - * f += 2 - * stack.append(iter(descr.fields.iteritems())) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":831 + * elif t == NPY_OBJECT: f[0] = 79 #"O" + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) # <<<<<<<<<<<<<< + * f += 1 + * else: */ - (__pyx_v_f[1]) = 123; + __pyx_t_3 = PyNumber_Remainder(((PyObject *)__pyx_kp_u_5), __pyx_v_t); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_5, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_Raise(__pyx_t_3, 0, 0); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + {__pyx_filename = __pyx_f[1]; __pyx_lineno = 831; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + } + __pyx_L11:; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":184 - * f[0] = 84 #"T" - * f[1] = 123 #"{" - * f += 2 # <<<<<<<<<<<<<< - * stack.append(iter(descr.fields.iteritems())) - * + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":832 + * else: + * raise ValueError(u"unknown dtype code in numpy.pxd (%d)" % t) + * f += 1 # <<<<<<<<<<<<<< + * else: + * # Cython ignores struct boundary information ("T{...}"), */ - __pyx_v_f += 2; + __pyx_v_f += 1; + goto __pyx_L9; + } + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":185 - * f[1] = 123 #"{" - * f += 2 - * stack.append(iter(descr.fields.iteritems())) # <<<<<<<<<<<<<< + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":836 + * # Cython ignores struct boundary information ("T{...}"), + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) # <<<<<<<<<<<<<< + * return f * - * def __releasebuffer__(ndarray self, Py_buffer* info): */ - __pyx_7 = PyObject_GetAttr(__pyx_v_descr->fields, __pyx_kp_iteritems); if (unlikely(!__pyx_7)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_6 = PyObject_Call(__pyx_7, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_6)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_7); __pyx_7 = 0; - __pyx_2 = PyObject_GetIter(__pyx_6); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_6); __pyx_6 = 0; - __pyx_4 = PyList_Append(((PyObject *)__pyx_v_stack), __pyx_2); if (unlikely(__pyx_4 == -1)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; - } - __pyx_L24:; + __pyx_t_10 = __pyx_f_5numpy__util_dtypestring(__pyx_v_child, __pyx_v_f, __pyx_v_end, __pyx_v_offset); if (unlikely(__pyx_t_10 == NULL)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 836; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_v_f = __pyx_t_10; } + __pyx_L9:; } - __pyx_L12:; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":837 + * # so don't output it + * f = _util_dtypestring(child, f, end, offset) + * return f # <<<<<<<<<<<<<< + * + * + */ + __pyx_r = __pyx_v_f; + goto __pyx_L0; + __pyx_r = 0; goto __pyx_L0; __pyx_L1_error:; - Py_XDECREF(__pyx_2); - Py_XDECREF(__pyx_3); - Py_XDECREF(__pyx_5); - Py_XDECREF(__pyx_6); - Py_XDECREF(__pyx_7); - __Pyx_AddTraceback("numpy.ndarray.__getbuffer__"); - __pyx_r = -1; - Py_DECREF(__pyx_v_info->obj); __pyx_v_info->obj = NULL; - goto __pyx_L2; + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); + __Pyx_XDECREF(__pyx_t_5); + __Pyx_AddTraceback("numpy._util_dtypestring"); + __pyx_r = NULL; __pyx_L0:; - if (__pyx_v_info->obj == Py_None) { Py_DECREF(Py_None); __pyx_v_info->obj = NULL; } - __pyx_L2:; - Py_XDECREF(__pyx_v_descr); - Py_DECREF(__pyx_v_stack); - Py_DECREF(__pyx_v_iterator); + __Pyx_DECREF((PyObject *)__pyx_v_child); + __Pyx_DECREF(__pyx_v_fields); + __Pyx_DECREF(__pyx_v_childname); + __Pyx_DECREF(__pyx_v_new_offset); + __Pyx_DECREF(__pyx_v_t); + __Pyx_DECREF((PyObject *)__pyx_v_descr); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":187 - * stack.append(iter(descr.fields.iteritems())) +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":952 * - * def __releasebuffer__(ndarray self, Py_buffer* info): # <<<<<<<<<<<<<< - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) + * + * cdef inline void set_array_base(ndarray arr, object base): # <<<<<<<<<<<<<< + * cdef PyObject* baseptr + * if base is None: */ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info); /*proto*/ -static void __pyx_pf_5numpy_7ndarray___releasebuffer__(PyObject *__pyx_v_self, Py_buffer *__pyx_v_info) { - int __pyx_1; - int __pyx_2; +static CYTHON_INLINE void __pyx_f_5numpy_set_array_base(PyArrayObject *__pyx_v_arr, PyObject *__pyx_v_base) { + PyObject *__pyx_v_baseptr; + int __pyx_t_1; + __Pyx_RefNannySetupContext("set_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + __Pyx_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":188 - * - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): # <<<<<<<<<<<<<< - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":954 + * cdef inline void set_array_base(ndarray arr, object base): + * cdef PyObject* baseptr + * if base is None: # <<<<<<<<<<<<<< + * baseptr = NULL + * else: */ - __pyx_1 = PyArray_HASFIELDS(((PyArrayObject *)__pyx_v_self)); - if (__pyx_1) { + __pyx_t_1 = (__pyx_v_base == Py_None); + if (__pyx_t_1) { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":189 - * def __releasebuffer__(ndarray self, Py_buffer* info): - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) # <<<<<<<<<<<<<< - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":955 + * cdef PyObject* baseptr + * if base is None: + * baseptr = NULL # <<<<<<<<<<<<<< + * else: + * Py_INCREF(base) # important to do this before decref below! */ - free(__pyx_v_info->format); - goto __pyx_L5; + __pyx_v_baseptr = NULL; + goto __pyx_L3; } - __pyx_L5:; + /*else*/ { - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":190 - * if PyArray_HASFIELDS(self): - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): # <<<<<<<<<<<<<< - * stdlib.free(info.strides) - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":957 + * baseptr = NULL + * else: + * Py_INCREF(base) # important to do this before decref below! # <<<<<<<<<<<<<< + * baseptr = base + * Py_XDECREF(arr.base) */ - __pyx_2 = ((sizeof(npy_intp)) != (sizeof(Py_ssize_t))); - if (__pyx_2) { + Py_INCREF(__pyx_v_base); - /* "/usr/lib/pymodules/python2.6/Cython/Includes/numpy.pxd":191 - * stdlib.free(info.format) - * if sizeof(npy_intp) != sizeof(Py_ssize_t): - * stdlib.free(info.strides) # <<<<<<<<<<<<<< - * # info.shape was stored after info.strides in the same block + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":958 + * else: + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base # <<<<<<<<<<<<<< + * Py_XDECREF(arr.base) + * arr.base = baseptr + */ + __pyx_v_baseptr = ((PyObject *)__pyx_v_base); + } + __pyx_L3:; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":959 + * Py_INCREF(base) # important to do this before decref below! + * baseptr = base + * Py_XDECREF(arr.base) # <<<<<<<<<<<<<< + * arr.base = baseptr * */ - free(__pyx_v_info->strides); - goto __pyx_L6; + Py_XDECREF(__pyx_v_arr->base); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":960 + * baseptr = base + * Py_XDECREF(arr.base) + * arr.base = baseptr # <<<<<<<<<<<<<< + * + * cdef inline object get_array_base(ndarray arr): + */ + __pyx_v_arr->base = __pyx_v_baseptr; + + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_DECREF(__pyx_v_base); + __Pyx_RefNannyFinishContext(); +} + +/* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":962 + * arr.base = baseptr + * + * cdef inline object get_array_base(ndarray arr): # <<<<<<<<<<<<<< + * if arr.base is NULL: + * return None + */ + +static CYTHON_INLINE PyObject *__pyx_f_5numpy_get_array_base(PyArrayObject *__pyx_v_arr) { + PyObject *__pyx_r = NULL; + int __pyx_t_1; + __Pyx_RefNannySetupContext("get_array_base"); + __Pyx_INCREF((PyObject *)__pyx_v_arr); + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":963 + * + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: # <<<<<<<<<<<<<< + * return None + * else: + */ + __pyx_t_1 = (__pyx_v_arr->base == NULL); + if (__pyx_t_1) { + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":964 + * cdef inline object get_array_base(ndarray arr): + * if arr.base is NULL: + * return None # <<<<<<<<<<<<<< + * else: + * return arr.base + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(Py_None); + __pyx_r = Py_None; + goto __pyx_L0; + goto __pyx_L3; } - __pyx_L6:; + /*else*/ { + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/numpy.pxd":966 + * return None + * else: + * return arr.base # <<<<<<<<<<<<<< + */ + __Pyx_XDECREF(__pyx_r); + __Pyx_INCREF(((PyObject *)__pyx_v_arr->base)); + __pyx_r = ((PyObject *)__pyx_v_arr->base); + goto __pyx_L0; + } + __pyx_L3:; + + __pyx_r = Py_None; __Pyx_INCREF(Py_None); + __pyx_L0:; + __Pyx_DECREF((PyObject *)__pyx_v_arr); + __Pyx_XGIVEREF(__pyx_r); + __Pyx_RefNannyFinishContext(); + return __pyx_r; } static struct PyMethodDef __pyx_methods[] = { - {"von_mises_cdf_normalapprox", (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf_normalapprox, METH_VARARGS|METH_KEYWORDS, 0}, - {"von_mises_cdf", (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf, METH_VARARGS|METH_KEYWORDS, 0}, + {__Pyx_NAMESTR("von_mises_cdf_normalapprox"), (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf_normalapprox, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, + {__Pyx_NAMESTR("von_mises_cdf"), (PyCFunction)__pyx_pf_5scipy_5stats_15vonmises_cython_von_mises_cdf, METH_VARARGS|METH_KEYWORDS, __Pyx_DOCSTR(0)}, {0, 0, 0, 0} }; @@ -2819,7 +4165,7 @@ #if PY_MAJOR_VERSION >= 3 static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, - "vonmises_cython", + __Pyx_NAMESTR("vonmises_cython"), 0, /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, @@ -2831,68 +4177,79 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, - {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, - {&__pyx_kp_23, __pyx_k_23, sizeof(__pyx_k_23), 1, 1, 1}, - {&__pyx_kp_numpy, __pyx_k_numpy, sizeof(__pyx_k_numpy), 1, 1, 1}, - {&__pyx_kp_np, __pyx_k_np, sizeof(__pyx_k_np), 0, 1, 1}, - {&__pyx_kp_24, __pyx_k_24, sizeof(__pyx_k_24), 1, 1, 1}, - {&__pyx_kp_scipy, __pyx_k_scipy, sizeof(__pyx_k_scipy), 0, 1, 1}, - {&__pyx_kp_25, __pyx_k_25, sizeof(__pyx_k_25), 1, 1, 1}, - {&__pyx_kp_i0, __pyx_k_i0, sizeof(__pyx_k_i0), 1, 1, 1}, - {&__pyx_kp_26, __pyx_k_26, sizeof(__pyx_k_26), 1, 1, 1}, - {&__pyx_kp_pi, __pyx_k_pi, sizeof(__pyx_k_pi), 1, 1, 1}, - {&__pyx_kp_sqrt, __pyx_k_sqrt, sizeof(__pyx_k_sqrt), 1, 1, 1}, - {&__pyx_kp_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 1, 1, 1}, - {&__pyx_kp_sin, __pyx_k_sin, sizeof(__pyx_k_sin), 1, 1, 1}, - {&__pyx_kp_stats, __pyx_k_stats, sizeof(__pyx_k_stats), 1, 1, 1}, - {&__pyx_kp_norm, __pyx_k_norm, sizeof(__pyx_k_norm), 1, 1, 1}, - {&__pyx_kp_cdf, __pyx_k_cdf, sizeof(__pyx_k_cdf), 1, 1, 1}, - {&__pyx_kp_asarray, __pyx_k_asarray, sizeof(__pyx_k_asarray), 1, 1, 1}, - {&__pyx_kp_ndim, __pyx_k_ndim, sizeof(__pyx_k_ndim), 1, 1, 1}, - {&__pyx_kp_27, __pyx_k_27, sizeof(__pyx_k_27), 1, 1, 1}, - {&__pyx_kp_round, __pyx_k_round, sizeof(__pyx_k_round), 1, 1, 1}, - {&__pyx_kp_broadcast_arrays, __pyx_k_broadcast_arrays, sizeof(__pyx_k_broadcast_arrays), 1, 1, 1}, - {&__pyx_kp_empty, __pyx_k_empty, sizeof(__pyx_k_empty), 1, 1, 1}, - {&__pyx_kp_shape, __pyx_k_shape, sizeof(__pyx_k_shape), 1, 1, 1}, - {&__pyx_kp_dtype, __pyx_k_dtype, sizeof(__pyx_k_dtype), 1, 1, 1}, - {&__pyx_kp_float, __pyx_k_float, sizeof(__pyx_k_float), 1, 1, 1}, - {&__pyx_kp_astype, __pyx_k_astype, sizeof(__pyx_k_astype), 1, 1, 1}, - {&__pyx_kp_28, __pyx_k_28, sizeof(__pyx_k_28), 1, 1, 1}, - {&__pyx_kp___getbuffer__, __pyx_k___getbuffer__, sizeof(__pyx_k___getbuffer__), 1, 1, 1}, - {&__pyx_kp___releasebuffer__, __pyx_k___releasebuffer__, sizeof(__pyx_k___releasebuffer__), 1, 1, 1}, - {&__pyx_kp_info, __pyx_k_info, sizeof(__pyx_k_info), 1, 1, 1}, - {&__pyx_kp_flags, __pyx_k_flags, sizeof(__pyx_k_flags), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_iteritems, __pyx_k_iteritems, sizeof(__pyx_k_iteritems), 1, 1, 1}, - {&__pyx_kp_next, __pyx_k_next, sizeof(__pyx_k_next), 1, 1, 1}, - {&__pyx_kp_StopIteration, __pyx_k_StopIteration, sizeof(__pyx_k_StopIteration), 1, 1, 1}, - {&__pyx_kp_pop, __pyx_k_pop, sizeof(__pyx_k_pop), 1, 1, 1}, - {&__pyx_kp_RuntimeError, __pyx_k_RuntimeError, sizeof(__pyx_k_RuntimeError), 1, 1, 1}, - {&__pyx_kp_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 0}, - {&__pyx_kp_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 0, 0}, - {&__pyx_kp_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 0, 0}, - {&__pyx_kp_21, __pyx_k_21, sizeof(__pyx_k_21), 0, 0, 0}, - {&__pyx_kp_22, __pyx_k_22, sizeof(__pyx_k_22), 0, 0, 0}, - {0, 0, 0, 0, 0, 0} + {&__pyx_n_s_1, __pyx_k_1, sizeof(__pyx_k_1), 0, 0, 1, 1}, + {&__pyx_n_s_10, __pyx_k_10, sizeof(__pyx_k_10), 0, 0, 1, 1}, + {&__pyx_kp_u_2, __pyx_k_2, sizeof(__pyx_k_2), 0, 1, 0, 0}, + {&__pyx_kp_u_3, __pyx_k_3, sizeof(__pyx_k_3), 0, 1, 0, 0}, + {&__pyx_kp_u_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 1, 0, 0}, + {&__pyx_kp_u_5, __pyx_k_5, sizeof(__pyx_k_5), 0, 1, 0, 0}, + {&__pyx_kp_u_6, __pyx_k_6, sizeof(__pyx_k_6), 0, 1, 0, 0}, + {&__pyx_kp_u_7, __pyx_k_7, sizeof(__pyx_k_7), 0, 1, 0, 0}, + {&__pyx_n_s_8, __pyx_k_8, sizeof(__pyx_k_8), 0, 0, 1, 1}, + {&__pyx_n_s_9, __pyx_k_9, sizeof(__pyx_k_9), 0, 0, 1, 1}, + {&__pyx_n_s__C1, __pyx_k__C1, sizeof(__pyx_k__C1), 0, 0, 1, 1}, + {&__pyx_n_s__RuntimeError, __pyx_k__RuntimeError, sizeof(__pyx_k__RuntimeError), 0, 0, 1, 1}, + {&__pyx_n_s__ValueError, __pyx_k__ValueError, sizeof(__pyx_k__ValueError), 0, 0, 1, 1}, + {&__pyx_n_s____main__, __pyx_k____main__, sizeof(__pyx_k____main__), 0, 0, 1, 1}, + {&__pyx_n_s____test__, __pyx_k____test__, sizeof(__pyx_k____test__), 0, 0, 1, 1}, + {&__pyx_n_s__asarray, __pyx_k__asarray, sizeof(__pyx_k__asarray), 0, 0, 1, 1}, + {&__pyx_n_s__astype, __pyx_k__astype, sizeof(__pyx_k__astype), 0, 0, 1, 1}, + {&__pyx_n_s__atleast_1d, __pyx_k__atleast_1d, sizeof(__pyx_k__atleast_1d), 0, 0, 1, 1}, + {&__pyx_n_s__base, __pyx_k__base, sizeof(__pyx_k__base), 0, 0, 1, 1}, + {&__pyx_n_s__broadcast_arrays, __pyx_k__broadcast_arrays, sizeof(__pyx_k__broadcast_arrays), 0, 0, 1, 1}, + {&__pyx_n_s__buf, __pyx_k__buf, sizeof(__pyx_k__buf), 0, 0, 1, 1}, + {&__pyx_n_s__byteorder, __pyx_k__byteorder, sizeof(__pyx_k__byteorder), 0, 0, 1, 1}, + {&__pyx_n_s__cdf, __pyx_k__cdf, sizeof(__pyx_k__cdf), 0, 0, 1, 1}, + {&__pyx_n_s__descr, __pyx_k__descr, sizeof(__pyx_k__descr), 0, 0, 1, 1}, + {&__pyx_n_s__dtype, __pyx_k__dtype, sizeof(__pyx_k__dtype), 0, 0, 1, 1}, + {&__pyx_n_s__empty, __pyx_k__empty, sizeof(__pyx_k__empty), 0, 0, 1, 1}, + {&__pyx_n_s__exp, __pyx_k__exp, sizeof(__pyx_k__exp), 0, 0, 1, 1}, + {&__pyx_n_s__fields, __pyx_k__fields, sizeof(__pyx_k__fields), 0, 0, 1, 1}, + {&__pyx_n_s__float, __pyx_k__float, sizeof(__pyx_k__float), 0, 0, 1, 1}, + {&__pyx_n_s__format, __pyx_k__format, sizeof(__pyx_k__format), 0, 0, 1, 1}, + {&__pyx_n_s__i0, __pyx_k__i0, sizeof(__pyx_k__i0), 0, 0, 1, 1}, + {&__pyx_n_s__itemsize, __pyx_k__itemsize, sizeof(__pyx_k__itemsize), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__names, __pyx_k__names, sizeof(__pyx_k__names), 0, 0, 1, 1}, + {&__pyx_n_s__ndim, __pyx_k__ndim, sizeof(__pyx_k__ndim), 0, 0, 1, 1}, + {&__pyx_n_s__norm, __pyx_k__norm, sizeof(__pyx_k__norm), 0, 0, 1, 1}, + {&__pyx_n_s__np, __pyx_k__np, sizeof(__pyx_k__np), 0, 0, 1, 1}, + {&__pyx_n_s__numpy, __pyx_k__numpy, sizeof(__pyx_k__numpy), 0, 0, 1, 1}, + {&__pyx_n_s__obj, __pyx_k__obj, sizeof(__pyx_k__obj), 0, 0, 1, 1}, + {&__pyx_n_s__pi, __pyx_k__pi, sizeof(__pyx_k__pi), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__readonly, __pyx_k__readonly, sizeof(__pyx_k__readonly), 0, 0, 1, 1}, + {&__pyx_n_s__round, __pyx_k__round, sizeof(__pyx_k__round), 0, 0, 1, 1}, + {&__pyx_n_s__scipy, __pyx_k__scipy, sizeof(__pyx_k__scipy), 0, 0, 1, 1}, + {&__pyx_n_s__shape, __pyx_k__shape, sizeof(__pyx_k__shape), 0, 0, 1, 1}, + {&__pyx_n_s__sin, __pyx_k__sin, sizeof(__pyx_k__sin), 0, 0, 1, 1}, + {&__pyx_n_s__sqrt, __pyx_k__sqrt, sizeof(__pyx_k__sqrt), 0, 0, 1, 1}, + {&__pyx_n_s__stats, __pyx_k__stats, sizeof(__pyx_k__stats), 0, 0, 1, 1}, + {&__pyx_n_s__strides, __pyx_k__strides, sizeof(__pyx_k__strides), 0, 0, 1, 1}, + {&__pyx_n_s__suboffsets, __pyx_k__suboffsets, sizeof(__pyx_k__suboffsets), 0, 0, 1, 1}, + {&__pyx_n_s__type_num, __pyx_k__type_num, sizeof(__pyx_k__type_num), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 65; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_StopIteration = __Pyx_GetName(__pyx_b, __pyx_kp_StopIteration); if (!__pyx_builtin_StopIteration) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 144; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_kp_RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_n_s__range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 21; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_n_s__ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 205; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_builtin_RuntimeError = __Pyx_GetName(__pyx_b, __pyx_n_s__RuntimeError); if (!__pyx_builtin_RuntimeError) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 786; __pyx_clineno = __LINE__; goto __pyx_L1_error;} return 0; __pyx_L1_error:; return -1; } static int __Pyx_InitGlobals(void) { + if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_3 = PyInt_FromLong(3); if (unlikely(!__pyx_int_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_neg_1 = PyInt_FromLong(-1); if (unlikely(!__pyx_int_neg_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_15 = PyInt_FromLong(15); if (unlikely(!__pyx_int_15)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_16 = PyInt_FromLong(16); if (unlikely(!__pyx_int_16)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_4 = PyInt_FromLong(4); if (unlikely(!__pyx_int_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - __pyx_int_0 = PyInt_FromLong(0); if (unlikely(!__pyx_int_0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (__Pyx_InitStrings(__pyx_string_tab) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + __pyx_int_24 = PyInt_FromLong(24); if (unlikely(!__pyx_int_24)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; return 0; __pyx_L1_error:; return -1; @@ -2906,16 +4263,36 @@ PyMODINIT_FUNC PyInit_vonmises_cython(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; + PyObject *__pyx_t_1 = NULL; + PyObject *__pyx_t_2 = NULL; + #if CYTHON_REFNANNY + void* __pyx_refnanny = NULL; + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("refnanny"); + if (!__Pyx_RefNanny) { + PyErr_Clear(); + __Pyx_RefNanny = __Pyx_RefNannyImportAPI("Cython.Runtime.refnanny"); + if (!__Pyx_RefNanny) + Py_FatalError("failed to import 'refnanny' module"); + } + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_vonmises_cython(void)", __LINE__, __FILE__); + #endif + __pyx_init_filenames(); __pyx_empty_tuple = PyTuple_New(0); if (unlikely(!__pyx_empty_tuple)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #if PY_MAJOR_VERSION < 3 + __pyx_empty_bytes = PyString_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #else + __pyx_empty_bytes = PyBytes_FromStringAndSize("", 0); if (unlikely(!__pyx_empty_bytes)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + #endif /*--- Library function declarations ---*/ - __pyx_init_filenames(); - /*--- Initialize various global constants etc. ---*/ - if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + /*--- Threads initialization code ---*/ + #if defined(__PYX_FORCE_INIT_THREADS) && __PYX_FORCE_INIT_THREADS + #ifdef WITH_THREAD /* Python build with threading support? */ + PyEval_InitThreads(); + #endif + #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4("vonmises_cython", __pyx_methods, 0, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("vonmises_cython"), __pyx_methods, 0, 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -2923,86 +4300,115 @@ #if PY_MAJOR_VERSION < 3 Py_INCREF(__pyx_m); #endif - __pyx_b = PyImport_AddModule(__Pyx_BUILTIN_MODULE_NAME); + __pyx_b = PyImport_AddModule(__Pyx_NAMESTR(__Pyx_BUILTIN_MODULE_NAME)); if (!__pyx_b) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; - if (PyObject_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + if (__Pyx_SetAttrString(__pyx_m, "__builtins__", __pyx_b) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + /*--- Initialize various global constants etc. ---*/ + if (unlikely(__Pyx_InitGlobals() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (__pyx_module_is_main_scipy__stats__vonmises_cython) { + if (__Pyx_SetAttrString(__pyx_m, "__name__", __pyx_n_s____main__) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; + } /*--- Builtin init code ---*/ if (unlikely(__Pyx_InitCachedBuiltins() < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_skip_dispatch = 0; /*--- Global init code ---*/ /*--- Function export code ---*/ /*--- Type init code ---*/ /*--- Type import code ---*/ - __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr)); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 30; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject)); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 36; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_dtype = __Pyx_ImportType("numpy", "dtype", sizeof(PyArray_Descr), 0); if (unlikely(!__pyx_ptype_5numpy_dtype)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 148; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_flatiter = __Pyx_ImportType("numpy", "flatiter", sizeof(PyArrayIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_flatiter)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 158; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_broadcast = __Pyx_ImportType("numpy", "broadcast", sizeof(PyArrayMultiIterObject), 0); if (unlikely(!__pyx_ptype_5numpy_broadcast)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 162; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ndarray = __Pyx_ImportType("numpy", "ndarray", sizeof(PyArrayObject), 0); if (unlikely(!__pyx_ptype_5numpy_ndarray)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 171; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_ptype_5numpy_ufunc = __Pyx_ImportType("numpy", "ufunc", sizeof(PyUFuncObject), 0); if (unlikely(!__pyx_ptype_5numpy_ufunc)) {__pyx_filename = __pyx_f[1]; __pyx_lineno = 848; __pyx_clineno = __LINE__; goto __pyx_L1_error;} /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":1 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":1 * import numpy as np # <<<<<<<<<<<<<< * import scipy.stats * from scipy.special import i0 */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__np, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":2 * import numpy as np * import scipy.stats # <<<<<<<<<<<<<< * from scipy.special import i0 * import numpy.testing */ - __pyx_1 = __Pyx_Import(__pyx_kp_24, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_scipy, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s_8), 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__scipy, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 2; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":3 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":3 * import numpy as np * import scipy.stats * from scipy.special import i0 # <<<<<<<<<<<<<< * import numpy.testing * cimport numpy as np */ - __pyx_1 = PyList_New(1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_INCREF(__pyx_kp_i0); - PyList_SET_ITEM(__pyx_1, 0, __pyx_kp_i0); - __pyx_2 = __Pyx_Import(__pyx_kp_25, ((PyObject *)__pyx_1)); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(((PyObject *)__pyx_1)); __pyx_1 = 0; - __pyx_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_i0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_i0, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_1); __pyx_1 = 0; - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__i0)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__i0)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__i0)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_9), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__i0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__i0, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 3; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/peridot/software/scipy/scipy/scipy/stats/vonmises_cython.pyx":4 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":4 * import scipy.stats * from scipy.special import i0 * import numpy.testing # <<<<<<<<<<<<<< * cimport numpy as np * */ - __pyx_2 = __Pyx_Import(__pyx_kp_26, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - if (PyObject_SetAttr(__pyx_m, __pyx_kp_numpy, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - Py_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_10), 0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__numpy, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 4; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/usr/lib/pymodules/python2.6/Cython/Includes/stdlib.pxd":2 + /* "/Users/mb312/dev_trees/scipy-work/scipy/stats/vonmises_cython.pyx":1 + * import numpy as np # <<<<<<<<<<<<<< + * import scipy.stats + * from scipy.special import i0 + */ + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s____test__, ((PyObject *)__pyx_t_2)) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + + /* "/Users/mb312/usr/local/lib/python2.6/site-packages/Cython/Includes/stdlib.pxd":2 * - * cdef extern from "stdlib.h": # <<<<<<<<<<<<<< - * ctypedef unsigned long size_t + * cdef extern from "stdlib.h" nogil: # <<<<<<<<<<<<<< * void free(void *ptr) + * void *malloc(size_t size) */ + goto __pyx_L0; + __pyx_L1_error:; + __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + if (__pyx_m) { + __Pyx_AddTraceback("init scipy.stats.vonmises_cython"); + Py_DECREF(__pyx_m); __pyx_m = 0; + } else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_ImportError, "init scipy.stats.vonmises_cython"); + } + __pyx_L0:; + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else return __pyx_m; #endif - __pyx_L1_error:; - Py_XDECREF(__pyx_1); - Py_XDECREF(__pyx_2); - __Pyx_AddTraceback("scipy.stats.vonmises_cython"); - #if PY_MAJOR_VERSION >= 3 - return NULL; - #endif } static const char *__pyx_filenames[] = { @@ -3073,18 +4479,17 @@ PyObject*** first_kw_arg = argnames + num_pos_args; while (PyDict_Next(kwds, &pos, &key, &value)) { - #if PY_MAJOR_VERSION < 3 - if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { - #else - if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { - #endif - goto invalid_keyword_type; + name = first_kw_arg; + while (*name && (**name != key)) name++; + if (*name) { + values[name-argnames] = value; } else { - name = argnames; - while (*name && (**name != key)) name++; - if (*name) { - if (name < first_kw_arg) goto arg_passed_twice; - values[name-argnames] = value; + #if PY_MAJOR_VERSION < 3 + if (unlikely(!PyString_CheckExact(key)) && unlikely(!PyString_Check(key))) { + #else + if (unlikely(!PyUnicode_CheckExact(key)) && unlikely(!PyUnicode_Check(key))) { + #endif + goto invalid_keyword_type; } else { for (name = first_kw_arg; *name; name++) { #if PY_MAJOR_VERSION >= 3 @@ -3092,8 +4497,7 @@ PyUnicode_Compare(**name, key) == 0) break; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) break; + _PyString_Eq(**name, key)) break; #endif } if (*name) { @@ -3107,8 +4511,7 @@ PyUnicode_Compare(**name, key) == 0) goto arg_passed_twice; #else if (PyString_GET_SIZE(**name) == PyString_GET_SIZE(key) && - strcmp(PyString_AS_STRING(**name), - PyString_AS_STRING(key)) == 0) goto arg_passed_twice; + _PyString_Eq(**name, key)) goto arg_passed_twice; #endif } if (kwds2) { @@ -3141,95 +4544,461 @@ return -1; } -static INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { - if (info->buf == NULL) return; - if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; - __Pyx_ReleaseBuffer(info); +static CYTHON_INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index) { + PyErr_Format(PyExc_ValueError, + #if PY_VERSION_HEX < 0x02050000 + "need more than %d value%s to unpack", (int)index, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); } -static INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { - buf->buf = NULL; - buf->obj = NULL; - buf->strides = __Pyx_zeros; - buf->shape = __Pyx_zeros; - buf->suboffsets = __Pyx_minusones; +static CYTHON_INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); } -static INLINE const char* __Pyx_ConsumeWhitespace(const char* ts) { - while (1) { - switch (*ts) { - case '@': - case 10: - case 13: - case ' ': - ++ts; - break; - case '=': - case '<': - case '>': - case '!': - PyErr_SetString(PyExc_ValueError, "Buffer acquisition error: Only native byte order, size and alignment supported."); - return NULL; - default: - return ts; +static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { + PyObject *item; + if (!(item = PyIter_Next(iter))) { + if (!PyErr_Occurred()) { + __Pyx_RaiseNeedMoreValuesError(index); + } } + return item; +} + +static int __Pyx_EndUnpack(PyObject *iter) { + PyObject *item; + if ((item = PyIter_Next(iter))) { + Py_DECREF(item); + __Pyx_RaiseTooManyValuesError(); + return -1; + } + else if (!PyErr_Occurred()) + return 0; + else + return -1; +} + +static CYTHON_INLINE int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { + if (unlikely(!type)) { + PyErr_Format(PyExc_SystemError, "Missing type object"); + return 0; + } + if (likely(PyObject_TypeCheck(obj, type))) + return 1; + PyErr_Format(PyExc_TypeError, "Cannot convert %.200s to %.200s", + Py_TYPE(obj)->tp_name, type->tp_name); + return 0; +} + +static CYTHON_INLINE int __Pyx_IsLittleEndian(void) { + unsigned int n = 1; + return *(unsigned char*)(&n) != 0; +} + +typedef struct { + __Pyx_StructField root; + __Pyx_BufFmt_StackElem* head; + size_t fmt_offset; + int new_count, enc_count; + int is_complex; + char enc_type; + char packmode; +} __Pyx_BufFmt_Context; + +static void __Pyx_BufFmt_Init(__Pyx_BufFmt_Context* ctx, + __Pyx_BufFmt_StackElem* stack, + __Pyx_TypeInfo* type) { + stack[0].field = &ctx->root; + stack[0].parent_offset = 0; + ctx->root.type = type; + ctx->root.name = "buffer dtype"; + ctx->root.offset = 0; + ctx->head = stack; + ctx->head->field = &ctx->root; + ctx->fmt_offset = 0; + ctx->head->parent_offset = 0; + ctx->packmode = '@'; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ctx->is_complex = 0; + while (type->typegroup == 'S') { + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = 0; + type = type->fields->type; } } -static void __Pyx_BufferNdimError(Py_buffer* buffer, int expected_ndim) { - PyErr_Format(PyExc_ValueError, - "Buffer has wrong number of dimensions (expected %d, got %d)", - expected_ndim, buffer->ndim); +static int __Pyx_BufFmt_ParseNumber(const char** ts) { + int count; + const char* t = *ts; + if (*t < '0' || *t > '9') { + return -1; + } else { + count = *t++ - '0'; + while (*t >= '0' && *t < '9') { + count *= 10; + count += *t++ - '0'; + } + } + *ts = t; + return count; } -static const char* __Pyx_DescribeTokenInFormatString(const char* ts) { - switch (*ts) { - case 'b': return "char"; - case 'B': return "unsigned char"; - case 'h': return "short"; - case 'H': return "unsigned short"; - case 'i': return "int"; - case 'I': return "unsigned int"; - case 'l': return "long"; - case 'L': return "unsigned long"; - case 'q': return "long long"; - case 'Q': return "unsigned long long"; - case 'f': return "float"; - case 'd': return "double"; - case 'g': return "long double"; - case 'Z': switch (*(ts+1)) { - case 'f': return "complex float"; - case 'd': return "complex double"; - case 'g': return "complex long double"; - default: return "unparseable format string"; - } +static void __Pyx_BufFmt_RaiseUnexpectedChar(char ch) { + char msg[] = {ch, 0}; + PyErr_Format(PyExc_ValueError, "Unexpected format string character: '%s'", msg); +} + +static const char* __Pyx_BufFmt_DescribeTypeChar(char ch, int is_complex) { + switch (ch) { + case 'b': return "'char'"; + case 'B': return "'unsigned char'"; + case 'h': return "'short'"; + case 'H': return "'unsigned short'"; + case 'i': return "'int'"; + case 'I': return "'unsigned int'"; + case 'l': return "'long'"; + case 'L': return "'unsigned long'"; + case 'q': return "'long long'"; + case 'Q': return "'unsigned long long'"; + case 'f': return (is_complex ? "'complex float'" : "'float'"); + case 'd': return (is_complex ? "'complex double'" : "'double'"); + case 'g': return (is_complex ? "'complex long double'" : "'long double'"); case 'T': return "a struct"; case 'O': return "Python object"; case 'P': return "a pointer"; + case 0: return "end"; default: return "unparseable format string"; } } -static const char* __Pyx_CheckTypestring_double(const char* ts) { - int ok; - ts = __Pyx_ConsumeWhitespace(ts); if (!ts) return NULL; - if (*ts == '1') ++ts; - switch (*ts) { - case 'f': ok = (sizeof(double) == sizeof(float) && (double)-1 < 0); break; - case 'd': ok = (sizeof(double) == sizeof(double) && (double)-1 < 0); break; - case 'g': ok = (sizeof(double) == sizeof(long double) && (double)-1 < 0); break; - default: ok = 0; +static size_t __Pyx_BufFmt_TypeCharToStandardSize(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return 2; + case 'i': case 'I': case 'l': case 'L': return 4; + case 'q': case 'Q': return 8; + case 'f': return (is_complex ? 8 : 4); + case 'd': return (is_complex ? 16 : 8); + case 'g': { + PyErr_SetString(PyExc_ValueError, "Python does not define a standard format string size for long double ('g').."); + return 0; } - if (!(ok)) { - PyErr_Format(PyExc_ValueError, "Buffer dtype mismatch (expected double, got %s)", __Pyx_DescribeTokenInFormatString(ts)); - return NULL; + case 'O': case 'P': return sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; } - ++ts; - return ts; +} + +static size_t __Pyx_BufFmt_TypeCharToNativeSize(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(short); + case 'i': case 'I': return sizeof(int); + case 'l': case 'L': return sizeof(long); + #ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(PY_LONG_LONG); + #endif + case 'f': return sizeof(float) * (is_complex ? 2 : 1); + case 'd': return sizeof(double) * (is_complex ? 2 : 1); + case 'g': return sizeof(long double) * (is_complex ? 2 : 1); + case 'O': case 'P': return sizeof(void*); + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } } +} + +typedef struct { char c; short x; } __Pyx_st_short; +typedef struct { char c; int x; } __Pyx_st_int; +typedef struct { char c; long x; } __Pyx_st_long; +typedef struct { char c; float x; } __Pyx_st_float; +typedef struct { char c; double x; } __Pyx_st_double; +typedef struct { char c; long double x; } __Pyx_st_longdouble; +typedef struct { char c; void *x; } __Pyx_st_void_p; +#ifdef HAVE_LONG_LONG +typedef struct { char c; PY_LONG_LONG x; } __Pyx_s_long_long; +#endif + +static size_t __Pyx_BufFmt_TypeCharToAlignment(char ch, int is_complex) { + switch (ch) { + case '?': case 'c': case 'b': case 'B': return 1; + case 'h': case 'H': return sizeof(__Pyx_st_short) - sizeof(short); + case 'i': case 'I': return sizeof(__Pyx_st_int) - sizeof(int); + case 'l': case 'L': return sizeof(__Pyx_st_long) - sizeof(long); +#ifdef HAVE_LONG_LONG + case 'q': case 'Q': return sizeof(__Pyx_s_long_long) - sizeof(PY_LONG_LONG); +#endif + case 'f': return sizeof(__Pyx_st_float) - sizeof(float); + case 'd': return sizeof(__Pyx_st_double) - sizeof(double); + case 'g': return sizeof(__Pyx_st_longdouble) - sizeof(long double); + case 'P': case 'O': return sizeof(__Pyx_st_void_p) - sizeof(void*); + default: + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } +} + +static size_t __Pyx_BufFmt_TypeCharToGroup(char ch, int is_complex) { + switch (ch) { + case 'c': case 'b': case 'h': case 'i': case 'l': case 'q': return 'I'; + case 'B': case 'H': case 'I': case 'L': case 'Q': return 'U'; + case 'f': case 'd': case 'g': return (is_complex ? 'C' : 'R'); + case 'O': return 'O'; + case 'P': return 'P'; + default: { + __Pyx_BufFmt_RaiseUnexpectedChar(ch); + return 0; + } + } +} + +static void __Pyx_BufFmt_RaiseExpected(__Pyx_BufFmt_Context* ctx) { + if (ctx->head == NULL || ctx->head->field == &ctx->root) { + const char* expected; + const char* quote; + if (ctx->head == NULL) { + expected = "end"; + quote = ""; + } else { + expected = ctx->head->field->type->name; + quote = "'"; + } + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected %s%s%s but got %s", + quote, expected, quote, + __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex)); + } else { + __Pyx_StructField* field = ctx->head->field; + __Pyx_StructField* parent = (ctx->head - 1)->field; + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch, expected '%s' but got %s in '%s.%s'", + field->type->name, __Pyx_BufFmt_DescribeTypeChar(ctx->enc_type, ctx->is_complex), + parent->type->name, field->name); + } +} + +static int __Pyx_BufFmt_ProcessTypeChunk(__Pyx_BufFmt_Context* ctx) { + char group; + size_t size, offset; + if (ctx->enc_type == 0) return 0; + group = __Pyx_BufFmt_TypeCharToGroup(ctx->enc_type, ctx->is_complex); + do { + __Pyx_StructField* field = ctx->head->field; + __Pyx_TypeInfo* type = field->type; -static int __Pyx_GetBuffer_double(PyObject* obj, Py_buffer* buf, int flags, int nd, int cast) { - const char* ts; + if (ctx->packmode == '@' || ctx->packmode == '^') { + size = __Pyx_BufFmt_TypeCharToNativeSize(ctx->enc_type, ctx->is_complex); + } else { + size = __Pyx_BufFmt_TypeCharToStandardSize(ctx->enc_type, ctx->is_complex); + } + if (ctx->packmode == '@') { + int align_at = __Pyx_BufFmt_TypeCharToAlignment(ctx->enc_type, ctx->is_complex); + int align_mod_offset; + if (align_at == 0) return -1; + align_mod_offset = ctx->fmt_offset % align_at; + if (align_mod_offset > 0) ctx->fmt_offset += align_at - align_mod_offset; + } + + if (type->size != size || type->typegroup != group) { + if (type->typegroup == 'C' && type->fields != NULL) { + /* special case -- treat as struct rather than complex number */ + size_t parent_offset = ctx->head->parent_offset + field->offset; + ++ctx->head; + ctx->head->field = type->fields; + ctx->head->parent_offset = parent_offset; + continue; + } + + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + + offset = ctx->head->parent_offset + field->offset; + if (ctx->fmt_offset != offset) { + PyErr_Format(PyExc_ValueError, + "Buffer dtype mismatch; next field is at offset %"PY_FORMAT_SIZE_T"d " + "but %"PY_FORMAT_SIZE_T"d expected", ctx->fmt_offset, offset); + return -1; + } + + ctx->fmt_offset += size; + + --ctx->enc_count; /* Consume from buffer string */ + + /* Done checking, move to next field, pushing or popping struct stack if needed */ + while (1) { + if (field == &ctx->root) { + ctx->head = NULL; + if (ctx->enc_count != 0) { + __Pyx_BufFmt_RaiseExpected(ctx); + return -1; + } + break; /* breaks both loops as ctx->enc_count == 0 */ + } + ctx->head->field = ++field; + if (field->type == NULL) { + --ctx->head; + field = ctx->head->field; + continue; + } else if (field->type->typegroup == 'S') { + size_t parent_offset = ctx->head->parent_offset + field->offset; + if (field->type->fields->type == NULL) continue; /* empty struct */ + field = field->type->fields; + ++ctx->head; + ctx->head->field = field; + ctx->head->parent_offset = parent_offset; + break; + } else { + break; + } + } + } while (ctx->enc_count); + ctx->enc_type = 0; + ctx->is_complex = 0; + return 0; +} + +static int __Pyx_BufFmt_FirstPack(__Pyx_BufFmt_Context* ctx) { + if (ctx->enc_type != 0 || ctx->packmode != '@') { + PyErr_SetString(PyExc_ValueError, "Buffer packing mode currently only allowed at beginning of format string (this is a defect)"); + return -1; + } + return 0; +} + +static const char* __Pyx_BufFmt_CheckString(__Pyx_BufFmt_Context* ctx, const char* ts) { + int got_Z = 0; + while (1) { + switch(*ts) { + case 0: + if (ctx->enc_type != 0 && ctx->head == NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + if (ctx->head != NULL) { + __Pyx_BufFmt_RaiseExpected(ctx); + return NULL; + } + return ts; + case ' ': + case 10: + case 13: + ++ts; + break; + case '<': + if (!__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Little-endian buffer not supported on big-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '>': + case '!': + if (__Pyx_IsLittleEndian()) { + PyErr_SetString(PyExc_ValueError, "Big-endian buffer not supported on little-endian compiler"); + return NULL; + } + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = '='; + ++ts; + break; + case '=': + case '@': + case '^': + if (__Pyx_BufFmt_FirstPack(ctx) == -1) return NULL; + ctx->packmode = *ts++; + break; + case 'T': /* substruct */ + { + int i; + const char* ts_after_sub; + int struct_count = ctx->new_count; + ctx->new_count = 1; + ++ts; + if (*ts != '{') { + PyErr_SetString(PyExc_ValueError, "Buffer acquisition: Expected '{' after 'T'"); + return NULL; + } + ++ts; + ts_after_sub = ts; + for (i = 0; i != struct_count; ++i) { + ts_after_sub = __Pyx_BufFmt_CheckString(ctx, ts); + if (!ts_after_sub) return NULL; + } + ts = ts_after_sub; + } + break; + case '}': /* end of substruct; either repeat or move on */ + ++ts; + return ts; + case 'x': + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->fmt_offset += ctx->new_count; + ctx->new_count = 1; + ctx->enc_count = 0; + ctx->enc_type = 0; + ++ts; + break; + case 'Z': + got_Z = 1; + ++ts; + if (*ts != 'f' && *ts != 'd' && *ts != 'g') { + __Pyx_BufFmt_RaiseUnexpectedChar('Z'); + return NULL; + } /* fall through */ + case 'c': case 'b': case 'B': case 'h': case 'H': case 'i': case 'I': + case 'l': case 'L': case 'q': case 'Q': + case 'f': case 'd': case 'g': + case 'O': + if (ctx->enc_type == *ts && got_Z == ctx->is_complex) { + /* Continue pooling same type */ + ctx->enc_count += ctx->new_count; + } else { + /* New type */ + if (__Pyx_BufFmt_ProcessTypeChunk(ctx) == -1) return NULL; + ctx->enc_count = ctx->new_count; + ctx->enc_type = *ts; + ctx->is_complex = got_Z; + } + ++ts; + ctx->new_count = 1; + got_Z = 0; + break; + default: + { + ctx->new_count = __Pyx_BufFmt_ParseNumber(&ts); + if (ctx->new_count == -1) { /* First char was not a digit */ + char msg[2] = { *ts, 0 }; + PyErr_Format(PyExc_ValueError, + "Does not understand character buffer dtype format string ('%s')", msg); + return NULL; + } + } + + } + } +} + +static CYTHON_INLINE void __Pyx_ZeroBuffer(Py_buffer* buf) { + buf->buf = NULL; + buf->obj = NULL; + buf->strides = __Pyx_zeros; + buf->shape = __Pyx_zeros; + buf->suboffsets = __Pyx_minusones; +} + +static int __Pyx_GetBufferAndValidate(Py_buffer* buf, PyObject* obj, __Pyx_TypeInfo* dtype, int flags, int nd, int cast, __Pyx_BufFmt_StackElem* stack) { if (obj == Py_None) { __Pyx_ZeroBuffer(buf); return 0; @@ -3237,36 +5006,37 @@ buf->buf = NULL; if (__Pyx_GetBuffer(obj, buf, flags) == -1) goto fail; if (buf->ndim != nd) { - __Pyx_BufferNdimError(buf, nd); + PyErr_Format(PyExc_ValueError, + "Buffer has wrong number of dimensions (expected %d, got %d)", + nd, buf->ndim); goto fail; } if (!cast) { - ts = buf->format; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - ts = __Pyx_CheckTypestring_double(ts); - if (!ts) goto fail; - ts = __Pyx_ConsumeWhitespace(ts); - if (!ts) goto fail; - if (*ts != 0) { - PyErr_Format(PyExc_ValueError, - "Buffer dtype mismatch (expected end, got %s)", - __Pyx_DescribeTokenInFormatString(ts)); - goto fail; - } - } else { - if (buf->itemsize != sizeof(double)) { - PyErr_SetString(PyExc_ValueError, - "Attempted cast of buffer to datatype of different size."); - goto fail; - } + __Pyx_BufFmt_Context ctx; + __Pyx_BufFmt_Init(&ctx, stack, dtype); + if (!__Pyx_BufFmt_CheckString(&ctx, buf->format)) goto fail; } + if ((unsigned)buf->itemsize != dtype->size) { + PyErr_Format(PyExc_ValueError, + "Item size of buffer (%"PY_FORMAT_SIZE_T"d byte%s) does not match size of '%s' (%"PY_FORMAT_SIZE_T"d byte%s)", + buf->itemsize, (buf->itemsize > 1) ? "s" : "", + dtype->name, + dtype->size, (dtype->size > 1) ? "s" : ""); + goto fail; + } if (buf->suboffsets == NULL) buf->suboffsets = __Pyx_minusones; return 0; fail:; __Pyx_ZeroBuffer(buf); return -1; } + +static CYTHON_INLINE void __Pyx_SafeReleaseBuffer(Py_buffer* info) { + if (info->buf == NULL) return; + if (info->suboffsets == __Pyx_minusones) info->suboffsets = NULL; + __Pyx_ReleaseBuffer(info); +} + static void __Pyx_RaiseBufferFallbackError(void) { PyErr_Format(PyExc_ValueError, "Buffer acquisition failed on assignment; and then reacquiring the old buffer failed too!"); @@ -3274,7 +5044,7 @@ -static INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { +static CYTHON_INLINE void __Pyx_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { PyObject *tmp_type, *tmp_value, *tmp_tb; PyThreadState *tstate = PyThreadState_GET(); @@ -3289,7 +5059,7 @@ Py_XDECREF(tmp_tb); } -static INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { +static CYTHON_INLINE void __Pyx_ErrFetch(PyObject **type, PyObject **value, PyObject **tb) { PyThreadState *tstate = PyThreadState_GET(); *type = tstate->curexc_type; *value = tstate->curexc_value; @@ -3301,6 +5071,20 @@ } +static CYTHON_INLINE void __Pyx_RaiseNoneNotIterableError(void) { + PyErr_SetString(PyExc_TypeError, "'NoneType' object is not iterable"); +} + +static void __Pyx_UnpackTupleError(PyObject *t, Py_ssize_t index) { + if (t == Py_None) { + __Pyx_RaiseNoneNotIterableError(); + } else if (PyTuple_GET_SIZE(t) < index) { + __Pyx_RaiseNeedMoreValuesError(PyTuple_GET_SIZE(t)); + } else { + __Pyx_RaiseTooManyValuesError(); + } +} + #if PY_MAJOR_VERSION < 3 static int __Pyx_GetBuffer(PyObject *obj, Py_buffer *view, int flags) { #if PY_VERSION_HEX >= 0x02060000 @@ -3332,7 +5116,7 @@ PyObject *global_dict = 0; PyObject *empty_dict = 0; PyObject *list; - __import__ = PyObject_GetAttrString(__pyx_b, "__import__"); + __import__ = __Pyx_GetAttrString(__pyx_b, "__import__"); if (!__import__) goto bad; if (from_list) @@ -3349,8 +5133,8 @@ empty_dict = PyDict_New(); if (!empty_dict) goto bad; - module = PyObject_CallFunction(__import__, "OOOO", - name, global_dict, empty_dict, list); + module = PyObject_CallFunctionObjArgs(__import__, + name, global_dict, empty_dict, list, NULL); bad: Py_XDECREF(empty_list); Py_XDECREF(__import__); @@ -3366,70 +5150,157 @@ return result; } -static PyObject *__Pyx_UnpackItem(PyObject *iter, Py_ssize_t index) { - PyObject *item; - if (!(item = PyIter_Next(iter))) { - if (!PyErr_Occurred()) { - PyErr_Format(PyExc_ValueError, - #if PY_VERSION_HEX < 0x02050000 - "need more than %d values to unpack", (int)index); - #else - "need more than %zd values to unpack", index); - #endif - } +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return ::std::complex< float >(x, y); } - return item; -} + #else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + return x + y*(__pyx_t_float_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_float_complex __pyx_t_float_complex_from_parts(float x, float y) { + __pyx_t_float_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif -static int __Pyx_EndUnpack(PyObject *iter) { - PyObject *item; - if ((item = PyIter_Next(iter))) { - Py_DECREF(item); - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); - return -1; +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eqf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + return (a.real == b.real) && (a.imag == b.imag); } - else if (!PyErr_Occurred()) - return 0; - else - return -1; -} + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_sumf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_difff(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_prodf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_quotf(__pyx_t_float_complex a, __pyx_t_float_complex b) { + __pyx_t_float_complex z; + float denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_negf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zerof(__pyx_t_float_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_float_complex __Pyx_c_conjf(__pyx_t_float_complex a) { + __pyx_t_float_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE float __Pyx_c_absf(__pyx_t_float_complex z) { +#if HAVE_HYPOT + return hypotf(z.real, z.imag); +#else + return sqrtf(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif -static int __Pyx_TypeTest(PyObject *obj, PyTypeObject *type) { - if (!type) { - PyErr_Format(PyExc_SystemError, "Missing type object"); - return 0; +#if CYTHON_CCOMPLEX + #ifdef __cplusplus + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return ::std::complex< double >(x, y); } - if (obj == Py_None || PyObject_TypeCheck(obj, type)) - return 1; - PyErr_Format(PyExc_TypeError, "Cannot convert %s to %s", - Py_TYPE(obj)->tp_name, type->tp_name); - return 0; -} + #else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + return x + y*(__pyx_t_double_complex)_Complex_I; + } + #endif +#else + static CYTHON_INLINE __pyx_t_double_complex __pyx_t_double_complex_from_parts(double x, double y) { + __pyx_t_double_complex z; + z.real = x; + z.imag = y; + return z; + } +#endif -static INLINE void __Pyx_ExceptionSave(PyObject **type, PyObject **value, PyObject **tb) { - PyThreadState *tstate = PyThreadState_GET(); - *type = tstate->exc_type; - *value = tstate->exc_value; - *tb = tstate->exc_traceback; - Py_XINCREF(*type); - Py_XINCREF(*value); - Py_XINCREF(*tb); -} +#if CYTHON_CCOMPLEX +#else + static CYTHON_INLINE int __Pyx_c_eq(__pyx_t_double_complex a, __pyx_t_double_complex b) { + return (a.real == b.real) && (a.imag == b.imag); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_sum(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real + b.real; + z.imag = a.imag + b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_diff(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real - b.real; + z.imag = a.imag - b.imag; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_prod(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + z.real = a.real * b.real - a.imag * b.imag; + z.imag = a.real * b.imag + a.imag * b.real; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_quot(__pyx_t_double_complex a, __pyx_t_double_complex b) { + __pyx_t_double_complex z; + double denom = b.real * b.real + b.imag * b.imag; + z.real = (a.real * b.real + a.imag * b.imag) / denom; + z.imag = (a.imag * b.real - a.real * b.imag) / denom; + return z; + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_neg(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = -a.real; + z.imag = -a.imag; + return z; + } + static CYTHON_INLINE int __Pyx_c_is_zero(__pyx_t_double_complex a) { + return (a.real == 0) && (a.imag == 0); + } + static CYTHON_INLINE __pyx_t_double_complex __Pyx_c_conj(__pyx_t_double_complex a) { + __pyx_t_double_complex z; + z.real = a.real; + z.imag = -a.imag; + return z; + } +/* + static CYTHON_INLINE double __Pyx_c_abs(__pyx_t_double_complex z) { +#if HAVE_HYPOT + return hypot(z.real, z.imag); +#else + return sqrt(z.real*z.real + z.imag*z.imag); +#endif + } +*/ +#endif -static void __Pyx_ExceptionReset(PyObject *type, PyObject *value, PyObject *tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = type; - tstate->exc_value = value; - tstate->exc_traceback = tb; - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); -} - +#if PY_MAJOR_VERSION < 3 static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { Py_XINCREF(type); Py_XINCREF(value); @@ -3485,6 +5356,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -3494,36 +5366,431 @@ return; } -static int __Pyx_GetException(PyObject **type, PyObject **value, PyObject **tb) { - PyObject *tmp_type, *tmp_value, *tmp_tb; - PyThreadState *tstate = PyThreadState_GET(); - __Pyx_ErrFetch(type, value, tb); - PyErr_NormalizeException(type, value, tb); - if (PyErr_Occurred()) +#else /* Python 3+ */ + +static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb) { + if (tb == Py_None) { + tb = 0; + } else if (tb && !PyTraceBack_Check(tb)) { + PyErr_SetString(PyExc_TypeError, + "raise: arg 3 must be a traceback or None"); goto bad; - Py_INCREF(*type); - Py_INCREF(*value); - Py_INCREF(*tb); - tmp_type = tstate->exc_type; - tmp_value = tstate->exc_value; - tmp_tb = tstate->exc_traceback; - tstate->exc_type = *type; - tstate->exc_value = *value; - tstate->exc_traceback = *tb; - /* Make sure tstate is in a consistent state when we XDECREF - these objects (XDECREF may run arbitrary code). */ - Py_XDECREF(tmp_type); - Py_XDECREF(tmp_value); - Py_XDECREF(tmp_tb); - return 0; + } + if (value == Py_None) + value = 0; + + if (PyExceptionInstance_Check(type)) { + if (value) { + PyErr_SetString(PyExc_TypeError, + "instance exception may not have a separate value"); + goto bad; + } + value = type; + type = (PyObject*) Py_TYPE(value); + } else if (!PyExceptionClass_Check(type)) { + PyErr_SetString(PyExc_TypeError, + "raise: exception class must be a subclass of BaseException"); + goto bad; + } + + PyErr_SetObject(type, value); + + if (tb) { + PyThreadState *tstate = PyThreadState_GET(); + PyObject* tmp_tb = tstate->curexc_traceback; + if (tb != tmp_tb) { + Py_INCREF(tb); + tstate->curexc_traceback = tb; + Py_XDECREF(tmp_tb); + } + } + bad: - Py_XDECREF(*type); - Py_XDECREF(*value); - Py_XDECREF(*tb); - return -1; + return; } +#endif +static CYTHON_INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject* x) { + const unsigned char neg_one = (unsigned char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned char" : + "value too large to convert to unsigned char"); + } + return (unsigned char)-1; + } + return (unsigned char)val; + } + return (unsigned char)__Pyx_PyInt_AsUnsignedLong(x); +} +static CYTHON_INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject* x) { + const unsigned short neg_one = (unsigned short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned short" : + "value too large to convert to unsigned short"); + } + return (unsigned short)-1; + } + return (unsigned short)val; + } + return (unsigned short)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE unsigned int __Pyx_PyInt_AsUnsignedInt(PyObject* x) { + const unsigned int neg_one = (unsigned int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(unsigned int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(unsigned int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to unsigned int" : + "value too large to convert to unsigned int"); + } + return (unsigned int)-1; + } + return (unsigned int)val; + } + return (unsigned int)__Pyx_PyInt_AsUnsignedLong(x); +} + +static CYTHON_INLINE char __Pyx_PyInt_AsChar(PyObject* x) { + const char neg_one = (char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to char" : + "value too large to convert to char"); + } + return (char)-1; + } + return (char)val; + } + return (char)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE short __Pyx_PyInt_AsShort(PyObject* x) { + const short neg_one = (short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to short" : + "value too large to convert to short"); + } + return (short)-1; + } + return (short)val; + } + return (short)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE int __Pyx_PyInt_AsInt(PyObject* x) { + const int neg_one = (int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to int" : + "value too large to convert to int"); + } + return (int)-1; + } + return (int)val; + } + return (int)__Pyx_PyInt_AsLong(x); +} + +static CYTHON_INLINE signed char __Pyx_PyInt_AsSignedChar(PyObject* x) { + const signed char neg_one = (signed char)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed char) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed char)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed char" : + "value too large to convert to signed char"); + } + return (signed char)-1; + } + return (signed char)val; + } + return (signed char)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed short __Pyx_PyInt_AsSignedShort(PyObject* x) { + const signed short neg_one = (signed short)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed short) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed short)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed short" : + "value too large to convert to signed short"); + } + return (signed short)-1; + } + return (signed short)val; + } + return (signed short)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE signed int __Pyx_PyInt_AsSignedInt(PyObject* x) { + const signed int neg_one = (signed int)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; + if (sizeof(signed int) < sizeof(long)) { + long val = __Pyx_PyInt_AsLong(x); + if (unlikely(val != (long)(signed int)val)) { + if (!unlikely(val == -1 && PyErr_Occurred())) { + PyErr_SetString(PyExc_OverflowError, + (is_unsigned && unlikely(val < 0)) ? + "can't convert negative value to signed int" : + "value too large to convert to signed int"); + } + return (signed int)-1; + } + return (signed int)val; + } + return (signed int)__Pyx_PyInt_AsSignedLong(x); +} + +static CYTHON_INLINE unsigned long __Pyx_PyInt_AsUnsignedLong(PyObject* x) { + const unsigned long neg_one = (unsigned long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return (unsigned long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned long"); + return (unsigned long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + unsigned long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned long)-1; + val = __Pyx_PyInt_AsUnsignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE unsigned PY_LONG_LONG __Pyx_PyInt_AsUnsignedLongLong(PyObject* x) { + const unsigned PY_LONG_LONG neg_one = (unsigned PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return (unsigned PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to unsigned PY_LONG_LONG"); + return (unsigned PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + unsigned PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (unsigned PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsUnsignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE long __Pyx_PyInt_AsLong(PyObject* x) { + const long neg_one = (long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return (long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to long"); + return (long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (long)-1; + val = __Pyx_PyInt_AsLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE PY_LONG_LONG __Pyx_PyInt_AsLongLong(PyObject* x) { + const PY_LONG_LONG neg_one = (PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return (PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to PY_LONG_LONG"); + return (PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed long __Pyx_PyInt_AsSignedLong(PyObject* x) { + const signed long neg_one = (signed long)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return (signed long)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed long"); + return (signed long)-1; + } + return PyLong_AsUnsignedLong(x); + } else { + return PyLong_AsLong(x); + } + } else { + signed long val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed long)-1; + val = __Pyx_PyInt_AsSignedLong(tmp); + Py_DECREF(tmp); + return val; + } +} + +static CYTHON_INLINE signed PY_LONG_LONG __Pyx_PyInt_AsSignedLongLong(PyObject* x) { + const signed PY_LONG_LONG neg_one = (signed PY_LONG_LONG)-1, const_zero = 0; + const int is_unsigned = neg_one > const_zero; +#if PY_VERSION_HEX < 0x03000000 + if (likely(PyInt_Check(x))) { + long val = PyInt_AS_LONG(x); + if (is_unsigned && unlikely(val < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return (signed PY_LONG_LONG)val; + } else +#endif + if (likely(PyLong_Check(x))) { + if (is_unsigned) { + if (unlikely(Py_SIZE(x) < 0)) { + PyErr_SetString(PyExc_OverflowError, + "can't convert negative value to signed PY_LONG_LONG"); + return (signed PY_LONG_LONG)-1; + } + return PyLong_AsUnsignedLongLong(x); + } else { + return PyLong_AsLongLong(x); + } + } else { + signed PY_LONG_LONG val; + PyObject *tmp = __Pyx_PyNumber_Int(x); + if (!tmp) return (signed PY_LONG_LONG)-1; + val = __Pyx_PyInt_AsSignedLongLong(tmp); + Py_DECREF(tmp); + return val; + } +} + static void __Pyx_WriteUnraisable(const char *name) { PyObject *old_exc, *old_val, *old_tb; PyObject *ctx; @@ -3545,11 +5812,12 @@ #ifndef __PYX_HAVE_RT_ImportType #define __PYX_HAVE_RT_ImportType static PyTypeObject *__Pyx_ImportType(const char *module_name, const char *class_name, - long size) + long size, int strict) { PyObject *py_module = 0; PyObject *result = 0; PyObject *py_name = 0; + char warning[200]; py_module = __Pyx_ImportModule(module_name); if (!py_module) @@ -3574,9 +5842,15 @@ module_name, class_name); goto bad; } - if (((PyTypeObject *)result)->tp_basicsize != size) { + if (!strict && ((PyTypeObject *)result)->tp_basicsize > size) { + PyOS_snprintf(warning, sizeof(warning), + "%s.%s size changed, may indicate binary incompatibility", + module_name, class_name); + PyErr_WarnEx(NULL, warning, 0); + } + else if (((PyTypeObject *)result)->tp_basicsize != size) { PyErr_Format(PyExc_ValueError, - "%s.%s does not appear to be the correct type object", + "%s.%s has the wrong size, try recompiling", module_name, class_name); goto bad; } @@ -3618,7 +5892,6 @@ PyObject *py_srcfile = 0; PyObject *py_funcname = 0; PyObject *py_globals = 0; - PyObject *empty_string = 0; PyCodeObject *py_code = 0; PyFrameObject *py_frame = 0; @@ -3645,12 +5918,6 @@ if (!py_funcname) goto bad; py_globals = PyModule_GetDict(__pyx_m); if (!py_globals) goto bad; - #if PY_MAJOR_VERSION < 3 - empty_string = PyString_FromStringAndSize("", 0); - #else - empty_string = PyBytes_FromStringAndSize("", 0); - #endif - if (!empty_string) goto bad; py_code = PyCode_New( 0, /*int argcount,*/ #if PY_MAJOR_VERSION >= 3 @@ -3659,7 +5926,7 @@ 0, /*int nlocals,*/ 0, /*int stacksize,*/ 0, /*int flags,*/ - empty_string, /*PyObject *code,*/ + __pyx_empty_bytes, /*PyObject *code,*/ __pyx_empty_tuple, /*PyObject *consts,*/ __pyx_empty_tuple, /*PyObject *names,*/ __pyx_empty_tuple, /*PyObject *varnames,*/ @@ -3668,7 +5935,7 @@ py_srcfile, /*PyObject *filename,*/ py_funcname, /*PyObject *name,*/ __pyx_lineno, /*int firstlineno,*/ - empty_string /*PyObject *lnotab*/ + __pyx_empty_bytes /*PyObject *lnotab*/ ); if (!py_code) goto bad; py_frame = PyFrame_New( @@ -3683,7 +5950,6 @@ bad: Py_XDECREF(py_srcfile); Py_XDECREF(py_funcname); - Py_XDECREF(empty_string); Py_XDECREF(py_code); Py_XDECREF(py_frame); } @@ -3691,7 +5957,7 @@ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t) { while (t->p) { #if PY_MAJOR_VERSION < 3 - if (t->is_unicode && (!t->is_identifier)) { + if (t->is_unicode) { *t->p = PyUnicode_DecodeUTF8(t->s, t->n - 1, NULL); } else if (t->intern) { *t->p = PyString_InternFromString(t->s); @@ -3699,10 +5965,14 @@ *t->p = PyString_FromStringAndSize(t->s, t->n - 1); } #else /* Python 3+ has unicode identifiers */ - if (t->is_identifier || (t->is_unicode && t->intern)) { - *t->p = PyUnicode_InternFromString(t->s); - } else if (t->is_unicode) { - *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + if (t->is_unicode | t->is_str) { + if (t->intern) { + *t->p = PyUnicode_InternFromString(t->s); + } else if (t->encoding) { + *t->p = PyUnicode_Decode(t->s, t->n - 1, t->encoding, NULL); + } else { + *t->p = PyUnicode_FromStringAndSize(t->s, t->n - 1); + } } else { *t->p = PyBytes_FromStringAndSize(t->s, t->n - 1); } @@ -3716,221 +5986,92 @@ /* Type Conversion Functions */ -static INLINE Py_ssize_t __pyx_PyIndex_AsSsize_t(PyObject* b) { - Py_ssize_t ival; - PyObject* x = PyNumber_Index(b); - if (!x) return -1; - ival = PyInt_AsSsize_t(x); - Py_DECREF(x); - return ival; -} - -static INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { +static CYTHON_INLINE int __Pyx_PyObject_IsTrue(PyObject* x) { if (x == Py_True) return 1; - else if (x == Py_False) return 0; + else if ((x == Py_False) | (x == Py_None)) return 0; else return PyObject_IsTrue(x); } -static INLINE PY_LONG_LONG __pyx_PyInt_AsLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - return PyInt_AS_LONG(x); +static CYTHON_INLINE PyObject* __Pyx_PyNumber_Int(PyObject* x) { + PyNumberMethods *m; + const char *name = NULL; + PyObject *res = NULL; +#if PY_VERSION_HEX < 0x03000000 + if (PyInt_Check(x) || PyLong_Check(x)) +#else + if (PyLong_Check(x)) +#endif + return Py_INCREF(x), x; + m = Py_TYPE(x)->tp_as_number; +#if PY_VERSION_HEX < 0x03000000 + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Int(x); + } + else if (m && m->nb_long) { + name = "long"; + res = PyNumber_Long(x); + } +#else + if (m && m->nb_int) { + name = "int"; + res = PyNumber_Long(x); + } +#endif + if (res) { +#if PY_VERSION_HEX < 0x03000000 + if (!PyInt_Check(res) && !PyLong_Check(res)) { +#else + if (!PyLong_Check(res)) { +#endif + PyErr_Format(PyExc_TypeError, + "__%s__ returned non-%s (type %.200s)", + name, name, Py_TYPE(res)->tp_name); + Py_DECREF(res); + return NULL; } - else if (PyLong_CheckExact(x)) { - return PyLong_AsLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsLongLong(tmp); - Py_DECREF(tmp); - return val; - } + } + else if (!PyErr_Occurred()) { + PyErr_SetString(PyExc_TypeError, + "an integer is required"); + } + return res; } -static INLINE unsigned PY_LONG_LONG __pyx_PyInt_AsUnsignedLongLong(PyObject* x) { - if (PyInt_CheckExact(x)) { - long val = PyInt_AS_LONG(x); - if (unlikely(val < 0)) { - PyErr_SetString(PyExc_TypeError, "Negative assignment to unsigned type."); - return (unsigned PY_LONG_LONG)-1; - } - return val; - } - else if (PyLong_CheckExact(x)) { - return PyLong_AsUnsignedLongLong(x); - } - else { - PY_LONG_LONG val; - PyObject* tmp = PyNumber_Int(x); if (!tmp) return (PY_LONG_LONG)-1; - val = __pyx_PyInt_AsUnsignedLongLong(tmp); - Py_DECREF(tmp); - return val; - } +static CYTHON_INLINE Py_ssize_t __Pyx_PyIndex_AsSsize_t(PyObject* b) { + Py_ssize_t ival; + PyObject* x = PyNumber_Index(b); + if (!x) return -1; + ival = PyInt_AsSsize_t(x); + Py_DECREF(x); + return ival; } - -static INLINE unsigned char __pyx_PyInt_unsigned_char(PyObject* x) { - if (sizeof(unsigned char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned char val = (unsigned char)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned char"); - return (unsigned char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE PyObject * __Pyx_PyInt_FromSize_t(size_t ival) { +#if PY_VERSION_HEX < 0x02050000 + if (ival <= LONG_MAX) + return PyInt_FromLong((long)ival); + else { + unsigned char *bytes = (unsigned char *) &ival; + int one = 1; int little = (int)*(unsigned char*)&one; + return _PyLong_FromByteArray(bytes, sizeof(size_t), little, 0); + } +#else + return PyInt_FromSize_t(ival); +#endif } -static INLINE unsigned short __pyx_PyInt_unsigned_short(PyObject* x) { - if (sizeof(unsigned short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - unsigned short val = (unsigned short)long_val; - if (unlikely((val != long_val) || (long_val < 0))) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to unsigned short"); - return (unsigned short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } +static CYTHON_INLINE size_t __Pyx_PyInt_AsSize_t(PyObject* x) { + unsigned PY_LONG_LONG val = __Pyx_PyInt_AsUnsignedLongLong(x); + if (unlikely(val == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())) { + return (size_t)-1; + } else if (unlikely(val != (unsigned PY_LONG_LONG)(size_t)val)) { + PyErr_SetString(PyExc_OverflowError, + "value too large to convert to size_t"); + return (size_t)-1; + } + return (size_t)val; } -static INLINE char __pyx_PyInt_char(PyObject* x) { - if (sizeof(char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - char val = (char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to char"); - return (char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} -static INLINE short __pyx_PyInt_short(PyObject* x) { - if (sizeof(short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - short val = (short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to short"); - return (short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE int __pyx_PyInt_int(PyObject* x) { - if (sizeof(int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - int val = (int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to int"); - return (int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long __pyx_PyInt_long(PyObject* x) { - if (sizeof(long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long val = (long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long"); - return (long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed char __pyx_PyInt_signed_char(PyObject* x) { - if (sizeof(signed char) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed char val = (signed char)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed char"); - return (signed char)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed short __pyx_PyInt_signed_short(PyObject* x) { - if (sizeof(signed short) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed short val = (signed short)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed short"); - return (signed short)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed int __pyx_PyInt_signed_int(PyObject* x) { - if (sizeof(signed int) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed int val = (signed int)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed int"); - return (signed int)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE signed long __pyx_PyInt_signed_long(PyObject* x) { - if (sizeof(signed long) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - signed long val = (signed long)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to signed long"); - return (signed long)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - -static INLINE long double __pyx_PyInt_long_double(PyObject* x) { - if (sizeof(long double) < sizeof(long)) { - long long_val = __pyx_PyInt_AsLong(x); - long double val = (long double)long_val; - if (unlikely((val != long_val) )) { - PyErr_SetString(PyExc_OverflowError, "value too large to convert to long double"); - return (long double)-1; - } - return val; - } - else { - return __pyx_PyInt_AsLong(x); - } -} - +#endif /* Py_PYTHON_H */ From scipy-svn at scipy.org Sat Jun 26 14:53:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 13:53:03 -0500 (CDT) Subject: [Scipy-svn] r6562 - trunk/scipy/constants/tests Message-ID: <20100626185303.93A0339C4B4@scipy.org> Author: stefan Date: 2010-06-26 13:53:03 -0500 (Sat, 26 Jun 2010) New Revision: 6562 Modified: trunk/scipy/constants/tests/test_codata.py Log: ENH: Allow codata tests to be run as script. Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2010-06-21 20:55:39 UTC (rev 6561) +++ trunk/scipy/constants/tests/test_codata.py 2010-06-26 18:53:03 UTC (rev 6562) @@ -2,7 +2,7 @@ import warnings from scipy.constants import find -from numpy.testing import assert_equal +from numpy.testing import assert_equal, run_module_suite def test_find(): @@ -25,3 +25,6 @@ 'natural unit of momentum in MeV/c', 'natural unit of length', 'natural unit of time'])) + +if __name__ == "__main__": + run_module_suite() From scipy-svn at scipy.org Sat Jun 26 14:53:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 13:53:07 -0500 (CDT) Subject: [Scipy-svn] r6563 - trunk/scipy/constants/tests Message-ID: <20100626185307.BFF9739C4B4@scipy.org> Author: stefan Date: 2010-06-26 13:53:07 -0500 (Sat, 26 Jun 2010) New Revision: 6563 Modified: trunk/scipy/constants/tests/test_codata.py Log: ENH: Add very basic tests for codata and constants. Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2010-06-26 18:53:03 UTC (rev 6562) +++ trunk/scipy/constants/tests/test_codata.py 2010-06-26 18:53:07 UTC (rev 6563) @@ -1,6 +1,9 @@ import warnings +import codata +import constants + from scipy.constants import find from numpy.testing import assert_equal, run_module_suite @@ -26,5 +29,15 @@ 'natural unit of length', 'natural unit of time'])) + +def test_basic_table_parse(): + c = 'speed of light in vacuum' + assert_equal(codata.value(c), constants.c) + assert_equal(codata.value(c), constants.speed_of_light) + +def test_basic_lookup(): + assert_equal('%d %s' % (codata.c, codata.unit('speed of light in vacuum')), + '299792458 m s^-1') + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jun 26 14:53:11 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 13:53:11 -0500 (CDT) Subject: [Scipy-svn] r6564 - trunk/scipy/constants Message-ID: <20100626185311.9783039C4B4@scipy.org> Author: stefan Date: 2010-06-26 13:53:11 -0500 (Sat, 26 Jun 2010) New Revision: 6564 Modified: trunk/scipy/constants/codata.py Log: ENH: Add new CODATA values [patch by Vincent Davis]. Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-06-26 18:53:07 UTC (rev 6563) +++ trunk/scipy/constants/codata.py 2010-06-26 18:53:11 UTC (rev 6564) @@ -1,23 +1,23 @@ -# Compiled by Charles Harris -# Taken from his email message to scipy-dev -# dated October 3, 2002 +# Compiled by Charles Harris, dated October 3, 2002 +# updated to 2002 values by BasSw, 2006 +# Updated to 2006 values by Vincent Davis June 2010 -# updated to 2002 values by BasSw, 2006 """ Fundamental Physical Constants These constants are taken from CODATA Recommended Values of the - Fundamental Physical Constants: 2002. They may be found at - physics.nist.gov/constants. The values are stored in the dictionary - physical_constants as a tuple containing the value, the units, and - the relative precision, in that order. All constants are in SI units - unless otherwise stated. + Fundamental Physical Constants. They may be found at + http://physics.nist.gov/cuu/Constants/index.html + The values are stored in the dictionary physical_constants as a tuple + containing the value, the units, and the relative precision, in that order. + All constants are in SI units unless otherwise stated. + Several helper functions are provided: - value(key) returns the value of the physical constant. - unit(key) returns the units of the physical constant. - precision(key) returns the relative precision of the physical constant. - find(sub) prints out a list of keys containing the string sub. + value(key) : returns the value of the physical constant. + unit(key) : returns the units of the physical constant. + precision(key) : returns the relative precision of the physical constant. + find(sub) : prints a list of keys containing the string sub, Defualt is all. """ import warnings @@ -25,336 +25,364 @@ from math import pi, sqrt __all__ = ['physical_constants', 'value', 'unit', 'precision', 'find'] - """ -From: http://physics.nist.gov/constants +Website: http://physics.nist.gov/cuu/Constants/index.html -Source: Peter J. Mohr and Barry N. Taylor, CODATA Recommended Values of the - Fundamental Physical Constants: 2002, published in Rev. Mod. Phys. - vol. 77(1) 1-107 (2005). +Source: Source of the CODATA internationally recommended values + The values of the constants provided at this site are recommended for + international use by CODATA and are the latest available. Termed the + "2006 CODATA recommended values," they are generally recognized + worldwide for use in all fields of science and technology. The values + became available in March 2007 and replaced the 2002 CODATA set. They + are based on all of the data available through 31 December 2006. The + 2006 adjustment was carried out under the auspices of the CODATA Task + Group on Fundamental Constants. Also available is an Introduction to + the constants for nonexperts. - +bibliography: This bibliography gives citations for the most important + theoretical and experimental publications relevant to the + fundamental constants and closely related precision measurements + published since the mid 1980s, but also including many older + papers of particular interest, some of which date back to the + 1800s. +""" +""" Quantity Value Uncertainty Unit """ -txt = """speed of light in vacuum 299 792 458 0 m s^-1 -magn. constant 12.566 370 614...e-7 0 N A^-2 -electric constant 8.854 187 817...e-12 0 F m^-1 -characteristic impedance of vacuum 376.730 313 461... 0 ohm -Newtonian constant of gravitation 6.6742e-11 0.0010e-11 m^3 kg^-1 s^-2 -Newtonian constant of gravitation over h-bar c 6.7087e-39 0.0010e-39 (GeV/c^2)^-2 -Planck constant 6.626 0693e-34 0.000 0011e-34 J s -Planck constant in eV s 4.135 667 43e-15 0.000 000 35e-15 eV s -Planck constant over 2 pi times c in MeV fm 197.326 968 0.000 017 MeV fm -Planck constant over 2 pi 1.054 571 68e-34 0.000 000 18e-34 J s -Planck constant over 2 pi in eV s 6.582 119 15e-16 0.000 000 56e-16 eV s -Planck mass 2.176 45e-8 0.000 16e-8 kg -Planck temperature 1.416 79e32 0.000 11e32 K -Planck length 1.616 24e-35 0.000 12e-35 m -Planck time 5.391 21e-44 0.000 40e-44 s -elementary charge 1.602 176 53e-19 0.000 000 14e-19 C -elementary charge over h 2.417 989 40e14 0.000 000 21e14 A J^-1 -magn. flux quantum 2.067 833 72e-15 0.000 000 18e-15 Wb -conductance quantum 7.748 091 733e-5 0.000 000 026e-5 S -inverse of conductance quantum 12 906.403 725 0.000 043 ohm -Josephson constant 483 597.879e9 0.041e9 Hz V^-1 -von Klitzing constant 25 812.807 449 0.000 086 ohm -Bohr magneton 927.400 949e-26 0.000 080e-26 J T^-1 -Bohr magneton in eV/T 5.788 381 804e-5 0.000 000 039e-5 eV T^-1 -Bohr magneton in Hz/T 13.996 2458e9 0.000 0012e9 Hz T^-1 -Bohr magneton in inverse meters per tesla 46.686 4507 0.000 0040 m^-1 T^-1 +txt2006 = """lattice spacing of silicon 192.015 5762 e-12 0.000 0050 e-12 m +alpha particle-electron mass ratio 7294.299 5365 0.000 0031 +alpha particle mass 6.644 656 20 e-27 0.000 000 33 e-27 kg +alpha particle mass energy equivalent 5.971 919 17 e-10 0.000 000 30 e-10 J +alpha particle mass energy equivalent in MeV 3727.379 109 0.000 093 MeV +alpha particle mass in u 4.001 506 179 127 0.000 000 000 062 u +alpha particle molar mass 4.001 506 179 127 e-3 0.000 000 000 062 e-3 kg mol^-1 +alpha particle-proton mass ratio 3.972 599 689 51 0.000 000 000 41 +Angstrom star 1.000 014 98 e-10 0.000 000 90 e-10 m +atomic mass constant 1.660 538 782 e-27 0.000 000 083 e-27 kg +atomic mass constant energy equivalent 1.492 417 830 e-10 0.000 000 074 e-10 J +atomic mass constant energy equivalent in MeV 931.494 028 0.000 023 MeV +atomic mass unit-electron volt relationship 931.494 028 e6 0.000 023 e6 eV +atomic mass unit-hartree relationship 3.423 177 7149 e7 0.000 000 0049 e7 E_h +atomic mass unit-hertz relationship 2.252 342 7369 e23 0.000 000 0032 e23 Hz +atomic mass unit-inverse meter relationship 7.513 006 671 e14 0.000 000 011 e14 m^-1 +atomic mass unit-joule relationship 1.492 417 830 e-10 0.000 000 074 e-10 J +atomic mass unit-kelvin relationship 1.080 9527 e13 0.000 0019 e13 K +atomic mass unit-kilogram relationship 1.660 538 782 e-27 0.000 000 083 e-27 kg +atomic unit of 1st hyperpolarizability 3.206 361 533 e-53 0.000 000 081 e-53 C^3 m^3 J^-2 +atomic unit of 2nd hyperpolarizability 6.235 380 95 e-65 0.000 000 31 e-65 C^4 m^4 J^-3 +atomic unit of action 1.054 571 628 e-34 0.000 000 053 e-34 J s +atomic unit of charge 1.602 176 487 e-19 0.000 000 040 e-19 C +atomic unit of charge density 1.081 202 300 e12 0.000 000 027 e12 C m^-3 +atomic unit of current 6.623 617 63 e-3 0.000 000 17 e-3 A +atomic unit of electric dipole mom. 8.478 352 81 e-30 0.000 000 21 e-30 C m +atomic unit of electric field 5.142 206 32 e11 0.000 000 13 e11 V m^-1 +atomic unit of electric field gradient 9.717 361 66 e21 0.000 000 24 e21 V m^-2 +atomic unit of electric polarizability 1.648 777 2536 e-41 0.000 000 0034 e-41 C^2 m^2 J^-1 +atomic unit of electric potential 27.211 383 86 0.000 000 68 V +atomic unit of electric quadrupole mom. 4.486 551 07 e-40 0.000 000 11 e-40 C m^2 +atomic unit of energy 4.359 743 94 e-18 0.000 000 22 e-18 J +atomic unit of force 8.238 722 06 e-8 0.000 000 41 e-8 N +atomic unit of length 0.529 177 208 59 e-10 0.000 000 000 36 e-10 m +atomic unit of mag. dipole mom. 1.854 801 830 e-23 0.000 000 046 e-23 J T^-1 +atomic unit of mag. flux density 2.350 517 382 e5 0.000 000 059 e5 T +atomic unit of magnetizability 7.891 036 433 e-29 0.000 000 027 e-29 J T^-2 +atomic unit of mass 9.109 382 15 e-31 0.000 000 45 e-31 kg +atomic unit of momentum 1.992 851 565 e-24 0.000 000 099 e-24 kg m s^-1 +atomic unit of permittivity 1.112 650 056... e-10 (exact) F m^-1 +atomic unit of time 2.418 884 326 505 e-17 0.000 000 000 016 e-17 s +atomic unit of velocity 2.187 691 2541 e6 0.000 000 0015 e6 m s^-1 +Avogadro constant 6.022 141 79 e23 0.000 000 30 e23 mol^-1 +Bohr magneton 927.400 915 e-26 0.000 023 e-26 J T^-1 +Bohr magneton in eV/T 5.788 381 7555 e-5 0.000 000 0079 e-5 eV T^-1 +Bohr magneton in Hz/T 13.996 246 04 e9 0.000 000 35 e9 Hz T^-1 +Bohr magneton in inverse meters per tesla 46.686 4515 0.000 0012 m^-1 T^-1 Bohr magneton in K/T 0.671 7131 0.000 0012 K T^-1 -nuclear magneton 5.050 783 43e-27 0.000 000 43e-27 J T^-1 -nuclear magneton in eV/T 3.152 451 259e-8 0.000 000 021e-8 eV T^-1 -nuclear magneton in MHz/T 7.622 593 71 0.000 000 65 MHz T^-1 -nuclear magneton in inverse meters per tesla 2.542 623 58e-2 0.000 000 22e-2 m^-1 T^-1 -nuclear magneton in K/T 3.658 2637e-4 0.000 0064e-4 K T^-1 -fine-structure constant 7.297 352 568e-3 0.000 000 024e-3 -inverse fine-structure constant 137.035 999 11 0.000 000 46 -Rydberg constant 10 973 731.568 525 0.000 073 m^-1 -Rydberg constant times c in Hz 3.289 841 960 360e15 0.000 000 000 022e15 Hz -Rydberg constant times hc in J 2.179 872 09e-18 0.000 000 37e-18 J -Rydberg constant times hc in eV 13.605 6923 0.000 0012 eV -Bohr radius 0.529 177 2108e-10 0.000 000 0018e-10 m -Hartree energy 4.359 744 17e-18 0.000 000 75e-18 J -Hartree energy in eV 27.211 3845 0.000 0023 eV -quantum of circulation 3.636 947 550e-4 0.000 000 024e-4 m^2 s^-1 -quantum of circulation times 2 7.273 895 101e-4 0.000 000 048e-4 m^2 s^-1 -Fermi coupling constant 1.166 39e-5 0.000 01e-5 GeV^-2 -weak mixing angle 0.222 15 0.000 76 -electron mass 9.109 3826e-31 0.000 0016e-31 kg -electron mass in u 5.485 799 0945e-4 0.000 000 0024e-4 u -electron mass energy equivalent 8.187 1047e-14 0.000 0014e-14 J -electron mass energy equivalent in MeV 0.510 998 918 0.000 000 044 MeV -electron-muon mass ratio 4.836 331 67e-3 0.000 000 13e-3 -electron-tau mass ratio 2.875 64e-4 0.000 47e-4 -electron-proton mass ratio 5.446 170 2173e-4 0.000 000 0025e-4 -electron-neutron mass ratio 5.438 673 4481e-4 0.000 000 0038e-4 -electron-deuteron mass ratio 2.724 437 1095e-4 0.000 000 0013e-4 -electron to alpha particle mass ratio 1.370 933 555 75e-4 0.000 000 000 61e-4 -electron charge to mass quotient -1.758 820 12e11 0.000 000 15e11 C kg^-1 -electron molar mass 5.485 799 0945e-7 0.000 000 0024e-7 kg mol^-1 -Compton wavelength 2.426 310 238e-12 0.000 000 016e-12 m -Compton wavelength over 2 pi 386.159 2678e-15 0.000 0026e-15 m -classical electron radius 2.817 940 325e-15 0.000 000 028e-15 m -Thomson cross section 0.665 245 873e-28 0.000 000 013e-28 m^2 -electron magn. moment -928.476 412e-26 0.000 080e-26 J T^-1 -electron magn. moment to Bohr magneton ratio -1.001 159 652 1859 0.000 000 000 0038 -electron magn. moment to nuclear magneton ratio -1838.281 971 07 0.000 000 85 -electron magn. moment anomaly 1.159 652 1859e-3 0.000 000 0038e-3 -electron g factor -2.002 319 304 3718 0.000 000 000 0075 -electron-muon magn. moment ratio 206.766 9894 0.000 0054 -electron-proton magn. moment ratio -658.210 6862 0.000 0066 -electron to shielded proton magn. moment ratio -658.227 5956 0.000 0071 -electron-neutron magn. moment ratio 960.920 50 0.000 23 -electron-deuteron magn. moment ratio -2143.923 493 0.000 023 -electron to shielded helion magn. moment ratio 864.058 255 0.000 010 -electron gyromagn. ratio 1.760 859 74e11 0.000 000 15e11 s^-1 T^-1 -electron gyromagn. ratio over 2 pi 28 024.9532 0.0024 MHz T^-1 -muon mass 1.883 531 40e-28 0.000 000 33e-28 kg -muon mass in u 0.113 428 9264 0.000 000 0030 u -muon mass energy equivalent 1.692 833 60e-11 0.000 000 29e-11 J -muon mass energy equivalent in MeV 105.658 3692 0.000 0094 MeV -muon-electron mass ratio 206.768 2838 0.000 0054 -muon-tau mass ratio 5.945 92e-2 0.000 97e-2 -muon-proton mass ratio 0.112 609 5269 0.000 000 0029 -muon-neutron mass ratio 0.112 454 5175 0.000 000 0029 -muon molar mass 0.113 428 9264e-3 0.000 000 0030e-3 kg mol^-1 -muon Compton wavelength 11.734 441 05e-15 0.000 000 30e-15 m -muon Compton wavelength over 2 pi 1.867 594 298e-15 0.000 000 047e-15 m -muon magn. moment -4.490 447 99e-26 0.000 000 40e-26 J T^-1 -muon magn. moment to Bohr magneton ratio -4.841 970 45e-3 0.000 000 13e-3 -muon magn. moment to nuclear magneton ratio -8.890 596 98 0.000 000 23 -muon magn. moment anomaly 1.165 919 81e-3 0.000 000 62e-3 -muon g factor -2.002 331 8396 0.000 000 0012 -muon-proton magn. moment ratio -3.183 345 118 0.000 000 089 -tau mass 3.167 77e-27 0.000 52e-27 kg +Bohr radius 0.529 177 208 59 e-10 0.000 000 000 36 e-10 m +Boltzmann constant 1.380 6504 e-23 0.000 0024 e-23 J K^-1 +Boltzmann constant in eV/K 8.617 343 e-5 0.000 015 e-5 eV K^-1 +Boltzmann constant in Hz/K 2.083 6644 e10 0.000 0036 e10 Hz K^-1 +Boltzmann constant in inverse meters per kelvin 69.503 56 0.000 12 m^-1 K^-1 +characteristic impedance of vacuum 376.730 313 461... (exact) ohm +classical electron radius 2.817 940 2894 e-15 0.000 000 0058 e-15 m +Compton wavelength 2.426 310 2175 e-12 0.000 000 0033 e-12 m +Compton wavelength over 2 pi 386.159 264 59 e-15 0.000 000 53 e-15 m +conductance quantum 7.748 091 7004 e-5 0.000 000 0053 e-5 S +conventional value of Josephson constant 483 597.9 e9 (exact) Hz V^-1 +conventional value of von Klitzing constant 25 812.807 (exact) ohm +Cu x unit 1.002 076 99 e-13 0.000 000 28 e-13 m +deuteron-electron mag. mom. ratio -4.664 345 537 e-4 0.000 000 039 e-4 +deuteron-electron mass ratio 3670.482 9654 0.000 0016 +deuteron g factor 0.857 438 2308 0.000 000 0072 +deuteron mag. mom. 0.433 073 465 e-26 0.000 000 011 e-26 J T^-1 +deuteron mag. mom. to Bohr magneton ratio 0.466 975 4556 e-3 0.000 000 0039 e-3 +deuteron mag. mom. to nuclear magneton ratio 0.857 438 2308 0.000 000 0072 +deuteron mass 3.343 583 20 e-27 0.000 000 17 e-27 kg +deuteron mass energy equivalent 3.005 062 72 e-10 0.000 000 15 e-10 J +deuteron mass energy equivalent in MeV 1875.612 793 0.000 047 MeV +deuteron mass in u 2.013 553 212 724 0.000 000 000 078 u +deuteron molar mass 2.013 553 212 724 e-3 0.000 000 000 078 e-3 kg mol^-1 +deuteron-neutron mag. mom. ratio -0.448 206 52 0.000 000 11 +deuteron-proton mag. mom. ratio 0.307 012 2070 0.000 000 0024 +deuteron-proton mass ratio 1.999 007 501 08 0.000 000 000 22 +deuteron rms charge radius 2.1402 e-15 0.0028 e-15 m +electric constant 8.854 187 817... e-12 (exact) F m^-1 +electron charge to mass quotient -1.758 820 150 e11 0.000 000 044 e11 C kg^-1 +electron-deuteron mag. mom. ratio -2143.923 498 0.000 018 +electron-deuteron mass ratio 2.724 437 1093 e-4 0.000 000 0012 e-4 +electron g factor -2.002 319 304 3622 0.000 000 000 0015 +electron gyromag. ratio 1.760 859 770 e11 0.000 000 044 e11 s^-1 T^-1 +electron gyromag. ratio over 2 pi 28 024.953 64 0.000 70 MHz T^-1 +electron mag. mom. -928.476 377 e-26 0.000 023 e-26 J T^-1 +electron mag. mom. anomaly 1.159 652 181 11 e-3 0.000 000 000 74 e-3 +electron mag. mom. to Bohr magneton ratio -1.001 159 652 181 11 0.000 000 000 000 74 +electron mag. mom. to nuclear magneton ratio -1838.281 970 92 0.000 000 80 +electron mass 9.109 382 15 e-31 0.000 000 45 e-31 kg +electron mass energy equivalent 8.187 104 38 e-14 0.000 000 41 e-14 J +electron mass energy equivalent in MeV 0.510 998 910 0.000 000 013 MeV +electron mass in u 5.485 799 0943 e-4 0.000 000 0023 e-4 u +electron molar mass 5.485 799 0943 e-7 0.000 000 0023 e-7 kg mol^-1 +electron-muon mag. mom. ratio 206.766 9877 0.000 0052 +electron-muon mass ratio 4.836 331 71 e-3 0.000 000 12 e-3 +electron-neutron mag. mom. ratio 960.920 50 0.000 23 +electron-neutron mass ratio 5.438 673 4459 e-4 0.000 000 0033 e-4 +electron-proton mag. mom. ratio -658.210 6848 0.000 0054 +electron-proton mass ratio 5.446 170 2177 e-4 0.000 000 0024 e-4 +electron-tau mass ratio 2.875 64 e-4 0.000 47 e-4 +electron to alpha particle mass ratio 1.370 933 555 70 e-4 0.000 000 000 58 e-4 +electron to shielded helion mag. mom. ratio 864.058 257 0.000 010 +electron to shielded proton mag. mom. ratio -658.227 5971 0.000 0072 +electron volt 1.602 176 487 e-19 0.000 000 040 e-19 J +electron volt-atomic mass unit relationship 1.073 544 188 e-9 0.000 000 027 e-9 u +electron volt-hartree relationship 3.674 932 540 e-2 0.000 000 092 e-2 E_h +electron volt-hertz relationship 2.417 989 454 e14 0.000 000 060 e14 Hz +electron volt-inverse meter relationship 8.065 544 65 e5 0.000 000 20 e5 m^-1 +electron volt-joule relationship 1.602 176 487 e-19 0.000 000 040 e-19 J +electron volt-kelvin relationship 1.160 4505 e4 0.000 0020 e4 K +electron volt-kilogram relationship 1.782 661 758 e-36 0.000 000 044 e-36 kg +elementary charge 1.602 176 487 e-19 0.000 000 040 e-19 C +elementary charge over h 2.417 989 454 e14 0.000 000 060 e14 A J^-1 +Faraday constant 96 485.3399 0.0024 C mol^-1 +Faraday constant for conventional electric current 96 485.3401 0.0048 C_90 mol^-1 +Fermi coupling constant 1.166 37 e-5 0.000 01 e-5 GeV^-2 +fine-structure constant 7.297 352 5376 e-3 0.000 000 0050 e-3 +first radiation constant 3.741 771 18 e-16 0.000 000 19 e-16 W m^2 +first radiation constant for spectral radiance 1.191 042 759 e-16 0.000 000 059 e-16 W m^2 sr^-1 +hartree-atomic mass unit relationship 2.921 262 2986 e-8 0.000 000 0042 e-8 u +hartree-electron volt relationship 27.211 383 86 0.000 000 68 eV +Hartree energy 4.359 743 94 e-18 0.000 000 22 e-18 J +Hartree energy in eV 27.211 383 86 0.000 000 68 eV +hartree-hertz relationship 6.579 683 920 722 e15 0.000 000 000 044 e15 Hz +hartree-inverse meter relationship 2.194 746 313 705 e7 0.000 000 000 015 e7 m^-1 +hartree-joule relationship 4.359 743 94 e-18 0.000 000 22 e-18 J +hartree-kelvin relationship 3.157 7465 e5 0.000 0055 e5 K +hartree-kilogram relationship 4.850 869 34 e-35 0.000 000 24 e-35 kg +helion-electron mass ratio 5495.885 2765 0.000 0052 +helion mass 5.006 411 92 e-27 0.000 000 25 e-27 kg +helion mass energy equivalent 4.499 538 64 e-10 0.000 000 22 e-10 J +helion mass energy equivalent in MeV 2808.391 383 0.000 070 MeV +helion mass in u 3.014 932 2473 0.000 000 0026 u +helion molar mass 3.014 932 2473 e-3 0.000 000 0026 e-3 kg mol^-1 +helion-proton mass ratio 2.993 152 6713 0.000 000 0026 +hertz-atomic mass unit relationship 4.439 821 6294 e-24 0.000 000 0064 e-24 u +hertz-electron volt relationship 4.135 667 33 e-15 0.000 000 10 e-15 eV +hertz-hartree relationship 1.519 829 846 006 e-16 0.000 000 000 010 e-16 E_h +hertz-inverse meter relationship 3.335 640 951... e-9 (exact) m^-1 +hertz-joule relationship 6.626 068 96 e-34 0.000 000 33 e-34 J +hertz-kelvin relationship 4.799 2374 e-11 0.000 0084 e-11 K +hertz-kilogram relationship 7.372 496 00 e-51 0.000 000 37 e-51 kg +inverse fine-structure constant 137.035 999 679 0.000 000 094 +inverse meter-atomic mass unit relationship 1.331 025 0394 e-15 0.000 000 0019 e-15 u +inverse meter-electron volt relationship 1.239 841 875 e-6 0.000 000 031 e-6 eV +inverse meter-hartree relationship 4.556 335 252 760 e-8 0.000 000 000 030 e-8 E_h +inverse meter-hertz relationship 299 792 458 (exact) Hz +inverse meter-joule relationship 1.986 445 501 e-25 0.000 000 099 e-25 J +inverse meter-kelvin relationship 1.438 7752 e-2 0.000 0025 e-2 K +inverse meter-kilogram relationship 2.210 218 70 e-42 0.000 000 11 e-42 kg +inverse of conductance quantum 12 906.403 7787 0.000 0088 ohm +Josephson constant 483 597.891 e9 0.012 e9 Hz V^-1 +joule-atomic mass unit relationship 6.700 536 41 e9 0.000 000 33 e9 u +joule-electron volt relationship 6.241 509 65 e18 0.000 000 16 e18 eV +joule-hartree relationship 2.293 712 69 e17 0.000 000 11 e17 E_h +joule-hertz relationship 1.509 190 450 e33 0.000 000 075 e33 Hz +joule-inverse meter relationship 5.034 117 47 e24 0.000 000 25 e24 m^-1 +joule-kelvin relationship 7.242 963 e22 0.000 013 e22 K +joule-kilogram relationship 1.112 650 056... e-17 (exact) kg +kelvin-atomic mass unit relationship 9.251 098 e-14 0.000 016 e-14 u +kelvin-electron volt relationship 8.617 343 e-5 0.000 015 e-5 eV +kelvin-hartree relationship 3.166 8153 e-6 0.000 0055 e-6 E_h +kelvin-hertz relationship 2.083 6644 e10 0.000 0036 e10 Hz +kelvin-inverse meter relationship 69.503 56 0.000 12 m^-1 +kelvin-joule relationship 1.380 6504 e-23 0.000 0024 e-23 J +kelvin-kilogram relationship 1.536 1807 e-40 0.000 0027 e-40 kg +kilogram-atomic mass unit relationship 6.022 141 79 e26 0.000 000 30 e26 u +kilogram-electron volt relationship 5.609 589 12 e35 0.000 000 14 e35 eV +kilogram-hartree relationship 2.061 486 16 e34 0.000 000 10 e34 E_h +kilogram-hertz relationship 1.356 392 733 e50 0.000 000 068 e50 Hz +kilogram-inverse meter relationship 4.524 439 15 e41 0.000 000 23 e41 m^-1 +kilogram-joule relationship 8.987 551 787... e16 (exact) J +kilogram-kelvin relationship 6.509 651 e39 0.000 011 e39 K +lattice parameter of silicon 543.102 064 e-12 0.000 014 e-12 m +Loschmidt constant (273.15 K, 101.325 kPa) 2.686 7774 e25 0.000 0047 e25 m^-3 +mag. constant 12.566 370 614... e-7 (exact) N A^-2 +mag. flux quantum 2.067 833 667 e-15 0.000 000 052 e-15 Wb +molar gas constant 8.314 472 0.000 015 J mol^-1 K^-1 +molar mass constant 1 e-3 (exact) kg mol^-1 +molar mass of carbon-12 12 e-3 (exact) kg mol^-1 +molar Planck constant 3.990 312 6821 e-10 0.000 000 0057 e-10 J s mol^-1 +molar Planck constant times c 0.119 626 564 72 0.000 000 000 17 J m mol^-1 +molar volume of ideal gas (273.15 K, 100 kPa) 22.710 981 e-3 0.000 040 e-3 m^3 mol^-1 +molar volume of ideal gas (273.15 K, 101.325 kPa) 22.413 996 e-3 0.000 039 e-3 m^3 mol^-1 +molar volume of silicon 12.058 8349 e-6 0.000 0011 e-6 m^3 mol^-1 +Mo x unit 1.002 099 55 e-13 0.000 000 53 e-13 m +muon Compton wavelength 11.734 441 04 e-15 0.000 000 30 e-15 m +muon Compton wavelength over 2 pi 1.867 594 295 e-15 0.000 000 047 e-15 m +muon-electron mass ratio 206.768 2823 0.000 0052 +muon g factor -2.002 331 8414 0.000 000 0012 +muon mag. mom. -4.490 447 86 e-26 0.000 000 16 e-26 J T^-1 +muon mag. mom. anomaly 1.165 920 69 e-3 0.000 000 60 e-3 +muon mag. mom. to Bohr magneton ratio -4.841 970 49 e-3 0.000 000 12 e-3 +muon mag. mom. to nuclear magneton ratio -8.890 597 05 0.000 000 23 +muon mass 1.883 531 30 e-28 0.000 000 11 e-28 kg +muon mass energy equivalent 1.692 833 510 e-11 0.000 000 095 e-11 J +muon mass energy equivalent in MeV 105.658 3668 0.000 0038 MeV +muon mass in u 0.113 428 9256 0.000 000 0029 u +muon molar mass 0.113 428 9256 e-3 0.000 000 0029 e-3 kg mol^-1 +muon-neutron mass ratio 0.112 454 5167 0.000 000 0029 +muon-proton mag. mom. ratio -3.183 345 137 0.000 000 085 +muon-proton mass ratio 0.112 609 5261 0.000 000 0029 +muon-tau mass ratio 5.945 92 e-2 0.000 97 e-2 +natural unit of action 1.054 571 628 e-34 0.000 000 053 e-34 J s +natural unit of action in eV s 6.582 118 99 e-16 0.000 000 16 e-16 eV s +natural unit of energy 8.187 104 38 e-14 0.000 000 41 e-14 J +natural unit of energy in MeV 0.510 998 910 0.000 000 013 MeV +natural unit of length 386.159 264 59 e-15 0.000 000 53 e-15 m +natural unit of mass 9.109 382 15 e-31 0.000 000 45 e-31 kg +natural unit of momentum 2.730 924 06 e-22 0.000 000 14 e-22 kg m s^-1 +natural unit of momentum in MeV/c 0.510 998 910 0.000 000 013 MeV/c +natural unit of time 1.288 088 6570 e-21 0.000 000 0018 e-21 s +natural unit of velocity 299 792 458 (exact) m s^-1 +neutron Compton wavelength 1.319 590 8951 e-15 0.000 000 0020 e-15 m +neutron Compton wavelength over 2 pi 0.210 019 413 82 e-15 0.000 000 000 31 e-15 m +neutron-electron mag. mom. ratio 1.040 668 82 e-3 0.000 000 25 e-3 +neutron-electron mass ratio 1838.683 6605 0.000 0011 +neutron g factor -3.826 085 45 0.000 000 90 +neutron gyromag. ratio 1.832 471 85 e8 0.000 000 43 e8 s^-1 T^-1 +neutron gyromag. ratio over 2 pi 29.164 6954 0.000 0069 MHz T^-1 +neutron mag. mom. -0.966 236 41 e-26 0.000 000 23 e-26 J T^-1 +neutron mag. mom. to Bohr magneton ratio -1.041 875 63 e-3 0.000 000 25 e-3 +neutron mag. mom. to nuclear magneton ratio -1.913 042 73 0.000 000 45 +neutron mass 1.674 927 211 e-27 0.000 000 084 e-27 kg +neutron mass energy equivalent 1.505 349 505 e-10 0.000 000 075 e-10 J +neutron mass energy equivalent in MeV 939.565 346 0.000 023 MeV +neutron mass in u 1.008 664 915 97 0.000 000 000 43 u +neutron molar mass 1.008 664 915 97 e-3 0.000 000 000 43 e-3 kg mol^-1 +neutron-muon mass ratio 8.892 484 09 0.000 000 23 +neutron-proton mag. mom. ratio -0.684 979 34 0.000 000 16 +neutron-proton mass ratio 1.001 378 419 18 0.000 000 000 46 +neutron-tau mass ratio 0.528 740 0.000 086 +neutron to shielded proton mag. mom. ratio -0.684 996 94 0.000 000 16 +Newtonian constant of gravitation 6.674 28 e-11 0.000 67 e-11 m^3 kg^-1 s^-2 +Newtonian constant of gravitation over h-bar c 6.708 81 e-39 0.000 67 e-39 (GeV/c^2)^-2 +nuclear magneton 5.050 783 24 e-27 0.000 000 13 e-27 J T^-1 +nuclear magneton in eV/T 3.152 451 2326 e-8 0.000 000 0045 e-8 eV T^-1 +nuclear magneton in inverse meters per tesla 2.542 623 616 e-2 0.000 000 064 e-2 m^-1 T^-1 +nuclear magneton in K/T 3.658 2637 e-4 0.000 0064 e-4 K T^-1 +nuclear magneton in MHz/T 7.622 593 84 0.000 000 19 MHz T^-1 +Planck constant 6.626 068 96 e-34 0.000 000 33 e-34 J s +Planck constant in eV s 4.135 667 33 e-15 0.000 000 10 e-15 eV s +Planck constant over 2 pi 1.054 571 628 e-34 0.000 000 053 e-34 J s +Planck constant over 2 pi in eV s 6.582 118 99 e-16 0.000 000 16 e-16 eV s +Planck constant over 2 pi times c in MeV fm 197.326 9631 0.000 0049 MeV fm +Planck length 1.616 252 e-35 0.000 081 e-35 m +Planck mass 2.176 44 e-8 0.000 11 e-8 kg +Planck mass energy equivalent in GeV 1.220 892 e19 0.000 061 e19 GeV +Planck temperature 1.416 785 e32 0.000 071 e32 K +Planck time 5.391 24 e-44 0.000 27 e-44 s +proton charge to mass quotient 9.578 833 92 e7 0.000 000 24 e7 C kg^-1 +proton Compton wavelength 1.321 409 8446 e-15 0.000 000 0019 e-15 m +proton Compton wavelength over 2 pi 0.210 308 908 61 e-15 0.000 000 000 30 e-15 m +proton-electron mass ratio 1836.152 672 47 0.000 000 80 +proton g factor 5.585 694 713 0.000 000 046 +proton gyromag. ratio 2.675 222 099 e8 0.000 000 070 e8 s^-1 T^-1 +proton gyromag. ratio over 2 pi 42.577 4821 0.000 0011 MHz T^-1 +proton mag. mom. 1.410 606 662 e-26 0.000 000 037 e-26 J T^-1 +proton mag. mom. to Bohr magneton ratio 1.521 032 209 e-3 0.000 000 012 e-3 +proton mag. mom. to nuclear magneton ratio 2.792 847 356 0.000 000 023 +proton mag. shielding correction 25.694 e-6 0.014 e-6 +proton mass 1.672 621 637 e-27 0.000 000 083 e-27 kg +proton mass energy equivalent 1.503 277 359 e-10 0.000 000 075 e-10 J +proton mass energy equivalent in MeV 938.272 013 0.000 023 MeV +proton mass in u 1.007 276 466 77 0.000 000 000 10 u +proton molar mass 1.007 276 466 77 e-3 0.000 000 000 10 e-3 kg mol^-1 +proton-muon mass ratio 8.880 243 39 0.000 000 23 +proton-neutron mag. mom. ratio -1.459 898 06 0.000 000 34 +proton-neutron mass ratio 0.998 623 478 24 0.000 000 000 46 +proton rms charge radius 0.8768 e-15 0.0069 e-15 m +proton-tau mass ratio 0.528 012 0.000 086 +quantum of circulation 3.636 947 5199 e-4 0.000 000 0050 e-4 m^2 s^-1 +quantum of circulation times 2 7.273 895 040 e-4 0.000 000 010 e-4 m^2 s^-1 +Rydberg constant 10 973 731.568 527 0.000 073 m^-1 +Rydberg constant times c in Hz 3.289 841 960 361 e15 0.000 000 000 022 e15 Hz +Rydberg constant times hc in eV 13.605 691 93 0.000 000 34 eV +Rydberg constant times hc in J 2.179 871 97 e-18 0.000 000 11 e-18 J +Sackur-Tetrode constant (1 K, 100 kPa) -1.151 7047 0.000 0044 +Sackur-Tetrode constant (1 K, 101.325 kPa) -1.164 8677 0.000 0044 +second radiation constant 1.438 7752 e-2 0.000 0025 e-2 m K +shielded helion gyromag. ratio 2.037 894 730 e8 0.000 000 056 e8 s^-1 T^-1 +shielded helion gyromag. ratio over 2 pi 32.434 101 98 0.000 000 90 MHz T^-1 +shielded helion mag. mom. -1.074 552 982 e-26 0.000 000 030 e-26 J T^-1 +shielded helion mag. mom. to Bohr magneton ratio -1.158 671 471 e-3 0.000 000 014 e-3 +shielded helion mag. mom. to nuclear magneton ratio -2.127 497 718 0.000 000 025 +shielded helion to proton mag. mom. ratio -0.761 766 558 0.000 000 011 +shielded helion to shielded proton mag. mom. ratio -0.761 786 1313 0.000 000 0033 +shielded proton gyromag. ratio 2.675 153 362 e8 0.000 000 073 e8 s^-1 T^-1 +shielded proton gyromag. ratio over 2 pi 42.576 3881 0.000 0012 MHz T^-1 +shielded proton mag. mom. 1.410 570 419 e-26 0.000 000 038 e-26 J T^-1 +shielded proton mag. mom. to Bohr magneton ratio 1.520 993 128 e-3 0.000 000 017 e-3 +shielded proton mag. mom. to nuclear magneton ratio 2.792 775 598 0.000 000 030 +speed of light in vacuum 299 792 458 (exact) m s^-1 +standard acceleration of gravity 9.806 65 (exact) m s^-2 +standard atmosphere 101 325 (exact) Pa +Stefan-Boltzmann constant 5.670 400 e-8 0.000 040 e-8 W m^-2 K^-4 +tau Compton wavelength 0.697 72 e-15 0.000 11 e-15 m +tau Compton wavelength over 2 pi 0.111 046 e-15 0.000 018 e-15 m +tau-electron mass ratio 3477.48 0.57 +tau mass 3.167 77 e-27 0.000 52 e-27 kg +tau mass energy equivalent 2.847 05 e-10 0.000 46 e-10 J +tau mass energy equivalent in MeV 1776.99 0.29 MeV tau mass in u 1.907 68 0.000 31 u -tau mass energy equivalent 2.847 05e-10 0.000 46e-10 J -tau mass energy equivalent in MeV 1776.99 0.29 MeV -tau-electron mass ratio 3477.48 0.57 +tau molar mass 1.907 68 e-3 0.000 31 e-3 kg mol^-1 tau-muon mass ratio 16.8183 0.0027 +tau-neutron mass ratio 1.891 29 0.000 31 tau-proton mass ratio 1.893 90 0.000 31 -tau-neutron mass ratio 1.891 29 0.000 31 -tau molar mass 1.907 68e-3 0.000 31e-3 kg mol^-1 -tau Compton wavelength 0.697 72e-15 0.000 11e-15 m -tau Compton wavelength over 2 pi 0.111 046e-15 0.000 018e-15 m -proton mass 1.672 621 71e-27 0.000 000 29e-27 kg -proton mass in u 1.007 276 466 88 0.000 000 000 13 u -proton mass energy equivalent 1.503 277 43e-10 0.000 000 26e-10 J -proton mass energy equivalent in MeV 938.272 029 0.000 080 MeV -proton-electron mass ratio 1836.152 672 61 0.000 000 85 -proton-muon mass ratio 8.880 243 33 0.000 000 23 -proton-tau mass ratio 0.528 012 0.000 086 -proton-neutron mass ratio 0.998 623 478 72 0.000 000 000 58 -proton charge to mass quotient 9.578 833 76e7 0.000 000 82e7 C kg^-1 -proton molar mass 1.007 276 466 88e-3 0.000 000 000 13e-3 kg mol^-1 -proton Compton wavelength 1.321 409 8555e-15 0.000 000 0088e-15 m -proton Compton wavelength over 2 pi 0.210 308 9104e-15 0.000 000 0014e-15 m -proton magn. moment 1.410 606 71e-26 0.000 000 12e-26 J T^-1 -proton magn. moment to Bohr magneton ratio 1.521 032 206e-3 0.000 000 015e-3 -proton magn. moment to nuclear magneton ratio 2.792 847 351 0.000 000 028 -proton g factor 5.585 694 701 0.000 000 056 -proton-neutron magn. moment ratio -1.459 898 05 0.000 000 34 -shielded proton magn. moment 1.410 570 47e-26 0.000 000 12e-26 J T^-1 -shielded proton magn. moment to Bohr magneton ratio 1.520 993 132e-3 0.000 000 016e-3 -shielded proton magn. moment to nuclear magneton ratio 2.792 775 604 0.000 000 030 -proton magn. shielding correction 25.689e-6 0.015e-6 -proton gyromagn. ratio 2.675 222 05e8 0.000 000 23e8 s^-1 T^-1 -proton gyromagn. ratio over 2 pi 42.577 4813 0.000 0037 MHz T^-1 -shielded proton gyromagn. ratio 2.675 153 33e8 0.000 000 23e8 s^-1 T^-1 -shielded proton gyromagn. ratio over 2 pi 42.576 3875 0.000 0037 MHz T^-1 -proton rms charge radius 0.8750e-15 0.0068e-15 m -neutron mass 1.674 927 28e-27 0.000 000 29e-27 kg -neutron mass in u 1.008 664 915 60 0.000 000 000 55 u -neutron mass energy equivalent 1.505 349 57e-10 0.000 000 26e-10 J -neutron mass energy equivalent in MeV 939.565 360 0.000 081 MeV -neutron-electron mass ratio 1838.683 6598 0.000 0013 -neutron-muon mass ratio 8.892 484 02 0.000 000 23 -neutron-tau mass ratio 0.528 740 0.000 086 -neutron-proton mass ratio 1.001 378 418 70 0.000 000 000 58 -neutron molar mass 1.008 664 915 60e-3 0.000 000 000 55e-3 kg mol^-1 -neutron Compton wavelength 1.319 590 9067e-15 0.000 000 0088e-15 m -neutron Compton wavelength over 2 pi 0.210 019 4157e-15 0.000 000 0014e-15 m -neutron magn. moment -0.966 236 45e-26 0.000 000 24e-26 J T^-1 -neutron magn. moment to Bohr magneton ratio -1.041 875 63e-3 0.000 000 25e-3 -neutron magn. moment to nuclear magneton ratio -1.913 042 73 0.000 000 45 -neutron g factor -3.826 085 46 0.000 000 90 -neutron-electron magn. moment ratio 1.040 668 82e-3 0.000 000 25e-3 -neutron-proton magn. moment ratio -0.684 979 34 0.000 000 16 -neutron to shielded proton magn. moment ratio -0.684 996 94 0.000 000 16 -neutron gyromagn. ratio 1.832 471 83e8 0.000 000 46e8 s^-1 T^-1 -neutron gyromagn. ratio over 2 pi 29.164 6950 0.000 0073 MHz T^-1 -deuteron mass 3.343 583 35e-27 0.000 000 57e-27 kg -deuteron mass in u 2.013 553 212 70 0.000 000 000 35 u -deuteron mass energy equivalent 3.005 062 85e-10 0.000 000 51e-10 J -deuteron mass energy equivalent in MeV 1875.612 82 0.000 16 MeV -deuteron-electron mass ratio 3670.482 9652 0.000 0018 -deuteron-proton mass ratio 1.999 007 500 82 0.000 000 000 41 -deuteron molar mass 2.013 553 212 70e-3 0.000 000 000 35e-3 kg mol^-1 -deuteron magn. moment 0.433 073 482e-26 0.000 000 038e-26 J T^-1 -deuteron magn. moment to Bohr magneton ratio 0.466 975 4567e-3 0.000 000 0050e-3 -deuteron magn. moment to nuclear magneton ratio 0.857 438 2329 0.000 000 0092 -deuteron-electron magn. moment ratio -4.664 345 548e-4 0.000 000 050e-4 -deuteron-proton magn. moment ratio 0.307 012 2084 0.000 000 0045 -deuteron-neutron magn. moment ratio -0.448 206 52 0.000 000 11 -deuteron rms charge radius 2.1394e-15 0.0028e-15 m -helion mass 5.006 412 14e-27 0.000 000 86e-27 kg -helion mass in u 3.014 932 2434 0.000 000 0058 u -helion mass energy equivalent 4.499 538 84e-10 0.000 000 77e-10 J -helion mass energy equivalent in MeV 2808.391 42 0.000 24 MeV -helion-electron mass ratio 5495.885 269 0.000 011 -helion-proton mass ratio 2.993 152 6671 0.000 000 0058 -helion molar mass 3.014 932 2434e-3 0.000 000 0058e-3 kg mol^-1 -shielded helion magn. moment -1.074 553 024e-26 0.000 000 093e-26 J T^-1 -shielded helion magn. moment to Bohr magneton ratio -1.158 671 474e-3 0.000 000 014e-3 -shielded helion magn. moment to nuclear magneton ratio -2.127 497 723 0.000 000 025 -shielded helion to proton magn. moment ratio -0.761 766 562 0.000 000 012 -shielded helion to shielded proton magn. moment ratio -0.761 786 1313 0.000 000 0033 -shielded helion gyromagn. ratio 2.037 894 70e8 0.000 000 18e8 s^-1 T^-1 -shielded helion gyromagn. ratio over 2 pi 32.434 1015 0.000 0028 MHz T^-1 -alpha particle mass 6.644 6565e-27 0.000 0011e-27 kg -alpha particle mass in u 4.001 506 179 149 0.000 000 000 056 u -alpha particle mass energy equivalent 5.971 9194e-10 0.000 0010e-10 J -alpha particle mass energy equivalent in MeV 3727.379 17 0.000 32 MeV -alpha particle-electron mass ratio 7294.299 5363 0.000 0032 -alpha particle-proton mass ratio 3.972 599 689 07 0.000 000 000 52 -alpha particle molar mass 4.001 506 179 149e-3 0.000 000 000 056e-3 kg mol^-1 -Avogadro constant 6.022 1415e23 0.000 0010e23 mol^-1 -atomic mass constant 1.660 538 86e-27 0.000 000 28e-27 kg -atomic mass constant energy equivalent 1.492 417 90e-10 0.000 000 26e-10 J -atomic mass constant energy equivalent in MeV 931.494 043 0.000 080 MeV -Faraday constant 96 485.3383 0.0083 C mol^-1 -Faraday constant for conventional electric current 96 485.336 0.016 C_90 mol^-1 -molar Planck constant 3.990 312 716e-10 0.000 000 027e-10 J s mol^-1 -molar Planck constant times c 0.119 626 565 72 0.000 000 000 80 J m mol^-1 -molar gas constant 8.314 472 0.000 015 J mol^-1 K^-1 -Boltzmann constant 1.380 6505e-23 0.000 0024e-23 J K^-1 -Boltzmann constant in eV/K 8.617 343e-5 0.000 015e-5 eV K^-1 -Boltzmann constant in Hz/K 2.083 6644e10 0.000 0036e10 Hz K^-1 -Boltzmann constant in inverse meters per kelvin 69.503 56 0.000 12 m^-1 K^-1 -molar volume of ideal gas (273.15 K, 101.325 kPa) 22.413 996e-3 0.000 039e-3 m^3 mol^-1 -Loschmidt constant (273.15 K, 101.325 kPa) 2.686 7773e25 0.000 0047e25 m^-3 -molar volume of ideal gas (273.15 K, 100 kPa) 22.710 981e-3 0.000 040e-3 m^3 mol^-1 -Sackur-Tetrode constant (1 K, 100 kPa) -1.151 7047 0.000 0044 -Sackur-Tetrode constant (1 K, 101.325 kPa) -1.164 8677 0.000 0044 -Stefan-Boltzmann constant 5.670 400e-8 0.000 040e-8 W m^-2 K^-4 -first radiation constant 3.741 771 38e-16 0.000 000 64e-16 W m^2 -first radiation constant for spectral radiance 1.191 042 82e-16 0.000 000 20e-16 W m^2 sr^-1 -second radiation constant 1.438 7752e-2 0.000 0025e-2 m K -Wien displacement law constant 2.897 7685e-3 0.000 0051e-3 m K -molar mass of carbon-12 12e-3 0 kg mol^-1 -molar mass constant 1e-3 0 kg mol^-1 -conventional value of Josephson constant 483 597.9e9 0 Hz V^-1 -conventional value of von Klitzing constant 25 812.807 0 ohm -standard atmosphere 101 325 0 Pa -standard acceleration of gravity 9.806 65 0 m s^-2 -Cu x unit 1.002 077 10e-13 0.000 000 29e-13 m -Mo x unit 1.002 099 66e-13 0.000 000 53e-13 m -Angstrom star 1.000 015 09e-10 0.000 000 90e-10 m -lattice parameter of silicon 543.102 122e-12 0.000 020e-12 m -{220} lattice spacing of silicon 192.015 5965e-12 0.000 0070e-12 m -molar volume of silicon 12.058 8382e-6 0.000 0024e-6 m^3 mol^-1 -electron volt 1.602 176 53e-19 0.000 000 14e-19 J -unified atomic mass unit 1.660 538 86e-27 0.000 000 28e-27 kg -natural unit of velocity 299 792 458 0 m s^-1 -natural unit of action 1.054 571 68e-34 0.000 000 18e-34 J s -natural unit of action in eV s 6.582 119 15e-16 0.000 000 56e-16 eV s -natural unit of mass 9.109 3826e-31 0.000 0016e-31 kg -natural unit of energy 8.187 1047e-14 0.000 0014e-14 J -natural unit of energy in MeV 0.510 998 918 0.000 000 044 MeV -natural unit of momentum 2.730 924 19e-22 0.000 000 47e-22 kg m s^-1 -natural unit of momentum in MeV/c 0.510 998 918 0.000 000 044 MeV/c -natural unit of length 386.159 2678e-15 0.000 0026e-15 m -natural unit of time 1.288 088 6677e-21 0.000 000 0086e-21 s -atomic unit of charge 1.602 176 53e-19 0.000 000 14e-19 C -atomic unit of mass 9.109 3826e-31 0.000 0016e-31 kg -atomic unit of action 1.054 571 68e-34 0.000 000 18e-34 J s -atomic unit of length 0.529 177 2108e-10 0.000 000 0018e-10 m -atomic unit of energy 4.359 744 17e-18 0.000 000 75e-18 J -atomic unit of time 2.418 884 326 505e-17 0.000 000 000 016e-17 s -atomic unit of force 8.238 7225e-8 0.000 0014e-8 N -atomic unit of velocity 2.187 691 2633e6 0.000 000 0073e6 m s^-1 -atomic unit of momentum 1.992 851 66e-24 0.000 000 34e-24 kg m s^-1 -atomic unit of current 6.623 617 82e-3 0.000 000 57e-3 A -atomic unit of charge density 1.081 202 317e12 0.000 000 093e12 C m^-3 -atomic unit of electric potential 27.211 3845 0.000 0023 V -atomic unit of electric field 5.142 206 42e11 0.000 000 44e11 V m^-1 -atomic unit of electric field gradient 9.717 361 82e21 0.000 000 83e21 V m^-2 -atomic unit of electric dipole moment 8.478 353 09e-30 0.000 000 73e-30 C m -atomic unit of electric quadrupole moment 4.486 551 24e-40 0.000 000 39e-40 C m^2 -atomic unit of electric polarizablity 1.648 777 274e-41 0.000 000 016e-41 C^2 m^2 J^-1 -atomic unit of 1st hyperpolarizablity 3.206 361 51e-53 0.000 000 28e-53 C^3 m^3 J^-2 -atomic unit of 2nd hyperpolarizablity 6.235 3808e-65 0.000 0011e-65 C^4 m^4 J^-3 -atomic unit of magn. flux density 2.350 517 42e5 0.000 000 20e5 T -atomic unit of magn. dipole moment 1.854 801 90e-23 0.000 000 16e-23 J T^-1 -atomic unit of magnetizability 7.891 036 60e-29 0.000 000 13e-29 J T^-2 -atomic unit of permittivity 1.112 650 056...e-10 0 F m^-1 -joule-kilogram relationship 1.112 650 056...e-17 0 kg -joule-inverse meter relationship 5.034 117 20e24 0.000 000 86e24 m^-1 -joule-hertz relationship 1.509 190 37e33 0.000 000 26e33 Hz -joule-kelvin relationship 7.242 963e22 0.000 013e22 K -joule-electron volt relationship 6.241 509 47e18 0.000 000 53e18 eV -joule-atomic mass unit relationship 6.700 5361e9 0.000 0011e9 u -joule-hartree relationship 2.293 712 57e17 0.000 000 39e17 E_h -kilogram-joule relationship 8.987 551 787...e16 0 J -kilogram-inverse meter relationship 4.524 438 91e41 0.000 000 77e41 m^-1 -kilogram-hertz relationship 1.356 392 66e50 0.000 000 23e50 Hz -kilogram-kelvin relationship 6.509 650e39 0.000 011e39 K -kilogram-electron volt relationship 5.609 588 96e35 0.000 000 48e35 eV -kilogram-atomic mass unit relationship 6.022 1415e26 0.000 0010e26 u -kilogram-hartree relationship 2.061 486 05e34 0.000 000 35e34 E_h -inverse meter-joule relationship 1.986 445 61e-25 0.000 000 34e-25 J -inverse meter-kilogram relationship 2.210 218 81e-42 0.000 000 38e-42 kg -inverse meter-hertz relationship 299 792 458 0 Hz -inverse meter-kelvin relationship 1.438 7752e-2 0.000 0025e-2 K -inverse meter-electron volt relationship 1.239 841 91e-6 0.000 000 11e-6 eV -inverse meter-atomic mass unit relationship 1.331 025 0506e-15 0.000 000 0089e-15 u -inverse meter-hartree relationship 4.556 335 252 760e-8 0.000 000 000 030e-8 E_h -hertz-joule relationship 6.626 0693e-34 0.000 0011e-34 J -hertz-kilogram relationship 7.372 4964e-51 0.000 0013e-51 kg -hertz-inverse meter relationship 3.335 640 951...e-9 0 m^-1 -hertz-kelvin relationship 4.799 2374e-11 0.000 0084e-11 K -hertz-electron volt relationship 4.135 667 43e-15 0.000 000 35e-15 eV -hertz-atomic mass unit relationship 4.439 821 667e-24 0.000 000 030e-24 u -hertz-hartree relationship 1.519 829 846 006e-16 0.000 000 000 010e-16 E_h -kelvin-joule relationship 1.380 6505e-23 0.000 0024e-23 J -kelvin-kilogram relationship 1.536 1808e-40 0.000 0027e-40 kg -kelvin-inverse meter relationship 69.503 56 0.000 12 m^-1 -kelvin-hertz relationship 2.083 6644e10 0.000 0036e10 Hz -kelvin-electron volt relationship 8.617 343e-5 0.000 015e-5 eV -kelvin-atomic mass unit relationship 9.251 098e-14 0.000 016e-14 u -kelvin-hartree relationship 3.166 8153e-6 0.000 0055e-6 E_h -electron volt-joule relationship 1.602 176 53e-19 0.000 000 14e-19 J -electron volt-kilogram relationship 1.782 661 81e-36 0.000 000 15e-36 kg -electron volt-inverse meter relationship 8.065 544 45e5 0.000 000 69e5 m^-1 -electron volt-hertz relationship 2.417 989 40e14 0.000 000 21e14 Hz -electron volt-kelvin relationship 1.160 4505e4 0.000 0020e4 K -electron volt-atomic mass unit relationship 1.073 544 171e-9 0.000 000 092e-9 u -electron volt-hartree relationship 3.674 932 45e-2 0.000 000 31e-2 E_h -atomic mass unit-joule relationship 1.492 417 90e-10 0.000 000 26e-10 J -atomic mass unit-kilogram relationship 1.660 538 86e-27 0.000 000 28e-27 kg -atomic mass unit-inverse meter relationship 7.513 006 608e14 0.000 000 050e14 m^-1 -atomic mass unit-hertz relationship 2.252 342 718e23 0.000 000 015e23 Hz -atomic mass unit-kelvin relationship 1.080 9527e13 0.000 0019e13 K -atomic mass unit-electron volt relationship 931.494 043e6 0.000 080e6 eV -atomic mass unit-hartree relationship 3.423 177 686e7 0.000 000 023e7 E_h -hartree-joule relationship 4.359 744 17e-18 0.000 000 75e-18 J -hartree-kilogram relationship 4.850 869 60e-35 0.000 000 83e-35 kg -hartree-inverse meter relationship 2.194 746 313 705e7 0.000 000 000 015e7 m^-1 -hartree-hertz relationship 6.579 683 920 721e15 0.000 000 000 044e15 Hz -hartree-kelvin relationship 3.157 7465e5 0.000 0055e5 K -hartree-electron volt relationship 27.211 3845 0.000 0023 eV -hartree-atomic mass unit relationship 2.921 262 323e-8 0.000 000 019e-8 u""" +Thomson cross section 0.665 245 8558 e-28 0.000 000 0027 e-28 m^2 +triton-electron mag. mom. ratio -1.620 514 423 e-3 0.000 000 021 e-3 +triton-electron mass ratio 5496.921 5269 0.000 0051 +triton g factor 5.957 924 896 0.000 000 076 +triton mag. mom. 1.504 609 361 e-26 0.000 000 042 e-26 J T^-1 +triton mag. mom. to Bohr magneton ratio 1.622 393 657 e-3 0.000 000 021 e-3 +triton mag. mom. to nuclear magneton ratio 2.978 962 448 0.000 000 038 +triton mass 5.007 355 88 e-27 0.000 000 25 e-27 kg +triton mass energy equivalent 4.500 387 03 e-10 0.000 000 22 e-10 J +triton mass energy equivalent in MeV 2808.920 906 0.000 070 MeV +triton mass in u 3.015 500 7134 0.000 000 0025 u +triton molar mass 3.015 500 7134 e-3 0.000 000 0025 e-3 kg mol^-1 +triton-neutron mag. mom. ratio -1.557 185 53 0.000 000 37 +triton-proton mag. mom. ratio 1.066 639 908 0.000 000 010 +triton-proton mass ratio 2.993 717 0309 0.000 000 0025 +unified atomic mass unit 1.660 538 782 e-27 0.000 000 083 e-27 kg +von Klitzing constant 25 812.807 557 0.000 018 ohm +weak mixing angle 0.222 55 0.000 56 +Wien frequency displacement law constant 5.878 933 e10 0.000 010 e10 Hz K^-1 +Wien wavelength displacement law constant 2.897 7685 e-3 0.000 0051 e-3 m K""" - - #parse into a dict physical_constants = {} -for line in txt.split('\n'): - name = line[:55].rstrip().replace('magn.','magnetic') +for line in txt2006.split('\n'): + name = line[:55].rstrip() val = line[55:77].replace(' ','').replace('...','') val = float(val) - uncert = line[77:99].replace(' ','') + uncert = line[77:99].replace(' ','').replace('(exact)', '0') uncert = float(uncert) units = line[99:].rstrip() physical_constants[name] = (val, units, uncert) @@ -443,14 +471,19 @@ """ return physical_constants[key][2] / physical_constants[key][0] - def find(sub, disp=True) : """ - Find the codata.physical_constant keys containing a given string. + Return list of codata.physical_constant keys containing a given string + Deprecation Warning + ------------------- + In Scipy version 0.8.0, the keyword argument 'disp' was added to find(), + with the default value True. In 0.9.0, the default will be False. + Parameters ---------- - sub : str or unicode + sub : str, unicode or defualt=None + defualt, print all keys Sub-string to search keys for disp : bool If True, print the keys that are found, and return None. @@ -471,13 +504,17 @@ warnings.warn("In Scipy version 0.8.0, the keyword argument 'disp' was added to " "find(), with the default value True. In 0.9.0, the default will be False.", DeprecationWarning) - l_sub = string.lower(sub) - result = [] - for key in physical_constants : - l_key = string.lower(key) - if l_sub in l_key: - result.append(key) - result.sort() + if sub==None: + results = physical_constants.keys() + results.sort() + else: + l_sub = string.lower(sub) + result = [] + for key in physical_constants : + l_key = string.lower(key) + if l_sub in l_key: + result.append(key) + result.sort() if disp: for key in result: print key @@ -485,7 +522,6 @@ else: return result - #table is lacking some digits for exact values: calculate from definition c = value('speed of light in vacuum') @@ -493,7 +529,7 @@ epsilon0 = 1/(mu0*c*c) exact_values = { -'magnetic constant': (mu0, 'N A^-2', 0.0), +'mag. constant': (mu0, 'N A^-2', 0.0), 'electric constant': (epsilon0, 'F m^-1', 0.0), 'characteristic impedance of vacuum': (sqrt(mu0/epsilon0), 'ohm', 0.0), 'atomic unit of permittivity': (4*epsilon0*pi, 'F m^-1', 0.0), #is that the definition? From scipy-svn at scipy.org Sat Jun 26 14:53:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 13:53:16 -0500 (CDT) Subject: [Scipy-svn] r6565 - in trunk/scipy/constants: . tests Message-ID: <20100626185316.0D9BD39CB01@scipy.org> Author: stefan Date: 2010-06-26 13:53:16 -0500 (Sat, 26 Jun 2010) New Revision: 6565 Modified: trunk/scipy/constants/codata.py trunk/scipy/constants/tests/test_codata.py Log: ENH: Clean up codata. Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-06-26 18:53:11 UTC (rev 6564) +++ trunk/scipy/constants/codata.py 2010-06-26 18:53:16 UTC (rev 6565) @@ -2,22 +2,26 @@ # updated to 2002 values by BasSw, 2006 # Updated to 2006 values by Vincent Davis June 2010 -""" Fundamental Physical Constants +""" +Fundamental Physical Constants - These constants are taken from CODATA Recommended Values of the - Fundamental Physical Constants. They may be found at - http://physics.nist.gov/cuu/Constants/index.html +These constants are taken from CODATA Recommended Values of the +Fundamental Physical Constants. They may be found at - The values are stored in the dictionary physical_constants as a tuple - containing the value, the units, and the relative precision, in that order. - All constants are in SI units unless otherwise stated. +http://physics.nist.gov/cuu/Constants/index.html - Several helper functions are provided: +The values are stored in the dictionary physical_constants as a tuple +containing the value, the units, and the relative precision, in that +order. All constants are in SI units unless otherwise stated. - value(key) : returns the value of the physical constant. - unit(key) : returns the units of the physical constant. - precision(key) : returns the relative precision of the physical constant. - find(sub) : prints a list of keys containing the string sub, Defualt is all. +Several helper functions are provided: + + value(key) : Returns the value of the physical constant. + unit(key) : Returns the units of the physical constant. + precision(key) : Returns the relative precision of the physical constant. + find(sub) : Prints a list of keys containing the string sub. + If sub is not specified, returns all keys. + """ import warnings @@ -26,25 +30,17 @@ __all__ = ['physical_constants', 'value', 'unit', 'precision', 'find'] """ -Website: http://physics.nist.gov/cuu/Constants/index.html +Source: http://physics.nist.gov/cuu/Constants/index.html -Source: Source of the CODATA internationally recommended values - The values of the constants provided at this site are recommended for - international use by CODATA and are the latest available. Termed the - "2006 CODATA recommended values," they are generally recognized - worldwide for use in all fields of science and technology. The values - became available in March 2007 and replaced the 2002 CODATA set. They - are based on all of the data available through 31 December 2006. The - 2006 adjustment was carried out under the auspices of the CODATA Task - Group on Fundamental Constants. Also available is an Introduction to - the constants for nonexperts. +The values of the constants provided at the above site are recommended +for international use by CODATA and are the latest available. Termed +the "2006 CODATA recommended values", they are generally recognized +worldwide for use in all fields of science and technology. The values +became available in March 2007 and replaced the 2002 CODATA set. They +are based on all of the data available through 31 December 2006. The +2006 adjustment was carried out under the auspices of the CODATA Task +Group on Fundamental Constants. -bibliography: This bibliography gives citations for the most important - theoretical and experimental publications relevant to the - fundamental constants and closely related precision measurements - published since the mid 1980s, but also including many older - papers of particular interest, some of which date back to the - 1800s. """ """ Quantity Value Uncertainty Unit @@ -471,7 +467,7 @@ """ return physical_constants[key][2] / physical_constants[key][0] -def find(sub, disp=True) : +def find(sub=None, disp=True) : """ Return list of codata.physical_constant keys containing a given string @@ -482,9 +478,8 @@ Parameters ---------- - sub : str, unicode or defualt=None - defualt, print all keys - Sub-string to search keys for + sub : str, unicode + Sub-string to search keys for. By default, return all keys. disp : bool If True, print the keys that are found, and return None. Otherwise, return the list of keys without printing anything. @@ -504,17 +499,13 @@ warnings.warn("In Scipy version 0.8.0, the keyword argument 'disp' was added to " "find(), with the default value True. In 0.9.0, the default will be False.", DeprecationWarning) - if sub==None: - results = physical_constants.keys() - results.sort() + if sub is None: + result = physical_constants.keys() else: - l_sub = string.lower(sub) - result = [] - for key in physical_constants : - l_key = string.lower(key) - if l_sub in l_key: - result.append(key) - result.sort() + result = [key for key in physical_constants \ + if sub.lower() in key.lower()] + + result.sort() if disp: for key in result: print key Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2010-06-26 18:53:11 UTC (rev 6564) +++ trunk/scipy/constants/tests/test_codata.py 2010-06-26 18:53:16 UTC (rev 6565) @@ -39,5 +39,12 @@ assert_equal('%d %s' % (codata.c, codata.unit('speed of light in vacuum')), '299792458 m s^-1') +def test_find_all(): + assert len(codata.find(disp=False)) > 300 + +def test_find_single(): + assert_equal(codata.find('Wien freq', disp=False)[0], + 'Wien frequency displacement law constant') + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Sat Jun 26 14:53:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 13:53:19 -0500 (CDT) Subject: [Scipy-svn] r6566 - trunk/scipy/constants Message-ID: <20100626185319.94F8239CB00@scipy.org> Author: stefan Date: 2010-06-26 13:53:19 -0500 (Sat, 26 Jun 2010) New Revision: 6566 Modified: trunk/scipy/constants/constants.py Log: BUG: Fix lookup of Wien wavelength displacement. Modified: trunk/scipy/constants/constants.py =================================================================== --- trunk/scipy/constants/constants.py 2010-06-26 18:53:16 UTC (rev 6565) +++ trunk/scipy/constants/constants.py 2010-06-26 18:53:19 UTC (rev 6566) @@ -68,7 +68,7 @@ N_A = Avogadro = _cd('Avogadro constant') k = Bolzmann = _cd('Boltzmann constant') sigma = Stefan_Bolzmann = _cd('Stefan-Boltzmann constant') -Wien = _cd('Wien displacement law constant') +Wien = _cd('Wien wavelength displacement law constant') Rydberg = _cd('Rydberg constant') #weight in kg From scipy-svn at scipy.org Sun Jun 27 00:19:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 23:19:59 -0500 (CDT) Subject: [Scipy-svn] r6567 - trunk/scipy/sparse/tests Message-ID: <20100627041959.C181139CAEB@scipy.org> Author: stefan Date: 2010-06-26 23:19:59 -0500 (Sat, 26 Jun 2010) New Revision: 6567 Modified: trunk/scipy/sparse/tests/test_base.py Log: ENH: Silence ComplexWarnings during sparse tests. Modified: trunk/scipy/sparse/tests/test_base.py =================================================================== --- trunk/scipy/sparse/tests/test_base.py 2010-06-26 18:53:19 UTC (rev 6566) +++ trunk/scipy/sparse/tests/test_base.py 2010-06-27 04:19:59 UTC (rev 6567) @@ -18,7 +18,7 @@ import numpy as np from numpy import arange, zeros, array, dot, matrix, asmatrix, asarray, \ vstack, ndarray, transpose, diag, kron, inf, conjugate, \ - int8 + int8, ComplexWarning import random from numpy.testing import * @@ -32,6 +32,7 @@ warnings.simplefilter('ignore', SparseEfficiencyWarning) +warnings.simplefilter('ignore', ComplexWarning) #TODO check that spmatrix( ... , copy=X ) is respected From scipy-svn at scipy.org Sun Jun 27 00:20:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 23:20:03 -0500 (CDT) Subject: [Scipy-svn] r6568 - trunk/scipy/constants Message-ID: <20100627042003.BE82139CB17@scipy.org> Author: stefan Date: 2010-06-26 23:20:03 -0500 (Sat, 26 Jun 2010) New Revision: 6568 Modified: trunk/scipy/constants/constants.py Log: ENH: Allow temperature conversion functions to operate on array-like input. Modified: trunk/scipy/constants/constants.py =================================================================== --- trunk/scipy/constants/constants.py 2010-06-27 04:19:59 UTC (rev 6567) +++ trunk/scipy/constants/constants.py 2010-06-27 04:20:03 UTC (rev 6568) @@ -18,6 +18,7 @@ import math as _math from codata import value as _cd +import numpy as np #mathematical constants pi = _math.pi @@ -196,7 +197,7 @@ array([ 233.15, 313.15]) """ - return C + zero_Celsius + return np.asanyarray(C) + zero_Celsius def K2C(K): """ @@ -224,7 +225,7 @@ array([-40., 40.]) """ - return K - zero_Celsius + return np.asanyarray(K) - zero_Celsius def F2C(F): """ @@ -251,7 +252,7 @@ array([-40. , 4.44444444]) """ - return (F - 32) / 1.8 + return (np.asanyarray(F) - 32) / 1.8 def C2F(C): """ @@ -278,7 +279,7 @@ array([ -40., 104.]) """ - return 1.8 * C + 32 + return 1.8 * np.asanyarray(C) + 32 def F2K(F): """ @@ -307,7 +308,7 @@ array([ 233.15, 313.15]) """ - return C2K(F2C(F)) + return C2K(F2C(np.asanyarray(F))) def K2F(K): """ @@ -336,7 +337,7 @@ array([ -40., 104.]) """ - return C2F(K2C(K)) + return C2F(K2C(np.asanyarray(K))) #optics @@ -366,7 +367,7 @@ array([ 2.99792458e+08, 1.00000000e+00]) """ - return c / lambda_ + return np.asanyarray(c) / lambda_ def nu2lambda(nu): """ @@ -394,4 +395,5 @@ array([ 2.99792458e+08, 1.00000000e+00]) """ - return c / nu + return c / np.asanyarray(nu) + From scipy-svn at scipy.org Sun Jun 27 00:20:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 26 Jun 2010 23:20:07 -0500 (CDT) Subject: [Scipy-svn] r6569 - trunk/scipy/constants/tests Message-ID: <20100627042007.B8F7339CAEB@scipy.org> Author: stefan Date: 2010-06-26 23:20:07 -0500 (Sat, 26 Jun 2010) New Revision: 6569 Added: trunk/scipy/constants/tests/test_constants.py Log: ENH: Add basic tests for constants. Added: trunk/scipy/constants/tests/test_constants.py =================================================================== --- trunk/scipy/constants/tests/test_constants.py (rev 0) +++ trunk/scipy/constants/tests/test_constants.py 2010-06-27 04:20:07 UTC (rev 6569) @@ -0,0 +1,30 @@ +from numpy.testing import run_module_suite, assert_equal +import scipy.constants as sc + +def test_fahrenheit_to_celcius(): + assert_equal(sc.F2C(32), 0) + assert_equal(sc.F2C([32, 32]), [0, 0]) + +def test_celcius_to_kelvin(): + assert_equal(sc.C2K([0, 0]), [273.15, 273.15]) + +def test_kelvin_to_celcius(): + assert_equal(sc.K2C([0, 0]), [-273.15, -273.15]) + +def test_fahrenheit_to_kelvin(): + assert_equal(sc.F2K([32, 32]), [273.15, 273.15]) + +def test_kelvin_to_fahrenheit(): + assert_equal(sc.K2F([273.15, 273.15]), [32, 32]) + +def test_celcius_to_fahrenheit(): + assert_equal(sc.C2F([0, 0]), [32, 32]) + +def test_lambda_to_nu(): + assert_equal(sc.lambda2nu(sc.speed_of_light), 1) + +def test_nu_to_lambda(): + assert_equal(sc.nu2lambda(1), sc.speed_of_light) + +if __name__ == "__main__": + run_module_suite() From scipy-svn at scipy.org Sun Jun 27 08:53:15 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 07:53:15 -0500 (CDT) Subject: [Scipy-svn] r6570 - in branches/0.8.x: doc/release scipy/fftpack scipy/fftpack/tests Message-ID: <20100627125315.F27EA39C4B4@scipy.org> Author: ptvirtan Date: 2010-06-27 07:53:15 -0500 (Sun, 27 Jun 2010) New Revision: 6570 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst branches/0.8.x/scipy/fftpack/basic.py branches/0.8.x/scipy/fftpack/tests/test_basic.py Log: BUG: fftpack: use single-precision FFT implementation only for "easy" sizes For large "difficult" sizes, the current single precision implementation apparently falls back to a non-optimal algorithm, and can produce large rounding errors. (bug #1212) This commit provides a work-around, by enabling the single-precision algorithms only for sizes that are composite numbers of 2, 3, and 5, for which FFTPACK has explicit support. This is probably a rather conservative approach. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-27 04:20:07 UTC (rev 6569) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-27 12:53:15 UTC (rev 6570) @@ -83,8 +83,7 @@ --------------------------- New realtransforms have been added, namely dct and idct for Discrete Cosine -Transform; type I, II and III are available, for both single and double -precision. +Transform; type I, II and III are available. Single precision support for fft functions (scipy.fftpack) ---------------------------------------------------------- @@ -92,6 +91,10 @@ fft functions can now handle single precision inputs as well: fft(x) will return a single precision array if x is single precision. +At the moment, for FFT sizes that are not composites of 2, 3, and 5, the +transform is computed internally in double precision to avoid rounding error in +FFTPACK. + Correlation functions now implement the usual definition (scipy.signal) ----------------------------------------------------------------------- Modified: branches/0.8.x/scipy/fftpack/basic.py =================================================================== --- branches/0.8.x/scipy/fftpack/basic.py 2010-06-27 04:20:07 UTC (rev 6569) +++ branches/0.8.x/scipy/fftpack/basic.py 2010-06-27 12:53:15 UTC (rev 6570) @@ -22,22 +22,73 @@ def istype(arr, typeclass): return issubclass(arr.dtype.type, typeclass) +# XXX: single precision FFTs partially disabled due to accuracy issues +# for large prime-sized inputs. +# +# See http://permalink.gmane.org/gmane.comp.python.scientific.devel/13834 +# ("fftpack test failures for 0.8.0b1", Ralf Gommers, 17 Jun 2010, +# @ scipy-dev) +# +# These should be re-enabled once the problems are resolved + +def _is_safe_size(n): + """ + Is the size of FFT such that FFTPACK can handle it in single precision + with sufficient accuracy? + + Composite numbers of 2, 3, and 5 are accepted, as FFTPACK has those + """ + n = int(n) + for c in (2, 3, 5): + while n % c == 0: + n /= c + return (n <= 1) + +def _fake_crfft(x, n, *a, **kw): + if _is_safe_size(n): + return _fftpack.crfft(x, n, *a, **kw) + else: + return _fftpack.zrfft(x, n, *a, **kw).astype(numpy.complex64) + +def _fake_cfft(x, n, *a, **kw): + if _is_safe_size(n): + return _fftpack.cfft(x, n, *a, **kw) + else: + return _fftpack.zfft(x, n, *a, **kw).astype(numpy.complex64) + +def _fake_rfft(x, n, *a, **kw): + if _is_safe_size(n): + return _fftpack.rfft(x, n, *a, **kw) + else: + return _fftpack.drfft(x, n, *a, **kw).astype(numpy.float32) + +def _fake_cfftnd(x, shape, *a, **kw): + if numpy.all(map(_is_safe_size, shape)): + return _fftpack.cfftnd(x, shape, *a, **kw) + else: + return _fftpack.zfftnd(x, shape, *a, **kw).astype(numpy.complex64) + _DTYPE_TO_FFT = { - numpy.dtype(numpy.float32): _fftpack.crfft, +# numpy.dtype(numpy.float32): _fftpack.crfft, + numpy.dtype(numpy.float32): _fake_crfft, numpy.dtype(numpy.float64): _fftpack.zrfft, - numpy.dtype(numpy.complex64): _fftpack.cfft, +# numpy.dtype(numpy.complex64): _fftpack.cfft, + numpy.dtype(numpy.complex64): _fake_cfft, numpy.dtype(numpy.complex128): _fftpack.zfft, } _DTYPE_TO_RFFT = { - numpy.dtype(numpy.float32): _fftpack.rfft, +# numpy.dtype(numpy.float32): _fftpack.rfft, + numpy.dtype(numpy.float32): _fake_rfft, numpy.dtype(numpy.float64): _fftpack.drfft, } _DTYPE_TO_FFTN = { - numpy.dtype(numpy.complex64): _fftpack.cfftnd, +# numpy.dtype(numpy.complex64): _fftpack.cfftnd, + numpy.dtype(numpy.complex64): _fake_cfftnd, numpy.dtype(numpy.complex128): _fftpack.zfftnd, - numpy.dtype(numpy.float32): _fftpack.cfftnd, +# numpy.dtype(numpy.float32): _fftpack.cfftnd, + numpy.dtype(numpy.float32): _fake_cfftnd, numpy.dtype(numpy.float64): _fftpack.zfftnd, } Modified: branches/0.8.x/scipy/fftpack/tests/test_basic.py =================================================================== --- branches/0.8.x/scipy/fftpack/tests/test_basic.py 2010-06-27 04:20:07 UTC (rev 6569) +++ branches/0.8.x/scipy/fftpack/tests/test_basic.py 2010-06-27 12:53:15 UTC (rev 6570) @@ -20,6 +20,25 @@ import numpy as np import numpy.fft +# "large" composite numbers supported by FFTPACK +LARGE_COMPOSITE_SIZES = [ + 2**13, + 2**5 * 3**5, + 2**3 * 3**3 * 5**2, +] +SMALL_COMPOSITE_SIZES = [ + 2, + 2*3*5, + 2*2*3*3, +] +# prime +LARGE_PRIME_SIZES = [ + 2011 +] +SMALL_PRIME_SIZES = [ + 29 +] + from numpy.random import rand def random(size): return rand(*size) @@ -134,7 +153,6 @@ y = fftpack.zrfft(x) assert_array_almost_equal(y,y2) - class TestDoubleFFT(_TestFFTBase): def setUp(self): self.cdt = np.cdouble @@ -145,6 +163,10 @@ self.cdt = np.complex64 self.rdt = np.float32 + @dec.knownfailureif(True, "single-precision FFT implementation is partially disabled, until accuracy issues with large prime powers are resolved") + def test_notice(self): + pass + class _TestIFFTBase(TestCase): def test_definition(self): x = np.array([1,2,3,4+1j,1,2,3,4+2j], self.cdt) @@ -205,6 +227,31 @@ assert_array_almost_equal (y1, x) assert_array_almost_equal (y2, x) + def test_size_accuracy(self): + # Sanity check for the accuracy for prime and non-prime sized inputs + if self.rdt == np.float32: + rtol = 1e-5 + elif self.rdt == np.float64: + rtol = 1e-10 + + for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES: + np.random.seed(1234) + x = np.random.rand(size).astype(self.rdt) + y = ifft(fft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + y = fft(ifft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + + x = (x + 1j*np.random.rand(size)).astype(self.cdt) + y = ifft(fft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + y = fft(ifft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + class TestDoubleIFFT(_TestIFFTBase): def setUp(self): self.cdt = np.cdouble @@ -294,9 +341,28 @@ "Output dtype is %s, expected %s" % (y1.dtype, self.rdt)) self.failUnless(y2.dtype == self.rdt, "Output dtype is %s, expected %s" % (y2.dtype, self.rdt)) - assert_array_almost_equal (y1, x, decimal=self.ndec) - assert_array_almost_equal (y2, x, decimal=self.ndec) + assert_array_almost_equal (y1, x, decimal=self.ndec, + err_msg="size=%d" % size) + assert_array_almost_equal (y2, x, decimal=self.ndec, + err_msg="size=%d" % size) + def test_size_accuracy(self): + # Sanity check for the accuracy for prime and non-prime sized inputs + if self.rdt == np.float32: + rtol = 1e-5 + elif self.rdt == np.float64: + rtol = 1e-10 + + for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES: + np.random.seed(1234) + x = np.random.rand(size).astype(self.rdt) + y = irfft(rfft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + y = rfft(irfft(x)) + self.failUnless(np.linalg.norm(x - y) < rtol*np.linalg.norm(x), + (size, self.rdt)) + # self.ndec is bogus; we should have a assert_array_approx_equal for number of # significant digits class TestIRFFTDouble(_TestIRFFTBase): @@ -331,6 +397,25 @@ y_r = np.array(fftn(x), np.complex64) assert_array_almost_equal_nulp(y, y_r) + def test_size_accuracy(self): + for size in SMALL_COMPOSITE_SIZES + SMALL_PRIME_SIZES: + np.random.seed(1234) + x = np.random.rand(size, size) + 1j*np.random.rand(size, size) + y1 = fftn(x.astype(np.float32)) + y2 = fftn(x.astype(np.float64)).astype(np.complex64) + + self.failUnless(y1.dtype == np.complex64) + assert_array_almost_equal_nulp(y1, y2, 2000) + + for size in LARGE_COMPOSITE_SIZES + LARGE_PRIME_SIZES: + np.random.seed(1234) + x = np.random.rand(size, 3) + 1j*np.random.rand(size, 3) + y1 = fftn(x.astype(np.float32)) + y2 = fftn(x.astype(np.float64)).astype(np.complex64) + + self.failUnless(y1.dtype == np.complex64) + assert_array_almost_equal_nulp(y1, y2, 2000) + class TestFftn(TestCase): def test_definition(self): @@ -513,7 +598,7 @@ class TestIfftnSingle(_TestIfftn): dtype = np.float32 cdtype = np.complex64 - maxnlp = 2000 + maxnlp = 3500 class TestLongDoubleFailure(TestCase): def test_complex(self): From scipy-svn at scipy.org Sun Jun 27 09:11:51 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 08:11:51 -0500 (CDT) Subject: [Scipy-svn] r6571 - in branches/0.8.x: doc/release scipy/optimize scipy/optimize/tests Message-ID: <20100627131151.867B539C4B4@scipy.org> Author: rgommers Date: 2010-06-27 08:11:51 -0500 (Sun, 27 Jun 2010) New Revision: 6571 Modified: branches/0.8.x/doc/release/0.8.0-notes.rst branches/0.8.x/scipy/optimize/minpack.py branches/0.8.x/scipy/optimize/tests/test_minpack.py Log: DOC: Add curve_fit and changes to fsolve/leastsq to release notes. Also add the latter changes to their respective docstrings, and fix some asserts in their tests. Modified: branches/0.8.x/doc/release/0.8.0-notes.rst =================================================================== --- branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-27 12:53:15 UTC (rev 6570) +++ branches/0.8.x/doc/release/0.8.0-notes.rst 2010-06-27 13:11:51 UTC (rev 6571) @@ -62,6 +62,7 @@ Additional deprecations ----------------------- + * linalg: The function `solveh_banded` currently returns a tuple containing the Cholesky factorization and the solution to the linear system. In SciPy 0.9, the return value will be just the solution. @@ -109,6 +110,7 @@ Additions and modification to LTI functions (scipy.signal) ---------------------------------------------------------- + * The functions `impulse2` and `step2` were added to `scipy.signal`. They use the function `scipy.signal.lsim2` to compute the impulse and step response of a system, respectively. @@ -117,6 +119,7 @@ Improved waveform generators (scipy.signal) ------------------------------------------- + Several improvements to the `chirp` function in `scipy.signal` were made: * The waveform generated when `method="logarithmic"` was corrected; it @@ -132,14 +135,25 @@ New functions and other changes in scipy.linalg ----------------------------------------------- + The functions `cho_solve_banded`, `circulant`, `companion`, `hadamard` and `leslie` were added to `scipy.linalg`. The function `block_diag` was enhanced to accept scalar and 1D arguments, along with the usual 2D arguments. +New function and changes in scipy.optimize +------------------------------------------ + +The `curve_fit` function has been added; it takes a function and uses +non-linear least squares to fit that to the provided data. + +The `leastsq` and `fsolve` functions now return an array of size one instead of +a scalar when solving for a single parameter. + New sparse least squares solver ------------------------------- + The `lsqr` function was added to `scipy.sparse`. `This routine `_ finds a least-squares solution to a large, sparse, linear system of equations. @@ -153,6 +167,7 @@ Alternative behavior available for `scipy.constants.find` --------------------------------------------------------- + The keyword argument `disp` was added to the function `scipy.constants.find`, with the default value `True`. When `disp` is `True`, the behavior is the same as in Scipy version 0.7. When `False`, the function returns the list of @@ -168,6 +183,7 @@ Faster matlab file reader and default behavior change ------------------------------------------------------ + We've rewritten the matlab file reader in Cython and it should now read matlab files at around the same speed that Matlab does. @@ -192,11 +208,11 @@ ------------------------------------------- Values of orthogonal polynomials can be evaluated with new vectorized functions -in ``scipy.special``: ``eval_legendre``, ``eval_chebyt``, ``eval_chebyu``, -``eval_chebyc``, ``eval_chebys``, ``eval_jacobi``, ``eval_laguerre``, -``eval_genlaguerre``, ``eval_hermite``, ``eval_hermitenorm``, -``eval_gegenbauer``, ``eval_sh_legendre``, ``eval_sh_chebyt``, -``eval_sh_chebyu``, ``eval_sh_jacobi``. This is faster than constructing the +in `scipy.special`: `eval_legendre`, `eval_chebyt`, `eval_chebyu`, +`eval_chebyc`, `eval_chebys`, `eval_jacobi`, `eval_laguerre`, +`eval_genlaguerre`, `eval_hermite`, `eval_hermitenorm`, +`eval_gegenbauer`, `eval_sh_legendre`, `eval_sh_chebyt`, +`eval_sh_chebyu`, `eval_sh_jacobi`. This is faster than constructing the full coefficient representation of the polynomials, which was previously the only available way. @@ -206,13 +222,13 @@ Lambert W function ------------------ -``scipy.special.lambertw`` can now be used for evaluating the Lambert W +`scipy.special.lambertw` can now be used for evaluating the Lambert W function. Improved hypergeometric 2F1 function ------------------------------------ -Implementation of ``scipy.special.hyp2f1`` for real parameters was revised. +Implementation of `scipy.special.hyp2f1` for real parameters was revised. The new version should produce accurate values for all real parameters. Removed features @@ -230,11 +246,11 @@ arrays is located, while SciPy will house file readers and writers for various data formats (data, audio, video, images, matlab, etc.). -Several functions in ``scipy.io`` are removed in the 0.8.0 release including: -``npfile``, ``save``, ``load``, ``create_module``, ``create_shelf``, -``objload``, ``objsave``, ``fopen``, ``read_array``, ``write_array``, -``fread``, ``fwrite``, ``bswap``, ``packbits``, ``unpackbits``, and -``convert_objectarray``. Some of these functions have been replaced by NumPy's +Several functions in `scipy.io` are removed in the 0.8.0 release including: +`npfile`, `save`, `load`, `create_module`, `create_shelf`, +`objload`, `objsave`, `fopen`, `read_array`, `write_array`, +`fread`, `fwrite`, `bswap`, `packbits`, `unpackbits`, and +`convert_objectarray`. Some of these functions have been replaced by NumPy's raw reading and writing capabilities, memory-mapping capabilities, or array methods. Others have been moved from SciPy to NumPy, since basic array reading and writing capability is now handled by NumPy. Modified: branches/0.8.x/scipy/optimize/minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/minpack.py 2010-06-27 12:53:15 UTC (rev 6570) +++ branches/0.8.x/scipy/optimize/minpack.py 2010-06-27 13:11:51 UTC (rev 6571) @@ -106,6 +106,9 @@ ----- ``fsolve`` is a wrapper around MINPACK's hybrd and hybrj algorithms. + From scipy 0.8.0 `fsolve` returns an array of size one instead of a scalar + when solving for a single parameter. + """ if not warning : msg = "The warning keyword is deprecated. Use the warnings module." @@ -257,6 +260,9 @@ ----- "leastsq" is a wrapper around MINPACK's lmdif and lmder algorithms. + From scipy 0.8.0 `leastsq` returns an array of size one instead of a scalar + when solving for a single parameter. + """ if not warning : msg = "The warning keyword is deprecated. Use the warnings module." Modified: branches/0.8.x/scipy/optimize/tests/test_minpack.py =================================================================== --- branches/0.8.x/scipy/optimize/tests/test_minpack.py 2010-06-27 12:53:15 UTC (rev 6570) +++ branches/0.8.x/scipy/optimize/tests/test_minpack.py 2010-06-27 13:11:51 UTC (rev 6571) @@ -131,8 +131,8 @@ def func(x,a): return x**a popt, pcov = curve_fit(func, self.x, self.y) - assert len(popt)==1 - assert pcov.shape==(1,1) + assert_(len(popt)==1) + assert_(pcov.shape==(1,1)) assert_almost_equal(popt[0], 1.9149, decimal=4) assert_almost_equal(pcov[0,0], 0.0016, decimal=4) @@ -140,8 +140,8 @@ def func(x, a, b): return b*x**a popt, pcov = curve_fit(func, self.x, self.y) - assert len(popt)==2 - assert pcov.shape==(2,2) + assert_(len(popt)==2) + assert_(pcov.shape==(2,2)) assert_array_almost_equal(popt, [1.7989, 1.1642], decimal=4) assert_array_almost_equal(pcov, [[0.0852, -0.1260],[-0.1260, 0.1912]], decimal=4) From scipy-svn at scipy.org Sun Jun 27 09:49:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 08:49:56 -0500 (CDT) Subject: [Scipy-svn] r6572 - trunk/scipy/integrate/tests Message-ID: <20100627134956.D983439C4B4@scipy.org> Author: warren.weckesser Date: 2010-06-27 08:49:56 -0500 (Sun, 27 Jun 2010) New Revision: 6572 Modified: trunk/scipy/integrate/tests/test_integrate.py trunk/scipy/integrate/tests/test_quadpack.py trunk/scipy/integrate/tests/test_quadrature.py Log: TST: Don't use 'import *'. Modified: trunk/scipy/integrate/tests/test_integrate.py =================================================================== --- trunk/scipy/integrate/tests/test_integrate.py 2010-06-27 13:11:51 UTC (rev 6571) +++ trunk/scipy/integrate/tests/test_integrate.py 2010-06-27 13:49:56 UTC (rev 6572) @@ -7,7 +7,7 @@ from numpy import arange, zeros, array, dot, sqrt, cos, sin, eye, pi, exp, \ allclose -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite from scipy.integrate import odeint, ode, complex_ode #------------------------------------------------------------------------------ Modified: trunk/scipy/integrate/tests/test_quadpack.py =================================================================== --- trunk/scipy/integrate/tests/test_quadpack.py 2010-06-27 13:11:51 UTC (rev 6571) +++ trunk/scipy/integrate/tests/test_quadpack.py 2010-06-27 13:49:56 UTC (rev 6572) @@ -1,5 +1,5 @@ from numpy import sqrt, cos, sin, arctan, exp, log, pi, Inf -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite from scipy.integrate import quad, dblquad, tplquad def assert_quad((value, err), tabledValue, errTol=1.5e-8): Modified: trunk/scipy/integrate/tests/test_quadrature.py =================================================================== --- trunk/scipy/integrate/tests/test_quadrature.py 2010-06-27 13:11:51 UTC (rev 6571) +++ trunk/scipy/integrate/tests/test_quadrature.py 2010-06-27 13:49:56 UTC (rev 6572) @@ -1,7 +1,8 @@ import numpy from numpy import cos, sin, pi -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_almost_equal from scipy.integrate import quadrature, romberg, romb, newton_cotes From scipy-svn at scipy.org Sun Jun 27 09:51:05 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 08:51:05 -0500 (CDT) Subject: [Scipy-svn] r6573 - trunk/scipy/signal/tests Message-ID: <20100627135105.E00FE39C4B4@scipy.org> Author: warren.weckesser Date: 2010-06-27 08:51:05 -0500 (Sun, 27 Jun 2010) New Revision: 6573 Modified: trunk/scipy/signal/tests/test_signaltools.py trunk/scipy/signal/tests/test_wavelets.py Log: TST: Don't use 'import *'. Modified: trunk/scipy/signal/tests/test_signaltools.py =================================================================== --- trunk/scipy/signal/tests/test_signaltools.py 2010-06-27 13:49:56 UTC (rev 6572) +++ trunk/scipy/signal/tests/test_signaltools.py 2010-06-27 13:51:05 UTC (rev 6573) @@ -2,7 +2,9 @@ from decimal import Decimal import types -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_almost_equal, assert_array_equal, assert_array_almost_equal, \ + dec import scipy.signal as signal from scipy.signal import lfilter, correlate, convolve, convolve2d, hilbert Modified: trunk/scipy/signal/tests/test_wavelets.py =================================================================== --- trunk/scipy/signal/tests/test_wavelets.py 2010-06-27 13:49:56 UTC (rev 6572) +++ trunk/scipy/signal/tests/test_wavelets.py 2010-06-27 13:51:05 UTC (rev 6573) @@ -1,5 +1,6 @@ import numpy as np -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_array_equal, assert_array_almost_equal, assert_array_less from scipy.signal import wavelets From scipy-svn at scipy.org Sun Jun 27 09:52:46 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 08:52:46 -0500 (CDT) Subject: [Scipy-svn] r6574 - trunk/scipy/linalg/tests Message-ID: <20100627135246.D2EA339C4B4@scipy.org> Author: warren.weckesser Date: 2010-06-27 08:52:46 -0500 (Sun, 27 Jun 2010) New Revision: 6574 Modified: trunk/scipy/linalg/tests/test_atlas_version.py trunk/scipy/linalg/tests/test_basic.py trunk/scipy/linalg/tests/test_blas.py trunk/scipy/linalg/tests/test_fblas.py trunk/scipy/linalg/tests/test_lapack.py trunk/scipy/linalg/tests/test_matfuncs.py trunk/scipy/linalg/tests/test_special_matrices.py Log: TST: Don't use 'import *'. Modified: trunk/scipy/linalg/tests/test_atlas_version.py =================================================================== --- trunk/scipy/linalg/tests/test_atlas_version.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_atlas_version.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -3,8 +3,6 @@ # Created by: Pearu Peterson, October 2003 # -from numpy.testing import * - import scipy.linalg.atlas_version Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_basic.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -25,10 +25,11 @@ float32, zeros_like import numpy.linalg as linalg -from numpy.testing import * +from numpy.testing import TestCase, rand, run_module_suite, assert_raises, \ + assert_equal, assert_almost_equal, assert_array_almost_equal from scipy.linalg import solve, inv, det, lstsq, pinv, pinv2, norm,\ - solve_banded, solveh_banded, cholesky_banded + solve_banded, solveh_banded def random(size): Modified: trunk/scipy/linalg/tests/test_blas.py =================================================================== --- trunk/scipy/linalg/tests/test_blas.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_blas.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -12,7 +12,9 @@ import math -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_almost_equal, assert_array_almost_equal + from scipy.linalg import fblas, cblas Modified: trunk/scipy/linalg/tests/test_fblas.py =================================================================== --- trunk/scipy/linalg/tests/test_fblas.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_fblas.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -10,7 +10,8 @@ zeros, shape, transpose, newaxis, common_type, conjugate from scipy.linalg import fblas -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_array_equal, \ + assert_array_almost_equal #decimal accuracy to require between Python and LAPACK/BLAS calculations Modified: trunk/scipy/linalg/tests/test_lapack.py =================================================================== --- trunk/scipy/linalg/tests/test_lapack.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_lapack.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -3,7 +3,8 @@ # Created by: Pearu Peterson, September 2002 # -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_array_almost_equal from numpy import ones from scipy.linalg import flapack, clapack Modified: trunk/scipy/linalg/tests/test_matfuncs.py =================================================================== --- trunk/scipy/linalg/tests/test_matfuncs.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_matfuncs.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -7,9 +7,8 @@ """ from numpy import array, identity, dot, sqrt -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_array_almost_equal -import scipy.linalg from scipy.linalg import signm, logm, sqrtm, expm, expm2, expm3 Modified: trunk/scipy/linalg/tests/test_special_matrices.py =================================================================== --- trunk/scipy/linalg/tests/test_special_matrices.py 2010-06-27 13:51:05 UTC (rev 6573) +++ trunk/scipy/linalg/tests/test_special_matrices.py 2010-06-27 13:52:46 UTC (rev 6574) @@ -1,7 +1,8 @@ """Tests for functions in special_matrices.py.""" from numpy import arange, add, array, eye, all, copy -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_raises, \ + assert_equal, assert_array_equal from scipy.linalg import toeplitz, hankel, circulant, hadamard, leslie, \ companion, tri, triu, tril, kron, block_diag From scipy-svn at scipy.org Sun Jun 27 11:02:57 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 27 Jun 2010 10:02:57 -0500 (CDT) Subject: [Scipy-svn] r6575 - trunk/scipy/stats/tests Message-ID: <20100627150257.B55BE39CB1C@scipy.org> Author: warren.weckesser Date: 2010-06-27 10:02:57 -0500 (Sun, 27 Jun 2010) New Revision: 6575 Modified: trunk/scipy/stats/tests/test_distributions.py trunk/scipy/stats/tests/test_morestats.py trunk/scipy/stats/tests/test_mstats_basic.py trunk/scipy/stats/tests/test_mstats_extras.py trunk/scipy/stats/tests/test_stats.py Log: TST: Don't use 'import *'. Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2010-06-27 13:52:46 UTC (rev 6574) +++ trunk/scipy/stats/tests/test_distributions.py 2010-06-27 15:02:57 UTC (rev 6575) @@ -2,7 +2,8 @@ """ -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_array_equal, assert_almost_equal, assert_array_almost_equal, rand import numpy @@ -19,7 +20,7 @@ kwds = {'size':N} vals = numpy.sort(dist.rvs(*args,**kwds)) cdfvals = cdf(vals,*args) - q = max(abs(cdfvals-arange(1.0,N+1)/N)) + q = max(abs(cdfvals - np.arange(1.0,N+1)/N)) assert (q < qtest), "Failed q=%f, bound=%f, alpha=%f" % (q, qtest, significance) return @@ -329,13 +330,16 @@ class TestHypergeom(TestCase): def test_precision(self): # comparison number from mpmath + M = 2500 + n = 50 + N = 500 + tot = M + good = n + hgpmf = stats.hypergeom.pmf(2, tot, good, N) - M,n,N = 2500,50,500 - tot=M;good=n;bad=tot-good - hgpmf = stats.hypergeom.pmf(2,tot,good,N) - assert_almost_equal(hgpmf, 0.0010114963068932233, 11) + class TestChi2(TestCase): # regression tests after precision improvements, ticket:1041, not verified def test_precision(self): @@ -380,7 +384,7 @@ assert_array_equal(b, a) assert_array_equal(c, [2] * numpy.size(a)) -import sys + class TestFitMethod(TestCase): skip = ['ncf'] def test_fit(self): Modified: trunk/scipy/stats/tests/test_morestats.py =================================================================== --- trunk/scipy/stats/tests/test_morestats.py 2010-06-27 13:52:46 UTC (rev 6574) +++ trunk/scipy/stats/tests/test_morestats.py 2010-06-27 15:02:57 UTC (rev 6575) @@ -1,7 +1,8 @@ # Author: Travis Oliphant, 2002 # -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_array_equal, \ + assert_almost_equal, assert_array_less, assert_array_almost_equal import scipy.stats as stats Modified: trunk/scipy/stats/tests/test_mstats_basic.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_basic.py 2010-06-27 13:52:46 UTC (rev 6574) +++ trunk/scipy/stats/tests/test_mstats_basic.py 2010-06-27 15:02:57 UTC (rev 6575) @@ -9,7 +9,7 @@ from numpy.ma import masked, nomask import scipy.stats.mstats as mstats -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite from numpy.ma.testutils import assert_equal, assert_almost_equal, \ assert_array_almost_equal Modified: trunk/scipy/stats/tests/test_mstats_extras.py =================================================================== --- trunk/scipy/stats/tests/test_mstats_extras.py 2010-06-27 13:52:46 UTC (rev 6574) +++ trunk/scipy/stats/tests/test_mstats_extras.py 2010-06-27 15:02:57 UTC (rev 6575) @@ -13,7 +13,8 @@ import scipy.stats.mstats as ms #import scipy.stats.mmorestats as mms -from numpy.testing import * +from numpy.testing import TestCase, run_module_suite, assert_equal, \ + assert_almost_equal class TestMisc(TestCase): Modified: trunk/scipy/stats/tests/test_stats.py =================================================================== --- trunk/scipy/stats/tests/test_stats.py 2010-06-27 13:52:46 UTC (rev 6574) +++ trunk/scipy/stats/tests/test_stats.py 2010-06-27 15:02:57 UTC (rev 6575) @@ -6,7 +6,9 @@ """ -from numpy.testing import * +from numpy.testing import TestCase, rand, assert_, assert_equal, \ + assert_almost_equal, assert_array_almost_equal, assert_array_equal, \ + assert_approx_equal, assert_raises, run_module_suite from numpy import array, arange, zeros, ravel, float32, float64, power import numpy as np @@ -1351,7 +1353,6 @@ def test_ttest_1samp_new(): n1, n2, n3 = (10,15,20) rvn1 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3)) - rvn2 = stats.norm.rvs(loc=5,scale=10,size=(n1,n2,n3)) #check multidimensional array and correct axis handling #deterministic rvn1 and rvn2 would be better as in test_ttest_rel @@ -1677,7 +1678,6 @@ np.arange(24).reshape(4,6).T, 4/6.) def test_trim_mean(self): - a = np.arange(11) assert_equal(stats.trim_mean(np.arange(24).reshape(4,6).T, 2/6.), np.array([ 2.5, 8.5, 14.5, 20.5])) assert_equal(stats.trim_mean(np.arange(24).reshape(4,6), 2/6.), From scipy-svn at scipy.org Mon Jun 28 19:14:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 28 Jun 2010 18:14:33 -0500 (CDT) Subject: [Scipy-svn] r6576 - in trunk/scipy/stats: . tests Message-ID: <20100628231433.2982139CAE7@scipy.org> Author: oliphant Date: 2010-06-28 18:14:32 -0500 (Mon, 28 Jun 2010) New Revision: 6576 Modified: trunk/scipy/stats/distributions.py trunk/scipy/stats/tests/test_distributions.py Log: Allow optimizer to be changed in .fit method of distributions. Modified: trunk/scipy/stats/distributions.py =================================================================== --- trunk/scipy/stats/distributions.py 2010-06-27 15:02:57 UTC (rev 6575) +++ trunk/scipy/stats/distributions.py 2010-06-28 23:14:32 UTC (rev 6576) @@ -1626,9 +1626,14 @@ Starting values for the location and scale parameters Special keyword arguments are recognized as holding certain parameters fixed: - f1..fn : hold respective shape paramters fixed - floc : hold location parameter fixed to specified value - fscale : hold scale parameter fixed to specified value + f0..fn : hold respective shape paramters fixed + floc : hold location parameter fixed to specified value + fscale : hold scale parameter fixed to specified value + optimizer : The optimizer to use. The optimizer must take func, + and starting position as the first two arguments, + plus args (for extra arguments to pass to the + function to be optimized) and disp=0 to suppress + output as keyword arguments. Return ------ @@ -1647,7 +1652,19 @@ scale = kwds.get('scale', start[-1]) args += (loc, scale) x0, func, restore, args = self._reduce_func(args, kwds) - vals = optimize.fmin(func,x0,args=(ravel(data),),disp=0) + + optimizer = kwds.get('optimizer', optimize.fmin) + # convert string to function in scipy.optimize + if not callable(optimizer) and isinstance(optimizer, (str, unicode)): + if not optimizer.startswith('fmin_'): + optimizer = "fmin_"+optimizer + if optimizer == 'fmin_': + optimizer = 'fmin' + try: + optimizer = getattr(optimize, optimizer) + except AttributeError: + raise ValueError, "%s is not a valid optimizer" % optimizer + vals = optimizer(func,x0,args=(ravel(data),),disp=0) vals = tuple(vals) if restore is not None: vals = restore(args, vals) Modified: trunk/scipy/stats/tests/test_distributions.py =================================================================== --- trunk/scipy/stats/tests/test_distributions.py 2010-06-27 15:02:57 UTC (rev 6575) +++ trunk/scipy/stats/tests/test_distributions.py 2010-06-28 23:14:32 UTC (rev 6576) @@ -394,10 +394,17 @@ distfunc = getattr(stats, dist) res = distfunc.rvs(*args, **{'size':200}) vals = distfunc.fit(res) + vals2 = distfunc.fit(res, optimizer='powell') + # Only check the length of the return + # FIXME: should check the actual results to see if we are 'close' + # to what was created --- but what is 'close' enough if dist in ['erlang', 'frechet']: assert(len(vals)==len(args)) + assert(len(vals2)==len(args)) else: assert(len(vals) == 2+len(args)) + assert(len(vals2)==2+len(args)) + def test_fix_fit(self): for func, dist, args, alpha in test_all_distributions(): From scipy-svn at scipy.org Mon Jun 28 19:14:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 28 Jun 2010 18:14:49 -0500 (CDT) Subject: [Scipy-svn] r6577 - trunk/scipy/optimize Message-ID: <20100628231449.E294A39CAE7@scipy.org> Author: oliphant Date: 2010-06-28 18:14:49 -0500 (Mon, 28 Jun 2010) New Revision: 6577 Modified: trunk/scipy/optimize/cobyla.py trunk/scipy/optimize/lbfgsb.py trunk/scipy/optimize/slsqp.py trunk/scipy/optimize/tnc.py Log: Make sure all fmin_ optimizers accept the disp= keyword. Modified: trunk/scipy/optimize/cobyla.py =================================================================== --- trunk/scipy/optimize/cobyla.py 2010-06-28 23:14:32 UTC (rev 6576) +++ trunk/scipy/optimize/cobyla.py 2010-06-28 23:14:49 UTC (rev 6577) @@ -11,7 +11,7 @@ import _cobyla from numpy import copy def fmin_cobyla(func, x0, cons, args=(), consargs=None, rhobeg=1.0, rhoend=1e-4, - iprint=1, maxfun=1000): + iprint=1, maxfun=1000, disp=None): """ Minimize a function using the Constrained Optimization BY Linear Approximation (COBYLA) method. @@ -36,7 +36,9 @@ rhoend : Final accuracy in the optimization (not precisely guaranteed). iprint : {0, 1, 2, 3} - Controls the frequency of output; 0 implies no output. + Controls the frequency of output; 0 implies no output. Deprecated + disp : {0, 1, 2, 3} + Over-rides the iprint interface. Preferred. maxfun : int Maximum number of function evaluations. @@ -64,6 +66,9 @@ if consargs is None: consargs = args + if disp is not None: + iprint = disp + def calcfc(x, con): f = func(x, *args) k = 0 Modified: trunk/scipy/optimize/lbfgsb.py =================================================================== --- trunk/scipy/optimize/lbfgsb.py 2010-06-28 23:14:32 UTC (rev 6576) +++ trunk/scipy/optimize/lbfgsb.py 2010-06-28 23:14:49 UTC (rev 6577) @@ -34,7 +34,7 @@ approx_grad=0, bounds=None, m=10, factr=1e7, pgtol=1e-5, epsilon=1e-8, - iprint=-1, maxfun=15000): + iprint=-1, maxfun=15000, disp=None): """ Minimize a function func using the L-BFGS-B algorithm. @@ -78,6 +78,8 @@ calculating the gradient iprint : int Controls the frequency of output. ``iprint < 0`` means no output. + disp : int + If zero, then no output. If positive number, then this over-rides iprint maxfun : int Maximum number of function evaluations. @@ -128,6 +130,12 @@ if len(bounds) != n: raise ValueError('length of x0 != length of bounds') + if disp is not None: + if disp == 0: + iprint = -1 + else: + iprint = disp + if approx_grad: def func_and_grad(x): f = func(x, *args) Modified: trunk/scipy/optimize/slsqp.py =================================================================== --- trunk/scipy/optimize/slsqp.py 2010-06-28 23:14:32 UTC (rev 6576) +++ trunk/scipy/optimize/slsqp.py 2010-06-28 23:14:49 UTC (rev 6577) @@ -55,7 +55,7 @@ def fmin_slsqp( func, x0 , eqcons=[], f_eqcons=None, ieqcons=[], f_ieqcons=None, bounds = [], fprime = None, fprime_eqcons=None, fprime_ieqcons=None, args = (), iter = 100, acc = 1.0E-6, - iprint = 1, full_output = 0, epsilon = _epsilon ): + iprint = 1, disp = None, full_output = 0, epsilon = _epsilon ): """ Minimize a function using Sequential Least SQuares Programming @@ -111,6 +111,8 @@ * iprint <= 0 : Silent operation * iprint == 1 : Print summary upon completion (default) * iprint >= 2 : Print status of each iterate and summary + disp : int + Over-rides the iprint interface (preferred). full_output : bool If False, return only the minimizer of func (default). Otherwise, output final objective function and summary @@ -164,6 +166,9 @@ 7 : "Rank-deficient equality constraint subproblem HFTI", 8 : "Positive directional derivative for linesearch", 9 : "Iteration limit exceeded" } + + if disp is not None: + iprint = disp # Now do a lot of function wrapping Modified: trunk/scipy/optimize/tnc.py =================================================================== --- trunk/scipy/optimize/tnc.py 2010-06-28 23:14:32 UTC (rev 6576) +++ trunk/scipy/optimize/tnc.py 2010-06-28 23:14:49 UTC (rev 6577) @@ -82,7 +82,7 @@ bounds=None, epsilon=1e-8, scale=None, offset=None, messages=MSG_ALL, maxCGit=-1, maxfun=None, eta=-1, stepmx=0, accuracy=0, fmin=0, ftol=-1, xtol=-1, pgtol=-1, - rescale=-1): + rescale=-1, disp=None): """Minimize a function with variables subject to bounds, using gradient information. @@ -118,6 +118,8 @@ Bit mask used to select messages display during minimization values defined in the MSGS dict. Defaults to MGS_ALL. + disp : int + Integer interface to messages. 0 = no message, 5 = all messages maxCGit : int Maximum number of hessian*vector evaluations per main iteration. If maxCGit == 0, the direction chosen is @@ -174,6 +176,10 @@ if len(bounds) != n: raise ValueError('length of x0 != length of bounds') + if disp is not None: + messages = {0:MSG_NONE, 1:MSG_ITER, 2:MSG_INFO, 3:MSG_VERS, + 4:MSG_EXIT, 5:MSG_ALL}.get(disp, MSG_ALL) + if approx_grad: def func_and_grad(x): x = asarray(x) From scipy-svn at scipy.org Tue Jun 29 12:06:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 29 Jun 2010 11:06:45 -0500 (CDT) Subject: [Scipy-svn] r6578 - in trunk/scipy/misc: . tests Message-ID: <20100629160645.3C22E39CAE9@scipy.org> Author: oliphant Date: 2010-06-29 11:06:45 -0500 (Tue, 29 Jun 2010) New Revision: 6578 Modified: trunk/scipy/misc/pilutil.py trunk/scipy/misc/tests/test_pilutil.py Log: Remove duplicate imresize in pilutil.py and merge functionality. Modified: trunk/scipy/misc/pilutil.py =================================================================== --- trunk/scipy/misc/pilutil.py 2010-06-28 23:14:49 UTC (rev 6577) +++ trunk/scipy/misc/pilutil.py 2010-06-29 16:06:45 UTC (rev 6578) @@ -254,16 +254,6 @@ im = im.rotate(angle,resample=func[interp]) return fromimage(im) -def imresize(arr,newsize,interp='bilinear',mode=None): - newsize=list(newsize) - newsize.reverse() - newsize = tuple(newsize) - arr = asarray(arr) - func = {'nearest':0,'bilinear':2,'bicubic':3,'cubic':3} - im = toimage(arr,mode=mode) - im = im.resize(newsize,resample=func[interp]) - return fromimage(im) - def imshow(arr): """Simple showing of an image through an external viewer. """ @@ -284,7 +274,7 @@ if status != 0: raise RuntimeError('Could not execute image viewer.') -def imresize(arr,size): +def imresize(arr, size, interp='bilinear', mode=None): """ Resize an image. @@ -298,6 +288,12 @@ * float - Fraction of current size. * tuple - Size of the output image. + interp : string + interpolation to use for re-sizing ('nearest', 'bilinear', 'bicubic' or 'cubic') + + mode : + mode is the PIL image mode ('P', 'L', etc.) + Returns ------- @@ -305,7 +301,7 @@ The resized array of image. """ - im = toimage(arr) + im = toimage(arr, mode=mode) ts = type(size) if issubdtype(ts,int): size = size / 100.0 @@ -313,7 +309,8 @@ size = (array(im.size)*size).astype(int) else: size = (size[1],size[0]) - imnew = im.resize(size) + func = {'nearest':0,'bilinear':2,'bicubic':3,'cubic':3} + imnew = im.resize(size, resample=func[interp]) return fromimage(imnew) Modified: trunk/scipy/misc/tests/test_pilutil.py =================================================================== --- trunk/scipy/misc/tests/test_pilutil.py 2010-06-28 23:14:49 UTC (rev 6577) +++ trunk/scipy/misc/tests/test_pilutil.py 2010-06-29 16:06:45 UTC (rev 6578) @@ -23,6 +23,16 @@ im1 = pilutil.imresize(im,T(1.1)) assert_equal(im1.shape,(11,22)) + def test_imresize2(self): + im = np.random.random((20,30)) + im2 = pilutil.imresize(im, (30,40), interp='bicubic') + assert_equal(im2.shape, (30,40)) + + def test_imresize3(self): + im = np.random.random((15,30)) + im2 = pilutil.imresize(im, (30,60), interp='nearest') + assert_equal(im2.shape, (30,60)) + def test_bytescale(self): x = np.array([0,1,2],np.uint8) y = np.array([0,1,2]) From scipy-svn at scipy.org Tue Jun 29 19:03:31 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 29 Jun 2010 18:03:31 -0500 (CDT) Subject: [Scipy-svn] r6579 - in trunk/scipy/optimize: . tests Message-ID: <20100629230331.112EA39CB0A@scipy.org> Author: warren.weckesser Date: 2010-06-29 18:03:30 -0500 (Tue, 29 Jun 2010) New Revision: 6579 Modified: trunk/scipy/optimize/tests/test_regression.py trunk/scipy/optimize/zeros.py Log: BUG: Ticket #1214: optimize.newton could return an incorrect value if the function coefficients and initial guess were integers. Modified: trunk/scipy/optimize/tests/test_regression.py =================================================================== --- trunk/scipy/optimize/tests/test_regression.py 2010-06-29 16:06:45 UTC (rev 6578) +++ trunk/scipy/optimize/tests/test_regression.py 2010-06-29 23:03:30 UTC (rev 6579) @@ -1,14 +1,24 @@ """Regression tests for optimize. """ -from numpy.testing import * -import numpy as np +from numpy.testing import TestCase, run_module_suite, assert_almost_equal +import scipy.optimize class TestRegression(TestCase): + def test_newton_x0_is_0(self): """Ticket #1074""" - import scipy.optimize + tgt = 1 res = scipy.optimize.newton(lambda x: x - 1, 0) assert_almost_equal(res, tgt) + + def test_newton_integers(self): + """Ticket #1214""" + root = scipy.optimize.newton(lambda x: x**2 - 1, x0=2, + fprime=lambda x: 2*x) + assert_almost_equal(root, 1.0) + +if __name__ == "__main__": + run_module_suite() \ No newline at end of file Modified: trunk/scipy/optimize/zeros.py =================================================================== --- trunk/scipy/optimize/zeros.py 2010-06-29 16:06:45 UTC (rev 6578) +++ trunk/scipy/optimize/zeros.py 2010-06-29 23:03:30 UTC (rev 6579) @@ -95,7 +95,9 @@ """ if fprime is not None: # Newton-Rapheson method - p0 = x0 + # Multiply by 1.0 to convert to floating point. We don't use float(x0) + # so it still works if x0 is complex. + p0 = 1.0 * x0 for iter in range(maxiter): myargs = (p0,) + args fder = fprime(*myargs)