Skip to content

Commit c0d3515

Browse files
authored
Merge branch 'main' into main
2 parents 0628d1d + c3d2eff commit c0d3515

File tree

71 files changed

+1947
-883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1947
-883
lines changed

.github/workflows/config/spelling_allowlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,7 @@ nullary
276276
observables
277277
optimizer
278278
optimizers
279+
pagerank
279280
parallelization
280281
parallelize
281282
parallelizing

.github/workflows/integration_tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -835,10 +835,9 @@ jobs:
835835
836836
# Test all remote-sim tests
837837
for filename in `find targettests/Remote-Sim -name '*.cpp'`; do
838-
# unsupport_args and compile_errors are compile error tests
839-
# nested_vectors: Compiler fails to synthesize nested vector parameters (https://github.com/NVIDIA/cuda-quantum/issues/2001)
838+
# unsupport_args is compile error test
840839
# qvector_init_from_state, qvector_init_from_state_lazy, test_trotter: New argument synthesis is not executed for nvqc (https://github.com/NVIDIA/cuda-quantum/issues/2146)
841-
if [[ "$filename" != *"unsupport_args"* ]] && [[ "$filename" != *"compile_errors"* ]] && [[ "$filename" != *"nested_vectors"* ]] && [[ "$filename" != *"qvector_init_from_state"* ]] && [[ "$filename" != *"qvector_init_from_state_lazy"* ]] && [[ "$filename" != *"test_trotter"* ]]; then
840+
if [[ "$filename" != *"unsupport_args"* ]] && [[ "$filename" != *"qvector_init_from_state"* ]] && [[ "$filename" != *"qvector_init_from_state_lazy"* ]] && [[ "$filename" != *"test_trotter"* ]]; then
842841
echo "$filename"
843842
nvqc_config=""
844843
# Look for a --remote-mqpu-auto-launch to determine the number of QPUs

.github/workflows/nvqc_regression_tests.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -131,14 +131,13 @@ jobs:
131131
132132
# Test all remote-sim tests
133133
for filename in `find targettests/Remote-Sim -name '*.cpp'`; do
134-
# unsupport_args and compile_errors are compile error tests
134+
# unsupport_args is compile error test
135135
# pauli_word: https://github.com/NVIDIA/cuda-quantum/issues/1957
136-
# nested_vectors: related to vector of pauli_words (https://github.com/NVIDIA/cuda-quantum/issues/1957)
137136
# custom_operation: https://github.com/NVIDIA/cuda-quantum/issues/1985
138137
# return_values: only supported in 0.8 NVQC service.
139138
# qvector_init_from_vector: only supported in 0.8 NVQC service.
140139
# qvector_init_from_state, qvector_init_from_state_lazy, test_trotter: not supported yet on nvqc: https://github.com/NVIDIA/cuda-quantum/issues/2146
141-
if [[ "$filename" != *"unsupport_args"* ]] && [[ "$filename" != *"state_overlap"* ]] && [[ "$filename" != *"compile_errors"* ]] && [[ "$filename" != *"nested_vectors"* ]] && [[ "$filename" != *"pauli_word"* ]] && [[ "$filename" != *"custom_operation"* ]] && [[ "$filename" != *"return_values"* ]] && [[ "$filename" != *"qvector_init_from_state"* ]] && [[ "$filename" != *"qvector_init_from_state_lazy"* ]] && [[ "$filename" != *"qvector_init_from_vector"* ]] && [[ "$filename" != *"test_trotter"* ]]; then
140+
if [[ "$filename" != *"unsupport_args"* ]] && [[ "$filename" != *"state_overlap"* ]] && [[ "$filename" != *"pauli_word"* ]] && [[ "$filename" != *"custom_operation"* ]] && [[ "$filename" != *"return_values"* ]] && [[ "$filename" != *"qvector_init_from_state"* ]] && [[ "$filename" != *"qvector_init_from_state_lazy"* ]] && [[ "$filename" != *"qvector_init_from_vector"* ]] && [[ "$filename" != *"test_trotter"* ]]; then
142141
echo "$filename"
143142
nvqc_config=""
144143
# Look for a --remote-mqpu-auto-launch to determine the number of QPUs
Loading

docs/sphinx/applications/python/adapt_qaoa.ipynb

