def test_fully_bound(self):
        """Test fully binding the circuit works."""

        circuit = RawFeatureVector(8)

        params = np.random.random(8) + 1j * np.random.random(8)
        params /= np.linalg.norm(params)

        bound = circuit.bind_parameters(params)

        ref = QuantumCircuit(3)
        ref.initialize(params, ref.qubits)

        self.assertEqual(bound.decompose(), ref)
示例#2
0
    def test_fully_bound(self):
        """Test fully binding the circuit works."""

        circuit = RawFeatureVector(8)

        params = np.random.random(8) + 1j * np.random.random(8)
        params /= np.linalg.norm(params)

        bound = circuit.bind_parameters(params)

        ref = QuantumCircuit(3)
        ref.initialize(params, ref.qubits)

        self.assertEqual(bound.decompose(), ref)

        # make sure that the bound circuit is a successful copy of the original circuit
        self.assertEqual(circuit.num_qubits, bound.num_qubits)
        self.assertEqual(circuit.feature_dimension, bound.feature_dimension)