This resource function is obsolete. Use the paclet Wolfram/QuantumFramework instead.

Function Repository Resource:

QuantumTensorProduct

Source Notebook

Compute the tensor product of quantum bases, states or operators

Contributed by: Jonathan Gorard

ResourceFunction["QuantumTensorProduct"][QuantumBasis[],QuantumBasis[]]

computes the tensor product of two QuantumBasis objects.

ResourceFunction["QuantumTensorProduct"][QuantumDiscreteState[],QuantumDiscreteState[]]

computes the tensor product of two QuantumDiscreteState objects.

ResourceFunction["QuantumTensorProduct"][QuantumDiscreteOperator[],QuantumDiscreteOperator[]]

computes the tensor product of two QuantumDiscreteOperator objects.

ResourceFunction["QuantumTensorProduct"][QuantumMeasurementOperator[],QuantumMeasurementOperator[]]

computes the tensor product of two QuantumMeasurementOperator objects.

ResourceFunction["QuantumTensorProduct"][QuantumHamiltonianOperator[],QuantumHamiltonianOperator[]]

computes the tensor product of two QuantumHamiltonianOperator objects.

ResourceFunction["QuantumTensorProduct"][QuantumCircuitOperator[],QuantumCircuitOperator[]]

computes the (operator representation of the) tensor product of two QuantumCircuitOperator objects.

ResourceFunction["QuantumTensorProduct"][{ob1,ob2,}]

computes the tensor product of a list of QuantumBasis,QuantumDiscreteState,QuantumDiscreteOperator,QuantumMeasurementOperator,QuantumHamiltonianOperator or QuantumCircuitOperator objects obi.

Details

ResourceFunction["QuantumTensorProduct"] will return a QuantumBasis object if the inputs were QuantumBasis objects, a QuantumDiscreteState object if the inputs were QuantumDiscreteState objects, etc. The only exception to this rule is QuantumCircuitOperator objects, whose tensor product is always a QuantumDiscreteOperator object (i.e. ResourceFunction["QuantumTensorProduct"] always returns the operator representation of the resulting circuit).
ResourceFunction["QuantumTensorProduct"], when applied to a pair (or list) of QuantumDiscreteState, QuantumDiscreteOperator, QuantumMeasurementOperator, QuantumHamiltonianOperator or QuantumCircuitOperator objects, will compute the ResourceFunction["QuantumTensorProduct"] of their associated QuantumBasis objects implicitly.
ResourceFunction["QuantumTensorProduct"][{ob1,ob2}] is equivalent to ResourceFunction["QuantumTensorProduct"][ob1,ob2].

Examples

Basic Examples (3) 

Compute the tensor product of a single-qubit Pauli-X QuantumBasis object and a single-qubit Pauli-Z QuantumBasis object to obtain a two-qubit QuantumBasis object:

In[1]:=
basis1 = ResourceFunction["QuantumBasis"]["PauliX"];
basis1["BasisElementAssociation"]
Out[2]=
In[3]:=
basis2 = ResourceFunction["QuantumBasis"]["PauliZ"];
basis2["BasisElementAssociation"]
Out[4]=
In[5]:=
newBasis = ResourceFunction["QuantumTensorProduct"][basis1, basis2]
Out[5]=

Show the product basis:

In[6]:=
newBasis["BasisElementAssociation"]
Out[6]=

Compute the tensor product of a two-qubit Pauli-X QuantumBasis object and a three-qubit Pauli-Z QuantumBasis object to obtain a five-qubit QuantumBasis object instead:

In[7]:=
newBasis2 = ResourceFunction["QuantumTensorProduct"][
  ResourceFunction["QuantumBasis"]["PauliX", 2], ResourceFunction["QuantumBasis"]["PauliZ", 3]]
Out[7]=
In[8]:=
newBasis2["BasisElementNames"]
Out[8]=

Scope (9) 

Compute the tensor product of two pure QuantumDiscreteState objects to obtain another pure QuantumDiscreteState object:

In[9]:=
state = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction["QuantumDiscreteState"][{1 + I, 1 - I}], ResourceFunction["QuantumDiscreteState"][{1/Sqrt[2], 0, 0, 1/Sqrt[2]}]];
state["Amplitudes"]
Out[10]=

Check that this is a pure state:

In[11]:=
state["PureStateQ"]
Out[11]=

Compute the tensor product of two mixed QuantumDiscreteState objects to obtain another mixed QuantumDiscreteState object:

In[12]:=
state2 = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction[
     "QuantumDiscreteState"][{{1/4 + I, 1/2}, {1/2, 3/4 - I}}], ResourceFunction["QuantumDiscreteState"][{{1 + I, 0}, {0, I - 1}}]];
state2["Amplitudes"]
Out[13]=
In[14]:=
state2["MixedStateQ"]
Out[14]=

Compute the tensor product of a pure QuantumDiscreteState object and a mixed QuantumDiscreteState object to obtain a mixed QuantumDiscreteState object:

In[15]:=
state3 = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction[
     "QuantumDiscreteState"][{{1/4 + I, 1/2}, {1/2, 3/4 - I}}], ResourceFunction["QuantumDiscreteState"][{1, -I}]];
state3["Amplitudes"]
Out[16]=
In[17]:=
state3["MixedStateQ"]
Out[17]=

