Prepare the index-th SIC basis state.
764924
def _one_q_sic_prep(index, qubit):
    """"""
    if index == 0:
        return Program()

    theta = 2 * np.arccos(1 / np.sqrt(3))
    zx_plane_rotation = Program([
        RX(-pi / 2, qubit),
        RZ(theta - pi, qubit),
        RX(-pi / 2, qubit),
    ])

    if index == 1:
        return zx_plane_rotation

    elif index == 2:
        return zx_plane_rotation + RZ(-2 * pi / 3, qubit)

    elif index == 3:
        return zx_plane_rotation + RZ(2 * pi / 3, qubit)

    raise ValueError(f'Bad SIC index: {index}')
691234
def set_initial_state(self, initial_state, initial_frames):
    """"""
    self._initial_state = initial_state
    self._initial_frames = initial_frames[:, -1, ...]
    self._should_preprocess_on_reset = False
379137
protected function prepareInit()
    {
        $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_TIMESTAMP_FORMAT = 'YYYY-MM-DD HH24:MI:SS'");
        oci_execute($stid);
        oci_free_statement($stid);

        $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_SORT = BINARY_CI");
        oci_execute($stid);
        oci_free_statement($stid);

        $stid = oci_parse($this->raw, "ALTER SESSION SET NLS_COMP = LINGUISTIC");
        oci_execute($stid);
        oci_free_statement($stid);
    }
311102
def set_base_initial_condition(model, monomer, value):
    """"""
    # Build up monomer pattern dict
    sites_dict = {}
    for site in monomer.sites:
        if site in monomer.site_states:
            if site == 'loc' and 'cytoplasm' in monomer.site_states['loc']:
                sites_dict['loc'] = 'cytoplasm'
            else:
                sites_dict[site] = monomer.site_states[site][0]
        else:
            sites_dict[site] = None
    mp = monomer(**sites_dict)
    pname = monomer.name + '_0'
    try:
        p = model.parameters[pname]
        p.value = value
    except KeyError:
        p = Parameter(pname, value)
        model.add_component(p)
        model.initial(mp, p)
1147570
def _init_refl3x(self, projectables):
        """"""
        if not Calculator:
            LOG.info("Couldn't load pyspectral")
            raise ImportError("No module named pyspectral.near_infrared_reflectance")
        _nir, _tb11 = projectables
        self._refl3x = Calculator(_nir.attrs['platform_name'], _nir.attrs['sensor'], _nir.attrs['name'])
101941
def run(self, ket: State) -> State:
        """"""
        qubits = self.qubits
        indices = [ket.qubits.index(q) for q in qubits]
        tensor = bk.tensormul(self.tensor, ket.tensor, indices)
        return State(tensor, ket.qubits, ket.memory)
242057
private void prepareFFTTables()
	{
		int n2 = ss2;
		int nu1 = nu-1;
		int k = 0;
		int x = 0;
		for (int l=1; l<=nu; l++)
		{
			while (k < ss)
			{
				for (int i=1; i<=n2; i++)
				{
					double p = (double)bitrev(k >> nu1, nu);
					double arg = (Math.PI * p * 2.0D) / (double) ss;
					fftSin[x] = (long) (Math.sin(arg) * FRAC_FAC);
					fftCos[x] = (long) (Math.cos(arg) * FRAC_FAC);
					k++;
					x++;
				}

				k += n2;
			}
			k = 0;
			nu1--;
			n2 >>= 1;
		}

		for (k=0; k<ss; k++)
			fftBr[k] = bitrev(k, nu);
	}
99541
def create(self):
        """"""
        body = dict()
        if self.mapping is not None:
            body['mappings'] = self.mapping
        if self.settings is not None:
            body['settings'] = self.settings
        else:
            body['settings'] = self._default_settings()
        self.instance.indices.create(self.index, body)
418829
def set_states(self, states):
        """"""
        states = pickle.loads(states)
        if isinstance(states, tuple) and len(states) == 2:
            self.states, self.optimizer = states
        else:
            self.states = states
        self.states_synced = dict.fromkeys(self.states.keys(), False)
