GatesExtension Toffoli Method A Sandcastle Documented Class Library

Applies Toffoli gate. If all of the control bits are enabled, the target bit gets inverted. This gate with more than two control bits is not considered elementary and is not available on all physical realizations of a quantum computer. Toffoli gate with two control bits can be represented by unitary matrix:

Namespace: Quantum.Operations
Assembly: Quantum (in Quantum.dll) Version: (

public static void Toffoli(
	this QuantumComputer comp,
	RegisterRef target,
	params RegisterRef[] controls


Type: Quantum QuantumComputer
The QuantumComputer instance.
Type: Quantum RegisterRef
The reference to target qubit.
Type:  Quantum RegisterRef 
The references to control qubits. There must be at least two control qubits.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type QuantumComputer. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
See Also