kronecker_product_list

Graph.kronecker_product_list(operators, *, name=None)

Calculate the Kronecker product between a list of operators.

Parameters

  • operators (list [Tensor or np.ndarray ]) – The list of operators. It must contain at least one operator. The operators must be at least 2D and can contain leading batch dimensions.
  • name (str or None , optional) – The name of the node.

Returns

The Kronecker product of the list of operators. The Hilbert space of the output is equal to the tensor product of the Hilbert spaces of all the given operators.

Return type

Tensor

SEE ALSO

Graph.embed_operators : Embed operators into a larger Hilbert space.

Graph.kron : Kronecker product between two objects.

Graph.pauli_kronecker_product : Embed Pauli matrices into a larger Hilbert space.

Examples

>>> number_op = graph.number_operator(3)
>>> sigma_x = graph.pauli_matrix("X")
>>> graph.kronecker_product_list([number_op, sigma_x], name="N0X1")
<Tensor: name="N0X1", operation_name="kronecker_product_list", shape=(6, 6)>
>>> result = bo.execute_graph(graph=graph, output_node_names="N0X1")
>>> result["output"]["N0X1"]["value"]
array([[0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 1.+0.j, 0.+0.j, 0.+0.j, 0.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 2.+0.j],
       [0.+0.j, 0.+0.j, 0.+0.j, 0.+0.j, 2.+0.j, 0.+0.j]])

Was this useful?