single: single

Description Usage Arguments Value Examples

View source: R/single.R

Description

Takes as input a gate and generates the matrix for that gate being applied to a single qubit in a ket by creating a tensor product of the matrix with Identity matrices. If a ket is supplied, the matrix will be applied to the ket

Usage

1
single(gate,n,t,...)

Arguments

gate

Single qubit gate to apply

n

Number of qubits that are in the target ket

t

Target qubit that the gate will be applied to, other qubits are unmodified. Indexed from 0.

...

Either no argument or a ket that the gate will be applied to

Value

The matrix representing the application of a single gate to one of the qubits in a ket or a ket after the gate has been applied

Examples

1
2
3
 single(H(),4,1)
 single(H(),2,1,ket(1,0,0,0))
 single(X(),2,0,ket(1,0,0,0))

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