#NEWLINE# def vander( x , N = None ) : #NEWLINE# #INDENT# '\n    Generate a Van der Monde matrix.\n\n    The columns of the output matrix are decreasing powers of the input\n    vector.  Specifically, the i-th output column is the input vector to\n    the power of ``N - i - 1``. Such a matrix with a geometric progression\n    in each row is named Van Der Monde, or Vandermonde matrix, from\n    Alexandre-Theophile Vandermonde.\n\n    Parameters\n    ----------\n    x : array_like\n        1-D input array.\n    N : int, optional\n        Order of (number of columns in) the output. If `N` is not specified,\n        a square array is returned (``N = len(x)``).\n\n    Returns\n    -------\n    out : ndarray\n        Van der Monde matrix of order `N`.  The first column is ``x^(N-1)``,\n        the second ``x^(N-2)`` and so forth.\n\n    References\n    ----------\n    .. [1] Wikipedia, "Vandermonde matrix",\n           http://en.wikipedia.org/wiki/Vandermonde_matrix\n\n    Examples\n    --------\n    >>> x = np.array([1, 2, 3, 5])\n    >>> N = 3\n    >>> np.vander(x, N)\n    array([[ 1,  1,  1],\n           [ 4,  2,  1],\n           [ 9,  3,  1],\n           [25,  5,  1]])\n\n    >>> np.column_stack([x**(N-1-i) for i in range(N)])\n    array([[ 1,  1,  1],\n           [ 4,  2,  1],\n           [ 9,  3,  1],\n           [25,  5,  1]])\n\n    >>> x = np.array([1, 2, 3, 5])\n    >>> np.vander(x)\n    array([[  1,   1,   1,   1],\n           [  8,   4,   2,   1],\n           [ 27,   9,   3,   1],\n           [125,  25,   5,   1]])\n\n    ' #NEWLINE# x = asarray ( x ) #NEWLINE# if ( N is None ) : #NEWLINE# #INDENT# N = len ( x ) #NEWLINE# #UNINDENT# X = ones ( ( len ( x ) , N ) , x . dtype ) #NEWLINE# for i in range ( ( N - 1 ) ) : #NEWLINE# #INDENT# X [ : , i ] = ( N ** ( ( N - i ) - 1 ) ) #NEWLINE# #UNINDENT# return X