'Derivative of 1D Chebyshev series'

def _chebderiv1d(self, x, deg):

    x = np.array(x, dtype=np.float, copy=False, ndmin=1)
    d = np.empty(((deg + 1), len(x)), dtype=x.dtype)
    d[0] = ((x * 0) + 1)
    if (deg > 0):
        x2 = (2 * x)
        d[1] = x
        for i in range(2, (deg + 1)):
            d[i] = ((d[(i - 1)] * x2) - d[(i - 2)])
    return np.rollaxis(d, 0, d.ndim)
