def test_compare_S2_S3(self):
        """
        Compare the gradient of the Hamiltonian on S2 with the gradient on 
        S3.

        """


        # Pre-allocate buffer
        DH3a = np.zeros(self.phi.shape, dtype=np.complex)
        gradient_S3(DH3a, self.gamma, self.phi, self.sigma)
        DH3b = gradient_S3_pullback(self.gamma, self.phi, self.sigma)

        self.assertTrue( np.allclose(DH3a, DH3b, atol=1e-12) )
    def test_compare_S3_optimized(self):
        """
        Compare gradient implemented with finite differences with the 
        optimized cython gradient.

        """

        # Pre-allocate buffer
        DH3a = np.zeros(self.phi.shape, dtype=np.complex)

        gradient_S3(DH3a, self.gamma, self.phi, self.sigma)
        DH3b = gradient_S3_fd(self.gamma, self.phi, self.sigma)

        self.assertTrue( np.allclose(DH3a, DH3b) )