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 ValidationError 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, configuration=None, provider=None):
        super().__init__(configuration=(configuration
                                        or BackendConfiguration.from_dict(
                                            self.DEFAULT_CONFIGURATION)),
                         provider=provider)

        # Define attributes inside __init__.
        self._unitary_state = None
        self._number_of_qubits = 0
Exemple #3
0
    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,
            gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')],
            coupling_map=qx4_cmap,
        )
    def __init__(self, configuration=None, provider=None):
        super().__init__(configuration=(configuration or
                                        BackendConfiguration.from_dict(self.DEFAULT_CONFIGURATION)),
                         provider=provider)

        self._local_random = random.Random()

        # Define attributes in __init__.
        self._classical_state = 0
        self._statevector = 0
        self._snapshots = {}
        self._number_of_cbits = 0
        self._number_of_qubits = 0
        self._shots = 0
        self._memory = False
        self._qobj_config = None
    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:
            config = BackendConfiguration.from_dict(raw_config)
            ret[config.backend_name] = IBMQBackend(
                configuration=config,
                provider=self._ibm_provider,
                credentials=self.credentials,
                api=self._api)

        return ret
Exemple #6
0
    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
Exemple #7
0
    def configuration(self):
        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_qx5',
            backend_version='0.0.0',
            n_qubits=16,
            basis_gates=['u1', 'u2', 'u3', 'cx', 'id'],
            simulator=False,
            local=True,
            conditional=False,
            open_pulse=False,
            gates=[GateConfig(name='TODO', parameters=[], qasm_def='TODO')],
            coupling_map=qx5_cmap,
        )
Exemple #8
0
    def __init__(self, configuration=None, provider=None):
        super().__init__(configuration=(configuration
                                        or BackendConfiguration.from_dict(
                                            self.DEFAULT_CONFIGURATION)),
                         provider=provider)

        # Try to use the default executable if not specified.
        if 'exe' in self._configuration:
            paths = [self._configuration.exe]
        else:
            paths = DEFAULT_SIMULATOR_PATHS

        # Ensure that the executable is available.
        try:
            self._configuration.exe = next(
                path for path in paths
                if (os.path.exists(path) and os.path.getsize(path) > 100))
        except StopIteration:
            raise FileNotFoundError(
                'Simulator executable not found (using %s)' %
                getattr(self._configuration, 'exe', 'default locations'))
 def __init__(self, configuration=None, provider=None):
     super().__init__(configuration=(configuration or
                                     BackendConfiguration.from_dict(self.DEFAULT_CONFIGURATION)),
                      provider=provider)