def delta1(m, n, p, q):
    """delta1 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------

    delta1 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (m*n*p*q)/((m**2 - p**2)*(n**2 - q**2))

def delta2(m, n, p, q):
    """delta2 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------

    delta2 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((m**2 + p**2)*n*q)/((m**2 - p**2)*(n**2 - q**2))

def delta3(m, n, p, q):
    """delta3 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta3 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((p**2)*m*q)/((m**2 - p**2)*(n**2 - q**2))

def delta31(m, n, p, q):
    """delta31 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta31 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((m**2)*n*p)/((m**2 - p**2)*(n**2 - q**2))

def delta4(m, n, p, q):
    """delta4 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta4 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((n**2)*m*q)/((m**2 - p**2)*(n**2 - q**2))

def delta41(m, n, p, q):
    """delta41 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta41 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((q**2)*n*p)/((m**2 - p**2)*(n**2 - q**2))

def delta5(m, n, p, q):
    """delta5 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta5 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((n**2 + q**2)*m*p)/((m**2 - p**2)*(n**2 - q**2))

def delta66(m, n, p, q):
    """delta66 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta66 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (p*n*q)/((m**2 - p**2)*(n**2 - q**2))

def delta67(m, n, p, q):
    """delta67 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta67 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (m*p*q)/((m**2 - p**2)*(n**2 - q**2))

def delta68(m, n, p, q):
    """delta61 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta68 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (m*n*q)/((m**2 - p**2)*(n**2 - q**2))

def delta69(m, n, p, q):
    """delta61 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta69 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (m*n*p)/((m**2 - p**2)*(n**2 - q**2))
    
def delta75(m, n, p, q):
    """delta75 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta69 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((n**2)*m*p)/((m**2 - p**2)*(n**2 - q**2))
    
def delta76(m, n, p, q):
    """delta76 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta69 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((q**2)*m*p)/((m**2 - p**2)*(n**2 - q**2))

def delta8(m, n, p, q):
    """delta8 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta69 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((p**2)*n*q)/((m**2 - p**2)*(n**2 - q**2))

def delta9(m, n, p, q):
    """delta9 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta91 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return ((m**2)*n*q)/((m**2 - p**2)*(n**2 - q**2))
        
def delta91(m, n, p, q):
    """delta91 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta91 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (n*p)/((m**2 - p**2)*(n**2 - q**2))

def delta92(m, n, p, q):
    """delta61 operator. 
    
    Parameters
    ----------
    m : int

    n : int

    p : int

    q : int
    
    Returns
    -------
    
    delta92 : float
    
    """

    if m == p or n == q or (m+p) % 2 == 0 or (n+q) % 2 == 0 or (m-p) % 2 == 0 or (n-q) % 2 == 0:
        return 0
    else:
        return (m*q)/((m**2 - p**2)*(n**2 - q**2))

def kronecker(m, n):
    """Calculates kronecker delta.
    
    Parameters
    ----------
    m : int

    n : int
    
    Returns
    -------
    
    kronecker : int
    
    """

    if m == n:
        return 1
    else:
        return 0

def get_odd_even(m):
    """Creates odd/even pair list for a given m (assumed to be equal to n).
    For i = 1, 2, ... , m and j = 1, 2, ... ,n: odd list consists of (i, j) such
    that i+j is odd and even list consists of (i, j) such that i+j is even.
    
    Parameters
    ----------

    m : int
    
    Returns
    -------
    
    (odd, even) : (list, list)
    odd : list
        [(i, j), ..., (i, j)]
    even : list
        [(i, j), ..., (i, j)]
    
    """

    odd = [(i, j) for i in range(1, m+1) for j in range(1, m+1) 
    if (i+j) % 2 != 0]
    even = [(i, j) for i in range(1, m+1) for j in range(1, m+1) 
    if (i+j) % 2 == 0]
    return (odd, even)

def get_pairs(m):
    """Creates list of all possible pairs for a given m (assumed to be equal to n).
    
    Parameters
    ----------
    
    m : int
    
    Returns
    -------
    
    pairs : list
    
        [(1,1), (1,2), ...]
        
    """

    pairs = [(i, j) for i in range(1, m+1) for j in range(1, m+1)]
    return pairs
            