def second_order_moments(adata, adjusted=False):
if '<STR_LIT>' not in adata.uns:<EOL><INDENT>raise ValueError('<STR_LIT>')<EOL><DEDENT>connectivities = get_connectivities(adata)<EOL>s, u = csr_matrix(adata.layers['<STR_LIT>']), csr_matrix(adata.layers['<STR_LIT>'])<EOL>Mss = csr_matrix.dot(connectivities, s.multiply(s)).astype(np.float32).A<EOL>Mus = csr_matrix.dot(connectivities, s.multiply(u)).astype(np.float32).A<EOL>if adjusted:<EOL><INDENT>Mss = <NUM_LIT:2> * Mss - adata.layers['<STR_LIT>'].reshape(Mss.shape)<EOL>Mus = <NUM_LIT:2> * Mus - adata.layers['<STR_LIT>'].reshape(Mus.shape)<EOL><DEDENT>return Mss, Mus<EOL>
Computes second order moments for stochastic velocity estimation.

    Arguments
    ---------
    adata: `AnnData`
        Annotated data matrix.

    Returns
    -------
    Mss: Second order moments for spliced abundances
    Mus: Second order moments for spliced with unspliced abundances