(csr)
return SparseMatrix(*(shape + [smat]))
Converts a CSR representation to DOK representation
Converts a CSR representation to DOK representation
Converts a CSR representation to DOK representation
def _csrtodok(csr):
    """Converts a CSR representation to DOK representation"""
    smat = {}
    A, JA, IA, shape = csr
    for i in range(len(IA) - 1):
        indices = slice(IA[i], IA[i + 1])
        for l, m in zip(A[indices], JA[indices]):
            smat[i, m] = l
    return SparseMatrix(*(shape + [smat]))
def _csrtodok ( csr ) : smat = { } A , JA , IA , shape = csr for i in range ( len ( IA ) - 1 ) : indices = slice ( IA [ i ] , IA [ i + 1 ] ) for l , m in zip ( A [ indices ] , JA [ indices ] ) : smat [ i , m ] = l return SparseMatrix ( * ( shape + [ smat ] ) )