tensor: tensor

Description Usage Arguments Value Examples

View source: R/tensor.R

Description

Takes all arguments and combines them as a tensor product. Can be used to create a unified vector that represents multiple qubits or to create higher dimensional gates. If the inputs are two n-dimensional kets, the output is a 2-n dimensional ket representing the combined system.

Usage

1

Arguments

...

kets (column vectosr) or gates (matrices) to take tensor product of

Value

The tensor product of all supplied arguments

Examples

1
2
3
4
 tensor(ket(1,0),ket(0,1),ket(1,0),ket(1,0))
 tensor(ket(1,1,1,1),ket(1,0,0,1))
 tensor(X(),I())
 tensor(H(),H(),H())

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+0i
 [2,] 0+0i
 [3,] 0+0i
 [4,] 0+0i
 [5,] 1+0i
 [6,] 0+0i
 [7,] 0+0i
 [8,] 0+0i
 [9,] 0+0i
[10,] 0+0i
[11,] 0+0i
[12,] 0+0i
[13,] 0+0i
[14,] 0+0i
[15,] 0+0i
[16,] 0+0i
              [,1]
 [1,] 0.3535534+0i
 [2,] 0.0000000+0i
 [3,] 0.0000000+0i
 [4,] 0.3535534+0i
 [5,] 0.3535534+0i
 [6,] 0.0000000+0i
 [7,] 0.0000000+0i
 [8,] 0.3535534+0i
 [9,] 0.3535534+0i
[10,] 0.0000000+0i
[11,] 0.0000000+0i
[12,] 0.3535534+0i
[13,] 0.3535534+0i
[14,] 0.0000000+0i
[15,] 0.0000000+0i
[16,] 0.3535534+0i
     [,1] [,2] [,3] [,4]
[1,]    0    0    1    0
[2,]    0    0    0    1
[3,]    1    0    0    0
[4,]    0    1    0    0
          [,1]       [,2]       [,3]       [,4]       [,5]       [,6]
[1,] 0.3535534  0.3535534  0.3535534  0.3535534  0.3535534  0.3535534
[2,] 0.3535534 -0.3535534  0.3535534 -0.3535534  0.3535534 -0.3535534
[3,] 0.3535534  0.3535534 -0.3535534 -0.3535534  0.3535534  0.3535534
[4,] 0.3535534 -0.3535534 -0.3535534  0.3535534  0.3535534 -0.3535534
[5,] 0.3535534  0.3535534  0.3535534  0.3535534 -0.3535534 -0.3535534
[6,] 0.3535534 -0.3535534  0.3535534 -0.3535534 -0.3535534  0.3535534
[7,] 0.3535534  0.3535534 -0.3535534 -0.3535534 -0.3535534 -0.3535534
[8,] 0.3535534 -0.3535534 -0.3535534  0.3535534 -0.3535534  0.3535534
           [,7]       [,8]
[1,]  0.3535534  0.3535534
[2,]  0.3535534 -0.3535534
[3,] -0.3535534 -0.3535534
[4,] -0.3535534  0.3535534
[5,] -0.3535534 -0.3535534
[6,] -0.3535534  0.3535534
[7,]  0.3535534  0.3535534
[8,]  0.3535534 -0.3535534

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