Skip to content
This repository was archived by the owner on Aug 21, 2023. It is now read-only.

Commit 0854ffc

Browse files
manoelmarquesjaygambetta
authored andcommitted
Fixes Aqua notebooks for upcoming Aqua 0.6 Release (#778)
* switch from BasicAer to LegacySimulators * Eliminate paulis_grouping * update the tutorial to register a component/algorithm * Fix grover input file * Change from qiskit_aqua to qiskit.aqua and from qiskit_chemistry to qiskit.chemistry * Add run_config to some notebooks * Remove LegacySimulators * Remove get_aer_backend and arr run_config * Remove get_aer_backend and add run_config * fix the format of entangler_map * Update h2_uccsd to latest chemistry/aqua * Update ExactEigensolver valid dictionaries * Shots defaults for statevector_simulator * add example: 3-Coloring oracle by reduction to SAT * minor edits * remove period * Remove RunConfig from QuantumInstance parameters * remove cnf - its str content will be used directly * Update grover.ipynb * minor edit * Change get_input_instance to get_pluggable_class * Change set_aqua_logging to set_qiskit_aqua_logging * Fixed grover input file * Add Aqua tutorial solving linear systems of equation with HHL * Fix Hamiltonian run return values * random_distributions was renamed to uncertainty_models * add arbitrary logic expr and truth table examples * LogicExpressionOracle -> LogicalExpressionOracle * moo -> moot * Tutorial for variational algo optimization callback * remove circuit_caching=False flags * minor edits * minor edit * Update for latest hhl & ExactLPsolver * Update Aqua general tutorials * Notebook was refactored/renamed * initial commit for new qiskit finance folder structure * reintroduce fidelity and probability output * added docplex.ipynb and added docplex parts into an exisitng maxcut_and_tsp.ipynb * Added header and removed error examples. Fixed the problem name * random number generator notebook * new random generator * minor improvements * Moving the drivers to tutorials * update ExactLSsolver naming * Deprecation of warnings, addition of outputs * Minor spelling and text fixups * A simple tutorial for the Qiskit Finance data loading * Updates to the random variates notebook * A bugfix * move finance tutorials to qiskit / finance and add new tutorials as well * Create execute_qgan.ipynb * Time series tutorial * Minor improvements * streamline all tutorials * notebooks qgans * update * add HHL truncate parameters * improve HHL example and clean up * update results * fix * text update * Noisy simulation with AER on Aqua * Fix Grover input file * delete files * Create qgans_for_loading_random_distributions.ipynb * Contributing the time_series, portfolio_diversification, and generating_random_variates notebooks. * update qgan tutorials * update qiskit finance index page * bug fix in amplitude estimation tutorial * update portfolio optimization and qiskit finance index * Update portfolio_optimization.ipynb * add notebook for deutsch-jozsa * add notebook for bernstein-vazirani * add notebook for simon's * add notebook for shor's * Change seed_mapper to seed_transpiler * merge PR * edit notebooks after VQC refactor * switch BasicAer -> Aer * switch back Aer -> BasicAer * minor edits on wording * Updates to chemistry notebooks * Update chemistry notebooks * more updates for vqc refactor * Update optimization notebooks * adjust tutorials index * along with qiskit-community/qiskit-aqua#496 * Added random data * Updated portfolio diversification to the current master branch * Updated generation of random variates * update qiskit tutorials and qiskit finance index * merge use of time series * rerun all notebooks with fetched terra / aqua * The vehicle routing notebook * Update portfolio_diversification.ipynb * running optimization notebooks with fetched aqua / terra * delete empty readmes * For the updated Qiskit Aqua (as of April 30th) * use data provider in portfolio optimization and rerun all notebooks with most recent aqua/terra * update qgan notebooks * Update time_series.ipynb * Mover domain folders like chemistry, ai etc out of aqua as peers * Update index to reflect chem, ai, opt folder moves * Update section numbers for Aqua domains * Re-ran notebook to remove old warning * add notebook for vqc comparing feature maps * Update the notebbooks * add finance notebooks to community section and adjust indices where necessary * update aqua community index * add qgan tutorials and update corresponding indices * Edits * split into featured, community, and qiskit tutorials * Update qGAN notebooks with a Numpy based Discriminator * Use IBMQ v2 api and QuantumInstance seed_simulator parameter * change qiskit_aqua import to qiskit.aqua * Fix picture relative path * Use Z2Symmetries static method * fix aqua how to * update usage based no aqua0.6's change * Revert "split into featured, community, and qiskit tutorials" This reverts commit 59dac5c. * sync with aqua 0.6 branch * updating references in finance tutorials
1 parent 32ed3ce commit 0854ffc

22 files changed

+546
-652
lines changed

qiskit/advanced/aqua/Aqua_how_to_build_a_pluggable_algorithm_components.ipynb

Lines changed: 14 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,7 @@
7575
"source": [
7676
"from qiskit import BasicAer\n",
7777
"import numpy as np\n",
78-
"from qiskit.aqua.operator import Operator\n",
78+
"from qiskit.aqua.operators import MatrixOperator, op_converter\n",
7979
"from qiskit.aqua import local_pluggables, PluggableType"
8080
]
8181
},
@@ -95,7 +95,7 @@
9595
"name": "stdout",
9696
"output_type": "stream",
9797
"text": [
98-
"['QAOA.Variational', 'VQC', 'VQE', 'ExactEigensolver', 'ExactLSsolver', 'SVM', 'EOH', 'QSVM', 'AmplitudeEstimation', 'BernsteinVazirani', 'DeutschJozsa', 'Grover', 'HHL', 'IQPE', 'QPE', 'Shor', 'Simon', 'EvolutionFidelity']\n"
98+
"['QAOA.Variational', 'QGAN', 'VQC', 'VQE', 'ExactEigensolver', 'ExactLSsolver', 'SVM', 'EOH', 'QSVM', 'AmplitudeEstimation', 'BernsteinVazirani', 'DeutschJozsa', 'Grover', 'HHL', 'IQPE', 'QPE', 'Shor', 'Simon', 'EOM_EE', 'EOM_VQE', 'EvolutionFidelity']\n"
9999
]
100100
}
101101
],
@@ -116,11 +116,18 @@
116116
"execution_count": 4,
117117
"metadata": {},
118118
"outputs": [
119+
{
120+
"name": "stderr",
121+
"output_type": "stream",
122+
"text": [
123+
"Convert from a MatrixOperator to a Pauli-type Operator requires exponential time. You can turn on DEBUG logging to check the progress.\n"
124+
]
125+
},
119126
{
120127
"name": "stdout",
121128
"output_type": "stream",
122129
"text": [
123-
"0.934847761060059\n"
130+
"0.9597914987731967\n"
124131
]
125132
}
126133
],
@@ -130,7 +137,7 @@
130137
"from qiskit.aqua import QuantumInstance\n",
131138
"num_qubits = 2\n",
132139
"temp = np.random.random((2 ** num_qubits, 2 ** num_qubits))\n",
133-
"qubit_op = Operator(matrix=temp + temp.T)\n",
140+
"qubit_op = op_converter.to_weighted_pauli_operator(MatrixOperator(matrix=temp + temp.T))\n",
134141
"\n",
135142
"initial_state = Zero(qubit_op.num_qubits)\n",
136143
"\n",
@@ -185,7 +192,7 @@
185192
"name": "stdout",
186193
"output_type": "stream",
187194
"text": [
188-
"0.9348477610600592\n"
195+
"0.9597914987731967\n"
189196
]
190197
}
191198
],
@@ -197,9 +204,9 @@
197204
],
198205
"metadata": {
199206
"kernelspec": {
200-
"display_name": "Python 3",
207+
"display_name": "Quantum (Dev)",
201208
"language": "python",
202-
"name": "python3"
209+
"name": "quantum-dev"
203210
},
204211
"language_info": {
205212
"codemirror_mode": {
@@ -212,35 +219,6 @@
212219
"nbconvert_exporter": "python",
213220
"pygments_lexer": "ipython3",
214221
"version": "3.7.3"
215-
},
216-
"varInspector": {
217-
"cols": {
218-
"lenName": 16,
219-
"lenType": 16,
220-
"lenVar": 40
221-
},
222-
"kernels_config": {
223-
"python": {
224-
"delete_cmd_postfix": "",
225-
"delete_cmd_prefix": "del ",
226-
"library": "var_list.py",
227-
"varRefreshCmd": "print(var_dic_list())"
228-
},
229-
"r": {
230-
"delete_cmd_postfix": ") ",
231-
"delete_cmd_prefix": "rm(",
232-
"library": "var_list.r",
233-
"varRefreshCmd": "cat(var_dic_list()) "
234-
}
235-
},
236-
"types_to_exclude": [
237-
"module",
238-
"function",
239-
"builtin_function_or_method",
240-
"instance",
241-
"_Feature"
242-
],
243-
"window_display": false
244222
}
245223
},
246224
"nbformat": 4,

qiskit/advanced/aqua/amplitude_estimation.ipynb

Lines changed: 4 additions & 4 deletions
Large diffs are not rendered by default.

qiskit/advanced/aqua/artificial_intelligence/qgans_for_loading_random_distributions.ipynb

Lines changed: 14 additions & 14 deletions
Large diffs are not rendered by default.

qiskit/advanced/aqua/artificial_intelligence/qsvm_classification.ipynb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"### [Optional] Setup token to run the experiment on a real device\n",
6767
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
6868
"\n",
69-
"Note: If you do not store your token yet, use `IBMQ.save_accounts()` to store it first."
69+
"Note: If you do not store your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
7070
]
7171
},
7272
{
@@ -76,7 +76,7 @@
7676
"outputs": [],
7777
"source": [
7878
"# from qiskit import IBMQ\n",
79-
"# IBMQ.load_accounts()"
79+
"# provider = IBMQ.load_account()"
8080
]
8181
},
8282
{
@@ -173,7 +173,7 @@
173173
"qsvm = QSVM(feature_map, training_input, test_input, datapoints[0])\n",
174174
"\n",
175175
"backend = BasicAer.get_backend('qasm_simulator')\n",
176-
"quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, seed_transpiler=seed)\n",
176+
"quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed, seed_transpiler=seed)\n",
177177
"\n",
178178
"result = qsvm.run(quantum_instance)\n",
179179
"\n",
@@ -279,7 +279,7 @@
279279
"qsvm = QSVM(feature_map, training_input, test_input)\n",
280280
"\n",
281281
"backend = BasicAer.get_backend('qasm_simulator')\n",
282-
"quantum_instance = QuantumInstance(backend, shots=1024, seed=seed, seed_transpiler=seed)\n",
282+
"quantum_instance = QuantumInstance(backend, shots=1024, seed_simulator=seed, seed_transpiler=seed)\n",
283283
"\n",
284284
"result = qsvm.run(quantum_instance)\n",
285285
"\n",

qiskit/advanced/aqua/chemistry/declarative_approach.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@
6868
"### [Optional] Setup token to run the experiment on a real device\n",
6969
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
7070
"\n",
71-
"Note: If you have not stored your token yet, use `IBMQ.save_accounts()` to store it first."
71+
"Note: If you have not stored your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
7272
]
7373
},
7474
{
@@ -78,8 +78,8 @@
7878
"outputs": [],
7979
"source": [
8080
"# from qiskit import IBMQ\n",
81-
"# IBMQ.load_accounts()\n",
82-
"# backend = IBMQ.get_backend('ibmq_16_melbourne')"
81+
"# provider = IBMQ.load_account()\n",
82+
"# backend = provider.get_backend('ibmq_16_melbourne')"
8383
]
8484
},
8585
{

qiskit/advanced/aqua/chemistry/dissociation_profile_of_molecule.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@
134134
"### [Optional] Setup token to run the experiment on a real device\n",
135135
"If you would like to run the experiement on a real device, you need to setup your account first.\n",
136136
"\n",
137-
"Note: If you do not store your token yet, use `IBMQ.save_accounts()` to store it first."
137+
"Note: If you do not store your token yet, use `IBMQ.save_account('MY_API_TOKEN')` to store it first."
138138
]
139139
},
140140
{
@@ -144,7 +144,7 @@
144144
"outputs": [],
145145
"source": [
146146
"# from qiskit import IBMQ\n",
147-
"# IBMQ.load_accounts()"
147+
"# provider = IBMQ.load_account()"
148148
]
149149
},
150150
{

0 commit comments

Comments
 (0)