Ask Your Question

Revision history [back]

How about something like this:

def xyz(n):
    m = -Infinity # or some number that you know is less than the max
    matrices = []  # list of matrices with max determinant
    for A in myfunction(n):
        d = A.det()
        if d > m:
            matrices = [A]
            m = d
        elif d == m:
            matrices.append(A)
    return matrices