From scipy-svn at scipy.org Mon Mar 1 07:36:29 2010 From: scipy-svn at scipy.org (Natasha) Date: Mon, 1 Mar 2010 06:36:29 -0600 (CST) Subject: [Scipy-svn] Order status #385694 Message-ID: <20100301123629.DF0AB39CB3F@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Tue Mar 2 11:48:54 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 2 Mar 2010 13:48:54 -0300 Subject: [Scipy-svn] Get hit on more often with Acai Berry Message-ID: <000d01caba28$3e5645e0$6400a8c0@whitakerw> If you have any difficulty viewing this newsletter click here March, 2010 our limited time offer is almost expired, try acai free You received this because you signed up to receive health newsletters. You may choose not to receive promotional messages from us. To unsubscribe,click here. Read our privacy policy. Louis Inman Health Magazine441 8th ActonNY, NY 01412 -------------- next part -------------- An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Tue Mar 2 14:14:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 2 Mar 2010 13:14:21 -0600 (CST) Subject: [Scipy-svn] r6251 - in trunk/scipy/sparse/linalg/isolve: . tests Message-ID: <20100302191421.3EB6B39CAE7@scipy.org> Author: stefan Date: 2010-03-02 13:14:21 -0600 (Tue, 02 Mar 2010) New Revision: 6251 Added: trunk/scipy/sparse/linalg/isolve/lsqr.py trunk/scipy/sparse/linalg/isolve/tests/test_lsqr.py Modified: trunk/scipy/sparse/linalg/isolve/__init__.py Log: ENH: Add LSQR algorithm for solving sparse least squares problems to scipy.sparse. Modified: trunk/scipy/sparse/linalg/isolve/__init__.py =================================================================== --- trunk/scipy/sparse/linalg/isolve/__init__.py 2010-02-24 12:27:43 UTC (rev 6250) +++ trunk/scipy/sparse/linalg/isolve/__init__.py 2010-03-02 19:14:21 UTC (rev 6251) @@ -4,6 +4,7 @@ from iterative import * from minres import minres from lgmres import lgmres +from lsqr import lsqr __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.testing import Tester Added: trunk/scipy/sparse/linalg/isolve/lsqr.py =================================================================== --- trunk/scipy/sparse/linalg/isolve/lsqr.py (rev 0) +++ trunk/scipy/sparse/linalg/isolve/lsqr.py 2010-03-02 19:14:21 UTC (rev 6251) @@ -0,0 +1,495 @@ +"""Sparse Equations and Least Squares. + +The original Fortran code was written by C. C. Paige and M. A. Saunders as +described in + +C. C. Paige and M. A. Saunders, LSQR: An algorithm for sparse linear +equations and sparse least squares, TOMS 8(1), 43--71 (1982). + +C. C. Paige and M. A. Saunders, Algorithm 583; LSQR: Sparse linear +equations and least-squares problems, TOMS 8(2), 195--209 (1982). + +It is licensed under the following BSD license: + +Copyright (c) 2006, Systems Optimization Laboratory +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + + * Neither the name of Stanford University nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +The Fortran code was translated to Python for use in CVXOPT by Jeffery +Kline with contributions by Mridul Aanjaneya and Bob Myhill. + +Adapted for SciPy by Stefan van der Walt. + +""" + +__all__ = ['lsqr'] + +import numpy as np +from math import sqrt +from scipy.sparse.linalg.interface import aslinearoperator + +def _sym_ortho(a,b): + """ + Jeffery Kline noted: I added the routine 'SymOrtho' for numerical + stability. This is recommended by S.-C. Choi in [1]_. It removes + the unpleasant potential of ``1/eps`` in some important places + (see, for example text following "Compute the next + plane rotation Qk" in minres_py). + + References + ---------- + .. [1] S.-C. Choi, "Iterative Methods for Singular Linear Equations + and Least-Squares Problems", Dissertation, + http://www.stanford.edu/group/SOL/dissertations/sou-cheng-choi-thesis.pdf + + """ + aa = abs(a) + ab = abs(b) + if b == 0.: + s = 0. + r = aa + if aa == 0.: + c = 1. + else: + c = a/aa + elif a == 0.: + c = 0. + s = b / ab + r = ab + elif ab >= aa: + sb = 1 + if b < 0: sb=-1 + tau = a/b + s = sb * (1 + tau**2)**-0.5 + c = s * tau + r = b / s + elif aa > ab: + sa = 1 + if a < 0: sa = -1 + tau = b / a + c = sa * (1 + tau**2)**-0.5 + s = c * tau + r = a / c + + return c, s, r + + +def lsqr(A, b, damp=0.0, atol=1e-8, btol=1e-8, conlim=1e8, + iter_lim=None, show=False, calc_var=False): + """Find the least-squares solution to a large, sparse, linear system + of equations. + + The function solves ``Ax = b`` or ``min ||b - Ax||^2`` or + ``min ||Ax - b||^2 + d^2 ||x||^2. + + The matrix A may be square or rectangular (over-determined or + under-determined), and may have any rank. + + :: + + 1. Unsymmetric equations -- solve A*x = b + + 2. Linear least squares -- solve A*x = b + in the least-squares sense + + 3. Damped least squares -- solve ( A )*x = ( b ) + ( damp*I ) ( 0 ) + in the least-squares sense + + Parameters + ---------- + A : {sparse matrix, ndarray, LinearOperatorLinear} + Representation of an mxn matrix. It is required that + the linear operator can produce ``Ax`` and ``A^T x``. + b : (m,) ndarray + Right-hand side vector ``b``. + damp : float + Damping coefficient. + atol, btol : float + Stopping tolerances. If both are 1.0e-9 (say), the final + residual norm should be accurate to about 9 digits. (The + final x will usually have fewer correct digits, depending on + cond(A) and the size of damp.) + conlim : float + Another stopping tolerance. lsqr terminates if an estimate of + ``cond(A)`` exceeds `conlim`. For compatible systems ``Ax = + b``, `conlim` could be as large as 1.0e+12 (say). For + least-squares problems, conlim should be less than 1.0e+8. + Maximum precision can be obtained by setting ``atol = btol = + conlim = zero``, but the number of iterations may then be + excessive. + iter_lim : int + Explicit limitation on number of iterations (for safety). + show : bool + Display an iteration log. + calc_var : bool + Whether to estimate diagonals of ``(A'A + damp^2*I)^{-1}``. + + Returns + ------- + x : ndarray of float + The final solution. + istop : int + Gives the reason for termination. + 1 means x is an approximate solution to Ax = b. + 2 means x approximately solves the least-squares problem. + itn : int + Iteration number upon termination. + r1norm : float + ``norm(r)``, where ``r = b - Ax``. + r2norm : float + ``sqrt( norm(r)^2 + damp^2 * norm(x)^2 )``. Equal to `r1norm` if + ``damp == 0``. + anorm : float + Estimate of Frobenius norm of ``Abar = [[A]; [damp*I]]``. + acond : float + Estimate of ``cond(Abar)``. + arnorm : float + Estimate of ``norm(A'*r - damp^2*x)``. + xnorm : float + ``norm(x)`` + var : ndarray of float + If ``calc_var`` is True, estimates all diagonals of + ``(A'A)^{-1}`` (if ``damp == 0``) or more generally ``(A'A + + damp^2*I)^{-1}``. This is well defined if A has full column + rank or ``damp > 0``. (Not sure what var means if ``rank(A) + < n`` and ``damp = 0.``) + + Notes + ----- + LSQR uses an iterative method to approximate the solution. The + number of iterations required to reach a certain accuracy depends + strongly on the scaling of the problem. Poor scaling of the rows + or columns of A should therefore be avoided where possible. + + For example, in problem 1 the solution is unaltered by + row-scaling. If a row of A is very small or large compared to + the other rows of A, the corresponding row of ( A b ) should be + scaled up or down. + + In problems 1 and 2, the solution x is easily recovered + following column-scaling. Unless better information is known, + the nonzero columns of A should be scaled so that they all have + the same Euclidean norm (e.g., 1.0). + + In problem 3, there is no freedom to re-scale if damp is + nonzero. However, the value of damp should be assigned only + after attention has been paid to the scaling of A. + + The parameter damp is intended to help regularize + ill-conditioned systems, by preventing the true solution from + being very large. Another aid to regularization is provided by + the parameter acond, which may be used to terminate iterations + before the computed solution becomes very large. + + If some initial estimate ``x0`` is known and if ``damp == 0``, + one could proceed as follows: + + 1. Compute a residual vector ``r0 = b - A*x0``. + 2. Use LSQR to solve the system ``A*dx = r0``. + 3. Add the correction dx to obtain a final solution ``x = x0 + dx``. + + This requires that ``x0`` be available before and after the call + to LSQR. To judge the benefits, suppose LSQR takes k1 iterations + to solve A*x = b and k2 iterations to solve A*dx = r0. + If x0 is "good", norm(r0) will be smaller than norm(b). + If the same stopping tolerances atol and btol are used for each + system, k1 and k2 will be similar, but the final solution x0 + dx + should be more accurate. The only way to reduce the total work + is to use a larger stopping tolerance for the second system. + If some value btol is suitable for A*x = b, the larger value + btol*norm(b)/norm(r0) should be suitable for A*dx = r0. + + Preconditioning is another way to reduce the number of iterations. + If it is possible to solve a related system ``M*x = b`` + efficiently, where M approximates A in some helpful way (e.g. M - + A has low rank or its elements are small relative to those of A), + LSQR may converge more rapidly on the system ``A*M(inverse)*z = + b``, after which x can be recovered by solving M*x = z. + + If A is symmetric, LSQR should not be used! + + Alternatives are the symmetric conjugate-gradient method (cg) + and/or SYMMLQ. SYMMLQ is an implementation of symmetric cg that + applies to any symmetric A and will converge more rapidly than + LSQR. If A is positive definite, there are other implementations + of symmetric cg that require slightly less work per iteration than + SYMMLQ (but will take the same number of iterations). + + References + ---------- + .. [1] C. C. Paige and M. A. Saunders (1982a). + "LSQR: An algorithm for sparse linear equations and + sparse least squares", ACM TOMS 8(1), 43-71. + .. [2] C. C. Paige and M. A. Saunders (1982b). + "Algorithm 583. LSQR: Sparse linear equations and least + squares problems", ACM TOMS 8(2), 195-209. + .. [3] M. A. Saunders (1995). "Solution of sparse rectangular + systems using LSQR and CRAIG", BIT 35, 588-604. + + """ + A = aslinearoperator(A) + b = b.squeeze() + + m, n = A.shape + if iter_lim is None: iter_lim = 2 * n + var = np.zeros(n) + + msg=('The exact solution is x = 0 ', + 'Ax - b is small enough, given atol, btol ', + 'The least-squares solution is good enough, given atol ', + 'The estimate of cond(Abar) has exceeded conlim ', + 'Ax - b is small enough for this machine ', + 'The least-squares solution is good enough for this machine', + 'Cond(Abar) seems to be too large for this machine ', + 'The iteration limit has been reached '); + + if show: + print ' ' + print 'LSQR Least-squares solution of Ax = b' + str1 = 'The matrix A has %8g rows and %8g cols' % (m, n) + str2 = 'damp = %20.14e calc_var = %8g' % (damp, calc_var) + str3 = 'atol = %8.2e conlim = %8.2e'%( atol, conlim) + str4 = 'btol = %8.2e iter_lim = %8g' %( btol, iter_lim) + print str1 + print str2 + print str3 + print str4 + + itn = 0 + istop = 0 + nstop = 0 + ctol = 0 + if conlim > 0: ctol = 1/conlim + anorm = 0 + acond = 0 + dampsq = damp**2 + ddnorm = 0 + res2 = 0 + xnorm = 0 + xxnorm = 0 + z = 0 + cs2 = -1 + sn2 = 0 + + """ + Set up the first vectors u and v for the bidiagonalization. + These satisfy beta*u = b, alfa*v = A'u. + """ + __xm = np.zeros(m) # a matrix for temporary holding + __xn = np.zeros(n) # a matrix for temporary holding + v = np.zeros(n) + u = b + x = np.zeros(n) + alfa = 0 + beta = np.linalg.norm(u) + w = np.zeros(n) + + if beta > 0: + u = (1/beta) * u + v = A.rmatvec(u) + alfa = np.linalg.norm(v) + + if alfa > 0: + v = (1/alfa) * v + w = v.copy() + + rhobar = alfa + phibar = beta + bnorm = beta + rnorm = beta + r1norm = rnorm + r2norm = rnorm + + # Reverse the order here from the original matlab code because + # there was an error on return when arnorm==0 + arnorm = alfa * beta + if arnorm == 0: + print msg[0]; + return x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var + + head1 = ' Itn x[0] r1norm r2norm '; + head2 = ' Compatible LS Norm A Cond A'; + + if show: + print ' ' + print head1, head2 + test1 = 1; test2 = alfa / beta; + str1 = '%6g %12.5e' %( itn, x[0] ); + str2 = ' %10.3e %10.3e'%( r1norm, r2norm ); + str3 = ' %8.1e %8.1e' %( test1, test2 ); + print str1, str2, str3 + + # Main iteration loop. + while itn < iter_lim: + itn = itn + 1 + """ + % Perform the next step of the bidiagonalization to obtain the + % next beta, u, alfa, v. These satisfy the relations + % beta*u = a*v - alfa*u, + % alfa*v = A'*u - beta*v. + """ + u = A.matvec(v) - alfa * u + beta = np.linalg.norm(u) + + if beta > 0: + u = (1/beta) * u + anorm = sqrt(anorm**2 + alfa**2 + beta**2 + damp**2) + v = A.rmatvec(u) - beta * v + alfa = np.linalg.norm(v) + if alfa > 0: + v = (1 / alfa) * v + + # Use a plane rotation to eliminate the damping parameter. + # This alters the diagonal (rhobar) of the lower-bidiagonal matrix. + rhobar1 = sqrt(rhobar**2 + damp**2) + cs1 = rhobar / rhobar1 + sn1 = damp / rhobar1 + psi = sn1 * phibar + phibar = cs1 * phibar + + # Use a plane rotation to eliminate the subdiagonal element (beta) + # of the lower-bidiagonal matrix, giving an upper-bidiagonal matrix. + cs, sn, rho = _sym_ortho(rhobar1, beta) + + theta = sn * alfa + rhobar = -cs * alfa + phi = cs * phibar + phibar = sn * phibar + tau = sn * phi + + # Update x and w. + t1 = phi / rho + t2 = -theta / rho + dk = (1 / rho) * w + + x = x + t1 * w + w = v + t2 * w + ddnorm = ddnorm + np.linalg.norm(dk)**2 + + if calc_var: + var = var + dk**2 + + # Use a plane rotation on the right to eliminate the + # super-diagonal element (theta) of the upper-bidiagonal matrix. + # Then use the result to estimate norm(x). + delta = sn2 * rho + gambar = -cs2 * rho + rhs = phi - delta * z + zbar = rhs / gambar + xnorm = sqrt(xxnorm + zbar**2) + gamma = sqrt(gambar**2 +theta**2) + cs2 = gambar / gamma + sn2 = theta / gamma + z = rhs / gamma + xxnorm = xxnorm + z**2 + + # Test for convergence. + # First, estimate the condition of the matrix Abar, + # and the norms of rbar and Abar'rbar. + acond = anorm * sqrt(ddnorm) + res1 = phibar**2 + res2 = res2 + psi**2 + rnorm = sqrt(res1 + res2) + arnorm = alfa * abs(tau) + + # Distinguish between + # r1norm = ||b - Ax|| and + # r2norm = rnorm in current code + # = sqrt(r1norm^2 + damp^2*||x||^2). + # Estimate r1norm from + # r1norm = sqrt(r2norm^2 - damp^2*||x||^2). + # Although there is cancellation, it might be accurate enough. + r1sq = rnorm**2 - dampsq * xxnorm + r1norm = sqrt(abs(r1sq)) + if r1sq < 0: + r1norm = -r1norm + r2norm = rnorm + + # Now use these norms to estimate certain other quantities, + # some of which will be small near a solution. + test1 = rnorm / bnorm + test2 = arnorm / (anorm * rnorm) + test3 = 1 / acond + t1 = test1 / (1 + anorm * xnorm / bnorm) + rtol = btol + atol * anorm * xnorm / bnorm + + # The following tests guard against extremely small values of + # atol, btol or ctol. (The user may have set any or all of + # the parameters atol, btol, conlim to 0.) + # The effect is equivalent to the normal tests using + # atol = eps, btol = eps, conlim = 1/eps. + if itn >= iter_lim: istop = 7 + if 1 + test3 <= 1: istop = 6 + if 1 + test2 <= 1: istop = 5 + if 1 + t1 <= 1: istop = 4 + + # Allow for tolerances set by the user. + if test3 <= ctol: istop = 3 + if test2 <= atol: istop = 2 + if test1 <= rtol: istop = 1 + + # See if it is time to print something. + prnt = False; + if n <= 40: prnt = True + if itn <= 10: prnt = True + if itn >= iter_lim-10: prnt = True + # if itn%10 == 0: prnt = True + if test3 <= 2*ctol: prnt = True + if test2 <= 10*atol: prnt = True + if test1 <= 10*rtol: prnt = True + if istop != 0: prnt = True + + if prnt: + if show: + str1 = '%6g %12.5e' % (itn, x[0]) + str2 = ' %10.3e %10.3e' % (r1norm, r2norm) + str3 = ' %8.1e %8.1e' % (test1, test2) + str4 = ' %8.1e %8.1e' % (anorm, acond) + print str1, str2, str3, str4 + + if istop != 0: break + + # End of iteration loop. + # Print the stopping condition. + if show: + print ' ' + print 'LSQR finished' + print msg[istop] + print ' ' + str1 = 'istop =%8g r1norm =%8.1e' % (istop, r1norm) + str2 = 'anorm =%8.1e arnorm =%8.1e' % (anorm, arnorm) + str3 = 'itn =%8g r2norm =%8.1e' % (itn, r2norm) + str4 = 'acond =%8.1e xnorm =%8.1e' % (acond, xnorm) + print str1+ ' ' + str2 + print str3+ ' ' + str4 + print ' ' + + return x, istop, itn, r1norm, r2norm, anorm, acond, arnorm, xnorm, var Added: trunk/scipy/sparse/linalg/isolve/tests/test_lsqr.py =================================================================== --- trunk/scipy/sparse/linalg/isolve/tests/test_lsqr.py (rev 0) +++ trunk/scipy/sparse/linalg/isolve/tests/test_lsqr.py 2010-03-02 19:14:21 UTC (rev 6251) @@ -0,0 +1,59 @@ +import numpy as np + +from scipy.sparse.linalg import lsqr +from time import time + +# Set up a test problem +n = 35 +G = np.eye(n) +normal = np.random.normal +norm = np.linalg.norm + +for jj in range(5): + gg = normal(size=n) + hh = gg * gg.T + G += (hh + hh.T) * 0.5 + G += normal(size=n) * normal(size=n) + +b = normal(size=n) + +tol = 1e-10 +show = False +maxit = None + +def test_basic(): + svx = np.linalg.solve(G, b) + X = lsqr(G, b, show=show, atol=tol, btol=tol, iter_lim=maxit) + xo = X[0] + assert norm(svx - xo) < 1e-5 + +if __name__ == "__main__": + svx = np.linalg.solve(G, b) + + tic = time() + X = lsqr(G, b, show=show, atol=tol, btol=tol, iter_lim=maxit) + xo = X[0] + phio = X[3] + psio = X[7] + k = X[2] + chio = X[8] + mg = np.amax(G - G.T) + if mg > 1e-14: + sym='No' + else: + sym='Yes' + + print 'LSQR' + print "Is linear operator symmetric? " + sym + print "n: %3g iterations: %3g" % (n, k) + print "Norms computed in %.2fs by LSQR" % (time() - tic) + print " ||x|| %9.4e ||r|| %9.4e ||Ar|| %9.4e " %( chio, phio, psio) + print "Residual norms computed directly:" + print " ||x|| %9.4e ||r|| %9.4e ||Ar|| %9.4e" % (norm(xo), + norm(G*xo - b), + norm(G.T*(G*xo-b))) + print "Direct solution norms:" + print " ||x|| %9.4e ||r|| %9.4e " % (norm(svx), norm(G*svx -b)) + print "" + print " || x_{direct} - x_{LSQR}|| %9.4e " % norm(svx-xo) + print "" From scipy-svn at scipy.org Wed Mar 3 03:17:30 2010 From: scipy-svn at scipy.org (Carson) Date: Wed, 3 Mar 2010 02:17:30 -0600 (CST) Subject: [Scipy-svn] Delivery Status Notification Message-ID: <20100303081730.1527439CBC9@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Wed Mar 3 17:44:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 3 Mar 2010 23:44:40 +0100 Subject: [Scipy-svn] Unmask your excitement Message-ID: <000d01cabb23$1c004670$6400a8c0@boozingph9> Your road to best-priced remedies will be only one click long! Make this click right now and you will get over 400 goods available for express packing to your city, plus discounts on 40 of them, which are by the way the most famous ones! http://cx29.paharawid.cn From scipy-svn at scipy.org Thu Mar 4 16:35:10 2010 From: scipy-svn at scipy.org (Approved VIAGRA® Store) Date: Thu, 4 Mar 2010 15:35:10 -0600 (CST) Subject: [Scipy-svn] Your Future Order with 77% off retail Message-ID: <20100304213510.5106E39CB41@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Sat Mar 6 11:43:56 2010 From: scipy-svn at scipy.org (Cansdian Online Stores) Date: Sat, 6 Mar 2010 10:43:56 -0600 (CST) Subject: [Scipy-svn] Online Shopping Message-ID: <20100306164356.5C83039CBF9@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Sat Mar 6 12:40:17 2010 From: scipy-svn at scipy.org (Authorized Online Shop) Date: Sat, 6 Mar 2010 11:40:17 -0600 (CST) Subject: [Scipy-svn] Buy at Worldwide Shipping Message-ID: <20100306174017.D7D2539CC03@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Sun Mar 7 12:00:14 2010 From: scipy-svn at scipy.org (Rita Hatcher) Date: Sun, 7 Mar 2010 11:00:14 -0600 (CST) Subject: [Scipy-svn] Buy at Worldwide Shipping Message-ID: <20100307170014.D992139CB55@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Sun Mar 7 12:59:15 2010 From: scipy-svn at scipy.org (Harry Lee) Date: Sun, 7 Mar 2010 11:59:15 -0600 (CST) Subject: [Scipy-svn] Buy at Worldwide Shipping Message-ID: <20100307175915.6F70639CB55@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Mon Mar 8 01:52:56 2010 From: scipy-svn at scipy.org (Vern York) Date: Mon, 8 Mar 2010 00:52:56 -0600 (CST) Subject: [Scipy-svn] New Arrivals On Sale, Low Shipping Rate! Message-ID: <20100308065256.0E60539CB3E@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Mon Mar 8 02:55:12 2010 From: scipy-svn at scipy.org (Loyd Wiley) Date: Mon, 8 Mar 2010 01:55:12 -0600 (CST) Subject: [Scipy-svn] 37, 000 Health and Beauty Items Low Prices. Worldwide Shipping Message-ID: <20100308075512.6DD6139CB94@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Mon Mar 8 23:17:17 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 8 Mar 2010 22:17:17 -0600 (CST) Subject: [Scipy-svn] r6252 - trunk/scipy/linalg Message-ID: <20100309041717.D684939CAFD@scipy.org> Author: warren.weckesser Date: 2010-03-08 22:17:17 -0600 (Mon, 08 Mar 2010) New Revision: 6252 Modified: trunk/scipy/linalg/basic.py Log: Remove unused imports, and comment out a couple unused lines. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-02 19:14:21 UTC (rev 6251) +++ trunk/scipy/linalg/basic.py 2010-03-09 04:17:17 UTC (rev 6252) @@ -16,7 +16,7 @@ from flinalg import get_flinalg_funcs from lapack import get_lapack_funcs from numpy import asarray,zeros,sum,newaxis,greater_equal,subtract,arange,\ - conjugate,ravel,r_,mgrid,take,ones,dot,transpose,sqrt,add,real + conjugate,ravel,r_,mgrid,take,ones,dot,transpose import numpy from numpy import asarray_chkfinite, outer, concatenate, reshape, single from numpy import matrix as Matrix @@ -662,7 +662,7 @@ [10, 11, 12]]) """ - svsp = getattr(m,'spacesaver',lambda:0)() + ## svsp = getattr(m,'spacesaver',lambda:0)() m = asarray(m) out = tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype.char)*m pass ## pass ## out.savespace(svsp) @@ -693,7 +693,7 @@ [ 0, 0, 12]]) """ - svsp = getattr(m,'spacesaver',lambda:0)() + ## svsp = getattr(m,'spacesaver',lambda:0)() m = asarray(m) out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m pass ## pass ## out.savespace(svsp) From scipy-svn at scipy.org Tue Mar 9 08:15:34 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 9 Mar 2010 07:15:34 -0600 (CST) Subject: [Scipy-svn] r6253 - trunk/scipy/linalg Message-ID: <20100309131534.D536139CAFC@scipy.org> Author: warren.weckesser Date: 2010-03-09 07:15:33 -0600 (Tue, 09 Mar 2010) New Revision: 6253 Modified: trunk/scipy/linalg/basic.py Log: Removed commented-out code. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-09 04:17:17 UTC (rev 6252) +++ trunk/scipy/linalg/basic.py 2010-03-09 13:15:33 UTC (rev 6253) @@ -662,10 +662,8 @@ [10, 11, 12]]) """ - ## svsp = getattr(m,'spacesaver',lambda:0)() m = asarray(m) out = tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype.char)*m - pass ## pass ## out.savespace(svsp) return out def triu(m, k=0): @@ -693,10 +691,8 @@ [ 0, 0, 12]]) """ - ## svsp = getattr(m,'spacesaver',lambda:0)() m = asarray(m) out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m - pass ## pass ## out.savespace(svsp) return out def toeplitz(c,r=None): From scipy-svn at scipy.org Tue Mar 9 08:31:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 9 Mar 2010 07:31:00 -0600 (CST) Subject: [Scipy-svn] r6254 - trunk/scipy/linalg Message-ID: <20100309133100.EFBE839CAFC@scipy.org> Author: warren.weckesser Date: 2010-03-09 07:31:00 -0600 (Tue, 09 Mar 2010) New Revision: 6254 Modified: trunk/scipy/linalg/matfuncs.py Log: Removed a few lines of dead code (related to the old Numeric savespace() method). Modified: trunk/scipy/linalg/matfuncs.py =================================================================== --- trunk/scipy/linalg/matfuncs.py 2010-03-09 13:15:33 UTC (rev 6253) +++ trunk/scipy/linalg/matfuncs.py 2010-03-09 13:31:00 UTC (rev 6254) @@ -36,11 +36,6 @@ """ A = asarray(A) - ss = True - if A.dtype.char in ['f', 'F']: - pass ## A.savespace(1) - else: - pass ## A.savespace(0) # Scale A so that norm is < 1/2 nA = norm(A,Inf) @@ -69,7 +64,6 @@ F = solve(D,N) for k in range(1,j+1): F = dot(F,F) - pass ## A.savespace(ss) return F def expm2(A): From scipy-svn at scipy.org Wed Mar 10 10:59:16 2010 From: scipy-svn at scipy.org (Approved VIAGRA® Store) Date: Wed, 10 Mar 2010 09:59:16 -0600 (CST) Subject: [Scipy-svn] Electronic Discount Code 76% for scipy-svn@scipy.org Message-ID: <20100310155916.5029739CC71@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Wed Mar 10 11:06:19 2010 From: scipy-svn at scipy.org (Approved VIAGRA® Store) Date: Wed, 10 Mar 2010 10:06:19 -0600 (CST) Subject: [Scipy-svn] News on myspace Message-ID: <20100310160619.573C139CB2B@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Tue Mar 16 02:40:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 16 Mar 2010 01:40:00 -0500 (CDT) Subject: [Scipy-svn] Crazy 70% Discount for scipy-svn Message-ID: <20100316064000.A180139CB11@scipy.org> An HTML attachment was scrubbed... URL: From scipy-svn at scipy.org Tue Mar 16 21:46:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 16 Mar 2010 20:46:41 -0500 (CDT) Subject: [Scipy-svn] r6255 - trunk/scipy/special/tests Message-ID: <20100317014641.7ABA239CAEB@scipy.org> Author: matthew.brett at gmail.com Date: 2010-03-16 20:46:41 -0500 (Tue, 16 Mar 2010) New Revision: 6255 Modified: trunk/scipy/special/tests/test_basic.py Log: TEST - selected tests of spherical harmonics from Wikipedia spherical harmonics table Modified: trunk/scipy/special/tests/test_basic.py =================================================================== --- trunk/scipy/special/tests/test_basic.py 2010-03-09 13:31:00 UTC (rev 6254) +++ trunk/scipy/special/tests/test_basic.py 2010-03-17 01:46:41 UTC (rev 6255) @@ -2017,11 +2017,42 @@ # correctly written. rndrl = (10,10,10,11) assert_array_equal(rnd,rndrl) + +def test_sph_harm(): + # Tests derived from tables in + # http://en.wikipedia.org/wiki/Table_of_spherical_harmonics + sh = sph_harm + pi = np.pi + exp = np.exp + sqrt = np.sqrt + sin = np.sin + cos = np.cos + yield (assert_array_almost_equal, sh(0,0,0,0), + 0.5/sqrt(pi)) + yield (assert_array_almost_equal, sh(-2,2,0.,pi/4), + 0.25*sqrt(15./(2.*pi))* + (sin(pi/4))**2.) + yield (assert_array_almost_equal, sh(-2,2,0.,pi/2), + 0.25*sqrt(15./(2.*pi))) + yield (assert_array_almost_equal, sh(2,2,pi,pi/2), + 0.25*sqrt(15/(2.*pi))* + exp(0+2.*pi*1j)*sin(pi/2.)**2.) + yield (assert_array_almost_equal, sh(2,4,pi/4.,pi/3.), + (3./8.)*sqrt(5./(2.*pi))* + exp(0+2.*pi/4.*1j)* + sin(pi/3.)**2.* + (7.*cos(pi/3.)**2.-1)) + yield (assert_array_almost_equal, sh(4,4,pi/8.,pi/6.), + (3./16.)*sqrt(35./(2.*pi))* + exp(0+4.*pi/8.*1j)*sin(pi/6.)**4.) + + class TestSpherical(TestCase): def test_sph_harm(self): + # see test_sph_harm function pass - + def test_sph_in(self): i1n = sph_in(1,.2) inp0 = (i1n[0][1]) From scipy-svn at scipy.org Sat Mar 20 09:41:19 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Mar 2010 08:41:19 -0500 (CDT) Subject: [Scipy-svn] r6256 - branches/0.7.x Message-ID: <20100320134119.E9DE839CAE6@scipy.org> Author: cdavid Date: 2010-03-20 08:41:19 -0500 (Sat, 20 Mar 2010) New Revision: 6256 Modified: branches/0.7.x/setup.py Log: Set version number to 0.7.2rc1. Modified: branches/0.7.x/setup.py =================================================================== --- branches/0.7.x/setup.py 2010-03-17 01:46:41 UTC (rev 6255) +++ branches/0.7.x/setup.py 2010-03-20 13:41:19 UTC (rev 6256) @@ -42,9 +42,9 @@ MAJOR = 0 MINOR = 7 -MICRO = 1 +MICRO = 2 ISRELEASED = True -VERSION = '%d.%d.%d' % (MAJOR, MINOR, MICRO) +VERSION = '%d.%d.%drc1' % (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 Sat Mar 20 09:41:38 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Mar 2010 08:41:38 -0500 (CDT) Subject: [Scipy-svn] r6257 - branches/0.7.x/doc/release Message-ID: <20100320134138.CD57839CAE6@scipy.org> Author: cdavid Date: 2010-03-20 08:41:38 -0500 (Sat, 20 Mar 2010) New Revision: 6257 Added: branches/0.7.x/doc/release/0.7.2-notes.rst Log: Add 0.7.2 release notes. Added: branches/0.7.x/doc/release/0.7.2-notes.rst =================================================================== --- branches/0.7.x/doc/release/0.7.2-notes.rst (rev 0) +++ branches/0.7.x/doc/release/0.7.2-notes.rst 2010-03-20 13:41:38 UTC (rev 6257) @@ -0,0 +1,10 @@ +========================= +SciPy 0.7.2 Release Notes +========================= + +.. contents:: + +SciPy 0.7.2 is a bug-fix release with no new features compared to 0.7.1. The +only change is that all C sources from Cython code have been regenerated with +Cython 0.12.1. This fixes the incompatibility between binaries of SciPy 0.7.1 +and NumPy 1.4. From scipy-svn at scipy.org Sat Mar 20 09:41:53 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Mar 2010 08:41:53 -0500 (CDT) Subject: [Scipy-svn] r6258 - branches/0.7.x Message-ID: <20100320134153.85C1A39CAFA@scipy.org> Author: cdavid Date: 2010-03-20 08:41:53 -0500 (Sat, 20 Mar 2010) New Revision: 6258 Modified: branches/0.7.x/pavement.py Log: Update notes and log generation in pavement.py Modified: branches/0.7.x/pavement.py =================================================================== --- branches/0.7.x/pavement.py 2010-03-20 13:41:38 UTC (rev 6257) +++ branches/0.7.x/pavement.py 2010-03-20 13:41:53 UTC (rev 6258) @@ -105,10 +105,10 @@ DOC_BLD_LATEX = DOC_BLD / "latex" # Source of the release notes -RELEASE = 'doc/release/0.7.1-notes.rst' +RELEASE = 'doc/release/0.7.2-notes.rst' # Start/end of the log (from git) -LOG_START = 'svn/tags/0.7.0' +LOG_START = 'svn/tags/0.7.1' LOG_END = '0.7.x' # Virtualenv bootstrap stuff From scipy-svn at scipy.org Sat Mar 20 09:42:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Mar 2010 08:42:07 -0500 (CDT) Subject: [Scipy-svn] r6259 - branches/0.7.x Message-ID: <20100320134207.A1ECC39CAFD@scipy.org> Author: cdavid Date: 2010-03-20 08:42:07 -0500 (Sat, 20 Mar 2010) New Revision: 6259 Modified: branches/0.7.x/pavement.py Log: Update Sphinx version in pavement.py. Modified: branches/0.7.x/pavement.py =================================================================== --- branches/0.7.x/pavement.py 2010-03-20 13:41:53 UTC (rev 6258) +++ branches/0.7.x/pavement.py 2010-03-20 13:42:07 UTC (rev 6259) @@ -123,7 +123,7 @@ options(sphinx=Bunch(builddir="build", sourcedir="source", docroot='doc'), virtualenv=Bunch(script_name=BOOTSTRAP_SCRIPT, - packages_to_install=["sphinx==0.6.1"]), + packages_to_install=["sphinx==0.6.5"]), wininst=Bunch(pyver="2.5", scratch=True)) def parse_numpy_version(pyexec): From scipy-svn at scipy.org Sat Mar 20 09:42:28 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sat, 20 Mar 2010 08:42:28 -0500 (CDT) Subject: [Scipy-svn] r6260 - branches/0.7.x Message-ID: <20100320134228.A79E739CAFA@scipy.org> Author: cdavid Date: 2010-03-20 08:42:28 -0500 (Sat, 20 Mar 2010) New Revision: 6260 Modified: branches/0.7.x/pavement.py Log: Make paths to Python in Wine a little less hardcoded. Modified: branches/0.7.x/pavement.py =================================================================== --- branches/0.7.x/pavement.py 2010-03-20 13:42:07 UTC (rev 6259) +++ branches/0.7.x/pavement.py 2010-03-20 13:42:28 UTC (rev 6260) @@ -79,12 +79,12 @@ WINE_PY26 = [r"C:\Python26\python26.exe"] elif sys.platform == "darwin": WINE_PY25 = ["/Applications/Darwine/Wine.bundle/Contents/bin/wine", - "/Users/david/.wine/drive_c/Python25/python.exe"] + os.environ['HOME'] + '/.wine/drive_c/Python25/python.exe'] WINE_PY26 = ["/Applications/Darwine/Wine.bundle/Contents/bin/wine", - "/Users/david/.wine/drive_c/Python26/python.exe"] + os.environ['HOME'] + '/.wine/drive_c/Python26/python.exe'] else: - WINE_PY25 = ["/home/david/.wine/drive_c/Python25/python.exe"] - WINE_PY26 = ["/home/david/.wine/drive_c/Python26/python.exe"] + WINE_PY25 = [os.environ['HOME'] + "/.wine/drive_c/Python25/python.exe"] + WINE_PY26 = [os.environ['HOME'] + "/.wine/drive_c/Python26/python.exe"] WINE_PYS = {'2.6' : WINE_PY26, '2.5': WINE_PY25} SUPERPACK_BUILD = 'build-superpack' SUPERPACK_BINDIR = os.path.join(SUPERPACK_BUILD, 'binaries') From scipy-svn at scipy.org Sun Mar 21 08:37:36 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 07:37:36 -0500 (CDT) Subject: [Scipy-svn] r6261 - trunk/scipy/misc Message-ID: <20100321123736.388D839CAEA@scipy.org> Author: warren.weckesser Date: 2010-03-21 07:37:36 -0500 (Sun, 21 Mar 2010) New Revision: 6261 Modified: trunk/scipy/misc/ppimport.py Log: BUG: Fix two mistakes found by pyflakes, one of which was reported in ticket 1133. Modified: trunk/scipy/misc/ppimport.py =================================================================== --- trunk/scipy/misc/ppimport.py 2010-03-20 13:42:28 UTC (rev 6260) +++ trunk/scipy/misc/ppimport.py 2010-03-21 12:37:36 UTC (rev 6261) @@ -143,7 +143,7 @@ if p_name=='__main__': p_dir = '' fullname = name - elif '__path__' in _frame.f_locals: + elif '__path__' in p_frame.f_locals: # python package p_path = p_frame.f_locals['__path__'] p_dir = p_path[0] @@ -243,7 +243,7 @@ if location != 'sys.path': from numpy.testing import Tester - self.__dict__['test'] = Tester(os,path.dirname(location)).test + self.__dict__['test'] = Tester(os.path.dirname(location)).test # install loader sys.modules[name] = self From scipy-svn at scipy.org Sun Mar 21 09:27:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 08:27:41 -0500 (CDT) Subject: [Scipy-svn] r6262 - trunk/scipy/cluster Message-ID: <20100321132741.4050D39CAED@scipy.org> Author: warren.weckesser Date: 2010-03-21 08:27:41 -0500 (Sun, 21 Mar 2010) New Revision: 6262 Modified: trunk/scipy/cluster/hierarchy.py Log: BUG: array is from the numpy (np) module. Modified: trunk/scipy/cluster/hierarchy.py =================================================================== --- trunk/scipy/cluster/hierarchy.py 2010-03-21 12:37:36 UTC (rev 6261) +++ trunk/scipy/cluster/hierarchy.py 2010-03-21 13:27:41 UTC (rev 6262) @@ -219,7 +219,7 @@ if a.base is not None: return a.copy() elif np.issubsctype(a, np.float32): - return array(a, dtype=np.double) + return np.array(a, dtype=np.double) else: return a From scipy-svn at scipy.org Sun Mar 21 10:20:11 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 09:20:11 -0500 (CDT) Subject: [Scipy-svn] r6263 - trunk/scipy/signal Message-ID: <20100321142011.4092D39CAF3@scipy.org> Author: warren.weckesser Date: 2010-03-21 09:20:11 -0500 (Sun, 21 Mar 2010) New Revision: 6263 Modified: trunk/scipy/signal/waveforms.py Log: DOC: Edit docstrings of chirp() and sweep_poly() for better reST rendering and to conform to the standard. Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-03-21 13:27:41 UTC (rev 6262) +++ trunk/scipy/signal/waveforms.py 2010-03-21 14:20:11 UTC (rev 6263) @@ -146,9 +146,10 @@ def chirp(t, f0, t1, f1, method='linear', phi=0, vertex_zero=True): """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 radians. + 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 + radians. Parameters ---------- @@ -161,28 +162,35 @@ f1 : float Frequency (in Hz) of the waveform at time `t1`. method : {'linear', 'quadratic', 'logarithmic', 'hyperbolic'}, optional - Kind of frequency sweep. If not given, `linear` is assumed. See Notes below - for more details. + Kind of frequency sweep. If not given, `linear` is assumed. See + Notes below for more details. phi : float, optional Phase offset, in degrees. Default is 0. vertex_zero : bool, optional 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. + It determines whether the vertex of the parabola that is the graph + of the frequency is at t=0 or t=t1. Returns ------- A numpy array containing the signal evaluated at 't' with the requested - time-varying frequency. More precisely, the function returns + time-varying frequency. More precisely, the function returns: + ``cos(phase + (pi/180)*phi)`` + where `phase` is the integral (from 0 to t) of ``2*pi*f(t)``. ``f(t)`` is defined below. + See Also + -------- + scipy.signal.waveforms.sweep_poly + Notes ----- - There are four options for the `method`. The following formulas give the - instantaneous frequency (in Hz) of the signal generated by `chirp()`. - For convenience, the shorter names shown below may also be used. + There are four options for the `method`. The following formulas give + the instantaneous frequency (in Hz) of the signal generated by + `chirp()`. For convenience, the shorter names shown below may also be + used. linear, lin, li: @@ -190,20 +198,21 @@ quadratic, quad, q: - The graph of the frequency f(t) is a parabola through (0, f0) and (t1, f1). - By default, the vertex of the parabola is at (0, f0). If `vertex_zero` - is False, then the vertex is at (t1, f1). The formula is: + The graph of the frequency f(t) is a parabola through (0, f0) and + (t1, f1). By default, the vertex of the parabola is at (0, f0). + If `vertex_zero` is False, then the vertex is at (t1, f1). The + formula is: if vertex_zero is True: ``f(t) = f0 + (f1 - f0) * t**2 / t1**2`` - else + else: ``f(t) = f1 - (f1 - f0) * (t1 - t)**2 / t1**2`` - To use a more general quadratic function, or an arbitrary polynomial, - use the function `scipy.signal.waveforms.sweep_poly`. + To use a more general quadratic function, or an arbitrary + polynomial, use the function `scipy.signal.waveforms.sweep_poly`. logarithmic, log, lo: @@ -219,10 +228,6 @@ f1 must be positive, and f0 must be greater than f1. - See Also - -------- - scipy.signal.waveforms.sweep_poly - """ # 'phase' is computed in _chirp_phase, to make testing easier. phase = _chirp_phase(t, f0, t1, f1, method, vertex_zero) @@ -273,11 +278,12 @@ def sweep_poly(t, poly, phi=0): - """Frequency-swept cosine generator, with a time-dependent frequency specified - as a polynomial. + """Frequency-swept cosine generator, with a time-dependent frequency + specified as a polynomial. - This function generates a sinusoidal function whose instantaneous frequency - varies with time. The frequency at time `t` is given by the polynomial `poly`. + This function generates a sinusoidal function whose instantaneous + frequency varies with time. The frequency at time `t` is given by + the polynomial `poly`. Parameters ---------- @@ -288,10 +294,14 @@ a list or ndarray of length n, then the elements of `poly` are the coefficients of the polynomial, and the instantaneous frequency is - ``f(t) = poly[0]*t**(n-1) + poly[1]*t**(n-2) + ... + poly[n-1]`` + + ``f(t) = poly[0]*t**(n-1) + poly[1]*t**(n-2) + ... + poly[n-1]`` + If `poly` is an instance of numpy.poly1d, then the instantaneous frequency is - ``f(t) = poly(t)`` + + ``f(t) = poly(t)`` + phi : float, optional Phase offset, in degrees. Default is 0. @@ -299,7 +309,9 @@ ------- A numpy array containing the signal evaluated at 't' with the requested time-varying frequency. More precisely, the function returns + ``cos(phase + (pi/180)*phi)`` + where `phase` is the integral (from 0 to t) of ``2 * pi * f(t)``; ``f(t)`` is defined above. From scipy-svn at scipy.org Sun Mar 21 15:41:30 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 14:41:30 -0500 (CDT) Subject: [Scipy-svn] r6264 - trunk/scipy/signal Message-ID: <20100321194130.30BB439CAF3@scipy.org> Author: warren.weckesser Date: 2010-03-21 14:41:30 -0500 (Sun, 21 Mar 2010) New Revision: 6264 Modified: trunk/scipy/signal/ltisys.py Log: DOC: Fix typo and shorten a line. Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-03-21 14:20:11 UTC (rev 6263) +++ trunk/scipy/signal/ltisys.py 2010-03-21 19:41:30 UTC (rev 6264) @@ -543,8 +543,8 @@ def impulse2(system, X0=None, T=None, N=None, **kwargs): """Impulse response of a single-input continuous-time linear system. - The solution is generated by calling `scipy.soignal.lsim2`, which uses the - differential equation solver `scipy.integrate.odeint`. + The solution is generated by calling `scipy.signal.lsim2`, which uses + the differential equation solver `scipy.integrate.odeint`. Parameters ---------- From scipy-svn at scipy.org Sun Mar 21 16:37:15 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 15:37:15 -0500 (CDT) Subject: [Scipy-svn] r6265 - in trunk/scipy/linalg: . tests Message-ID: <20100321203715.00F2A39CAF2@scipy.org> Author: warren.weckesser Date: 2010-03-21 15:37:15 -0500 (Sun, 21 Mar 2010) New Revision: 6265 Modified: trunk/scipy/linalg/decomp.py trunk/scipy/linalg/tests/test_decomp.py Log: BUG: Add check that both matrices have the same shape when the generalized eigenvalue problem is being solve (fix for ticket 1113). Modified: trunk/scipy/linalg/decomp.py =================================================================== --- trunk/scipy/linalg/decomp.py 2010-03-21 19:41:30 UTC (rev 6264) +++ trunk/scipy/linalg/decomp.py 2010-03-21 20:37:15 UTC (rev 6265) @@ -150,10 +150,12 @@ """ a1 = asarray_chkfinite(a) if len(a1.shape) != 2 or a1.shape[0] != a1.shape[1]: - raise ValueError, 'expected square matrix' + raise ValueError('expected square matrix') overwrite_a = overwrite_a or (_datanotshared(a1,a)) if b is not None: b = asarray_chkfinite(b) + if b.shape != a1.shape: + raise ValueError('a and b must have the same shape') return _geneig(a1,b,left,right,overwrite_a,overwrite_b) geev, = get_lapack_funcs(('geev',),(a1,)) compute_vl,compute_vr=left,right Modified: trunk/scipy/linalg/tests/test_decomp.py =================================================================== --- trunk/scipy/linalg/tests/test_decomp.py 2010-03-21 19:41:30 UTC (rev 6264) +++ trunk/scipy/linalg/tests/test_decomp.py 2010-03-21 20:37:15 UTC (rev 6265) @@ -205,6 +205,18 @@ if all(isfinite(res[:, i])): assert_array_almost_equal(res[:, i], 0) + def test_not_square_error(self): + """Check that passing a non-square array raises a ValueError.""" + A = np.arange(6).reshape(3,2) + assert_raises(ValueError, eig, A) + + def test_shape_mismatch(self): + """Check that passing arrays of with different shapes raises a ValueError.""" + A = identity(2) + B = np.arange(9.0).reshape(3,3) + assert_raises(ValueError, eig, A, B) + assert_raises(ValueError, eig, B, A) + class TestEigBanded(TestCase): def __init__(self, *args): From scipy-svn at scipy.org Sun Mar 21 17:16:09 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Sun, 21 Mar 2010 16:16:09 -0500 (CDT) Subject: [Scipy-svn] r6266 - in trunk/scipy/constants: . tests Message-ID: <20100321211609.61AD939CAF2@scipy.org> Author: warren.weckesser Date: 2010-03-21 16:16:09 -0500 (Sun, 21 Mar 2010) New Revision: 6266 Added: trunk/scipy/constants/tests/ trunk/scipy/constants/tests/test_codata.py Modified: trunk/scipy/constants/codata.py Log: ENH: Change scipy.constants.find() to return the list of keys instead of printing them (ticket #996). Modified: trunk/scipy/constants/codata.py =================================================================== --- trunk/scipy/constants/codata.py 2010-03-21 20:37:15 UTC (rev 6265) +++ trunk/scipy/constants/codata.py 2010-03-21 21:16:09 UTC (rev 6266) @@ -469,8 +469,7 @@ if l_sub in l_key: result.append(key) result.sort() - for key in result : - print key + return result #table is lacking some digits for exact values: calculate from definition Added: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py (rev 0) +++ trunk/scipy/constants/tests/test_codata.py 2010-03-21 21:16:09 UTC (rev 6266) @@ -0,0 +1,23 @@ + +from scipy.constants import find +from numpy.testing import assert_equal + +def test_find(): + + keys = find('weak mixing') + assert_equal(keys, ['weak mixing angle']) + + keys = find('qwertyuiop') + assert_equal(keys, []) + + keys = find('natural unit') + assert_equal(keys, sorted(['natural unit of velocity', + 'natural unit of action', + 'natural unit of action in eV s', + 'natural unit of mass', + 'natural unit of energy', + 'natural unit of energy in MeV', + 'natural unit of momentum', + 'natural unit of momentum in MeV/c', + 'natural unit of length', + 'natural unit of time'])) From scipy-svn at scipy.org Tue Mar 23 22:39:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 23 Mar 2010 21:39:33 -0500 (CDT) Subject: [Scipy-svn] r6267 - in trunk/scipy/linalg: . tests Message-ID: <20100324023933.2201C39CAEB@scipy.org> Author: warren.weckesser Date: 2010-03-23 21:39:31 -0500 (Tue, 23 Mar 2010) New Revision: 6267 Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/tests/test_basic.py Log: BUG+ENH: Updated linalg.toeplitz to fix problems reported in ticket #667. Updated linalg.hankel to have behavior consistent with toeplitz. Added a new function, linalg.circulant. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-21 21:16:09 UTC (rev 6266) +++ trunk/scipy/linalg/basic.py 2010-03-24 02:39:31 UTC (rev 6267) @@ -7,16 +7,16 @@ # # w/ additions by Travis Oliphant, March 2002 -__all__ = ['solve','inv','det','lstsq','norm','pinv','pinv2', - 'tri','tril','triu','toeplitz','hankel','block_diag','lu_solve', - 'cho_solve','solve_banded','LinAlgError','kron', +__all__ = ['solve', 'inv', 'det', 'lstsq', 'norm', 'pinv', 'pinv2', + 'tri','tril', 'triu', 'toeplitz', 'circulant', 'hankel', 'block_diag', + 'lu_solve', 'cho_solve', 'solve_banded', 'LinAlgError', 'kron', 'all_mat', 'cholesky_banded', 'solveh_banded'] #from blas import get_blas_funcs from flinalg import get_flinalg_funcs from lapack import get_lapack_funcs -from numpy import asarray,zeros,sum,newaxis,greater_equal,subtract,arange,\ - conjugate,ravel,r_,mgrid,take,ones,dot,transpose +from numpy import asarray, zeros, sum, greater_equal, subtract, arange,\ + conjugate, dot, transpose import numpy from numpy import asarray_chkfinite, outer, concatenate, reshape, single from numpy import matrix as Matrix @@ -537,6 +537,7 @@ feps = numpy.finfo(single).eps _array_precision = {'f': 0, 'd': 1, 'F': 0, 'D': 1} + def pinv2(a, cond=None, rcond=None): """Compute the (Moore-Penrose) pseudo-inverse of a matrix. @@ -695,24 +696,31 @@ out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m return out -def toeplitz(c,r=None): + +def toeplitz(c, r=None): """Construct a Toeplitz matrix. - The Toepliz matrix has constant diagonals, c as its first column, - and r as its first row (if not given, r == c is assumed). + The Toepliz matrix has constant diagonals, with c as its first column + and r as its first row. If r is not given, r == conjugate(c) is + assumed. Parameters ---------- - c : array - First column of the matrix - r : array - First row of the matrix. If None, r == c is assumed. + c : array-like, 1D + First column of the matrix. Whatever the actual shape of `c`, it + will be converted to a 1D array. + r : array-like, 1D + First row of the matrix. If None, `r = conjugate(c)` is assumed; in + this case, if `c[0]` is real, the result is a Hermitian matrix. + `r[0]` is ignored; the first row of the returned matrix is + `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be + converted to a 1D array. Returns ------- A : array, shape (len(c), len(r)) - Constructed Toeplitz matrix. - dtype is the same as (c[0] + r[0]).dtype + The Toeplitz matrix. + dtype is the same as `(c[0] + r[0]).dtype`. Examples -------- @@ -721,54 +729,105 @@ array([[1, 4, 5, 6], [2, 1, 4, 5], [3, 2, 1, 4]]) + >>> toeplitz([1.0, 2+3j, 4-1j]) + array([[ 1.+0.j, 2.-3.j, 4.+1.j], + [ 2.+3.j, 1.+0.j, 2.-3.j], + [ 4.-1.j, 2.+3.j, 1.+0.j]]) See also -------- + circulant : circulant matrix hankel : Hankel matrix + Notes + ----- + The behavior when `c` or `r` is a scalar, or when `c` is complex and + `r` is None, was changed in version 0.8.0. The behavior in previous + versions was undocumented and is no longer supported. """ - isscalar = numpy.isscalar - if isscalar(c) or isscalar(r): - return c + c = numpy.asarray(c).ravel() if r is None: - r = c - r[0] = conjugate(r[0]) - c = conjugate(c) - r,c = map(asarray_chkfinite,(r,c)) - r,c = map(ravel,(r,c)) - rN,cN = map(len,(r,c)) - if r[0] != c[0]: - print "Warning: column and row values don't agree; column value used." - vals = r_[r[rN-1:0:-1], c] - cols = mgrid[0:cN] - rows = mgrid[rN:0:-1] - indx = cols[:,newaxis]*ones((1,rN),dtype=int) + \ - rows[newaxis,:]*ones((cN,1),dtype=int) - 1 - return take(vals, indx, 0) + r = c.conjugate() + else: + r = numpy.asarray(r).ravel() + # Form a 1D array of values to be used in the matrix, containing a reversed + # copy of r[1:], followed by c. + vals = numpy.concatenate((r[-1:0:-1], c)) + a, b = numpy.ogrid[0:len(c), len(r)-1:-1:-1] + indx = a + b + # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that + # `vals[indx]` is the Toeplitz matrix. + return vals[indx] +def circulant(c): + """Construct a circulant matrix. -def hankel(c,r=None): + Parameters + ---------- + c : array-like, 1D + First column of the matrix. + + Returns + ------- + A : array, shape (len(c), len(c)) + A circulant matrix whose first column is `c`. + + Examples + -------- + >>> from scipy.linalg import circulant + >>> circulant([1, 2, 3]) + array([[1, 3, 2], + [2, 1, 3], + [3, 2, 1]]) + + See also + -------- + toeplitz : Toeplitz matrix + hankel : Hankel matrix + + Notes + ----- + .. versionadded:: 0.8.0 + + """ + c = numpy.asarray(c).ravel() + a, b = numpy.ogrid[0:len(c), 0:-len(c):-1] + indx = a + b + # `indx` is a 2D array of indices into `c`, arranged so that `c[indx]` is + # the circulant matrix. + return c[indx] + +def hankel(c, r=None): """Construct a Hankel matrix. - The Hankel matrix has constant anti-diagonals, c as its first column, - and r as its last row (if not given, r == 0 os assumed). + The Hankel matrix has constant anti-diagonals, with `c` as its + first column and `r` as its last row. If `r` is not given, then + `r = zeros_like(c)` is assumed. Parameters ---------- - c : array - First column of the matrix - r : array - Last row of the matrix. If None, r == 0 is assumed. + c : array-like, 1D + First column of the matrix. Whatever the actual shape of `c`, it + will be converted to a 1D array. + r : array-like, 1D + Last row of the matrix. If None, `r` == 0 is assumed. + `r[0]` is ignored; the last row of the returned matrix is + `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be + converted to a 1D array. Returns ------- A : array, shape (len(c), len(r)) - Constructed Hankel matrix. - dtype is the same as (c[0] + r[0]).dtype + The Hankel matrix. + dtype is the same as `(c[0] + r[0]).dtype`. Examples -------- >>> from scipy.linalg import hankel + >>> hankel([1, 17, 99]) + array([[ 1, 17, 99], + [17, 99, 0], + [99, 0, 0]]) >>> hankel([1,2,3,4], [4,7,7,8,9]) array([[1, 2, 3, 4, 7], [2, 3, 4, 7, 7], @@ -778,24 +837,22 @@ See also -------- toeplitz : Toeplitz matrix + circulant : circulant matrix """ - isscalar = numpy.isscalar - if isscalar(c) or isscalar(r): - return c + c = numpy.asarray(c).ravel() if r is None: - r = zeros(len(c)) - elif r[0] != c[-1]: - print "Warning: column and row values don't agree; column value used." - r,c = map(asarray_chkfinite,(r,c)) - r,c = map(ravel,(r,c)) - rN,cN = map(len,(r,c)) - vals = r_[c, r[1:rN]] - cols = mgrid[1:cN+1] - rows = mgrid[0:rN] - indx = cols[:,newaxis]*ones((1,rN),dtype=int) + \ - rows[newaxis,:]*ones((cN,1),dtype=int) - 1 - return take(vals, indx, 0) + r = numpy.zeros_like(c) + else: + r = numpy.asarray(r).ravel() + # Form a 1D array of values to be used in the matrix, containing `c` + # followed by r[1:]. + vals = numpy.concatenate((c, r[1:])) + a, b = numpy.ogrid[0:len(c), 0:len(r)] + indx = a + b + # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that + # `vals[indx]` is the Hankel matrix. + return vals[indx] def all_mat(*args): return map(Matrix,args) Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-03-21 21:16:09 UTC (rev 6266) +++ trunk/scipy/linalg/tests/test_basic.py 2010-03-24 02:39:31 UTC (rev 6267) @@ -20,13 +20,13 @@ """ from numpy import arange, add, array, dot, zeros, identity, conjugate, \ - transpose, eye, all + transpose, eye, all, copy import numpy.linalg as linalg from numpy.testing import * -from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, tri, triu, \ - tril, pinv, pinv2, solve_banded, block_diag, norm +from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, circulant, \ + tri, triu, tril, pinv, pinv2, solve_banded, block_diag, norm def random(size): @@ -385,13 +385,54 @@ b[l,k] = 0 assert_equal(triu(a,k=-2),b) + class TestToeplitz(TestCase): + def test_basic(self): y = toeplitz([1,2,3]) assert_array_equal(y,[[1,2,3],[2,1,2],[3,2,1]]) y = toeplitz([1,2,3],[1,4,5]) assert_array_equal(y,[[1,4,5],[2,1,4],[3,2,1]]) + + def test_complex_01(self): + data = (1.0 + arange(3.0)) * (1.0 + 1.0j) + x = copy(data) + t = toeplitz(x) + # Calling toeplitz should not change x. + assert_array_equal(x, data) + # According to the docstring, x should be the first column of t. + col0 = t[:,0] + assert_array_equal(col0, data) + assert_array_equal(t[0,1:], data[1:].conj()) + def test_scalar_00(self): + """Scalar arguments still produce a 2D array.""" + t = toeplitz(10) + assert_array_equal(t, [[10]]) + t = toeplitz(10, 20) + assert_array_equal(t, [[10]]) + + def test_scalar_01(self): + c = array([1,2,3]) + t = toeplitz(c, 1) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_02(self): + c = array([1,2,3]) + t = toeplitz(c, array(1)) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_03(self): + c = array([1,2,3]) + t = toeplitz(c, array([1])) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_04(self): + r = array([10,2,3]) + t = toeplitz(1, r) + assert_array_equal(t, [[1,2,3]]) + + class TestHankel(TestCase): def test_basic(self): y = hankel([1,2,3]) @@ -399,6 +440,13 @@ y = hankel([1,2,3],[3,4,5]) assert_array_equal(y,[[1,2,3],[2,3,4],[3,4,5]]) + +class TestCirculant(TestCase): + def test_basic(self): + y = circulant([1,2,3]) + assert_array_equal(y,[[1,3,2],[2,1,3],[3,2,1]]) + + class TestBlockDiag: def test_basic(self): x = block_diag(eye(2), [[1,2], [3,4], [5,6]], [[1, 2, 3]]) From scipy-svn at scipy.org Fri Mar 26 01:34:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:34:49 -0500 (CDT) Subject: [Scipy-svn] r6268 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053449.0576A39CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:34:48 -0500 (Fri, 26 Mar 2010) New Revision: 6268 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: REF: put arpack unsymmetric solver paramaters checking into separate object. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-24 02:39:31 UTC (rev 6267) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:34:48 UTC (rev 6268) @@ -51,7 +51,88 @@ _type_conv = {'f':'s', 'd':'d', 'F':'c', 'D':'z'} _ndigits = {'f':5, 'd':12, 'F':5, 'D':12} +class _ArpackParams(object): + def __init__(self, n, k, tp, mode="symmetric", sigma=None, + ncv=None, v0=None, maxiter=None, which="LM", tol=0): + if k <= 0: + raise ValueError("k must be positive, k=%d" % k) + if k == n: + raise ValueError("k must be less than rank(A), k=%d" % k) + if maxiter is None: + maxiter = n * 10 + if maxiter <= 0: + raise ValueError("maxiter must be positive, maxiter=%d" % maxiter) + + if tp not in 'fdFD': + raise ValueError("matrix type must be 'f', 'd', 'F', or 'D'") + + if v0 is not None: + self.resid = v0 + info = 1 + else: + self.resid = np.zeros(n, tp) + info = 0 + + if sigma is not None: + raise NotImplementedError("shifted eigenproblem not supported yet") + + if ncv is None: + ncv = 2 * k + 1 + ncv = min(ncv, n) + + if ncv > n or ncv < k: + raise ValueError("ncv must be k<=ncv<=n, ncv=%s" % ncv) + + if not which in ["LM", "SM", "LR", "SR", "LI", "SI"]: + raise ValueError("Parameter which must be one of %s" % ' '.join(whiches)) + + ltr = _type_conv[tp] + + self.v = np.zeros((n, ncv), tp) # holds Ritz vectors + self.rwork = None # Only used for unsymmetric, complex solver + + if mode == "unsymmetric": + self.workd = np.zeros(3 * n, tp) + self.workl = np.zeros(3 * ncv * ncv + 6 * ncv, tp) + self.solver = _arpack.__dict__[ltr + 'naupd'] + self.extract = _arpack.__dict__[ltr + 'neupd'] + + if tp in 'FD': + self.rwork = np.zeros(ncv, tp.lower()) + + self.ipntr = np.zeros(14, "int") + elif mode == "symmetric": + self.workd = np.zeros(3 * n, tp) + self.workl = np.zeros(ncv * (ncv + 8), tp) + self.solver = _arpack.__dict__[ltr + 'saupd'] + self.extract = _arpack.__dict__[ltr + 'seupd'] + + self.ipntr = np.zeros(11, "int") + else: + raise ValueError("Unrecognized mode %s" % mode) + + self.iparam = np.zeros(11, "int") + + # set solver mode and parameters + # only supported mode is 1: Ax=lx + ishfts = 1 + mode1 = 1 + self.iparam[0] = ishfts + self.iparam[2] = maxiter + self.iparam[6] = mode1 + + self.n = n + self.mode = mode + self.tol = tol + self.k = k + self.maxiter = maxiter + self.ncv = ncv + self.which = which + self.tp = tp + self.info = info + self.bmat = 'I' + def eigen(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): @@ -133,168 +214,113 @@ raise ValueError('expected square matrix (shape=%s)' % A.shape) n = A.shape[0] - # guess type - typ = A.dtype.char - if typ not in 'fdFD': - raise ValueError("matrix type must be 'f', 'd', 'F', or 'D'") + params = _ArpackParams(n, k, A.dtype.char, "unsymmetric", sigma, + ncv, v0, maxiter, which, tol) if M is not None: raise NotImplementedError("generalized eigenproblem not supported yet") - if sigma is not None: - raise NotImplementedError("shifted eigenproblem not supported yet") - - # some defaults - if ncv is None: - ncv=2*k+1 - ncv=min(ncv,n) - if maxiter==None: - maxiter=n*10 - # assign starting vector - if v0 is not None: - resid=v0 - info=1 - else: - resid = np.zeros(n,typ) - info=0 - - - # some sanity checks - if k <= 0: - raise ValueError("k must be positive, k=%d"%k) - if k == n: - raise ValueError("k must be less than rank(A), k=%d"%k) - if maxiter <= 0: - raise ValueError("maxiter must be positive, maxiter=%d"%maxiter) - whiches=['LM','SM','LR','SR','LI','SI'] - if which not in whiches: - raise ValueError("which must be one of %s"%' '.join(whiches)) - if ncv > n or ncv < k: - raise ValueError("ncv must be k<=ncv<=n, ncv=%s"%ncv) - - # assign solver and postprocessor - ltr = _type_conv[typ] - eigsolver = _arpack.__dict__[ltr+'naupd'] - eigextract = _arpack.__dict__[ltr+'neupd'] - - v = np.zeros((n,ncv),typ) # holds Ritz vectors - workd = np.zeros(3*n,typ) # workspace - workl = np.zeros(3*ncv*ncv+6*ncv,typ) # workspace - iparam = np.zeros(11,'int') # problem parameters - ipntr = np.zeros(14,'int') # pointers into workspaces ido = 0 - if typ in 'FD': - rwork = np.zeros(ncv,typ.lower()) - - # set solver mode and parameters - # only supported mode is 1: Ax=lx - ishfts = 1 - mode1 = 1 - bmat = 'I' - iparam[0] = ishfts - iparam[2] = maxiter - iparam[6] = mode1 - while True: - if typ in 'fd': - ido,resid,v,iparam,ipntr,info =\ - eigsolver(ido,bmat,which,k,tol,resid,v,iparam,ipntr, - workd,workl,info) + if params.tp in 'fd': + ido, params.resid, params.v, params.iparam, params.ipntr, params.info = \ + params.solver(ido, params.bmat, params.which, params.k, params.tol, + params.resid, params.v, params.iparam, params.ipntr, + params.workd, params.workl, params.info) else: - ido,resid,v,iparam,ipntr,info =\ - eigsolver(ido,bmat,which,k,tol,resid,v,iparam,ipntr, - workd,workl,rwork,info) + ido, params.resid, params.v, params.iparam, params.ipntr, params.info =\ + params.solver(ido, params.bmat, params.which, params.k, params.tol, + params.resid, params.v, params.iparam, params.ipntr, + params.workd, params.workl, params.rwork, params.info) - xslice = slice(ipntr[0]-1, ipntr[0]-1+n) - yslice = slice(ipntr[1]-1, ipntr[1]-1+n) + xslice = slice(params.ipntr[0]-1, params.ipntr[0]-1+n) + yslice = slice(params.ipntr[1]-1, params.ipntr[1]-1+n) if ido == -1: # initialization - workd[yslice]=A.matvec(workd[xslice]) + params.workd[yslice] = A.matvec(params.workd[xslice]) elif ido == 1: # compute y=Ax - workd[yslice]=A.matvec(workd[xslice]) + params.workd[yslice] = A.matvec(params.workd[xslice]) else: break - if info < -1 : - raise RuntimeError("Error info=%d in arpack"%info) - return None - if info == -1: - warnings.warn("Maximum number of iterations taken: %s"%iparam[2]) -# if iparam[3] != k: -# warnings.warn("Only %s eigenvalues converged"%iparam[3]) + if params.info < -1 : + raise RuntimeError("Error info=%d in arpack" % params.info) + elif params.info == -1: + warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) - # now extract eigenvalues and (optionally) eigenvectors rvec = return_eigenvectors ierr = 0 howmny = 'A' # return all eigenvectors - sselect = np.zeros(ncv,'int') # unused + sselect = np.zeros(params.ncv, 'int') # unused sigmai = 0.0 # no shifts, not implemented sigmar = 0.0 # no shifts, not implemented - workev = np.zeros(3*ncv,typ) + workev = np.zeros(3 * params.ncv, params.tp) - if typ in 'fd': - dr=np.zeros(k+1,typ) - di=np.zeros(k+1,typ) - zr=np.zeros((n,k+1),typ) - dr,di,zr,info=\ - eigextract(rvec,howmny,sselect,sigmar,sigmai,workev, - bmat,which,k,tol,resid,v,iparam,ipntr, - workd,workl,info) + if params.tp in 'fd': + dr = np.zeros(k+1, params.tp) + di = np.zeros(k+1, params.tp) + zr = np.zeros((n, k+1), params.tp) + dr, di, zr, params.info=\ + params.extract(rvec, howmny, sselect, sigmar, sigmai, workev, + params.bmat, params.which, k, params.tol, params.resid, + params.v, params.iparam, params.ipntr, + params.workd, params.workl, params.info) # The ARPACK nonsymmetric real and double interface (s,d)naupd return # eigenvalues and eigenvectors in real (float,double) arrays. # Build complex eigenvalues from real and imaginary parts - d=dr+1.0j*di + d = dr + 1.0j * di # Arrange the eigenvectors: complex eigenvectors are stored as # real,imaginary in consecutive columns - z=zr.astype(typ.upper()) - eps=np.finfo(typ).eps - i=0 + z = zr.astype(params.tp.upper()) + eps = np.finfo(params.tp).eps + i = 0 while i<=k: # check if complex - if abs(d[i].imag)>eps: + if abs(d[i].imag) > eps: # assume this is a complex conjugate pair with eigenvalues # in consecutive columns - z[:,i]=zr[:,i]+1.0j*zr[:,i+1] - z[:,i+1]=z[:,i].conjugate() - i+=1 - i+=1 + z[:,i] = zr[:,i] + 1.0j * zr[:,i+1] + z[:,i+1] = z[:,i].conjugate() + i +=1 + i += 1 # Now we have k+1 possible eigenvalues and eigenvectors # Return the ones specified by the keyword "which" - nreturned=iparam[4] # number of good eigenvalues returned - if nreturned==k: # we got exactly how many eigenvalues we wanted - d=d[:k] - z=z[:,:k] + nreturned = params.iparam[4] # number of good eigenvalues returned + if nreturned == k: # we got exactly how many eigenvalues we wanted + d = d[:k] + z = z[:,:k] else: # we got one extra eigenvalue (likely a cc pair, but which?) # cut at approx precision for sorting - rd=np.round(d,decimals=_ndigits[typ]) - if which in ['LR','SR']: - ind=np.argsort(rd.real) + rd = np.round(d, decimals = _ndigits[params.tp]) + if params.which in ['LR','SR']: + ind = np.argsort(rd.real) elif which in ['LI','SI']: # for LI,SI ARPACK returns largest,smallest abs(imaginary) why? - ind=np.argsort(abs(rd.imag)) + ind = np.argsort(abs(rd.imag)) else: - ind=np.argsort(abs(rd)) - if which in ['LR','LM','LI']: - d=d[ind[-k:]] - z=z[:,ind[-k:]] - if which in ['SR','SM','SI']: - d=d[ind[:k]] - z=z[:,ind[:k]] + ind = np.argsort(abs(rd)) + if params.which in ['LR','LM','LI']: + d = d[ind[-k:]] + z = z[:,ind[-k:]] + if params.which in ['SR','SM','SI']: + d = d[ind[:k]] + z = z[:,ind[:k]] else: # complex is so much simpler... - d,z,info =\ - eigextract(rvec,howmny,sselect,sigmar,workev, - bmat,which,k,tol,resid,v,iparam,ipntr, - workd,workl,rwork,ierr) + d, z, params.info =\ + params.extract(rvec, howmny, sselect, sigmar, workev, + params.bmat, params.which, k, params.tol, params.resid, + params.v, params.iparam, params.ipntr, + params.workd, params.workl, params.rwork, ierr) From scipy-svn at scipy.org Fri Mar 26 01:34:58 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:34:58 -0500 (CDT) Subject: [Scipy-svn] r6269 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053458.2072F39CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:34:57 -0500 (Fri, 26 Mar 2010) New Revision: 6269 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: REF: use _ArpackParams in symmetric solver. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:34:48 UTC (rev 6268) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:34:57 UTC (rev 6269) @@ -84,15 +84,15 @@ if ncv > n or ncv < k: raise ValueError("ncv must be k<=ncv<=n, ncv=%s" % ncv) - if not which in ["LM", "SM", "LR", "SR", "LI", "SI"]: - raise ValueError("Parameter which must be one of %s" % ' '.join(whiches)) - ltr = _type_conv[tp] self.v = np.zeros((n, ncv), tp) # holds Ritz vectors self.rwork = None # Only used for unsymmetric, complex solver if mode == "unsymmetric": + if not which in ["LM", "SM", "LR", "SR", "LI", "SI"]: + raise ValueError("Parameter which must be one of %s" % ' '.join(whiches)) + self.workd = np.zeros(3 * n, tp) self.workl = np.zeros(3 * ncv * ncv + 6 * ncv, tp) self.solver = _arpack.__dict__[ltr + 'naupd'] @@ -103,6 +103,9 @@ self.ipntr = np.zeros(14, "int") elif mode == "symmetric": + if not which in ['LM','SM','LA','SA','BE']: + raise ValueError("which must be one of %s" % ' '.join(whiches)) + self.workd = np.zeros(3 * n, tp) self.workl = np.zeros(ncv * (ncv + 8), tp) self.solver = _arpack.__dict__[ltr + 'saupd'] @@ -413,107 +416,54 @@ raise ValueError('expected square matrix (shape=%s)' % shape) n = A.shape[0] - # guess type - typ = A.dtype.char - if typ not in 'fd': - raise ValueError("matrix must be real valued (type must be 'f' or 'd')") - if M is not None: raise NotImplementedError("generalized eigenproblem not supported yet") - if sigma is not None: - raise NotImplementedError("shifted eigenproblem not supported yet") - if ncv is None: - ncv=2*k+1 - ncv=min(ncv,n) - if maxiter==None: - maxiter=n*10 - # assign starting vector - if v0 is not None: - resid=v0 - info=1 - else: - resid = np.zeros(n,typ) - info=0 + params = _ArpackParams(n, k, A.dtype.char, "symmetric", sigma, + ncv, v0, maxiter, which, tol) - # some sanity checks - if k <= 0: - raise ValueError("k must be positive, k=%d"%k) - if k == n: - raise ValueError("k must be less than rank(A), k=%d"%k) - if maxiter <= 0: - raise ValueError("maxiter must be positive, maxiter=%d"%maxiter) - whiches=['LM','SM','LA','SA','BE'] - if which not in whiches: - raise ValueError("which must be one of %s"%' '.join(whiches)) - if ncv > n or ncv < k: - raise ValueError("ncv must be k<=ncv<=n, ncv=%s"%ncv) - - # assign solver and postprocessor - ltr = _type_conv[typ] - eigsolver = _arpack.__dict__[ltr+'saupd'] - eigextract = _arpack.__dict__[ltr+'seupd'] - - # set output arrays, parameters, and workspace - v = np.zeros((n,ncv),typ) - workd = np.zeros(3*n,typ) - workl = np.zeros(ncv*(ncv+8),typ) - iparam = np.zeros(11,'int') - ipntr = np.zeros(11,'int') ido = 0 - - # set solver mode and parameters - # only supported mode is 1: Ax=lx - ishfts = 1 - mode1 = 1 - bmat='I' - iparam[0] = ishfts - iparam[2] = maxiter - iparam[6] = mode1 - while True: - ido,resid,v,iparam,ipntr,info =\ - eigsolver(ido,bmat,which,k,tol,resid,v, - iparam,ipntr,workd,workl,info) + ido, params.resid, params.v, params.iparam, params.ipntr, params.info = \ + params.solver(ido, params.bmat, params.which, params.k, params.tol, + params.resid, params.v, params.iparam, params.ipntr, + params.workd, params.workl, params.info) - xslice = slice(ipntr[0]-1, ipntr[0]-1+n) - yslice = slice(ipntr[1]-1, ipntr[1]-1+n) + xslice = slice(params.ipntr[0]-1, params.ipntr[0]-1+n) + yslice = slice(params.ipntr[1]-1, params.ipntr[1]-1+n) if ido == -1: # initialization - workd[yslice]=A.matvec(workd[xslice]) + params.workd[yslice] = A.matvec(params.workd[xslice]) elif ido == 1: # compute y=Ax - workd[yslice]=A.matvec(workd[xslice]) + params.workd[yslice] = A.matvec(params.workd[xslice]) else: break - if info < -1 : - raise RuntimeError("Error info=%d in arpack" % info) - return None + if params.info < -1 : + raise RuntimeError("Error info=%d in arpack" % params.info) + elif params.info == 1: + warnings.warn("Maximum number of iterations taken: %s" % params.iparam[2]) - if info == 1: - warnings.warn("Maximum number of iterations taken: %s" % iparam[2]) + if params.iparam[4] < k: + warnings.warn("Only %d/%d eigenvectors converged" % (params.iparam[4], k)) - if iparam[4] < k: - warnings.warn("Only %d/%d eigenvectors converged" % (iparam[4], k)) - # now extract eigenvalues and (optionally) eigenvectors rvec = return_eigenvectors ierr = 0 howmny = 'A' # return all eigenvectors - sselect = np.zeros(ncv,'int') # unused + sselect = np.zeros(params.ncv, 'int') # unused sigma = 0.0 # no shifts, not implemented - d,z,info =\ - eigextract(rvec,howmny,sselect,sigma, - bmat,which, k,tol,resid,v,iparam[0:7],ipntr, - workd[0:2*n],workl,ierr) + d, z, info = params.extract(rvec, howmny, sselect, sigma, params.bmat, + params.which, k, params.tol, params.resid, params.v, + params.iparam[0:7], params.ipntr, params.workd[0:2*n], + params.workl,ierr) if ierr != 0: - raise RuntimeError("Error info=%d in arpack"%info) - return None + raise RuntimeError("Error info=%d in arpack" % params.info) if return_eigenvectors: - return d,z + return d, z return d def svd(A, k=6): From scipy-svn at scipy.org Fri Mar 26 01:35:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:35:07 -0500 (CDT) Subject: [Scipy-svn] r6270 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053507.5433339CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:35:07 -0500 (Fri, 26 Mar 2010) New Revision: 6270 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: REF: abstrace solver call for ARPACK. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:34:57 UTC (rev 6269) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:07 UTC (rev 6270) @@ -52,7 +52,7 @@ _ndigits = {'f':5, 'd':12, 'F':5, 'D':12} class _ArpackParams(object): - def __init__(self, n, k, tp, mode="symmetric", sigma=None, + def __init__(self, n, k, tp, matvec, mode="symmetric", sigma=None, ncv=None, v0=None, maxiter=None, which="LM", tol=0): if k <= 0: raise ValueError("k must be positive, k=%d" % k) @@ -95,7 +95,8 @@ self.workd = np.zeros(3 * n, tp) self.workl = np.zeros(3 * ncv * ncv + 6 * ncv, tp) - self.solver = _arpack.__dict__[ltr + 'naupd'] + self._arpack_solver = _arpack.__dict__[ltr + 'naupd'] + self.iterate = self._unsymmetric_solver self.extract = _arpack.__dict__[ltr + 'neupd'] if tp in 'FD': @@ -108,7 +109,8 @@ self.workd = np.zeros(3 * n, tp) self.workl = np.zeros(ncv * (ncv + 8), tp) - self.solver = _arpack.__dict__[ltr + 'saupd'] + self._arpack_solver = _arpack.__dict__[ltr + 'saupd'] + self.iterate = self._symmetric_solver self.extract = _arpack.__dict__[ltr + 'seupd'] self.ipntr = np.zeros(11, "int") @@ -127,6 +129,7 @@ self.n = n self.mode = mode + self.matvec = matvec self.tol = tol self.k = k self.maxiter = maxiter @@ -136,6 +139,62 @@ self.info = info self.bmat = 'I' + self.converged = False + self.ido = 0 + + def _unsymmetric_solver(self): + if self.tp in 'fd': + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.info) + else: + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info =\ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.rwork, self.info) + + xslice = slice(self.ipntr[0]-1, self.ipntr[0]-1+self.n) + yslice = slice(self.ipntr[1]-1, self.ipntr[1]-1+self.n) + if self.ido == -1: + # initialization + self.workd[yslice] = self.matvec(self.workd[xslice]) + elif self.ido == 1: + # compute y=Ax + self.workd[yslice] = self.matvec(self.workd[xslice]) + else: + self.converged = True + + if self.info < -1 : + raise RuntimeError("Error info=%d in arpack" % self.info) + elif self.info == -1: + warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) + + def _symmetric_solver(self): + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.info) + + xslice = slice(self.ipntr[0]-1, self.ipntr[0]-1+self.n) + yslice = slice(self.ipntr[1]-1, self.ipntr[1]-1+self.n) + if self.ido == -1: + # initialization + self.workd[yslice] = self.matvec(self.workd[xslice]) + elif self.ido == 1: + # compute y=Ax + self.workd[yslice] = self.matvec(self.workd[xslice]) + else: + self.converged = True + + if self.info < -1 : + raise RuntimeError("Error info=%d in arpack" % self.info) + elif self.info == -1: + warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) + + if self.iparam[4] < self.k: + warnings.warn("Only %d/%d eigenvectors converged" % (self.iparam[4], self.k)) + def eigen(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): @@ -217,42 +276,16 @@ raise ValueError('expected square matrix (shape=%s)' % A.shape) n = A.shape[0] - params = _ArpackParams(n, k, A.dtype.char, "unsymmetric", sigma, + matvec = lambda x : A.matvec(x) + params = _ArpackParams(n, k, A.dtype.char, matvec, "unsymmetric", sigma, ncv, v0, maxiter, which, tol) if M is not None: raise NotImplementedError("generalized eigenproblem not supported yet") - ido = 0 + while not params.converged: + params.iterate() - while True: - if params.tp in 'fd': - ido, params.resid, params.v, params.iparam, params.ipntr, params.info = \ - params.solver(ido, params.bmat, params.which, params.k, params.tol, - params.resid, params.v, params.iparam, params.ipntr, - params.workd, params.workl, params.info) - else: - ido, params.resid, params.v, params.iparam, params.ipntr, params.info =\ - params.solver(ido, params.bmat, params.which, params.k, params.tol, - params.resid, params.v, params.iparam, params.ipntr, - params.workd, params.workl, params.rwork, params.info) - - xslice = slice(params.ipntr[0]-1, params.ipntr[0]-1+n) - yslice = slice(params.ipntr[1]-1, params.ipntr[1]-1+n) - if ido == -1: - # initialization - params.workd[yslice] = A.matvec(params.workd[xslice]) - elif ido == 1: - # compute y=Ax - params.workd[yslice] = A.matvec(params.workd[xslice]) - else: - break - - if params.info < -1 : - raise RuntimeError("Error info=%d in arpack" % params.info) - elif params.info == -1: - warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) - # now extract eigenvalues and (optionally) eigenvectors rvec = return_eigenvectors ierr = 0 @@ -419,35 +452,13 @@ if M is not None: raise NotImplementedError("generalized eigenproblem not supported yet") - params = _ArpackParams(n, k, A.dtype.char, "symmetric", sigma, + matvec = lambda x : A.matvec(x) + params = _ArpackParams(n, k, A.dtype.char, matvec, "symmetric", sigma, ncv, v0, maxiter, which, tol) - ido = 0 - while True: - ido, params.resid, params.v, params.iparam, params.ipntr, params.info = \ - params.solver(ido, params.bmat, params.which, params.k, params.tol, - params.resid, params.v, params.iparam, params.ipntr, - params.workd, params.workl, params.info) + while not params.converged: + params.iterate() - xslice = slice(params.ipntr[0]-1, params.ipntr[0]-1+n) - yslice = slice(params.ipntr[1]-1, params.ipntr[1]-1+n) - if ido == -1: - # initialization - params.workd[yslice] = A.matvec(params.workd[xslice]) - elif ido == 1: - # compute y=Ax - params.workd[yslice] = A.matvec(params.workd[xslice]) - else: - break - - if params.info < -1 : - raise RuntimeError("Error info=%d in arpack" % params.info) - elif params.info == 1: - warnings.warn("Maximum number of iterations taken: %s" % params.iparam[2]) - - if params.iparam[4] < k: - warnings.warn("Only %d/%d eigenvectors converged" % (params.iparam[4], k)) - # now extract eigenvalues and (optionally) eigenvectors rvec = return_eigenvectors ierr = 0 From scipy-svn at scipy.org Fri Mar 26 01:35:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:35:16 -0500 (CDT) Subject: [Scipy-svn] r6271 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053516.D442139CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:35:16 -0500 (Fri, 26 Mar 2010) New Revision: 6271 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: REF: split symmetric/unsymmetric cases in two classes. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:07 UTC (rev 6270) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:16 UTC (rev 6271) @@ -52,7 +52,7 @@ _ndigits = {'f':5, 'd':12, 'F':5, 'D':12} class _ArpackParams(object): - def __init__(self, n, k, tp, matvec, mode="symmetric", sigma=None, + def __init__(self, n, k, tp, matvec, sigma=None, ncv=None, v0=None, maxiter=None, which="LM", tol=0): if k <= 0: raise ValueError("k must be positive, k=%d" % k) @@ -84,39 +84,7 @@ if ncv > n or ncv < k: raise ValueError("ncv must be k<=ncv<=n, ncv=%s" % ncv) - ltr = _type_conv[tp] - self.v = np.zeros((n, ncv), tp) # holds Ritz vectors - self.rwork = None # Only used for unsymmetric, complex solver - - if mode == "unsymmetric": - if not which in ["LM", "SM", "LR", "SR", "LI", "SI"]: - raise ValueError("Parameter which must be one of %s" % ' '.join(whiches)) - - self.workd = np.zeros(3 * n, tp) - self.workl = np.zeros(3 * ncv * ncv + 6 * ncv, tp) - self._arpack_solver = _arpack.__dict__[ltr + 'naupd'] - self.iterate = self._unsymmetric_solver - self.extract = _arpack.__dict__[ltr + 'neupd'] - - if tp in 'FD': - self.rwork = np.zeros(ncv, tp.lower()) - - self.ipntr = np.zeros(14, "int") - elif mode == "symmetric": - if not which in ['LM','SM','LA','SA','BE']: - raise ValueError("which must be one of %s" % ' '.join(whiches)) - - self.workd = np.zeros(3 * n, tp) - self.workl = np.zeros(ncv * (ncv + 8), tp) - self._arpack_solver = _arpack.__dict__[ltr + 'saupd'] - self.iterate = self._symmetric_solver - self.extract = _arpack.__dict__[ltr + 'seupd'] - - self.ipntr = np.zeros(11, "int") - else: - raise ValueError("Unrecognized mode %s" % mode) - self.iparam = np.zeros(11, "int") # set solver mode and parameters @@ -128,7 +96,6 @@ self.iparam[6] = mode1 self.n = n - self.mode = mode self.matvec = matvec self.tol = tol self.k = k @@ -142,18 +109,30 @@ self.converged = False self.ido = 0 - def _unsymmetric_solver(self): - if self.tp in 'fd': - self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ - self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, - self.resid, self.v, self.iparam, self.ipntr, - self.workd, self.workl, self.info) - else: - self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info =\ - self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, - self.resid, self.v, self.iparam, self.ipntr, - self.workd, self.workl, self.rwork, self.info) +class _SymmetricArpackParams(_ArpackParams): + def __init__(self, n, k, tp, matvec, sigma=None, + ncv=None, v0=None, maxiter=None, which="LM", tol=0): + if not which in ['LM', 'SM', 'LA', 'SA', 'BE']: + raise ValueError("which must be one of %s" % ' '.join(whiches)) + _ArpackParams.__init__(self, n, k, tp, matvec, sigma, + ncv, v0, maxiter, which, tol) + + self.workd = np.zeros(3 * n, self.tp) + self.workl = np.zeros(self.ncv * (self.ncv + 8), self.tp) + + ltr = _type_conv[self.tp] + self._arpack_solver = _arpack.__dict__[ltr + 'saupd'] + self.extract = _arpack.__dict__[ltr + 'seupd'] + + self.ipntr = np.zeros(11, "int") + + def iterate(self): + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.info) + xslice = slice(self.ipntr[0]-1, self.ipntr[0]-1+self.n) yslice = slice(self.ipntr[1]-1, self.ipntr[1]-1+self.n) if self.ido == -1: @@ -170,12 +149,44 @@ elif self.info == -1: warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) - def _symmetric_solver(self): - self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ - self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, - self.resid, self.v, self.iparam, self.ipntr, - self.workd, self.workl, self.info) + if self.iparam[4] < self.k: + warnings.warn("Only %d/%d eigenvectors converged" % (self.iparam[4], self.k)) +class _UnsymmetricArpackParams(_ArpackParams): + def __init__(self, n, k, tp, matvec, sigma=None, + ncv=None, v0=None, maxiter=None, which="LM", tol=0): + if not which in ["LM", "SM", "LR", "SR", "LI", "SI"]: + raise ValueError("Parameter which must be one of %s" % ' '.join(whiches)) + + _ArpackParams.__init__(self, n, k, tp, matvec, sigma, + ncv, v0, maxiter, which, tol) + + self.workd = np.zeros(3 * n, self.tp) + self.workl = np.zeros(3 * self.ncv * self.ncv + 6 * self.ncv, self.tp) + + ltr = _type_conv[self.tp] + self._arpack_solver = _arpack.__dict__[ltr + 'naupd'] + self.extract = _arpack.__dict__[ltr + 'neupd'] + + self.ipntr = np.zeros(14, "int") + + if self.tp in 'FD': + self.rwork = np.zeros(self.ncv, self.tp.lower()) + else: + self.rwork = None + + def iterate(self): + if self.tp in 'fd': + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info = \ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.info) + else: + self.ido, self.resid, self.v, self.iparam, self.ipntr, self.info =\ + self._arpack_solver(self.ido, self.bmat, self.which, self.k, self.tol, + self.resid, self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.rwork, self.info) + xslice = slice(self.ipntr[0]-1, self.ipntr[0]-1+self.n) yslice = slice(self.ipntr[1]-1, self.ipntr[1]-1+self.n) if self.ido == -1: @@ -192,9 +203,6 @@ elif self.info == -1: warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) - if self.iparam[4] < self.k: - warnings.warn("Only %d/%d eigenvectors converged" % (self.iparam[4], self.k)) - def eigen(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): @@ -277,7 +285,7 @@ n = A.shape[0] matvec = lambda x : A.matvec(x) - params = _ArpackParams(n, k, A.dtype.char, matvec, "unsymmetric", sigma, + params = _UnsymmetricArpackParams(n, k, A.dtype.char, matvec, sigma, ncv, v0, maxiter, which, tol) if M is not None: @@ -453,7 +461,7 @@ raise NotImplementedError("generalized eigenproblem not supported yet") matvec = lambda x : A.matvec(x) - params = _ArpackParams(n, k, A.dtype.char, matvec, "symmetric", sigma, + params = _SymmetricArpackParams(n, k, A.dtype.char, matvec, sigma, ncv, v0, maxiter, which, tol) while not params.converged: From scipy-svn at scipy.org Fri Mar 26 01:35:26 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:35:26 -0500 (CDT) Subject: [Scipy-svn] r6272 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053526.168D839CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:35:25 -0500 (Fri, 26 Mar 2010) New Revision: 6272 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: REF: abstract eigen value/vector extraction into *Params classes. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:16 UTC (rev 6271) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:25 UTC (rev 6272) @@ -123,7 +123,7 @@ ltr = _type_conv[self.tp] self._arpack_solver = _arpack.__dict__[ltr + 'saupd'] - self.extract = _arpack.__dict__[ltr + 'seupd'] + self._arpack_extract = _arpack.__dict__[ltr + 'seupd'] self.ipntr = np.zeros(11, "int") @@ -152,6 +152,26 @@ if self.iparam[4] < self.k: warnings.warn("Only %d/%d eigenvectors converged" % (self.iparam[4], self.k)) + def extract(self, return_eigenvectors): + rvec = return_eigenvectors + ierr = 0 + howmny = 'A' # return all eigenvectors + sselect = np.zeros(self.ncv, 'int') # unused + sigma = 0.0 # no shifts, not implemented + + d, z, info = self._arpack_extract(rvec, howmny, sselect, sigma, self.bmat, + self.which, self.k, self.tol, self.resid, self.v, + self.iparam[0:7], self.ipntr, self.workd[0:2*self.n], + self.workl,ierr) + + if ierr != 0: + raise RuntimeError("Error info=%d in arpack" % params.info) + + if return_eigenvectors: + return d, z + else: + return d + class _UnsymmetricArpackParams(_ArpackParams): def __init__(self, n, k, tp, matvec, sigma=None, ncv=None, v0=None, maxiter=None, which="LM", tol=0): @@ -166,7 +186,7 @@ ltr = _type_conv[self.tp] self._arpack_solver = _arpack.__dict__[ltr + 'naupd'] - self.extract = _arpack.__dict__[ltr + 'neupd'] + self._arpack_extract = _arpack.__dict__[ltr + 'neupd'] self.ipntr = np.zeros(14, "int") @@ -203,6 +223,88 @@ elif self.info == -1: warnings.warn("Maximum number of iterations taken: %s" % self.iparam[2]) + def extract(self, return_eigenvectors): + k, n = self.k, self.n + + ierr = 0 + howmny = 'A' # return all eigenvectors + sselect = np.zeros(self.ncv, 'int') # unused + sigmai = 0.0 # no shifts, not implemented + sigmar = 0.0 # no shifts, not implemented + workev = np.zeros(3 * self.ncv, self.tp) + + if self.tp in 'fd': + dr = np.zeros(k+1, self.tp) + di = np.zeros(k+1, self.tp) + zr = np.zeros((n, k+1), self.tp) + dr, di, zr, self.info=\ + self._arpack_extract(return_eigenvectors, + howmny, sselect, sigmar, sigmai, workev, + self.bmat, self.which, k, self.tol, self.resid, + self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.info) + + # The ARPACK nonsymmetric real and double interface (s,d)naupd return + # eigenvalues and eigenvectors in real (float,double) arrays. + + # Build complex eigenvalues from real and imaginary parts + d = dr + 1.0j * di + + # Arrange the eigenvectors: complex eigenvectors are stored as + # real,imaginary in consecutive columns + z = zr.astype(self.tp.upper()) + eps = np.finfo(self.tp).eps + i = 0 + while i<=k: + # check if complex + if abs(d[i].imag) > eps: + # assume this is a complex conjugate pair with eigenvalues + # in consecutive columns + z[:,i] = zr[:,i] + 1.0j * zr[:,i+1] + z[:,i+1] = z[:,i].conjugate() + i +=1 + i += 1 + + # Now we have k+1 possible eigenvalues and eigenvectors + # Return the ones specified by the keyword "which" + nreturned = self.iparam[4] # number of good eigenvalues returned + if nreturned == k: # we got exactly how many eigenvalues we wanted + d = d[:k] + z = z[:,:k] + else: # we got one extra eigenvalue (likely a cc pair, but which?) + # cut at approx precision for sorting + rd = np.round(d, decimals = _ndigits[self.tp]) + if self.which in ['LR','SR']: + ind = np.argsort(rd.real) + elif self.which in ['LI','SI']: + # for LI,SI ARPACK returns largest,smallest abs(imaginary) why? + ind = np.argsort(abs(rd.imag)) + else: + ind = np.argsort(abs(rd)) + if self.which in ['LR','LM','LI']: + d = d[ind[-k:]] + z = z[:,ind[-k:]] + if self.which in ['SR','SM','SI']: + d = d[ind[:k]] + z = z[:,ind[:k]] + + else: + # complex is so much simpler... + d, z, self.info =\ + self._arpack_extract(return_eigenvectors, + howmny, sselect, sigmar, workev, + self.bmat, self.which, k, self.tol, self.resid, + self.v, self.iparam, self.ipntr, + self.workd, self.workl, self.rwork, ierr) + + if ierr != 0: + raise RuntimeError("Error info=%d in arpack" % info) + + if return_eigenvectors: + return d, z + else: + return d + def eigen(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): @@ -294,88 +396,8 @@ while not params.converged: params.iterate() - # now extract eigenvalues and (optionally) eigenvectors - rvec = return_eigenvectors - ierr = 0 - howmny = 'A' # return all eigenvectors - sselect = np.zeros(params.ncv, 'int') # unused - sigmai = 0.0 # no shifts, not implemented - sigmar = 0.0 # no shifts, not implemented - workev = np.zeros(3 * params.ncv, params.tp) + return params.extract(return_eigenvectors) - if params.tp in 'fd': - dr = np.zeros(k+1, params.tp) - di = np.zeros(k+1, params.tp) - zr = np.zeros((n, k+1), params.tp) - dr, di, zr, params.info=\ - params.extract(rvec, howmny, sselect, sigmar, sigmai, workev, - params.bmat, params.which, k, params.tol, params.resid, - params.v, params.iparam, params.ipntr, - params.workd, params.workl, params.info) - - # The ARPACK nonsymmetric real and double interface (s,d)naupd return - # eigenvalues and eigenvectors in real (float,double) arrays. - - # Build complex eigenvalues from real and imaginary parts - d = dr + 1.0j * di - - # Arrange the eigenvectors: complex eigenvectors are stored as - # real,imaginary in consecutive columns - z = zr.astype(params.tp.upper()) - eps = np.finfo(params.tp).eps - i = 0 - while i<=k: - # check if complex - if abs(d[i].imag) > eps: - # assume this is a complex conjugate pair with eigenvalues - # in consecutive columns - z[:,i] = zr[:,i] + 1.0j * zr[:,i+1] - z[:,i+1] = z[:,i].conjugate() - i +=1 - i += 1 - - # Now we have k+1 possible eigenvalues and eigenvectors - # Return the ones specified by the keyword "which" - nreturned = params.iparam[4] # number of good eigenvalues returned - if nreturned == k: # we got exactly how many eigenvalues we wanted - d = d[:k] - z = z[:,:k] - else: # we got one extra eigenvalue (likely a cc pair, but which?) - # cut at approx precision for sorting - rd = np.round(d, decimals = _ndigits[params.tp]) - if params.which in ['LR','SR']: - ind = np.argsort(rd.real) - elif which in ['LI','SI']: - # for LI,SI ARPACK returns largest,smallest abs(imaginary) why? - ind = np.argsort(abs(rd.imag)) - else: - ind = np.argsort(abs(rd)) - if params.which in ['LR','LM','LI']: - d = d[ind[-k:]] - z = z[:,ind[-k:]] - if params.which in ['SR','SM','SI']: - d = d[ind[:k]] - z = z[:,ind[:k]] - - - else: - # complex is so much simpler... - d, z, params.info =\ - params.extract(rvec, howmny, sselect, sigmar, workev, - params.bmat, params.which, k, params.tol, params.resid, - params.v, params.iparam, params.ipntr, - params.workd, params.workl, params.rwork, ierr) - - - - if ierr != 0: - raise RuntimeError("Error info=%d in arpack"%info) - return None - if return_eigenvectors: - return d,z - return d - - def eigen_symmetric(A, k=6, M=None, sigma=None, which='LM', v0=None, ncv=None, maxiter=None, tol=0, return_eigenvectors=True): @@ -467,24 +489,8 @@ while not params.converged: params.iterate() - # now extract eigenvalues and (optionally) eigenvectors - rvec = return_eigenvectors - ierr = 0 - howmny = 'A' # return all eigenvectors - sselect = np.zeros(params.ncv, 'int') # unused - sigma = 0.0 # no shifts, not implemented + return params.extract(return_eigenvectors) - d, z, info = params.extract(rvec, howmny, sselect, sigma, params.bmat, - params.which, k, params.tol, params.resid, params.v, - params.iparam[0:7], params.ipntr, params.workd[0:2*n], - params.workl,ierr) - - if ierr != 0: - raise RuntimeError("Error info=%d in arpack" % params.info) - if return_eigenvectors: - return d, z - return d - def svd(A, k=6): """Compute a few singular values/vectors for a sparse matrix using ARPACK. From scipy-svn at scipy.org Fri Mar 26 01:35:35 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 00:35:35 -0500 (CDT) Subject: [Scipy-svn] r6273 - trunk/scipy/sparse/linalg/eigen/arpack Message-ID: <20100326053535.894FD39CAF4@scipy.org> Author: cdavid Date: 2010-03-26 00:35:35 -0500 (Fri, 26 Mar 2010) New Revision: 6273 Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py Log: ENH: use implicit A'A computation for sparse SVD. Modified: trunk/scipy/sparse/linalg/eigen/arpack/arpack.py =================================================================== --- trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:25 UTC (rev 6272) +++ trunk/scipy/sparse/linalg/eigen/arpack/arpack.py 2010-03-26 05:35:35 UTC (rev 6273) @@ -519,22 +519,35 @@ else: op = lambda x: x.T - def _left(x): + tp = A.dtype.char + linear_at = aslinearoperator(op(A)) + linear_a = aslinearoperator(A) + + def _left(x, sz): x = csc_matrix(x) - m = op(x) * x - eigvals, eigvec = eigen_symmetric(m, k) + matvec = lambda x: linear_at.matvec(linear_a.matvec(x)) + params = _SymmetricArpackParams(sz, k, tp, matvec) + + while not params.converged: + params.iterate() + eigvals, eigvec = params.extract(True) s = np.sqrt(eigvals) v = eigvec u = (x * v) / s return u, s, op(v) - def _right(x): + def _right(x, sz): x = csr_matrix(x) - m = x * op(x) - eigvals, eigvec = eigen_symmetric(m, k) + matvec = lambda x: linear_a.matvec(linear_at.matvec(x)) + params = _SymmetricArpackParams(sz, k, tp, matvec) + + while not params.converged: + params.iterate() + eigvals, eigvec = params.extract(True) + s = np.sqrt(eigvals) u = eigvec @@ -542,6 +555,6 @@ return u, s, vh if n > m: - return _left(A) + return _left(A, m) else: - return _right(A) + return _right(A, n) From scipy-svn at scipy.org Fri Mar 26 20:17:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Fri, 26 Mar 2010 19:17:23 -0500 (CDT) Subject: [Scipy-svn] r6274 - in trunk/scipy/linalg: . tests Message-ID: <20100327001723.0554D39CAF1@scipy.org> Author: warren.weckesser Date: 2010-03-26 19:17:22 -0500 (Fri, 26 Mar 2010) New Revision: 6274 Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/tests/test_basic.py Log: ENH: Allow linalg.block_diag to accept scalar and 1D arguments (ticket #1128) Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-26 05:35:35 UTC (rev 6273) +++ trunk/scipy/linalg/basic.py 2010-03-27 00:17:22 UTC (rev 6274) @@ -18,7 +18,7 @@ from numpy import asarray, zeros, sum, greater_equal, subtract, arange,\ conjugate, dot, transpose import numpy -from numpy import asarray_chkfinite, outer, concatenate, reshape, single +from numpy import asarray_chkfinite, atleast_2d, outer, concatenate, reshape, single from numpy import matrix as Matrix from numpy.linalg import LinAlgError from scipy.linalg import calc_lwork @@ -894,7 +894,7 @@ return concatenate(concatenate(o, axis=1), axis=1) def block_diag(*arrs): - """Create a diagonal matrix from the provided arrays. + """Create a block diagonal matrix from the provided arrays. Given the inputs `A`, `B` and `C`, the output will have these arrays arranged on the diagonal:: @@ -908,8 +908,9 @@ Parameters ---------- - A, B, C, ... : 2-D ndarray - Input arrays. + A, B, C, ... : array-like, up to 2D + Input arrays. A 1D array or array-like sequence with length n is + treated as a 2D array with shape (1,n). Returns ------- @@ -929,15 +930,28 @@ >>> B = [[3, 4, 5], ... [6, 7, 8]] >>> C = [[7]] - >>> print block_diag(A, B, C) - [[ 1. 0. 0. 0. 0. 0.] - [ 0. 1. 0. 0. 0. 0.] - [ 0. 0. 3. 4. 5. 0.] - [ 0. 0. 6. 7. 8. 0.] - [ 0. 0. 0. 0. 0. 7.]] + >>> print(block_diag(A, B, C)) + [[1 0 0 0 0 0] + [0 1 0 0 0 0] + [0 0 3 4 5 0] + [0 0 6 7 8 0] + [0 0 0 0 0 7]] + >>> block_diag(1.0, [2, 3], [[4, 5], [6, 7]]) + array([[ 1., 0., 0., 0., 0.], + [ 0., 2., 3., 0., 0.], + [ 0., 0., 0., 4., 5.], + [ 0., 0., 0., 6., 7.]]) """ - arrs = [asarray(a) for a in arrs] + if arrs == (): + arrs = ([],) + arrs = [atleast_2d(a) for a in arrs] + + bad_args = [k for k in range(len(arrs)) if arrs[k].ndim > 2] + if bad_args: + raise ValueError("arguments in the following positions have dimension " + "greater than 2: %s" % bad_args) + shapes = numpy.array([a.shape for a in arrs]) out = zeros(sum(shapes, axis=0), dtype=arrs[0].dtype) @@ -947,4 +961,3 @@ r += rr c += cc return out - Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-03-26 05:35:35 UTC (rev 6273) +++ trunk/scipy/linalg/tests/test_basic.py 2010-03-27 00:17:22 UTC (rev 6274) @@ -463,7 +463,24 @@ x = block_diag([[True]]) assert_equal(x.dtype, bool) + + def test_scalar_and_1d_args(self): + a = block_diag(1) + assert_equal(a.shape, (1,1)) + assert_array_equal(a, [[1]]) + + a = block_diag([2,3], 4) + assert_array_equal(a, [[2, 3, 0], [0, 0, 4]]) + def test_bad_arg(self): + assert_raises(ValueError, block_diag, [[[1]]]) + + def test_no_args(self): + a = block_diag() + assert_equal(a.ndim, 2) + assert_equal(a.nbytes, 0) + + class TestPinv(TestCase): def test_simple(self): From scipy-svn at scipy.org Mon Mar 29 21:56:45 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 20:56:45 -0500 (CDT) Subject: [Scipy-svn] r6275 - trunk/scipy/cluster/src Message-ID: <20100330015645.4969A39CAEC@scipy.org> Author: cdavid Date: 2010-03-29 20:56:45 -0500 (Mon, 29 Mar 2010) New Revision: 6275 Modified: trunk/scipy/cluster/src/vq.c Log: BUG: fix warning in vq. Modified: trunk/scipy/cluster/src/vq.c =================================================================== --- trunk/scipy/cluster/src/vq.c 2010-03-27 00:17:22 UTC (rev 6274) +++ trunk/scipy/cluster/src/vq.c 2010-03-30 01:56:45 UTC (rev 6275) @@ -1,10 +1,15 @@ /* - * vim:syntax=c - * * This file implements vq for float and double in C. It is a direct * translation from the swig interface which could not be generated anymore * with recent swig */ + +/* + * Including python.h is necessary because python header redefines some macros + * in standart C header + */ +#include + #include #include From scipy-svn at scipy.org Mon Mar 29 21:56:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 20:56:52 -0500 (CDT) Subject: [Scipy-svn] r6276 - trunk Message-ID: <20100330015652.0FE0539CAEC@scipy.org> Author: cdavid Date: 2010-03-29 20:56:51 -0500 (Mon, 29 Mar 2010) New Revision: 6276 Modified: trunk/setup.py Log: PY3K: make top setup py3k compatible. Modified: trunk/setup.py =================================================================== --- trunk/setup.py 2010-03-30 01:56:45 UTC (rev 6275) +++ trunk/setup.py 2010-03-30 01:56:51 UTC (rev 6276) @@ -147,7 +147,7 @@ url = "http://www.scipy.org", download_url = "http://sourceforge.net/project/showfiles.php?group_id=27747&package_id=19531", license = 'BSD', - classifiers=filter(None, CLASSIFIERS.split('\n')), + classifiers=[f for f in CLASSIFIERS.split('\n') if f], platforms = ["Windows", "Linux", "Solaris", "Mac OS-X", "Unix"], configuration=configuration ) finally: From scipy-svn at scipy.org Mon Mar 29 21:56:59 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 20:56:59 -0500 (CDT) Subject: [Scipy-svn] r6277 - trunk/scipy/cluster Message-ID: <20100330015659.3A2F239CAEC@scipy.org> Author: cdavid Date: 2010-03-29 20:56:59 -0500 (Mon, 29 Mar 2010) New Revision: 6277 Modified: trunk/scipy/cluster/hierarchy.py Log: REF: move types import on top. Having local and non local imports on the same import statement confuses 2to3. Modified: trunk/scipy/cluster/hierarchy.py =================================================================== --- trunk/scipy/cluster/hierarchy.py 2010-03-30 01:56:51 UTC (rev 6276) +++ trunk/scipy/cluster/hierarchy.py 2010-03-30 01:56:59 UTC (rev 6277) @@ -193,9 +193,10 @@ # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +import types import numpy as np -import _hierarchy_wrap, types +import _hierarchy_wrap import scipy.spatial.distance as distance _cpy_non_euclid_methods = {'single': 0, 'complete': 1, 'average': 2, From scipy-svn at scipy.org Mon Mar 29 21:57:07 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 20:57:07 -0500 (CDT) Subject: [Scipy-svn] r6278 - trunk/scipy/fftpack/tests Message-ID: <20100330015707.13A6739CAEC@scipy.org> Author: cdavid Date: 2010-03-29 20:57:06 -0500 (Mon, 29 Mar 2010) New Revision: 6278 Modified: trunk/scipy/fftpack/tests/test_basic.py Log: PY3K: fix fftpack tests for py3k. Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2010-03-30 01:56:59 UTC (rev 6277) +++ trunk/scipy/fftpack/tests/test_basic.py 2010-03-30 01:57:06 UTC (rev 6278) @@ -64,7 +64,7 @@ n = len(x) w = -arange(n)*(2j*pi/n) r = zeros(n,dtype=double) - for i in range(n/2+1): + for i in range(int(n/2+1)): y = dot(exp(i*w),x) if i: r[2*i-1] = y.real @@ -78,7 +78,7 @@ x = asarray(x) n = len(x) x1 = zeros(n,dtype=cdouble) - for i in range(n/2+1): + for i in range(int(n/2+1)): if i: if 2*i Author: cdavid Date: 2010-03-29 20:57:14 -0500 (Mon, 29 Mar 2010) New Revision: 6279 Modified: trunk/scipy/interpolate/polyint.py Log: REF: import factorial from scipy.misc. Modified: trunk/scipy/interpolate/polyint.py =================================================================== --- trunk/scipy/interpolate/polyint.py 2010-03-30 01:57:06 UTC (rev 6278) +++ trunk/scipy/interpolate/polyint.py 2010-03-30 01:57:14 UTC (rev 6279) @@ -1,5 +1,5 @@ import numpy as np -from scipy import factorial +from scipy.misc import factorial __all__ = ["KroghInterpolator", "krogh_interpolate", "BarycentricInterpolator", "barycentric_interpolate", "PiecewisePolynomial", "piecewise_polynomial_interpolate","approximate_taylor_polynomial", "pchip"] From scipy-svn at scipy.org Mon Mar 29 21:57:21 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 20:57:21 -0500 (CDT) Subject: [Scipy-svn] r6280 - trunk/scipy Message-ID: <20100330015721.61FBA39CAEC@scipy.org> Author: cdavid Date: 2010-03-29 20:57:21 -0500 (Mon, 29 Mar 2010) New Revision: 6280 Modified: trunk/scipy/__init__.py Log: PY3K: make top __init__ py3-compatible. Modified: trunk/scipy/__init__.py =================================================================== --- trunk/scipy/__init__.py 2010-03-30 01:57:14 UTC (rev 6279) +++ trunk/scipy/__init__.py 2010-03-30 01:57:21 UTC (rev 6280) @@ -107,13 +107,13 @@ __all__.remove('linalg') try: - from __config__ import show as show_config -except ImportError, e: + from scipy.__config__ import show as show_config +except ImportError: msg = """Error importing scipy: you cannot import scipy while being in scipy source directory; please exit the scipy source tree first, and relaunch your python intepreter.""" raise ImportError(msg) -from version import version as __version__ +from scipy.version import version as __version__ # Load scipy packages and their global_symbols from numpy._import_tools import PackageLoader From scipy-svn at scipy.org Tue Mar 30 00:39:08 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 23:39:08 -0500 (CDT) Subject: [Scipy-svn] r6281 - in trunk/scipy/lib: blas lapack Message-ID: <20100330043908.A822D39CAE7@scipy.org> Author: cdavid Date: 2010-03-29 23:39:08 -0500 (Mon, 29 Mar 2010) New Revision: 6281 Modified: trunk/scipy/lib/blas/setup.py trunk/scipy/lib/lapack/setup.py Log: PY3K: make setup.py in scipy.lib py3-runnable. Modified: trunk/scipy/lib/blas/setup.py =================================================================== --- trunk/scipy/lib/blas/setup.py 2010-03-30 01:57:21 UTC (rev 6280) +++ trunk/scipy/lib/blas/setup.py 2010-03-30 04:39:08 UTC (rev 6281) @@ -58,7 +58,7 @@ atlas_version = ([v[3:-3] for k,v in blas_opt.get('define_macros',[]) \ if k=='ATLAS_INFO']+[None])[0] if atlas_version: - print 'ATLAS version',atlas_version + print ('ATLAS version: %s' % atlas_version) target_dir = '' skip_names = {'cblas':[],'fblas':[]} @@ -93,7 +93,7 @@ # cblas: def get_cblas_source(ext, build_dir): name = ext.name.split('.')[-1] - assert name=='cblas',`name` + assert name=='cblas', repr(name) if atlas_version is None: target = join(build_dir,target_dir,'cblas.pyf') from distutils.dep_util import newer Modified: trunk/scipy/lib/lapack/setup.py =================================================================== --- trunk/scipy/lib/lapack/setup.py 2010-03-30 01:57:21 UTC (rev 6280) +++ trunk/scipy/lib/lapack/setup.py 2010-03-30 04:39:08 UTC (rev 6281) @@ -34,7 +34,7 @@ atlas_version = ([v[3:-3] for k,v in lapack_opt.get('define_macros',[]) \ if k=='ATLAS_INFO']+[None])[0] if atlas_version: - print 'ATLAS version',atlas_version + print ('ATLAS version: %s' % atlas_version) target_dir = '' skip_names = {'clapack':[],'flapack':[]} From scipy-svn at scipy.org Tue Mar 30 00:39:16 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 23:39:16 -0500 (CDT) Subject: [Scipy-svn] r6282 - trunk/scipy/linalg Message-ID: <20100330043916.2997439CAE7@scipy.org> Author: cdavid Date: 2010-03-29 23:39:16 -0500 (Mon, 29 Mar 2010) New Revision: 6282 Modified: trunk/scipy/linalg/lapack.py Log: PY3K: replace obsolete new usage with types. Modified: trunk/scipy/linalg/lapack.py =================================================================== --- trunk/scipy/linalg/lapack.py 2010-03-30 04:39:08 UTC (rev 6281) +++ trunk/scipy/linalg/lapack.py 2010-03-30 04:39:16 UTC (rev 6282) @@ -6,11 +6,10 @@ __all__ = ['get_lapack_funcs'] -import new - # The following ensures that possibly missing flavor (C or Fortran) is # replaced with the available one. If none is available, exception # is raised at the first attempt to use the resources. +import types import numpy @@ -97,9 +96,9 @@ func2 = getattr(m2,func_name,None) if func2 is not None: exec _colmajor_func_template % {'func_name':func_name} - func = new.function(func_code, - {'clapack_func':func2}, - func_name) + func = types.FunctionType(func_code, + {'clapack_func':func2}, + func_name) func.module_name = m2_name func.__doc__ = func2.__doc__ func.prefix = required_prefix From scipy-svn at scipy.org Tue Mar 30 00:39:23 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 23:39:23 -0500 (CDT) Subject: [Scipy-svn] r6283 - trunk/scipy/linalg Message-ID: <20100330043923.BCC2339CAE7@scipy.org> Author: cdavid Date: 2010-03-29 23:39:23 -0500 (Mon, 29 Mar 2010) New Revision: 6283 Removed: trunk/scipy/linalg/iterative.py Modified: trunk/scipy/linalg/__init__.py Log: ENH: remove deprecated scipy.linalg.iterative. Modified: trunk/scipy/linalg/__init__.py =================================================================== --- trunk/scipy/linalg/__init__.py 2010-03-30 04:39:16 UTC (rev 6282) +++ trunk/scipy/linalg/__init__.py 2010-03-30 04:39:23 UTC (rev 6283) @@ -10,9 +10,6 @@ from matfuncs import * from blas import * -from iterative import * - - __all__ = filter(lambda s:not s.startswith('_'),dir()) from numpy.dual import register_func Deleted: trunk/scipy/linalg/iterative.py =================================================================== --- trunk/scipy/linalg/iterative.py 2010-03-30 04:39:16 UTC (rev 6282) +++ trunk/scipy/linalg/iterative.py 2010-03-30 04:39:23 UTC (rev 6283) @@ -1,13 +0,0 @@ -__all__ = ['bicg','bicgstab','cg','cgs','gmres','qmr'] - -# Deprecated on January 26, 2008 - -from scipy.sparse.linalg import isolve -from numpy import deprecate - -for name in __all__: - oldfn = getattr(isolve, name) - oldname='scipy.linalg.' + name - newname='scipy.sparse.linalg.' + name - newfn = deprecate(oldfn, old_name=oldname, new_name=newname) - exec(name + ' = newfn') From scipy-svn at scipy.org Tue Mar 30 00:39:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 23:39:33 -0500 (CDT) Subject: [Scipy-svn] r6284 - trunk/scipy/linalg Message-ID: <20100330043933.16E6E39CAE7@scipy.org> Author: cdavid Date: 2010-03-29 23:39:32 -0500 (Mon, 29 Mar 2010) New Revision: 6284 Added: trunk/scipy/linalg/misc.py trunk/scipy/linalg/special_matrices.py Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/decomp.py Log: PY3K: split linalg decomp/basic to avoid circular imports. 2to3 and python 3 are stricted in terms of circular imports, and that's bad practice in general. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-30 04:39:23 UTC (rev 6283) +++ trunk/scipy/linalg/basic.py 2010-03-30 04:39:32 UTC (rev 6284) @@ -20,9 +20,14 @@ import numpy from numpy import asarray_chkfinite, atleast_2d, outer, concatenate, reshape, single from numpy import matrix as Matrix -from numpy.linalg import LinAlgError +from misc import LinAlgError, norm +from special_matrices import tri, tril, triu, toeplitz, circulant, hankel, \ + kron, block_diag, all_mat from scipy.linalg import calc_lwork +from misc import LinAlgError, norm +from special_matrices import tri, tril, triu, toeplitz, circulant, hankel, \ + block_diag, kron import decomp def lu_solve((lu, piv), b, trans=0, overwrite_b=0): @@ -386,13 +391,6 @@ return inv_a -### Norm - -def norm(a, ord=None): - # Differs from numpy only in non-finite handling - return numpy.linalg.norm(asarray_chkfinite(a), ord=ord) -norm.__doc__ = numpy.linalg.norm.__doc__ - ### Determinant def det(a, overwrite_a=0): @@ -588,376 +586,3 @@ psigma[i,i] = 1.0/conjugate(s[i]) #XXX: use lapack/blas routines for dot return transpose(conjugate(dot(dot(u,psigma),vh))) - -#----------------------------------------------------------------------------- -# matrix construction functions -#----------------------------------------------------------------------------- - -def tri(N, M=None, k=0, dtype=None): - """Construct (N, M) matrix filled with ones at and below the k-th diagonal. - - The matrix has A[i,j] == 1 for i <= j + k - - Parameters - ---------- - N : integer - M : integer - Size of the matrix. If M is None, M == N is assumed. - k : integer - Number of subdiagonal below which matrix is filled with ones. - k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. - dtype : dtype - Data type of the matrix. - - Returns - ------- - A : array, shape (N, M) - - Examples - -------- - >>> from scipy.linalg import tri - >>> tri(3, 5, 2, dtype=int) - array([[1, 1, 1, 0, 0], - [1, 1, 1, 1, 0], - [1, 1, 1, 1, 1]]) - >>> tri(3, 5, -1, dtype=int) - array([[0, 0, 0, 0, 0], - [1, 0, 0, 0, 0], - [1, 1, 0, 0, 0]]) - - """ - if M is None: M = N - if type(M) == type('d'): - #pearu: any objections to remove this feature? - # As tri(N,'d') is equivalent to tri(N,dtype='d') - dtype = M - M = N - m = greater_equal(subtract.outer(arange(N), arange(M)),-k) - if dtype is None: - return m - else: - return m.astype(dtype) - -def tril(m, k=0): - """Construct a copy of a matrix with elements above the k-th diagonal zeroed. - - Parameters - ---------- - m : array - Matrix whose elements to return - k : integer - Diagonal above which to zero elements. - k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. - - Returns - ------- - A : array, shape m.shape, dtype m.dtype - - Examples - -------- - >>> from scipy.linalg import tril - >>> tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) - array([[ 0, 0, 0], - [ 4, 0, 0], - [ 7, 8, 0], - [10, 11, 12]]) - - """ - m = asarray(m) - out = tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype.char)*m - return out - -def triu(m, k=0): - """Construct a copy of a matrix with elements below the k-th diagonal zeroed. - - Parameters - ---------- - m : array - Matrix whose elements to return - k : integer - Diagonal below which to zero elements. - k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. - - Returns - ------- - A : array, shape m.shape, dtype m.dtype - - Examples - -------- - >>> from scipy.linalg import tril - >>> triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) - array([[ 1, 2, 3], - [ 4, 5, 6], - [ 0, 8, 9], - [ 0, 0, 12]]) - - """ - m = asarray(m) - out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m - return out - - -def toeplitz(c, r=None): - """Construct a Toeplitz matrix. - - The Toepliz matrix has constant diagonals, with c as its first column - and r as its first row. If r is not given, r == conjugate(c) is - assumed. - - Parameters - ---------- - c : array-like, 1D - First column of the matrix. Whatever the actual shape of `c`, it - will be converted to a 1D array. - r : array-like, 1D - First row of the matrix. If None, `r = conjugate(c)` is assumed; in - this case, if `c[0]` is real, the result is a Hermitian matrix. - `r[0]` is ignored; the first row of the returned matrix is - `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be - converted to a 1D array. - - Returns - ------- - A : array, shape (len(c), len(r)) - The Toeplitz matrix. - dtype is the same as `(c[0] + r[0]).dtype`. - - Examples - -------- - >>> from scipy.linalg import toeplitz - >>> toeplitz([1,2,3], [1,4,5,6]) - array([[1, 4, 5, 6], - [2, 1, 4, 5], - [3, 2, 1, 4]]) - >>> toeplitz([1.0, 2+3j, 4-1j]) - array([[ 1.+0.j, 2.-3.j, 4.+1.j], - [ 2.+3.j, 1.+0.j, 2.-3.j], - [ 4.-1.j, 2.+3.j, 1.+0.j]]) - - See also - -------- - circulant : circulant matrix - hankel : Hankel matrix - - Notes - ----- - The behavior when `c` or `r` is a scalar, or when `c` is complex and - `r` is None, was changed in version 0.8.0. The behavior in previous - versions was undocumented and is no longer supported. - """ - c = numpy.asarray(c).ravel() - if r is None: - r = c.conjugate() - else: - r = numpy.asarray(r).ravel() - # Form a 1D array of values to be used in the matrix, containing a reversed - # copy of r[1:], followed by c. - vals = numpy.concatenate((r[-1:0:-1], c)) - a, b = numpy.ogrid[0:len(c), len(r)-1:-1:-1] - indx = a + b - # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that - # `vals[indx]` is the Toeplitz matrix. - return vals[indx] - -def circulant(c): - """Construct a circulant matrix. - - Parameters - ---------- - c : array-like, 1D - First column of the matrix. - - Returns - ------- - A : array, shape (len(c), len(c)) - A circulant matrix whose first column is `c`. - - Examples - -------- - >>> from scipy.linalg import circulant - >>> circulant([1, 2, 3]) - array([[1, 3, 2], - [2, 1, 3], - [3, 2, 1]]) - - See also - -------- - toeplitz : Toeplitz matrix - hankel : Hankel matrix - - Notes - ----- - .. versionadded:: 0.8.0 - - """ - c = numpy.asarray(c).ravel() - a, b = numpy.ogrid[0:len(c), 0:-len(c):-1] - indx = a + b - # `indx` is a 2D array of indices into `c`, arranged so that `c[indx]` is - # the circulant matrix. - return c[indx] - -def hankel(c, r=None): - """Construct a Hankel matrix. - - The Hankel matrix has constant anti-diagonals, with `c` as its - first column and `r` as its last row. If `r` is not given, then - `r = zeros_like(c)` is assumed. - - Parameters - ---------- - c : array-like, 1D - First column of the matrix. Whatever the actual shape of `c`, it - will be converted to a 1D array. - r : array-like, 1D - Last row of the matrix. If None, `r` == 0 is assumed. - `r[0]` is ignored; the last row of the returned matrix is - `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be - converted to a 1D array. - - Returns - ------- - A : array, shape (len(c), len(r)) - The Hankel matrix. - dtype is the same as `(c[0] + r[0]).dtype`. - - Examples - -------- - >>> from scipy.linalg import hankel - >>> hankel([1, 17, 99]) - array([[ 1, 17, 99], - [17, 99, 0], - [99, 0, 0]]) - >>> hankel([1,2,3,4], [4,7,7,8,9]) - array([[1, 2, 3, 4, 7], - [2, 3, 4, 7, 7], - [3, 4, 7, 7, 8], - [4, 7, 7, 8, 9]]) - - See also - -------- - toeplitz : Toeplitz matrix - circulant : circulant matrix - - """ - c = numpy.asarray(c).ravel() - if r is None: - r = numpy.zeros_like(c) - else: - r = numpy.asarray(r).ravel() - # Form a 1D array of values to be used in the matrix, containing `c` - # followed by r[1:]. - vals = numpy.concatenate((c, r[1:])) - a, b = numpy.ogrid[0:len(c), 0:len(r)] - indx = a + b - # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that - # `vals[indx]` is the Hankel matrix. - return vals[indx] - -def all_mat(*args): - return map(Matrix,args) - -def kron(a,b): - """Kronecker product of a and b. - - The result is the block matrix:: - - a[0,0]*b a[0,1]*b ... a[0,-1]*b - a[1,0]*b a[1,1]*b ... a[1,-1]*b - ... - a[-1,0]*b a[-1,1]*b ... a[-1,-1]*b - - Parameters - ---------- - a : array, shape (M, N) - b : array, shape (P, Q) - - Returns - ------- - A : array, shape (M*P, N*Q) - Kronecker product of a and b - - Examples - -------- - >>> from scipy import kron, array - >>> kron(array([[1,2],[3,4]]), array([[1,1,1]])) - array([[1, 1, 1, 2, 2, 2], - [3, 3, 3, 4, 4, 4]]) - - """ - if not a.flags['CONTIGUOUS']: - a = reshape(a, a.shape) - if not b.flags['CONTIGUOUS']: - b = reshape(b, b.shape) - o = outer(a,b) - o=o.reshape(a.shape + b.shape) - return concatenate(concatenate(o, axis=1), axis=1) - -def block_diag(*arrs): - """Create a block diagonal matrix from the provided arrays. - - Given the inputs `A`, `B` and `C`, the output will have these - arrays arranged on the diagonal:: - - [[A, 0, 0], - [0, B, 0], - [0, 0, C]] - - If all the input arrays are square, the output is known as a - block diagonal matrix. - - Parameters - ---------- - A, B, C, ... : array-like, up to 2D - Input arrays. A 1D array or array-like sequence with length n is - treated as a 2D array with shape (1,n). - - Returns - ------- - D : ndarray - Array with `A`, `B`, `C`, ... on the diagonal. `D` has the - same dtype as `A`. - - References - ---------- - .. [1] Wikipedia, "Block matrix", - http://en.wikipedia.org/wiki/Block_diagonal_matrix - - Examples - -------- - >>> A = [[1, 0], - ... [0, 1]] - >>> B = [[3, 4, 5], - ... [6, 7, 8]] - >>> C = [[7]] - >>> print(block_diag(A, B, C)) - [[1 0 0 0 0 0] - [0 1 0 0 0 0] - [0 0 3 4 5 0] - [0 0 6 7 8 0] - [0 0 0 0 0 7]] - >>> block_diag(1.0, [2, 3], [[4, 5], [6, 7]]) - array([[ 1., 0., 0., 0., 0.], - [ 0., 2., 3., 0., 0.], - [ 0., 0., 0., 4., 5.], - [ 0., 0., 0., 6., 7.]]) - - """ - if arrs == (): - arrs = ([],) - arrs = [atleast_2d(a) for a in arrs] - - bad_args = [k for k in range(len(arrs)) if arrs[k].ndim > 2] - if bad_args: - raise ValueError("arguments in the following positions have dimension " - "greater than 2: %s" % bad_args) - - shapes = numpy.array([a.shape for a in arrs]) - out = zeros(sum(shapes, axis=0), dtype=arrs[0].dtype) - - r, c = 0, 0 - for i, (rr, cc) in enumerate(shapes): - out[r:r + rr, c:c + cc] = arrs[i] - r += rr - c += cc - return out Modified: trunk/scipy/linalg/decomp.py =================================================================== --- trunk/scipy/linalg/decomp.py 2010-03-30 04:39:23 UTC (rev 6283) +++ trunk/scipy/linalg/decomp.py 2010-03-30 04:39:32 UTC (rev 6284) @@ -15,8 +15,9 @@ 'schur','rsf2csf','lu_factor','cho_factor','cho_solve','orth', 'hessenberg'] -from basic import LinAlgError -import basic +from misc import LinAlgError +import misc +import special_matrices from warnings import warn from lapack import get_lapack_funcs, find_best_lapack_type @@ -1196,9 +1197,9 @@ % -info) if not econ or M eps*(abs(T[m-1,m-1]) + abs(T[m,m])): k = slice(m-1,m+1) mu = eigvals(T[k,k]) - T[m,m] - r = basic.norm([mu[0], T[m,m-1]]) + r = misc.norm([mu[0], T[m,m-1]]) c = mu[0] / r s = T[m,m-1] / r G = r_[arr([[conj(c),s]],dtype=t),arr([[-s,c]],dtype=t)] Added: trunk/scipy/linalg/misc.py =================================================================== --- trunk/scipy/linalg/misc.py (rev 0) +++ trunk/scipy/linalg/misc.py 2010-03-30 04:39:32 UTC (rev 6284) @@ -0,0 +1,10 @@ +import numpy as np +from numpy.linalg import LinAlgError + +### Norm + +def norm(a, ord=None): + # Differs from numpy only in non-finite handling + return np.linalg.norm(np.asarray_chkfinite(a), ord=ord) +norm.__doc__ = np.linalg.norm.__doc__ + Added: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py (rev 0) +++ trunk/scipy/linalg/special_matrices.py 2010-03-30 04:39:32 UTC (rev 6284) @@ -0,0 +1,374 @@ +import numpy as np + +#----------------------------------------------------------------------------- +# matrix construction functions +#----------------------------------------------------------------------------- + +def tri(N, M=None, k=0, dtype=None): + """Construct (N, M) matrix filled with ones at and below the k-th diagonal. + + The matrix has A[i,j] == 1 for i <= j + k + + Parameters + ---------- + N : integer + M : integer + Size of the matrix. If M is None, M == N is assumed. + k : integer + Number of subdiagonal below which matrix is filled with ones. + k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. + dtype : dtype + Data type of the matrix. + + Returns + ------- + A : array, shape (N, M) + + Examples + -------- + >>> from scipy.linalg import tri + >>> tri(3, 5, 2, dtype=int) + array([[1, 1, 1, 0, 0], + [1, 1, 1, 1, 0], + [1, 1, 1, 1, 1]]) + >>> tri(3, 5, -1, dtype=int) + array([[0, 0, 0, 0, 0], + [1, 0, 0, 0, 0], + [1, 1, 0, 0, 0]]) + + """ + if M is None: M = N + if type(M) == type('d'): + #pearu: any objections to remove this feature? + # As tri(N,'d') is equivalent to tri(N,dtype='d') + dtype = M + M = N + m = np.greater_equal(np.subtract.outer(np.arange(N), np.arange(M)),-k) + if dtype is None: + return m + else: + return m.astype(dtype) + +def tril(m, k=0): + """Construct a copy of a matrix with elements above the k-th diagonal zeroed. + + Parameters + ---------- + m : array + Matrix whose elements to return + k : integer + Diagonal above which to zero elements. + k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. + + Returns + ------- + A : array, shape m.shape, dtype m.dtype + + Examples + -------- + >>> from scipy.linalg import tril + >>> tril([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) + array([[ 0, 0, 0], + [ 4, 0, 0], + [ 7, 8, 0], + [10, 11, 12]]) + + """ + m = np.asarray(m) + out = tri(m.shape[0], m.shape[1], k=k, dtype=m.dtype.char)*m + return out + +def triu(m, k=0): + """Construct a copy of a matrix with elements below the k-th diagonal zeroed. + + Parameters + ---------- + m : array + Matrix whose elements to return + k : integer + Diagonal below which to zero elements. + k == 0 is the main diagonal, k < 0 subdiagonal and k > 0 superdiagonal. + + Returns + ------- + A : array, shape m.shape, dtype m.dtype + + Examples + -------- + >>> from scipy.linalg import tril + >>> triu([[1,2,3],[4,5,6],[7,8,9],[10,11,12]], -1) + array([[ 1, 2, 3], + [ 4, 5, 6], + [ 0, 8, 9], + [ 0, 0, 12]]) + + """ + m = np.asarray(m) + out = (1-tri(m.shape[0], m.shape[1], k-1, m.dtype.char))*m + return out + + +def toeplitz(c, r=None): + """Construct a Toeplitz matrix. + + The Toepliz matrix has constant diagonals, with c as its first column + and r as its first row. If r is not given, r == conjugate(c) is + assumed. + + Parameters + ---------- + c : array-like, 1D + First column of the matrix. Whatever the actual shape of `c`, it + will be converted to a 1D array. + r : array-like, 1D + First row of the matrix. If None, `r = conjugate(c)` is assumed; in + this case, if `c[0]` is real, the result is a Hermitian matrix. + `r[0]` is ignored; the first row of the returned matrix is + `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be + converted to a 1D array. + + Returns + ------- + A : array, shape (len(c), len(r)) + The Toeplitz matrix. + dtype is the same as `(c[0] + r[0]).dtype`. + + Examples + -------- + >>> from scipy.linalg import toeplitz + >>> toeplitz([1,2,3], [1,4,5,6]) + array([[1, 4, 5, 6], + [2, 1, 4, 5], + [3, 2, 1, 4]]) + >>> toeplitz([1.0, 2+3j, 4-1j]) + array([[ 1.+0.j, 2.-3.j, 4.+1.j], + [ 2.+3.j, 1.+0.j, 2.-3.j], + [ 4.-1.j, 2.+3.j, 1.+0.j]]) + + See also + -------- + circulant : circulant matrix + hankel : Hankel matrix + + Notes + ----- + The behavior when `c` or `r` is a scalar, or when `c` is complex and + `r` is None, was changed in version 0.8.0. The behavior in previous + versions was undocumented and is no longer supported. + """ + c = np.asarray(c).ravel() + if r is None: + r = c.conjugate() + else: + r = np.asarray(r).ravel() + # Form a 1D array of values to be used in the matrix, containing a reversed + # copy of r[1:], followed by c. + vals = np.concatenate((r[-1:0:-1], c)) + a, b = np.ogrid[0:len(c), len(r)-1:-1:-1] + indx = a + b + # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that + # `vals[indx]` is the Toeplitz matrix. + return vals[indx] + +def circulant(c): + """Construct a circulant matrix. + + Parameters + ---------- + c : array-like, 1D + First column of the matrix. + + Returns + ------- + A : array, shape (len(c), len(c)) + A circulant matrix whose first column is `c`. + + Examples + -------- + >>> from scipy.linalg import circulant + >>> circulant([1, 2, 3]) + array([[1, 3, 2], + [2, 1, 3], + [3, 2, 1]]) + + See also + -------- + toeplitz : Toeplitz matrix + hankel : Hankel matrix + + Notes + ----- + .. versionadded:: 0.8.0 + + """ + c = np.asarray(c).ravel() + a, b = np.ogrid[0:len(c), 0:-len(c):-1] + indx = a + b + # `indx` is a 2D array of indices into `c`, arranged so that `c[indx]` is + # the circulant matrix. + return c[indx] + +def hankel(c, r=None): + """Construct a Hankel matrix. + + The Hankel matrix has constant anti-diagonals, with `c` as its + first column and `r` as its last row. If `r` is not given, then + `r = zeros_like(c)` is assumed. + + Parameters + ---------- + c : array-like, 1D + First column of the matrix. Whatever the actual shape of `c`, it + will be converted to a 1D array. + r : array-like, 1D + Last row of the matrix. If None, `r` == 0 is assumed. + `r[0]` is ignored; the last row of the returned matrix is + `[c[0], r[1:]]`. Whatever the actual shape of `r`, it will be + converted to a 1D array. + + Returns + ------- + A : array, shape (len(c), len(r)) + The Hankel matrix. + dtype is the same as `(c[0] + r[0]).dtype`. + + Examples + -------- + >>> from scipy.linalg import hankel + >>> hankel([1, 17, 99]) + array([[ 1, 17, 99], + [17, 99, 0], + [99, 0, 0]]) + >>> hankel([1,2,3,4], [4,7,7,8,9]) + array([[1, 2, 3, 4, 7], + [2, 3, 4, 7, 7], + [3, 4, 7, 7, 8], + [4, 7, 7, 8, 9]]) + + See also + -------- + toeplitz : Toeplitz matrix + circulant : circulant matrix + + """ + c = np.asarray(c).ravel() + if r is None: + r = np.zeros_like(c) + else: + r = np.asarray(r).ravel() + # Form a 1D array of values to be used in the matrix, containing `c` + # followed by r[1:]. + vals = np.concatenate((c, r[1:])) + a, b = np.ogrid[0:len(c), 0:len(r)] + indx = a + b + # `indx` is a 2D array of indices into the 1D array `vals`, arranged so that + # `vals[indx]` is the Hankel matrix. + return vals[indx] + +def all_mat(*args): + return map(np.matrix,args) + +def kron(a,b): + """Kronecker product of a and b. + + The result is the block matrix:: + + a[0,0]*b a[0,1]*b ... a[0,-1]*b + a[1,0]*b a[1,1]*b ... a[1,-1]*b + ... + a[-1,0]*b a[-1,1]*b ... a[-1,-1]*b + + Parameters + ---------- + a : array, shape (M, N) + b : array, shape (P, Q) + + Returns + ------- + A : array, shape (M*P, N*Q) + Kronecker product of a and b + + Examples + -------- + >>> from scipy import kron, array + >>> kron(array([[1,2],[3,4]]), array([[1,1,1]])) + array([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]]) + + """ + if not a.flags['CONTIGUOUS']: + a = reshape(a, a.shape) + if not b.flags['CONTIGUOUS']: + b = reshape(b, b.shape) + o = outer(a,b) + o=o.reshape(a.shape + b.shape) + return concatenate(concatenate(o, axis=1), axis=1) + +def block_diag(*arrs): + """Create a block diagonal matrix from the provided arrays. + + Given the inputs `A`, `B` and `C`, the output will have these + arrays arranged on the diagonal:: + + [[A, 0, 0], + [0, B, 0], + [0, 0, C]] + + If all the input arrays are square, the output is known as a + block diagonal matrix. + + Parameters + ---------- + A, B, C, ... : array-like, up to 2D + Input arrays. A 1D array or array-like sequence with length n is + treated as a 2D array with shape (1,n). + + Returns + ------- + D : ndarray + Array with `A`, `B`, `C`, ... on the diagonal. `D` has the + same dtype as `A`. + + References + ---------- + .. [1] Wikipedia, "Block matrix", + http://en.wikipedia.org/wiki/Block_diagonal_matrix + + Examples + -------- + >>> A = [[1, 0], + ... [0, 1]] + >>> B = [[3, 4, 5], + ... [6, 7, 8]] + >>> C = [[7]] + >>> print(block_diag(A, B, C)) + [[1 0 0 0 0 0] + [0 1 0 0 0 0] + [0 0 3 4 5 0] + [0 0 6 7 8 0] + [0 0 0 0 0 7]] + >>> block_diag(1.0, [2, 3], [[4, 5], [6, 7]]) + array([[ 1., 0., 0., 0., 0.], + [ 0., 2., 3., 0., 0.], + [ 0., 0., 0., 4., 5.], + [ 0., 0., 0., 6., 7.]]) + + """ + if arrs == (): + arrs = ([],) + arrs = [np.atleast_2d(a) for a in arrs] + + bad_args = [k for k in range(len(arrs)) if arrs[k].ndim > 2] + if bad_args: + raise ValueError("arguments in the following positions have dimension " + "greater than 2: %s" % bad_args) + + shapes = np.array([a.shape for a in arrs]) + out = np.zeros(np.sum(shapes, axis=0), dtype=arrs[0].dtype) + + r, c = 0, 0 + for i, (rr, cc) in enumerate(shapes): + out[r:r + rr, c:c + cc] = arrs[i] + r += rr + c += cc + return out From scipy-svn at scipy.org Tue Mar 30 00:39:41 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Mon, 29 Mar 2010 23:39:41 -0500 (CDT) Subject: [Scipy-svn] r6285 - trunk/scipy/stats/tests Message-ID: <20100330043941.2E6D039CAFD@scipy.org> Author: cdavid Date: 2010-03-29 23:39:41 -0500 (Mon, 29 Mar 2010) New Revision: 6285 Modified: trunk/scipy/stats/tests/test_discrete_basic.py Log: BUG: update histogram to use numpy >= 1.4 conventions. Modified: trunk/scipy/stats/tests/test_discrete_basic.py =================================================================== --- trunk/scipy/stats/tests/test_discrete_basic.py 2010-03-30 04:39:32 UTC (rev 6284) +++ trunk/scipy/stats/tests/test_discrete_basic.py 2010-03-30 04:39:41 UTC (rev 6285) @@ -249,7 +249,7 @@ histsupp[0] = distfn.a # find sample frequencies and perform chisquare test - freq,hsupp = np.histogram(rvs,histsupp,new=True) + freq,hsupp = np.histogram(rvs,histsupp) cdfs = distfn.cdf(distsupp,*arg) (chis,pval) = stats.chisquare(np.array(freq),n*distmass) From scipy-svn at scipy.org Tue Mar 30 21:42:00 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 20:42:00 -0500 (CDT) Subject: [Scipy-svn] r6286 - in trunk/scipy/linalg: . tests Message-ID: <20100331014200.BC22F39CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 20:42:00 -0500 (Tue, 30 Mar 2010) New Revision: 6286 Added: trunk/scipy/linalg/tests/test_special_matrices.py Modified: trunk/scipy/linalg/basic.py trunk/scipy/linalg/special_matrices.py trunk/scipy/linalg/tests/test_basic.py Log: ENH: Added the function hadamard() to linalg (ticket #675). Cleaned up unused and duplicated imports in basic.py. Moved tests of special matrices to their own file. Added a test for kron. Modified: trunk/scipy/linalg/basic.py =================================================================== --- trunk/scipy/linalg/basic.py 2010-03-30 04:39:41 UTC (rev 6285) +++ trunk/scipy/linalg/basic.py 2010-03-31 01:42:00 UTC (rev 6286) @@ -7,29 +7,30 @@ # # w/ additions by Travis Oliphant, March 2002 -__all__ = ['solve', 'inv', 'det', 'lstsq', 'norm', 'pinv', 'pinv2', - 'tri','tril', 'triu', 'toeplitz', 'circulant', 'hankel', 'block_diag', - 'lu_solve', 'cho_solve', 'solve_banded', 'LinAlgError', 'kron', - 'all_mat', 'cholesky_banded', 'solveh_banded'] +__all__ = ['solve', 'inv', 'det', 'lstsq', 'pinv', 'pinv2', + 'cholesky_banded', 'solveh_banded', 'lu_solve', 'cho_solve', + 'solve_banded', + # From special_matrices: + 'tri','tril', 'triu', 'toeplitz', 'circulant', 'hankel', 'kron', + 'hadamard', 'block_diag', 'all_mat', + # From misc: + 'LinAlgError', 'norm', + ] +from numpy import asarray, zeros, sum, conjugate, dot, transpose, \ + asarray_chkfinite, single +import numpy + #from blas import get_blas_funcs from flinalg import get_flinalg_funcs from lapack import get_lapack_funcs -from numpy import asarray, zeros, sum, greater_equal, subtract, arange,\ - conjugate, dot, transpose -import numpy -from numpy import asarray_chkfinite, atleast_2d, outer, concatenate, reshape, single -from numpy import matrix as Matrix from misc import LinAlgError, norm from special_matrices import tri, tril, triu, toeplitz, circulant, hankel, \ - kron, block_diag, all_mat + hadamard, kron, block_diag, all_mat from scipy.linalg import calc_lwork - -from misc import LinAlgError, norm -from special_matrices import tri, tril, triu, toeplitz, circulant, hankel, \ - block_diag, kron import decomp + def lu_solve((lu, piv), b, trans=0, overwrite_b=0): """Solve an equation system, a x = b, given the LU factorization of a Modified: trunk/scipy/linalg/special_matrices.py =================================================================== --- trunk/scipy/linalg/special_matrices.py 2010-03-30 04:39:41 UTC (rev 6285) +++ trunk/scipy/linalg/special_matrices.py 2010-03-31 01:42:00 UTC (rev 6286) @@ -1,3 +1,5 @@ + +import math import numpy as np #----------------------------------------------------------------------------- @@ -265,6 +267,59 @@ # `vals[indx]` is the Hankel matrix. return vals[indx] +def hadamard(n, dtype=int): + """Construct a Hadamard matrix. + + `hadamard(n)` constructs an n-by-n Hadamard matrix, using Sylvester's + construction. `n` must be a power of 2. + + Parameters + ---------- + n : int + The order of the matrix. `n` must be a power of 2. + dtype : numpy dtype + The data type of the array to be constructed. + + Returns + ------- + H : ndarray with shape (n, n) + The Hadamard matrix. + + Examples + -------- + >>> hadamard(2, dtype=complex) + array([[ 1.+0.j, 1.+0.j], + [ 1.+0.j, -1.-0.j]]) + >>> hadamard(4) + array([[ 1, 1, 1, 1], + [ 1, -1, 1, -1], + [ 1, 1, -1, -1], + [ 1, -1, -1, 1]]) + + Notes + ----- + .. versionadded:: 0.8.0 + + """ + + # This function is a slightly modified version of the + # function contributed by Ivo in ticket #675. + + if n < 1: + lg2 = 0 + else: + lg2 = int(math.log(n, 2)) + if 2 ** lg2 != n: + raise ValueError("n must be an positive integer, and n must be power of 2") + + H = np.array([[1]], dtype=dtype) + + # Sylvester's construction + for i in range(0, lg2): + H = np.vstack((np.hstack((H, H)), np.hstack((H, -H)))) + + return H + def all_mat(*args): return map(np.matrix,args) @@ -297,12 +352,12 @@ """ if not a.flags['CONTIGUOUS']: - a = reshape(a, a.shape) + a = np.reshape(a, a.shape) if not b.flags['CONTIGUOUS']: - b = reshape(b, b.shape) - o = outer(a,b) - o=o.reshape(a.shape + b.shape) - return concatenate(concatenate(o, axis=1), axis=1) + b = np.reshape(b, b.shape) + o = np.outer(a,b) + o = o.reshape(a.shape + b.shape) + return np.concatenate(np.concatenate(o, axis=1), axis=1) def block_diag(*arrs): """Create a block diagonal matrix from the provided arrays. Modified: trunk/scipy/linalg/tests/test_basic.py =================================================================== --- trunk/scipy/linalg/tests/test_basic.py 2010-03-30 04:39:41 UTC (rev 6285) +++ trunk/scipy/linalg/tests/test_basic.py 2010-03-31 01:42:00 UTC (rev 6286) @@ -19,23 +19,17 @@ python tests/test_basic.py """ -from numpy import arange, add, array, dot, zeros, identity, conjugate, \ - transpose, eye, all, copy +from numpy import arange, array, dot, zeros, identity, conjugate, transpose import numpy.linalg as linalg from numpy.testing import * -from scipy.linalg import solve,inv,det,lstsq, toeplitz, hankel, circulant, \ - tri, triu, tril, pinv, pinv2, solve_banded, block_diag, norm +from scipy.linalg import solve, inv, det, lstsq, pinv, pinv2, solve_banded, norm def random(size): return rand(*size) -def get_mat(n): - data = arange(n) - data = add.outer(data,data) - return data class TestSolveBanded(TestCase): @@ -305,182 +299,9 @@ #XXX: check definition of res assert_array_almost_equal(x,direct_lstsq(a,b,1)) -class TestTri(TestCase): - def test_basic(self): - assert_equal(tri(4),array([[1,0,0,0], - [1,1,0,0], - [1,1,1,0], - [1,1,1,1]])) - assert_equal(tri(4,dtype='f'),array([[1,0,0,0], - [1,1,0,0], - [1,1,1,0], - [1,1,1,1]],'f')) - def test_diag(self): - assert_equal(tri(4,k=1),array([[1,1,0,0], - [1,1,1,0], - [1,1,1,1], - [1,1,1,1]])) - assert_equal(tri(4,k=-1),array([[0,0,0,0], - [1,0,0,0], - [1,1,0,0], - [1,1,1,0]])) - def test_2d(self): - assert_equal(tri(4,3),array([[1,0,0], - [1,1,0], - [1,1,1], - [1,1,1]])) - assert_equal(tri(3,4),array([[1,0,0,0], - [1,1,0,0], - [1,1,1,0]])) - def test_diag2d(self): - assert_equal(tri(3,4,k=2),array([[1,1,1,0], - [1,1,1,1], - [1,1,1,1]])) - assert_equal(tri(4,3,k=-2),array([[0,0,0], - [0,0,0], - [1,0,0], - [1,1,0]])) -class TestTril(TestCase): - def test_basic(self): - a = (100*get_mat(5)).astype('l') - b = a.copy() - for k in range(5): - for l in range(k+1,5): - b[k,l] = 0 - assert_equal(tril(a),b) - def test_diag(self): - a = (100*get_mat(5)).astype('f') - b = a.copy() - for k in range(5): - for l in range(k+3,5): - b[k,l] = 0 - assert_equal(tril(a,k=2),b) - b = a.copy() - for k in range(5): - for l in range(max((k-1,0)),5): - b[k,l] = 0 - assert_equal(tril(a,k=-2),b) -class TestTriu(TestCase): - def test_basic(self): - a = (100*get_mat(5)).astype('l') - b = a.copy() - for k in range(5): - for l in range(k+1,5): - b[l,k] = 0 - assert_equal(triu(a),b) - - def test_diag(self): - a = (100*get_mat(5)).astype('f') - b = a.copy() - for k in range(5): - for l in range(max((k-1,0)),5): - b[l,k] = 0 - assert_equal(triu(a,k=2),b) - b = a.copy() - for k in range(5): - for l in range(k+3,5): - b[l,k] = 0 - assert_equal(triu(a,k=-2),b) - - -class TestToeplitz(TestCase): - - def test_basic(self): - y = toeplitz([1,2,3]) - assert_array_equal(y,[[1,2,3],[2,1,2],[3,2,1]]) - y = toeplitz([1,2,3],[1,4,5]) - assert_array_equal(y,[[1,4,5],[2,1,4],[3,2,1]]) - - def test_complex_01(self): - data = (1.0 + arange(3.0)) * (1.0 + 1.0j) - x = copy(data) - t = toeplitz(x) - # Calling toeplitz should not change x. - assert_array_equal(x, data) - # According to the docstring, x should be the first column of t. - col0 = t[:,0] - assert_array_equal(col0, data) - assert_array_equal(t[0,1:], data[1:].conj()) - - def test_scalar_00(self): - """Scalar arguments still produce a 2D array.""" - t = toeplitz(10) - assert_array_equal(t, [[10]]) - t = toeplitz(10, 20) - assert_array_equal(t, [[10]]) - - def test_scalar_01(self): - c = array([1,2,3]) - t = toeplitz(c, 1) - assert_array_equal(t, [[1],[2],[3]]) - - def test_scalar_02(self): - c = array([1,2,3]) - t = toeplitz(c, array(1)) - assert_array_equal(t, [[1],[2],[3]]) - - def test_scalar_03(self): - c = array([1,2,3]) - t = toeplitz(c, array([1])) - assert_array_equal(t, [[1],[2],[3]]) - - def test_scalar_04(self): - r = array([10,2,3]) - t = toeplitz(1, r) - assert_array_equal(t, [[1,2,3]]) - - -class TestHankel(TestCase): - def test_basic(self): - y = hankel([1,2,3]) - assert_array_equal(y,[[1,2,3],[2,3,0],[3,0,0]]) - y = hankel([1,2,3],[3,4,5]) - assert_array_equal(y,[[1,2,3],[2,3,4],[3,4,5]]) - - -class TestCirculant(TestCase): - def test_basic(self): - y = circulant([1,2,3]) - assert_array_equal(y,[[1,3,2],[2,1,3],[3,2,1]]) - - -class TestBlockDiag: - def test_basic(self): - x = block_diag(eye(2), [[1,2], [3,4], [5,6]], [[1, 2, 3]]) - assert all(x == [[1, 0, 0, 0, 0, 0, 0], - [0, 1, 0, 0, 0, 0, 0], - [0, 0, 1, 2, 0, 0, 0], - [0, 0, 3, 4, 0, 0, 0], - [0, 0, 5, 6, 0, 0, 0], - [0, 0, 0, 0, 1, 2, 3]]) - - def test_dtype(self): - x = block_diag([[1.5]]) - assert_equal(x.dtype, float) - - x = block_diag([[True]]) - assert_equal(x.dtype, bool) - - def test_scalar_and_1d_args(self): - a = block_diag(1) - assert_equal(a.shape, (1,1)) - assert_array_equal(a, [[1]]) - - a = block_diag([2,3], 4) - assert_array_equal(a, [[2, 3, 0], [0, 0, 4]]) - - def test_bad_arg(self): - assert_raises(ValueError, block_diag, [[[1]]]) - - def test_no_args(self): - a = block_diag() - assert_equal(a.ndim, 2) - assert_equal(a.nbytes, 0) - - class TestPinv(TestCase): def test_simple(self): Added: trunk/scipy/linalg/tests/test_special_matrices.py =================================================================== --- trunk/scipy/linalg/tests/test_special_matrices.py (rev 0) +++ trunk/scipy/linalg/tests/test_special_matrices.py 2010-03-31 01:42:00 UTC (rev 6286) @@ -0,0 +1,229 @@ +"""Tests for functions in special_matrices.py.""" + +from numpy import arange, add, array, eye, all, copy +from numpy.testing import * + +from scipy.linalg import toeplitz, hankel, circulant, hadamard, tri, triu, tril, \ + kron, block_diag + + +def get_mat(n): + data = arange(n) + data = add.outer(data,data) + return data + + +class TestTri(TestCase): + def test_basic(self): + assert_equal(tri(4),array([[1,0,0,0], + [1,1,0,0], + [1,1,1,0], + [1,1,1,1]])) + assert_equal(tri(4,dtype='f'),array([[1,0,0,0], + [1,1,0,0], + [1,1,1,0], + [1,1,1,1]],'f')) + def test_diag(self): + assert_equal(tri(4,k=1),array([[1,1,0,0], + [1,1,1,0], + [1,1,1,1], + [1,1,1,1]])) + assert_equal(tri(4,k=-1),array([[0,0,0,0], + [1,0,0,0], + [1,1,0,0], + [1,1,1,0]])) + def test_2d(self): + assert_equal(tri(4,3),array([[1,0,0], + [1,1,0], + [1,1,1], + [1,1,1]])) + assert_equal(tri(3,4),array([[1,0,0,0], + [1,1,0,0], + [1,1,1,0]])) + def test_diag2d(self): + assert_equal(tri(3,4,k=2),array([[1,1,1,0], + [1,1,1,1], + [1,1,1,1]])) + assert_equal(tri(4,3,k=-2),array([[0,0,0], + [0,0,0], + [1,0,0], + [1,1,0]])) + +class TestTril(TestCase): + def test_basic(self): + a = (100*get_mat(5)).astype('l') + b = a.copy() + for k in range(5): + for l in range(k+1,5): + b[k,l] = 0 + assert_equal(tril(a),b) + + def test_diag(self): + a = (100*get_mat(5)).astype('f') + b = a.copy() + for k in range(5): + for l in range(k+3,5): + b[k,l] = 0 + assert_equal(tril(a,k=2),b) + b = a.copy() + for k in range(5): + for l in range(max((k-1,0)),5): + b[k,l] = 0 + assert_equal(tril(a,k=-2),b) + + +class TestTriu(TestCase): + def test_basic(self): + a = (100*get_mat(5)).astype('l') + b = a.copy() + for k in range(5): + for l in range(k+1,5): + b[l,k] = 0 + assert_equal(triu(a),b) + + def test_diag(self): + a = (100*get_mat(5)).astype('f') + b = a.copy() + for k in range(5): + for l in range(max((k-1,0)),5): + b[l,k] = 0 + assert_equal(triu(a,k=2),b) + b = a.copy() + for k in range(5): + for l in range(k+3,5): + b[l,k] = 0 + assert_equal(triu(a,k=-2),b) + + +class TestToeplitz(TestCase): + + def test_basic(self): + y = toeplitz([1,2,3]) + assert_array_equal(y,[[1,2,3],[2,1,2],[3,2,1]]) + y = toeplitz([1,2,3],[1,4,5]) + assert_array_equal(y,[[1,4,5],[2,1,4],[3,2,1]]) + + def test_complex_01(self): + data = (1.0 + arange(3.0)) * (1.0 + 1.0j) + x = copy(data) + t = toeplitz(x) + # Calling toeplitz should not change x. + assert_array_equal(x, data) + # According to the docstring, x should be the first column of t. + col0 = t[:,0] + assert_array_equal(col0, data) + assert_array_equal(t[0,1:], data[1:].conj()) + + def test_scalar_00(self): + """Scalar arguments still produce a 2D array.""" + t = toeplitz(10) + assert_array_equal(t, [[10]]) + t = toeplitz(10, 20) + assert_array_equal(t, [[10]]) + + def test_scalar_01(self): + c = array([1,2,3]) + t = toeplitz(c, 1) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_02(self): + c = array([1,2,3]) + t = toeplitz(c, array(1)) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_03(self): + c = array([1,2,3]) + t = toeplitz(c, array([1])) + assert_array_equal(t, [[1],[2],[3]]) + + def test_scalar_04(self): + r = array([10,2,3]) + t = toeplitz(1, r) + assert_array_equal(t, [[1,2,3]]) + + +class TestHankel(TestCase): + def test_basic(self): + y = hankel([1,2,3]) + assert_array_equal(y, [[1,2,3], [2,3,0], [3,0,0]]) + y = hankel([1,2,3], [3,4,5]) + assert_array_equal(y, [[1,2,3], [2,3,4], [3,4,5]]) + + +class TestCirculant(TestCase): + def test_basic(self): + y = circulant([1,2,3]) + assert_array_equal(y, [[1,3,2], [2,1,3], [3,2,1]]) + + +class TestHadamard(TestCase): + + def test_basic(self): + + y = hadamard(1) + assert_array_equal(y, [[1]]) + + y = hadamard(2, dtype=float) + assert_array_equal(y, [[1.0, 1.0], [1.0, -1.0]]) + + y = hadamard(4) + assert_array_equal(y, [[1,1,1,1], [1,-1,1,-1], [1,1,-1,-1], [1,-1,-1,1]]) + + assert_raises(ValueError, hadamard, 0) + assert_raises(ValueError, hadamard, 5) + + +class TestBlockDiag: + def test_basic(self): + x = block_diag(eye(2), [[1,2], [3,4], [5,6]], [[1, 2, 3]]) + assert all(x == [[1, 0, 0, 0, 0, 0, 0], + [0, 1, 0, 0, 0, 0, 0], + [0, 0, 1, 2, 0, 0, 0], + [0, 0, 3, 4, 0, 0, 0], + [0, 0, 5, 6, 0, 0, 0], + [0, 0, 0, 0, 1, 2, 3]]) + + def test_dtype(self): + x = block_diag([[1.5]]) + assert_equal(x.dtype, float) + + x = block_diag([[True]]) + assert_equal(x.dtype, bool) + + def test_scalar_and_1d_args(self): + a = block_diag(1) + assert_equal(a.shape, (1,1)) + assert_array_equal(a, [[1]]) + + a = block_diag([2,3], 4) + assert_array_equal(a, [[2, 3, 0], [0, 0, 4]]) + + def test_bad_arg(self): + assert_raises(ValueError, block_diag, [[[1]]]) + + def test_no_args(self): + a = block_diag() + assert_equal(a.ndim, 2) + assert_equal(a.nbytes, 0) + + +class TestKron: + + def test_basic(self): + + a = kron(array([[1, 2], [3, 4]]), array([[1, 1, 1]])) + assert_array_equal(a, array([[1, 1, 1, 2, 2, 2], + [3, 3, 3, 4, 4, 4]])) + + m1 = array([[1, 2], [3, 4]]) + m2 = array([[10], [11]]) + a = kron(m1, m2) + expected = array([[ 10, 20 ], + [ 11, 22 ], + [ 30, 40 ], + [ 33, 44 ]]) + assert_array_equal(a, expected) + + +if __name__ == "__main__": + run_module_suite() From scipy-svn at scipy.org Tue Mar 30 23:04:22 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 22:04:22 -0500 (CDT) Subject: [Scipy-svn] r6287 - trunk/scipy/integrate/tests Message-ID: <20100331030422.4FC6139CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 22:04:22 -0500 (Tue, 30 Mar 2010) New Revision: 6287 Modified: trunk/scipy/integrate/tests/test_quadrature.py Log: Add a test for scipy.integrate.newton_cotes. A more comprehensive set of tests would be better, but it's a start. Modified: trunk/scipy/integrate/tests/test_quadrature.py =================================================================== --- trunk/scipy/integrate/tests/test_quadrature.py 2010-03-31 01:42:00 UTC (rev 6286) +++ trunk/scipy/integrate/tests/test_quadrature.py 2010-03-31 03:04:22 UTC (rev 6287) @@ -3,7 +3,7 @@ from numpy import cos, sin, pi from numpy.testing import * -from scipy.integrate import quadrature, romberg, romb +from scipy.integrate import quadrature, romberg, romb, newton_cotes class TestQuadrature(TestCase): def quad(self, x, a, b, args): @@ -35,6 +35,28 @@ expected_val = 0.45969769413185085 assert_almost_equal(valmath, expected_val, decimal=7) + def test_newton_cotes(self): + """Test the first few degrees, for evenly spaced points.""" + n = 1 + wts, errcoff = newton_cotes(n, 1) + assert_equal(wts, n*numpy.array([0.5, 0.5])) + assert_almost_equal(errcoff, -n**3/12.0) + n = 2 + wts, errcoff = newton_cotes(n, 1) + assert_almost_equal(wts, n*numpy.array([1.0, 4.0, 1.0])/6.0) + assert_almost_equal(errcoff, -n**5/2880.0) + + n = 3 + wts, errcoff = newton_cotes(n, 1) + assert_almost_equal(wts, n*numpy.array([1.0, 3.0, 3.0, 1.0])/8.0) + assert_almost_equal(errcoff, -n**5/6480.0) + + n = 4 + wts, errcoff = newton_cotes(n, 1) + assert_almost_equal(wts, n*numpy.array([7.0, 32.0, 12.0, 32.0, 7.0])/90.0) + assert_almost_equal(errcoff, -n**7/1935360.0) + + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Mar 30 23:30:12 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 22:30:12 -0500 (CDT) Subject: [Scipy-svn] r6288 - trunk/scipy/integrate/tests Message-ID: <20100331033012.6342F39CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 22:30:12 -0500 (Tue, 30 Mar 2010) New Revision: 6288 Modified: trunk/scipy/integrate/tests/test_quadrature.py Log: Added a test for integrate.newton_cotes with points that are not evenly spaced. Modified: trunk/scipy/integrate/tests/test_quadrature.py =================================================================== --- trunk/scipy/integrate/tests/test_quadrature.py 2010-03-31 03:04:22 UTC (rev 6287) +++ trunk/scipy/integrate/tests/test_quadrature.py 2010-03-31 03:30:12 UTC (rev 6288) @@ -57,6 +57,23 @@ assert_almost_equal(wts, n*numpy.array([7.0, 32.0, 12.0, 32.0, 7.0])/90.0) assert_almost_equal(errcoff, -n**7/1935360.0) + def test_newton_cotes2(self): + """Test newton_cotes with points that are not evenly spaced.""" + + x = numpy.array([0.0, 1.5, 2.0]) + y = x**2 + wts, errcoff = newton_cotes(x) + exact_integral = 8.0/3 + numeric_integral = numpy.dot(wts, y) + assert_almost_equal(numeric_integral, exact_integral) + + x = numpy.array([0.0, 1.4, 2.1, 3.0]) + y = x**2 + wts, errcoff = newton_cotes(x) + exact_integral = 9.0 + numeric_integral = numpy.dot(wts, y) + assert_almost_equal(numeric_integral, exact_integral) + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Tue Mar 30 23:49:40 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 22:49:40 -0500 (CDT) Subject: [Scipy-svn] r6289 - trunk/scipy/signal Message-ID: <20100331034940.2C10E39CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 22:49:40 -0500 (Tue, 30 Mar 2010) New Revision: 6289 Modified: trunk/scipy/signal/ltisys.py trunk/scipy/signal/waveforms.py Log: DOC: Added a couple 'versionadded' notes. Modified: trunk/scipy/signal/ltisys.py =================================================================== --- trunk/scipy/signal/ltisys.py 2010-03-31 03:30:12 UTC (rev 6288) +++ trunk/scipy/signal/ltisys.py 2010-03-31 03:49:40 UTC (rev 6289) @@ -582,6 +582,9 @@ -------- scipy.signal.impulse + Notes + ----- + .. versionadded:: 0.8.0 """ if isinstance(system, lti): sys = system Modified: trunk/scipy/signal/waveforms.py =================================================================== --- trunk/scipy/signal/waveforms.py 2010-03-31 03:30:12 UTC (rev 6288) +++ trunk/scipy/signal/waveforms.py 2010-03-31 03:49:40 UTC (rev 6289) @@ -319,6 +319,9 @@ -------- scipy.signal.waveforms.chirp + Notes + ----- + .. versionadded:: 0.8.0 """ # 'phase' is computed in _sweep_poly_phase, to make testing easier. phase = _sweep_poly_phase(t, poly) From scipy-svn at scipy.org Wed Mar 31 00:48:52 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 23:48:52 -0500 (CDT) Subject: [Scipy-svn] r6290 - in trunk/doc: release source Message-ID: <20100331044852.A917939CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 23:48:52 -0500 (Tue, 30 Mar 2010) New Revision: 6290 Modified: trunk/doc/release/0.8.0-notes.rst trunk/doc/source/release.rst Log: DOC: Update release notes with changes I've made. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-03-31 03:49:40 UTC (rev 6289) +++ trunk/doc/release/0.8.0-notes.rst 2010-03-31 04:48:52 UTC (rev 6290) @@ -4,7 +4,7 @@ .. contents:: -SciPy 0.8.0 is the culmination of 6 months of hard work. It contains +SciPy 0.8.0 is the culmination of XXX 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 @@ -32,7 +32,7 @@ about our function's call signatures. Python 3.0 ----------- +========== Python 3.0 is not supported at all; it requires NumPy to be ported to Python 3.0. This requires immense effort, since a lot of C code has @@ -40,7 +40,7 @@ currently, we don't have any timeline or roadmap for this transition. Major documentation improvements --------------------------------- +================================ SciPy documentation is greatly improved. @@ -71,8 +71,8 @@ fft functions can now handle single precision inputs as well: fft(x) will return a single precision array if x is single precision. -correlation functions now implements the usual definition (scipy.signal) ------------------------------------------------------------------------- +Correlation functions now implement the usual definition (scipy.signal) +----------------------------------------------------------------------- The outputs should now correspond to their matlab and R counterparts, and do what most people expect if the old_behavior=False argument is passed: @@ -83,6 +83,36 @@ the slided sum-products, which correspond to the usual definition of correlation +Additions and modification to LTI functions (scipy.signal) +---------------------------------------------------------- +* The function `impulse2` was added to `scipy.signal`. It uses the ODE + solver `scipy.integrate.odeint` to compute the impulse response of + a system. +* The function `scipy.signal.lsim2` was changed to pass any additional + keyword arguments to the ODE solver. + +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 + now generates a waveform that is also known as an "exponential" or + "geometric" chirp. (See http://en.wikipedia.org/wiki/Chirp.) +* A new `chirp` method, "hyperbolic", was added. +* Instead of the keyword `qshape`, `chirp` now uses the keyword + `vertex_zero`, a boolean. +* `chirp` no longer handles an arbitrary polynomial. This functionality + has been moved to a new function, `sweep_poly`. + +A new function, `sweep_poly`, was added. + +New special matrix functions (scipy.linalg) +------------------------------------------- +The functions `circulant` and `hadamard` were added to `scipy.linalg`. + +The function `block_diag` was enhanced to accept scalar and 1D arguments, +along with the usual 2D arguments. + ARPACK-based sparse SVD ----------------------- @@ -90,7 +120,19 @@ 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. + + Removed features ================ scipy.stsci: the package was removed + +scipy.signal.chirp: + 1. The `qshape` keyword argument was removed. Instead, use the `vertex_zero` + argument. + 2. `chirp` no longer handles the case of a general polynomial. This + functionality has been moved to a new function, `sweep_poly`. Modified: trunk/doc/source/release.rst =================================================================== --- trunk/doc/source/release.rst 2010-03-31 03:49:40 UTC (rev 6289) +++ trunk/doc/source/release.rst 2010-03-31 04:48:52 UTC (rev 6290) @@ -2,4 +2,4 @@ Release Notes ************* -.. include:: ../release/0.7.0-notes.rst +.. include:: ../release/0.8.0-notes.rst From scipy-svn at scipy.org Wed Mar 31 00:55:13 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Tue, 30 Mar 2010 23:55:13 -0500 (CDT) Subject: [Scipy-svn] r6291 - trunk/doc/release Message-ID: <20100331045513.E9B1F39CAE9@scipy.org> Author: warren.weckesser Date: 2010-03-30 23:55:13 -0500 (Tue, 30 Mar 2010) New Revision: 6291 Modified: trunk/doc/release/0.8.0-notes.rst Log: DOC: Tweak restructured text in the release notes. Modified: trunk/doc/release/0.8.0-notes.rst =================================================================== --- trunk/doc/release/0.8.0-notes.rst 2010-03-31 04:48:52 UTC (rev 6290) +++ trunk/doc/release/0.8.0-notes.rst 2010-03-31 04:55:13 UTC (rev 6291) @@ -77,11 +77,11 @@ The outputs should now correspond to their matlab and R counterparts, and do what most people expect if the old_behavior=False argument is passed: - * correlate, convolve and their 2d counterparts do not swap their inputs - depending on their relative shape anymore. - * correlation functions now conjugate their second argument while computing - the slided sum-products, which correspond to the usual definition of - correlation +* correlate, convolve and their 2d counterparts do not swap their inputs + depending on their relative shape anymore; +* correlation functions now conjugate their second argument while computing + the slided sum-products, which correspond to the usual definition of + correlation. Additions and modification to LTI functions (scipy.signal) ---------------------------------------------------------- @@ -132,7 +132,8 @@ scipy.stsci: the package was removed scipy.signal.chirp: - 1. The `qshape` keyword argument was removed. Instead, use the `vertex_zero` - argument. - 2. `chirp` no longer handles the case of a general polynomial. This - functionality has been moved to a new function, `sweep_poly`. + +* 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 Mar 31 01:33:56 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 31 Mar 2010 00:33:56 -0500 (CDT) Subject: [Scipy-svn] r6292 - trunk/scipy/constants/tests Message-ID: <20100331053356.AE4BE39CAE9@scipy.org> Author: cdavid Date: 2010-03-31 00:33:56 -0500 (Wed, 31 Mar 2010) New Revision: 6292 Modified: trunk/scipy/constants/tests/test_codata.py Log: STY: use unix EOL. Modified: trunk/scipy/constants/tests/test_codata.py =================================================================== --- trunk/scipy/constants/tests/test_codata.py 2010-03-31 04:55:13 UTC (rev 6291) +++ trunk/scipy/constants/tests/test_codata.py 2010-03-31 05:33:56 UTC (rev 6292) @@ -1,23 +1,23 @@ - -from scipy.constants import find -from numpy.testing import assert_equal - -def test_find(): - - keys = find('weak mixing') - assert_equal(keys, ['weak mixing angle']) - - keys = find('qwertyuiop') - assert_equal(keys, []) - - keys = find('natural unit') - assert_equal(keys, sorted(['natural unit of velocity', - 'natural unit of action', - 'natural unit of action in eV s', - 'natural unit of mass', - 'natural unit of energy', - 'natural unit of energy in MeV', - 'natural unit of momentum', - 'natural unit of momentum in MeV/c', - 'natural unit of length', - 'natural unit of time'])) + +from scipy.constants import find +from numpy.testing import assert_equal + +def test_find(): + + keys = find('weak mixing') + assert_equal(keys, ['weak mixing angle']) + + keys = find('qwertyuiop') + assert_equal(keys, []) + + keys = find('natural unit') + assert_equal(keys, sorted(['natural unit of velocity', + 'natural unit of action', + 'natural unit of action in eV s', + 'natural unit of mass', + 'natural unit of energy', + 'natural unit of energy in MeV', + 'natural unit of momentum', + 'natural unit of momentum in MeV/c', + 'natural unit of length', + 'natural unit of time'])) From scipy-svn at scipy.org Wed Mar 31 02:49:33 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 31 Mar 2010 01:49:33 -0500 (CDT) Subject: [Scipy-svn] r6293 - in trunk/scipy/fftpack: . tests Message-ID: <20100331064933.A096E39CAE9@scipy.org> Author: cdavid Date: 2010-03-31 01:49:33 -0500 (Wed, 31 Mar 2010) New Revision: 6293 Modified: trunk/scipy/fftpack/basic.py trunk/scipy/fftpack/tests/test_basic.py Log: BUG: fix long double fft (fix #948) Modified: trunk/scipy/fftpack/basic.py =================================================================== --- trunk/scipy/fftpack/basic.py 2010-03-31 05:33:56 UTC (rev 6292) +++ trunk/scipy/fftpack/basic.py 2010-03-31 06:49:33 UTC (rev 6293) @@ -8,22 +8,55 @@ __all__ = ['fft','ifft','fftn','ifftn','rfft','irfft', 'fft2','ifft2', 'rfftfreq'] -from numpy import asarray, zeros, swapaxes, integer, array +from numpy import zeros, swapaxes, integer, array import numpy -import _fftpack as fftpack +import _fftpack import atexit -atexit.register(fftpack.destroy_zfft_cache) -atexit.register(fftpack.destroy_zfftnd_cache) -atexit.register(fftpack.destroy_drfft_cache) -atexit.register(fftpack.destroy_cfft_cache) -atexit.register(fftpack.destroy_cfftnd_cache) -atexit.register(fftpack.destroy_rfft_cache) +atexit.register(_fftpack.destroy_zfft_cache) +atexit.register(_fftpack.destroy_zfftnd_cache) +atexit.register(_fftpack.destroy_drfft_cache) +atexit.register(_fftpack.destroy_cfft_cache) +atexit.register(_fftpack.destroy_cfftnd_cache) +atexit.register(_fftpack.destroy_rfft_cache) del atexit def istype(arr, typeclass): return issubclass(arr.dtype.type, typeclass) +_DTYPE_TO_FFT = { + numpy.dtype(numpy.float32): _fftpack.crfft, + numpy.dtype(numpy.float64): _fftpack.zrfft, + numpy.dtype(numpy.complex64): _fftpack.cfft, + numpy.dtype(numpy.complex128): _fftpack.zfft, +} + +_DTYPE_TO_RFFT = { + numpy.dtype(numpy.float32): _fftpack.rfft, + numpy.dtype(numpy.float64): _fftpack.drfft, +} + +_DTYPE_TO_FFTN = { + numpy.dtype(numpy.complex64): _fftpack.cfftnd, + numpy.dtype(numpy.complex128): _fftpack.zfftnd, + numpy.dtype(numpy.float32): _fftpack.cfftnd, + numpy.dtype(numpy.float64): _fftpack.zfftnd, +} + +def _asfarray(x): + """Like numpy asfarray, except that it does not modify x dtype if x is + already an array with a float dtype, and do not cast complex types to + real.""" + if hasattr(x, "dtype") and x.dtype.char in numpy.typecodes["AllFloat"]: + return x + else: + # We cannot use asfarray directly because it converts sequences of + # complex to sequence of real + ret = numpy.asarray(x) + if not ret.dtype.char in numpy.typecodes["AllFloat"]: + return numpy.asfarray(x) + return ret + def _fix_shape(x, n, axis): """ Internal auxiliary function for _raw_fft, _raw_fftnd.""" s = list(x.shape) @@ -106,21 +139,21 @@ True """ - tmp = asarray(x) + tmp = _asfarray(x) + + try: + work_function = _DTYPE_TO_FFT[tmp.dtype] + except KeyError: + raise ValueError("type %s is not supported" % tmp.dtype) + if istype(tmp, numpy.complex128): overwrite_x = overwrite_x or (tmp is not x and not \ hasattr(x,'__array__')) - work_function = fftpack.zfft elif istype(tmp, numpy.complex64): overwrite_x = overwrite_x or (tmp is not x and not \ hasattr(x,'__array__')) - work_function = fftpack.cfft else: overwrite_x = 1 - if istype(tmp, numpy.float32): - work_function = fftpack.crfft - else: - work_function = fftpack.zrfft #return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) if n is None: @@ -149,21 +182,21 @@ Optional input: see fft.__doc__ """ - tmp = asarray(x) + tmp = _asfarray(x) + + try: + work_function = _DTYPE_TO_FFT[tmp.dtype] + except KeyError: + raise ValueError("type %s is not supported" % tmp.dtype) + if istype(tmp, numpy.complex128): overwrite_x = overwrite_x or (tmp is not x and not \ hasattr(x,'__array__')) - work_function = fftpack.zfft elif istype(tmp, numpy.complex64): overwrite_x = overwrite_x or (tmp is not x and not \ hasattr(x,'__array__')) - work_function = fftpack.cfft else: overwrite_x = 1 - if istype(tmp, numpy.float32): - work_function = fftpack.crfft - else: - work_function = fftpack.zrfft #return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) if n is None: @@ -207,13 +240,16 @@ Notes: y == rfft(irfft(y)) within numerical accuracy. """ - tmp = asarray(x) + tmp = _asfarray(x) + if not numpy.isrealobj(tmp): raise TypeError,"1st argument must be real sequence" - if istype(tmp, numpy.float32): - work_function = fftpack.rfft - else: - work_function = fftpack.drfft + + try: + work_function = _DTYPE_TO_RFFT[tmp.dtype] + except KeyError: + raise ValueError("type %s is not supported" % tmp.dtype) + return _raw_fft(tmp,n,axis,1,overwrite_x,work_function) @@ -254,13 +290,15 @@ Optional input: see rfft.__doc__ """ - tmp = asarray(x) + tmp = _asfarray(x) if not numpy.isrealobj(tmp): raise TypeError,"1st argument must be real sequence" - if istype(tmp, numpy.float32): - work_function = fftpack.rfft - else: - work_function = fftpack.drfft + + try: + work_function = _DTYPE_TO_RFFT[tmp.dtype] + except KeyError: + raise ValueError("type %s is not supported" % tmp.dtype) + return _raw_fft(tmp,n,axis,-1,overwrite_x,work_function) def _raw_fftnd(x, s, axes, direction, overwrite_x, work_function): @@ -354,19 +392,20 @@ return _raw_fftn_dispatch(x, shape, axes, overwrite_x, 1) def _raw_fftn_dispatch(x, shape, axes, overwrite_x, direction): - tmp = asarray(x) + tmp = _asfarray(x) + + try: + work_function = _DTYPE_TO_FFTN[tmp.dtype] + except KeyError: + raise ValueError("type %s is not supported" % tmp.dtype) + if istype(tmp, numpy.complex128): overwrite_x = overwrite_x or (tmp is not x and not \ hasattr(x,'__array__')) - work_function = fftpack.zfftnd elif istype(tmp, numpy.complex64): - work_function = fftpack.cfftnd + pass else: overwrite_x = 1 - if istype(tmp, numpy.float32): - work_function = fftpack.cfftnd - else: - work_function = fftpack.zfftnd return _raw_fftnd(tmp,shape,axes,direction,overwrite_x,work_function) Modified: trunk/scipy/fftpack/tests/test_basic.py =================================================================== --- trunk/scipy/fftpack/tests/test_basic.py 2010-03-31 05:33:56 UTC (rev 6292) +++ trunk/scipy/fftpack/tests/test_basic.py 2010-03-31 06:49:33 UTC (rev 6293) @@ -515,5 +515,29 @@ cdtype = np.complex64 maxnlp = 2000 +class TestLongDoubleFailure(TestCase): + def test_complex(self): + x = np.random.randn(10).astype(np.longdouble) + \ + 1j * np.random.randn(10).astype(np.longdouble) + + for f in [fft, ifft]: + try: + f(x) + raise AssertionError("Type %r not supported but does not fail" % \ + np.longcomplex) + except ValueError: + pass + + def test_real(self): + x = np.random.randn(10).astype(np.longcomplex) + + for f in [fft, ifft]: + try: + f(x) + raise AssertionError("Type %r not supported but does not fail" % \ + np.longcomplex) + except ValueError: + pass + if __name__ == "__main__": run_module_suite() From scipy-svn at scipy.org Wed Mar 31 12:30:49 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 31 Mar 2010 11:30:49 -0500 (CDT) Subject: [Scipy-svn] r6294 - trunk/scipy/special Message-ID: <20100331163049.DE98539CAF6@scipy.org> Author: ptvirtan Date: 2010-03-31 11:30:49 -0500 (Wed, 31 Mar 2010) New Revision: 6294 Modified: trunk/scipy/special/orthogonal_eval.pyx Log: BUG: special: fix int vs. long issue in orthogonal_eval.pyx Modified: trunk/scipy/special/orthogonal_eval.pyx =================================================================== --- trunk/scipy/special/orthogonal_eval.pyx 2010-03-31 06:49:33 UTC (rev 6293) +++ trunk/scipy/special/orthogonal_eval.pyx 2010-03-31 16:30:49 UTC (rev 6294) @@ -60,8 +60,8 @@ cdef double x cdef char *ip1=args[0], *ip2=args[1], *op=args[2] for i in range(0, dimensions[0]): - (op)[0] = (func)( - (ip1)[0], (ip2)[0]) + (op)[0] = (func)( + (ip1)[0], (ip2)[0]) ip1 += steps[0]; ip2 += steps[1]; op += steps[2] cdef char _id_d_types[3] From scipy-svn at scipy.org Wed Mar 31 12:31:03 2010 From: scipy-svn at scipy.org (scipy-svn at scipy.org) Date: Wed, 31 Mar 2010 11:31:03 -0500 (CDT) Subject: [Scipy-svn] r6295 - trunk/scipy/special Message-ID: <20100331163103.319DD39CAF6@scipy.org> Author: ptvirtan Date: 2010-03-31 11:31:03 -0500 (Wed, 31 Mar 2010) New Revision: 6295 Modified: trunk/scipy/special/orthogonal_eval.c Log: special: regenerate orthogonal_eval.c Modified: trunk/scipy/special/orthogonal_eval.c =================================================================== --- trunk/scipy/special/orthogonal_eval.c 2010-03-31 16:30:49 UTC (rev 6294) +++ trunk/scipy/special/orthogonal_eval.c 2010-03-31 16:31:03 UTC (rev 6295) @@ -1,4 +1,4 @@ -/* Generated by Cython 0.11.3 on Tue Oct 27 00:02:15 2009 */ +/* Generated by Cython 0.12 on Wed Mar 31 17:45:34 2010 */ #define PY_SSIZE_T_CLEAN #include "Python.h" @@ -15,6 +15,7 @@ #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; @@ -73,8 +74,13 @@ #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,9 +95,10 @@ #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) @@ -135,9 +142,7 @@ #include "math.h" #include "numpy/arrayobject.h" #include "numpy/ufuncobject.h" -#define __PYX_USE_C99_COMPLEX defined(_Complex_I) - #ifdef __GNUC__ #define INLINE __inline__ #elif _WIN32 @@ -146,13 +151,9 @@ #define INLINE #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 @@ -265,38 +266,54 @@ static const char *__pyx_filename; static const char **__pyx_f; -static char __pyx_mdoc[] = "\nEvaluate orthogonal polynomial values using recurrence relations.\n\nReferences\n----------\n\n.. [AMS55] Abramowitz & Stegun, Section 22.5.\n\n.. [MH] Mason & Handscombe, Chebyshev Polynomials, CRC Press (2003).\n\n"; +/* Type declarations */ -#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) +#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) if((r) == NULL) ; else __Pyx_GIVEREF(r) -#define __Pyx_XGOTREF(r) if((r) == NULL) ; else __Pyx_GOTREF(r) +#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*/ @@ -306,12 +323,6 @@ static int __Pyx_ParseOptionalKeywords(PyObject *kwds, PyObject **argnames[], PyObject *kwds2, PyObject *values[], Py_ssize_t num_pos_args, const char* function_name); /*proto*/ -static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ - -static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ - -static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); - static INLINE void __Pyx_RaiseNeedMoreValuesError(Py_ssize_t index); static INLINE void __Pyx_RaiseTooManyValuesError(void); @@ -319,11 +330,17 @@ static PyObject *__Pyx_UnpackItem(PyObject *, Py_ssize_t index); /*proto*/ static int __Pyx_EndUnpack(PyObject *); /*proto*/ -static void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ +static PyObject *__Pyx_Import(PyObject *name, PyObject *from_list); /*proto*/ +static PyObject *__Pyx_GetName(PyObject *dict, PyObject *name); /*proto*/ + +static INLINE PyObject *__Pyx_PyInt_to_py_npy_intp(npy_intp); + 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 void __Pyx_Raise(PyObject *type, PyObject *value, PyObject *tb); /*proto*/ + static INLINE unsigned char __Pyx_PyInt_AsUnsignedChar(PyObject *); static INLINE unsigned short __Pyx_PyInt_AsUnsignedShort(PyObject *); @@ -357,8 +374,6 @@ static void __Pyx_AddTraceback(const char *funcname); /*proto*/ static int __Pyx_InitStrings(__Pyx_StringTabEntry *t); /*proto*/ - -/* Type declarations */ /* Module declarations from scipy.special.orthogonal_eval */ static char __pyx_v_5scipy_7special_15orthogonal_eval__id_d_types[3]; @@ -370,80 +385,132 @@ int __pyx_module_is_main_scipy__special__orthogonal_eval = 0; /* Implementation of scipy.special.orthogonal_eval */ -static char __pyx_k_1[] = ""; -static char __pyx_k_2[] = ""; +static PyObject *__pyx_builtin_range; +static PyObject *__pyx_builtin_ValueError; +static char __pyx_k_1[] = "Order must be integer"; +static char __pyx_k_2[] = "\nEvaluate orthogonal polynomial values using recurrence relations.\n\nReferences\n----------\n\n.. [AMS55] Abramowitz & Stegun, Section 22.5.\n\n.. [MH] Mason & Handscombe, Chebyshev Polynomials, CRC Press (2003).\n\n"; +static char __pyx_k_3[] = ""; +static char __pyx_k_4[] = "scipy.special._cephes"; +static char __pyx_k_5[] = "binom (line 96)"; +static char __pyx_k_6[] = "eval_jacobi (line 100)"; +static char __pyx_k_7[] = "eval_sh_jacobi (line 109)"; +static char __pyx_k_8[] = "eval_gegenbauer (line 114)"; +static char __pyx_k_9[] = "eval_chebyt (line 123)"; +static char __pyx_k_10[] = "eval_chebyu (line 132)"; +static char __pyx_k_11[] = "eval_chebys (line 141)"; +static char __pyx_k_12[] = "eval_chebyc (line 145)"; +static char __pyx_k_13[] = "eval_sh_chebyt (line 149)"; +static char __pyx_k_14[] = "eval_sh_chebyu (line 153)"; +static char __pyx_k_15[] = "eval_legendre (line 157)"; +static char __pyx_k_16[] = "eval_sh_legendre (line 166)"; +static char __pyx_k_17[] = "eval_genlaguerre (line 170)"; +static char __pyx_k_18[] = "eval_laguerre (line 178)"; +static char __pyx_k_19[] = "eval_hermite (line 182)"; +static char __pyx_k_20[] = "eval_hermitenorm (line 204)"; +static char __pyx_k__k[] = "k"; +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__np[] = "np"; +static char __pyx_k__any[] = "any"; +static char __pyx_k__exp[] = "exp"; +static char __pyx_k__out[] = "out"; +static char __pyx_k__beta[] = "beta"; +static char __pyx_k__alpha[] = "alpha"; +static char __pyx_k__binom[] = "binom"; +static char __pyx_k__gamma[] = "gamma"; +static char __pyx_k__numpy[] = "numpy"; +static char __pyx_k__range[] = "range"; +static char __pyx_k__hyp1f1[] = "hyp1f1"; +static char __pyx_k__hyp2f1[] = "hyp2f1"; +static char __pyx_k__gammaln[] = "gammaln"; +static char __pyx_k____main__[] = "__main__"; +static char __pyx_k____test__[] = "__test__"; +static char __pyx_k__ValueError[] = "ValueError"; +static char __pyx_k__atleast_1d[] = "atleast_1d"; +static char __pyx_k__zeros_like[] = "zeros_like"; +static char __pyx_k__eval_chebyc[] = "eval_chebyc"; +static char __pyx_k__eval_chebys[] = "eval_chebys"; +static char __pyx_k__eval_chebyt[] = "eval_chebyt"; +static char __pyx_k__eval_chebyu[] = "eval_chebyu"; +static char __pyx_k__eval_jacobi[] = "eval_jacobi"; +static char __pyx_k___eval_chebyt[] = "_eval_chebyt"; +static char __pyx_k__eval_hermite[] = "eval_hermite"; +static char __pyx_k__eval_laguerre[] = "eval_laguerre"; +static char __pyx_k__eval_legendre[] = "eval_legendre"; +static char __pyx_k__eval_sh_chebyt[] = "eval_sh_chebyt"; +static char __pyx_k__eval_sh_chebyu[] = "eval_sh_chebyu"; +static char __pyx_k__eval_sh_jacobi[] = "eval_sh_jacobi"; +static char __pyx_k__eval_gegenbauer[] = "eval_gegenbauer"; +static char __pyx_k__broadcast_arrays[] = "broadcast_arrays"; +static char __pyx_k__eval_genlaguerre[] = "eval_genlaguerre"; +static char __pyx_k__eval_hermitenorm[] = "eval_hermitenorm"; +static char __pyx_k__eval_sh_legendre[] = "eval_sh_legendre"; +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_u_15; +static PyObject *__pyx_kp_u_16; +static PyObject *__pyx_kp_u_17; +static PyObject *__pyx_kp_u_18; +static PyObject *__pyx_kp_u_19; +static PyObject *__pyx_kp_u_20; +static PyObject *__pyx_n_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__ValueError; +static PyObject *__pyx_n_s____main__; +static PyObject *__pyx_n_s____test__; +static PyObject *__pyx_n_s___eval_chebyt; +static PyObject *__pyx_n_s__alpha; +static PyObject *__pyx_n_s__any; +static PyObject *__pyx_n_s__atleast_1d; +static PyObject *__pyx_n_s__beta; +static PyObject *__pyx_n_s__binom; +static PyObject *__pyx_n_s__broadcast_arrays; +static PyObject *__pyx_n_s__eval_chebyc; +static PyObject *__pyx_n_s__eval_chebys; +static PyObject *__pyx_n_s__eval_chebyt; +static PyObject *__pyx_n_s__eval_chebyu; +static PyObject *__pyx_n_s__eval_gegenbauer; +static PyObject *__pyx_n_s__eval_genlaguerre; +static PyObject *__pyx_n_s__eval_hermite; +static PyObject *__pyx_n_s__eval_hermitenorm; +static PyObject *__pyx_n_s__eval_jacobi; +static PyObject *__pyx_n_s__eval_laguerre; +static PyObject *__pyx_n_s__eval_legendre; +static PyObject *__pyx_n_s__eval_sh_chebyt; +static PyObject *__pyx_n_s__eval_sh_chebyu; +static PyObject *__pyx_n_s__eval_sh_jacobi; +static PyObject *__pyx_n_s__eval_sh_legendre; +static PyObject *__pyx_n_s__exp; +static PyObject *__pyx_n_s__gamma; +static PyObject *__pyx_n_s__gammaln; +static PyObject *__pyx_n_s__hyp1f1; +static PyObject *__pyx_n_s__hyp2f1; +static PyObject *__pyx_n_s__k; +static PyObject *__pyx_n_s__n; +static PyObject *__pyx_n_s__np; +static PyObject *__pyx_n_s__numpy; +static PyObject *__pyx_n_s__out; +static PyObject *__pyx_n_s__p; +static PyObject *__pyx_n_s__q; +static PyObject *__pyx_n_s__range; +static PyObject *__pyx_n_s__x; +static PyObject *__pyx_n_s__zeros_like; static PyObject *__pyx_int_0; -static PyObject *__pyx_int_neg_1; static PyObject *__pyx_int_1; static PyObject *__pyx_int_2; -static char __pyx_k___main__[] = "__main__"; -static PyObject *__pyx_kp___main__; -static char __pyx_k_n[] = "n"; -static PyObject *__pyx_kp_n; -static char __pyx_k_k[] = "k"; -static PyObject *__pyx_kp_k; -static char __pyx_k_alpha[] = "alpha"; -static PyObject *__pyx_kp_alpha; -static char __pyx_k_beta[] = "beta"; -static PyObject *__pyx_kp_beta; -static char __pyx_k_x[] = "x"; -static PyObject *__pyx_kp_x; -static char __pyx_k_out[] = "out"; -static PyObject *__pyx_kp_out; -static char __pyx_k_p[] = "p"; -static PyObject *__pyx_kp_p; -static char __pyx_k_q[] = "q"; -static PyObject *__pyx_kp_q; -static char __pyx_k__eval_chebyt[] = "_eval_chebyt"; -static PyObject *__pyx_kp__eval_chebyt; -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_3[] = "scipy.special._cephes"; -static PyObject *__pyx_kp_3; -static char __pyx_k_gamma[] = "gamma"; -static PyObject *__pyx_kp_gamma; -static char __pyx_k_4[] = "hyp2f1"; -static PyObject *__pyx_kp_4; -static char __pyx_k_5[] = "hyp1f1"; -static PyObject *__pyx_kp_5; -static char __pyx_k_gammaln[] = "gammaln"; -static PyObject *__pyx_kp_gammaln; -static char __pyx_k_exp[] = "exp"; -static PyObject *__pyx_kp_exp; -static char __pyx_k_range[] = "range"; -static PyObject *__pyx_kp_range; -static char __pyx_k_binom[] = "binom"; -static PyObject *__pyx_kp_binom; -static char __pyx_k_eval_jacobi[] = "eval_jacobi"; -static PyObject *__pyx_kp_eval_jacobi; -static char __pyx_k_eval_chebyu[] = "eval_chebyu"; -static PyObject *__pyx_kp_eval_chebyu; -static char __pyx_k_eval_chebyt[] = "eval_chebyt"; -static PyObject *__pyx_kp_eval_chebyt; -static char __pyx_k_eval_legendre[] = "eval_legendre"; -static PyObject *__pyx_kp_eval_legendre; -static char __pyx_k_eval_genlaguerre[] = "eval_genlaguerre"; -static PyObject *__pyx_kp_eval_genlaguerre; -static char __pyx_k_broadcast_arrays[] = "broadcast_arrays"; -static PyObject *__pyx_kp_broadcast_arrays; -static char __pyx_k_6[] = "atleast_1d"; -static PyObject *__pyx_kp_6; -static char __pyx_k_zeros_like[] = "zeros_like"; -static PyObject *__pyx_kp_zeros_like; -static char __pyx_k_any[] = "any"; -static PyObject *__pyx_kp_any; -static char __pyx_k_ValueError[] = "ValueError"; -static PyObject *__pyx_kp_ValueError; -static char __pyx_k_eval_hermite[] = "eval_hermite"; -static PyObject *__pyx_kp_eval_hermite; -static PyObject *__pyx_builtin_range; -static PyObject *__pyx_builtin_ValueError; -static PyObject *__pyx_kp_7; -static char __pyx_k_7[] = "Order must be integer"; +static PyObject *__pyx_int_neg_1; -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":24 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":24 * double sqrt(double x) * * cdef double eval_poly_chebyt(long k, double x): # <<<<<<<<<<<<<< @@ -458,9 +525,9 @@ double __pyx_v_b0; double __pyx_r; long __pyx_t_1; - __Pyx_SetupRefcountContext("eval_poly_chebyt"); + __Pyx_RefNannySetupContext("eval_poly_chebyt"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":29 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":29 * cdef double b2, b1, b0 * * b2 = 0 # <<<<<<<<<<<<<< @@ -469,7 +536,7 @@ */ __pyx_v_b2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":30 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":30 * * b2 = 0 * b1 = -1 # <<<<<<<<<<<<<< @@ -478,7 +545,7 @@ */ __pyx_v_b1 = -1; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":31 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":31 * b2 = 0 * b1 = -1 * b0 = 0 # <<<<<<<<<<<<<< @@ -487,7 +554,7 @@ */ __pyx_v_b0 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":32 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":32 * b1 = -1 * b0 = 0 * x = 2*x # <<<<<<<<<<<<<< @@ -496,7 +563,7 @@ */ __pyx_v_x = (2 * __pyx_v_x); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":33 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":33 * b0 = 0 * x = 2*x * for m in range(k+1, 0, -1): # <<<<<<<<<<<<<< @@ -506,7 +573,7 @@ for (__pyx_t_1 = (__pyx_v_k + 1); __pyx_t_1 > 0; __pyx_t_1-=1) { __pyx_v_m = __pyx_t_1; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":34 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":34 * x = 2*x * for m in range(k+1, 0, -1): * b2 = b1 # <<<<<<<<<<<<<< @@ -515,7 +582,7 @@ */ __pyx_v_b2 = __pyx_v_b1; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":35 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":35 * for m in range(k+1, 0, -1): * b2 = b1 * b1 = b0 # <<<<<<<<<<<<<< @@ -524,7 +591,7 @@ */ __pyx_v_b1 = __pyx_v_b0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":36 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":36 * b2 = b1 * b1 = b0 * b0 = x*b1 - b2 # <<<<<<<<<<<<<< @@ -534,7 +601,7 @@ __pyx_v_b0 = ((__pyx_v_x * __pyx_v_b1) - __pyx_v_b2); } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":37 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":37 * b1 = b0 * b0 = x*b1 - b2 * return (b0 - b2)/2.0 # <<<<<<<<<<<<<< @@ -546,11 +613,11 @@ __pyx_r = 0; __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":57 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":57 * int identity, char* name, char* doc, int c) * * cdef void _loop_id_d(char **args, npy_intp *dimensions, npy_intp *steps, # <<<<<<<<<<<<<< @@ -563,42 +630,44 @@ char *__pyx_v_ip1; char *__pyx_v_ip2; char *__pyx_v_op; - int __pyx_t_1; - __Pyx_SetupRefcountContext("_loop_id_d"); + npy_intp __pyx_t_1; + int __pyx_t_2; + __Pyx_RefNannySetupContext("_loop_id_d"); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":61 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":61 * cdef int i * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] # <<<<<<<<<<<<<< * for i in range(0, dimensions[0]): - * (op)[0] = (func)( + * (op)[0] = (func)( */ __pyx_v_ip1 = (__pyx_v_args[0]); __pyx_v_ip2 = (__pyx_v_args[1]); __pyx_v_op = (__pyx_v_args[2]); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":62 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":62 * cdef double x * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): # <<<<<<<<<<<<<< - * (op)[0] = (func)( - * (ip1)[0], (ip2)[0]) + * (op)[0] = (func)( + * (ip1)[0], (ip2)[0]) */ - for (__pyx_t_1 = 0; __pyx_t_1 < (__pyx_v_dimensions[0]); __pyx_t_1+=1) { - __pyx_v_i = __pyx_t_1; + __pyx_t_1 = (__pyx_v_dimensions[0]); + for (__pyx_t_2 = 0; __pyx_t_2 < __pyx_t_1; __pyx_t_2+=1) { + __pyx_v_i = __pyx_t_2; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":63 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":63 * cdef char *ip1=args[0], *ip2=args[1], *op=args[2] * for i in range(0, dimensions[0]): - * (op)[0] = (func)( # <<<<<<<<<<<<<< - * (ip1)[0], (ip2)[0]) + * (op)[0] = (func)( # <<<<<<<<<<<<<< + * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] */ - (((double *)__pyx_v_op)[0]) = ((double (*)(int, double))__pyx_v_func)((((int *)__pyx_v_ip1)[0]), (((double *)__pyx_v_ip2)[0])); + (((double *)__pyx_v_op)[0]) = ((double (*)(long, double))__pyx_v_func)((((long *)__pyx_v_ip1)[0]), (((double *)__pyx_v_ip2)[0])); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":65 - * (op)[0] = (func)( - * (ip1)[0], (ip2)[0]) + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":65 + * (op)[0] = (func)( + * (ip1)[0], (ip2)[0]) * ip1 += steps[0]; ip2 += steps[1]; op += steps[2] # <<<<<<<<<<<<<< * * cdef char _id_d_types[3] @@ -608,10 +677,10 @@ __pyx_v_op += (__pyx_v_steps[2]); } - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":96 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":96 * from numpy import exp * * def binom(n, k): # <<<<<<<<<<<<<< @@ -625,13 +694,13 @@ PyObject *__pyx_v_n = 0; PyObject *__pyx_v_k = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_k,0}; - __Pyx_SetupRefcountContext("binom"); + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__k,0}; + __Pyx_RefNannySetupContext("binom"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); @@ -644,11 +713,11 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_k); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__k); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("binom", 1, 2, 2, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 96; __pyx_clineno = __LINE__; goto __pyx_L3_error;} @@ -673,7 +742,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":98 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":98 * def binom(n, k): * """Binomial coefficient""" * return np.exp(gammaln(1+n) - gammaln(1+k) - gammaln(1+n-k)) # <<<<<<<<<<<<<< @@ -681,70 +750,70 @@ * def eval_jacobi(n, alpha, beta, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_exp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__exp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_v_k); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Subtract(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_v_k); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Subtract(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_3, __pyx_v_k); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Subtract(__pyx_t_3, __pyx_v_k); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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 = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 98; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; @@ -752,20 +821,20 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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_XDECREF(__pyx_t_5); __Pyx_AddTraceback("scipy.special.orthogonal_eval.binom"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":100 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":100 * return np.exp(gammaln(1+n) - gammaln(1+k) - gammaln(1+n-k)) * * def eval_jacobi(n, alpha, beta, x, out=None): # <<<<<<<<<<<<<< @@ -787,17 +856,16 @@ PyObject *__pyx_v_c; PyObject *__pyx_v_g; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_alpha,&__pyx_kp_beta,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_jacobi"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__alpha,&__pyx_n_s__beta,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_jacobi"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[5] = {0,0,0,0,0}; - values[4] = Py_None; + values[4] = ((PyObject *)Py_None); 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); @@ -809,30 +877,30 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_alpha); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_jacobi", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_beta); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__beta); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_jacobi", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_jacobi", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 100; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[4] = value; kw_args--; } } } @@ -845,7 +913,7 @@ __pyx_v_x = values[3]; __pyx_v_out = values[4]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 4); @@ -871,98 +939,98 @@ __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); __pyx_v_g = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":102 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":102 * def eval_jacobi(n, alpha, beta, x, out=None): * """Evaluate Jacobi polynomial at a point.""" * d = binom(n+alpha, n) # <<<<<<<<<<<<<< * a = -n * b = n + alpha + beta + 1 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_binom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__binom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __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 = 102; __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_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 102; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __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 = 102; __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_d); - __pyx_v_d = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_d = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":103 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":103 * """Evaluate Jacobi polynomial at a point.""" * d = binom(n+alpha, n) * a = -n # <<<<<<<<<<<<<< * b = n + alpha + beta + 1 * c = alpha + 1 */ - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 103; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_a); - __pyx_v_a = __pyx_1; - __pyx_1 = 0; + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":104 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":104 * d = binom(n+alpha, n) * a = -n * b = n + alpha + beta + 1 # <<<<<<<<<<<<<< * c = alpha + 1 * g = (1-x)/2.0 */ - __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_t_1, __pyx_v_beta); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_v_beta); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __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_Add(__pyx_t_3, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 104; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":105 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":105 * a = -n * b = n + alpha + beta + 1 * c = alpha + 1 # <<<<<<<<<<<<<< * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d */ - __pyx_t_1 = PyNumber_Add(__pyx_v_alpha, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_alpha, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 105; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_c); - __pyx_v_c = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_c = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":106 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":106 * b = n + alpha + beta + 1 * c = alpha + 1 * g = (1-x)/2.0 # <<<<<<<<<<<<<< * return hyp2f1(a, b, c, g) * d * */ - __pyx_t_1 = PyNumber_Subtract(__pyx_int_1, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Subtract(__pyx_int_1, __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_1, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 106; __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_DECREF(__pyx_v_g); - __pyx_v_g = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_g = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":107 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":107 * c = alpha + 1 * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d # <<<<<<<<<<<<<< @@ -970,10 +1038,10 @@ * def eval_sh_jacobi(n, p, q, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__hyp2f1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_a); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_a); __Pyx_GIVEREF(__pyx_v_a); @@ -986,10 +1054,10 @@ __Pyx_INCREF(__pyx_v_g); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __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 = 107; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 107; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; @@ -1000,7 +1068,6 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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); @@ -1013,11 +1080,11 @@ __Pyx_DECREF(__pyx_v_c); __Pyx_DECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":109 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":109 * return hyp2f1(a, b, c, g) * d * * def eval_sh_jacobi(n, p, q, x, out=None): # <<<<<<<<<<<<<< @@ -1035,18 +1102,18 @@ PyObject *__pyx_v_out = 0; PyObject *__pyx_v_factor; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; PyObject *__pyx_t_4 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_p,&__pyx_kp_q,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_sh_jacobi"); + PyObject *__pyx_t_5 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__p,&__pyx_n_s__q,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_sh_jacobi"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[5] = {0,0,0,0,0}; - values[4] = Py_None; + values[4] = ((PyObject *)Py_None); 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); @@ -1058,30 +1125,30 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_p); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__p); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_sh_jacobi", 0, 4, 5, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_q); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__q); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_sh_jacobi", 0, 4, 5, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: - values[3] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[3] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[3])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_sh_jacobi", 0, 4, 5, 3); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 109; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 4: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[4] = value; kw_args--; } } } @@ -1094,7 +1161,7 @@ __pyx_v_x = values[3]; __pyx_v_out = values[4]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 5: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 4); @@ -1116,82 +1183,82 @@ __pyx_L4_argument_unpacking_done:; __pyx_v_factor = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":111 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":111 * def eval_sh_jacobi(n, p, q, x, out=None): * """Evaluate shifted Jacobi polynomial at a point.""" * factor = np.exp(gammaln(1+n) + gammaln(n+p) - gammaln(2*n+p)) # <<<<<<<<<<<<<< * return factor * eval_jacobi(n, p-q, q-1, 2*x-1) * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_exp); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__exp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyNumber_Add(__pyx_v_n, __pyx_v_p); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_4)); + __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_1, ((PyObject *)__pyx_t_4), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_4)); __pyx_t_4 = 0; - __pyx_t_4 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_v_p); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_4, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Add(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gammaln); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_n); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_2 = PyNumber_Add(__pyx_t_3, __pyx_v_p); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); + __pyx_t_4 = PyNumber_Add(__pyx_t_3, __pyx_v_p); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_3 = PyNumber_Subtract(__pyx_t_4, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_1, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Subtract(__pyx_t_5, __pyx_t_4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __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 = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_t_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 111; __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_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_factor); __pyx_v_factor = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":112 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":112 * """Evaluate shifted Jacobi polynomial at a point.""" * factor = np.exp(gammaln(1+n) + gammaln(n+p) - gammaln(2*n+p)) * return factor * eval_jacobi(n, p-q, q-1, 2*x-1) # <<<<<<<<<<<<<< @@ -1199,60 +1266,60 @@ * def eval_gegenbauer(n, alpha, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_jacobi); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyNumber_Subtract(__pyx_v_p, __pyx_v_q); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_jacobi); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); + __pyx_t_4 = PyNumber_Subtract(__pyx_v_p, __pyx_v_q); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_2 = PyNumber_Subtract(__pyx_v_q, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __pyx_t_1 = PyNumber_Subtract(__pyx_t_5, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_4 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyTuple_New(4); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_5, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_5, 2, __pyx_t_2); __Pyx_GIVEREF(__pyx_t_2); - PyTuple_SET_ITEM(__pyx_t_1, 3, __pyx_t_4); - __Pyx_GIVEREF(__pyx_t_4); - __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_5, 3, __pyx_t_1); + __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_4 = 0; __pyx_t_2 = 0; - __pyx_t_4 = 0; - __pyx_t_4 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_4); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_v_factor, __pyx_t_4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = 0; + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_5, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __pyx_t_5 = PyNumber_Multiply(__pyx_v_factor, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 112; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_5; + __pyx_t_5 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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_XDECREF(__pyx_t_5); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_sh_jacobi"); __pyx_r = NULL; __pyx_L0:; __Pyx_DECREF(__pyx_v_factor); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":114 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":114 * return factor * eval_jacobi(n, p-q, q-1, 2*x-1) * * def eval_gegenbauer(n, alpha, x, out=None): # <<<<<<<<<<<<<< @@ -1273,17 +1340,17 @@ PyObject *__pyx_v_c; PyObject *__pyx_v_g; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_alpha,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_gegenbauer"); + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__alpha,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_gegenbauer"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[4] = {0,0,0,0}; - values[3] = Py_None; + values[3] = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1294,24 +1361,24 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_alpha); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_gegenbauer", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_gegenbauer", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 114; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[3] = value; kw_args--; } } } @@ -1323,7 +1390,7 @@ __pyx_v_x = values[2]; __pyx_v_out = values[3]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 3); @@ -1348,81 +1415,81 @@ __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); __pyx_v_g = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":116 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":116 * def eval_gegenbauer(n, alpha, x, out=None): * """Evaluate Gegenbauer polynomial at a point.""" * d = gamma(n+2*alpha)/gamma(1+n)/gamma(2*alpha) # <<<<<<<<<<<<<< * a = -n * b = n + 2*alpha */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gamma); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gamma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_v_n, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyNumber_Add(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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 = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gamma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gamma); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_1); __Pyx_GIVEREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __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_4); __pyx_t_4 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gamma); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__gamma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_alpha); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __pyx_t_2 = PyTuple_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_t_4, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 116; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_d); __pyx_v_d = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":117 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":117 * """Evaluate Gegenbauer polynomial at a point.""" * d = gamma(n+2*alpha)/gamma(1+n)/gamma(2*alpha) * a = -n # <<<<<<<<<<<<<< * b = n + 2*alpha * c = alpha + 0.5 */ - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 117; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_a); - __pyx_v_a = __pyx_1; - __pyx_1 = 0; + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":118 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":118 * d = gamma(n+2*alpha)/gamma(1+n)/gamma(2*alpha) * a = -n * b = n + 2*alpha # <<<<<<<<<<<<<< @@ -1431,30 +1498,30 @@ */ __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_3 = PyNumber_Add(__pyx_v_n, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 118; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_b = __pyx_t_3; + __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":119 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":119 * a = -n * b = n + 2*alpha * c = alpha + 0.5 # <<<<<<<<<<<<<< * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d */ - __pyx_t_1 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Add(__pyx_v_alpha, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(0.5); 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_t_2 = PyNumber_Add(__pyx_v_alpha, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 119; __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_c); __pyx_v_c = __pyx_t_2; __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":120 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":120 * b = n + 2*alpha * c = alpha + 0.5 * g = (1-x)/2.0 # <<<<<<<<<<<<<< @@ -1463,17 +1530,17 @@ */ __pyx_t_2 = PyNumber_Subtract(__pyx_int_1, __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 120; __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 = 120; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_g); - __pyx_v_g = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_g = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":121 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":121 * c = alpha + 0.5 * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d # <<<<<<<<<<<<<< @@ -1481,10 +1548,10 @@ * def eval_chebyt(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__hyp2f1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_a); PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_a); __Pyx_GIVEREF(__pyx_v_a); @@ -1497,13 +1564,13 @@ __Pyx_INCREF(__pyx_v_g); PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_Call(__pyx_t_4, __pyx_t_3, NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 121; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_r = __pyx_t_3; __pyx_t_3 = 0; goto __pyx_L0; @@ -1511,10 +1578,10 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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.special.orthogonal_eval.eval_gegenbauer"); __pyx_r = NULL; __pyx_L0:; @@ -1524,11 +1591,11 @@ __Pyx_DECREF(__pyx_v_c); __Pyx_DECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":123 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":123 * return hyp2f1(a, b, c, g) * d * * def eval_chebyt(n, x, out=None): # <<<<<<<<<<<<<< @@ -1543,16 +1610,16 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_chebyt"); + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_chebyt"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -1562,18 +1629,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_chebyt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 123; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -1584,7 +1651,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1603,7 +1670,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":130 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":130 * up to order ``10000``. * """ * return _eval_chebyt(n, x, out) # <<<<<<<<<<<<<< @@ -1611,42 +1678,42 @@ * def eval_chebyu(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp__eval_chebyt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s___eval_chebyt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); __Pyx_INCREF(__pyx_v_out); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_out); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 130; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_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_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_chebyt"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":132 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":132 * return _eval_chebyt(n, x, out) * * def eval_chebyu(n, x, out=None): # <<<<<<<<<<<<<< @@ -1666,17 +1733,16 @@ PyObject *__pyx_v_c; PyObject *__pyx_v_g; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_chebyu"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_chebyu"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -1686,18 +1752,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_chebyu", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 132; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -1708,7 +1774,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1732,7 +1798,7 @@ __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); __pyx_v_g = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":134 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":134 * def eval_chebyu(n, x, out=None): * """Evaluate Chebyshev U polynomial at a point.""" * d = n+1 # <<<<<<<<<<<<<< @@ -1745,20 +1811,20 @@ __pyx_v_d = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":135 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":135 * """Evaluate Chebyshev U polynomial at a point.""" * d = n+1 * a = -n # <<<<<<<<<<<<<< * b = n+2 * c = 1.5 */ - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 135; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_a); - __pyx_v_a = __pyx_1; - __pyx_1 = 0; + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":136 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":136 * d = n+1 * a = -n * b = n+2 # <<<<<<<<<<<<<< @@ -1771,7 +1837,7 @@ __pyx_v_b = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":137 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":137 * a = -n * b = n+2 * c = 1.5 # <<<<<<<<<<<<<< @@ -1784,7 +1850,7 @@ __pyx_v_c = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":138 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":138 * b = n+2 * c = 1.5 * g = (1-x)/2.0 # <<<<<<<<<<<<<< @@ -1803,7 +1869,7 @@ __pyx_v_g = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":139 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":139 * c = 1.5 * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d # <<<<<<<<<<<<<< @@ -1811,37 +1877,36 @@ * def eval_chebys(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__hyp2f1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_a); __Pyx_GIVEREF(__pyx_v_a); __Pyx_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_b); __Pyx_GIVEREF(__pyx_v_b); __Pyx_INCREF(__pyx_v_c); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_c); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_c); __Pyx_GIVEREF(__pyx_v_c); __Pyx_INCREF(__pyx_v_g); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_g); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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 = PyNumber_Multiply(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __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_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 139; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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); @@ -1854,11 +1919,11 @@ __Pyx_DECREF(__pyx_v_c); __Pyx_DECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":141 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":141 * return hyp2f1(a, b, c, g) * d * * def eval_chebys(n, x, out=None): # <<<<<<<<<<<<<< @@ -1873,17 +1938,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_chebys"); + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_chebys"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -1893,18 +1958,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_chebys", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 141; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -1915,7 +1980,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -1934,7 +1999,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":143 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":143 * def eval_chebys(n, x, out=None): * """Evaluate Chebyshev S polynomial at a point.""" * return eval_chebyu(n, x/2, out=out) # <<<<<<<<<<<<<< @@ -1942,46 +2007,46 @@ * def eval_chebyc(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_chebyu); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_chebyu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_int_2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __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 = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_out, __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__out), __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 143; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_chebys"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":145 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":145 * return eval_chebyu(n, x/2, out=out) * * def eval_chebyc(n, x, out=None): # <<<<<<<<<<<<<< @@ -1996,16 +2061,16 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_chebyc"); + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_chebyc"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2015,18 +2080,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_chebyc", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 145; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2037,7 +2102,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2056,7 +2121,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":147 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":147 * def eval_chebyc(n, x, out=None): * """Evaluate Chebyshev C polynomial at a point.""" * return 2*eval_chebyt(n, x/2.0, out) # <<<<<<<<<<<<<< @@ -2064,50 +2129,50 @@ * def eval_sh_chebyt(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_chebyt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_chebyt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __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(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_out); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_out); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_out); __Pyx_GIVEREF(__pyx_v_out); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_t_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_r = __pyx_t_2; __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 147; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __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; __Pyx_INCREF(Py_None); 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_AddTraceback("scipy.special.orthogonal_eval.eval_chebyc"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":149 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":149 * return 2*eval_chebyt(n, x/2.0, out) * * def eval_sh_chebyt(n, x, out=None): # <<<<<<<<<<<<<< @@ -2122,17 +2187,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_sh_chebyt"); + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_sh_chebyt"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2142,18 +2207,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_sh_chebyt", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 149; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2164,7 +2229,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2183,7 +2248,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":151 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":151 * def eval_sh_chebyt(n, x, out=None): * """Evaluate shifted Chebyshev T polynomial at a point.""" * return eval_chebyt(n, 2*x-1, out=out) # <<<<<<<<<<<<<< @@ -2191,49 +2256,49 @@ * def eval_sh_chebyu(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_chebyt); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_chebyt); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_out, __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __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 = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__out), __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 151; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_sh_chebyt"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":153 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":153 * return eval_chebyt(n, 2*x-1, out=out) * * def eval_sh_chebyu(n, x, out=None): # <<<<<<<<<<<<<< @@ -2248,17 +2313,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_sh_chebyu"); + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_sh_chebyu"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2268,18 +2333,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_sh_chebyu", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 153; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2290,7 +2355,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2309,7 +2374,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":155 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":155 * def eval_sh_chebyu(n, x, out=None): * """Evaluate shifted Chebyshev U polynomial at a point.""" * return eval_chebyu(n, 2*x-1, out=out) # <<<<<<<<<<<<<< @@ -2317,49 +2382,49 @@ * def eval_legendre(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_chebyu); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_chebyu); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_out, __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __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 = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__out), __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 155; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_sh_chebyu"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":157 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":157 * return eval_chebyu(n, 2*x-1, out=out) * * def eval_legendre(n, x, out=None): # <<<<<<<<<<<<<< @@ -2379,17 +2444,16 @@ PyObject *__pyx_v_c; PyObject *__pyx_v_g; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_legendre"); + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_legendre"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2399,18 +2463,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_legendre", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 157; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2421,7 +2485,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2445,7 +2509,7 @@ __pyx_v_c = Py_None; __Pyx_INCREF(Py_None); __pyx_v_g = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":159 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":159 * def eval_legendre(n, x, out=None): * """Evaluate Legendre polynomial at a point.""" * d = 1 # <<<<<<<<<<<<<< @@ -2456,20 +2520,20 @@ __Pyx_DECREF(__pyx_v_d); __pyx_v_d = __pyx_int_1; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":160 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":160 * """Evaluate Legendre polynomial at a point.""" * d = 1 * a = -n # <<<<<<<<<<<<<< * b = n+1 * c = 1 */ - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 160; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_v_a); - __pyx_v_a = __pyx_1; - __pyx_1 = 0; + __pyx_v_a = __pyx_t_1; + __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":161 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":161 * d = 1 * a = -n * b = n+1 # <<<<<<<<<<<<<< @@ -2482,7 +2546,7 @@ __pyx_v_b = __pyx_t_1; __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":162 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":162 * a = -n * b = n+1 * c = 1 # <<<<<<<<<<<<<< @@ -2493,7 +2557,7 @@ __Pyx_DECREF(__pyx_v_c); __pyx_v_c = __pyx_int_1; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":163 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":163 * b = n+1 * c = 1 * g = (1-x)/2.0 # <<<<<<<<<<<<<< @@ -2512,7 +2576,7 @@ __pyx_v_g = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":164 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":164 * c = 1 * g = (1-x)/2.0 * return hyp2f1(a, b, c, g) * d # <<<<<<<<<<<<<< @@ -2520,37 +2584,36 @@ * def eval_sh_legendre(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_4); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyTuple_New(4); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__hyp2f1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyTuple_New(4); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_a); __Pyx_GIVEREF(__pyx_v_a); __Pyx_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_b); __Pyx_GIVEREF(__pyx_v_b); __Pyx_INCREF(__pyx_v_c); - PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_c); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_c); __Pyx_GIVEREF(__pyx_v_c); __Pyx_INCREF(__pyx_v_g); - PyTuple_SET_ITEM(__pyx_t_3, 3, __pyx_v_g); + PyTuple_SET_ITEM(__pyx_t_2, 3, __pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_3, __pyx_t_2, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __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 = PyNumber_Multiply(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __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_3 = PyNumber_Multiply(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 164; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_3; - __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_r = __pyx_t_2; + __pyx_t_2 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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); @@ -2563,11 +2626,11 @@ __Pyx_DECREF(__pyx_v_c); __Pyx_DECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":166 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":166 * return hyp2f1(a, b, c, g) * d * * def eval_sh_legendre(n, x, out=None): # <<<<<<<<<<<<<< @@ -2582,17 +2645,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_sh_legendre"); + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_sh_legendre"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2602,18 +2665,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_sh_legendre", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 166; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2624,7 +2687,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2643,7 +2706,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":168 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":168 * def eval_sh_legendre(n, x, out=None): * """Evaluate shifted Legendre polynomial at a point.""" * return eval_legendre(n, 2*x-1, out=out) # <<<<<<<<<<<<<< @@ -2651,49 +2714,49 @@ * def eval_genlaguerre(n, alpha, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_legendre); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_legendre); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyNumber_Subtract(__pyx_t_1, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_x); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = PyNumber_Subtract(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_out, __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_2 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_1), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_2; - __pyx_t_2 = 0; + PyTuple_SET_ITEM(__pyx_t_2, 1, __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 = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_3)); + if (PyDict_SetItem(__pyx_t_3, ((PyObject *)__pyx_n_s__out), __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_2, ((PyObject *)__pyx_t_3)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 168; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_sh_legendre"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":170 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":170 * return eval_legendre(n, 2*x-1, out=out) * * def eval_genlaguerre(n, alpha, x, out=None): # <<<<<<<<<<<<<< @@ -2713,16 +2776,16 @@ PyObject *__pyx_v_b; PyObject *__pyx_v_g; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_alpha,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_genlaguerre"); + PyObject *__pyx_t_3 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__alpha,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_genlaguerre"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[4] = {0,0,0,0}; - values[3] = Py_None; + values[3] = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: values[3] = PyTuple_GET_ITEM(__pyx_args, 3); case 3: values[2] = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2733,24 +2796,24 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); if (likely(values[0])) kw_args--; else goto __pyx_L5_argtuple_error; case 1: - values[1] = PyDict_GetItem(__pyx_kwds, __pyx_kp_alpha); + values[1] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__alpha); if (likely(values[1])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_genlaguerre", 0, 3, 4, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: - values[2] = PyDict_GetItem(__pyx_kwds, __pyx_kp_x); + values[2] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__x); if (likely(values[2])) kw_args--; else { __Pyx_RaiseArgtupleInvalid("eval_genlaguerre", 0, 3, 4, 2); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 170; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 3: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[3] = value; kw_args--; } } } @@ -2762,7 +2825,7 @@ __pyx_v_x = values[2]; __pyx_v_out = values[3]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 4: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 3); @@ -2786,60 +2849,60 @@ __pyx_v_b = Py_None; __Pyx_INCREF(Py_None); __pyx_v_g = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":172 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":172 * def eval_genlaguerre(n, alpha, x, out=None): * """Evaluate generalized Laguerre polynomial at a point.""" * d = binom(n+alpha, n) # <<<<<<<<<<<<<< * a = -n * b = alpha + 1 */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_binom); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__binom); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_n, __pyx_v_alpha); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __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 = 172; __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_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 172; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __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 = 172; __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_d); - __pyx_v_d = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_d = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":173 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":173 * """Evaluate generalized Laguerre polynomial at a point.""" * d = binom(n+alpha, n) * a = -n # <<<<<<<<<<<<<< * b = alpha + 1 * g = x */ - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_2 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 173; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_a); - __pyx_v_a = __pyx_1; - __pyx_1 = 0; + __pyx_v_a = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":174 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":174 * d = binom(n+alpha, n) * a = -n * b = alpha + 1 # <<<<<<<<<<<<<< * g = x * return hyp1f1(a, b, g) * d */ - __pyx_t_1 = PyNumber_Add(__pyx_v_alpha, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = PyNumber_Add(__pyx_v_alpha, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 174; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(__pyx_v_b); - __pyx_v_b = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_v_b = __pyx_t_2; + __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":175 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":175 * a = -n * b = alpha + 1 * g = x # <<<<<<<<<<<<<< @@ -2850,7 +2913,7 @@ __Pyx_DECREF(__pyx_v_g); __pyx_v_g = __pyx_v_x; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":176 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":176 * b = alpha + 1 * g = x * return hyp1f1(a, b, g) * d # <<<<<<<<<<<<<< @@ -2858,36 +2921,36 @@ * def eval_laguerre(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_5); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__hyp1f1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_a); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_a); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_a); __Pyx_GIVEREF(__pyx_v_a); __Pyx_INCREF(__pyx_v_b); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_b); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_b); __Pyx_GIVEREF(__pyx_v_b); __Pyx_INCREF(__pyx_v_g); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_v_g); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_g); __Pyx_GIVEREF(__pyx_v_g); - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_v_d); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_1, __pyx_v_d); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 176; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __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_1); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_genlaguerre"); __pyx_r = NULL; __pyx_L0:; @@ -2896,11 +2959,11 @@ __Pyx_DECREF(__pyx_v_b); __Pyx_DECREF(__pyx_v_g); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":178 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":178 * return hyp1f1(a, b, g) * d * * def eval_laguerre(n, x, out=None): # <<<<<<<<<<<<<< @@ -2915,17 +2978,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_laguerre"); + PyObject *__pyx_t_3 = NULL; + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_laguerre"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -2935,18 +2998,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_laguerre", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 178; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -2957,7 +3020,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -2976,7 +3039,7 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":180 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":180 * def eval_laguerre(n, x, out=None): * """Evaluate Laguerre polynomial at a point.""" * return eval_genlaguerre(n, 0., x, out=out) # <<<<<<<<<<<<<< @@ -2984,49 +3047,49 @@ * def eval_hermite(n, x, out=None): */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_genlaguerre); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_genlaguerre); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyFloat_FromDouble(0.0); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_3 = PyTuple_New(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __pyx_t_1 = 0; - __pyx_2 = PyDict_New(); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_2)); - if (PyDict_SetItem(__pyx_2, __pyx_kp_out, __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_t_1 = PyEval_CallObjectWithKeywords(__pyx_1, ((PyObject *)__pyx_t_2), ((PyObject *)__pyx_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = 0; + __pyx_t_2 = PyDict_New(); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + if (PyDict_SetItem(__pyx_t_2, ((PyObject *)__pyx_n_s__out), __pyx_v_out) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyEval_CallObjectWithKeywords(__pyx_t_1, __pyx_t_3, ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 180; __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_3); __pyx_t_3 = 0; __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_2)); __pyx_2 = 0; - __pyx_r = __pyx_t_1; - __pyx_t_1 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); + __Pyx_XDECREF(__pyx_t_4); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_laguerre"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":182 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":182 * return eval_genlaguerre(n, 0., x, out=out) * * def eval_hermite(n, x, out=None): # <<<<<<<<<<<<<< @@ -3043,21 +3106,19 @@ PyObject *__pyx_v_even; PyObject *__pyx_v_m; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; - PyObject *__pyx_3 = 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; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_hermite"); + PyObject *__pyx_t_4 = NULL; + int __pyx_t_5; + PyObject *__pyx_t_6 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_hermite"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -3067,18 +3128,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_hermite", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 182; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -3089,7 +3150,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3113,181 +3174,181 @@ __pyx_v_even = Py_None; __Pyx_INCREF(Py_None); __pyx_v_m = Py_None; __Pyx_INCREF(Py_None); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":184 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":184 * def eval_hermite(n, x, out=None): * """Evaluate Hermite polynomial at a point.""" * n, x = np.broadcast_arrays(n, x) # <<<<<<<<<<<<<< * n, x = np.atleast_1d(n, x) * */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyObject_GetAttr(__pyx_1, __pyx_kp_broadcast_arrays); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__broadcast_arrays); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __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 = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __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(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyTuple_CheckExact(__pyx_t_3) && likely(PyTuple_GET_SIZE(__pyx_t_3) == 2)) { PyObject* tuple = __pyx_t_3; - __pyx_2 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_2); - __pyx_3 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_3); + __pyx_t_1 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_1); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_2; - __pyx_2 = 0; + __pyx_v_n = __pyx_t_1; + __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_3; - __pyx_3 = 0; + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; } else { - __pyx_1 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __pyx_t_4 = PyObject_GetIter(__pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_2 = __Pyx_UnpackItem(__pyx_1, 0); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_3 = __Pyx_UnpackItem(__pyx_1, 1); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - if (__Pyx_EndUnpack(__pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 184; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_2; - __pyx_2 = 0; + __pyx_v_n = __pyx_t_1; + __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_3; - __pyx_3 = 0; + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":185 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":185 * """Evaluate Hermite polynomial at a point.""" * n, x = np.broadcast_arrays(n, x) * n, x = np.atleast_1d(n, x) # <<<<<<<<<<<<<< * * if out is None: */ - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_3 = PyObject_GetAttr(__pyx_1, __pyx_kp_6); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __pyx_t_2 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__atleast_1d); 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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); __Pyx_INCREF(__pyx_v_x); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_v_x); + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_v_x); __Pyx_GIVEREF(__pyx_v_x); - __pyx_t_1 = PyObject_Call(__pyx_t_3, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __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_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; if (PyTuple_CheckExact(__pyx_t_1) && likely(PyTuple_GET_SIZE(__pyx_t_1) == 2)) { PyObject* tuple = __pyx_t_1; - __pyx_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_3); - __pyx_1 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_1); + __pyx_t_3 = PyTuple_GET_ITEM(tuple, 0); __Pyx_INCREF(__pyx_t_3); + __pyx_t_2 = PyTuple_GET_ITEM(tuple, 1); __Pyx_INCREF(__pyx_t_2); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; __Pyx_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_3; - __pyx_3 = 0; + __pyx_v_n = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_1; - __pyx_1 = 0; + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; } else { - __pyx_2 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); + __pyx_t_4 = PyObject_GetIter(__pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_3 = __Pyx_UnpackItem(__pyx_2, 0); if (unlikely(!__pyx_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_1 = __Pyx_UnpackItem(__pyx_2, 1); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (__Pyx_EndUnpack(__pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; + __pyx_t_3 = __Pyx_UnpackItem(__pyx_t_4, 0); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = __Pyx_UnpackItem(__pyx_t_4, 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); + if (__Pyx_EndUnpack(__pyx_t_4) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 185; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_n); - __pyx_v_n = __pyx_3; - __pyx_3 = 0; + __pyx_v_n = __pyx_t_3; + __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_x); - __pyx_v_x = __pyx_1; - __pyx_1 = 0; + __pyx_v_x = __pyx_t_2; + __pyx_t_2 = 0; } - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":187 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":187 * n, x = np.atleast_1d(n, x) * * if out is None: # <<<<<<<<<<<<<< * out = np.zeros_like(0*n + 0*x) * if (n % 1 != 0).any(): */ - __pyx_t_4 = (__pyx_v_out == Py_None); - if (__pyx_t_4) { + __pyx_t_5 = (__pyx_v_out == Py_None); + if (__pyx_t_5) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":188 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":188 * * if out is None: * out = np.zeros_like(0*n + 0*x) # <<<<<<<<<<<<<< * if (n % 1 != 0).any(): * raise ValueError("Order must be integer") */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_np); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_1 = PyObject_GetAttr(__pyx_2, __pyx_kp_zeros_like); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__np); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_int_0, __pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__zeros_like); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __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_Multiply(__pyx_int_0, __pyx_v_n); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __pyx_t_3 = PyNumber_Multiply(__pyx_int_0, __pyx_v_x); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __pyx_t_5 = PyNumber_Add(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_4 = PyNumber_Add(__pyx_t_1, __pyx_t_3); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __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_3); __pyx_t_3 = 0; + __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __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 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__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_1, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 188; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_out); - __pyx_v_out = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_out = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L6; } __pyx_L6:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":189 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":189 * if out is None: * out = np.zeros_like(0*n + 0*x) * if (n % 1 != 0).any(): # <<<<<<<<<<<<<< * raise ValueError("Order must be integer") * */ - __pyx_t_5 = PyNumber_Remainder(__pyx_v_n, __pyx_int_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(__pyx_v_n, __pyx_int_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_NE); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyObject_GetAttr(__pyx_t_3, __pyx_kp_any); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyObject_GetAttr(__pyx_t_3, __pyx_n_s__any); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_t_5, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_Call(__pyx_t_4, ((PyObject *)__pyx_empty_tuple), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_4 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_4 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_5 = __Pyx_PyObject_IsTrue(__pyx_t_3); if (unlikely(__pyx_t_5 < 0)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 189; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - if (__pyx_t_4) { + if (__pyx_t_5) { - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":190 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":190 * out = np.zeros_like(0*n + 0*x) * if (n % 1 != 0).any(): * raise ValueError("Order must be integer") # <<<<<<<<<<<<<< @@ -3295,125 +3356,125 @@ * even = (n % 2 == 0) */ __pyx_t_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - __Pyx_INCREF(__pyx_kp_7); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_kp_7); - __Pyx_GIVEREF(__pyx_kp_7); - __pyx_t_5 = PyObject_Call(__pyx_builtin_ValueError, ((PyObject *)__pyx_t_3), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __Pyx_Raise(__pyx_t_5, 0, 0); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_GOTREF(__pyx_t_3); + __Pyx_INCREF(((PyObject *)__pyx_kp_s_1)); + PyTuple_SET_ITEM(__pyx_t_3, 0, ((PyObject *)__pyx_kp_s_1)); + __Pyx_GIVEREF(((PyObject *)__pyx_kp_s_1)); + __pyx_t_4 = PyObject_Call(__pyx_builtin_ValueError, __pyx_t_3, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_Raise(__pyx_t_4, 0, 0); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __pyx_clineno = __LINE__; goto __pyx_L1_error;} goto __pyx_L7; } __pyx_L7:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":192 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":192 * raise ValueError("Order must be integer") * * even = (n % 2 == 0) # <<<<<<<<<<<<<< * * m = n[even]/2 */ - __pyx_t_5 = PyNumber_Remainder(__pyx_v_n, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_3 = PyObject_RichCompare(__pyx_t_5, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Remainder(__pyx_v_n, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyObject_RichCompare(__pyx_t_4, __pyx_int_0, Py_EQ); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 192; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; __Pyx_DECREF(__pyx_v_even); __pyx_v_even = __pyx_t_3; __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":194 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":194 * even = (n % 2 == 0) * * m = n[even]/2 # <<<<<<<<<<<<<< * out[even] = ((-1)**m * 2**(2*m) * gamma(1+m) * * eval_genlaguerre(m, -0.5, x[even]**2)) */ - __pyx_3 = PyObject_GetItem(__pyx_v_n, __pyx_v_even); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_3, __pyx_int_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_n, __pyx_v_even); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_3, __pyx_int_2); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 194; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; __Pyx_DECREF(__pyx_v_m); - __pyx_v_m = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_v_m = __pyx_t_4; + __pyx_t_4 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":195 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":195 * * m = n[even]/2 * out[even] = ((-1)**m * 2**(2*m) * gamma(1+m) # <<<<<<<<<<<<<< * * eval_genlaguerre(m, -0.5, x[even]**2)) * */ - __pyx_t_3 = PyNumber_Power(__pyx_int_neg_1, __pyx_v_m, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_4 = PyNumber_Power(__pyx_int_neg_1, __pyx_v_m, Py_None); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyNumber_Multiply(__pyx_int_2, __pyx_v_m); 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_t_5 = PyNumber_Multiply(__pyx_int_2, __pyx_v_m); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_t_1 = PyNumber_Power(__pyx_int_2, __pyx_t_5, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_int_2, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_4, __pyx_t_2); 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_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gamma); 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_4 = PyNumber_Add(__pyx_int_1, __pyx_v_m); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_1 = PyTuple_New(1); 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_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + __pyx_t_4 = 0; + __pyx_t_4 = PyObject_Call(__pyx_t_2, __pyx_t_1, NULL); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_gamma); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyNumber_Add(__pyx_int_1, __pyx_v_m); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Multiply(__pyx_t_3, __pyx_t_4); 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_3 = PyTuple_New(1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_3)); - PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - __pyx_t_1 = 0; - __pyx_t_1 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_3), NULL); 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_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_3)); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __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_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":196 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":196 * m = n[even]/2 * out[even] = ((-1)**m * 2**(2*m) * gamma(1+m) * * eval_genlaguerre(m, -0.5, x[even]**2)) # <<<<<<<<<<<<<< * * m = (n[~even]-1)/2 */ - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_genlaguerre); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_1 = PyFloat_FromDouble((-0.5)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_v_even); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __pyx_t_5 = PyNumber_Power(__pyx_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; + __pyx_t_4 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_genlaguerre); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_3 = PyFloat_FromDouble((-0.5)); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __pyx_t_2 = PyObject_GetItem(__pyx_v_x, __pyx_v_even); if (!__pyx_t_2) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __pyx_t_6 = PyNumber_Power(__pyx_t_2, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __pyx_t_2 = PyTuple_New(3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_m); PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_m); __Pyx_GIVEREF(__pyx_v_m); - PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_1); - __Pyx_GIVEREF(__pyx_t_1); - PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - __pyx_t_1 = 0; - __pyx_t_5 = 0; - __pyx_t_5 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_2), NULL); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_3, __pyx_t_5); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + PyTuple_SET_ITEM(__pyx_t_2, 2, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_3 = 0; + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_4, __pyx_t_2, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 196; __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_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":195 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":195 * * m = n[even]/2 * out[even] = ((-1)**m * 2**(2*m) * gamma(1+m) # <<<<<<<<<<<<<< @@ -3423,129 +3484,129 @@ if (PyObject_SetItem(__pyx_v_out, __pyx_v_even, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 195; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":198 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":198 * * eval_genlaguerre(m, -0.5, x[even]**2)) * * m = (n[~even]-1)/2 # <<<<<<<<<<<<<< * out[~even] = ((-1)**m * 2**(2*m+1) * gamma(1+m) * * x[~even] * eval_genlaguerre(m, 0.5, x[~even]**2)) */ - __pyx_1 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_3 = PyObject_GetItem(__pyx_v_n, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyNumber_Subtract(__pyx_3, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_5 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_int_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyObject_GetItem(__pyx_v_n, __pyx_t_2); if (!__pyx_t_6) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Subtract(__pyx_t_6, __pyx_int_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_int_2); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 198; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_v_m); - __pyx_v_m = __pyx_t_5; - __pyx_t_5 = 0; + __pyx_v_m = __pyx_t_6; + __pyx_t_6 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":199 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":199 * * m = (n[~even]-1)/2 * out[~even] = ((-1)**m * 2**(2*m+1) * gamma(1+m) # <<<<<<<<<<<<<< * * x[~even] * eval_genlaguerre(m, 0.5, x[~even]**2)) * */ - __pyx_t_5 = PyNumber_Power(__pyx_int_neg_1, __pyx_v_m, Py_None); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); + __pyx_t_6 = PyNumber_Power(__pyx_int_neg_1, __pyx_v_m, Py_None); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); __pyx_t_2 = PyNumber_Multiply(__pyx_int_2, __pyx_v_m); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_3 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); + __pyx_t_1 = PyNumber_Add(__pyx_t_2, __pyx_int_1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_t_2 = PyNumber_Power(__pyx_int_2, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyNumber_Power(__pyx_int_2, __pyx_t_1, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - __pyx_t_3 = PyNumber_Multiply(__pyx_t_5, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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_t_1 = PyNumber_Multiply(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_gamma); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_2 = PyNumber_Add(__pyx_int_1, __pyx_v_m); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = __Pyx_GetName(__pyx_m, __pyx_n_s__gamma); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __pyx_t_5 = PyTuple_New(1); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_5)); - PyTuple_SET_ITEM(__pyx_t_5, 0, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_5), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_5)); __pyx_t_5 = 0; - __pyx_t_5 = PyNumber_Multiply(__pyx_t_3, __pyx_t_2); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_6 = PyNumber_Add(__pyx_int_1, __pyx_v_m); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_4 = PyTuple_New(1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_4, 0, __pyx_t_6); + __Pyx_GIVEREF(__pyx_t_6); + __pyx_t_6 = 0; + __pyx_t_6 = PyObject_Call(__pyx_t_2, __pyx_t_4, NULL); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Multiply(__pyx_t_1, __pyx_t_6); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __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_6); __pyx_t_6 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":200 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":200 * m = (n[~even]-1)/2 * out[~even] = ((-1)**m * 2**(2*m+1) * gamma(1+m) * * x[~even] * eval_genlaguerre(m, 0.5, x[~even]**2)) # <<<<<<<<<<<<<< * * return out */ - __pyx_1 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_2 = PyNumber_Multiply(__pyx_t_5, __pyx_3); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_6 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __pyx_t_1 = PyObject_GetItem(__pyx_v_x, __pyx_t_6); if (!__pyx_t_1) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; + __pyx_t_6 = PyNumber_Multiply(__pyx_t_4, __pyx_t_1); if (unlikely(!__pyx_t_6)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_6); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_genlaguerre); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __pyx_t_4 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __pyx_t_2 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_t_5); __pyx_t_5 = 0; - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_2 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_genlaguerre); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - __pyx_t_5 = PyFloat_FromDouble(0.5); if (unlikely(!__pyx_t_5)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_5); - __pyx_1 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_3 = PyObject_GetItem(__pyx_v_x, __pyx_1); if (!__pyx_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __pyx_t_3 = PyNumber_Power(__pyx_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_3 = PyObject_GetItem(__pyx_v_x, __pyx_t_2); if (!__pyx_t_3) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_3); __pyx_3 = 0; - __pyx_t_1 = PyTuple_New(3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Power(__pyx_t_3, __pyx_int_2, Py_None); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __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(3); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); __Pyx_INCREF(__pyx_v_m); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_m); + PyTuple_SET_ITEM(__pyx_t_3, 0, __pyx_v_m); __Pyx_GIVEREF(__pyx_v_m); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_5); - __Pyx_GIVEREF(__pyx_t_5); - PyTuple_SET_ITEM(__pyx_t_1, 2, __pyx_t_3); - __Pyx_GIVEREF(__pyx_t_3); - __pyx_t_5 = 0; - __pyx_t_3 = 0; - __pyx_t_3 = PyObject_Call(__pyx_2, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_3, 1, __pyx_t_4); + __Pyx_GIVEREF(__pyx_t_4); + PyTuple_SET_ITEM(__pyx_t_3, 2, __pyx_t_2); + __Pyx_GIVEREF(__pyx_t_2); + __pyx_t_4 = 0; + __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 = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; + __pyx_t_3 = PyNumber_Multiply(__pyx_t_6, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Multiply(__pyx_t_2, __pyx_t_3); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 200; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_6); __pyx_t_6 = 0; __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; - __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":199 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":199 * * m = (n[~even]-1)/2 * out[~even] = ((-1)**m * 2**(2*m+1) * gamma(1+m) # <<<<<<<<<<<<<< * * x[~even] * eval_genlaguerre(m, 0.5, x[~even]**2)) * */ - __pyx_1 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetItem(__pyx_v_out, __pyx_1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_2 = PyNumber_Invert(__pyx_v_even); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetItem(__pyx_v_out, __pyx_t_2, __pyx_t_3) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 199; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_3); __pyx_t_3 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":202 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":202 * * x[~even] * eval_genlaguerre(m, 0.5, x[~even]**2)) * * return out # <<<<<<<<<<<<<< @@ -3560,13 +3621,11 @@ __pyx_r = Py_None; __Pyx_INCREF(Py_None); goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); - __Pyx_XDECREF(__pyx_3); __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_XDECREF(__pyx_t_6); __Pyx_AddTraceback("scipy.special.orthogonal_eval.eval_hermite"); __pyx_r = NULL; __pyx_L0:; @@ -3576,11 +3635,11 @@ __Pyx_DECREF(__pyx_v_x); __Pyx_DECREF(__pyx_v_out); __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } -/* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":204 +/* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":204 * return out * * def eval_hermitenorm(n, x, out=None): # <<<<<<<<<<<<<< @@ -3595,17 +3654,17 @@ PyObject *__pyx_v_x = 0; PyObject *__pyx_v_out = 0; PyObject *__pyx_r = NULL; - PyObject *__pyx_1 = 0; PyObject *__pyx_t_1 = NULL; PyObject *__pyx_t_2 = NULL; PyObject *__pyx_t_3 = NULL; - static PyObject **__pyx_pyargnames[] = {&__pyx_kp_n,&__pyx_kp_x,&__pyx_kp_out,0}; - __Pyx_SetupRefcountContext("eval_hermitenorm"); + PyObject *__pyx_t_4 = NULL; + static PyObject **__pyx_pyargnames[] = {&__pyx_n_s__n,&__pyx_n_s__x,&__pyx_n_s__out,0}; + __Pyx_RefNannySetupContext("eval_hermitenorm"); __pyx_self = __pyx_self; if (unlikely(__pyx_kwds)) { Py_ssize_t kw_args = PyDict_Size(__pyx_kwds); PyObject* values[3] = {0,0,0}; - values[2] = Py_None; + values[2] = ((PyObject *)Py_None); 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); @@ -3615,18 +3674,18 @@ } switch (PyTuple_GET_SIZE(__pyx_args)) { case 0: - values[0] = PyDict_GetItem(__pyx_kwds, __pyx_kp_n); + values[0] = PyDict_GetItem(__pyx_kwds, __pyx_n_s__n); 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("eval_hermitenorm", 0, 2, 3, 1); {__pyx_filename = __pyx_f[0]; __pyx_lineno = 204; __pyx_clineno = __LINE__; goto __pyx_L3_error;} } case 2: if (kw_args > 0) { - PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_kp_out); + PyObject* value = PyDict_GetItem(__pyx_kwds, __pyx_n_s__out); if (unlikely(value)) { values[2] = value; kw_args--; } } } @@ -3637,7 +3696,7 @@ __pyx_v_x = values[1]; __pyx_v_out = values[2]; } else { - __pyx_v_out = Py_None; + __pyx_v_out = ((PyObject *)Py_None); switch (PyTuple_GET_SIZE(__pyx_args)) { case 3: __pyx_v_out = PyTuple_GET_ITEM(__pyx_args, 2); @@ -3656,62 +3715,62 @@ return NULL; __pyx_L4_argument_unpacking_done:; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":206 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":206 * def eval_hermitenorm(n, x, out=None): * """Evaluate normalized Hermite polynomial at a point.""" * return eval_hermite(n, x/sqrt(2)) * 2**(-n/2.0) # <<<<<<<<<<<<<< */ __Pyx_XDECREF(__pyx_r); - __pyx_1 = __Pyx_GetName(__pyx_m, __pyx_kp_eval_hermite); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __pyx_t_1 = PyFloat_FromDouble(sqrt(2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = __Pyx_GetName(__pyx_m, __pyx_n_s__eval_hermite); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_2 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_2 = PyFloat_FromDouble(sqrt(2)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __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(2); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_v_x, __pyx_t_2); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyTuple_New(2); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_INCREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 0, __pyx_v_n); + PyTuple_SET_ITEM(__pyx_t_2, 0, __pyx_v_n); __Pyx_GIVEREF(__pyx_v_n); - PyTuple_SET_ITEM(__pyx_t_1, 1, __pyx_t_2); - __Pyx_GIVEREF(__pyx_t_2); - __pyx_t_2 = 0; - __pyx_t_2 = PyObject_Call(__pyx_1, ((PyObject *)__pyx_t_1), NULL); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + PyTuple_SET_ITEM(__pyx_t_2, 1, __pyx_t_3); + __Pyx_GIVEREF(__pyx_t_3); + __pyx_t_3 = 0; + __pyx_t_3 = PyObject_Call(__pyx_t_1, __pyx_t_2, NULL); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_3); + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __pyx_t_2 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_2); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_1 = PyNumber_Negative(__pyx_v_n); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); __pyx_t_1 = PyFloat_FromDouble(2.0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - __pyx_t_3 = __Pyx_PyNumber_Divide(__pyx_1, __pyx_t_1); if (unlikely(!__pyx_t_3)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_t_3); - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_4 = __Pyx_PyNumber_Divide(__pyx_t_2, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - __pyx_t_1 = PyNumber_Power(__pyx_int_2, __pyx_t_3, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyNumber_Power(__pyx_int_2, __pyx_t_4, Py_None); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(__pyx_t_4); __pyx_t_4 = 0; + __pyx_t_4 = PyNumber_Multiply(__pyx_t_3, __pyx_t_1); if (unlikely(!__pyx_t_4)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 206; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_4); __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 = 206; __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_r = __pyx_t_3; - __pyx_t_3 = 0; + __pyx_r = __pyx_t_4; + __pyx_t_4 = 0; goto __pyx_L0; __pyx_r = Py_None; __Pyx_INCREF(Py_None); 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.special.orthogonal_eval.eval_hermitenorm"); __pyx_r = NULL; __pyx_L0:; __Pyx_XGIVEREF(__pyx_r); - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); return __pyx_r; } @@ -3741,7 +3800,7 @@ static struct PyModuleDef __pyx_moduledef = { PyModuleDef_HEAD_INIT, __Pyx_NAMESTR("orthogonal_eval"), - __Pyx_DOCSTR(__pyx_mdoc), /* m_doc */ + __Pyx_DOCSTR(__pyx_k_2), /* m_doc */ -1, /* m_size */ __pyx_methods /* m_methods */, NULL, /* m_reload */ @@ -3752,54 +3811,80 @@ #endif static __Pyx_StringTabEntry __pyx_string_tab[] = { - {&__pyx_kp___main__, __pyx_k___main__, sizeof(__pyx_k___main__), 1, 1, 1}, - {&__pyx_kp_n, __pyx_k_n, sizeof(__pyx_k_n), 1, 1, 1}, - {&__pyx_kp_k, __pyx_k_k, sizeof(__pyx_k_k), 1, 1, 1}, - {&__pyx_kp_alpha, __pyx_k_alpha, sizeof(__pyx_k_alpha), 1, 1, 1}, - {&__pyx_kp_beta, __pyx_k_beta, sizeof(__pyx_k_beta), 1, 1, 1}, - {&__pyx_kp_x, __pyx_k_x, sizeof(__pyx_k_x), 1, 1, 1}, - {&__pyx_kp_out, __pyx_k_out, sizeof(__pyx_k_out), 1, 1, 1}, - {&__pyx_kp_p, __pyx_k_p, sizeof(__pyx_k_p), 1, 1, 1}, - {&__pyx_kp_q, __pyx_k_q, sizeof(__pyx_k_q), 1, 1, 1}, - {&__pyx_kp__eval_chebyt, __pyx_k__eval_chebyt, sizeof(__pyx_k__eval_chebyt), 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_3, __pyx_k_3, sizeof(__pyx_k_3), 1, 1, 1}, - {&__pyx_kp_gamma, __pyx_k_gamma, sizeof(__pyx_k_gamma), 1, 1, 1}, - {&__pyx_kp_4, __pyx_k_4, sizeof(__pyx_k_4), 1, 1, 1}, - {&__pyx_kp_5, __pyx_k_5, sizeof(__pyx_k_5), 1, 1, 1}, - {&__pyx_kp_gammaln, __pyx_k_gammaln, sizeof(__pyx_k_gammaln), 1, 1, 1}, - {&__pyx_kp_exp, __pyx_k_exp, sizeof(__pyx_k_exp), 1, 1, 1}, - {&__pyx_kp_range, __pyx_k_range, sizeof(__pyx_k_range), 1, 1, 1}, - {&__pyx_kp_binom, __pyx_k_binom, sizeof(__pyx_k_binom), 1, 1, 1}, - {&__pyx_kp_eval_jacobi, __pyx_k_eval_jacobi, sizeof(__pyx_k_eval_jacobi), 1, 1, 1}, - {&__pyx_kp_eval_chebyu, __pyx_k_eval_chebyu, sizeof(__pyx_k_eval_chebyu), 1, 1, 1}, - {&__pyx_kp_eval_chebyt, __pyx_k_eval_chebyt, sizeof(__pyx_k_eval_chebyt), 1, 1, 1}, - {&__pyx_kp_eval_legendre, __pyx_k_eval_legendre, sizeof(__pyx_k_eval_legendre), 1, 1, 1}, - {&__pyx_kp_eval_genlaguerre, __pyx_k_eval_genlaguerre, sizeof(__pyx_k_eval_genlaguerre), 1, 1, 1}, - {&__pyx_kp_broadcast_arrays, __pyx_k_broadcast_arrays, sizeof(__pyx_k_broadcast_arrays), 1, 1, 1}, - {&__pyx_kp_6, __pyx_k_6, sizeof(__pyx_k_6), 1, 1, 1}, - {&__pyx_kp_zeros_like, __pyx_k_zeros_like, sizeof(__pyx_k_zeros_like), 1, 1, 1}, - {&__pyx_kp_any, __pyx_k_any, sizeof(__pyx_k_any), 1, 1, 1}, - {&__pyx_kp_ValueError, __pyx_k_ValueError, sizeof(__pyx_k_ValueError), 1, 1, 1}, - {&__pyx_kp_eval_hermite, __pyx_k_eval_hermite, sizeof(__pyx_k_eval_hermite), 1, 1, 1}, - {&__pyx_kp_7, __pyx_k_7, sizeof(__pyx_k_7), 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_u_15, __pyx_k_15, sizeof(__pyx_k_15), 0, 1, 0, 0}, + {&__pyx_kp_u_16, __pyx_k_16, sizeof(__pyx_k_16), 0, 1, 0, 0}, + {&__pyx_kp_u_17, __pyx_k_17, sizeof(__pyx_k_17), 0, 1, 0, 0}, + {&__pyx_kp_u_18, __pyx_k_18, sizeof(__pyx_k_18), 0, 1, 0, 0}, + {&__pyx_kp_u_19, __pyx_k_19, sizeof(__pyx_k_19), 0, 1, 0, 0}, + {&__pyx_kp_u_20, __pyx_k_20, sizeof(__pyx_k_20), 0, 1, 0, 0}, + {&__pyx_n_s_4, __pyx_k_4, sizeof(__pyx_k_4), 0, 0, 1, 1}, + {&__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__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___eval_chebyt, __pyx_k___eval_chebyt, sizeof(__pyx_k___eval_chebyt), 0, 0, 1, 1}, + {&__pyx_n_s__alpha, __pyx_k__alpha, sizeof(__pyx_k__alpha), 0, 0, 1, 1}, + {&__pyx_n_s__any, __pyx_k__any, sizeof(__pyx_k__any), 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__beta, __pyx_k__beta, sizeof(__pyx_k__beta), 0, 0, 1, 1}, + {&__pyx_n_s__binom, __pyx_k__binom, sizeof(__pyx_k__binom), 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__eval_chebyc, __pyx_k__eval_chebyc, sizeof(__pyx_k__eval_chebyc), 0, 0, 1, 1}, + {&__pyx_n_s__eval_chebys, __pyx_k__eval_chebys, sizeof(__pyx_k__eval_chebys), 0, 0, 1, 1}, + {&__pyx_n_s__eval_chebyt, __pyx_k__eval_chebyt, sizeof(__pyx_k__eval_chebyt), 0, 0, 1, 1}, + {&__pyx_n_s__eval_chebyu, __pyx_k__eval_chebyu, sizeof(__pyx_k__eval_chebyu), 0, 0, 1, 1}, + {&__pyx_n_s__eval_gegenbauer, __pyx_k__eval_gegenbauer, sizeof(__pyx_k__eval_gegenbauer), 0, 0, 1, 1}, + {&__pyx_n_s__eval_genlaguerre, __pyx_k__eval_genlaguerre, sizeof(__pyx_k__eval_genlaguerre), 0, 0, 1, 1}, + {&__pyx_n_s__eval_hermite, __pyx_k__eval_hermite, sizeof(__pyx_k__eval_hermite), 0, 0, 1, 1}, + {&__pyx_n_s__eval_hermitenorm, __pyx_k__eval_hermitenorm, sizeof(__pyx_k__eval_hermitenorm), 0, 0, 1, 1}, + {&__pyx_n_s__eval_jacobi, __pyx_k__eval_jacobi, sizeof(__pyx_k__eval_jacobi), 0, 0, 1, 1}, + {&__pyx_n_s__eval_laguerre, __pyx_k__eval_laguerre, sizeof(__pyx_k__eval_laguerre), 0, 0, 1, 1}, + {&__pyx_n_s__eval_legendre, __pyx_k__eval_legendre, sizeof(__pyx_k__eval_legendre), 0, 0, 1, 1}, + {&__pyx_n_s__eval_sh_chebyt, __pyx_k__eval_sh_chebyt, sizeof(__pyx_k__eval_sh_chebyt), 0, 0, 1, 1}, + {&__pyx_n_s__eval_sh_chebyu, __pyx_k__eval_sh_chebyu, sizeof(__pyx_k__eval_sh_chebyu), 0, 0, 1, 1}, + {&__pyx_n_s__eval_sh_jacobi, __pyx_k__eval_sh_jacobi, sizeof(__pyx_k__eval_sh_jacobi), 0, 0, 1, 1}, + {&__pyx_n_s__eval_sh_legendre, __pyx_k__eval_sh_legendre, sizeof(__pyx_k__eval_sh_legendre), 0, 0, 1, 1}, + {&__pyx_n_s__exp, __pyx_k__exp, sizeof(__pyx_k__exp), 0, 0, 1, 1}, + {&__pyx_n_s__gamma, __pyx_k__gamma, sizeof(__pyx_k__gamma), 0, 0, 1, 1}, + {&__pyx_n_s__gammaln, __pyx_k__gammaln, sizeof(__pyx_k__gammaln), 0, 0, 1, 1}, + {&__pyx_n_s__hyp1f1, __pyx_k__hyp1f1, sizeof(__pyx_k__hyp1f1), 0, 0, 1, 1}, + {&__pyx_n_s__hyp2f1, __pyx_k__hyp2f1, sizeof(__pyx_k__hyp2f1), 0, 0, 1, 1}, + {&__pyx_n_s__k, __pyx_k__k, sizeof(__pyx_k__k), 0, 0, 1, 1}, + {&__pyx_n_s__n, __pyx_k__n, sizeof(__pyx_k__n), 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__out, __pyx_k__out, sizeof(__pyx_k__out), 0, 0, 1, 1}, + {&__pyx_n_s__p, __pyx_k__p, sizeof(__pyx_k__p), 0, 0, 1, 1}, + {&__pyx_n_s__q, __pyx_k__q, sizeof(__pyx_k__q), 0, 0, 1, 1}, + {&__pyx_n_s__range, __pyx_k__range, sizeof(__pyx_k__range), 0, 0, 1, 1}, + {&__pyx_n_s__x, __pyx_k__x, sizeof(__pyx_k__x), 0, 0, 1, 1}, + {&__pyx_n_s__zeros_like, __pyx_k__zeros_like, sizeof(__pyx_k__zeros_like), 0, 0, 1, 1}, + {0, 0, 0, 0, 0, 0, 0} }; static int __Pyx_InitCachedBuiltins(void) { - __pyx_builtin_range = __Pyx_GetName(__pyx_b, __pyx_kp_range); if (!__pyx_builtin_range) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 33; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __pyx_builtin_ValueError = __Pyx_GetName(__pyx_b, __pyx_kp_ValueError); if (!__pyx_builtin_ValueError) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 190; __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 = 33; __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 = 190; __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_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_1 = PyInt_FromLong(1); if (unlikely(!__pyx_int_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;}; __pyx_int_2 = PyInt_FromLong(2); if (unlikely(!__pyx_int_2)) {__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;}; return 0; __pyx_L1_error:; return -1; @@ -3813,21 +3898,21 @@ PyMODINIT_FUNC PyInit_orthogonal_eval(void) #endif { - PyObject *__pyx_1 = 0; - PyObject *__pyx_2 = 0; PyObject *__pyx_t_1 = NULL; - __pyx_init_filenames(); - #ifdef CYTHON_REFNANNY - void* __pyx_refchk = NULL; - __Pyx_Refnanny = __Pyx_ImportRefcountAPI("refnanny"); - if (!__Pyx_Refnanny) { + 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) { 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_orthogonal_eval(void)", __LINE__, __FILE__); + __pyx_refnanny = __Pyx_RefNanny->SetupContext("PyMODINIT_FUNC PyInit_orthogonal_eval(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;} @@ -3843,7 +3928,7 @@ #endif /*--- Module creation code ---*/ #if PY_MAJOR_VERSION < 3 - __pyx_m = Py_InitModule4(__Pyx_NAMESTR("orthogonal_eval"), __pyx_methods, __pyx_mdoc, 0, PYTHON_API_VERSION); + __pyx_m = Py_InitModule4(__Pyx_NAMESTR("orthogonal_eval"), __pyx_methods, __Pyx_DOCSTR(__pyx_k_2), 0, PYTHON_API_VERSION); #else __pyx_m = PyModule_Create(&__pyx_moduledef); #endif @@ -3854,14 +3939,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__special__orthogonal_eval) { - 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 ---*/ /*--- Type init code ---*/ @@ -3869,7 +3953,7 @@ /*--- Function import code ---*/ /*--- Execution code ---*/ - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":71 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":71 * cdef PyUFuncGenericFunction _id_d_funcs[1] * * _id_d_types[0] = NPY_LONG # <<<<<<<<<<<<<< @@ -3878,7 +3962,7 @@ */ (__pyx_v_5scipy_7special_15orthogonal_eval__id_d_types[0]) = NPY_LONG; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":72 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":72 * * _id_d_types[0] = NPY_LONG * _id_d_types[1] = NPY_DOUBLE # <<<<<<<<<<<<<< @@ -3887,7 +3971,7 @@ */ (__pyx_v_5scipy_7special_15orthogonal_eval__id_d_types[1]) = NPY_DOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":73 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":73 * _id_d_types[0] = NPY_LONG * _id_d_types[1] = NPY_DOUBLE * _id_d_types[2] = NPY_DOUBLE # <<<<<<<<<<<<<< @@ -3896,7 +3980,7 @@ */ (__pyx_v_5scipy_7special_15orthogonal_eval__id_d_types[2]) = NPY_DOUBLE; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":75 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":75 * _id_d_types[2] = NPY_DOUBLE * * _id_d_funcs[0] = _loop_id_d # <<<<<<<<<<<<<< @@ -3905,7 +3989,7 @@ */ (__pyx_v_5scipy_7special_15orthogonal_eval__id_d_funcs[0]) = __pyx_f_5scipy_7special_15orthogonal_eval__loop_id_d; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":77 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":77 * _id_d_funcs[0] = _loop_id_d * * import_array() # <<<<<<<<<<<<<< @@ -3914,7 +3998,7 @@ */ import_array(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":78 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":78 * * import_array() * import_ufunc() # <<<<<<<<<<<<<< @@ -3923,7 +4007,7 @@ */ import_ufunc(); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":83 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":83 * * cdef void *chebyt_data[1] * chebyt_data[0] = eval_poly_chebyt # <<<<<<<<<<<<<< @@ -3932,31 +4016,31 @@ */ (__pyx_v_5scipy_7special_15orthogonal_eval_chebyt_data[0]) = ((void *)__pyx_f_5scipy_7special_15orthogonal_eval_eval_poly_chebyt); - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":85 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":85 * chebyt_data[0] = eval_poly_chebyt * _eval_chebyt = PyUFunc_FromFuncAndData(_id_d_funcs, chebyt_data, * _id_d_types, 1, 2, 1, 0, "", "", 0) # <<<<<<<<<<<<<< * * */ - __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_15orthogonal_eval__id_d_funcs, __pyx_v_5scipy_7special_15orthogonal_eval_chebyt_data, __pyx_v_5scipy_7special_15orthogonal_eval__id_d_types, 1, 2, 1, 0, __pyx_k_1, __pyx_k_2, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __pyx_t_1 = PyUFunc_FromFuncAndData(__pyx_v_5scipy_7special_15orthogonal_eval__id_d_funcs, __pyx_v_5scipy_7special_15orthogonal_eval_chebyt_data, __pyx_v_5scipy_7special_15orthogonal_eval__id_d_types, 1, 2, 1, 0, __pyx_k_3, __pyx_k_3, 0); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(__pyx_t_1); - if (PyObject_SetAttr(__pyx_m, __pyx_kp__eval_chebyt, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + if (PyObject_SetAttr(__pyx_m, __pyx_n_s___eval_chebyt, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 84; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":92 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":92 * #------------------------------------------------------------------------------ * * import numpy as np # <<<<<<<<<<<<<< * from scipy.special._cephes import gamma, hyp2f1, hyp1f1, gammaln * from numpy import exp */ - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, 0); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_np, __pyx_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_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 = 92; __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 = 92; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":93 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":93 * * import numpy as np * from scipy.special._cephes import gamma, hyp2f1, hyp1f1, gammaln # <<<<<<<<<<<<<< @@ -3965,72 +4049,186 @@ */ __pyx_t_1 = PyList_New(4); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_gamma); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_gamma); - __Pyx_GIVEREF(__pyx_kp_gamma); - __Pyx_INCREF(__pyx_kp_4); - PyList_SET_ITEM(__pyx_t_1, 1, __pyx_kp_4); - __Pyx_GIVEREF(__pyx_kp_4); - __Pyx_INCREF(__pyx_kp_5); - PyList_SET_ITEM(__pyx_t_1, 2, __pyx_kp_5); - __Pyx_GIVEREF(__pyx_kp_5); - __Pyx_INCREF(__pyx_kp_gammaln); - PyList_SET_ITEM(__pyx_t_1, 3, __pyx_kp_gammaln); - __Pyx_GIVEREF(__pyx_kp_gammaln); - __pyx_1 = __Pyx_Import(__pyx_kp_3, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); + __Pyx_INCREF(((PyObject *)__pyx_n_s__gamma)); + PyList_SET_ITEM(__pyx_t_1, 0, ((PyObject *)__pyx_n_s__gamma)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gamma)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__hyp2f1)); + PyList_SET_ITEM(__pyx_t_1, 1, ((PyObject *)__pyx_n_s__hyp2f1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hyp2f1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__hyp1f1)); + PyList_SET_ITEM(__pyx_t_1, 2, ((PyObject *)__pyx_n_s__hyp1f1)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__hyp1f1)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__gammaln)); + PyList_SET_ITEM(__pyx_t_1, 3, ((PyObject *)__pyx_n_s__gammaln)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__gammaln)); + __pyx_t_2 = __Pyx_Import(((PyObject *)__pyx_n_s_4), ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_gamma); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_gamma, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_4); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_4, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_5); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_5, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_gammaln); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_gammaln, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__gamma); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gamma, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__hyp2f1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hyp2f1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__hyp1f1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__hyp1f1, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; + __pyx_t_1 = PyObject_GetAttr(__pyx_t_2, __pyx_n_s__gammaln); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__gammaln, __pyx_t_1) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 93; __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/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":94 + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":94 * import numpy as np * from scipy.special._cephes import gamma, hyp2f1, hyp1f1, gammaln * from numpy import exp # <<<<<<<<<<<<<< * * def binom(n, k): */ - __pyx_t_1 = PyList_New(1); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(((PyObject *)__pyx_t_1)); - __Pyx_INCREF(__pyx_kp_exp); - PyList_SET_ITEM(__pyx_t_1, 0, __pyx_kp_exp); - __Pyx_GIVEREF(__pyx_kp_exp); - __pyx_1 = __Pyx_Import(__pyx_kp_numpy, ((PyObject *)__pyx_t_1)); if (unlikely(!__pyx_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_1); - __Pyx_DECREF(((PyObject *)__pyx_t_1)); __pyx_t_1 = 0; - __pyx_2 = PyObject_GetAttr(__pyx_1, __pyx_kp_exp); if (unlikely(!__pyx_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_GOTREF(__pyx_2); - if (PyObject_SetAttr(__pyx_m, __pyx_kp_exp, __pyx_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} - __Pyx_DECREF(__pyx_2); __pyx_2 = 0; - __Pyx_DECREF(__pyx_1); __pyx_1 = 0; + __pyx_t_2 = PyList_New(1); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_2)); + __Pyx_INCREF(((PyObject *)__pyx_n_s__exp)); + PyList_SET_ITEM(__pyx_t_2, 0, ((PyObject *)__pyx_n_s__exp)); + __Pyx_GIVEREF(((PyObject *)__pyx_n_s__exp)); + __pyx_t_1 = __Pyx_Import(((PyObject *)__pyx_n_s__numpy), ((PyObject *)__pyx_t_2)); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_1); + __Pyx_DECREF(((PyObject *)__pyx_t_2)); __pyx_t_2 = 0; + __pyx_t_2 = PyObject_GetAttr(__pyx_t_1, __pyx_n_s__exp); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + if (PyObject_SetAttr(__pyx_m, __pyx_n_s__exp, __pyx_t_2) < 0) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 94; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_DECREF(__pyx_t_2); __pyx_t_2 = 0; + __Pyx_DECREF(__pyx_t_1); __pyx_t_1 = 0; - /* "/home/pauli/koodi/proj/scipy/scipy/scipy/special/orthogonal_eval.pyx":204 - * return out + /* "/home/pauli/wrk/scipy/scipy/scipy/special/orthogonal_eval.pyx":1 + * """ # <<<<<<<<<<<<<< + * Evaluate orthogonal polynomial values using recurrence relations. * - * def eval_hermitenorm(n, x, out=None): # <<<<<<<<<<<<<< - * """Evaluate normalized Hermite polynomial at a point.""" - * return eval_hermite(n, x/sqrt(2)) * 2**(-n/2.0) */ + __pyx_t_1 = PyDict_New(); if (unlikely(!__pyx_t_1)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(((PyObject *)__pyx_t_1)); + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__binom); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_5), __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__eval_jacobi); 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_6), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_sh_jacobi); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_7), __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__eval_gegenbauer); 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_8), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_chebyt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_9), __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__eval_chebyu); 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_10), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_chebys); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_11), __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__eval_chebyc); 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_12), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_sh_chebyt); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_13), __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__eval_sh_chebyu); 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_14), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_legendre); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_15), __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__eval_sh_legendre); 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_16), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_genlaguerre); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_17), __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__eval_laguerre); 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_18), __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; + __pyx_t_2 = PyObject_GetAttr(__pyx_m, __pyx_n_s__eval_hermite); if (unlikely(!__pyx_t_2)) {__pyx_filename = __pyx_f[0]; __pyx_lineno = 1; __pyx_clineno = __LINE__; goto __pyx_L1_error;} + __Pyx_GOTREF(__pyx_t_2); + __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_19), __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__eval_hermitenorm); 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_20), __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; goto __pyx_L0; __pyx_L1_error:; - __Pyx_XDECREF(__pyx_1); - __Pyx_XDECREF(__pyx_2); __Pyx_XDECREF(__pyx_t_1); + __Pyx_XDECREF(__pyx_t_2); + __Pyx_XDECREF(__pyx_t_3); if (__pyx_m) { __Pyx_AddTraceback("init scipy.special.orthogonal_eval"); Py_DECREF(__pyx_m); __pyx_m = 0; @@ -4038,7 +4236,7 @@ PyErr_SetString(PyExc_ImportError, "init scipy.special.orthogonal_eval"); } __pyx_L0:; - __Pyx_FinishRefcountContext(); + __Pyx_RefNannyFinishContext(); #if PY_MAJOR_VERSION < 3 return; #else @@ -4178,6 +4376,43 @@ return -1; } +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, + #else + "need more than %zd value%s to unpack", index, + #endif + (index == 1) ? "" : "s"); +} + +static INLINE void __Pyx_RaiseTooManyValuesError(void) { + PyErr_SetString(PyExc_ValueError, "too many values to unpack"); +} + +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 PyObject *__Pyx_Import(PyObject *name, PyObject *from_list) { PyObject *__import__ = 0; PyObject *empty_list = 0; @@ -4220,55 +4455,51 @@ } 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); + 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 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_ErrRestore(PyObject *type, PyObject *value, PyObject *tb) { + PyObject *tmp_type, *tmp_value, *tmp_tb; + PyThreadState *tstate = PyThreadState_GET(); -static INLINE void __Pyx_RaiseTooManyValuesError(void) { - PyErr_SetString(PyExc_ValueError, "too many values to unpack"); + 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 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 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; -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; + 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); @@ -4324,6 +4555,7 @@ } #endif } + __Pyx_ErrRestore(type, value, tb); return; raise_error: @@ -4333,57 +4565,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) { + 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"); } @@ -4395,12 +4629,14 @@ } static 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"); } @@ -4412,12 +4648,14 @@ } static 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"); } @@ -4429,12 +4667,14 @@ } static 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"); } @@ -4446,12 +4686,14 @@ } static 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"); } @@ -4463,12 +4705,14 @@ } static 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"); } @@ -4480,12 +4724,14 @@ } static 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"); } @@ -4497,12 +4743,14 @@ } static 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"); } @@ -4514,12 +4762,14 @@ } static 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"); } @@ -4531,10 +4781,12 @@ } static 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; @@ -4543,14 +4795,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); @@ -4562,10 +4816,12 @@ } static 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; @@ -4574,14 +4830,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); @@ -4593,10 +4851,12 @@ } static 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; @@ -4605,14 +4865,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); @@ -4624,10 +4886,12 @@ } static 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; @@ -4636,14 +4900,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); @@ -4655,10 +4921,12 @@ } static 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; @@ -4667,14 +4935,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); @@ -4686,10 +4956,12 @@ } static 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; @@ -4698,14 +4970,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); @@ -4789,7 +5063,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); @@ -4797,10 +5071,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); }