ccsrc/cxx_experimental/lib/decompositions/time_evolution.cpp
// hamiltonian has more than one local operator
hamiltonian has more than one local operator
hamiltonian has more than one local operator
MQ_WITH_COMPUTE(result, circuit) {
            for (const auto& [index, action] : term) {
                qubits.push_back(targets[index]);
                if (action == 'X') {
                    circuit.apply_operator(td::Op::H(), qubits);
                } else if (action == 'Y') {
                    circuit.apply_operator(td::Op::Rx(0.5), qubits);
                }
                qubits.pop_back();
            }
            for (std::size_t i = 0; i < std::size(targets) - 1; ++i) {
                qubits.push_back(targets[i]);
                qubits.push_back(targets[i + 1]);
                circuit.apply_operator(td::Op::X(), qubits);
                qubits.pop_back();
                qubits.pop_back();
            }
        }
MQ_WITH_COMPUTE ( result , circuit ) { for ( const auto & [ index , action ] : term ) { qubits . push_back ( targets [ index ] ) ; if ( action == ' ' ) { circuit . apply_operator ( td :: Op :: H ( ) , qubits ) ; } else if ( action == ' ' ) { circuit . apply_operator ( td :: Op :: Rx ( 0.5 ) , qubits ) ; } qubits . pop_back ( ) ; } for ( std :: size_t i = 0 ; i < std :: size ( targets ) - 1 ; ++ i ) { qubits . push_back ( targets [ i ] ) ; qubits . push_back ( targets [ i + 1 ] ) ; circuit . apply_operator ( td :: Op :: X ( ) , qubits ) ; qubits . pop_back ( ) ; qubits . pop_back ( ) ; } }
hamiltonian has more than one local operator
hamiltonian has more than one local operator
// Compute parity