(ctx, diagonal, **kwargs)
return A
Create square diagonal matrix using given list.

        Example:
        >>> from sympy.mpmath import diag, mp
        >>> mp.pretty = False
        >>> diag([1, 2, 3])
        matrix(
        [['1.0', '0.0', '0.0'],
         ['0.0', '2.0', '0.0'],
         ['0.0', '0.0', '3.0']])
Create square diagonal matrix using given list.
Create square diagonal matrix using given list .
def diag(ctx, diagonal, **kwargs):
        """
        Create square diagonal matrix using given list.

        Example:
        >>> from sympy.mpmath import diag, mp
        >>> mp.pretty = False
        >>> diag([1, 2, 3])
        matrix(
        [['1.0', '0.0', '0.0'],
         ['0.0', '2.0', '0.0'],
         ['0.0', '0.0', '3.0']])
        """
        A = ctx.matrix(len(diagonal), **kwargs)
        for i in xrange(len(diagonal)):
            A[i,i] = diagonal[i]
        return A
def diag ( ctx , diagonal , * * kwargs ) : A = ctx . matrix ( len ( diagonal ) , * * kwargs ) for i in xrange ( len ( diagonal ) ) : A [ i , i ] = diagonal [ i ] return A