diff --git a/qbiocode/embeddings/embed.py b/qbiocode/embeddings/embed.py index 3b6b087..af306ae 100644 --- a/qbiocode/embeddings/embed.py +++ b/qbiocode/embeddings/embed.py @@ -66,7 +66,13 @@ def data_map_func(x: np.ndarray) -> float: float: the mapped value """ coeff = x[0] / 2 if len(x) == 1 else reduce(lambda m, n: (m * n) / 2, x) - return float(coeff) + try: + return float(coeff) + except TypeError: + # coeff is a symbolic ParameterExpression during circuit + # construction (unbound parameters) — return it unevaluated + # and let Qiskit bind real values later. + return coeff else: data_map_func = None