squeeze_operator
Graph.squeeze_operator(zeta, dimension, offset=0, *, name=None)
Create a squeeze operator (or a batch of them).
Parameters
- zeta (number or np.ndarray) – A number that characterizes the squeeze operator. You can also pass a 1D array to generate a batch of squeeze operators.
- dimension (int) – The size of the truncated Fock space. By default, the Fock space is truncated at [0, dimension). If non-zero offset is passed, the space is then truncated at [offset, dimension + offset).
- offset (int , optional) – The lowest Fock state. Defaults to 0.
- name (str or None , optional) – The name of the node.
Returns
A tensor representing the squeeze operator. The shape is 2D if there is no batch in zeta, otherwise 3D where the first axis is the batch dimension.
Return type
SEE ALSO
Graph.annihilation_operator
: Create an annihilation operator in the truncated Fock space.
Graph.coherent_state
: Create a coherent state (or a batch of them).
Graph.creation_operator
: Create a creation operator in the truncated Fock space.
Graph.displacement_operator
: Create a displacement operator (or a batch of them) in the truncated Fock space.
Graph.fock_state
: Create a Fock state (or a batch of them).
Graph.number_operator
: Create a number operator in the truncated Fock space.
Notes
The squeeze operator is defined as:
where and are the annihilation and creation operators respectively.
For more information about the squeeze operator, see Squeeze operator on Wikipedia.
Examples
Create a squeeze operator.
>>> graph.squeeze_operator(1j, 3, name="squeeze")
<Tensor: name="squeeze", operation_name="squeeze_operator", shape=(3, 3)>
>>> result = bo.execute_graph(graph=graph, output_node_names="squeeze")
>>> result["output"]["squeeze"]["value"]
array([[0.7602446+0.j , 0. +0.j ,0. -0.64963694j],
[0. +0.j , 1. +0.j ,0. +0.j ],
[0. -0.64963694j, 0. +0.j ,0.7602446+0.j ]])
Create a batch of squeeze operators.
>>> graph.squeeze_operator([1j, 3], 3, name="squeeze_batch")
<Tensor: name="squeeze_batch", operation_name="squeeze_operator", shape=(2, 3, 3)>
>>> result = bo.execute_graph(graph=graph, output_node_names="squeeze_batch")
>>> result["output"]["squeeze_batch"]["value"]
array([[[ 0.7602446 +0.j , 0. +0.j ,0. -0.64963694j],
[ 0. +0.j , 1. +0.j ,0. +0.j ],
[ 0. -0.64963694j, 0. +0.j ,0.7602446 +0.j ]],
[[-0.19569944+0.j , 0. +0.j ,0.98066392+0.j ],
[ 0. +0.j , 1. +0.j ,0. +0.j ],
[-0.98066392-0.j , 0. -0.j ,-0.19569944-0.j ]]])