CX: CX

Description Usage Arguments Value Examples

View source: R/CX.R

Description

If no argument is supplied, returns the matrix of Controlled-X gate. If ket given as input, applies a Controlled-X gate to the input ket and returns the resulting ket

Usage

1

Arguments

...

No argument, or 4 dimensional (2 qubit) ket (column vector) that is input to the gate

Value

Matix of the Controlled-X gate or ket after a Controlled-X gate is applied

Examples

1
2
 CX(ket(1,1,1,1))
 CX()

Example output

Attaching package:QuantumOpsThe following object is masked frompackage:stats:

    dist

The following objects are masked frompackage:base:

    I, norm, single

       [,1]
[1,] 0.5+0i
[2,] 0.5+0i
[3,] 0.5+0i
[4,] 0.5+0i
     [,1] [,2] [,3] [,4]
[1,]    1    0    0    0
[2,]    0    1    0    0
[3,]    0    0    0    1
[4,]    0    0    1    0

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

Related to CX in QuantumOps...