(p, q=0)
return ','.join(D)
Returns string equivalent metric tensor for signature (p, q).
Returns string equivalent metric tensor for signature (p, q).
Returns string equivalent metric tensor for signature ( p q ) .
def diagpq(p, q=0):
    """
    Returns string equivalent metric tensor for signature (p, q).
    """
    n = p + q
    D = []
    for i in range(p):
        D.append((i*'0 ' +'1 '+ (n-i-1)*'0 ')[:-1])
    for i in range(p,n):
        D.append((i*'0 ' +'-1 '+ (n-i-1)*'0 ')[:-1])
    return ','.join(D)
def diagpq ( p , q = 0 ) : n = p + q D = [ ] for i in range ( p ) : D . append ( ( i * '0 ' + '1 ' + ( n - i - 1 ) * '0 ' ) [ : - 1 ] ) for i in range ( p , n ) : D . append ( ( i * '0 ' + '-1 ' + ( n - i - 1 ) * '0 ' ) [ : - 1 ] ) return ',' . join ( D )