# squeeze_operator

Source: https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/squeeze_operator

```python
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 $\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.
### 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
[Tensor](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Tensor.md#boulderopal.graph.Tensor)

### SEE ALSO
[`Graph.annihilation_operator`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/annihilation_operator.md#boulderopal.graph.Graph.annihilation_operator)
: Create an annihilation operator in the truncated Fock space.

[`Graph.coherent_state`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/coherent_state.md#boulderopal.graph.Graph.coherent_state)
: Create a coherent state (or a batch of them).

[`Graph.creation_operator`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/creation_operator.md#boulderopal.graph.Graph.creation_operator)
: Create a creation operator in the truncated Fock space.

[`Graph.displacement_operator`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/displacement_operator.md#boulderopal.graph.Graph.displacement_operator)
: Create a displacement operator (or a batch of them) in the truncated Fock space.

[`Graph.fock_state`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/fock_state.md#boulderopal.graph.Graph.fock_state)
: Create a Fock state (or a batch of them).

[`Graph.number_operator`](https://docs.q-ctrl.com/references/boulder-opal/boulderopal/graph/Graph/number_operator.md#boulderopal.graph.Graph.number_operator)
: Create a number operator in the truncated Fock space.

## Notes

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](https://en.wikipedia.org/wiki/Squeeze_operator) on Wikipedia.

## Examples

Create a squeeze operator.

```pycon
>>> 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.

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