Lines changed: 27 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 13,
39+
"execution_count": 1,
4040
"metadata": {},
4141
"outputs": [],
4242
"source": [
4343
"import numpy as np\n",
4444
"import cudaq\n",
45+
"from cudaq import spin\n",
4546
"from scipy.optimize import minimize\n",
4647
"import random\n",
4748
"\n",
@@ -59,7 +60,7 @@
5960
},
6061
{
6162
"cell_type": "code",
62-
"execution_count": 14,
63+
"execution_count": 12,
6364
"metadata": {},
6465
"outputs": [],
6566
"source": [
@@ -102,7 +103,7 @@
102103
},
103104
{
104105
"cell_type": "code",
105-
"execution_count": 15,
106+
"execution_count": 13,
106107
"metadata": {},
107108
"outputs": [],
108109
"source": [
@@ -157,16 +158,16 @@
157158
},
158159
{
159160
"cell_type": "code",
160-
"execution_count": 16,
161+
"execution_count": 14,
161162
"metadata": {},
162163
"outputs": [],
163164
"source": [
164165
"def qaoa_mixer(n):\n",
165166
"\n",
166-
" term = cudaq.spin.x(0)\n",
167+
" term = spin.x(0)\n",
167168
"\n",
168169
" for i in range(1, n):\n",
169-
" term = term + cudaq.spin.x(i)\n",
170+
" term = term + spin.x(i)\n",
170171
"\n",
171172
" pool = [term]\n",
172173
" return pool\n",
@@ -176,7 +177,7 @@
176177
" pool = []\n",
177178
"\n",
178179
" for i in range(n):\n",
179-
" pool.append(cudaq.spin.x(i))\n",
180+
" pool.append(cudaq.SpinOperator(spin.x(i)))\n",
180181
"\n",
181182
" return pool\n",
182183
"\n",
@@ -186,10 +187,10 @@
186187
"\n",
187188
" for i in range(n-1):\n",
188189
" for j in range(i+1, n):\n",
189-
" pool.append(cudaq.spin.x(i) * cudaq.spin.x(j))\n",
190-
" pool.append(cudaq.spin.y(i) * cudaq.spin.y(j))\n",
191-
" pool.append(cudaq.spin.y(i) * cudaq.spin.z(j))\n",
192-
" pool.append(cudaq.spin.z(i) * cudaq.spin.y(j))\n",
190+
" pool.append(cudaq.SpinOperator(spin.x(i)) * cudaq.SpinOperator(spin.x(j)))\n",
191+
" pool.append(cudaq.SpinOperator(spin.y(i)) * cudaq.SpinOperator(spin.y(j)))\n",
192+
" pool.append(cudaq.SpinOperator(spin.y(i)) * cudaq.SpinOperator(spin.z(j)))\n",
193+
" pool.append(cudaq.SpinOperator(spin.z(i)) * cudaq.SpinOperator(spin.y(j)))\n",
193194
"\n",
194195
" return pool\n",
195196
"\n",
@@ -203,7 +204,7 @@
203204
},
204205
{
205206
"cell_type": "code",
206-
"execution_count": 17,
207+
"execution_count": 15,
207208
"metadata": {},
208209
"outputs": [
209210
{
@@ -230,7 +231,7 @@
230231
},
231232
{
232233
"cell_type": "code",
233-
"execution_count": 18,
234+
"execution_count": 16,
234235
"metadata": {},
235236
"outputs": [],
236237
"source": [
@@ -251,7 +252,7 @@
251252
},
252253
{
253254
"cell_type": "code",
254-
"execution_count": 19,
255+
"execution_count": 17,
255256
"metadata": {},
256257
"outputs": [],
257258
"source": [
@@ -308,7 +309,7 @@
308309
},
309310
{
310311
"cell_type": "code",
311-
"execution_count": 20,
312+
"execution_count": 18,
312313
"metadata": {},
313314
"outputs": [
314315
{
@@ -423,7 +424,12 @@
423424
" layer.append(1) \n",
424425
" random_mixer = random.choice(temp_pool)\n",
425426
" \n",
426-
" mixer_pool = mixer_pool + [random_mixer.get_pauli_word(qubits_num)]\n",
427+
" pool_added = []\n",
428+
" for term in random_mixer:\n",
429+
" pool_added.append(term.get_pauli_word(qubits_num))\n",
430+
" \n",
431+
" mixer_pool = mixer_pool + pool_added\n",
432+
" \n",
427433
" \n",
428434
" print('Mixer pool at step', istep)\n",
429435
" print(mixer_pool)\n",
@@ -484,7 +490,7 @@
484490
},
485491
{
486492
"cell_type": "code",
487-
"execution_count": 21,
493+
"execution_count": 19,
488494
"metadata": {},
489495
"outputs": [
490496
{
@@ -494,8 +500,8 @@
494500
"\n",
495501
" Sampling the Final ADAPT QAOA circuit \n",
496502
"\n",
497-
"The most probable max cut: 01011\n",
498-
"All bitstring from circuit sampling: { 01011:2550 10100:2450 }\n",
503+
"The most probable max cut: 10100\n",
504+
"All bitstring from circuit sampling: { 01011:2499 10100:2501 }\n",
499505
"\n"
500506
]
501507
}
@@ -510,14 +516,14 @@
510516
},
511517
{
512518
"cell_type": "code",
513-
"execution_count": 12,
519+
"execution_count": 20,
514520
"metadata": {},
515521
"outputs": [
516522
{
517523
"name": "stdout",
518524
"output_type": "stream",
519525
"text": [
520-
"CUDA-Q Version cu12-latest (https://github.com/NVIDIA/cuda-quantum 05873efb8973bd60fcf7cfe193e6ab54c6edee60)\n"
526+
"CUDA-Q Version cu12-latest (https://github.com/NVIDIA/cuda-quantum 974716fa2024267f7c12a2ed86ffbfe314d37a36)\n"
521527
]
522528
}
523529
],

0 commit comments

Comments
 (0)