def _build(self):
    num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
    self.add_register(QuantumRegister(num_state_qubits, name='state'))
    num_ancillas = numpy.max([self.oracle.num_ancillas, self.zero_reflection.num_ancillas, self.state_preparation.num_ancillas])
    if (num_ancillas > 0):
        self.add_register(AncillaRegister(num_ancillas, name='ancilla'))
    self.compose(self.oracle, list(range(self.oracle.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.state_preparation.inverse(), list(range(self.state_preparation.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.zero_reflection, list(range(self.zero_reflection.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.state_preparation, list(range(self.state_preparation.num_qubits)), inplace=True)
    self.global_phase = numpy.pi
def _build(self):
    num_state_qubits = (self.oracle.num_qubits - self.oracle.num_ancillas)
    self.add_register(QuantumRegister(num_state_qubits, name='state'))
    num_ancillas = numpy.max([self.oracle.num_ancillas, self.zero_reflection.num_ancillas, self.state_preparation.num_ancillas])
    if (num_ancillas > 0):
        self.add_register(AncillaRegister(num_ancillas, name='ancilla'))
    self.compose(self.oracle, list(range(self.oracle.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.state_preparation.inverse(), list(range(self.state_preparation.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.zero_reflection, list(range(self.zero_reflection.num_qubits)), inplace=True)
    if self._insert_barriers:
        self.barrier()
    self.compose(self.state_preparation, list(range(self.state_preparation.num_qubits)), inplace=True)
    self.global_phase = numpy.pi