then simply say “all other values are zero.” In addition to these memorysavings, many algorithms have special ways of dealing with sparse matri‐ces that give additional computational benefits:>>>fromscipyimportsparse>>>A_sparse=sparse.random(2048,2048,0.05).tocsr()>>>A_sparse<2048x2048 sparse matrix oftype'<class 'numpy.float64'>'with209715stored elementsinCompressed Sparse Row format>>>> %timeit A_sparse*A_sparse150ms±1.71ms per loop(mean±std.dev.of7runs,10loopseach)>>>A_dense=A_sparse.todense()>>>type(A_dense)numpy.matrix>>> %timeit A_dense*A_dense571ms±14.5ms per loop(mean±std.dev.of7runs,1loop each)The simplest implementation of this is forCOOmatrices in SciPy, where