Example #1
0
 def test_primitive_param_binding(self):
     """Test that assign_parameters binds parameters of both the underlying primitive and coeffs."""
     theta = ParameterVector("theta", 2)
     # only OperatorStateFn can have a primitive with a parameterized coefficient
     op = StateFn(theta[0] * X) * theta[1]
     bound = op.assign_parameters(dict(zip(theta, [0.2, 0.3])))
     self.assertEqual(bound.coeff, 0.3)
     self.assertEqual(bound.primitive.coeff, 0.2)