qp.one_body_block_encoding_wires¶
- one_body_block_encoding_wires(norbs, alias_sampling_nbits)[source]¶
Returns the sizes of the three wire registers required by
OneBodyBlockEncoding.OneBodyBlockEncodingacts on three disjoint registers whose sizes are fixed bynorbsandalias_sampling_nbits. Use this function to size them before allocating wires.- The registers are:
prep_wires: the PREP register whose \(|\vec 0\rangle\) block holds the encoded operator, \(2 \lceil \log_2 n_\text{orbs} \rceil + 3 \mu + 1\) wiressystem_wires: the state register \(|\psi\rangle\) the operator acts on, \(2 n_\text{orbs}\) wireswork_wires: clean work wires that start and end in \(|0\rangle\), at least \(\lceil \log_2 n_\text{orbs} \rceil\) of them
Here \(\mu\) is
alias_sampling_nbits.- Parameters:
norbs (int) – number of spatial orbitals
alias_sampling_nbits (int) – number of bits of precision used for the alias-sampling coefficients
- Returns:
the required number of wires for
prep_wiresandsystem_wires, which are exact, and the minimum number forwork_wires- Return type:
dict[str, int]
Example
>>> qp.one_body_block_encoding_wires(4, alias_sampling_nbits=2) {'prep_wires': 11, 'system_wires': 8, 'work_wires': 2}