13 #ifndef QNLP_BIT_GROUP    14 #define QNLP_BIT_GROUP    24     template <
class SimulatorType>
    36         static void q_ops(SimulatorType& qSim, std::size_t qreg_idx0, std::size_t qreg_idx1, 
const std::vector<std::size_t>& qaux_idx){
    39             qSim.applyGateCCX(qreg_idx0, qaux_idx[0], qaux_idx[1]);
    40             qSim.applyGateCCX(qreg_idx1, qreg_idx0, qaux_idx[1]);
    41             qSim.applyGateCSwap(qaux_idx[1], qreg_idx0, qreg_idx1);
    44             qSim.applyGateH(qaux_idx[1]);
    45             qSim.collapseToBasisZ(qaux_idx[1], 0);
    83         static void bit_swap_pair(SimulatorType& qSim, 
const std::vector<std::size_t>& qreg_idx, 
const std::vector<std::size_t>& qaux_idx, 
bool lsb){
    84             bool isOdd = qreg_idx.size() % 2;
    85             qSim.applyGateX(qaux_idx[0]);
    87             for(std::size_t num_steps = 0; num_steps < qreg_idx.size(); num_steps++){
    88                 for(
int i = 0; i < qreg_idx.size()-1; i+=2){
    89                     if(i + 1 + isOdd < qreg_idx.size()){
    91                             q_ops(qSim,  qreg_idx[i + isOdd], qreg_idx[i + 1 + isOdd], qaux_idx);
    93                             q_ops(qSim,  qreg_idx[i + 1 + isOdd], qreg_idx[i + isOdd], qaux_idx);
    99             qSim.applyGateX(qaux_idx[0]);
   114         static void bit_group(SimulatorType& qSim, 
const std::vector<std::size_t>& qreg_idx, 
const std::vector<std::size_t>& qaux_idx, 
bool lsb=
true){
 static void bit_group(SimulatorType &qSim, const std::vector< std::size_t > &qreg_idx, const std::vector< std::size_t > &qaux_idx, bool lsb=true)
Swaps all qubits in register indices given by qreg_idx to their right-most positions....
 
Class definition for bit-wise grouping in register.
 
static void bit_swap_pair(SimulatorType &qSim, const std::vector< std::size_t > &qreg_idx, const std::vector< std::size_t > &qaux_idx, bool lsb)
Swaps all qubits in register indices given by qreg_idx to their right-most positions....
 
static void q_ops(SimulatorType &qSim, std::size_t qreg_idx0, std::size_t qreg_idx1, const std::vector< std::size_t > &qaux_idx)
Swap the qubits if qreg_idx0 is set and qreg_idx1 is not. Uses Auxiliary qubits qaux_idx which are se...