mul: expand intermediate matrices in sorted order

'mul' computes matrix products as sums of outer products. The matrices
were generated as unsorted lists of coefficients which were assembled
into uncompressed matrices using 'pack'. However, the intermediate
matrices can be generated in order so they need not be subsequently
sorted. This reduces the time to compute a matrix product by about 65%.