Compute the tensor product of an arity-2 QuantumDiscreteOperator object and an arity-1 QuantumDiscreteOperator object to obtain an arity-3 QuantumDiscreteOperator object:

In[18]:=
operator = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction["QuantumDiscreteOperator"]["CNOT", {1, 3}], ResourceFunction["QuantumDiscreteOperator"]["Hadamard", {2}]];
operator["MatrixRepresentation"]
Out[19]=
In[20]:=
operator["Order"]
Out[20]=

Compute the tensor product of two arity-2 projection-valued QuantumMeasurementOperator objects to obtain an arity-4 projection-valued QuantumMeasurementOperator object:

In[21]:=
measurement = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction["QuantumMeasurementOperator"][
    "ComputationalBasis", {2, 4}], ResourceFunction["QuantumMeasurementOperator"][
    "FourierBasis", {1, 3}]];
measurement["MatrixRepresentation"]
Out[22]=
In[23]:=
measurement["Order"]
Out[23]=

Compute the tensor product of two arity-1 positive operator-valued QuantumMeasurementOperator objects to obtain an arity-2 positive operator-valued QuantumMeasurementOperator object:

In[24]:=
measurement2 = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction[
     "QuantumMeasurementOperator"][{{{0, 0}, {0, 1}}, {{1, -1}, {-1, 1}}}], ResourceFunction[
     "QuantumMeasurementOperator"][{{{1, -1}, {-1, 1}}, {{0, 1}, {1, 0}}}]];
measurement2["POVMElements"]
Out[25]=
In[26]:=
measurement2["Arity"]
Out[26]=

Compute the tensor product of two arity-1 QuantumHamiltonianOperator objects to obtain an arity-2 QuantumHamiltonianOperator object:

In[27]:=
hamiltonian = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction[
     "QuantumHamiltonianOperator"][{{1 + \[FormalT]^2, 1 - \[FormalT]^2}, {1 - \[FormalT]^2, 1 + \[FormalT]^2}}], ResourceFunction["QuantumHamiltonianOperator"]["PauliX"]];
hamiltonian["Operator"]
Out[28]=
In[29]:=
hamiltonian["Arity"]
Out[29]=

Compute the tensor product of two arity-2 QuantumCircuitOperator objects to obtain an arity-4 QuantumDiscreteOperator object:

In[30]:=
circuit1 = ResourceFunction[
    "QuantumCircuitOperator"][{ResourceFunction[
      "QuantumDiscreteOperator"]["CNOT", {1, 2}], ResourceFunction["QuantumDiscreteOperator"]["Hadamard", {2}], ResourceFunction["QuantumDiscreteOperator"]["SWAP", {1, 2}]}, {1, 2}];
circuit1["Diagram"]
Out[31]=
In[32]:=
circuit2 = ResourceFunction[
    "QuantumCircuitOperator"][{ResourceFunction[
      "QuantumDiscreteOperator"]["RootNOT", {1}], ResourceFunction["QuantumDiscreteOperator"][
     "Fourier", {1, 2}]}, {3, 4}];
circuit2["Diagram"]
Out[33]=
In[34]:=
operator = ResourceFunction["QuantumTensorProduct"][circuit1, circuit2]
Out[34]=

Show the matrix representation of the resulting operator:

In[35]:=
operator["MatrixRepresentation"] // MatrixForm
Out[35]=

Compute the tensor product of a list of quantum objects:

In[36]:=
state = ResourceFunction[
   "QuantumTensorProduct"][{ResourceFunction[
      "QuantumDiscreteState"][{I, -1}], ResourceFunction["QuantumDiscreteState"][{-I, 1}], ResourceFunction[
      "QuantumDiscreteState"][{1/Sqrt[2], -1/Sqrt[2]}]}];
state["Amplitudes"]
Out[37]=

Compute the tensor product of higher-dimensional quantum objects:

In[38]:=
state = ResourceFunction["QuantumTensorProduct"][
   ResourceFunction["QuantumDiscreteState"][{1, 1 + I, 1 - I}, 3], ResourceFunction["QuantumDiscreteState"][{1/Sqrt[3], I, Sqrt[2/3] - I}, 3]];
state["Amplitudes"]
Out[39]=
In[40]:=
state["Dimensions"]
Out[40]=

When taking a tensor product of QuantumDiscreteState, QuantumDiscreteOperator, QuantumMeasurementOperator, QuantumHamiltonianOperator or QuantumCircuitOperator objects, QuantumTensorProduct will also compute the tensor product of the associated QuantumBasis objects implicitly:

In[41]:=
state1 = ResourceFunction["QuantumDiscreteState"][{1 + I, 1 - I}, ResourceFunction["QuantumBasis"]["Fourier"]];
state2 = ResourceFunction["QuantumDiscreteState"][{1/Sqrt[2], -1/Sqrt[2]}, ResourceFunction["QuantumBasis"]["PauliZ"]];
newState = ResourceFunction["QuantumTensorProduct"][state1, state2];
newState["Amplitudes"]
Out[44]=
In[45]:=
newState["Basis"]
Out[45]=

The resulting basis is equivalent to the tensor product of the two constituent bases:

In[46]:=
ResourceFunction["QuantumTensorProduct"][state1["Basis"], state2["Basis"]]
Out[46]=

Publisher

Jonathan Gorard

Version History

  • 1.0.0 – 02 June 2021

Related Resources

License Information