def Diag ( a ) : r = np . zeros ( 2 * a . shape , dtype = a . dtype ) for idx , v in np . ndenumerate ( a ) : r [ 2 * idx ] = v return r ,
python array to a diagnoal matrix
Diag op .
def Diag(a):
    """
    Diag op.
    """
    r = np.zeros(2 * a.shape, dtype=a.dtype)
    for idx, v in np.ndenumerate(a):
        r[2 * idx] = v
    return r,