qiskit/circuit/instruction.py
def assemble(self):
        """Assemble a QasmQobjInstruction"""
        instruction = QasmQobjInstruction(name=self.name)
        # Evaluate parameters
        if self.params:
            params = [
                x.evalf() if hasattr(x, 'evalf') else x for x in self.params
            ]
            params = [
                sympy.matrix2numpy(x, dtype=complex) if isinstance(
                    x, sympy.Matrix) else x for x in params
            ]
            instruction.params = params
        # Add placeholder for qarg and carg params
        if self.num_qubits:
            instruction.qubits = list(range(self.num_qubits))
        if self.num_clbits:
            instruction.memory = list(range(self.num_clbits))
        # Add control parameters for assembler. This is needed to convert
        # to a qobj conditional instruction at assemble time and after
        # conversion will be deleted by the assembler.
        if self.control:
            instruction._control = self.control
        return instruction
def assemble(self):
        """Assemble a QasmQobjInstruction"""
        instruction = QasmQobjInstruction(name=self.name)
        # Evaluate parameters
        if self.params:
            params = [
                x.evalf() if hasattr(x, 'evalf') else x for x in self.params
            ]
            params = [
                sympy.matrix2numpy(x, dtype=complex) if isinstance(
                    x, sympy.Matrix) else x for x in params
            ]
            instruction.params = params
        # Add placeholder for qarg and carg params
        if self.num_qubits:
            instruction.qubits = list(range(self.num_qubits))
        if self.num_clbits:
            instruction.memory = list(range(self.num_clbits))
        # Add control parameters for assembler. This is needed to convert
        # to a qobj conditional instruction at assemble time and after
        # conversion will be deleted by the assembler.
        if self.control:
            instruction._control = self.control
        return instruction
def assemble ( self ) : instruction = QasmQobjInstruction ( name = self . name ) # Evaluate parameters if self . params : params = [ x . evalf ( ) if hasattr ( x , 'evalf' ) else x for x in self . params ] params = [ sympy . matrix2numpy ( x , dtype = complex ) if isinstance ( x , sympy . Matrix ) else x for x in params ] instruction . params = params # Add placeholder for qarg and carg params if self . num_qubits : instruction . qubits = list ( range ( self . num_qubits ) ) if self . num_clbits : instruction . memory = list ( range ( self . num_clbits ) ) # Add control parameters for assembler. This is needed to convert # to a qobj conditional instruction at assemble time and after # conversion will be deleted by the assembler. if self . control : instruction . _control = self . control return instruction
Assemble a QasmQobjInstruction
Assemble a QasmQobjInstruction