TOFFOLI: TOFFOLI

Description Usage Arguments Value Examples

View source: R/TOFFOLI.R

Description

If no argument is supplied, returns the matrix of TOFFOLI gate. If ket given as input, applies a TOFFOLI gate to the input ket and returns the resulting ket. If byCycle is TRUE, it generates the cycles which implement the TOFFOLI gate with standard gates.

Usage

1
TOFFOLI(...,byCycle=FALSE,n=3,cQubits=c(0,1),tQubit=2)

Arguments

...

No argument, or an 8 dimensional (3 qubit) ket (column vector) that is input to the gate

byCycle

Boolean specifying if the circuit should be generated. If TRUE, rather than returning a matrix or performing a TOFFOLI gate, it returns a list of cycles of standard gates which implements the TOFFOLI gate.

n

Number of qubits in the system.

cQubits

Vector of control qubit indices. Indexed from 0.

tQubit

Index of target qubit. Indexed from 0.

Value

Matix of the TOFFOLI gate or ket after a TOFFOLI gate is applied. If byCycle is TRUE, a list of cycles implementing the TOFFOLI.

Examples

1
2
 TOFFOLI(ket(1,1,1,1,0,1,0,1))
 TOFFOLI()

QuantumOps documentation built on Feb. 3, 2020, 5:07 p.m.