singleSWAP: singleSWAP

Description Usage Arguments Value Examples

View source: R/singleSWAP.R

Description

Implements the SWAP gate between two qubits, which can be in a larger ket. If no argument is supplied, returns the matrix of the gate. If ket given as input, applies the gate to the input ket and returns the resulting ket. In its default configuration it is the same as standard SWAP.

Usage

1
singleSWAP(nQubits=2,a=0,b=1,...)

Arguments

nQubits

Number of qubits in target ket

a

Index of first qubit to swap, indexed from 0

b

Index of second qubit to swap, indexed from 0

...

No argument, or ket (column vector) that is input to the gate

Value

Matrix of the singleSWAP gate or ket after an singleSWAP gate is applied

Examples

1
2
 singleSWAP(2,0,1, ket(1,2,3,4) )
 singleSWAP(4,0,3, intket( c(1,5),4,c(1,2)) )

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