ENH: release the GIL in some C library functions.

Sandwich certain potentially long running for loops that don't touch any
Python objects between NPY_BEGIN_ALLOW_THREADS and NPY_END_ALLOW_THREADS
so that the interpreter can potentially schedule another Python thread.
ENH: less fine-grained GIL management in digitize.
ENH: Use char instead of int for error flag.
ENH: release GIL for C loops in ravel/unravel.
REF: factor out inner loop of arr_insert.

This makes subsequent thread-friendly modification easier.
ENH: release the GIL for arr_insert inner loop.

Releases it only conditionally, as object arrays require refcounting to
be performed within the inner loop, making GIL release impractical.
REF: simplify multi-loop breaking with a goto.
STY: Whitespace cleanup and double space between function definitions.
ENH: Modify the various polynomial series so that multidimensional coefficient arrays can be used. Add functions for evaluation of 2D and 3D polynomial series evaluated either on a specified set of points or on a cartesian product of 1D points.

The new functions have names polyval2d, polygrid2d, polyval3d, and
polygrid3d, where 'poly' can be replaced by any of 'leg', 'cheb', 'lag',
'herm', or 'herme'. These additional functions should cover the common
multidimensional cases and provide examples for anyone who wants to go to
higher dimensions.
ENH: Add functions for producing 2D and 3D pseudo Vandermonde matrices that are useful for least squares fits to data depending on two or three variables using the various polynomial basis.

The new functions have names polyvander2d, and polyvander3d,
where 'poly' can be replaced by any of 'leg', 'cheb', 'lag',
'herm', or 'herme'.
ENH: Make derivatives and integrals work on multidimensional array.

An axis keyword was added to the function signatures of xxxder and
xxxint, where xxx is any of poly, cheb, leg, lag, herm, herme. The
evaluation method for the Chebeshev series was also changed to avoid
using z_series and to more closely resemble the other implementations.

At some point the z_series will be removed from the chebyshev module
and only used for trigonometric series.
BUG: The derivative tests were using incorrect test coefficients.

The coefficients used were [1] + [0]*i instead of [0]*i + [1].
BUG: Small fixes and additions

Where xxx is one of poly, cheb, leg, lag, herm, herme:

Refactor  xxxval2d, xxxval3d, xxxgrid2d, and xxxgrid3d for clarity.
Check that coordinate arrays are compatible in xxxval2d, xxxval3d.
Work around einsum bug that affected xxxvander3d.
TST: Add tests for multidimensional coefficient array functionality.

Test the multi-dimensional coefficient array functionality.
Reorganize and cleanup some previous tests.
ENH: Add companion matrix functions.

The new companion matrices are related to the old by a
similarity transformation that makes them better conditioned
for root finding. In particular, the companion matrices for
the orthogonal polynomials are symmetric when the zeros of a
single polynomial term is wanted. This produces better zeros
for use in Gauss quadrature.
BUG: Fix test that was in wrong spot.
ENH: Add functions for Gauss quadrature and associated weight functions.

The new functions for Gauss quadrature  are of the form xxxgauss, where xxx
is any of cheb, leg, lag, herm, herme. They return the Gauss points and
weights for Gauss quadrature of the various orthogonal polynomial types
given the degree. They are tested to work up to degree 100.

The new functions for the weight are of the form xxxweight, where xxx is
any of cheb, leg, lag, herm, herme. They return the value of the weight
function for the various orthogonal polynomial types given and array of
points.
TST: Add tests for Gauss quadrature and weight functions.
ENH: Add static methods basis and cast to the polynomial classes.

The new basis method is a convenient way to return an instance of the basis
function of given degree for the class. It is intended mostly for
pedagogical purposes.

The new cast method provides an alternate way to convert an instance of one
polynomial class to another. It complements the convert instance method.
TST: Add tests for basis and cast static class methods.

A new test file, test_classes, has been added so that conversions
between all the class types can be tested. Several tests common to
all the classes were also moved to this file. Ideally all the common
tests will be moved, but that isn't done yet.