1241877
def update(self, Pi, Tij):
         """
        from msmtools import analysis as msmana

        # update transition matrix by copy
        self._Tij = np.array(Tij)
        assert msmana.is_transition_matrix(self._Tij), 'Given transition matrix is not a stochastic matrix'
        assert self._Tij.shape[0] == self._nstates, 'Given transition matrix has unexpected number of states '
        # reset spectral decomposition
        self._spectral_decomp_available = False

        # check initial distribution
        assert np.all(Pi >= 0), 'Given initial distribution contains negative elements.'
        assert np.any(Pi > 0), 'Given initial distribution is zero'
        self._Pi = np.array(Pi) / np.sum(Pi)
392280
def prepare(self):
        '''
        
        '''
        super(Master, self).prepare()

        try:
            if self.config['verify_env']:
                v_dirs = [
                        self.config['pki_dir'],
                        os.path.join(self.config['pki_dir'], 'minions'),
                        os.path.join(self.config['pki_dir'], 'minions_pre'),
                        os.path.join(self.config['pki_dir'], 'minions_denied'),
                        os.path.join(self.config['pki_dir'],
                                     'minions_autosign'),
                        os.path.join(self.config['pki_dir'],
                                     'minions_rejected'),
                        self.config['cachedir'],
                        os.path.join(self.config['cachedir'], 'jobs'),
                        os.path.join(self.config['cachedir'], 'proc'),
                        self.config['sock_dir'],
                        self.config['token_dir'],
                        self.config['syndic_dir'],
                        self.config['sqlite_queue_dir'],
                    ]
                verify_env(
                    v_dirs,
                    self.config['user'],
                    permissive=self.config['permissive_pki_access'],
                    root_dir=self.config['root_dir'],
                    pki_dir=self.config['pki_dir'],
                )
                # Clear out syndics from cachedir
                for syndic_file in os.listdir(self.config['syndic_dir']):
                    os.remove(os.path.join(self.config['syndic_dir'], syndic_file))
        except OSError as error:
            self.environment_failure(error)

        self.setup_logfile_logger()
        verify_log(self.config)
        self.action_log_info('Setting up')

        # TODO: AIO core is separate from transport
        if not verify_socket(self.config['interface'],
                             self.config['publish_port'],
                             self.config['ret_port']):
            self.shutdown(4, 'The ports are not available to bind')
        self.config['interface'] = ip_bracket(self.config['interface'])
        migrations.migrate_paths(self.config)

        # Late import so logging works correctly
        import salt.master
        self.master = salt.master.Master(self.config)

        self.daemonize_if_required()
        self.set_pidfile()
        salt.utils.process.notify_systemd()
226024
def session_preparation(self):
        """"""
        self._test_channel_read(pattern=r"[>#]")
        self.ansi_escape_codes = True
        self.set_base_prompt()
        self.disable_paging()
        # Clear the read buffer
        time.sleep(0.3 * self.global_delay_factor)
        self.clear_buffer()
463867
def init_state(self):
		'''  '''
		self.in_warc_response = False
		self.in_http_response = False
		self.in_payload = False
416916
def create_index(self, index=None, settings=None, es=None):
        """"""
        if index is None:
            index = self.index
        if es is None:
            es = self.es
        try:
            alias = index
            index = generate_index_name(alias)

            args = {'index': index}
            if settings:
                args['body'] = settings

            es.indices.create(**args)
            es.indices.put_alias(index, alias)
            logger.info('created index alias=%s index=%s' % (alias, index))
        except elasticsearch.TransportError:  # index exists
            pass
892471
def fromdict(dict):
        
        index = dict['index']
        seed = hb_decode(dict['seed'])
        n = dict['n']
        root = hb_decode(dict['root'])
        hmac = hb_decode(dict['hmac'])
        timestamp = dict['timestamp']
        self = State(index, seed, n, root, hmac, timestamp)
        return self
1265365
def from_indigo(idgmol, assign_descriptor=True):
    """"""
    mol = Compound()
    for atom in idgmol.iterateAtoms():
        key = atom.index()
        a = Atom(atom.symbol())
        a.coords = list(atom.xyz())
        mol.add_atom(key, a)
    for bond in idgmol.iterateBonds():
        u = bond.source()
        v = bond.destination()
        b = Bond()
        b.order = int(bond.bondOrder())
        mol.add_bond(u.index(), v.index(), b)
    if assign_descriptor:
        molutil.assign_descriptors(mol)
    return mol
119619
def state(self):
        '''

        '''
        return dict(a=self.a.tolist(), b=self.b.tolist(), c=self.c.tolist(),
                    pivot=self.pivot.tolist(), position=self.position.tolist())