def __init__(self): """ 0 - 1 - 2 - 3 - 4 - 5 - 6 | | | | | | 13 - 12 - 11 - 10 - 9 - 8 - 7 """ cmap = [[1, 0], [1, 2], [2, 3], [4, 3], [4, 10], [5, 4], [5, 6], [5, 9], [6, 8], [7, 8], [9, 8], [9, 10], [11, 3], [11, 10], [11, 12], [12, 2], [13, 1], [13, 12]] configuration = BackendConfiguration( backend_name='fake_melbourne', backend_version='0.0.0', n_qubits=14, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=cmap, ) super().__init__(configuration)
def __init__(self, provider: Provider = None): configuration = { 'backend_version': '0.0.0', 'url': 'http://www.qcware.com', 'backend_name': "QuasarMeasurementBackend", 'local': True, 'simulator': True, 'coupling_map': None, 'description': "Wrapper for the QuasarSimulator classical testing simulator", 'basis_gates': basis_gates(), 'memory': True, 'n_qubits': 30, 'conditional': False, 'max_shots': 100000, 'open_pulse': False, 'gates': [{ 'name': 'TODO', 'parameters': [], 'qasm_def': 'TODO' }], } super().__init__( configuration=BackendConfiguration.from_dict(configuration), provider=provider)
def _discover_remote_backends(self): """Return the remote backends available. Returns: dict[str:IBMQBackend]: a dict of the remote backend instances, keyed by backend name. """ ret = OrderedDict() configs_list = self._api.available_backends() for raw_config in configs_list: try: config = BackendConfiguration.from_dict(raw_config) ret[config.backend_name] = IBMQBackend( configuration=config, provider=self._ibm_provider, credentials=self.credentials, api=self._api) except ModelValidationError as ex: logger.warning( 'Remote backend "%s" could not be instantiated due to an ' 'invalid config: %s', raw_config.get('backend_name', raw_config.get('name', 'unknown')), ex) return ret
def __init__(self, n_qubits, coupling_map, basis_gates=None, name='AbstractBackend'): """ Args: n_qubits (int): Number of qubits. coupling_map (list): Coupling map. basis_gates (list): Basis gates. name (str): Name of backend instance. """ if basis_gates is None: basis_gates = ['u1', 'u2', 'u3', 'cx', 'id'] configuration = BackendConfiguration( backend_name=name, backend_version='0.0.0', n_qubits=n_qubits, basis_gates=basis_gates, simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=8192, gates=[GateConfig(name='None', parameters=[], qasm_def='None')], coupling_map=coupling_map) super().__init__(configuration)
def __init__(self): """ 1 / | 0 - 2 - 3 | / 4 """ cmap = [[1, 0], [2, 0], [2, 1], [3, 2], [3, 4], [4, 2]] configuration = BackendConfiguration( backend_name='fake_tenerife', backend_version='0.0.0', n_qubits=5, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=cmap, ) super().__init__(configuration)
def __init__(self, time_alive=10): """ Args: configuration (BackendConfiguration): backend configuration time_alive (int): time to wait before returning result """ cmap = [[i,j] for i in range(3) for j in range(3)] DEFAULT_BASIS_GATES = sorted([ 'p', 'rx', 'ry', 'rz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg', 'sx', 't', 'tdg', 'swap', 'cx', 'cy', 'cz', 'csx', 'cp', 'rxx', 'ryy', 'rzz', 'rzx', 'ccx', 'cswap', 'mcx', 'mcy', 'mcz', 'mcsx', 'mcphase', 'mcrx', 'mcry', 'mcrz', 'mcr', 'mcswap' ]) configuration = BackendConfiguration( backend_name='fake_backend', backend_version='0.0.0', n_qubits=4, basis_gates=DEFAULT_BASIS_GATES, simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[], coupling_map=cmap, ) super().__init__(configuration) self.time_alive = time_alive
def __init__(self, configuration=None, properties=None, defaults=None, provider=None, **backend_options): if configuration is None: configuration = BackendConfiguration.from_dict( DEFAULT_CONFIGURATION) else: configuration = copy.copy(configuration) configuration.meas_levels = self._meas_levels(configuration.meas_levels) if defaults is None: defaults = PulseDefaults(qubit_freq_est=[inf], meas_freq_est=[inf], buffer=0, cmd_def=[], pulse_library=[]) super().__init__(configuration, properties=properties, defaults=defaults, provider=provider, backend_options=backend_options) # Set up default system model subsystem_list = backend_options.get('subsystem_list', None) if backend_options.get('system_model') is None: if hasattr(configuration, 'hamiltonian'): system_model = PulseSystemModel.from_config( configuration, subsystem_list) self._set_system_model(system_model)
def __init__(self, provider): self.url = 'http://0f4aa71c.ngrok.io/cirq' configuration = { 'backend_name': 'aqt_qasm_simulator', 'backend_version': '0.0.1', 'url': self.url, 'simulator': True, 'local': False, 'coupling_map': None, 'description': 'aqt trapped ion device simulator', 'basis_gates': ['rx', 'ry', 'rxx'], 'memory': False, 'n_qubits': 5, 'conditional': False, 'max_shots': 250, 'open_pulse': False, 'gates': [{ 'name': 'TODO', 'parameters': [], 'qasm_def': 'TODO' }] } # We will explain about the provider in the next section super().__init__( configuration=BackendConfiguration.from_dict(configuration), provider=provider)
def __init__( self, configuration=None, provider=None, backend_name=None, toaster_host=None, toaster_port=None, use_cli=False, ): configuration = configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION ) # disable unroller # configuration.basis_gates=None super().__init__(configuration=configuration, provider=provider) getstates = False if ( backend_name is not None and backend_name == "statevector_simulator" ): getstates = True self._getstates = getstates self._toaster_port = ( toaster_port or ToasterBackend.DEFAULT_TOASTER_PORT ) self._toaster_host = ( toaster_host or ToasterBackend.DEFAULT_TOASTER_HOST ) self._use_cli = use_cli
def __init__(self, provider): self.url = 'https://gateway.aqt.eu/marmot/lint' configuration = { 'backend_name': 'aqt_innsbruck', 'backend_version': '0.0.1', 'url': self.url, 'simulator': False, 'local': False, 'coupling_map': None, 'description': 'aqt trapped ion device', 'basis_gates': ['rx', 'ry', 'rxx', 'ms'], 'memory': False, 'n_qubits': 4, 'conditional': False, 'max_shots': 200, 'open_pulse': False, 'gates': [{ 'name': 'TODO', 'parameters': [], 'qasm_def': 'TODO' }] } super().__init__( configuration=BackendConfiguration.from_dict(configuration), provider=provider)
def __init__(self, provider): self.url = "https://gateway.aqt.eu/marmot/sim/noise-model-1" configuration = { 'backend_name': 'aqt_qasm_simulator_noise_1', 'backend_version': '0.0.1', 'url': self.url, 'simulator': True, 'local': False, 'coupling_map': None, 'description': 'AQT trapped-ion device simulator ' 'with noise model 1', 'basis_gates': ['rx', 'ry', 'rxx'], 'memory': False, 'n_qubits': 11, 'conditional': False, 'max_shots': 200, 'open_pulse': False, 'gates': [{ 'name': 'TODO', 'parameters': [], 'qasm_def': 'TODO' }] } super().__init__( configuration=BackendConfiguration.from_dict(configuration), provider=provider)
def __init__(self): """ 1 - 2 - 3 - 4 - 5 - 6 - 7 - 8 | | | | | | | | 0 - 15 - 14 - 13 - 12 - 11 - 10 - 9 """ cmap = [[1, 0], [1, 2], [2, 3], [3, 4], [3, 14], [5, 4], [6, 5], [6, 7], [6, 11], [7, 10], [8, 7], [9, 8], [9, 10], [11, 10], [12, 5], [12, 11], [12, 13], [13, 4], [13, 14], [15, 0], [15, 2], [15, 14]] configuration = BackendConfiguration( backend_name='fake_rueschlikon', backend_version='0.0.0', n_qubits=16, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=cmap, ) super().__init__(configuration)
def __init__(self, provider): """Base class for interfacing with an IonQ backend""" config = BackendConfiguration.from_dict({ "backend_name": "ionq_simulator", "backend_version": "0.0.1", "simulator": True, "local": False, "coupling_map": None, "description": "IonQ simulator", "basis_gates": [ "x", "y", "z", "rx", "ry", "rz", "h", "not", "cnot", "cx", "s", "si", "t", "ti", "v", "vi", "xx", "yy", "zz", "swap", ], "memory": False, "n_qubits": 29, "conditional": False, "max_shots": 10000, "max_experiments": 1, "open_pulse": False, "gates": [{ "name": "TODO", "parameters": [], "qasm_def": "TODO" }], }) super().__init__(configuration=config, provider=provider)
def __init__(self, configuration=None, provider=None): configuration = configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION) super().__init__(configuration=configuration, provider=provider) self._configuration = configuration self._number_of_qubits = None self._statevector = None self._results = {} self._chop_threshold = 15 # chop to 10^-15
def __init__(self, configuration=None, provider=None): self.do_noise_1q = False self.do_noise_2q = False self.n_cpus = 1 self.noise_1q = np.zeros(16) self.noise_2q = np.zeros(256) super().__init__(configuration=(configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION)), provider=provider)
def __init__(self, configuration=None, provider=None): # purpose of defaults is to pass assemble checks self._defaults = PulseDefaults(qubit_freq_est=[inf], meas_freq_est=[inf], buffer=0, cmd_def=[], pulse_library=[]) super().__init__(self, BackendConfiguration.from_dict(self.DEFAULT_CONFIGURATION), provider=provider)
def __init__(self, configuration=None, provider=None): super().__init__(configuration=(configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION)), provider=provider) # Define attributes inside __init__. self._unitary = None self._number_of_qubits = 0 self._initial_unitary = None self._chop_threshold = 1e-15
def __init__(self, configuration=None, provider=None, lattice_name=None, as_qvm=False): configuration = configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION) super().__init__(configuration=configuration, provider=provider) self._lattice_name = lattice_name self._as_qvm = as_qvm
def __init__(self, configuration=None, provider=None): """ Args: configuration (BackendConfiguration): backend configuration provider (ProjectQProvider): parent provider Raises: ImportError: if the Project Q simulator is not available. """ super().__init__(configuration=(configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION)), provider=provider)
def test_backend_default_configuration(self): simulator = QuantumInspireBackend(Mock(), Mock()) configuration = simulator.configuration() expected_configuration = BackendConfiguration( backend_name='qi_simulator', backend_version=quantum_inspire_version, n_qubits=26, basis_gates=[ 'x', 'y', 'z', 'h', 'rx', 'ry', 'rz', 's', 'cx', 'ccx', 'u1', 'u2', 'u3', 'id', 'snapshot' ], gates=[ GateConfig(name='NotUsed', parameters=['NaN'], qasm_def='NaN') ], conditional=False, simulator=True, local=False, memory=True, open_pulse=False, max_shots=1024) self.assertDictEqual(configuration.to_dict(), expected_configuration.to_dict())
def __init__(self, provider=None): configuration = { 'backend_name': 'OSQ_ETH7_rev1', 'description': 'OpenSuperQ ETH 7 qubit chip, rev. 1, 12_15702', 'backend_version': '0.1.0', 'url': 'http://opensuperq.eu/', 'sample_name': 'QUDEV_M_12_15702', 'n_qubits': 7, 'basis_gates': ['u1', 'u2', 'u3', 'cx', 'id'], 'coupling_map': [[0, 2], [0, 3], [1, 3], [1, 4], [2, 5], [3, 5], [3, 6], [4, 6],[2, 0], [3, 0], [3, 1], [4, 1], [5, 2], [5, 3], [6, 3], [6, 4]], # Reduced qubit numbers by 1 compared to 20190823_OSQ_Waypoint1_experimental_parameters.pdf 'simulator': True, 'local': True, 'open_pulse': False, 'conditional': False, 'n_registers': 1, # Really 0, but QISKIT would not allow it, even if 'conditional' is False 'max_shots': 1_000_000, 'memory': 0, 'credits_required': False, 'gates': [ {'name':'id', 'parameters':[], 'coupling_map':[[0], [1], [2], [3], [4], [5], [6]], 'qasm_def' : 'gate id q { U(0,0,0) q; }'}, {'name':'u1', 'parameters':['lambda'], 'coupling_map':[[0], [1], [2], [3], [4], [5], [6]], 'qasm_def':'gate u1(lambda) q { U(0,0,lambda) q; }'}, {'name':'u2', 'parameters':['phi', 'lambda'], 'coupling_map':[[0], [1], [2], [3], [4], [5], [6]], 'qasm_def':'gate u2(phi,lambda) q { U(pi/2,phi,lambda) q; }'}, {'name':'u3', 'parameters':['theta', 'phi', 'lambda'], 'coupling_map':[[0], [1], [2], [3], [4], [5], [6]], 'qasm_def':'u3(theta,phi,lambda) q { U(theta,phi,lambda) q; }'}, {'name':'cx', 'parameters':[], 'coupling_map':[[0, 2], [0, 3], [1, 3], [1, 4], [2, 5], [3, 5], [3, 6], [4, 6],[2, 0], [3, 0], [3, 1], [4, 1], [5, 2], [5, 3], [6, 3], [6, 4]], 'qasm_def':'gate cx q1,q2 { CX q1,q2; }'} ] } super().__init__(configuration=BackendConfiguration.from_dict(configuration), provider=provider) self.aer_simulator = Aer.get_backend('qasm_simulator')
def __init__(self, configuration=None, provider=None): configuration = configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION) super().__init__(configuration=configuration, provider=provider) self._configuration = configuration self._number_of_qubits = None self._number_of_cbits = None self._statevector = None self._results = {} self._shots = {} self._local_random = np.random.RandomState() self._sample_measure = False self._chop_threshold = 15 # chop to 10^-15
def __init__(self): configuration = BackendConfiguration( backend_name='fake_openpulse_2q', backend_version='0.0.0', n_qubits=2, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=True, open_pulse=True, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=[[1, 0]], n_registers=2, n_uchannels=2, u_channel_lo=[[{ "q": 0, "scale": [1, 0] }], [{ "q": 0, "scale": [-1, 0] }, { "q": 1, "scale": [1, 0] }]], meas_level=[1, 2], qubit_lo_range=[[4.5, 5.5], [4.5, 5.5]], meas_lo_range=[[6.0, 7.0], [6.0, 7.0]], dt=1.3333, dtm=10.5, rep_times=[100, 250, 500, 1000], meas_map=[[0], [1, 2]], channel_bandwidth=[[-0.2, 0.4], [-0.3, 0.3], [-0.3, 0.3], [-0.02, 0.02], [-0.02, 0.02], [-0.02, 0.02]], meas_kernels=['kernel1'], discriminators=['max_1Q_fidelity'], acquisition_latency=[[100, 100], [100, 100]], conditional_latency=[[100, 1000], [1000, 100], [100, 1000], [1000, 100], [100, 1000], [1000, 100]]) self._defaults = PulseDefaults(qubit_freq_est=[4.9, 5.0], meas_freq_est=[6.5, 6.6], buffer=10, pulse_library=[], cmd_def=[]) super().__init__(configuration)
def configuration(self): qx4_cmap = [[1, 0], [2, 0], [2, 1], [3, 2], [3, 4], [4, 2]] return BackendConfiguration( backend_name='fake_qx4', backend_version='0.0.0', n_qubits=5, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=qx4_cmap, )
def __init__(self): """ 0 = 1 = 2 = 3 4 || || || || X || 5 = 6 = 7 = 8 = 9 || X || || X || 10 = 11 = 12 = 13 = 14 || || X || X || 15 = 16 = 17 18 19 """ cmap = [[0, 1], [0, 5], [1, 0], [1, 2], [1, 6], [2, 1], [2, 3], [2, 6], [3, 2], [3, 8], [3, 9], [4, 8], [4, 9], [5, 0], [5, 6], [5, 10], [5, 11], [6, 1], [6, 2], [6, 5], [6, 7], [6, 10], [6, 11], [7, 1], [7, 6], [7, 8], [7, 12], [7, 13], [8, 3], [8, 4], [8, 7], [8, 9], [8, 12], [8, 13], [9, 3], [9, 4], [9, 8], [10, 5], [10, 6], [10, 11], [10, 15], [11, 5], [11, 6], [11, 10], [11, 12], [11, 16], [11, 17], [12, 7], [12, 8], [12, 11], [12, 13], [12, 16], [13, 7], [13, 8], [13, 12], [13, 14], [13, 18], [13, 19], [14, 13], [14, 18], [14, 19], [15, 10], [15, 16], [16, 11], [16, 12], [16, 15], [16, 17], [17, 11], [17, 16], [18, 13], [18, 14], [19, 13], [19, 14]] configuration = BackendConfiguration( backend_name='fake_tokyo', backend_version='0.0.0', n_qubits=16, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=cmap, ) super().__init__(configuration)
def __init__(self, time_alive=10): configuration = BackendConfiguration( backend_name='fake_failure_qasm_simulator', backend_version='0.0.0', n_qubits=5, basis_gates=[ 'u1', 'u2', 'u3', 'cx', 'cz', 'id', 'x', 'y', 'z', 'h', 's', 'sdg', 't', 'tdg', 'ccx', 'swap', 'snapshot', 'unitary' ], simulator=True, local=True, conditional=True, open_pulse=False, memory=True, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')]) super().__init__(configuration, time_alive=time_alive)
def __init__(self, configuration=None, provider=None): super().__init__(configuration=(configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION)), provider=provider) # Define attributes in __init__. self._local_random = np.random.RandomState() self._classical_state = 0 self._statevector = 0 self._number_of_cbits = 0 self._number_of_qubits = 0 self._shots = 0 self._memory = False self._initial_statevector = self.DEFAULT_OPTIONS["initial_statevector"] self._chop_threshold = self.DEFAULT_OPTIONS["chop_threshold"] self._qobj_config = None # TEMP self._sample_measure = False
def from_name(cls, backend_name: str, provider: 'accountprovider.AccountProvider', credentials: Credentials, api: AccountClient) -> 'IBMQRetiredBackend': """Return a retired backend from its name.""" configuration = BackendConfiguration( backend_name=backend_name, backend_version='0.0.0', n_qubits=1, basis_gates=[], simulator=False, local=False, conditional=False, open_pulse=False, memory=False, max_shots=1, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=[[0, 1]], ) return cls(configuration, provider, credentials, api)
def configuration(self): """Return a make up configuration for a fake device.""" qx5_cmap = [[1, 0], [1, 2], [2, 3], [3, 4], [3, 14], [5, 4], [6, 5], [6, 7], [6, 11], [7, 10], [8, 7], [9, 8], [9, 10], [11, 10], [12, 5], [12, 11], [12, 13], [13, 4], [13, 14], [15, 0], [15, 2], [15, 14]] return BackendConfiguration( backend_name='fake', backend_version='0.0.0', n_qubits=16, basis_gates=['u1', 'u2', 'u3', 'cx', 'id'], simulator=False, local=True, conditional=False, open_pulse=False, memory=False, max_shots=65536, gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')], coupling_map=qx5_cmap, )
def __init__(self, configuration=None, provider=None, **fields): """Initialize a backend class Args: configuration (BackendConfiguration): A backend configuration object for the backend object. provider (qiskit.providers.Provider): Optionally, the provider object that this Backend comes from. fields: kwargs for the values to use to override the default options. Raises: AttributeError: if input field not a valid options .. This next bit is necessary just because autosummary generally won't summarise private methods; changing that behaviour would have annoying knock-on effects through all the rest of the documentation, so instead we just hard-code the automethod directive. In addition to the public abstract methods, subclasses should also implement the following private methods: .. automethod:: _default_options """ configuration = configuration or BackendConfiguration.from_dict( self.DEFAULT_CONFIGURATION) self._number_of_qubits = 0 self._number_of_clbits = 0 self._shots = 1 self._configuration = configuration self._options = self._default_options() self._provider = provider if fields: for field in fields: if field not in self.DEFAULT_OPTIONS: raise AttributeError( "Options field %s is not valid for this backend" % field) self._options.update_options(**fields)