intket {QuantumOps}R Documentation

intket

Description

Returns a ket (column vector) that has the encoded value of the specified integers. Implements what is commonly known as basis encoding. Does not simulate the state creation.

Usage

intket(x,n,amplitudes=rep(1,length(x)))

Arguments

x

Integer, or vector of integers, specifying the integer encoded state(s) of the ket

n

Integer specifying the number of qubits in the ket

amplitudes

Integer, or vector of integers, specifying the amplitudes for corresponding basis in x. Must be same length as x. Only relative values matter as the ket will be normalized. Default is for all states to have same amplitude.

Value

Column vector containing normalized amplitudes of a ket

Examples

 intket(0,1)
 intket(3,2)
 intket(4,3)
 intket( c(0,1), 4)
 intket( c(0,2), 4 , c(1,2) )

[Package QuantumOps version 3.0.1 Index]