Skip to content

Commit

Permalink
removed all and
Browse files Browse the repository at this point in the history
  • Loading branch information
Adam Gitter authored and Adamg-classiq committed Mar 2, 2025
1 parent d8c31ef commit 69489fb
Showing 1 changed file with 22 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -899,7 +899,7 @@
"constraints = Constraints(max_width=num_qubits)\n",
"qmod = set_constraints(qmod, constraints)\n",
"qmod = set_preferences(qmod, preferences)\n",
"qprog = await synthesize_async(qmod)"
"qprog = synthesize(qmod)"
]
},
{
Expand All @@ -921,7 +921,7 @@
},
"outputs": [],
"source": [
"res_proposed = await execute_async(qprog)"
"res_proposed = execute(qprog)"
]
},
{
Expand Down Expand Up @@ -958,7 +958,7 @@
"source": [
"# Collected job data by id\n",
"print(\"Job ID:\", res_proposed.id)\n",
"restored_job_proposed = await ExecutionJob.from_id_async(res_proposed.id)\n",
"restored_job_proposed = ExecutionJob.from_id(res_proposed.id)\n",
"print(restored_job_proposed.status)"
]
},
Expand All @@ -981,7 +981,7 @@
},
"outputs": [],
"source": [
"result_proposed = await restored_job_proposed.result_async()"
"result_proposed = restored_job_proposed.result()"
]
},
{
Expand Down Expand Up @@ -1294,7 +1294,7 @@
"constraints = Constraints(max_width=num_qubits) #, optimization_parameter=OptimizationParameter.WIDTH\n",
"qmod = set_constraints(qmod, constraints)\n",
"qmod = set_preferences(qmod, preferences)\n",
"qprog = await synthesize_async(qmod)"
"qprog = synthesize(qmod)"
]
},
{
Expand All @@ -1306,7 +1306,7 @@
},
"outputs": [],
"source": [
"res_trotter = await execute_async(qprog)"
"res_trotter = execute(qprog)"
]
},
{
Expand Down Expand Up @@ -1343,7 +1343,7 @@
"source": [
"# Collected job data by id\n",
"print(\"Job ID:\", res_trotter.id)\n",
"restored_job_trotter = await ExecutionJob.from_id_async(res_trotter.id)\n",
"restored_job_trotter = ExecutionJob.from_id(res_trotter.id)\n",
"print(restored_job_trotter.status)"
]
},
Expand All @@ -1366,7 +1366,7 @@
},
"outputs": [],
"source": [
"result_trotter = await res_trotter.result_async()"
"result_trotter = res_trotter.result()"
]
},
{
Expand Down Expand Up @@ -1713,7 +1713,7 @@
"constraints = Constraints(max_width=num_qubits)\n",
"qmod = set_constraints(qmod, constraints)\n",
"qmod = set_preferences(qmod, preferences)\n",
"qprog = await synthesize_async(qmod)\n",
"qprog = synthesize(qmod)\n",
"# show(qprog)"
]
},
Expand All @@ -1726,7 +1726,7 @@
},
"outputs": [],
"source": [
"res_proposed_custom = await execute_async(qprog)"
"res_proposed_custom = execute(qprog)"
]
},
{
Expand Down Expand Up @@ -1763,7 +1763,7 @@
"source": [
"# Collected job data by id\n",
"print(\"Job ID:\", res_proposed_custom.id)\n",
"restored_job_proposed_custom = await ExecutionJob.from_id_async(res_proposed_custom.id)\n",
"restored_job_proposed_custom = ExecutionJob.from_id(res_proposed_custom.id)\n",
"print(restored_job_proposed_custom.status)"
]
},
Expand All @@ -1786,7 +1786,7 @@
},
"outputs": [],
"source": [
"result_proposed_custom = await res_proposed_custom.result_async()"
"result_proposed_custom = res_proposed_custom.result()"
]
},
{
Expand Down Expand Up @@ -2083,12 +2083,12 @@
" return main\n",
"\n",
"# Function to synthesize circuit and collect CX count and depth\n",
"async def synthesize_and_collect(main, num_qubits):\n",
"def synthesize_and_collect(main, num_qubits):\n",
" # Define and synthesize model\n",
" qmod = create_model(main, execution_preferences=ExecutionPreferences(num_shots=1, backend_preferences=backend_preferences))\n",
" qmod = set_constraints(qmod, Constraints(max_width=num_qubits))\n",
" qmod = set_preferences(qmod, preferences)\n",
" qprog = await synthesize_async(qmod)\n",
" qprog = synthesize(qmod)\n",
"\n",
" # Extract CX count and depth from synthesized circuit\n",
" circuit = QuantumProgram.from_qprog(qprog)\n",
Expand Down Expand Up @@ -2155,20 +2155,20 @@
" main = v_operator(num_qubits, steps)\n",
"\n",
" # Collect data for V-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_proposed.append(cx_count)\n",
"\n",
" main = v_operator_custom(num_qubits, steps)\n",
"\n",
" # Collect data for V-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_proposed_custom.append(cx_count)\n",
"\n",
" # Define Suzuki-Trotter quantum function\n",
" main = suzuki_trotter_step(num_qubits, steps)\n",
"\n",
" # Collect data for Trotter-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_trotter.append(cx_count)\n",
"\n",
"qubits_analysis_results= {\n",
Expand Down Expand Up @@ -2388,20 +2388,20 @@
" main = v_operator(num_qubits, steps)\n",
"\n",
" # Collect data for V-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_proposed.append(cx_count)\n",
"\n",
" main = v_operator_custom(num_qubits, steps)\n",
"\n",
" # Collect data for V-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_proposed_custom.append(cx_count)\n",
"\n",
" # Define Suzuki-Trotter quantum function\n",
" main = suzuki_trotter_step(num_qubits, steps)\n",
"\n",
" # Collect data for Trotter-circuit\n",
" cx_count = await synthesize_and_collect(main, num_qubits)\n",
" cx_count = synthesize_and_collect(main, num_qubits)\n",
" cx_counts_trotter.append(cx_count)\n",
"\n",
"step_analysis_results = {\n",
Expand Down Expand Up @@ -2479,7 +2479,7 @@
"provenance": []
},
"kernelspec": {
"display_name": "Python 3",
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
Expand All @@ -2493,7 +2493,7 @@
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.10.1"
"version": "3.11.7"
}
},
"nbformat": 4,
Expand Down

0 comments on commit 69489fb

Please sign in to comment.