<br />

|---|
| [![](https://www.tensorflow.org/images/GitHub-Mark-32px.png) View source on GitHub](https://github.com/tensorflow/quantum/blob/v0.7.6/tensorflow_quantum/core/ops/math_ops/simulate_mps.py#L107-L152) |

Calculate the expectation value of circuits using samples.

#### View aliases


**Main aliases**

[`tfq.math.simulate_mps.mps_1d_sampled_expectation`](https://www.tensorflow.org/quantum/api_docs/python/tfq/math/mps_1d_sampled_expectation)

<br />

    tfq.math.mps_1d_sampled_expectation(
        programs, symbol_names, symbol_values, pauli_sums, num_samples, bond_dim=4
    )

Simulate the final state of `programs` given `symbol_values` are placed
inside of the symbols with the name in `symbol_names` in each circuit.
Them, sample the resulting state `num_samples` times and use these samples
to compute expectation values of the given `pauli_sums`. Note that this op
requires 1D non periodic circuits.

<br />

<br />

<br />

| ## Args ||
|---|---|
| `programs` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of strings with shape \[batch_size\] containing the string representations of the circuits to be executed. |
| `symbol_names` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of strings with shape \[n_params\], which is used to specify the order in which the values in `symbol_values` should be placed inside of the circuits in `programs`. |
| `symbol_values` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of real numbers with shape \[batch_size, n_params\] specifying parameter values to resolve into the circuits specificed by programs, following the ordering dictated by `symbol_names`. |
| `pauli_sums` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) of strings with shape \[batch_size, n_ops\] containing the string representation of the operators that will be used on all of the circuits in the expectation calculations. |
| `num_samples` | [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with `num_samples[i][j]` is equal to the number of samples to draw in each term of `pauli_sums[i][j]` when estimating the expectation. Therefore, `num_samples` must have the same shape as `pauli_sums`. |
| `bond_dim` | Integer value used for the bond dimension during simulation. |

<br />

<br />

<br />

<br />

| ## Returns ||
|---|---|
| [`tf.Tensor`](https://www.tensorflow.org/api_docs/python/tf/Tensor) with shape \[batch_size, n_ops\] that holds the expectation value for each circuit with each op applied to it (after resolving the corresponding parameters in). ||

<br />