Computes the CHSH parameter $S$ for a given two-qubit density matrix $\rho$ and measurement settings $\hat{a}_1, \hat{a}_2, \hat{b}_1, \hat{b}_2$.