def get_matrix_header(filename):
    """
    Returns the entries, rows, and cols of a matrix market file.
    """
    with open(filename) as f:
        entries = 0
        rows = 0
        cols = 0
        for line in f.readlines():
            if line.startswith('%'):
                continue
            line = line.split()
            entries = int(line[0])
            rows = int(line[1])
            cols = int(line[2])
        return entries, rows, cols