From 76ccbe71ca9ae09a843e19428de24316c817a584 Mon Sep 17 00:00:00 2001 From: yangguohao <70266361+yangguohao@users.noreply.github.com> Date: Fri, 29 Oct 2021 17:14:49 +0800 Subject: [PATCH] Update utils.py --- paddle_quantum/utils.py | 10 ---------- 1 file changed, 10 deletions(-) diff --git a/paddle_quantum/utils.py b/paddle_quantum/utils.py index 81d4767..26c289e 100644 --- a/paddle_quantum/utils.py +++ b/paddle_quantum/utils.py @@ -1310,17 +1310,7 @@ def plot_n_qubit_state_in_bloch_sphere( for i in range(state_len): assert type(state[i]) == paddle.Tensor or type(state[i]) == np.ndarray, \ 'the type of "state[i]" should be "paddle.Tensor" or "numpy.ndarray".' - - # Convert Tensor to numpy - for i in range(state_len): - if type(state[i]) == paddle.Tensor: - state[i] = state[i].numpy() - # Convert state_vector to density_matrix - for i in range(state_len): - if state[i].size == 2: - state_vector = state[i] - state[i] = np.outer(state_vector, np.conj(state_vector)) if show_qubits is None: show_qubits = [None]*state_len else: -- GitLab