Python/OLS/ols_example/linalg.py
def identity_matrix(n):
    """
    Creates and returns an identity matrix.
    """
    # initialize a 2D matrix with zeros
    I = np.zeros((n, n))

    # fill the diagonal with ones
    for i in range(n):
        I[i][i] = 1.0

    return I

    Creates and returns an identity matrix.
    
Creates and returns an identity matrix.
Creates and returns an identity matrix .
def identity_matrix(n):
    I = np.zeros((n, n))
    for i in range(n):
        I[i][i] = 1.0
    return I
def identity_matrix ( n ) : I = np . zeros ( ( n , n ) ) for i in range ( n ) : I [ i ] [ i ] = 1.0 return I
Creates and returns an identity matrix.
Creates and returns an identity matrix .
"""
    Creates and returns an identity matrix.
    """ # initialize a 2D matrix with zeros # fill the diagonal with ones
n