def test_grad_exponential_squared(self):

        data = helper.load_test_npz('test_points_10_2.npz')
        X1 = data['X']
        X2 = X1.copy()
        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0,1.0]))
        if self.writeData:
            np.savez('data/test_grad_exp_cov.npz', dC=dC)
        data = helper.load_test_npz('test_grad_exp_cov.npz')
        np.testing.assert_almost_equal(dC, data['dC'])
    def test_grad_exponential_squared_fd(self):

        np.random.seed(42)
        X1 = np.random.normal(size=(10, 2))
        X2 = X1.copy()
        C0 = rs.exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))

        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))
        e = 1e-6

        X2p1 = X2.copy()
        X2p1[:, 0] += e
        C1 = rs.exponential_squared(X1, X2p1, 1.0, np.array([1.0, 1.0]))
        dC1 = (C1 - C0) / e
        np.testing.assert_array_almost_equal(dC[:, :, 0], dC1, decimal=5)

        X2p2 = X2.copy()
        X2p2[:, 1] += e
        C2 = rs.exponential_squared(X1, X2p2, 1.0, np.array([1.0, 1.0]))
        dC2 = (C2 - C0) / e
        np.testing.assert_array_almost_equal(dC[:, :, 1], dC2, decimal=5)
    def test_grad_exponential_squared_fd(self):

        np.random.seed(42)
        X1 = np.random.normal(size=(10, 2))
        X2 = X1.copy()
        C0 = rs.exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))

        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))
        e = 1e-6

        X2p1 = X2.copy()
        X2p1[:, 0] += e
        C1 = rs.exponential_squared(X1, X2p1, 1.0, np.array([1.0, 1.0]))
        dC1 = (C1 - C0) / e
        np.testing.assert_array_almost_equal(dC[:, :, 0], dC1, decimal=5)

        X2p2 = X2.copy()
        X2p2[:, 1] += e
        C2 = rs.exponential_squared(X1, X2p2, 1.0, np.array([1.0, 1.0]))
        dC2 = (C2 - C0) / e
        np.testing.assert_array_almost_equal(dC[:, :, 1], dC2, decimal=5)
    def test_grad_exponential_squared_fd(self):

        data = helper.load_test_npz('test_points_10_2.npz')
        X1 = data['X']
        X2 = X1.copy()
        C0 = rs.exponential_squared(X1, X2, 1.0, np.array([1.0,1.0]))

        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0,1.0]))
        e = 1e-6

        X2p1 = X2.copy()
        X2p1[:,0] += e
        C1 = rs.exponential_squared(X1, X2p1, 1.0, np.array([1.0,1.0]))
        dC1 = (C1 - C0)/e
        np.testing.assert_array_almost_equal(dC[:,:,0], dC1, decimal=5)

        X2p2 = X2.copy()
        X2p2[:,1] += e
        C2 = rs.exponential_squared(X1, X2p2, 1.0, np.array([1.0,1.0]))
        dC2 = (C2 - C0)/e
        np.testing.assert_array_almost_equal(dC[:,:,1], dC2, decimal=5)
    def test_grad_exponential_squared(self):

        np.random.seed(42)
        X1 = np.random.normal(size=(10, 2))
        X2 = X1.copy()
        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))
    def test_grad_exponential_squared(self):

        np.random.seed(42)
        X1 = np.random.normal(size=(10, 2))
        X2 = X1.copy()
        dC = rs.grad_exponential_squared(X1, X2, 1.0, np.array([1.0, 1.0]))