single {QuantumOps}R Documentation

single

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

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

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

[Package QuantumOps version 3.0.1 Index]