https://github.com/epiqc/ScaffCC
Raw File
Tip revision: 66a79944ee4cd116b27bc1a69137276885461db8 authored by Andrew Litteken on 28 September 2021, 15:30:02 UTC
Merge pull request #49 from AndrewLitteken/master
Tip revision: 66a7994
SWAP.scaffold
scaff_module SWAP ( qbit a, qbit b ) {
    CNOT ( b, a );
    CNOT ( a, b );
    CNOT ( b, a );
}

// Scaffold doesn't allow overloading scaff_module names based on scaff_module parameter signature
// SWAPs is vector of gates on vectors of qubits
scaff_module SWAPs (
  const unsigned int width,
	qbit a[],
	qbit b[]
) {

	for (int i=0; i<width; i++) {
    CNOT(b[i], a[i]);
    CNOT(a[i], b[i]);
    CNOT(b[i], a[i]);
	}

}
back to top