def create_corr_matrix_sinh(matrix_index, filepath, fileprefix, filesuffix,
                       complex=True, verbose=0):
    """Creates a correlation function matrix.

    Reads different correlation functions and inserts them into a matrix. The
    matrix is filled row majored, the correlation functions matrix is stored
    column majored. It is assumed that the matrix is symmetric, the off
    diagonal elements are symmetrized.

    Args:
        nbsamples: Number of bootstrap samples created.
        filepath: The path to the data, including the fileprefix.
        filestring: A list of the changing parts of the filenames. The length
                    of the list gives the size of the matrix.
        filesuffix: The suffix of the data files.
        column: The column of the input file to be read. The same column is
                read from every file!
        verbose: Changes the amount of information printed.

    Returns:
        A numpy array with four axis. The first axis is the column of operators,
        the second axis is the row of operators, the third axis is the number
        of the bootstrap sample and the last axis is the time dependence.
        The second returned argument is the time extend of the correlation
        function matrix, that is (T/2)+1, where T is the length of the original
        correlation function in time.
    """
 
    fname = "%s/%s%i%i%s" % (filepath, fileprefix, 0, 0, filesuffix)
    datashape = io.read_header(fname)
    nsample = datashape[0]
    Lt = datashape[1]
    type = datashape[2]
    if type == 1:
       data_matrix = np.zeros((nsample, Lt, len(matrix_index), len(matrix_index)), dtype="complex")
    else:
       data_matrix = np.zeros((nsample, Lt, len(matrix_index), len(matrix_index)), dtype="float")
      
    for i in range(len(matrix_index)):
        for j in range(len(matrix_index)):
          fname = "%s/%s%i%i%s" % (filepath, fileprefix, matrix_index[i], matrix_index[j], filesuffix)
          if type == 0:
             data = np.real(io.read_data_ascii(fname))
          else:
             data = io.read_data_ascii(fname)
          if data.shape[0] != nsample or data.shape[1] != Lt:
             print("incompatible correlators")
          else:
             data_matrix[:,:,i,j] = data

    corr_mat_symm = np.zeros_like(data_matrix)
    for _s in range(0, nsample):
        for _t in range(0, Lt):
            corr_mat_symm[_s, _t] = (data_matrix[_s, _t] + data_matrix[_s, _t].T) / 2.

    if not complex and type == 1:
       return np.real(corr_mat_symm)
    else:
       return corr_mat_symm
def create_corr_matrix_cosh(filename_matrix, complex=False):
    """Creates a correlation function matrix.

    Reads different correlation functions and inserts them into a matrix. The
    matrix is filled row majored, the correlation functions matrix is stored
    column majored. It is assumed that the matrix is symmetric, the off
    diagonal elements are symmetrized.

    Args:
        nbsamples: Number of bootstrap samples created.
        filepath: The path to the data, including the fileprefix.
        filestring: A list of the changing parts of the filenames. The length
                    of the list gives the size of the matrix.
        filesuffix: The suffix of the data files.

    Returns:
        A numpy array with four axis. The first axis is the column of operators,
        the second axis is the row of operators, the third axis is the number
        of the bootstrap sample and the last axis is the time dependence.
        The second returned argument is the time extend of the correlation
        function matrix, that is (T/2)+1, where T is the length of the original
        correlation function in time.
    """

    matrix_dim_col = filename_matrix.shape[0] 
    matrix_dim_row = filename_matrix.shape[1]
    if matrix_dim_col != matrix_dim_row:
       print("must be a square matrix\n")
       os.sys.exit(-1)
    print("dimension of the matrix: %i\n" % matrix_dim_col) 
    datashape = io.read_header(filename_matrix[0,0])
    nsample = datashape[0]
    Lt = datashape[1]
    type = datashape[2]
    if type == 1:
       data_matrix = np.zeros((nsample, Lt, matrix_dim_col, matrix_dim_col), dtype="complex")
    else:
       data_matrix = np.zeros((nsample, Lt, matrix_dim_col, matrix_dim_col), dtype="float")
      
    for i in range(matrix_dim_col):
        for j in range(matrix_dim_col):
          data = io.read_data_ascii(filename_matrix[i,j])
          if data.shape[0] != nsample or data.shape[1] != Lt:
             print("incompatible correlators")
             os.sys.exit(-1)
          else:
             data_sys = bootstrap.sym(data)
             data_matrix[:,:,i,j] = data_sys

    corr_mat_symm = np.zeros_like(data_matrix)
    for _s in range(0, nsample):
        for _t in range(0, Lt):
            corr_mat_symm[_s, _t] = (data_matrix[_s, _t] + data_matrix[_s, _t].T) / 2.

    if not complex and type == 1:
       return np.real(corr_mat_symm)
    else:
       return corr_mat_symm