Graph.squeeze_operator(zeta, dimension, offset=0, *, name=None)

Create a squeeze operator (or a batch of them).

  • zeta (number or np.ndarray) – A number \(\zeta\) 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.


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


Create an annihilation operator in the truncated Fock space.


Create a coherent state (or a batch of them).


Create a creation operator in the truncated Fock space.


Create a displacement operator (or a batch of them) in the truncated Fock space.


Create a Fock state (or a batch of them).


Create a number operator in the truncated Fock space.


The squeeze operator is defined as:

\[S(\zeta) = \exp\left( \frac{\zeta^\ast \hat{a}^2 - \zeta \hat{a}^{\dagger2}}{2} \right)\]

where \(\hat{a}\) and \(\hat{a}^\dagger\) are the annihilation and creation operators respectively.

For more information about the squeeze operator, see Squeeze operator on Wikipedia.


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        ]]])