From 907e455d46b3726053680fa565ef1e586900bf54 Mon Sep 17 00:00:00 2001 From: yangguohao <70266361+yangguohao@users.noreply.github.com> Date: Tue, 5 Oct 2021 02:08:47 +0800 Subject: [PATCH] Update circuit.py --- paddle_quantum/circuit.py | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/paddle_quantum/circuit.py b/paddle_quantum/circuit.py index 2eba39f..dc4e8b9 100644 --- a/paddle_quantum/circuit.py +++ b/paddle_quantum/circuit.py @@ -59,6 +59,15 @@ class UAnsatz: paddle.to_tensor(np.array([math.pi / 4])), paddle.to_tensor(np.array([-math.pi / 4]))] # Record history of adding gates to the circuit self.__history = [] + + def expand(self,new_n): + """ + 为原来的量子电路进行比特数扩展 + + Args: + new_n(int):扩展后的量子比特数 + """ + self.n = new_n def __add__(self, cir): r"""重载加法 ‘+’ 运算符,用于拼接两个维度相同的电路 -- GitLab