# Revision history [back]

There is no single "internal representation". If a matrix is sparse, then its entries are represented by a dictionary. If not, its entries are a list. You can get either as follows:

sage: m = matrix(2,2, {(1,1): 3})
sage: m.is_sparse()
True
sage: m.dict()
{(1, 1): 3}
sage: m.list()
[0, 0, 0, 3]

sage: m = matrix(2,2, [1,2,3,4])
sage: m.is_sparse()
False
sage: m.dict()
{(0, 0): 1, (0, 1): 2, (1, 0): 3, (1, 1): 4}
sage: m.list()
[1, 2, 3, 4]


Is there something particular you are trying to do?