classiq 0.63.1__py3-none-any.whl → 0.64.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- classiq/analyzer/url_utils.py +2 -3
- classiq/interface/_version.py +1 -1
- classiq/interface/analyzer/result.py +1 -2
- classiq/interface/executor/result.py +6 -3
- classiq/interface/helpers/datastructures.py +26 -0
- classiq/interface/interface_version.py +1 -1
- classiq/interface/model/handle_binding.py +11 -3
- classiq/interface/server/routes.py +4 -0
- classiq/model_expansions/atomic_expression_functions_defs.py +6 -6
- classiq/model_expansions/capturing/captured_vars.py +27 -10
- classiq/model_expansions/evaluators/arg_type_match.py +4 -7
- classiq/model_expansions/evaluators/quantum_type_utils.py +15 -8
- classiq/model_expansions/expression_evaluator.py +8 -2
- classiq/model_expansions/generative_functions.py +3 -3
- classiq/model_expansions/interpreters/__init__.py +0 -0
- classiq/model_expansions/{interpreter.py → interpreters/base_interpreter.py} +26 -137
- classiq/model_expansions/interpreters/generative_interpreter.py +108 -0
- classiq/model_expansions/model_tables.py +1 -92
- classiq/model_expansions/quantum_operations/__init__.py +0 -10
- classiq/model_expansions/quantum_operations/call_emitter.py +3 -3
- classiq/model_expansions/quantum_operations/emitter.py +2 -2
- classiq/model_expansions/quantum_operations/quantum_function_call.py +2 -2
- classiq/model_expansions/quantum_operations/shallow_emitter.py +2 -2
- classiq/model_expansions/scope_initialization.py +8 -0
- classiq/qmod/declaration_inferrer.py +0 -3
- classiq/qmod/generative.py +4 -4
- classiq/qmod/qfunc.py +4 -2
- classiq/qmod/qmod_variable.py +17 -10
- classiq/qmod/quantum_function.py +6 -4
- classiq/qmod/utilities.py +7 -1
- {classiq-0.63.1.dist-info → classiq-0.64.0.dist-info}/METADATA +1 -1
- {classiq-0.63.1.dist-info → classiq-0.64.0.dist-info}/RECORD +33 -39
- classiq/interface/helpers/dotdict.py +0 -18
- classiq/model_expansions/quantum_operations/control.py +0 -290
- classiq/model_expansions/quantum_operations/expression_operation.py +0 -103
- classiq/model_expansions/quantum_operations/inplace_binary_operation.py +0 -535
- classiq/model_expansions/quantum_operations/invert.py +0 -36
- classiq/model_expansions/quantum_operations/phase.py +0 -187
- classiq/model_expansions/quantum_operations/power.py +0 -71
- classiq/model_expansions/quantum_operations/quantum_assignment_operation.py +0 -230
- classiq/model_expansions/quantum_operations/within_apply.py +0 -25
- {classiq-0.63.1.dist-info → classiq-0.64.0.dist-info}/WHEEL +0 -0
@@ -23,7 +23,7 @@ classiq/analyzer/analyzer.py,sha256=gvyiBWIdzrR4P_YE-si-UcfFpVZYNlIeCLuSO_XzAX8,
|
|
23
23
|
classiq/analyzer/analyzer_utilities.py,sha256=PT_WsLygmAx4Hf7-VGBzKi6xHclIy5FYelCkdtChe1k,3658
|
24
24
|
classiq/analyzer/rb.py,sha256=gUQPYEcy99rLcV-MQG87HSbiQP4IP_Qz3KKqqeq2T2E,4934
|
25
25
|
classiq/analyzer/show_interactive_hack.py,sha256=mXWSFOqInwFOlJOmkC3Q4rkYyeCufBXeDiQhtGUi67A,1867
|
26
|
-
classiq/analyzer/url_utils.py,sha256=
|
26
|
+
classiq/analyzer/url_utils.py,sha256=ICv92DoI3txVgKCbaWE0fa0G9OBZAbwAxDwNak9Rz0I,662
|
27
27
|
classiq/applications/__init__.py,sha256=gb2dQI2ZuiU3c77hUAAY0D-BIW4YLD-9W5dKzOmMR1U,306
|
28
28
|
classiq/applications/chemistry/__init__.py,sha256=_OGx8E8znq8jpjnHCSj89NpjxkcFZZ7endS5JLCybBM,1094
|
29
29
|
classiq/applications/chemistry/ansatz_parameters.py,sha256=2YXfTOGrsCc6xMpLiGhnIQfI6iBXvlWOS9DY862fgJc,673
|
@@ -95,11 +95,11 @@ classiq/execution/jobs.py,sha256=hRZK5n8xOdT67rb_qnGeb30MiTHax00uCaBgRr7usYE,109
|
|
95
95
|
classiq/execution/qnn.py,sha256=WGPvncz5uS2WxSY3-yBWt2LFiCk6Ug8WKWF-Kp-f7TM,2403
|
96
96
|
classiq/executor.py,sha256=JukmHbvH43cXWBzr1-LPk5gDz4LItJncEUaghZwmldY,2686
|
97
97
|
classiq/interface/__init__.py,sha256=cg7hD_XVu1_jJ1fgwmT0rMIoZHopNVeB8xtlmMx-E_A,83
|
98
|
-
classiq/interface/_version.py,sha256=
|
98
|
+
classiq/interface/_version.py,sha256=jiq21swRYlUvz82-oJu_84QnYJPllqObptNOBRqa69g,197
|
99
99
|
classiq/interface/analyzer/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
100
100
|
classiq/interface/analyzer/analysis_params.py,sha256=dM5rwSks798cxk4FWe4_X5ToRYtgZQh34F1u0XrFkK8,3881
|
101
101
|
classiq/interface/analyzer/cytoscape_graph.py,sha256=MpeRBIYS1TfwYwiFpgTO51IE0KoxhY510pmEM3S0rbw,2361
|
102
|
-
classiq/interface/analyzer/result.py,sha256=
|
102
|
+
classiq/interface/analyzer/result.py,sha256=CJhZ7Q_VUCyKS1ivtyD9l9534efjEUY6C6Wwrb3kXak,5872
|
103
103
|
classiq/interface/applications/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
104
104
|
classiq/interface/applications/qsvm.py,sha256=4dHVSZH--sv58SvxmpDHPh9JDr4qQUZbbGCeaEv6b1I,3408
|
105
105
|
classiq/interface/ast_node.py,sha256=EE06R8KwRA-QkK44Ou9TmMxiaa8J60G9Z9qf9T76k_k,398
|
@@ -161,7 +161,7 @@ classiq/interface/executor/optimizer_preferences.py,sha256=iw-UJ_8WhziqB2s8cmQ1j
|
|
161
161
|
classiq/interface/executor/quantum_code.py,sha256=jA-4hIw5nydv7TcDZ4xPI0YP-FiSa_52SieyYjJkVHI,4258
|
162
162
|
classiq/interface/executor/quantum_instruction_set.py,sha256=_2owh6shcNSKlCHCXbAO6UzzZqldTu3YmUqUw9Qefvo,565
|
163
163
|
classiq/interface/executor/register_initialization.py,sha256=-dkivVSDkkLGkIdu0L5VaONhPCRp_JE42LiAZuHUK7k,1365
|
164
|
-
classiq/interface/executor/result.py,sha256=
|
164
|
+
classiq/interface/executor/result.py,sha256=aBpMCHExTCgcx9y8akMv6ZQ2re4cmzdlrTBVSUBgyz4,12249
|
165
165
|
classiq/interface/executor/vqe_result.py,sha256=cH66jBbZVhyU5Ud4WeoC1eKeX15aO60phEXWFrilc4E,2324
|
166
166
|
classiq/interface/finance/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
167
167
|
classiq/interface/finance/finance_modelling_params.py,sha256=dmJscMXugQsBRoFd4HFtrTU8gsuZJ6sS51R4crC-PKE,347
|
@@ -339,7 +339,7 @@ classiq/interface/helpers/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJW
|
|
339
339
|
classiq/interface/helpers/classproperty.py,sha256=pt9A39GgEMzj2nbY5gjFp_CId_wom6lOQt_PADidT4Y,279
|
340
340
|
classiq/interface/helpers/custom_encoders.py,sha256=TjykoSTz7Kf4hsWmA0ANBshCadfqvcLCmvkadNaaoac,101
|
341
341
|
classiq/interface/helpers/custom_pydantic_types.py,sha256=KtitJvU2E0Q-arOQPxRiPcy_AeYRO7NKYcctuis2MXM,2913
|
342
|
-
classiq/interface/helpers/
|
342
|
+
classiq/interface/helpers/datastructures.py,sha256=QxEzMULNNt14uR4HHaDstHroLqcMDz_KnLTq-Sgn6CY,689
|
343
343
|
classiq/interface/helpers/hashable_mixin.py,sha256=BmMts3hvzNgTWnbYmjVeDYyNL9uMqID4jW_FLQapNVM,1099
|
344
344
|
classiq/interface/helpers/hashable_pydantic_base_model.py,sha256=ADkPtodtdNEsLkZl65Vw-H8N6e0pJaLccV3G1l-QPcs,638
|
345
345
|
classiq/interface/helpers/pydantic_model_helpers.py,sha256=i4AccZnH4EuxaRF6dbMdNrZ2kwxbbHsjzxP-fGDtyE0,548
|
@@ -348,14 +348,14 @@ classiq/interface/helpers/versioned_model.py,sha256=kBgEghNdSidohb0-p_EjRFZLs7LA
|
|
348
348
|
classiq/interface/ide/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
349
349
|
classiq/interface/ide/ide_data.py,sha256=TtFsBttR7L34DeRx4NaswpdyMqEyAuguEWSvGXfZtZs,2504
|
350
350
|
classiq/interface/ide/visual_model.py,sha256=IFJxI3ewvq4O6vPPSNcjawxmuxX4yT-j-BH-z6woK9w,3255
|
351
|
-
classiq/interface/interface_version.py,sha256=
|
351
|
+
classiq/interface/interface_version.py,sha256=7EdsqD253nKWs39lck2q3V_4aJ9QyGpG7p18RsiLCWw,24
|
352
352
|
classiq/interface/jobs.py,sha256=i8hrBR2qtptCbxNI-PVYZedH_EDehOe2i09JbJUlD1g,2339
|
353
353
|
classiq/interface/model/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
354
354
|
classiq/interface/model/bind_operation.py,sha256=J0E6u8KOSB-vRcdpsukYpk1oc8efRohyX-PwLKh98Dc,1869
|
355
355
|
classiq/interface/model/classical_if.py,sha256=Qr726EEiim47PexMd8lTRfHLziUoiTUitnHrM3-oSgI,432
|
356
356
|
classiq/interface/model/classical_parameter_declaration.py,sha256=tcAw-knjFqeHg_snv7qBJuJDrUhmL0v1-Q_YfVgRnEc,1261
|
357
357
|
classiq/interface/model/control.py,sha256=1q_CjIGSGmqmvfT1RAN6VmIj2DZIio2wMOCT6HNniBw,1356
|
358
|
-
classiq/interface/model/handle_binding.py,sha256=
|
358
|
+
classiq/interface/model/handle_binding.py,sha256=2uZGm1cHSvPFfQ9HZCl6MMQXZn9d3ZUkXaZU5Qht0GI,10967
|
359
359
|
classiq/interface/model/inplace_binary_operation.py,sha256=Q2CmF42Y975SOJ7gsZfGyRA5Jn9MKzyNle0sopCyCh4,1494
|
360
360
|
classiq/interface/model/invert.py,sha256=9gN0vmy4892_ItwPxKc0lTjjagyKUX6mEer2vINdL5o,294
|
361
361
|
classiq/interface/model/model.py,sha256=0QX1aOoLvfYnjVIjJY6ZffSHuvP5x8CQGDp8673dmNY,6818
|
@@ -386,48 +386,42 @@ classiq/interface/pyomo_extension/pyomo_sympy_bimap.py,sha256=sE8lGR2qQDwI-a-7Mg
|
|
386
386
|
classiq/interface/pyomo_extension/set_pprint.py,sha256=jlyYUHfQXwyzPQIzstnTeIK6T62BcSPn3eJdD1Qjy7E,344
|
387
387
|
classiq/interface/server/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
388
388
|
classiq/interface/server/global_versions.py,sha256=EyUtBCoGHjgS4jybiHI8wOZq3WOqvta2WYZc5MARkoA,274
|
389
|
-
classiq/interface/server/routes.py,sha256=
|
389
|
+
classiq/interface/server/routes.py,sha256=m2ZoWL3mQJSWPeMuahfVLTLjApkUnJwF_QmhUbVlqko,3267
|
390
390
|
classiq/interface/source_reference.py,sha256=a-4Vdc511ux-0lDPDTRGAzouRWWtu4A3MPAfiZe_YPE,1764
|
391
391
|
classiq/model_expansions/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
392
|
-
classiq/model_expansions/atomic_expression_functions_defs.py,sha256=
|
392
|
+
classiq/model_expansions/atomic_expression_functions_defs.py,sha256=h0itvVvjO_Z-x-qoNL0KEUDxcMClvvv_QCkdLF50QCU,8565
|
393
393
|
classiq/model_expansions/capturing/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
394
|
-
classiq/model_expansions/capturing/captured_vars.py,sha256=
|
394
|
+
classiq/model_expansions/capturing/captured_vars.py,sha256=i7aQtRcgq-rDAMisKmKg-brvdyzkpPfflHTZqOs8wpA,16323
|
395
395
|
classiq/model_expansions/capturing/mangling_utils.py,sha256=wfCsjP0pScZv9YP6JXq3oVhkS-lCFyUoZ9IROBHS3Ek,1858
|
396
396
|
classiq/model_expansions/closure.py,sha256=7GuKuQd6PD2bdIUU0V7qOC0YFcnjUSyHKWLZMSzsruo,5522
|
397
397
|
classiq/model_expansions/debug_flag.py,sha256=JWzl9FFq2CLcvTg_sh-K8Dp_xXvewsTuFKhPjTCrsrs,107
|
398
398
|
classiq/model_expansions/evaluators/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
399
|
-
classiq/model_expansions/evaluators/arg_type_match.py,sha256=
|
399
|
+
classiq/model_expansions/evaluators/arg_type_match.py,sha256=7sZggt0cUNYqBGfVCExJl2GpxdMybbnVlJLjIs4EQPI,6108
|
400
400
|
classiq/model_expansions/evaluators/argument_types.py,sha256=5KBtDgr_cOaJg9pAfme66P2hKLe9TT_bw39ipYtAumM,1424
|
401
401
|
classiq/model_expansions/evaluators/classical_expression.py,sha256=OM-lPEX9-5IW6DEVZ3GMkSZDqsVDV7WRLItOUaTOvgw,1403
|
402
402
|
classiq/model_expansions/evaluators/control.py,sha256=HxkK1uKKWnMRsbI8e_20i2MJM6y7HqNBw-I_MIaQTtQ,4718
|
403
403
|
classiq/model_expansions/evaluators/parameter_types.py,sha256=XCK8dKMemY6ptK3UqOdRqRA_9LsorqiX1-HUoMWc1NQ,7905
|
404
|
-
classiq/model_expansions/evaluators/quantum_type_utils.py,sha256=
|
404
|
+
classiq/model_expansions/evaluators/quantum_type_utils.py,sha256=vM2EpbvoDVT4J68AiF4Bh2dKUU2RdfcLo-Ejg26Rge4,9082
|
405
405
|
classiq/model_expansions/evaluators/type_type_match.py,sha256=3akZR86TAFKUyM5c5knCPSlraI3LQeWZXxXMTtmu0BI,3220
|
406
|
-
classiq/model_expansions/expression_evaluator.py,sha256=
|
406
|
+
classiq/model_expansions/expression_evaluator.py,sha256=8-uE89LOQy2nS3pm8fEToY00AXkYVwKyhfBMkB9Kh-g,4577
|
407
407
|
classiq/model_expansions/expression_renamer.py,sha256=rtAf-vvJhlwh-KCs2WgxdW4lP3UjA0vUtZeHcIoTwUM,2692
|
408
408
|
classiq/model_expansions/function_builder.py,sha256=-rmxmVcQGlaLvUEPZSFvaKLRy1oh99leCqhywMgHmxQ,7908
|
409
|
-
classiq/model_expansions/generative_functions.py,sha256=
|
410
|
-
classiq/model_expansions/
|
411
|
-
classiq/model_expansions/
|
412
|
-
classiq/model_expansions/
|
409
|
+
classiq/model_expansions/generative_functions.py,sha256=GrGO18geuTh75lC-xm-6ETH2-6CMODtF6nny7_mfOGI,6225
|
410
|
+
classiq/model_expansions/interpreters/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
411
|
+
classiq/model_expansions/interpreters/base_interpreter.py,sha256=8cXleQLu3tEB8mUWshQI4TFchtF3bKGKL08q8Sw4h_g,14894
|
412
|
+
classiq/model_expansions/interpreters/generative_interpreter.py,sha256=Gy6QMqv4cXuwz7ipH1T63idGnKYVQQ6us8YlhDEXDH4,3941
|
413
|
+
classiq/model_expansions/model_tables.py,sha256=dlrOGRS2x4Fd_dzClIcV7V8edmbbQzePv9eqxtJQrpo,620
|
414
|
+
classiq/model_expansions/quantum_operations/__init__.py,sha256=2Z8m4wz9Rfrw5s2izHbZFhAoaJ5U-ohbGE3x8t4e63c,473
|
413
415
|
classiq/model_expansions/quantum_operations/bind.py,sha256=A1XPXnoexaKUlgUZSAn88SYXmXjo1G9-fCAJS67gM-c,2515
|
414
|
-
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=
|
416
|
+
classiq/model_expansions/quantum_operations/call_emitter.py,sha256=yWFBgIfxVd8disJ6je0h2n4Zqw4qJWrhu7qiu-kPOa4,12570
|
415
417
|
classiq/model_expansions/quantum_operations/classicalif.py,sha256=RWtUD_BgjLoXI-yUkVYdvvdaGNLSRwUK1II7ROl1TgQ,2090
|
416
|
-
classiq/model_expansions/quantum_operations/
|
417
|
-
classiq/model_expansions/quantum_operations/
|
418
|
-
classiq/model_expansions/quantum_operations/expression_operation.py,sha256=aW-0VmmWF5_0v4yWFNQdXoN9HiJQWJmWyIS3uDvjLWI,3962
|
419
|
-
classiq/model_expansions/quantum_operations/inplace_binary_operation.py,sha256=BGBXV-NKFaL86qpdQZBKieLfrFajdtUipQ4AnyKIs9I,18213
|
420
|
-
classiq/model_expansions/quantum_operations/invert.py,sha256=zsxUkakWgpoF07MHst03ahGXWQaulTDE0n_Zf9OV7Xs,1287
|
421
|
-
classiq/model_expansions/quantum_operations/phase.py,sha256=PXbGRUHBVEXGzzDpeTjA1iAZSPuc66KMgw8De3tNFbE,7061
|
422
|
-
classiq/model_expansions/quantum_operations/power.py,sha256=uSMMsA4n6FDhdFZY_S1d1Uo6tx5yGUotvcClsBCTFXg,2468
|
423
|
-
classiq/model_expansions/quantum_operations/quantum_assignment_operation.py,sha256=BifM4oI0QKavSOZUq8Innd-1jmKkedk2jgADp-DFTLg,9095
|
424
|
-
classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=9pATOFHUz2Co9fVBXqgaWoWPPgR-h_C0HfWC57e5-C8,970
|
418
|
+
classiq/model_expansions/quantum_operations/emitter.py,sha256=BZLaqXdYrH8qvWOlnJDqv4OXJ_is73Kg-21e4H9HKzM,6650
|
419
|
+
classiq/model_expansions/quantum_operations/quantum_function_call.py,sha256=yEP6Yqx-w30paAsVYCu4yfgntw4PUrFHTKrcASjmt6Q,996
|
425
420
|
classiq/model_expansions/quantum_operations/repeat.py,sha256=jbBZzx6PTL2qjiAchF-lrIgiePRgMrzcEGarU9xirGU,2293
|
426
|
-
classiq/model_expansions/quantum_operations/shallow_emitter.py,sha256=
|
421
|
+
classiq/model_expansions/quantum_operations/shallow_emitter.py,sha256=u3B8AfZ_5-N0whha04rSBHE8BYqWkmNAKvdsz-LLJ-w,6387
|
427
422
|
classiq/model_expansions/quantum_operations/variable_decleration.py,sha256=OG_uWndzpPX4rJ3ij_7iOtcS779ubS-Uo2RT1GHdR60,1199
|
428
|
-
classiq/model_expansions/quantum_operations/within_apply.py,sha256=IbQ9sLWGzn-B_W-oHgdynyrnh2Sl4ZTksEETzeKQ508,982
|
429
423
|
classiq/model_expansions/scope.py,sha256=SreVjbt36-p4zfmzV8gmwq46HVwbrfoA4JBULXsQT_E,7868
|
430
|
-
classiq/model_expansions/scope_initialization.py,sha256=
|
424
|
+
classiq/model_expansions/scope_initialization.py,sha256=PTwpRXcRZ9Z6wacuCouKoqpU7MXWYqX7mET-8hoS17c,5984
|
431
425
|
classiq/model_expansions/sympy_conversion/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
432
426
|
classiq/model_expansions/sympy_conversion/arithmetics.py,sha256=7ZKg1C92wUdxtFhrT4VuI9mNvH2a1z1R8lbWYFhYczc,1116
|
433
427
|
classiq/model_expansions/sympy_conversion/expression_to_sympy.py,sha256=Hz7a1Gtg9_JoQtxdJuE08iDfIMahnmOzlljUE8VBozI,5861
|
@@ -480,9 +474,9 @@ classiq/qmod/cfunc.py,sha256=e3zWNEloBBPy-wJaGI1K5cdNFbd3oq0o4TUY2YDr6ks,1087
|
|
480
474
|
classiq/qmod/classical_function.py,sha256=iHm6T719PUZQPwuNSkouaMA8J9yHrrHUpP-2AQjsA5g,1088
|
481
475
|
classiq/qmod/cparam.py,sha256=wai8PyfS6QCJ8_WLck2nRZrtuEXYg1cogj4CQ_EZKP4,1182
|
482
476
|
classiq/qmod/create_model_function.py,sha256=JhPFmI-_K4Yv-RFcKwWLLhFMpcs35K651ItojXwHolk,2245
|
483
|
-
classiq/qmod/declaration_inferrer.py,sha256=
|
477
|
+
classiq/qmod/declaration_inferrer.py,sha256=X289TtXPxSzW37rm6-f02iPYMOHCZnDiZfCcf3gz56c,6809
|
484
478
|
classiq/qmod/expression_query.py,sha256=24gsE5hJ1o9ZuqPILH7aaoOzKRQY2RZtvIK35xuubGA,1629
|
485
|
-
classiq/qmod/generative.py,sha256=
|
479
|
+
classiq/qmod/generative.py,sha256=_Ct5pNgSTk_3EgZaf1P1wcU2LWjokJAVwfmDpOx4cQE,1208
|
486
480
|
classiq/qmod/model_state_container.py,sha256=lLE6sK0iAOXe3WB5_B59zZXuMzc1P6ZFf0n7FJZy3eU,1062
|
487
481
|
classiq/qmod/native/__init__.py,sha256=gm0L3ew0KAy0eSqaMQrvpnKWx85HoA1p9ADaAlyejdA,126
|
488
482
|
classiq/qmod/native/expression_to_qmod.py,sha256=a33dDr7BGWl7YhsFjpfAuI9Ys7amJjMo4DImSrD4NZg,7143
|
@@ -491,13 +485,13 @@ classiq/qmod/pretty_print/__init__.py,sha256=jhR0cpXumOJnyb-zWnvMLpEuUOYPnnJ7DJm
|
|
491
485
|
classiq/qmod/pretty_print/expression_to_python.py,sha256=QoRP817CFEp3Ad3Q3hxWW-hbVzWQbHQIGUHjZkpZDm8,7480
|
492
486
|
classiq/qmod/pretty_print/pretty_printer.py,sha256=U-YJwlT5cO_xLMdp2Vwo_QVIFJGSKp25xRxtSJwyYxA,23212
|
493
487
|
classiq/qmod/python_classical_type.py,sha256=aU7QYrz7_ZRjmgjjS1DPq3tPm3SzuqZoxlJ4ZuKX0XI,2456
|
494
|
-
classiq/qmod/qfunc.py,sha256=
|
488
|
+
classiq/qmod/qfunc.py,sha256=XFyuIG9g4gRM9vCmIJYR4k8qcDKX7xHZTjkVu520d9k,1955
|
495
489
|
classiq/qmod/qmod_constant.py,sha256=YawkwhhOLqFyFUyhE13Q_zCnex_Ki46hePRwGJmr5oU,4853
|
496
490
|
classiq/qmod/qmod_parameter.py,sha256=PpK4rzY0Hszgbzr_lclROcZ7JPqnhDJBYsSQkUjkcs8,4294
|
497
|
-
classiq/qmod/qmod_variable.py,sha256=
|
491
|
+
classiq/qmod/qmod_variable.py,sha256=caOWT_OVr19z3Pv98apV7NcbkqrKpP7ah5osVOm1i_0,24117
|
498
492
|
classiq/qmod/quantum_callable.py,sha256=sthlH5UJyJsdOxpCW3_EW3JFIYd0r1K3Zec1CDbC2-0,2451
|
499
493
|
classiq/qmod/quantum_expandable.py,sha256=qs35-qMGm_J92Pnem_Juw18Wv3DZQWlqy6-_kuWeMLA,17020
|
500
|
-
classiq/qmod/quantum_function.py,sha256=
|
494
|
+
classiq/qmod/quantum_function.py,sha256=Fa2eEBqXDsxnbl-RBbf-dikqLt8nGXf0SYMHtvYdYLs,12571
|
501
495
|
classiq/qmod/semantics/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
502
496
|
classiq/qmod/semantics/annotation.py,sha256=0IeRymMK20sPHzbs7EzGoqhZICQmR6-gXR3SS9sr9OE,1255
|
503
497
|
classiq/qmod/semantics/error_manager.py,sha256=KAnNaQE0YarkXTQ0du3mvCqGCbbH-d81sv2Ti-NpkL4,2783
|
@@ -514,9 +508,9 @@ classiq/qmod/symbolic.py,sha256=kmS-BWe0QCenq4i0WkzreFZsvbpgUv9RoSOQHCg3UKg,7607
|
|
514
508
|
classiq/qmod/symbolic_expr.py,sha256=LJoa9c6puMvUu4d5oU0SNzc7VXzSFBUNLf19ADzktLs,6133
|
515
509
|
classiq/qmod/symbolic_type.py,sha256=ded7bVfWmHFw8MoyivVDJsG5vZZVRQontOZYb1kCrTQ,162
|
516
510
|
classiq/qmod/type_attribute_remover.py,sha256=NZmTXAsngWqthXjE8n-n6yE72fiWTFM12-TXXJ1kJ-Q,1242
|
517
|
-
classiq/qmod/utilities.py,sha256=
|
511
|
+
classiq/qmod/utilities.py,sha256=KQ3L96YkdZyl6A67_waRoX15q1BNr855OYIknK7UQZY,2867
|
518
512
|
classiq/qmod/write_qmod.py,sha256=Oo-j_rSfcmzC5MOn0Vq334vv_OTvdD4P7K9pv-gbo8c,1833
|
519
513
|
classiq/synthesis.py,sha256=WLk3wpX_xPiAMstF9PGMO5SWVb_qqa1sN2Nj3MekX34,8113
|
520
|
-
classiq-0.
|
521
|
-
classiq-0.
|
522
|
-
classiq-0.
|
514
|
+
classiq-0.64.0.dist-info/METADATA,sha256=9j9tH8LflGXqHaDjEgpy8Ajg7qyZW_8NoutQ_mWUCWM,3497
|
515
|
+
classiq-0.64.0.dist-info/WHEEL,sha256=sP946D7jFCHeNz5Iq4fL4Lu-PrWrFsgfLXbbkciIZwg,88
|
516
|
+
classiq-0.64.0.dist-info/RECORD,,
|
@@ -1,18 +0,0 @@
|
|
1
|
-
from typing import Any
|
2
|
-
|
3
|
-
|
4
|
-
class DotDict(dict):
|
5
|
-
def __getattr__(self, key: str) -> Any:
|
6
|
-
return super().get(key)
|
7
|
-
|
8
|
-
def __setattr__(self, key: str, value: Any) -> None:
|
9
|
-
super().__setitem__(key, value)
|
10
|
-
|
11
|
-
def __delattr__(self, key: str) -> None:
|
12
|
-
super().__delitem__(key)
|
13
|
-
|
14
|
-
|
15
|
-
def get_recursive_dotdict(obj: Any) -> Any:
|
16
|
-
if not isinstance(obj, dict):
|
17
|
-
return obj
|
18
|
-
return DotDict({k: get_recursive_dotdict(v) for k, v in obj.items()})
|
@@ -1,290 +0,0 @@
|
|
1
|
-
from sympy import Equality
|
2
|
-
from sympy.logic.boolalg import Boolean
|
3
|
-
from typing_extensions import TypeGuard
|
4
|
-
|
5
|
-
from classiq.interface.exceptions import (
|
6
|
-
ClassiqExpansionError,
|
7
|
-
ClassiqInternalExpansionError,
|
8
|
-
)
|
9
|
-
from classiq.interface.generator.compiler_keywords import INPLACE_ARITH_AUX_VAR_PREFIX
|
10
|
-
from classiq.interface.generator.expressions.expression import Expression
|
11
|
-
from classiq.interface.generator.expressions.expression_types import ExpressionValue
|
12
|
-
from classiq.interface.generator.expressions.qmod_qarray_proxy import QmodQArrayProxy
|
13
|
-
from classiq.interface.generator.expressions.qmod_qscalar_proxy import QmodQNumProxy
|
14
|
-
from classiq.interface.generator.expressions.qmod_sized_proxy import QmodSizedProxy
|
15
|
-
from classiq.interface.generator.functions.builtins.internal_operators import (
|
16
|
-
CONTROL_OPERATOR_NAME,
|
17
|
-
)
|
18
|
-
from classiq.interface.model.bind_operation import BindOperation
|
19
|
-
from classiq.interface.model.control import Control
|
20
|
-
from classiq.interface.model.handle_binding import HandleBinding
|
21
|
-
from classiq.interface.model.quantum_expressions.arithmetic_operation import (
|
22
|
-
ArithmeticOperation,
|
23
|
-
ArithmeticOperationKind,
|
24
|
-
)
|
25
|
-
from classiq.interface.model.quantum_function_call import QuantumFunctionCall
|
26
|
-
from classiq.interface.model.quantum_type import (
|
27
|
-
QuantumBit,
|
28
|
-
QuantumBitvector,
|
29
|
-
)
|
30
|
-
from classiq.interface.model.statement_block import ConcreteQuantumStatement
|
31
|
-
from classiq.interface.model.variable_declaration_statement import (
|
32
|
-
VariableDeclarationStatement,
|
33
|
-
)
|
34
|
-
from classiq.interface.model.within_apply_operation import WithinApply
|
35
|
-
|
36
|
-
from classiq.model_expansions.capturing.captured_vars import (
|
37
|
-
validate_args_are_not_propagated,
|
38
|
-
)
|
39
|
-
from classiq.model_expansions.capturing.mangling_utils import ARRAY_CAST_SUFFIX
|
40
|
-
from classiq.model_expansions.closure import Closure
|
41
|
-
from classiq.model_expansions.evaluators.control import (
|
42
|
-
resolve_num_condition,
|
43
|
-
type_name,
|
44
|
-
)
|
45
|
-
from classiq.model_expansions.quantum_operations.expression_operation import (
|
46
|
-
ExpressionOperationEmitter,
|
47
|
-
)
|
48
|
-
from classiq.model_expansions.scope import Scope
|
49
|
-
from classiq.model_expansions.transformers.var_splitter import SymbolParts
|
50
|
-
from classiq.model_expansions.utils.handles_collector import extract_handles
|
51
|
-
from classiq.qmod.builtins.functions.standard_gates import X
|
52
|
-
|
53
|
-
|
54
|
-
class ControlEmitter(ExpressionOperationEmitter[Control]):
|
55
|
-
def emit(self, control: Control, /) -> None:
|
56
|
-
validate_args_are_not_propagated(
|
57
|
-
extract_handles(control.expression), extract_handles(control.body)
|
58
|
-
)
|
59
|
-
condition = control.expression
|
60
|
-
arrays_with_subscript = self.split_symbols(
|
61
|
-
condition, self._counted_name_allocator.allocate
|
62
|
-
)
|
63
|
-
if len(arrays_with_subscript) > 0:
|
64
|
-
self._emit_with_split(control, condition, arrays_with_subscript)
|
65
|
-
return
|
66
|
-
|
67
|
-
control = self._evaluate_types_in_expression(control)
|
68
|
-
condition_val = control.expression.value.value
|
69
|
-
if isinstance(condition_val, QmodSizedProxy):
|
70
|
-
if control.else_block is None:
|
71
|
-
self._validate_canonical_condition(condition_val)
|
72
|
-
self._emit_canonical_control(control)
|
73
|
-
return
|
74
|
-
else:
|
75
|
-
self._interpreter.emit_statement(
|
76
|
-
control.model_copy(
|
77
|
-
update=dict(
|
78
|
-
expression=self._uncanonize_condition(condition_val)
|
79
|
-
)
|
80
|
-
)
|
81
|
-
)
|
82
|
-
return
|
83
|
-
|
84
|
-
self._validate_condition(control)
|
85
|
-
self._emit_with_boolean(control)
|
86
|
-
|
87
|
-
def _uncanonize_condition(self, condition_val: QmodSizedProxy) -> Expression:
|
88
|
-
lhs = (
|
89
|
-
" & ".join(
|
90
|
-
f"{condition_val.handle}[{idx}]" for idx in range(condition_val.size)
|
91
|
-
)
|
92
|
-
if isinstance(condition_val, QmodQArrayProxy)
|
93
|
-
else condition_val.handle
|
94
|
-
)
|
95
|
-
return Expression(expr=f"{lhs} == 1")
|
96
|
-
|
97
|
-
def _emit_canonical_control(self, control: Control) -> None:
|
98
|
-
# canonical means control(q, body) where q is a single quantum variable
|
99
|
-
if self._should_wrap_control(control):
|
100
|
-
self._emit_wrapped(control)
|
101
|
-
return
|
102
|
-
self._emit_as_operation(control)
|
103
|
-
|
104
|
-
def _should_wrap_control(self, control: Control) -> bool:
|
105
|
-
# TODO we can return back to the general case (as in _should_wrap function)
|
106
|
-
# once we implement the "smart control" pass to blocks:
|
107
|
-
# Control(q, body) -> WithinApply(
|
108
|
-
# compute=aux:=QBit(), allocate(1, aux), Control(q, [X(aux)]),
|
109
|
-
# action=Control(aux, body)
|
110
|
-
# )
|
111
|
-
# We also need to be able to nest multiple Control statements to a single one
|
112
|
-
return len(control.body) > 1
|
113
|
-
|
114
|
-
def _emit_as_operation(self, control: Control) -> None:
|
115
|
-
control_operation = Closure(
|
116
|
-
name=CONTROL_OPERATOR_NAME,
|
117
|
-
blocks=dict(body=control.body),
|
118
|
-
scope=Scope(parent=self._current_scope),
|
119
|
-
)
|
120
|
-
context = self._expand_operation(control_operation)
|
121
|
-
self._update_control_state(control)
|
122
|
-
self.emit_statement(
|
123
|
-
control.model_copy(update=dict(body=context.statements("body")))
|
124
|
-
)
|
125
|
-
|
126
|
-
def _emit_wrapped(self, control: Control) -> None:
|
127
|
-
wrapping_function = self._create_expanded_wrapping_function(
|
128
|
-
CONTROL_OPERATOR_NAME, control.body
|
129
|
-
)
|
130
|
-
self._update_control_state(control)
|
131
|
-
self.emit_statement(control.model_copy(update=dict(body=[wrapping_function])))
|
132
|
-
|
133
|
-
@staticmethod
|
134
|
-
def _update_control_state(control: Control) -> None:
|
135
|
-
condition_val = control.expression.value.value
|
136
|
-
if not isinstance(condition_val, QmodSizedProxy):
|
137
|
-
raise ClassiqInternalExpansionError("Control is not in canonical form")
|
138
|
-
control.set_ctrl_size(condition_val.size)
|
139
|
-
|
140
|
-
def _emit_with_boolean(self, control: Control) -> None:
|
141
|
-
condition_val = control.expression.value.value
|
142
|
-
if self._is_simple_equality(condition_val):
|
143
|
-
ctrl, ctrl_state = resolve_num_condition(condition_val)
|
144
|
-
if control.else_block is None or ctrl.size == 1:
|
145
|
-
self._emit_with_x_gates(control, ctrl, ctrl_state)
|
146
|
-
return
|
147
|
-
self._emit_with_arithmetic(control)
|
148
|
-
|
149
|
-
@staticmethod
|
150
|
-
def _is_simple_equality(condition_val: ExpressionValue) -> TypeGuard[Equality]:
|
151
|
-
# Note that we don't support equalities with non-integer values yet
|
152
|
-
return isinstance(condition_val, Equality) and (
|
153
|
-
(
|
154
|
-
condition_val.args[0].is_Atom
|
155
|
-
and not isinstance(condition_val.args[0], QmodSizedProxy)
|
156
|
-
and isinstance(condition_val.args[1], QmodSizedProxy)
|
157
|
-
)
|
158
|
-
or (
|
159
|
-
condition_val.args[1].is_Atom
|
160
|
-
and not isinstance(condition_val.args[1], QmodSizedProxy)
|
161
|
-
and isinstance(condition_val.args[0], QmodSizedProxy)
|
162
|
-
)
|
163
|
-
)
|
164
|
-
|
165
|
-
def _create_canonical_control_op(
|
166
|
-
self, control: Control, handle_name: str
|
167
|
-
) -> list[ConcreteQuantumStatement]:
|
168
|
-
handle_expr = self._interpreter.evaluate(Expression(expr=handle_name)).emit()
|
169
|
-
control_then = control.model_copy(
|
170
|
-
update=dict(expression=handle_expr, else_block=None)
|
171
|
-
)
|
172
|
-
if control.else_block is None:
|
173
|
-
return [control_then]
|
174
|
-
else_compute_call = QuantumFunctionCall(
|
175
|
-
function="X", positional_args=[HandleBinding(name=handle_name)]
|
176
|
-
)
|
177
|
-
else_compute_call.set_func_decl(X.func_decl)
|
178
|
-
control_else_inner = control.model_copy(
|
179
|
-
update=dict(
|
180
|
-
expression=handle_expr, body=control.else_block, else_block=None
|
181
|
-
),
|
182
|
-
deep=True,
|
183
|
-
)
|
184
|
-
control_else = WithinApply(
|
185
|
-
compute=[else_compute_call],
|
186
|
-
action=[control_else_inner],
|
187
|
-
)
|
188
|
-
return [control_then, control_else]
|
189
|
-
|
190
|
-
def _control_with_x_gates(
|
191
|
-
self, control: Control, ctrl: QmodSizedProxy, ctrl_state: str
|
192
|
-
) -> ConcreteQuantumStatement:
|
193
|
-
compute_op: list[ConcreteQuantumStatement] = []
|
194
|
-
|
195
|
-
x_gate_value = self._get_x_gate_value(ctrl_state)
|
196
|
-
if x_gate_value != 0:
|
197
|
-
compute_op.append(
|
198
|
-
ArithmeticOperation(
|
199
|
-
result_var=ctrl.handle,
|
200
|
-
expression=Expression(expr=str(x_gate_value)),
|
201
|
-
operation_kind=ArithmeticOperationKind.InplaceXor,
|
202
|
-
)
|
203
|
-
)
|
204
|
-
|
205
|
-
if isinstance(ctrl, QmodQNumProxy):
|
206
|
-
# Canonical control does not accept QNum, so we have to cast it
|
207
|
-
cast_decl, bind_op = self._get_array_cast_ops(ctrl)
|
208
|
-
self._interpreter.emit_statement(cast_decl)
|
209
|
-
compute_op.append(bind_op)
|
210
|
-
control_ops = self._create_canonical_control_op(
|
211
|
-
control, str(cast_decl.name)
|
212
|
-
)
|
213
|
-
else:
|
214
|
-
control_ops = self._create_canonical_control_op(control, str(ctrl.handle))
|
215
|
-
|
216
|
-
return WithinApply(compute=compute_op, action=control_ops)
|
217
|
-
|
218
|
-
def _emit_with_x_gates(
|
219
|
-
self, control: Control, ctrl: QmodSizedProxy, ctrl_state: str
|
220
|
-
) -> None:
|
221
|
-
self._interpreter.emit_statement(
|
222
|
-
self._control_with_x_gates(control, ctrl, ctrl_state)
|
223
|
-
)
|
224
|
-
|
225
|
-
@staticmethod
|
226
|
-
def _get_x_gate_value(ctrl_state: str) -> int:
|
227
|
-
x_gate_value = 0
|
228
|
-
for idx, bit in enumerate(ctrl_state):
|
229
|
-
x_gate_value += int(bit == "0") << idx
|
230
|
-
return x_gate_value
|
231
|
-
|
232
|
-
def _get_array_cast_ops(
|
233
|
-
self, ctrl: QmodQNumProxy
|
234
|
-
) -> tuple[VariableDeclarationStatement, BindOperation]:
|
235
|
-
array_cast = self._counted_name_allocator.allocate(
|
236
|
-
f"{ctrl.handle}{ARRAY_CAST_SUFFIX}"
|
237
|
-
)
|
238
|
-
cast_decl = VariableDeclarationStatement(
|
239
|
-
name=array_cast, quantum_type=QuantumBitvector()
|
240
|
-
)
|
241
|
-
bind_op = BindOperation(
|
242
|
-
in_handles=[ctrl.handle], out_handles=[HandleBinding(name=array_cast)]
|
243
|
-
)
|
244
|
-
return cast_decl, bind_op
|
245
|
-
|
246
|
-
def _emit_with_arithmetic(self, control: Control) -> None:
|
247
|
-
aux_var = self._counted_name_allocator.allocate(INPLACE_ARITH_AUX_VAR_PREFIX)
|
248
|
-
self._interpreter.emit_statement(
|
249
|
-
VariableDeclarationStatement(name=aux_var, quantum_type=QuantumBit())
|
250
|
-
)
|
251
|
-
arith_expression = ArithmeticOperation(
|
252
|
-
result_var=HandleBinding(name=aux_var),
|
253
|
-
expression=control.expression,
|
254
|
-
operation_kind=ArithmeticOperationKind.Assignment,
|
255
|
-
)
|
256
|
-
self._interpreter.emit_statement(
|
257
|
-
WithinApply(
|
258
|
-
compute=[arith_expression],
|
259
|
-
action=self._create_canonical_control_op(control, aux_var),
|
260
|
-
)
|
261
|
-
)
|
262
|
-
|
263
|
-
def _validate_condition(self, control: Control) -> None:
|
264
|
-
condition_value = control.expression.value.value
|
265
|
-
if not (
|
266
|
-
isinstance(condition_value, Boolean)
|
267
|
-
or (self._all_vars_boolean(control) and self._is_res_boolean(control))
|
268
|
-
):
|
269
|
-
raise ClassiqExpansionError(_condition_err_msg(condition_value))
|
270
|
-
|
271
|
-
@staticmethod
|
272
|
-
def _validate_canonical_condition(condition_val: ExpressionValue) -> None:
|
273
|
-
if isinstance(condition_val, QmodQNumProxy):
|
274
|
-
raise ClassiqExpansionError(_condition_err_msg(condition_val))
|
275
|
-
|
276
|
-
def _get_updated_op_split_symbols(
|
277
|
-
self, op: Control, symbol_parts: SymbolParts
|
278
|
-
) -> Control:
|
279
|
-
new_body = self.rewrite(op.body, symbol_parts)
|
280
|
-
new_else = None
|
281
|
-
if op.else_block is not None:
|
282
|
-
new_else = self.rewrite(op.else_block, symbol_parts)
|
283
|
-
return op.model_copy(update=dict(body=new_body, else_block=new_else))
|
284
|
-
|
285
|
-
|
286
|
-
def _condition_err_msg(condition_val: ExpressionValue) -> str:
|
287
|
-
return (
|
288
|
-
f"Control condition {str(condition_val)!r} must be a qubit, an array of "
|
289
|
-
f"qubits, or a boolean expression, but is {type_name(condition_val)}"
|
290
|
-
)
|
@@ -1,103 +0,0 @@
|
|
1
|
-
import ast
|
2
|
-
from typing import Generic, TypeVar, Union
|
3
|
-
|
4
|
-
from classiq.interface.exceptions import ClassiqInternalExpansionError
|
5
|
-
from classiq.interface.generator.expressions.expression import Expression
|
6
|
-
from classiq.interface.generator.visitor import NodeType
|
7
|
-
from classiq.interface.model.control import Control
|
8
|
-
from classiq.interface.model.quantum_expressions.quantum_expression import (
|
9
|
-
QuantumAssignmentOperation,
|
10
|
-
QuantumExpressionOperation,
|
11
|
-
)
|
12
|
-
from classiq.interface.model.quantum_type import (
|
13
|
-
QuantumNumeric,
|
14
|
-
)
|
15
|
-
from classiq.interface.model.within_apply_operation import WithinApply
|
16
|
-
|
17
|
-
from classiq.model_expansions.quantum_operations.call_emitter import CallEmitter
|
18
|
-
from classiq.model_expansions.scope import QuantumSymbol
|
19
|
-
from classiq.model_expansions.transformers.var_splitter import SymbolParts
|
20
|
-
from classiq.model_expansions.visitors.variable_references import VarRefCollector
|
21
|
-
|
22
|
-
ExpressionOperationT = TypeVar("ExpressionOperationT", bound=QuantumExpressionOperation)
|
23
|
-
AST_NODE = TypeVar("AST_NODE", bound=NodeType)
|
24
|
-
|
25
|
-
|
26
|
-
class ExpressionOperationEmitter(
|
27
|
-
Generic[ExpressionOperationT], CallEmitter[ExpressionOperationT]
|
28
|
-
):
|
29
|
-
def _emit_with_split(
|
30
|
-
self,
|
31
|
-
op: ExpressionOperationT,
|
32
|
-
expression: Expression,
|
33
|
-
symbol_parts: SymbolParts,
|
34
|
-
) -> None:
|
35
|
-
for var_decl in self.get_var_decls(symbol_parts):
|
36
|
-
self._interpreter.emit_statement(var_decl)
|
37
|
-
bind_ops = self.get_bind_ops(symbol_parts)
|
38
|
-
|
39
|
-
new_expression = self.rewrite(expression, symbol_parts)
|
40
|
-
if len(self.split_symbols(new_expression, lambda name: name)) > 0:
|
41
|
-
raise ClassiqInternalExpansionError(
|
42
|
-
f"Did not replace all handles in expression: {expression.expr!r} -> "
|
43
|
-
f"{new_expression.expr!r}"
|
44
|
-
)
|
45
|
-
new_op = op.model_copy(update=dict(expression=new_expression))
|
46
|
-
new_op = self._get_updated_op_split_symbols(new_op, symbol_parts)
|
47
|
-
|
48
|
-
self._interpreter.emit_statement(
|
49
|
-
WithinApply(
|
50
|
-
compute=bind_ops,
|
51
|
-
action=[new_op],
|
52
|
-
source_ref=op.source_ref,
|
53
|
-
)
|
54
|
-
)
|
55
|
-
|
56
|
-
def _get_updated_op_split_symbols(
|
57
|
-
self,
|
58
|
-
op: ExpressionOperationT,
|
59
|
-
symbol_mapping: SymbolParts,
|
60
|
-
) -> ExpressionOperationT:
|
61
|
-
return op
|
62
|
-
|
63
|
-
def _evaluate_types_in_expression(
|
64
|
-
self, op: ExpressionOperationT
|
65
|
-
) -> ExpressionOperationT:
|
66
|
-
new_expression = self._evaluate_expression(op.expression)
|
67
|
-
op_with_evaluated_types = op.model_copy(update={"expression": new_expression})
|
68
|
-
vrc = VarRefCollector()
|
69
|
-
vrc.visit(ast.parse(op_with_evaluated_types.expression.expr))
|
70
|
-
handles = vrc.var_handles
|
71
|
-
op_with_evaluated_types.set_var_handles(handles)
|
72
|
-
op_with_evaluated_types.initialize_var_types(
|
73
|
-
{
|
74
|
-
handle.name: self._interpreter.evaluate(handle)
|
75
|
-
.as_type(QuantumSymbol)
|
76
|
-
.quantum_type
|
77
|
-
for handle in handles
|
78
|
-
},
|
79
|
-
self._machine_precision,
|
80
|
-
)
|
81
|
-
return op_with_evaluated_types
|
82
|
-
|
83
|
-
@staticmethod
|
84
|
-
def _all_vars_boolean(op: QuantumExpressionOperation) -> bool:
|
85
|
-
if not all(
|
86
|
-
var_type.has_size_in_bits and var_type.size_in_bits == 1
|
87
|
-
for var_type in op.var_types.values()
|
88
|
-
):
|
89
|
-
return False
|
90
|
-
return not any(
|
91
|
-
isinstance(var_type, QuantumNumeric)
|
92
|
-
and (var_type.sign_value or var_type.fraction_digits_value > 0)
|
93
|
-
for var_type in op.var_types.values()
|
94
|
-
)
|
95
|
-
|
96
|
-
@staticmethod
|
97
|
-
def _is_res_boolean(op: Union[QuantumAssignmentOperation, Control]) -> bool:
|
98
|
-
if not (op.result_type.has_size_in_bits and op.result_type.size_in_bits == 1):
|
99
|
-
return False
|
100
|
-
return not (
|
101
|
-
isinstance(op.result_type, QuantumNumeric)
|
102
|
-
and (op.result_type.sign_value or op.result_type.fraction_digits_value > 0)
|
103
|
-
)
|