Loading runtime/qrt/qrt.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -303,4 +303,38 @@ void reset(qreg q) { reset(q[i]); } } void cnot(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cnot(src[i], tgt[i]); } } void cy(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cy(src[i], tgt[i]); } } void cz(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cz(src[i], tgt[i]); } } void ch(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { ch(src[i], tgt[i]); } } } // namespace quantum No newline at end of file runtime/qrt/qrt.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,12 @@ void swap(const qubit &src_idx, const qubit &tgt_idx); void cphase(const qubit &src_idx, const qubit &tgt_idx, const double theta); void crz(const qubit &src_idx, const qubit &tgt_idx, const double theta); // Broadcast two registers void cnot(qreg src, qreg tgt); void cy(qreg src, qreg tgt); void cz(qreg src, qreg tgt); void ch(qreg src, qreg tgt); // exponential of i * theta * H, where H is an Observable pointer void exp(qreg q, const double theta, xacc::Observable &H); void exp(qreg q, const double theta, xacc::Observable *H); Loading Loading
runtime/qrt/qrt.cpp +34 −0 Original line number Diff line number Diff line Loading @@ -303,4 +303,38 @@ void reset(qreg q) { reset(q[i]); } } void cnot(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cnot(src[i], tgt[i]); } } void cy(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cy(src[i], tgt[i]); } } void cz(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { cz(src[i], tgt[i]); } } void ch(qreg src, qreg tgt) { assert(src.size() == tgt.size() && "2-qubit broadcast must be across registers of same size."); for (int i = 0; i < src.size(); i++) { ch(src[i], tgt[i]); } } } // namespace quantum No newline at end of file
runtime/qrt/qrt.hpp +6 −0 Original line number Diff line number Diff line Loading @@ -168,6 +168,12 @@ void swap(const qubit &src_idx, const qubit &tgt_idx); void cphase(const qubit &src_idx, const qubit &tgt_idx, const double theta); void crz(const qubit &src_idx, const qubit &tgt_idx, const double theta); // Broadcast two registers void cnot(qreg src, qreg tgt); void cy(qreg src, qreg tgt); void cz(qreg src, qreg tgt); void ch(qreg src, qreg tgt); // exponential of i * theta * H, where H is an Observable pointer void exp(qreg q, const double theta, xacc::Observable &H); void exp(qreg q, const double theta, xacc::Observable *H); Loading