Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

After Aer .14 is released, remove approximation=true from relevant pages #1020

Merged
merged 11 commits into from
Apr 8, 2024
8 changes: 4 additions & 4 deletions docs/api/migration-guides/qiskit-algorithms-module.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -145,13 +145,13 @@ This guide describes these common configurations for algorithms that determine w
* Running an algorithm on an Aer simulator using a custom instruction. For example, using the [`qiskit.opflow`](../qiskit/0.46/opflow) legacy
[`qiskit.opflow.expectations.AerPauliExpectation`](../qiskit/0.46/qiskit.opflow.expectations.AerPauliExpectation).

- Aer Primitives with `shots=None`, `approximation=True`. See [TrotterQRTE](#trotterqrte) for examples.
- Aer Primitives with `shots=None`. See [TrotterQRTE](#trotterqrte) for examples.
abbycross marked this conversation as resolved.
Show resolved Hide resolved

```python
from qiskit_aer.primitives import Sampler, Estimator

sampler = Sampler(run_options={"approximation": True, "shots": None})
estimator = Estimator(run_options={"approximation": True, "shots": None})
sampler = Sampler(run_options={"shots": None})
estimator = Estimator(run_options={"shots": None})
abbycross marked this conversation as resolved.
Show resolved Hide resolved
```

<span id="eigen"></span>
Expand Down Expand Up @@ -706,7 +706,7 @@ time = 1
evolution_problem = TimeEvolutionProblem(operator, 1, initial_state)

# Aer simulator using custom instruction
estimator = AerEstimator(run_options={"approximation": True, "shots": None})
estimator = AerEstimator(run_options={"shots": None})
abbycross marked this conversation as resolved.
Show resolved Hide resolved

# LieTrotter with 1 rep
trotter_qrte = TrotterQRTE(estimator=estimator)
Expand Down
4 changes: 2 additions & 2 deletions docs/api/migration-guides/qiskit-opflow-module.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,7 @@ are different `Estimator` implementations, as noted [previously.](#attention_pri
| Opflow | Alternative |
| --- | --- |
| [`qiskit.opflow.expectations.ExpectationFactory`](../qiskit/0.46/qiskit.opflow.expectations.ExpectationFactory) | No direct replacement. This class was used to create instances of one of the classes listed below. |
| [`qiskit.opflow.expectations.AerPauliExpectation`](../qiskit/0.46/qiskit.opflow.expectations.AerPauliExpectation) | Use [`qiskit_aer.primitives.Estimator`](https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.primitives.Estimator.html) with `approximation=True`, and then `shots=None` as `run_options`. See example below. |
| [`qiskit.opflow.expectations.AerPauliExpectation`](../qiskit/0.46/qiskit.opflow.expectations.AerPauliExpectation) | Use [`qiskit_aer.primitives.Estimator`](https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.primitives.Estimator.html) with `shots=None` as `run_options`. See example below. |
abbycross marked this conversation as resolved.
Show resolved Hide resolved
| [`qiskit.opflow.expectations.MatrixExpectation`](../qiskit/0.46/qiskit.opflow.expectations.MatrixExpectation) | Use [`qiskit.primitives.Estimator`](../qiskit/qiskit.primitives.Estimator) primitive. If no shots are set, it performs an exact Statevector calculation. See example below. |
| [`qiskit.opflow.expectations.PauliExpectation`](../qiskit/0.46/qiskit.opflow.expectations.PauliExpectation) | Use any Estimator primitive. For [`qiskit.primitives.Estimator`](../qiskit/qiskit.primitives.Estimator), set `shots!=None` for a shotbased simulation. For [`qiskit_aer.primitives.Estimator`](https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.primitives.Estimator.html), this is the default. |

Expand Down Expand Up @@ -989,7 +989,7 @@ from qiskit.quantum_info import SparsePauliOp
from qiskit import QuantumCircuit
from qiskit_aer.primitives import Estimator

estimator = Estimator(approximation=True, run_options={"shots": None})
estimator = Estimator(run_options={"shots": None})
abbycross marked this conversation as resolved.
Show resolved Hide resolved

op = SparsePauliOp.from_list([("X", 1j)])
states_op = QuantumCircuit(1)
Expand Down
10 changes: 3 additions & 7 deletions docs/verify/simulate-with-qiskit-aer.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@
"id": "db010004-7a23-4c64-9cb3-8768f805e22a",
"metadata": {},
"source": [
"This circuit contains parameters to represent the rotation angles for $R_y$ and $R_z$ gates. When simulating this circuit, we need to specify explicit values for these parameters. In the next cell, we specify some values for these parameters and use the [Estimator](https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.primitives.Estimator.html) primitive from Qiskit Aer to compute the exact expectation value of the observable $ZZ \\cdots Z$.\n",
"\n",
"<Admonition type=\"note\">\n",
"Setting `approximation=True` when initializing the Estimator tells Qiskit Aer to approximate the effect of sampling error rather than actually perform sampling. This makes the simulation much more efficient, and also allows us to calculate the exact expectation value, free of sampling error. After Qiskit Aer 0.14, this will be the default behavior, so we won't need to specify this argument.\n",
"</Admonition>"
"This circuit contains parameters to represent the rotation angles for $R_y$ and $R_z$ gates. When simulating this circuit, we need to specify explicit values for these parameters. In the next cell, we specify some values for these parameters and use the [Estimator](https://qiskit.org/ecosystem/aer/stubs/qiskit_aer.primitives.Estimator.html) primitive from Qiskit Aer to compute the exact expectation value of the observable $ZZ \\cdots Z$."
]
},
{
Expand All @@ -74,7 +70,7 @@
"observable = SparsePauliOp(\"Z\" * n_qubits)\n",
"params = [0.1] * circuit.num_parameters\n",
"\n",
"exact_estimator = Estimator(approximation=True)\n",
"exact_estimator = Estimator()\n",
"job = exact_estimator.run(circuit, observable, params)\n",
"exact_value = job.result().values[0]\n",
"exact_value"
Expand Down Expand Up @@ -117,7 +113,7 @@
")\n",
"\n",
"noisy_estimator = Estimator(\n",
" backend_options={\"noise_model\": noise_model}, approximation=True\n",
" backend_options={\"noise_model\": noise_model}\n",
")\n",
"job = noisy_estimator.run(circuit, observable, params)\n",
"noisy_value = job.result().values[0]\n",
Expand Down
1 change: 0 additions & 1 deletion docs/verify/stabilizer-circuit-simulation.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,6 @@
"\n",
"exact_estimator = Estimator(\n",
" backend_options=dict(method=\"stabilizer\"),\n",
" approximation=True,\n",
")\n",
"job = exact_estimator.run(circuit, observable, params)\n",
"exact_value = job.result().values[0]\n",
Expand Down
Loading