Ask Your Question

# Revision history [back]

Not a single expression, but you can try the following one-line possibilities:

sage: size = 1000
sage: m = random_matrix(RDF, size)

sage: max(max(i for i in rows) for rows in m)
sage: max(m[i,j] for i in range(size) for j in range(size))
sage: max(m.list())
sage: max(m._list())


From the slowest to the fastest (5.19 s, 3.1 s, 2.12 s, 2.08 s).

Not a single expression, command, but you can try the following one-line possibilities:

sage: size = 1000
sage: m = random_matrix(RDF, size)

sage: max(max(i for i in rows) for rows in m)
sage: max(m[i,j] for i in range(size) for j in range(size))
sage: max(m.list())
sage: max(m._list())


From the slowest to the fastest (5.19 s, 3.1 s, 2.12 s, 2.08 s).