<commit_before>"""This module implements the countmatrix estimation functionality"""

import numpy as np
import scipy.sparse

def count_matrix_mult(dtrajs, lag, sliding=True):
    r"""Generate a count matrix from a given list of discrete trajectories.

    The generated count matrix is a sparse matrix in coordinate 
    list (COO) format. 

    Parameters
    ----------
    dtraj : list of array_like
        Discretized trajectories
    lag : int
        Lagtime in trajectory steps
    sliding : bool, optional
        If true the sliding window approach 
        is used for transition counting.

    Returns
    -------
    C : scipy.sparse.coo_matrix
        The countmatrix at given lag in coordinate list format.
    
    """
    Z = scipy.sparse.coo_matrix((0,0))
    for dtraj in dtrajs:
        Zi = count_matrix(dtraj, lag, sliding)
        Z = add_coo_matrix(Z, Zi)
    return make_square_coo_matrix(Z)


def count_matrix(dtraj, lag, sliding=True):
    r"""Generate a count matrix from a given list of integers.

    The generated count matrix is a sparse matrix in coordinate 
    list (COO) format. 

    Parameters
    ----------
    dtraj : array_like
        Discretized trajectory
    lag : int
        Lagtime in trajectory steps
    sliding : bool, optional
        If true the sliding window approach 
        is used for transition counting.

    Returns
    -------
    C : scipy.sparse.coo_matrix
        The countmatrix at given lag in coordinate list format.
    
    """
    dtraj=np.asarray(dtraj)
    M=len(dtraj)<commit_msg>Fixed bug in count_matrix_mult<commit_after>"""This module implements the countmatrix estimation functionality"""

import numpy as np
import scipy.sparse

def count_matrix_mult(dtrajs, lag, sliding=True):
    r"""Generate a count matrix from a given list of discrete trajectories.

    The generated count matrix is a sparse matrix in coordinate 
    list (COO) format. 

    Parameters
    ----------
    dtraj : list of array_like
        Discretized trajectories
    lag : int
        Lagtime in trajectory steps
    sliding : bool, optional
        If true the sliding window approach 
        is used for transition counting.

    Returns
    -------
    C : scipy.sparse.coo_matrix
        The countmatrix at given lag in coordinate list format.
    
    """
    Z = scipy.sparse.coo_matrix((1,1))
    for dtraj in dtrajs:
        Zi = count_matrix(dtraj, lag, sliding)
        Z = add_coo_matrix(Z, Zi)
    return make_square_coo_matrix(Z)


def count_matrix(dtraj, lag, sliding=True):
    r"""Generate a count matrix from a given list of integers.

    The generated count matrix is a sparse matrix in coordinate 
    list (COO) format. 

    Parameters
    ----------
    dtraj : array_like
        Discretized trajectory
    lag : int
        Lagtime in trajectory steps
    sliding : bool, optional
        If true the sliding window approach 
        is used for transition counting.

    Returns
    -------
    C : scipy.sparse.coo_matrix
        The countmatrix at given lag in coordinate list format.
    
    """
    dtraj=np.asarray(dtraj)
    M=len(dtraj)
{'fraction_non_alphanumeric': 0.07729160012775471, 'fraction_numerical': 0.0012775471095496647, 'mean_word_length': 2.353319057815846, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2968552', 'n_tokens_mistral': 926, 'n_tokens_neox': 868, 'n_words': 324}