module catN ( qbit *bit, const int n ) { H( bit[0] ); for ( int i=1; i < n; i++ ) { CNOT( bit[i-1], bit[i] ); } } module unCatN ( qbit *bit, const int n ) { for ( int i=n-1; i > 0; i-- ) { CNOT( bit[i-1], bit[i] ); } H( bit[0] ); } int main () { qbit bits[4]; catN( bits, 4 ); return 0; }