set_num_sites
Method of BasisState.
set_num_sites(const integer num_sites) -> BasisState
Changes the number of sites on which the product state has support.
Changes the number of sites on which the Qbit object has support by appending qubits set in the state or by truncating the product state.
Parameters
- num_sites: The new number of sites for the basis state.
Example
Qbit("001101", 3.0 + 5.0i).set_num_sites(8) // Returns (3 + 5i)|00110100>
Qbit("001101", 3.0 + 5.0i).set_num_sites(4) // Returns (3 + 5i)|0011>