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
    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
示例#5
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
示例#6
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)