[-1]

        idx_dtype = get_index_dtype((self.indptr, self.indices,
                                     other.indptr, other.indices),
                                    maxval=bnnz)
        indptr = indptr.astype(idx_dtype)
        indices = np.empty(bnnz, dtype=idx_dtype)
        data = np.empty(R*C*bnnz, dtype=upcast(self.dtype,other.dtype))

        bsr_matmat_pass2(M//R, N//C, R, C, n,
                         self.indptr.astype(idx_dtype),
                         self.indices.astype(idx_dtype),
                         np.ravel(self.data),
                         other.indptr.astype(idx_dtype),
                         other.indices.astype(idx_dtype),
                         np.ravel(other.data),
                         indptr,
                         indices,
                         data)

        data = data.reshape(-1,R,C)

        # TODO eliminate zeros

        return bsr_matrix((data,indices,indptr),shape=(M,N),blocksize=(R,C))

    ######################
    # Conversion methods #
    ######################

    def tobsr(self, blocksize=None, copy=False):
        """Convert this matrix into Block Sparse Row Format.

        With copy=False, the data/indices may be shared between this
        matrix and the resultant bsr_matrix.

        If blocksize=(R, C) is provided, it will be used for determining
        block size of the bsr_matrix.
        """
        if blocksize not in [None, self.blocksize]:
            return self.tocsr().tobsr(blocksize=blocksize)
        if copy:
            return self.copy()
        else:
            return self

    def tocsr(self, copy=False):
        return self.tocoo(copy=False).tocsr(copy=copy)
        # TODO make this more efficient

    tocsr.__doc__ = spmatrix.tocsr.__doc__

    def tocsc(self, copy=False):
        return self.tocoo(copy=False).tocsc(copy=copy)

    tocsc.__doc__ = spmatrix.tocsc.__doc__

    def tocoo(self, copy=True):
        """Convert this matrix to COOrdinate format.

        When copy=False the data array will be shared between
 