def correlator(A, B):
correlators = []<EOL>for i in range(len(A)):<EOL><INDENT>correlator_row = []<EOL>for j in range(len(B)):<EOL><INDENT>corr = <NUM_LIT:0><EOL>for k in range(len(A[i])):<EOL><INDENT>for l in range(len(B[j])):<EOL><INDENT>if k == l:<EOL><INDENT>corr += A[i][k] * B[j][l]<EOL><DEDENT>else:<EOL><INDENT>corr -= A[i][k] * B[j][l]<EOL><DEDENT><DEDENT><DEDENT>correlator_row.append(corr)<EOL><DEDENT>correlators.append(correlator_row)<EOL><DEDENT>return correlators<EOL>
Correlators between the probabilities of two parties.

    :param A: Measurements of Alice.
    :type A: list of list of
             :class:`sympy.physics.quantum.operator.HermitianOperator`.
    :param B: Measurements of Bob.
    :type B: list of list of
             :class:`sympy.physics.quantum.operator.HermitianOperator`.

    :returns: list of correlators.