Vedral et.al. (quant-ph/9511018) propose various quantum netwerks for performing arithmetics on a quantum computer. The class EqcsVedral as shown in Listing 1 provides methods to compile gate arrays implementing such netwerks.
class EqcsVedral { public: // The not gate. class Not: public EqcsLambda { public: Not(int bit); }; // The controlled not gate. class CNot: public EqcsLambda { public: CNot(int c, int bit); }; // The controlled controlled not gate. class CCNot: public EqcsLambda { public: CCNot(int c0, int c1, int bit); }; // Elementary carry network. static void carry(EqcsGateArray &a, int b0, int b1, int b2, int b3); // Elementary carry network in reversed order. static void rcarry(EqcsGateArray &a, int b0, int b1, int b2, int b3); // Elementary sum network. static void sum(EqcsGateArray &a, int b0, int b1, int b2); // Elementary sum network in reversed order. static void rsum(EqcsGateArray &a, int b0, int b1, int b2); // Plain adder network for adding two n-bit numbers. static void plain_adder(EqcsGateArray &a, int n); // Plain adder network for adding two n-bit numbers in reversed order. static void rplain_adder(EqcsGateArray &a, int n); };
The Elementary Gates
The Carry and Sum Networks
The Plain Adder Network