https://github.com/epiqc/ScaffCC
Raw File
Tip revision: 4d7bfa034cfaea4e8346396c6198cdd3e271d272 authored by Andrew Litteken on 23 April 2020, 16:55:47 UTC
Version 5 Upgrade! (#40)
Tip revision: 4d7bfa0
cSWAP.scaffold
scaff_module cSWAP (
	qbit ctrl,
	qbit a,
	qbit b
) {

	CNOT(b, a);
	Toffoli(ctrl, a, b);
	CNOT(b, a);

}

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

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

}
back to top