# ms_dephasing_robust_cost

`ions.ms_dephasing_robust_cost(drives, lamb_dicke_parameters, relative_detunings, *, name=None)`

Calculate the cost for robust optimization of a Mølmer–Sørensen gate.

Add the tensor that this function returns to the infidelity of your target operation to obtain a cost that you can use to create a Mølmer–Sørensen gate that is robust against dephasing noise. You can further multiply the robust cost by a scaling factor to weigh how much importance you give to the robustness compared to the original cost.

### Parameters

**drives**(*list**[**Pwc**or**None**]*) – The piecewise-constant drives, $\{\gamma_j\}$, one for each of the $N$ ions. Drive values must be in rad/s and durations must be in seconds. All drives must have the same total duration, but can have different segmentations. If an ion is not addressed, you can pass None for its drive (this leads to a more efficient calculation than passing a zero drive).**lamb_dicke_parameters**(*np.ndarray*) – The laser-ion coupling strength, $\{\eta_{jkl}\}$. Its shape must be`(3, N, N)`

, where the dimensions indicate, respectively, axis, collective mode, and ion.**relative_detunings**(*np.ndarray*) – The difference $\{\delta_{jk} = \nu_{jk} - \delta\}$ (in Hz) between each motional mode frequency and the laser detuning from the qubit transition frequency $\omega_0$. Its shape must be`(3, N)`

, where the dimensions indicate, respectively, axis and collective mode.**name**(*str**or**None**,**optional*) – The name of the node.

### Returns

The cost term that you can use to optimize a Mølmer–Sørensen gate that is robust against dephasing noise. The cost is the sum of the square moduli of the time-averaged positions of the phase-space trajectories, weighted by the corresponding Lamb–Dicke parameters.

### Return type

Tensor(scalar, real)

### SEE ALSO

`Graph.ions.ms_infidelity`

: Final operational infidelity of a Mølmer–Sørensen gate.

`boulderopal.ions.obtain_ion_chain_properties`

: Function to calculate the properties of an ion chain.

## Notes

You can construct a Mølmer–Sørensen gate that is robust against
dephasing noise by a combination of minimizing the time-averaged
positions of the phase-space trajectories and imposing a symmetry in
each ion’s drive ^{1}.

The displacement of the $l$-th ion in the $k$-th mode of
oscillation in dimension $j$ is ^{2}

For a gate of duration $t_\text{gate}$, the time-averaged displacement is

$\langle \alpha_{jkl} \rangle = \frac{1}{t_\text{gate}} \int_0^{t_\text{gate}} \alpha_{jkl}(t) \mathrm{d} t .$This function returns the sum of the square moduli of the time-averaged
positions multiplied by the corresponding Lamb–Dicke parameters. These
parameters weight the time-averaged positions in the same way that the
$\alpha_{jkl}(t)$ are weighted in the formula for the infidelity
of a Mølmer–Sørensen gate (see `Graph.ions.ms_infidelity`

).

In other words, the robust cost that this function returns is

$C_\text{robust} = \sum_{j=1}^{3} \sum_{k=1}^{N} \sum_{l=1}^{N} \left| \eta_{jkl} \langle \alpha_{jkl} \rangle \right|^2 .$You can add this to the infidelity with the respect to the target gate to create the cost function that optimizes a gate that is also robust against dephasing. You can further multiply $C_\text{robust}$ by a scaling factor to weigh how much importance you give to robustness.

## References

## Examples

Refer to the How to optimize error-robust Mølmer–Sørensen gates for trapped ions user guide to find how to use this and related nodes.