├── .github ├── CODEOWNERS ├── pull_request_template.md ├── scripts │ ├── get_m2m_token.sh │ └── join_qmod_metadata.py └── workflows │ ├── Internal-automatic-deployment.yml │ ├── Lint.yml │ ├── Notification-developers-onboarding.yml │ ├── Test-CI-daily.yml │ ├── Test-CI-main.yml │ └── Utils-deployment-qmod.yml ├── .gitignore ├── .internal ├── docs_directories.txt ├── paths_for_docs.yaml ├── pre_commit_tools │ ├── auto_add_tests.py │ ├── clean_timeouts.py │ ├── notebook_pre_commit_collection.py │ └── qmod_pre_commit_collection.py ├── update_outputs │ ├── fake_browser.sh │ ├── hook_add_random_seed.py │ ├── hook_remove_random_seed.py │ ├── update_notebooks.sh │ └── update_single_notebook.sh └── url_allow_list.txt ├── .pre-commit-config.yaml ├── CITATION.bib ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── LICENSE.txt ├── README.md ├── README_resources ├── Execution_Screenshot_3_plus_5.png ├── Jobs_Screenshot_3_plus_5.png ├── Model_Screenshot_3_plus_5.png ├── Program_Screenshot_3_plus_5.png ├── classiq-logo.svg └── writing_models.png ├── algorithms ├── README.md ├── algebraic │ ├── discrete_log │ │ ├── discrete_log.ipynb │ │ ├── discrete_log.metadata.json │ │ ├── discrete_log.qmod │ │ ├── discrete_log.synthesis_options.json │ │ ├── discrete_log_large.metadata.json │ │ ├── discrete_log_large.qmod │ │ └── discrete_log_large.synthesis_options.json │ ├── hidden_shift │ │ ├── hidden_shift.ipynb │ │ ├── hidden_shift_complex.metadata.json │ │ ├── hidden_shift_complex.qmod │ │ ├── hidden_shift_complex.synthesis_options.json │ │ ├── hidden_shift_no_dual.metadata.json │ │ ├── hidden_shift_no_dual.qmod │ │ ├── hidden_shift_no_dual.synthesis_options.json │ │ ├── hidden_shift_simple.metadata.json │ │ ├── hidden_shift_simple.qmod │ │ └── hidden_shift_simple.synthesis_options.json │ └── shor │ │ ├── doubly_controlled_modular_adder.metadata.json │ │ ├── doubly_controlled_modular_adder.qmod │ │ ├── doubly_controlled_modular_adder.synthesis_options.json │ │ ├── shor.ipynb │ │ ├── shor.metadata.json │ │ ├── shor.qmod │ │ └── shor.synthesis_options.json ├── amplitude_estimation │ ├── qmc_user_defined │ │ ├── qmc_user_defined.ipynb │ │ ├── qmc_user_defined.metadata.json │ │ ├── qmc_user_defined.qmod │ │ └── qmc_user_defined.synthesis_options.json │ └── quantum_counting │ │ ├── quantum_counting.ipynb │ │ ├── quantum_counting_iqae.metadata.json │ │ ├── quantum_counting_iqae.qmod │ │ ├── quantum_counting_iqae.synthesis_options.json │ │ ├── quantum_counting_qpe.metadata.json │ │ ├── quantum_counting_qpe.qmod │ │ └── quantum_counting_qpe.synthesis_options.json ├── aqc │ └── solving_qlsp │ │ ├── solving_qlsp_with_aqc.ipynb │ │ ├── solving_qlsp_with_aqc.metadata.json │ │ ├── solving_qlsp_with_aqc.qmod │ │ └── solving_qlsp_with_aqc.synthesis_options.json ├── bernstein_vazirani │ ├── bernstein_vazirani.ipynb │ ├── bernstein_vazirani_example.metadata.json │ ├── bernstein_vazirani_example.qmod │ └── bernstein_vazirani_example.synthesis_options.json ├── deutsch_jozsa │ ├── complex_deutsch_jozsa.metadata.json │ ├── complex_deutsch_jozsa.qmod │ ├── complex_deutsch_jozsa.synthesis_options.json │ ├── deutsch_jozsa.ipynb │ ├── simple_deutsch_jozsa.metadata.json │ ├── simple_deutsch_jozsa.qmod │ └── simple_deutsch_jozsa.synthesis_options.json ├── differential_equations │ ├── discrete_poisson_solver │ │ ├── discrete_poisson_solver.ipynb │ │ ├── discrete_poisson_solver.metadata.json │ │ ├── discrete_poisson_solver.qmod │ │ └── discrete_poisson_solver.synthesis_options.json │ ├── hhl_lanchester │ │ ├── hhl_lanchester.ipynb │ │ ├── hhl_lanchester.metadata.json │ │ ├── hhl_lanchester.qmod │ │ └── hhl_lanchester.synthesis_options.json │ └── time_marching │ │ ├── time_marching.ipynb │ │ ├── time_marching.metadata.json │ │ ├── time_marching.qmod │ │ └── time_marching.synthesis_options.json ├── dqi │ ├── dqi_max_xorsat.ipynb │ ├── dqi_max_xorsat.metadata.json │ ├── dqi_max_xorsat.qmod │ └── dqi_max_xorsat.synthesis_options.json ├── gibbs │ └── quantum_thermal_state_preparation.ipynb ├── glued_trees │ ├── figures │ │ ├── 10_qubits.png │ │ ├── 20_qubits.png │ │ ├── A_matrix.png │ │ └── glued_trees_diagram.png │ ├── glued_trees.ipynb │ ├── glued_trees_cache.json │ ├── glued_trees_example.metadata.json │ ├── glued_trees_example.qmod │ ├── glued_trees_example.synthesis_options.json │ └── results │ │ ├── 10-qubits │ │ ├── 2n+0.json │ │ ├── 2n+10.json │ │ ├── 2n+12.json │ │ ├── 2n+2.json │ │ ├── 2n+4.json │ │ ├── 2n+6.json │ │ ├── 2n+8.json │ │ ├── 2n-10.json │ │ ├── 2n-12.json │ │ ├── 2n-2.json │ │ ├── 2n-4.json │ │ ├── 2n-6.json │ │ └── 2n-8.json │ │ └── 20-qubits │ │ ├── 2n+0.json │ │ ├── 2n+10.json │ │ ├── 2n+12.json │ │ ├── 2n+2.json │ │ ├── 2n+4.json │ │ ├── 2n+6.json │ │ ├── 2n+8.json │ │ ├── 2n-10.json │ │ ├── 2n-12.json │ │ ├── 2n-2.json │ │ ├── 2n-4.json │ │ ├── 2n-6.json │ │ └── 2n-8.json ├── grover │ ├── 3_sat_grover │ │ ├── 3_sat_grover.ipynb │ │ ├── 3_sat_grover.metadata.json │ │ ├── 3_sat_grover.qmod │ │ ├── 3_sat_grover.synthesis_options.json │ │ ├── 3_sat_grover_large.metadata.json │ │ ├── 3_sat_grover_large.qmod │ │ └── 3_sat_grover_large.synthesis_options.json │ └── grover_max_cut │ │ ├── grover_max_cut.ipynb │ │ ├── grover_max_cut.metadata.json │ │ ├── grover_max_cut.qmod │ │ └── grover_max_cut.synthesis_options.json ├── hhl │ └── hhl │ │ ├── figures │ │ └── hhl_circuit.png │ │ ├── hhl.ipynb │ │ ├── hhl.synthesis_options.json │ │ ├── hhl_exact.metadata.json │ │ ├── hhl_exact.qmod │ │ ├── hhl_exact.synthesis_options.json │ │ ├── hhl_trotter.metadata.json │ │ ├── hhl_trotter.qmod │ │ └── hhl_trotter.synthesis_options.json ├── oblivious_amplitude_amplification │ ├── oblivious_amplitude_amplification.ipynb │ ├── oblivious_amplitude_amplification.metadata.json │ ├── oblivious_amplitude_amplification.qmod │ └── oblivious_amplitude_amplification.synthesis_options.json ├── qaoa │ ├── knapsack │ │ ├── qaoa_knapsack.ipynb │ │ ├── qaoa_knapsack.metadata.json │ │ ├── qaoa_knapsack.qmod │ │ └── qaoa_knapsack.synthesis_options.json │ └── maxcut │ │ ├── qaoa_max_cut.ipynb │ │ ├── qaoa_max_cut.metadata.json │ │ ├── qaoa_max_cut.qmod │ │ └── qaoa_max_cut.synthesis_options.json ├── qml │ ├── hybrid_qnn │ │ ├── hybrid_qnn_for_subset_majority.ipynb │ │ ├── neural_network.png │ │ └── trained_model.pth │ ├── qgan │ │ ├── qgan_bars_and_strips.ipynb │ │ └── resources │ │ │ ├── generator_trained_model.pth │ │ │ └── q_generator_trained_model.pth │ ├── qsvm │ │ ├── qsvm.ipynb │ │ ├── qsvm.metadata.json │ │ ├── qsvm.qmod │ │ └── qsvm.synthesis_options.json │ ├── qsvm_pauli_feature_map │ │ ├── qsvm_pauli_feature_map.ipynb │ │ ├── qsvm_pauli_feature_map.metadata.json │ │ ├── qsvm_pauli_feature_map.qmod │ │ └── qsvm_pauli_feature_map.synthesis_options.json │ └── quantum_autoencoder │ │ ├── figures │ │ ├── Autoencoder_structure.png │ │ ├── encoder_decoder.png │ │ ├── q_auto_encoder.png │ │ ├── qae_qlayer.png │ │ ├── swap_test_closed.png │ │ └── swap_test_opened.png │ │ └── quantum_autoencoder.ipynb ├── qpe │ └── qpe_for_matrix │ │ ├── qpe_for_matrix.ipynb │ │ ├── qpe_for_matrix.metadata.json │ │ ├── qpe_for_matrix.qmod │ │ └── qpe_for_matrix.synthesis_options.json ├── qsvt │ ├── qsvt_fixed_point_amplitude_amplification │ │ ├── qsvt_fixed_point_amplitude_amplification.ipynb │ │ ├── qsvt_fixed_point_amplitude_amplification.metadata.json │ │ ├── qsvt_fixed_point_amplitude_amplification.qmod │ │ └── qsvt_fixed_point_amplitude_amplification.synthesis_options.json │ └── qsvt_matrix_inversion │ │ ├── qsvt_matrix_inversion.ipynb │ │ ├── qsvt_matrix_inversion.metadata.json │ │ ├── qsvt_matrix_inversion.qmod │ │ └── qsvt_matrix_inversion.synthesis_options.json ├── simon │ ├── simon.ipynb │ ├── simon_example.metadata.json │ ├── simon_example.qmod │ ├── simon_example.synthesis_options.json │ ├── simon_shallow_example.metadata.json │ ├── simon_shallow_example.qmod │ └── simon_shallow_example.synthesis_options.json ├── swap_test │ ├── swap_test.ipynb │ ├── swap_test.metadata.json │ ├── swap_test.qmod │ └── swap_test.synthesis_options.json └── vqls │ └── lcu_vqls │ ├── vqls_with_lcu.ipynb │ ├── vqls_with_lcu.metadata.json │ ├── vqls_with_lcu.qmod │ └── vqls_with_lcu.synthesis_options.json ├── applications ├── automotive │ └── cooling_systems_optimization │ │ ├── block_encoding.metadata.json │ │ ├── block_encoding.qmod │ │ ├── block_encoding.synthesis_options.json │ │ ├── cooling_systems_optimization.ipynb │ │ ├── cooling_systems_optimization.metadata.json │ │ ├── cooling_systems_optimization.qmod │ │ ├── cooling_systems_optimization.synthesis_options.json │ │ ├── data │ │ └── costs.npy │ │ ├── matrix_inverse.metadata.json │ │ ├── matrix_inverse.qmod │ │ └── matrix_inverse.synthesis_options.json ├── benchmarking │ └── quantum_volume │ │ └── quantum_volume.ipynb ├── chemistry │ ├── molecular_energy_curve │ │ ├── molecular_energy_curve.ipynb │ │ ├── molecular_energy_curve.metadata.json │ │ ├── molecular_energy_curve.qmod │ │ └── molecular_energy_curve.synthesis_options.json │ ├── molecule_eigensolver │ │ ├── molecule_eigensolver.ipynb │ │ ├── molecule_eigensolver.metadata.json │ │ ├── molecule_eigensolver.qmod │ │ └── molecule_eigensolver.synthesis_options.json │ ├── molecule_eigensolver_using_openfermion │ │ ├── lih.xyz │ │ ├── molecule_eigensolver_using_openfermion.ipynb │ │ ├── vqe_uccLiH.qmod │ │ └── vqe_uccLiH.synthesis_options.json │ ├── protein_folding │ │ ├── protein_folding.ipynb │ │ ├── protein_folding.metadata.json │ │ ├── protein_folding.qmod │ │ └── protein_folding.synthesis_options.json │ ├── qpe_for_molecules │ │ ├── qpe_for_molecules.ipynb │ │ ├── qpe_for_molecules.metadata.json │ │ ├── qpe_for_molecules.qmod │ │ └── qpe_for_molecules.synthesis_options.json │ └── second_quantized_hamiltonian │ │ ├── second_quantized_hamiltonian.ipynb │ │ ├── second_quantized_hamiltonian.metadata.json │ │ ├── second_quantized_hamiltonian.qmod │ │ └── second_quantized_hamiltonian.synthesis_options.json ├── cybersecurity │ ├── link_monitoring │ │ ├── link_monitoring.ipynb │ │ ├── link_monitoring.metadata.json │ │ ├── link_monitoring.qmod │ │ └── link_monitoring.synthesis_options.json │ ├── patching_management │ │ ├── Attack_graph.jpg │ │ ├── Attack_path.png │ │ ├── patch_min_vertex_cover.ipynb │ │ ├── patch_min_vertex_cover.metadata.json │ │ ├── patch_min_vertex_cover.qmod │ │ └── patch_min_vertex_cover.synthesis_options.json │ └── whitebox_fuzzing │ │ ├── fuzzing.jpeg │ │ ├── oracle.jpg │ │ ├── whitebox_fuzzing.ipynb │ │ ├── whitebox_fuzzing.metadata.json │ │ ├── whitebox_fuzzing.qmod │ │ └── whitebox_fuzzing.synthesis_options.json ├── finance │ ├── autocallable_options │ │ ├── partial_exponential_state_preparation.ipynb │ │ └── quantum_autocallable_option_pricing.ipynb │ ├── credit_card_fraud │ │ ├── credit_card_fraud.ipynb │ │ ├── credit_card_fraud.metadata.json │ │ ├── credit_card_fraud.qmod │ │ └── credit_card_fraud.synthesis_options.json │ ├── option_pricing │ │ ├── option_pricing.ipynb │ │ ├── option_pricing.metadata.json │ │ ├── option_pricing.qmod │ │ └── option_pricing.synthesis_options.json │ ├── portfolio_optimization │ │ ├── portfolio_optimization.ipynb │ │ ├── portfolio_optimization.metadata.json │ │ ├── portfolio_optimization.qmod │ │ └── portfolio_optimization.synthesis_options.json │ ├── rainbow_options │ │ ├── rainbow_options_bruteforce_method.ipynb │ │ ├── rainbow_options_bruteforce_method.metadata.json │ │ ├── rainbow_options_bruteforce_method.qmod │ │ ├── rainbow_options_bruteforce_method.synthesis_options.json │ │ ├── rainbow_options_direct_method.ipynb │ │ ├── rainbow_options_direct_method.metadata.json │ │ ├── rainbow_options_direct_method.qmod │ │ ├── rainbow_options_direct_method.synthesis_options.json │ │ ├── rainbow_options_integration_method.ipynb │ │ ├── rainbow_options_integration_method.metadata.json │ │ ├── rainbow_options_integration_method.qmod │ │ └── rainbow_options_integration_method.synthesis_options.json │ └── resources │ │ └── creditcard.csv ├── logistics │ ├── facility_location │ │ ├── facility_location.ipynb │ │ ├── facility_location.metadata.json │ │ ├── facility_location.qmod │ │ └── facility_location.synthesis_options.json │ ├── task_scheduling_problem │ │ ├── task_scheduling_problem.ipynb │ │ ├── task_scheduling_problem.metadata.json │ │ ├── task_scheduling_problem.qmod │ │ ├── task_scheduling_problem.synthesis_options.json │ │ ├── task_scheduling_problem_large.metadata.json │ │ ├── task_scheduling_problem_large.qmod │ │ └── task_scheduling_problem_large.synthesis_options.json │ └── traveling_salesman_problem │ │ ├── traveling_saleman_problem.metadata.json │ │ ├── traveling_saleman_problem.qmod │ │ ├── traveling_saleman_problem.synthesis_options.json │ │ └── traveling_salesman_problem.ipynb ├── optimization │ ├── electric_grid_optimization │ │ ├── electric_grid_optimization.ipynb │ │ ├── electric_grid_optimization.metadata.json │ │ ├── electric_grid_optimization.qmod │ │ └── electric_grid_optimization.synthesis_options.json │ ├── integer_linear_programming │ │ ├── integer_linear_programming.ipynb │ │ ├── integer_linear_programming.metadata.json │ │ ├── integer_linear_programming.qmod │ │ └── integer_linear_programming.synthesis_options.json │ ├── max_clique │ │ ├── max_clique.ipynb │ │ ├── max_clique.metadata.json │ │ ├── max_clique.qmod │ │ └── max_clique.synthesis_options.json │ ├── max_independent_set │ │ ├── max_independent_set.ipynb │ │ ├── max_independent_set.metadata.json │ │ ├── max_independent_set.qmod │ │ └── max_independent_set.synthesis_options.json │ ├── max_induced_k_color_subgraph │ │ ├── max_induced_k_color_subgraph.ipynb │ │ ├── max_induced_k_color_subgraph.metadata.json │ │ ├── max_induced_k_color_subgraph.qmod │ │ └── max_induced_k_color_subgraph.synthesis_options.json │ ├── max_k_vertex_cover │ │ ├── max_k_vertex_cover.ipynb │ │ ├── max_k_vertex_cover.metadata.json │ │ ├── max_k_vertex_cover.qmod │ │ └── max_k_vertex_cover.synthesis_options.json │ ├── min_graph_coloring │ │ ├── min_graph_coloring.ipynb │ │ ├── min_graph_coloring.metadata.json │ │ ├── min_graph_coloring.qmod │ │ └── min_graph_coloring.synthesis_options.json │ ├── minimum_dominating_set │ │ ├── minimum_dominating_set.ipynb │ │ ├── minimum_dominating_set.metadata.json │ │ ├── minimum_dominating_set.qmod │ │ └── minimum_dominating_set.synthesis_options.json │ ├── rectangles_packing │ │ ├── floorplan_example_bigger.png │ │ ├── rectangles_packing.metadata.json │ │ ├── rectangles_packing.qmod │ │ ├── rectangles_packing.synthesis_options.json │ │ └── rectangles_packing_grid.ipynb │ ├── set_cover │ │ ├── set_cover.ipynb │ │ ├── set_cover.metadata.json │ │ ├── set_cover.qmod │ │ └── set_cover.synthesis_options.json │ └── set_partition │ │ ├── set_partition.ipynb │ │ ├── set_partition.metadata.json │ │ ├── set_partition.qmod │ │ └── set_partition.synthesis_options.json └── physical_systems │ └── ising_model │ ├── ising_model.ipynb │ ├── ising_model.metadata.json │ ├── ising_model.qmod │ └── ising_model.synthesis_options.json ├── community ├── Hackathons │ ├── QInnovision_2025 │ │ └── advection_equation │ │ │ ├── advection_equation_2nd_place_submission.ipynb │ │ │ └── advection_equation_winning_submission.ipynb │ └── iQuHack_2025 │ │ ├── Challenge │ │ └── classiq_iQuHack_2025_final.ipynb │ │ ├── Challenge_solution │ │ ├── our_solution │ │ │ └── classiq_iQuHack_2025_final_sol.ipynb │ │ └── winning_solution │ │ │ └── classiq_iQuHack_2025_quantum_tree_sol.ipynb │ │ └── Workshop │ │ └── WS_iQuHack_2025_final.ipynb ├── QClass_2024 │ ├── Algorithm_Implementation │ │ ├── kidney_transplant_problems_Bill_Wisotsky.ipynb │ │ └── qnn_for_XOR_problem_Claudia_Zendejas_Morales.ipynb │ ├── Assignments │ │ ├── HW1_QClass2024.ipynb │ │ ├── HW2_QClass2024.ipynb │ │ └── Preparation_for_Week2_Git_GitHub.ipynb │ ├── README.md │ └── Sessions │ │ └── week1_QClass_workshop_with_sol.ipynb ├── basic_examples │ ├── entanglement │ │ ├── bell_state_of_2_qubits.qmod │ │ ├── bell_state_of_2_qubits.synthesis_options.json │ │ └── entanglement.ipynb │ ├── hw_aware_synthesis │ │ ├── hardware_aware_mcx_grid.qmod │ │ ├── hardware_aware_mcx_grid.synthesis_options.json │ │ ├── hardware_aware_mcx_star.qmod │ │ ├── hardware_aware_mcx_star.synthesis_options.json │ │ ├── hw_aware_synthesis.ipynb │ │ ├── mcx_10_ctrl_depth.qmod │ │ └── mcx_10_ctrl_depth.synthesis_options.json │ ├── logical_qubits │ │ └── logical_qubits_by_alice_and_bob.ipynb │ ├── superposition │ │ ├── equal_superposition_3_qubits.qmod │ │ ├── equal_superposition_3_qubits.synthesis_options.json │ │ └── superposition.ipynb │ └── vqe │ │ ├── vqe.ipynb │ │ ├── vqe_primitives.qmod │ │ └── vqe_primitives.synthesis_options.json └── paper_implementation_project │ ├── bb84 │ ├── bb84_implementation.ipynb │ ├── bb84_implementation.metadata.json │ ├── bb84_implementation.qmod │ └── bb84_implementation.synthesis_options.json │ ├── bpde │ ├── bpde.ipynb │ ├── bpde.metadata.json │ ├── bpde.qmod │ └── bpde.synthesis_options.json │ ├── explicit_quantum_circuits_for_block_encoding │ ├── extended_binary_tree_matrix_block_encoding.metadata.json │ ├── extended_binary_tree_matrix_block_encoding.qmod │ ├── extended_binary_tree_matrix_block_encoding.synthesis_options.json │ ├── quantum_walks_via_efficient_blockencoding.ipynb │ ├── stochastic_bandedcirculant_matrix_block_encoding.metadata.json │ ├── stochastic_bandedcirculant_matrix_block_encoding.qmod │ └── stochastic_bandedcirculant_matrix_block_encoding.synthesis_options.json │ ├── index.md │ ├── quantum_algo_for_solving_linear_differential_equations │ ├── harmonic_oscillator.ipynb │ ├── harmonic_oscillator.metadata.json │ ├── harmonic_oscillator.qmod │ └── harmonic_oscillator.synthesis_options.json │ ├── quantum_compression_algorithm_for_symmetric_states │ ├── quantum_compression_algorithm_for_symmetric_states.ipynb │ ├── quantum_compression_algorithm_for_symmetric_states.metadata.json │ ├── quantum_compression_algorithm_for_symmetric_states.qmod │ └── quantum_compression_algorithm_for_symmetric_states.synthesis_options.json │ └── quantum_state_preparation_without_coherent_arithmetic │ ├── stateprep_guassian_using_qsvt.ipynb │ ├── stateprep_guassian_using_qsvt.metadata.json │ ├── stateprep_guassian_using_qsvt.qmod │ └── stateprep_guassian_using_qsvt.synthesis_options.json ├── functions ├── function_declarations │ ├── builtin_operator_decls.qmod │ ├── core_lib_decls.qmod │ └── open_lib_decls.qmod ├── function_usage_examples │ ├── arithmetic │ │ ├── arithmetic_expression │ │ │ ├── arithmetic_expression_example.ipynb │ │ │ ├── arithmetic_expression_example.metadata.json │ │ │ ├── arithmetic_expression_example.qmod │ │ │ └── arithmetic_expression_example.synthesis_options.json │ │ ├── bitwise_and │ │ │ ├── bitwise_and_2vars_example.metadata.json │ │ │ ├── bitwise_and_2vars_example.qmod │ │ │ ├── bitwise_and_2vars_example.synthesis_options.json │ │ │ ├── bitwise_and_example.ipynb │ │ │ ├── bitwise_and_integer_example.metadata.json │ │ │ ├── bitwise_and_integer_example.qmod │ │ │ └── bitwise_and_integer_example.synthesis_options.json │ │ ├── bitwise_invert │ │ │ ├── bitwise_invert_example.ipynb │ │ │ ├── bitwise_invert_example.metadata.json │ │ │ ├── bitwise_invert_example.qmod │ │ │ └── bitwise_invert_example.synthesis_options.json │ │ ├── bitwise_or │ │ │ ├── bitwise_or_2vars_example.metadata.json │ │ │ ├── bitwise_or_2vars_example.qmod │ │ │ ├── bitwise_or_2vars_example.synthesis_options.json │ │ │ ├── bitwise_or_example.ipynb │ │ │ ├── bitwise_or_integer_example.metadata.json │ │ │ ├── bitwise_or_integer_example.qmod │ │ │ └── bitwise_or_integer_example.synthesis_options.json │ │ ├── bitwise_xor │ │ │ ├── bitwise_xor_2vars_example.metadata.json │ │ │ ├── bitwise_xor_2vars_example.qmod │ │ │ ├── bitwise_xor_2vars_example.synthesis_options.json │ │ │ ├── bitwise_xor_example.ipynb │ │ │ ├── bitwise_xor_integer_example.metadata.json │ │ │ ├── bitwise_xor_integer_example.qmod │ │ │ └── bitwise_xor_integer_example.synthesis_options.json │ │ ├── comparator │ │ │ ├── comparator_2vars_example.metadata.json │ │ │ ├── comparator_2vars_example.qmod │ │ │ ├── comparator_2vars_example.synthesis_options.json │ │ │ ├── comparator_example.ipynb │ │ │ ├── comparator_integer_example.metadata.json │ │ │ ├── comparator_integer_example.qmod │ │ │ └── comparator_integer_example.synthesis_options.json │ │ ├── extremum │ │ │ ├── extremum_example.ipynb │ │ │ ├── maximum_float_example.metadata.json │ │ │ ├── maximum_float_example.qmod │ │ │ ├── maximum_float_example.synthesis_options.json │ │ │ ├── maximum_integer_example.qmod │ │ │ ├── maximum_integer_example.synthesis_options.json │ │ │ ├── minimum_2vars_example.metadata.json │ │ │ ├── minimum_2vars_example.qmod │ │ │ └── minimum_2vars_example.synthesis_options.json │ │ ├── modular_exp │ │ │ ├── modular_exp_example.ipynb │ │ │ ├── modular_exp_example.metadata.json │ │ │ ├── modular_exp_example.qmod │ │ │ └── modular_exp_example.synthesis_options.json │ │ ├── modulo │ │ │ ├── modulo_example.ipynb │ │ │ ├── modulo_example.metadata.json │ │ │ ├── modulo_example.qmod │ │ │ └── modulo_example.synthesis_options.json │ │ ├── multiplication │ │ │ ├── multiplication.ipynb │ │ │ ├── multiplication_2vars_example.metadata.json │ │ │ ├── multiplication_2vars_example.qmod │ │ │ ├── multiplication_2vars_example.synthesis_options.json │ │ │ ├── multiplication_float_example.metadata.json │ │ │ ├── multiplication_float_example.qmod │ │ │ └── multiplication_float_example.synthesis_options.json │ │ ├── negation │ │ │ ├── negation_example.ipynb │ │ │ ├── negation_example.metadata.json │ │ │ ├── negation_example.qmod │ │ │ └── negation_example.synthesis_options.json │ │ └── subtraction │ │ │ ├── subtraction_2vars_example.metadata.json │ │ │ ├── subtraction_2vars_example.qmod │ │ │ ├── subtraction_2vars_example.synthesis_options.json │ │ │ ├── subtraction_example.ipynb │ │ │ ├── subtraction_float_example.metadata.json │ │ │ ├── subtraction_float_example.qmod │ │ │ └── subtraction_float_example.synthesis_options.json │ └── mcx │ │ ├── mcx_example.ipynb │ │ ├── mcx_example.metadata.json │ │ ├── mcx_example.qmod │ │ └── mcx_example.synthesis_options.json ├── open_library_definitions │ ├── _check_msb.qmod │ ├── _ctrl_x.qmod │ ├── _prepare_uniform_trimmed_state_step.qmod │ ├── _qct_d_operator.qmod │ ├── _qct_pi_operator.qmod │ ├── _single_pauli.qmod │ ├── allocate_num.qmod │ ├── amplitude_estimation.qmod │ ├── apply_to_all.qmod │ ├── c_modular_multiply.qmod │ ├── cc_modular_add.qmod │ ├── encode_in_angle.qmod │ ├── encode_on_bloch.qmod │ ├── full_hea.qmod │ ├── grover_diffuser.qmod │ ├── grover_operator.qmod │ ├── grover_search.qmod │ ├── hadamard_transform.qmod │ ├── inplace_c_modular_multiply.qmod │ ├── inplace_prepare_int.qmod │ ├── linear_pauli_rotations.qmod │ ├── modular_exp.qmod │ ├── modular_increment.qmod │ ├── multiswap.qmod │ ├── phase_oracle.qmod │ ├── prepare_bell_state.qmod │ ├── prepare_exponential_state.qmod │ ├── prepare_ghz_state.qmod │ ├── prepare_int.qmod │ ├── prepare_uniform_interval_state.qmod │ ├── prepare_uniform_trimmed_state.qmod │ ├── projector_controlled_phase.qmod │ ├── qaoa_cost_layer.qmod │ ├── qaoa_init.qmod │ ├── qaoa_layer.qmod │ ├── qaoa_mixer_layer.qmod │ ├── qaoa_penalty.qmod │ ├── qct_qst_type1.qmod │ ├── qct_qst_type2.qmod │ ├── qct_type2.qmod │ ├── qft.qmod │ ├── qft_no_swap.qmod │ ├── qft_space_add_const.qmod │ ├── qpe.qmod │ ├── qpe_flexible.qmod │ ├── qst_type2.qmod │ ├── qsvt.qmod │ ├── qsvt_inversion.qmod │ ├── qsvt_step.qmod │ ├── reflect_about_zero.qmod │ ├── swap_test.qmod │ └── switch.qmod └── qmod_library_reference │ ├── classiq_open_library │ ├── grover_operator │ │ ├── grover_operator.ipynb │ │ ├── grover_operator.metadata.json │ │ ├── grover_operator.qmod │ │ └── grover_operator.synthesis_options.json │ ├── hadamard_transform │ │ ├── hadamard_transform.ipynb │ │ ├── hadamard_transform.metadata.json │ │ ├── hadamard_transform.qmod │ │ └── hadamard_transform.synthesis_options.json │ ├── linear_pauli_rotations │ │ ├── linear_pauli_rotations.ipynb │ │ ├── linear_pauli_rotations.metadata.json │ │ ├── linear_pauli_rotations.qmod │ │ └── linear_pauli_rotations.synthesis_options.json │ ├── qct_qst │ │ ├── qct_qst.ipynb │ │ ├── qct_qst_type1.metadata.json │ │ ├── qct_qst_type1.qmod │ │ ├── qct_qst_type1.synthesis_options.json │ │ ├── qct_qst_type2.metadata.json │ │ ├── qct_qst_type2.qmod │ │ ├── qct_qst_type2.synthesis_options.json │ │ ├── qct_type2.metadata.json │ │ ├── qct_type2.qmod │ │ ├── qct_type2.synthesis_options.json │ │ ├── qft.synthesis_options.json │ │ ├── qst_type2.metadata.json │ │ ├── qst_type2.qmod │ │ └── qst_type2.synthesis_options.json │ ├── qft │ │ ├── qft.ipynb │ │ ├── qft.metadata.json │ │ ├── qft.qmod │ │ └── qft.synthesis_options.json │ ├── qpe │ │ ├── qpe.ipynb │ │ ├── qpe.metadata.json │ │ ├── qpe.qmod │ │ ├── qpe.synthesis_options.json │ │ ├── qpe_flexible.metadata.json │ │ ├── qpe_flexible.qmod │ │ └── qpe_flexible.synthesis_options.json │ ├── qsvt │ │ ├── qsvt.ipynb │ │ ├── qsvt.metadata.json │ │ ├── qsvt.qmod │ │ └── qsvt.synthesis_options.json │ ├── special_state_preparations │ │ ├── prepare_bell_state.ipynb │ │ ├── prepare_bell_state.metadata.json │ │ ├── prepare_bell_state.qmod │ │ ├── prepare_bell_state.synthesis_options.json │ │ ├── prepare_exponential_state.ipynb │ │ ├── prepare_exponential_state.metadata.json │ │ ├── prepare_exponential_state.qmod │ │ ├── prepare_exponential_state.synthesis_options.json │ │ ├── prepare_ghz_state.ipynb │ │ ├── prepare_ghz_state.metadata.json │ │ ├── prepare_ghz_state.qmod │ │ ├── prepare_ghz_state.synthesis_options.json │ │ ├── prepare_partial_uniform_state.ipynb │ │ ├── prepare_uniform_interval_state.json │ │ ├── prepare_uniform_interval_state.qmod │ │ ├── prepare_uniform_interval_state.synthesis_options.json │ │ ├── prepare_uniform_trimmed_state.json │ │ ├── prepare_uniform_trimmed_state.qmod │ │ └── prepare_uniform_trimmed_state.synthesis_options.json │ └── variational_data_encoding │ │ ├── encode_in_angle.metadata.json │ │ ├── encode_in_angle.qmod │ │ ├── encode_in_angle.synthesis_options.json │ │ ├── encode_on_bloch.metadata.json │ │ ├── encode_on_bloch.qmod │ │ ├── encode_on_bloch.synthesis_options.json │ │ ├── figures │ │ ├── angle_encoding_circuit.png │ │ └── dense_angle_encoding_circuit.png │ │ └── variational_data_encoding.ipynb │ └── qmod_core_library │ ├── hamiltonian_evolution │ ├── exponentiation │ │ ├── hamiltonian_evolution_exponentiation.ipynb │ │ ├── hamiltonian_evolution_exponentiation.metadata.json │ │ ├── hamiltonian_evolution_exponentiation.qmod │ │ └── hamiltonian_evolution_exponentiation.synthesis_options.json │ ├── qdrift │ │ ├── qdrift.ipynb │ │ ├── qdrift.metadata.json │ │ ├── qdrift.qmod │ │ └── qdrift.synthesis_options.json │ └── suzuki_trotter │ │ ├── suzuki_trotter.ipynb │ │ ├── suzuki_trotter.metadata.json │ │ ├── suzuki_trotter.qmod │ │ └── suzuki_trotter.synthesis_options.json │ ├── prepare_state_and_amplitudes │ ├── example_prepare_amplitudes.metadata.json │ ├── example_prepare_amplitudes.qmod │ ├── example_prepare_amplitudes.synthesis_options.json │ ├── example_prepare_state.metadata.json │ ├── example_prepare_state.qmod │ ├── example_prepare_state.synthesis_options.json │ └── prepare_state_and_amplitudes.ipynb │ ├── standard_gates │ ├── CRX.metadata.json │ ├── CRX.qmod │ ├── CRX.synthesis_options.json │ ├── CX.metadata.json │ ├── CX.qmod │ ├── CX.synthesis_options.json │ ├── PHASE.metadata.json │ ├── PHASE.qmod │ ├── PHASE.synthesis_options.json │ ├── R.metadata.json │ ├── R.qmod │ ├── R.synthesis_options.json │ ├── RZ.metadata.json │ ├── RZ.qmod │ ├── RZ.synthesis_options.json │ ├── RZZ.metadata.json │ ├── RZZ.qmod │ ├── RZZ.synthesis_options.json │ ├── SWAP.metadata.json │ ├── SWAP.qmod │ ├── SWAP.synthesis_options.json │ ├── U.metadata.json │ ├── U.qmod │ ├── U.synthesis_options.json │ ├── X.metadata.json │ ├── X.qmod │ ├── X.synthesis_options.json │ └── standard_gates.ipynb │ └── unitary │ ├── unitary.ipynb │ ├── unitary.metadata.json │ ├── unitary.qmod │ └── unitary.synthesis_options.json ├── pyproject.toml ├── requirements.txt ├── requirements_tests.txt ├── tests ├── config_notebook_execute_tests.ini ├── config_quick_tests.ini ├── internal │ ├── pre_commit_tools │ ├── test_paths_for_docs.py │ └── test_pre_commit.py ├── notebooks │ ├── classiq_paper │ │ ├── test_classiq_discrete_quantum_walk.py │ │ ├── test_classiq_qsvt.py │ │ ├── test_pennylane_cat_qsvt_example.py │ │ ├── test_pennylane_catalyst_discrete_quantum_walk.py │ │ ├── test_qiskit_discrete_quantum_walk.py │ │ ├── test_qiskit_qsvt.py │ │ ├── test_tket_discrete_quantum_walk.py │ │ └── test_tket_qsvt_example.py │ ├── test_3_sat_grover.py │ ├── test_3sat_oracles.py │ ├── test__community_and_functions.py │ ├── test_approximated_state_preparation.py │ ├── test_arithmetic_expressions.py │ ├── test_auxiliary_management.py │ ├── test_bernstein_vazirani.py │ ├── test_bpde.py │ ├── test_cooling_systems_optimization.py │ ├── test_credit_card_fraud.py │ ├── test_deutsch_jozsa.py │ ├── test_discrete_log.py │ ├── test_discrete_poisson_solver.py │ ├── test_discrete_quantum_walk.py │ ├── test_discrete_quantum_walk_circle.py │ ├── test_dqi_max_xorsat.py │ ├── test_electric_grid_optimization.py │ ├── test_example_exponentiation.py │ ├── test_facility_location.py │ ├── test_glued_trees.py │ ├── test_grover_max_cut.py │ ├── test_hamiltonian_evolution.py │ ├── test_hamiltonian_simulation_guide.py │ ├── test_hamiltonian_simulation_with_block_encoding.py │ ├── test_hardware_aware_mcx.py │ ├── test_hhl.py │ ├── test_hhl_example.py │ ├── test_hhl_lanchester.py │ ├── test_hidden_shift.py │ ├── test_high_level_modeling_flexible_qpe.py │ ├── test_hybrid_qnn_for_subset_majority.py │ ├── test_integer_linear_programming.py │ ├── test_ising_model.py │ ├── test_learning_optimization.py │ ├── test_linear_combination_of_unitaries.py │ ├── test_link_monitoring.py │ ├── test_logical_qubits_by_alice_and_bob.py │ ├── test_max_clique.py │ ├── test_max_independent_set.py │ ├── test_max_induced_k_color_subgraph.py │ ├── test_max_k_vertex_cover.py │ ├── test_mcx.py │ ├── test_min_graph_coloring.py │ ├── test_minimum_dominating_set.py │ ├── test_molecular_energy_curve.py │ ├── test_molecule_eigensolver.py │ ├── test_molecule_eigensolver_using_openfermion.py │ ├── test_oblivious_amplitude_amplification.py │ ├── test_option_pricing.py │ ├── test_partial_exponential_state_preparation.py │ ├── test_patch_min_vertex_cover.py │ ├── test_portfolio_optimization.py │ ├── test_prepare_state.py │ ├── test_protein_folding.py │ ├── test_qaoa.py │ ├── test_qaoa_knapsack.py │ ├── test_qaoa_max_cut.py │ ├── test_qgan_bars_and_strips.py │ ├── test_qmc_user_defined.py │ ├── test_qml_with_classiq_guide.py │ ├── test_qpe_for_grover_operator.py │ ├── test_qpe_for_matrix.py │ ├── test_qpe_for_molecules.py │ ├── test_qpe_for_unitary_matrix.py │ ├── test_qsvm.py │ ├── test_qsvm_pauli_feature_map.py │ ├── test_qsvt_fixed_point_amplitude_amplification.py │ ├── test_qsvt_matrix_inversion.py │ ├── test_quantum_autocallable_option_pricing.py │ ├── test_quantum_autoencoder.py │ ├── test_quantum_counting.py │ ├── test_quantum_thermal_state_preparation.py │ ├── test_quantum_volume.py │ ├── test_quantum_walks_via_efficient_blockencoding.py │ ├── test_rainbow_options_bruteforce_method.py │ ├── test_rainbow_options_direct_method.py │ ├── test_rainbow_options_integration_method.py │ ├── test_rectangles_packing.py │ ├── test_rectangles_packing_grid.py │ ├── test_second_quantized_hamiltonian.py │ ├── test_set_cover.py │ ├── test_set_partition.py │ ├── test_shor.py │ ├── test_simon.py │ ├── test_solving_qlsp_with_aqc.py │ ├── test_stateprep_guassian_using_qsvt.py │ ├── test_swap_test.py │ ├── test_task_scheduling_problem.py │ ├── test_time_marching.py │ ├── test_traveling_salesman_problem.py │ ├── test_vqls_with_lcu.py │ ├── test_whitebox_fuzzing.py │ └── workshops │ │ ├── test_Option_Pricing_Workshop.py │ │ ├── test_QMOD_Workshop_Part_1.py │ │ ├── test_QMOD_Workshop_Part_2.py │ │ ├── test_QMOD_Workshop_Part_3.py │ │ ├── test_Qmod_tutorial_part1.py │ │ ├── test_Qmod_tutorial_part2.py │ │ ├── test_Qmod_workshop4finance.py │ │ ├── test_analyze.py │ │ ├── test_classical_variables_and_operations.py │ │ ├── test_classiq_overview_tutorial.py │ │ ├── test_combi_workshop_Inequality_constriants_PO.py │ │ ├── test_combi_workshop_equality_constriants_PO.py │ │ ├── test_combinatorial_qmod_workshop_for_maxcut.py │ │ ├── test_design.py │ │ ├── test_execute.py │ │ ├── test_grover_workshop.py │ │ ├── test_hadamard_test.py │ │ ├── test_hello_many_worlds.py │ │ ├── test_hhl_workshop.py │ │ ├── test_optimize.py │ │ ├── test_part1_arithmetic.py │ │ ├── test_part2_state_preparation.py │ │ ├── test_part3_deutsch_jozsa.py │ │ ├── test_part4_ghz_state.py │ │ ├── test_part5_grover.py │ │ ├── test_phase_kickback.py │ │ ├── test_quantum_operations.py │ │ ├── test_quantum_variables_and_functions.py │ │ ├── test_synthesis_tutorial.py │ │ └── test_whats_classiq.py ├── resources │ └── timeouts.yaml ├── test_all_notebooks_are_tested.py ├── test_dummy.py ├── test_links.py ├── test_no_errors.py ├── utils_for_testbook.py └── utils_for_tests.py └── tutorials ├── advanced_tutorials ├── discrete_quantum_walk │ ├── discrete_quantum_walk.ipynb │ ├── quantum_walk_circle.metadata.json │ ├── quantum_walk_circle.qmod │ ├── quantum_walk_circle.synthesis_options.json │ ├── quantum_walk_circle_balanced_coin.metadata.json │ ├── quantum_walk_circle_balanced_coin.qmod │ ├── quantum_walk_circle_balanced_coin.synthesis_options.json │ ├── quantum_walk_hypercube.metadata.json │ ├── quantum_walk_hypercube.qmod │ └── quantum_walk_hypercube.synthesis_options.json ├── high_level_modeling_flexible_qpe │ └── high_level_modeling_flexible_qpe.ipynb └── linear_approximation_of_tanh │ ├── tanh.metadata.json │ ├── tanh.qmod │ └── tanh.synthesis_options.json ├── basic_tutorials ├── add_bell_states │ ├── add_bell_states.metadata.json │ ├── add_bell_states.qmod │ └── add_bell_states.synthesis_options.json ├── exponentiation │ ├── example_exponentiation.ipynb │ ├── example_exponentiation.metadata.json │ ├── example_exponentiation.qmod │ ├── example_exponentiation.synthesis_options.json │ ├── example_exponentiation_minimize_error.metadata.json │ ├── example_exponentiation_minimize_error.qmod │ └── example_exponentiation_minimize_error.synthesis_options.json ├── hamiltonian_simulation │ ├── hamiltonian_simulation_guide │ │ ├── hamiltonian_simulation_guide.ipynb │ │ ├── hamiltonian_simulation_guide_exponentiation.metadata.json │ │ ├── hamiltonian_simulation_guide_exponentiation.qmod │ │ ├── hamiltonian_simulation_guide_exponentiation.synthesis_options.json │ │ ├── hamiltonian_simulation_guide_qdrift.metadata.json │ │ ├── hamiltonian_simulation_guide_qdrift.qmod │ │ ├── hamiltonian_simulation_guide_qdrift.synthesis_options.json │ │ ├── hamiltonian_simulation_guide_trotter.metadata.json │ │ ├── hamiltonian_simulation_guide_trotter.qmod │ │ └── hamiltonian_simulation_guide_trotter.synthesis_options.json │ └── hamiltonian_simulation_with_block_encoding │ │ ├── hamiltonian_simulation_qsvt.metadata.json │ │ ├── hamiltonian_simulation_qsvt.qmod │ │ ├── hamiltonian_simulation_qsvt.synthesis_options.json │ │ ├── hamiltonian_simulation_qubitization.metadata.json │ │ ├── hamiltonian_simulation_qubitization.qmod │ │ ├── hamiltonian_simulation_qubitization.synthesis_options.json │ │ ├── hamiltonian_simulation_with_block_encoding.ipynb │ │ └── test.synthesis_options.json ├── mcx │ ├── mcx.ipynb │ ├── mcx_14_ctrl_cx.metadata.json │ ├── mcx_14_ctrl_cx.qmod │ ├── mcx_14_ctrl_cx.synthesis_options.json │ ├── mcx_14_ctrl_depth.metadata.json │ ├── mcx_14_ctrl_depth.qmod │ ├── mcx_14_ctrl_depth.synthesis_options.json │ ├── mcx_14_ctrl_hardware.metadata.json │ ├── mcx_14_ctrl_hardware.qmod │ ├── mcx_14_ctrl_hardware.synthesis_options.json │ ├── mcx_50_ctrl.metadata.json │ ├── mcx_50_ctrl.qmod │ └── mcx_50_ctrl.synthesis_options.json ├── optimization │ └── learning_optimization.ipynb ├── prepare_state │ ├── prepare_state.ipynb │ ├── prepare_state.metadata.json │ ├── prepare_state.qmod │ └── prepare_state.synthesis_options.json ├── qml_with_classiq_guide │ ├── qml_with_classiq_guide.ipynb │ ├── qnn_with_pytorch.metadata.json │ ├── qnn_with_pytorch.qmod │ ├── qnn_with_pytorch.synthesis_options.json │ ├── vqe_primitive.metadata.json │ ├── vqe_primitive.qmod │ └── vqe_primitive.synthesis_options.json └── the_classiq_tutorial │ ├── Qmod_tutorial_part1.ipynb │ ├── Qmod_tutorial_part2.ipynb │ ├── classiq_overview_tutorial.ipynb │ └── synthesis_tutorial.ipynb ├── classiq_101 ├── classiq_concepts │ ├── analyze │ │ ├── analyze.ipynb │ │ ├── analyze.metadata.json │ │ ├── analyze.qmod │ │ └── analyze.synthesis_options.json │ ├── design │ │ ├── classical_variables_and_operations │ │ │ ├── classical_variables_and_operations.ipynb │ │ │ ├── classical_variables_and_operations.metadata.json │ │ │ ├── classical_variables_and_operations.qmod │ │ │ └── classical_variables_and_operations.synthesis_options.json │ │ ├── design │ │ │ ├── design.ipynb │ │ │ ├── design.metadata.json │ │ │ ├── design.qmod │ │ │ └── design.synthesis_options.json │ │ ├── quantum_operations │ │ │ ├── quantum_operations.ipynb │ │ │ ├── quantum_operations.metadata.json │ │ │ ├── quantum_operations.qmod │ │ │ └── quantum_operations.synthesis_options.json │ │ └── quantum_variables_and_functions │ │ │ ├── quantum_variables_and_functions.ipynb │ │ │ ├── quantum_variables_and_functions.metadata.json │ │ │ ├── quantum_variables_and_functions.qmod │ │ │ └── quantum_variables_and_functions.synthesis_options.json │ ├── execute │ │ ├── execute.ipynb │ │ ├── execute.metadata.json │ │ ├── execute.qmod │ │ └── execute.synthesis_options.json │ └── optimize │ │ ├── optimize.ipynb │ │ ├── optimize.metadata.json │ │ ├── optimize.qmod │ │ └── optimize.synthesis_options.json ├── getting_started │ ├── part1_arithmetic.ipynb │ ├── part2_state_preparation.ipynb │ ├── part3_deutsch_jozsa.ipynb │ ├── part4_ghz_state.ipynb │ └── part5_grover.ipynb ├── hello_many_worlds │ ├── hello_many_worlds.ipynb │ ├── hello_many_worlds.qmod │ └── hello_many_worlds.synthesis_options.json ├── quantum_primitives │ ├── hadamard_test │ │ ├── hadamard_test.ipynb │ │ ├── hadamard_test.metadata.json │ │ ├── hadamard_test.qmod │ │ └── hadamard_test.synthesis_options.json │ ├── linear_combination_of_unitaries │ │ ├── linear_combination_of_unitaries.ipynb │ │ ├── linear_combination_of_unitaries.metadata.json │ │ ├── linear_combination_of_unitaries.qmod │ │ └── linear_combination_of_unitaries.synthesis_options.json │ └── phase_kickback │ │ ├── phase_kickback.ipynb │ │ ├── phase_kickback.metadata.json │ │ ├── phase_kickback.qmod │ │ └── phase_kickback.synthesis_options.json └── whats_classiq │ ├── whats_classiq.ipynb │ ├── whats_classiq.metadata.json │ ├── whats_classiq.qmod │ └── whats_classiq.synthesis_options.json ├── technology_demonstrations ├── approximated_state_preparation │ └── approximated_state_preparation.ipynb ├── arithmetic_expressions │ ├── arithmetic_demo_12_qubits.metadata.json │ ├── arithmetic_demo_12_qubits.qmod │ ├── arithmetic_demo_12_qubits.synthesis_options.json │ ├── arithmetic_demo_9_qubits.metadata.json │ ├── arithmetic_demo_9_qubits.qmod │ ├── arithmetic_demo_9_qubits.synthesis_options.json │ └── arithmetic_expressions.ipynb ├── auxiliary_managment │ └── auxiliary_management.ipynb ├── classiq_paper │ ├── qsvt │ │ ├── classiq_qsvt.ipynb │ │ ├── pennylane_cat_qsvt_example.ipynb │ │ ├── qiskit_qsvt.ipynb │ │ └── tket_qsvt_example.ipynb │ └── quantum_walk │ │ ├── classiq_discrete_quantum_walk.ipynb │ │ ├── pennylane_catalyst_discrete_quantum_walk.ipynb │ │ ├── qiskit_discrete_quantum_walk.ipynb │ │ └── tket_discrete_quantum_walk.ipynb ├── discrete_quantum_walk_circle │ ├── discrete_quantum_walk_circle.ipynb │ └── results.csv ├── hamiltonian_evolution │ └── hamiltonian_evolution.ipynb ├── hardware_aware_mcx │ ├── hardware_aware_mcx.ipynb │ ├── hardware_aware_mcx_all_to_all.metadata.json │ ├── hardware_aware_mcx_all_to_all.qmod │ ├── hardware_aware_mcx_all_to_all.synthesis_options.json │ ├── hardware_aware_mcx_linear.metadata.json │ ├── hardware_aware_mcx_linear.qmod │ └── hardware_aware_mcx_linear.synthesis_options.json ├── hhl │ └── hhl_example.ipynb ├── oracle_generation │ └── 3sat_oracles.ipynb ├── qaoa │ ├── qaoa.ipynb │ └── qiskit_res.npy └── qpe │ ├── qpe_for_grover_operator │ └── qpe_for_grover_operator.ipynb │ └── qpe_for_unitary_matrix │ └── qpe_for_unitary_matrix.ipynb └── workshops ├── QMOD_workshop ├── QMOD_Workshop_Part_1.ipynb ├── QMOD_Workshop_Part_2.ipynb └── QMOD_Workshop_Part_3.ipynb ├── combinatorial_workshop └── combinatorial_qmod_workshop_for_maxcut.ipynb ├── finance_workshops ├── Option_Pricing_Workshop.ipynb ├── Qmod_workshop4finance.ipynb ├── combi_workshop_Inequality_constriants_PO.ipynb └── combi_workshop_equality_constriants_PO.ipynb ├── grover_workshop ├── assets │ ├── graph1.jpg │ ├── graph2.jpg │ ├── oracle1.jpg │ └── oracle2.jpg ├── grover_workshop.ipynb ├── grover_workshop.metadata.json ├── grover_workshop.qmod └── grover_workshop.synthesis_options.json └── hhl_workshop └── hhl_workshop.ipynb /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | /.github @NadavClassiq @GilClassiq 2 | -------------------------------------------------------------------------------- /.github/scripts/get_m2m_token.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | export SECRET_ARN=$M2M_SECRET_ARN 5 | if [ "$IS_DEV" = "true" ]; then 6 | aws codeartifact login --tool pip --domain classiq-cadmium --repository Pypi-Classiq-Non-Prod 7 | fi 8 | 9 | aws secretsmanager get-secret-value --secret-id "$SECRET_ARN" | \ 10 | jq '{"classiqTokenAccount": .SecretString | fromjson | .access_token }' > "${HOME}/.classiq-credentials" 11 | -------------------------------------------------------------------------------- /.github/workflows/Internal-automatic-deployment.yml: -------------------------------------------------------------------------------- 1 | name: "(Internal) Automatic Deployment" 2 | 3 | on: 4 | pull_request_target: 5 | branches: 6 | - main 7 | types: 8 | - closed 9 | 10 | jobs: 11 | deploy-prod: 12 | if: github.event.pull_request.merged == true 13 | uses: ./.github/workflows/Utils-deployment-qmod.yml 14 | with: 15 | deploy-mode: production 16 | secrets: inherit 17 | 18 | deploy-staging: 19 | if: github.event.pull_request.merged == true 20 | uses: ./.github/workflows/Utils-deployment-qmod.yml 21 | with: 22 | deploy-mode: staging 23 | secrets: inherit 24 | -------------------------------------------------------------------------------- /.github/workflows/Lint.yml: -------------------------------------------------------------------------------- 1 | name: "Lint" 2 | 3 | on: [pull_request] 4 | 5 | permissions: 6 | contents: read 7 | 8 | env: 9 | FORCE_COLOR: 1 10 | RUFF_OUTPUT_FORMAT: github 11 | 12 | jobs: 13 | lint: 14 | runs-on: ubuntu-latest 15 | timeout-minutes: 5 16 | 17 | steps: 18 | - uses: actions/checkout@v4 19 | - uses: actions/setup-python@v5 20 | with: 21 | python-version: "3.11" 22 | - uses: pre-commit/action@v3.0.1 23 | -------------------------------------------------------------------------------- /.internal/docs_directories.txt: -------------------------------------------------------------------------------- 1 | algorithms 2 | applications 3 | functions 4 | tutorials 5 | -------------------------------------------------------------------------------- /.internal/update_outputs/fake_browser.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | -------------------------------------------------------------------------------- /.internal/update_outputs/update_single_notebook.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | notebook_relative_path="$1" 4 | notebook_path="$(realpath "$notebook_relative_path")" 5 | 6 | notebook_dir=$(dirname "$notebook_path") 7 | notebook_name=$(basename "$notebook_path") 8 | 9 | 10 | current_folder="$(realpath "$(dirname "$0")")" 11 | 12 | # disable popping browser for `show(qprog)` 13 | export BROWSER="$current_folder/fake_browser.sh" 14 | 15 | 16 | "$current_folder/hook_add_random_seed.py" "$notebook_path" 17 | 18 | 19 | cd "$notebook_dir" 20 | jupyter nbconvert --to notebook --execute --inplace "$notebook_name" 21 | 22 | "$current_folder/hook_remove_random_seed.py" "$notebook_path" 23 | -------------------------------------------------------------------------------- /.internal/url_allow_list.txt: -------------------------------------------------------------------------------- 1 | https://pubmed.ncbi.nlm.nih.gov/8604144/ 2 | -------------------------------------------------------------------------------- /README_resources/Execution_Screenshot_3_plus_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/README_resources/Execution_Screenshot_3_plus_5.png -------------------------------------------------------------------------------- /README_resources/Jobs_Screenshot_3_plus_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/README_resources/Jobs_Screenshot_3_plus_5.png -------------------------------------------------------------------------------- /README_resources/Model_Screenshot_3_plus_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/README_resources/Model_Screenshot_3_plus_5.png -------------------------------------------------------------------------------- /README_resources/Program_Screenshot_3_plus_5.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/README_resources/Program_Screenshot_3_plus_5.png -------------------------------------------------------------------------------- /README_resources/writing_models.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/README_resources/writing_models.png -------------------------------------------------------------------------------- /algorithms/algebraic/discrete_log/discrete_log.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Discrete Logarithm", 3 | "description": "Solving Discrete Logarithm Problem using Shor's Algorithm", 4 | "qmod_type": ["algorithms"], 5 | "level": ["advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/algebraic/discrete_log/discrete_log_large.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Discrete Logarithm Large Instance", 3 | "description": "Solving Discrete Logarithm Problem using Shor's Algorithm where the group order is not a power of 2", 4 | "qmod_type": ["algorithms"], 5 | "level": ["advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_complex.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hidden Shift Large Example", 3 | "description": "Hidden-Shift problem for bent functions (big instance)", 4 | "qmod_type": ["algorithms"], 5 | "level": ["demos"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_complex.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "width" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_no_dual.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hidden Shift Without Dual Oracle", 3 | "description": "Hidden-Shift problem for bent functions (without dual function oracle)", 4 | "qmod_type": ["algorithms"], 5 | "level": ["demos"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_no_dual.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "width" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_simple.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hidden Shift Small Example", 3 | "description": "Hidden-Shift problem for bent functions", 4 | "qmod_type": ["algorithms"], 5 | "level": ["demos"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/algebraic/hidden_shift/hidden_shift_simple.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "width" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /algorithms/algebraic/shor/doubly_controlled_modular_adder.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Doubly Controlled Modular Adder", 3 | "description": "Doubly Controlled Modular Adder - a building block in Shor's Algorithm", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/algebraic/shor/shor.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Shor's Algorithm Modular Exponentiation", 3 | "description": "Full Integer factorization using Shor's Algorithm and Modular Exponentiation", 4 | "vertical_tags": ["cyber"], 5 | "problem_domain_tags": [], 6 | "qmod_type": ["algorithms"], 7 | "level": ["advanced"] 8 | } 9 | -------------------------------------------------------------------------------- /algorithms/amplitude_estimation/qmc_user_defined/qmc_user_defined.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Amplitude Estimation", 3 | "description": "Integral Evaluation using Amplitude Estimation", 4 | "vertical_tags": ["finance"], 5 | "problem_domain_tags": ["risk analysis"], 6 | "qmod_type": ["algorithms"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /algorithms/amplitude_estimation/qmc_user_defined/qmc_user_defined.qmod: -------------------------------------------------------------------------------- 1 | qfunc load_probabilities(state: qbit[]) { 2 | inplace_prepare_state([ 3 | 0.0, 4 | 0.0357142857, 5 | 0.0714285714, 6 | 0.1071428571, 7 | 0.1428571429, 8 | 0.1785714286, 9 | 0.2142857143, 10 | 0.25 11 | ], 0, state); 12 | } 13 | 14 | qfunc amplitude_loading(io: qbit[], ind: qbit) { 15 | linear_pauli_rotations([2], [0.5], [0.4], io, ind); 16 | } 17 | 18 | qfunc state_loading(io: qbit[], ind: qbit) { 19 | load_probabilities(io); 20 | amplitude_loading(io, ind); 21 | } 22 | 23 | qfunc main(output res: qbit[], output ind: qbit) { 24 | allocate(3, res); 25 | allocate(1, ind); 26 | state_loading(res, ind); 27 | } 28 | -------------------------------------------------------------------------------- /algorithms/amplitude_estimation/qmc_user_defined/qmc_user_defined.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /algorithms/amplitude_estimation/quantum_counting/quantum_counting_iqae.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Counting IQAE", 3 | "description": "Counting Solutions to equation using Iterative Quantum Amplitude Estimation", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/amplitude_estimation/quantum_counting/quantum_counting_qpe.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Counting QPE", 3 | "description": "Counting Solutions to equation using Amplitude Estimation with Quantum Phase Estimation", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/aqc/solving_qlsp/solving_qlsp_with_aqc.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Solving QLSP with AQC", 3 | "description": "Solving the Quantum Linear Systems Problem (QLSP) using Adiabatic Quantum Computing (AQC)", 4 | "problem_domain_tags": ["adiabatic", "linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/bernstein_vazirani/bernstein_vazirani_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Bernstein Vazirani", 3 | "description": "Bernstein Vazirani example for secret integer 13 on 5 qubits", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/bernstein_vazirani/bernstein_vazirani_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc bv_predicate(a: int, x: qbit[], res: qbit) { 2 | repeat (i: x.len) { 3 | if ((floor(a / (2 ** i)) % 2) == 1) { 4 | CX(x[i], res); 5 | } else { 6 | IDENTITY(res); 7 | } 8 | } 9 | } 10 | 11 | qfunc bv_function(a: int, x: qbit[]) { 12 | aux: qbit; 13 | hadamard_transform(x); 14 | within { 15 | allocate(1, aux); 16 | X(aux); 17 | H(aux); 18 | } apply { 19 | bv_predicate(a, x, aux); 20 | } 21 | hadamard_transform(x); 22 | } 23 | 24 | qfunc main(output x: qnum) { 25 | allocate(5, x); 26 | bv_function(13, x); 27 | } 28 | -------------------------------------------------------------------------------- /algorithms/bernstein_vazirani/bernstein_vazirani_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /algorithms/deutsch_jozsa/complex_deutsch_jozsa.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Deutsch-Jozsa Large Example", 3 | "description": "Deutsch-Jozsa Algorithm Large example", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/deutsch_jozsa/simple_deutsch_jozsa.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Deutsch-Jozsa Small Example", 3 | "description": "Deutsch-Jozsa Algorithm simple example", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/differential_equations/discrete_poisson_solver/discrete_poisson_solver.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Poisson's Equation Solver", 3 | "description": "Solving the discrete Poisson's equation using the HHL Algorithm", 4 | "problem_domain_tags": ["linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/differential_equations/discrete_poisson_solver/discrete_poisson_solver.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 18 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /algorithms/differential_equations/hhl_lanchester/hhl_lanchester.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Lanchester Model HHL", 3 | "description": "Solving Lanchester Model using the HHL Algorithm", 4 | "problem_domain_tags": ["linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/differential_equations/time_marching/time_marching.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Time Marching Based Quantum Solver", 3 | "description": "Solving time-dependent linear equations using a Time-Marching based strategy and QSVT", 4 | "problem_domain_tags": ["linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/dqi/dqi_max_xorsat.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Decoded Quantum Interferometry (DQI) for MaxCut", 3 | "description": "Solving the MaxCut Problem using the DQI Algorithm in the setting of max-XORSAT", 4 | "qmod_type": ["algorithms"], 5 | "level": ["advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/glued_trees/figures/10_qubits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/glued_trees/figures/10_qubits.png -------------------------------------------------------------------------------- /algorithms/glued_trees/figures/20_qubits.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/glued_trees/figures/20_qubits.png -------------------------------------------------------------------------------- /algorithms/glued_trees/figures/A_matrix.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/glued_trees/figures/A_matrix.png -------------------------------------------------------------------------------- /algorithms/glued_trees/figures/glued_trees_diagram.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/glued_trees/figures/glued_trees_diagram.png -------------------------------------------------------------------------------- /algorithms/glued_trees/glued_trees_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Glued Trees Algorithm", 3 | "description": "Glued Trees Algorithm for 20 Qubits at t=2n", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["advanced"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/glued_trees/glued_trees_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /algorithms/grover/3_sat_grover/3_sat_grover.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Grover: 3-SAT", 3 | "description": "Solving 3-SAT problem using Grover's Algorithm", 4 | "problem_domain_tags": ["search"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/grover/3_sat_grover/3_sat_grover.qmod: -------------------------------------------------------------------------------- 1 | qfunc sat_oracle(x: qbit[], res: qbit) { 2 | res ^= ((((((x[0] | x[1]) | x[2]) & (((x[0] ^ 1) | x[1]) | x[2])) & (((x[0] ^ 1) | (x[1] ^ 1)) | (x[2] ^ 1))) & (((x[0] ^ 1) | (x[1] ^ 1)) | x[2])) & ((x[0] | x[1]) | (x[2] ^ 1))) & (((x[0] ^ 1) | x[1]) | (x[2] ^ 1)); 3 | } 4 | 5 | qfunc main(output x: qbit[3]) { 6 | allocate(x.len, x); 7 | grover_search(1, lambda(vars) { 8 | phase_oracle(sat_oracle, vars); 9 | }, x); 10 | } 11 | -------------------------------------------------------------------------------- /algorithms/grover/3_sat_grover/3_sat_grover_large.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Grover: 3-SAT Large Example", 3 | "description": "Solving 3-SAT problem using Grover's Algorithm (large example)", 4 | "problem_domain_tags": ["search"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/grover/3_sat_grover/3_sat_grover_large.qmod: -------------------------------------------------------------------------------- 1 | qfunc sat_oracle_large(x: qbit[], res: qbit) { 2 | res ^= (((((((((((((x[1] | x[2]) | x[3]) & (((x[0] ^ 1) | x[1]) | x[2])) & (((x[0] ^ 1) | x[1]) | (x[2] ^ 1))) & (((x[0] ^ 1) | (x[1] ^ 1)) | x[2])) & ((x[0] | (x[1] ^ 1)) | (x[2] ^ 1))) & ((x[0] | (x[1] ^ 1)) | x[2])) & (((x[0] ^ 1) | (x[1] ^ 1)) | (x[3] ^ 1))) & (((x[0] ^ 1) | (x[1] ^ 1)) | x[3])) & (((x[1] ^ 1) | (x[2] ^ 1)) | (x[3] ^ 1))) & ((x[1] | (x[2] ^ 1)) | x[3])) & ((x[0] | (x[2] ^ 1)) | x[3])) & ((x[0] | (x[1] ^ 1)) | (x[3] ^ 1))) & (((x[0] ^ 1) | (x[1] ^ 1)) | (x[2] ^ 1)); 3 | } 4 | 5 | qfunc main(output x: qbit[4]) { 6 | allocate(x.len, x); 7 | grover_search(2, lambda(vars) { 8 | phase_oracle(sat_oracle_large, vars); 9 | }, x); 10 | } 11 | -------------------------------------------------------------------------------- /algorithms/grover/grover_max_cut/grover_max_cut.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Grover: Max Cut", 3 | "description": "Graph Cut search problem with Grover Oracle", 4 | "problem_domain_tags": ["search", "optimization"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/grover/grover_max_cut/grover_max_cut.qmod: -------------------------------------------------------------------------------- 1 | qfunc cut_oracle(cut_size: int, nodes: qbit[], res: qbit) { 2 | res ^= (-(((((((((((((-2) * nodes[0]) * nodes[1]) - ((2 * nodes[0]) * nodes[2])) + (2 * nodes[0])) - ((2 * nodes[1]) * nodes[2])) - ((2 * nodes[1]) * nodes[3])) + (3 * nodes[1])) - ((2 * nodes[2]) * nodes[4])) + (3 * nodes[2])) - ((2 * nodes[3]) * nodes[4])) + (2 * nodes[3])) + (2 * nodes[4]))) <= (-cut_size); 3 | } 4 | 5 | qfunc main(output nodes: qbit[5]) { 6 | allocate(nodes.len, nodes); 7 | grover_search(3, lambda(vars) { 8 | phase_oracle(lambda(vars, res) { 9 | cut_oracle(4, vars, res); 10 | }, vars); 11 | }, nodes); 12 | } 13 | -------------------------------------------------------------------------------- /algorithms/hhl/hhl/figures/hhl_circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/hhl/hhl/figures/hhl_circuit.png -------------------------------------------------------------------------------- /algorithms/hhl/hhl/hhl.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /algorithms/hhl/hhl/hhl_exact.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "HHL (with exact Hamiltonian simulation)", 3 | "description": "Solving linear system of equations using HHL algorithm, with exact Hamiltonian simulation", 4 | "problem_domain_tags": ["ml", "linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/hhl/hhl/hhl_trotter.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "HHL (with approximated Hamiltonian simulation)", 3 | "description": "Solving linear system of equations using HHL algorithm, with approximated Hamiltonian simulation", 4 | "problem_domain_tags": ["ml", "linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/oblivious_amplitude_amplification/oblivious_amplitude_amplification.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Oblivious Amplitude Amplification", 3 | "description": "Oblivious Amplitude Amplification for the amplification of LCU", 4 | "problem_domain_tags": ["search"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qaoa/knapsack/qaoa_knapsack.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Constrained QAOA: Knapsack", 3 | "description": "Optimizing the Knapsack problem using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qaoa/knapsack/qaoa_knapsack.qmod: -------------------------------------------------------------------------------- 1 | qstruct KnapsackVars { 2 | a: qnum<3>; 3 | b: qnum<2>; 4 | } 5 | 6 | qfunc apply_cost(gamma: real, v: KnapsackVars) { 7 | aux: qbit; 8 | within { 9 | aux = ((v.a * 2) + (v.b * 3)) <= 12; 10 | } apply { 11 | control (aux) { 12 | phase (-((v.a * 3) + (v.b * 5)), gamma); 13 | } 14 | } 15 | } 16 | 17 | qfunc main(params: real[6], output v: KnapsackVars) { 18 | allocate(v.size, v); 19 | hadamard_transform(v); 20 | repeat (i: 3) { 21 | apply_cost(params[2 * i], v); 22 | apply_to_all(lambda(q) { 23 | RX(params[(2 * i) + 1], q); 24 | }, v); 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /algorithms/qaoa/maxcut/qaoa_max_cut.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QAOA: MaxCut", 3 | "description": "Optimizing the Maxcut problem using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qml/hybrid_qnn/neural_network.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/hybrid_qnn/neural_network.png -------------------------------------------------------------------------------- /algorithms/qml/hybrid_qnn/trained_model.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/hybrid_qnn/trained_model.pth -------------------------------------------------------------------------------- /algorithms/qml/qgan/resources/generator_trained_model.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/qgan/resources/generator_trained_model.pth -------------------------------------------------------------------------------- /algorithms/qml/qgan/resources/q_generator_trained_model.pth: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/qgan/resources/q_generator_trained_model.pth -------------------------------------------------------------------------------- /algorithms/qml/qsvm/qsvm.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QSVM: Bloch Sphere Kernel", 3 | "description": "QSVM Algorithm (with Bloch Sphere Kernel)", 4 | "problem_domain_tags": ["ml"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qml/qsvm/qsvm.qmod: -------------------------------------------------------------------------------- 1 | qfunc bloch_feature_map(data: real[], qba: qbit[]) { 2 | repeat (i: ceiling(data.len / 2)) { 3 | RX(data[2 * i] / 2, qba[i]); 4 | } 5 | repeat (i: floor(data.len / 2)) { 6 | RZ(data[(2 * i) + 1], qba[i]); 7 | } 8 | } 9 | 10 | qfunc main(data1: real[2], data2: real[2], output qba: qnum) { 11 | allocate(ceiling(data1.len / 2), qba); 12 | bloch_feature_map(data1, qba); 13 | invert { 14 | bloch_feature_map(data2, qba); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /algorithms/qml/qsvm_pauli_feature_map/qsvm_pauli_feature_map.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QSVM: Pauli Kernel", 3 | "description": "QSVM Algorithm (with Pauli Kernel)", 4 | "problem_domain_tags": ["ml"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qml/qsvm_pauli_feature_map/qsvm_pauli_feature_map.qmod: -------------------------------------------------------------------------------- 1 | qfunc hadamard_transform_expanded___0(target: qbit[2]) { 2 | repeat (index: 2) { 3 | H(target[index]); 4 | } 5 | } 6 | 7 | qfunc pauli_kernel_expanded___0(data: real[], qba: qbit[2]) { 8 | power (2) { 9 | hadamard_transform_expanded___0(qba); 10 | parametric_suzuki_trotter([[3, 0], [0, 3], [3, 3]], [ 11 | data[0], 12 | data[1], 13 | ((data[0] - 3.1416) * (data[1] - 3.1416)) 14 | ], -1, 1, 1, qba); 15 | } 16 | } 17 | 18 | qfunc main(data1: real[2], data2: real[2], output qba: qnum<2, False, 0>) { 19 | allocate(2, qba); 20 | pauli_kernel_expanded___0(data1, qba); 21 | invert { 22 | pauli_kernel_expanded___0(data2, qba); 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/Autoencoder_structure.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/Autoencoder_structure.png -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/encoder_decoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/encoder_decoder.png -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/q_auto_encoder.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/q_auto_encoder.png -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/qae_qlayer.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/qae_qlayer.png -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/swap_test_closed.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/swap_test_closed.png -------------------------------------------------------------------------------- /algorithms/qml/quantum_autoencoder/figures/swap_test_opened.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/algorithms/qml/quantum_autoencoder/figures/swap_test_opened.png -------------------------------------------------------------------------------- /algorithms/qpe/qpe_for_matrix/qpe_for_matrix.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Phase Estimation", 3 | "description": "Quantum Phase Estimation for Evaluating Matrix Eigenvalues", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qpe/qpe_for_matrix/qpe_for_matrix.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /algorithms/qsvt/qsvt_fixed_point_amplitude_amplification/qsvt_fixed_point_amplitude_amplification.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QSVT: Amplitude Amplification", 3 | "description": "QSVT for Fixed-Point Amplitude Amplification", 4 | "problem_domain_tags": ["search"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/qsvt/qsvt_matrix_inversion/qsvt_matrix_inversion.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QSVT: Matrix Inversion", 3 | "description": "QSVT for Matrix Inversion", 4 | "problem_domain_tags": ["linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/simon/simon_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Simon's Algorithm Simple Example", 3 | "description": "Solving Simon's problem for min(x,x^s) with secret string s", 4 | "qmod_type": ["algorithms"], 5 | "level": ["demos"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/simon/simon_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc simon_qfunc(f_qfunc: qfunc (qnum, output qnum), x: qnum) { 2 | res: qnum; 3 | hadamard_transform(x); 4 | f_qfunc(x, res); 5 | hadamard_transform(x); 6 | } 7 | 8 | qfunc simon_qfunc_simple(s: int, x: qnum, output res: qnum) { 9 | res = min(x, x ^ s); 10 | } 11 | 12 | qfunc main(output x: qnum) { 13 | allocate(5, x); 14 | simon_qfunc(lambda(x, res) { 15 | simon_qfunc_simple(6, x, res); 16 | }, x); 17 | } 18 | -------------------------------------------------------------------------------- /algorithms/simon/simon_shallow_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Simon's Algorithm Shallow Oracle", 3 | "description": "Solving Simon's problem for a shallow oracle with secret string of the form 000. 01..111", 4 | "qmod_type": ["algorithms"], 5 | "level": ["demos"] 6 | } 7 | -------------------------------------------------------------------------------- /algorithms/swap_test/swap_test.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Swap Test", 3 | "description": "Swap Test", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/swap_test/swap_test.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output test: qbit) { 2 | state1: qbit[]; 3 | state2: qbit[]; 4 | prepare_amplitudes([ 5 | 0.341820472306662, 6 | (-0.237261667325083), 7 | 0.233936034675983, 8 | (-0.033347531132715), 9 | 0.479787125057496, 10 | (-0.413883519835207), 11 | (-0.396060798200712), 12 | 0.461159549986877 13 | ], 0.0, state1); 14 | prepare_amplitudes([ 15 | (-0.464354866499289), 16 | 0.368670230538333, 17 | 0.219675023759545, 18 | (-0.107802417030113), 19 | (-0.451424452060796), 20 | (-0.358452134839606), 21 | 0.505807381305853, 22 | (-0.021570025938839) 23 | ], 0.0, state2); 24 | swap_test(state1, state2, test); 25 | } 26 | -------------------------------------------------------------------------------- /algorithms/vqls/lcu_vqls/vqls_with_lcu.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "VQLS: LCU Block Encoding", 3 | "description": "VQLS using Linear Combination of Unitaries (LCU)", 4 | "problem_domain_tags": ["search", "linear equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /algorithms/vqls/lcu_vqls/vqls_with_lcu.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/automotive/cooling_systems_optimization/block_encoding.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Block Encoding Cooling System", 3 | "description": "Block Encoding for Cooling System Optimization", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["applications"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/automotive/cooling_systems_optimization/cooling_systems_optimization.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare QAE State", 3 | "description": "Directly preparing the QAE state instead of synthesizing and running the QAE, which takes a long time. It was done similarly in the paper.", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["applications"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/automotive/cooling_systems_optimization/data/costs.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/automotive/cooling_systems_optimization/data/costs.npy -------------------------------------------------------------------------------- /applications/automotive/cooling_systems_optimization/matrix_inverse.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Matrix Inverse using QSVT", 3 | "description": "Solve the set of linear equations for the cooling system using the QSVT algorithm.", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["applications"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/chemistry/molecular_energy_curve/molecular_energy_curve.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Molecule Energy Curve", 3 | "description": "Computing Molecule's Potential Energy Curve", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/chemistry/molecule_eigensolver/molecule_eigensolver.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "VQE: Molecule Ground State", 3 | "description": "Molecule Eigensolver (VQE method): Evaluating the Ground State of a Molecular Hamiltonian", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/chemistry/molecule_eigensolver/molecule_eigensolver.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/chemistry/molecule_eigensolver_using_openfermion/lih.xyz: -------------------------------------------------------------------------------- 1 | 2 2 | LiH generated by RDKit 3 | Li 0.833472 0.000000 0.000000 4 | H -0.833472 0.000000 0.000000 5 | -------------------------------------------------------------------------------- /applications/chemistry/protein_folding/protein_folding.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Protein Folding", 3 | "description": "Finding Protein Folding Geometry using the QAOA Algorithm", 4 | "vertical_tags": ["pharma"], 5 | "problem_domain_tags": ["chemistry"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/chemistry/qpe_for_molecules/qpe_for_molecules.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Phase Estimation: Molecular Energies", 3 | "description": "Quantum Phase Estimation (QPE) for Finding Molecular Energies", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["application"], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/chemistry/second_quantized_hamiltonian/second_quantized_hamiltonian.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Second Quantized Hamiltonian", 3 | "description": "Variational Circuit For Second Quantized Hamiltonian", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/chemistry/second_quantized_hamiltonian/second_quantized_hamiltonian.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/cybersecurity/link_monitoring/link_monitoring.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Link Monitoring", 3 | "description": "Link Monitoring for Internet-of-Things-Enabled Wireless Sensor Networks", 4 | "vertical_tags": ["cyber", "telecom"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["basic", "demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/cybersecurity/patching_management/Attack_graph.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/cybersecurity/patching_management/Attack_graph.jpg -------------------------------------------------------------------------------- /applications/cybersecurity/patching_management/Attack_path.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/cybersecurity/patching_management/Attack_path.png -------------------------------------------------------------------------------- /applications/cybersecurity/patching_management/patch_min_vertex_cover.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Patch Management", 3 | "description": "Tackling Kill-Chains with Quantum Computing - The Patch Management challenge", 4 | "vertical_tags": ["cyber", "telecom"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["basic", "demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/cybersecurity/patching_management/patch_min_vertex_cover.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/cybersecurity/whitebox_fuzzing/fuzzing.jpeg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/cybersecurity/whitebox_fuzzing/fuzzing.jpeg -------------------------------------------------------------------------------- /applications/cybersecurity/whitebox_fuzzing/oracle.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/cybersecurity/whitebox_fuzzing/oracle.jpg -------------------------------------------------------------------------------- /applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Whitebox Fuzzing", 3 | "description": "Boosting Whitebox Fuzzing using Grover's Algorithm", 4 | "vertical_tags": ["cyber"], 5 | "problem_domain_tags": ["search"], 6 | "qmod_type": ["application"], 7 | "level": ["basic", "demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/cybersecurity/whitebox_fuzzing/whitebox_fuzzing.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 25 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /applications/finance/credit_card_fraud/credit_card_fraud.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Credit Card Fraud Detection", 3 | "description": "Detecting Credit Card Fraud Using the QSVM Algorithm", 4 | "vertical_tags": ["cyber", "finance"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/finance/option_pricing/option_pricing.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Option Pricing", 3 | "description": "Estimating European Call Options Price Using Amplitude Estimation", 4 | "vertical_tags": ["finance"], 5 | "problem_domain_tags": ["risk analysis"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/finance/portfolio_optimization/portfolio_optimization.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Portfolio Optimization", 3 | "description": "Portfolio Optimization Using the QAOA Algorithm", 4 | "vertical_tags": ["finance"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["basic", "demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/finance/rainbow_options/rainbow_options_bruteforce_method.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Rainbow Options Bruteforce Method", 3 | "description": "Rainbow Options payoff using Bruteforce Method in QAE", 4 | "problem_domain_tags": ["risk analysis"], 5 | "vertical_tags": ["finance"], 6 | "qmod_type": ["application"], 7 | "level": ["advanced"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/finance/rainbow_options/rainbow_options_direct_method.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Rainbow Options Direct Method", 3 | "description": "Rainbow Options payoff using Direct Method in QAE", 4 | "problem_domain_tags": ["risk analysis"], 5 | "vertical_tags": ["finance"], 6 | "qmod_type": ["application"], 7 | "level": ["advanced"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/finance/rainbow_options/rainbow_options_direct_method.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 25 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /applications/finance/rainbow_options/rainbow_options_integration_method.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Rainbow Options Integration Method", 3 | "description": "Rainbow Options payoff using Integration Method in QAE", 4 | "problem_domain_tags": ["risk analysis"], 5 | "vertical_tags": ["finance"], 6 | "qmod_type": ["application"], 7 | "level": ["advanced"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/logistics/facility_location/facility_location.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Facility Location Problem", 3 | "description": "Solving Facility Location Problem (P-median) Using the QAOA Algorithm", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/logistics/facility_location/facility_location.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/logistics/task_scheduling_problem/task_scheduling_problem.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Workflow Scheduling Problem", 3 | "description": "Solving Workflow Scheduling Problem Using the QAOA Algorithm", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/logistics/task_scheduling_problem/task_scheduling_problem.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/logistics/task_scheduling_problem/task_scheduling_problem_large.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Workflow Scheduling Problem: Large example", 3 | "description": "Solving Workflow Scheduling Problem Using the QAOA Algorithm (large example)", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/logistics/task_scheduling_problem/task_scheduling_problem_large.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/logistics/traveling_salesman_problem/traveling_saleman_problem.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Travelling Salesman", 3 | "description": "Solving Travelling Salesman Problem Using the QAOA Algorithm", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/logistics/traveling_salesman_problem/traveling_saleman_problem.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/optimization/electric_grid_optimization/electric_grid_optimization.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Electric Grid Optimization", 3 | "description": "Electric Grid Optimization using the QAOA Algorithm", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/optimization/integer_linear_programming/integer_linear_programming.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Integer Linear Programming", 3 | "description": "Solving Integer Linear Programming Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/max_clique/max_clique.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Max Clique", 3 | "description": "Solving Max Clique Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/max_clique/max_clique.qmod: -------------------------------------------------------------------------------- 1 | qstruct QAOAVars { 2 | x: qbit[7]; 3 | } 4 | 5 | qfunc main(params: real[6], output v: QAOAVars) { 6 | allocate(v.size, v); 7 | hadamard_transform(v); 8 | repeat (i: 3) { 9 | phase (-((((((((-v.x[0]) - v.x[1]) - v.x[2]) - v.x[3]) - v.x[4]) - v.x[5]) - v.x[6]) + (2 * ((((((((2 * v.x[0]) * v.x[5]) + (v.x[1] * v.x[4])) + (v.x[2] * (v.x[4] + v.x[6]))) + (v.x[3] * v.x[6])) + (v.x[4] * ((v.x[1] + v.x[2]) + v.x[6]))) + (v.x[6] * ((v.x[2] + v.x[3]) + v.x[4]))) ** 2))), params[i]); 10 | apply_to_all(lambda(q) { 11 | RX(params[3 + i], q); 12 | }, v); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /applications/optimization/max_independent_set/max_independent_set.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Max Independent Set", 3 | "description": "Solving Max Independent Set Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/max_induced_k_color_subgraph/max_induced_k_color_subgraph.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Max Induced K-Color Subgraph", 3 | "description": "Solving Max Induced K-Color Subgraph Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/max_induced_k_color_subgraph/max_induced_k_color_subgraph.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/optimization/max_k_vertex_cover/max_k_vertex_cover.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Max K-Vertex Cover", 3 | "description": "Solving Max K-Vertex Cover Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/min_graph_coloring/min_graph_coloring.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Min Graph Coloring", 3 | "description": "Solving Min Graph Coloring Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/min_graph_coloring/min_graph_coloring.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/optimization/minimum_dominating_set/minimum_dominating_set.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Minimum Dominating Set", 3 | "description": "Solving Minimum Dominating Set (MDS) Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/rectangles_packing/floorplan_example_bigger.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/applications/optimization/rectangles_packing/floorplan_example_bigger.png -------------------------------------------------------------------------------- /applications/optimization/rectangles_packing/rectangles_packing.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Rectangles Packing Problem", 3 | "description": "Solving the Rectangles Packing Problem using the QAOA Algorithm", 4 | "vertical_tags": ["retail"], 5 | "problem_domain_tags": ["optimization"], 6 | "qmod_type": ["application"], 7 | "level": ["demos"] 8 | } 9 | -------------------------------------------------------------------------------- /applications/optimization/rectangles_packing/rectangles_packing.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /applications/optimization/set_cover/set_cover.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Set Cover", 3 | "description": "Solving Set Cover Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/set_partition/set_partition.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Set Partition", 3 | "description": "Solving Set Partition Problem Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /applications/optimization/set_partition/set_partition.qmod: -------------------------------------------------------------------------------- 1 | qstruct QAOAVars { 2 | x: qbit[10]; 3 | } 4 | 5 | qfunc main(params: real[6], output v: QAOAVars) { 6 | allocate(v.size, v); 7 | hadamard_transform(v); 8 | repeat (i: 3) { 9 | phase (-((((((((((((4 * v.x[0]) + (16 * v.x[1])) + (14 * v.x[2])) + (18 * v.x[3])) + (16 * v.x[4])) + (16 * v.x[5])) + (12 * v.x[6])) + (4 * v.x[7])) + (10 * v.x[8])) + (20 * v.x[9])) - 65) ** 2), params[i]); 10 | apply_to_all(lambda(q) { 11 | RX(params[3 + i], q); 12 | }, v); 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /applications/physical_systems/ising_model/ising_model.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Ising Model", 3 | "description": "Solving Ising Model Using the QAOA Algorithm", 4 | "problem_domain_tags": ["optimization", "chemistry"], 5 | "qmod_type": ["application"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /community/basic_examples/entanglement/bell_state_of_2_qubits.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_bell_state(reg: qbit[]) { 2 | H(reg[0]); 3 | CX(reg[0], reg[1]); 4 | } 5 | 6 | qfunc main(output registers: qbit[]) { 7 | allocate(2, registers); 8 | my_bell_state(registers); 9 | } 10 | -------------------------------------------------------------------------------- /community/basic_examples/entanglement/bell_state_of_2_qubits.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /community/basic_examples/hw_aware_synthesis/hardware_aware_mcx_grid.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(ctrl: qbit[], target: qbit) { 2 | control (ctrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output ctrl: qbit[], output target: qbit) { 8 | allocate(12, ctrl); 9 | allocate(1, target); 10 | my_mcx(ctrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /community/basic_examples/hw_aware_synthesis/hardware_aware_mcx_star.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(ctrl: qbit[], target: qbit) { 2 | control (ctrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output ctrl: qbit[], output target: qbit) { 8 | allocate(12, ctrl); 9 | allocate(1, target); 10 | my_mcx(ctrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /community/basic_examples/hw_aware_synthesis/mcx_10_ctrl_depth.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(ctrl: qbit[], target: qbit) { 2 | control (ctrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output ctrl: qbit[], output target: qbit) { 8 | allocate(10, ctrl); 9 | allocate(1, target); 10 | my_mcx(ctrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /community/basic_examples/hw_aware_synthesis/mcx_10_ctrl_depth.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 20, 4 | "optimization_parameter": "depth" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /community/basic_examples/superposition/equal_superposition_3_qubits.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_hadamard_transform(reg_a: qbit[]) { 2 | apply_to_all(H, reg_a); 3 | } 4 | 5 | qfunc main(output register_a: qbit[]) { 6 | allocate(3, register_a); 7 | my_hadamard_transform(register_a); 8 | } 9 | -------------------------------------------------------------------------------- /community/basic_examples/superposition/equal_superposition_3_qubits.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /community/basic_examples/vqe/vqe_primitives.qmod: -------------------------------------------------------------------------------- 1 | HAMILTONIAN: PauliTerm[] = [ 2 | PauliTerm { 3 | pauli=[Pauli::Z], 4 | coefficient=1 5 | }, 6 | PauliTerm { 7 | pauli=[Pauli::X], 8 | coefficient=0.1 9 | } 10 | ]; 11 | 12 | qfunc main(output q: qbit, angles: real[1]) { 13 | allocate(1, q); 14 | RY(angles[0], q); 15 | } 16 | 17 | cscope ``` 18 | res = vqe(HAMILTONIAN, False, [], optimizer=Optimizer.COBYLA, max_iteration=1000, tolerance=0.001, step_size=0, skip_compute_variance=False, alpha_cvar=1.0) 19 | save({'result': res}) 20 | ``` 21 | -------------------------------------------------------------------------------- /community/basic_examples/vqe/vqe_primitives.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /community/paper_implementation_project/bb84/bb84_implementation.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "BB84 protocol", 3 | "description": "BB84 Quantum Key Distribution Protocol for generating secure private key", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /community/paper_implementation_project/bb84/bb84_implementation.qmod: -------------------------------------------------------------------------------- 1 | qfunc bb84(message: bool[], alice_bases: bool[], bob_bases: bool[], qba: qbit[]) { 2 | repeat (i: message.len) { 3 | if (message[i] == 1) { 4 | X(qba[i]); 5 | } 6 | } 7 | repeat (i: alice_bases.len) { 8 | if (alice_bases[i] == 1) { 9 | H(qba[i]); 10 | } 11 | } 12 | repeat (i: bob_bases.len) { 13 | if (bob_bases[i] == 1) { 14 | H(qba[i]); 15 | } 16 | } 17 | } 18 | 19 | qfunc main(output qba: qbit[]) { 20 | allocate(8, qba); 21 | bb84([0, 0, 1, 1, 0, 0, 0, 1], [1, 1, 0, 1, 1, 1, 0, 1], [1, 0, 0, 0, 0, 1, 1, 0], qba); 22 | } 23 | -------------------------------------------------------------------------------- /community/paper_implementation_project/bpde/bpde.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Bayesian Phase Difference Estimation", 3 | "description": "Bayesian Phase Difference Estimation Algorithm for Calculating Numerical Energy Gradient", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /community/paper_implementation_project/explicit_quantum_circuits_for_block_encoding/extended_binary_tree_matrix_block_encoding.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Block encoding sparse and structured matrix", 3 | "description": "Block encoding the adjacency matrix of an extended binary tree", 4 | "qmod_type": ["algorithms"], 5 | "level": ["advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /community/paper_implementation_project/explicit_quantum_circuits_for_block_encoding/stochastic_bandedcirculant_matrix_block_encoding.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Block encoding of a sparse and structured stochastic matrix", 3 | "description": "Exact Hermitian Block encoding for a stochastic banded circulant matrix", 4 | "qmod_type": ["algorithms"], 5 | "level": ["advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /community/paper_implementation_project/index.md: -------------------------------------------------------------------------------- 1 | # Paper Implementation Project 2 | 3 | Please open your Pull Request (PR) with the following guidelines: 4 | 5 | - Name the folder with the paper name. 6 | - Include the implementation in a Python notebook and all relevant files. 7 | - Follow the [CONTRIBUTING.md](https://github.com/Classiq/classiq-library/blob/main/CONTRIBUTING.md) file with all relevant instructions. 8 | -------------------------------------------------------------------------------- /community/paper_implementation_project/quantum_algo_for_solving_linear_differential_equations/harmonic_oscillator.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Harmonic Oscillator", 3 | "description": "Solving Harmonic Oscillator Equation using algorithm proposed in https://doi.org/10.1103/PhysRevA.101.032307", 4 | "problem_domain_tags": ["linear differential equation"], 5 | "qmod_type": ["algorithms"], 6 | "level": [] 7 | } 8 | -------------------------------------------------------------------------------- /community/paper_implementation_project/quantum_compression_algorithm_for_symmetric_states/quantum_compression_algorithm_for_symmetric_states.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "", 3 | "description": "Quantum compression algorithm for symmetric states algorithm", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": [] 7 | } 8 | -------------------------------------------------------------------------------- /community/paper_implementation_project/quantum_state_preparation_without_coherent_arithmetic/stateprep_guassian_using_qsvt.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Gaussian State Preparation using QSVT", 3 | "description": "Quantum state preparation without coherent arithmetic - Gaussian state", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": [] 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_declarations/builtin_operator_decls.qmod: -------------------------------------------------------------------------------- 1 | // Builtin operators 2 | qfunc apply(operand: qfunc ()); 3 | qfunc permute(functions: qfunc[] ()); 4 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/arithmetic_expression/arithmetic_expression_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Arithmetic Expression", 3 | "description": "Arithmetic Expression", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/arithmetic_expression/arithmetic_expression_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output c: qnum, output res: qnum) { 2 | a = 2; 3 | b = 1; 4 | c = 5; 5 | res = ((((((a + b) + c) & 15) % 8) ^ (3 & a)) ^ 10) == 4; 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/arithmetic_expression/arithmetic_expression_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Bitwise And", 3 | "description": "Quantum Variables Bitwise And", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | a = 4; 3 | b = 5; 4 | res = a & b; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_integer_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Integer Bitwise And", 3 | "description": "Quantum Variable and Integer Bitwise And", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_integer_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | a = 5; 3 | res = 3 & a; 4 | } 5 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_and/bitwise_and_integer_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_invert/bitwise_invert_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Bitwise Invert", 3 | "description": "Bitwise Invert", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_invert/bitwise_invert_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | x = 6; 3 | y = ~x; 4 | } 5 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_invert/bitwise_invert_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Bitwise Or", 3 | "description": "Quantum Variables Bitwise Or", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | allocate(5, True, 0, a); 3 | allocate(3, False, 0, b); 4 | a ^= 4; 5 | b ^= 5; 6 | res = a | b; 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_integer_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Integer Bitwise Or", 3 | "description": "Quantum Variable and Integer Bitwise Or", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_integer_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | a = 4; 3 | res = 3 | a; 4 | } 5 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_or/bitwise_or_integer_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Bitwise Xor", 3 | "description": "Quantum Variables Bitwise Xor", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | allocate(5, True, 0, a); 3 | allocate(3, False, 0, b); 4 | a ^= 4; 5 | b ^= 5; 6 | res = a ^ b; 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_integer_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Integer Bitwise Xor", 3 | "description": "Quantum Variable and Integer Bitwise Xor", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_integer_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | a = 4; 3 | res = 3 ^ a; 4 | } 5 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/bitwise_xor/bitwise_xor_integer_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Comparator", 3 | "description": "Quantum Variables Comparator", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | allocate(5, True, 0, a); 3 | allocate(3, False, 0, b); 4 | res = a == b; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_integer_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Integer Comparator", 3 | "description": "Quantum Variable and Integer Comparator", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_integer_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | allocate(3, a); 3 | hadamard_transform(a); 4 | res = a <= 2; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/comparator/comparator_integer_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/maximum_float_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Float Maximum", 3 | "description": "Quantum Variable and Float Maximum", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/maximum_float_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | allocate(3, a); 3 | hadamard_transform(a); 4 | res = max(3.5, a); 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/maximum_float_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/maximum_integer_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | allocate(3, a); 3 | hadamard_transform(a); 4 | res = max(3.5, a); 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/maximum_integer_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/minimum_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Mininum", 3 | "description": "Quantum Variables Mininum", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/minimum_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | a = 4; 3 | allocate(3, b); 4 | hadamard_transform(b); 5 | res = min(a, b); 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/extremum/minimum_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/modular_exp/modular_exp_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Modular Exponentiation", 3 | "description": "Modular Exponentiation with an Exponent of Quantum Variable", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/modular_exp/modular_exp_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output power: qnum, output x: qnum) { 2 | allocate(ceiling(log(5, 2)), x); 3 | x ^= 1; 4 | allocate(3, power); 5 | hadamard_transform(power); 6 | modular_exp(5, 4, x, power); 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/modulo/modulo_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Modulo", 3 | "description": "Modulo", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/modulo/modulo_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | allocate(5, a); 3 | allocate(5, b); 4 | a ^= 4; 5 | b ^= 7; 6 | res = (a + b) % 4; 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/modulo/modulo_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Multiplication", 3 | "description": "Quantum Variables Multiplication", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | a = 4; 3 | b = 5; 4 | res = a * b; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_float_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Float Multiplication", 3 | "description": "Quantum Variable and Float Multiplication", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_float_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | allocate(2, a); 3 | hadamard_transform(a); 4 | res = 3.5 * a; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/multiplication/multiplication_float_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/negation/negation_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable Negation", 3 | "description": "Quantum Variable Negation", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/negation/negation_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum) { 2 | allocate(3, True, 0, a); 3 | hadamard_transform(a); 4 | b = -a; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/negation/negation_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_2vars_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variables Subtraction", 3 | "description": "Quantum Variables Subtraction", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_2vars_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output res: qnum) { 2 | a = 4; 3 | b = 5; 4 | res = a - b; 5 | } 6 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_2vars_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_float_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Variable and Float Subtraction", 3 | "description": "Quantum Variable and Float Subtraction", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_float_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output res: qnum) { 2 | a = 4; 3 | res = a - 3.5; 4 | } 5 | -------------------------------------------------------------------------------- /functions/function_usage_examples/arithmetic/subtraction/subtraction_float_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/function_usage_examples/mcx/mcx_example.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Multi-Control-X", 3 | "description": "Multi-Control-X using the control operator", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/function_usage_examples/mcx/mcx_example.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output cntrl: qbit[], output target: qbit) { 2 | allocate(7, cntrl); 3 | allocate(1, target); 4 | control (cntrl) { 5 | X(target); 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /functions/function_usage_examples/mcx/mcx_example.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_check_msb.qmod: -------------------------------------------------------------------------------- 1 | qfunc _check_msb(ref: int, x: qbit[], aux: qbit) { 2 | within { 3 | invert { 4 | qft_no_swap(x); 5 | } 6 | } apply { 7 | _ctrl_x(ref, x[0], aux); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_ctrl_x.qmod: -------------------------------------------------------------------------------- 1 | qfunc _ctrl_x(ref: int, ctrl: qnum, aux: qbit) { 2 | control (ctrl == ref) { 3 | X(aux); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_prepare_uniform_trimmed_state_step.qmod: -------------------------------------------------------------------------------- 1 | qfunc _prepare_uniform_trimmed_state_step(size_lsb: int, ctrl_val: int, lsbs_val: int, ctrl_var: qnum, rotation_var: qbit) { 2 | if (lsbs_val != 0) { 3 | control (ctrl_var == ctrl_val) { 4 | RY(((-2) * (asin(sqrt(min((2 ** size_lsb) / lsbs_val, 1))) + (pi / 4))) + pi, rotation_var); 5 | } 6 | } 7 | } 8 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_qct_d_operator.qmod: -------------------------------------------------------------------------------- 1 | qfunc _qct_d_operator(x: qnum, q: qbit) { 2 | S(q); 3 | H(q); 4 | control (x == 0) { 5 | invert { 6 | S(q); 7 | H(q); 8 | } 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_qct_pi_operator.qmod: -------------------------------------------------------------------------------- 1 | qfunc _qct_pi_operator(x: qbit[], q: qbit) { 2 | control (q == 1) { 3 | apply_to_all(X, x); 4 | } 5 | control (q == 1) { 6 | modular_increment(1, x); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/_single_pauli.qmod: -------------------------------------------------------------------------------- 1 | qfunc _single_pauli(slope: real, offset: real, q1_qfunc: qfunc (theta: real, target: qbit), x: qbit[], q: qbit) { 2 | repeat (index: x.len) { 3 | control (x[index]) { 4 | q1_qfunc((2 ** index) * slope, q); 5 | } 6 | } 7 | q1_qfunc(offset, q); 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/allocate_num.qmod: -------------------------------------------------------------------------------- 1 | qfunc allocate_num(num_qubits: int, is_signed: bool, fraction_digits: int, output out: qnum) { 2 | allocate(num_qubits, out); 3 | } 4 | -------------------------------------------------------------------------------- /functions/open_library_definitions/amplitude_estimation.qmod: -------------------------------------------------------------------------------- 1 | qfunc amplitude_estimation(oracle: qfunc (qbit[]), space_transform: qfunc (qbit[]), phase_var: qnum, packed_vars: qbit[]) { 2 | space_transform(packed_vars); 3 | qpe(lambda() { 4 | grover_operator(oracle, space_transform, packed_vars); 5 | }, phase_var); 6 | } 7 | -------------------------------------------------------------------------------- /functions/open_library_definitions/apply_to_all.qmod: -------------------------------------------------------------------------------- 1 | qfunc apply_to_all(gate_operand: qfunc (target: qbit), target: qbit[]) { 2 | repeat (index: target.len) { 3 | gate_operand(target[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/c_modular_multiply.qmod: -------------------------------------------------------------------------------- 1 | qfunc c_modular_multiply(n: int, a: int, b: qbit[], x: qbit[], ctrl: qbit) { 2 | within { 3 | qft(b); 4 | } apply { 5 | repeat (index: x.len) { 6 | cc_modular_add(n, (a * (2 ** index)) % n, b, x[index], ctrl); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/cc_modular_add.qmod: -------------------------------------------------------------------------------- 1 | qfunc cc_modular_add(n: int, a: int, phi_b: qbit[], c1: qbit, c2: qbit) { 2 | ctrl: qbit[]; 3 | aux: qbit; 4 | within { 5 | allocate(1, aux); 6 | {c1, c2} -> ctrl; 7 | } apply { 8 | control (ctrl) { 9 | qft_space_add_const(a, phi_b); 10 | } 11 | invert { 12 | qft_space_add_const(n, phi_b); 13 | } 14 | _check_msb(1, phi_b, aux); 15 | control (aux) { 16 | qft_space_add_const(n, phi_b); 17 | } 18 | within { 19 | invert { 20 | control (ctrl) { 21 | qft_space_add_const(a, phi_b); 22 | } 23 | } 24 | } apply { 25 | _check_msb(0, phi_b, aux); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /functions/open_library_definitions/encode_in_angle.qmod: -------------------------------------------------------------------------------- 1 | qfunc encode_in_angle(data: real[], output qba: qbit[]) { 2 | allocate(data.len, qba); 3 | repeat (index: data.len) { 4 | RY(pi * data[index], qba[index]); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /functions/open_library_definitions/encode_on_bloch.qmod: -------------------------------------------------------------------------------- 1 | qfunc encode_on_bloch(data: real[], output qba: qbit[]) { 2 | allocate(ceiling(data.len / 2), qba); 3 | repeat (index: ceiling(data.len / 2)) { 4 | RX(pi * data[2 * index], qba[index]); 5 | } 6 | repeat (index: floor(data.len / 2)) { 7 | RZ(pi * data[(2 * index) + 1], qba[index]); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/grover_diffuser.qmod: -------------------------------------------------------------------------------- 1 | qfunc grover_diffuser(space_transform: qfunc (qbit[]), packed_vars: qbit[]) { 2 | within { 3 | invert { 4 | space_transform(packed_vars); 5 | } 6 | } apply { 7 | reflect_about_zero(packed_vars); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/grover_operator.qmod: -------------------------------------------------------------------------------- 1 | qfunc grover_operator(oracle: qfunc (qbit[]), space_transform: qfunc (qbit[]), packed_vars: qbit[]) { 2 | oracle(packed_vars); 3 | grover_diffuser(lambda(qba) { 4 | space_transform(qba); 5 | }, packed_vars); 6 | U(0, 0, 0, pi, packed_vars[0]); 7 | } 8 | -------------------------------------------------------------------------------- /functions/open_library_definitions/grover_search.qmod: -------------------------------------------------------------------------------- 1 | qfunc grover_search(reps: int, oracle: qfunc (qbit[]), packed_vars: qbit[]) { 2 | hadamard_transform(packed_vars); 3 | power (reps) { 4 | grover_operator(lambda(qba) { 5 | oracle(qba); 6 | }, lambda(qba) { 7 | hadamard_transform(qba); 8 | }, packed_vars); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /functions/open_library_definitions/hadamard_transform.qmod: -------------------------------------------------------------------------------- 1 | qfunc hadamard_transform(target: qbit[]) { 2 | apply_to_all(H, target); 3 | } 4 | -------------------------------------------------------------------------------- /functions/open_library_definitions/inplace_c_modular_multiply.qmod: -------------------------------------------------------------------------------- 1 | qfunc inplace_c_modular_multiply(n: int, a: int, x: qbit[], ctrl: qbit) { 2 | b: qbit[]; 3 | within { 4 | allocate(x.len + 1, b); 5 | } apply { 6 | c_modular_multiply(n, a, b, x, ctrl); 7 | control (ctrl) { 8 | multiswap(x, b); 9 | } 10 | invert { 11 | c_modular_multiply(n, mod_inverse(a, n), b, x, ctrl); 12 | } 13 | } 14 | } 15 | -------------------------------------------------------------------------------- /functions/open_library_definitions/inplace_prepare_int.qmod: -------------------------------------------------------------------------------- 1 | qfunc inplace_prepare_int(value: int, target: qbit[]) { 2 | repeat (index: target.len) { 3 | if ((floor(value / (2 ** index)) % 2) == 1) { 4 | X(target[index]); 5 | } else { 6 | IDENTITY(target[index]); 7 | } 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/linear_pauli_rotations.qmod: -------------------------------------------------------------------------------- 1 | qfunc linear_pauli_rotations(bases: Pauli[], slopes: real[], offsets: real[], x: qbit[], q: qbit[]) { 2 | repeat (index: q.len) { 3 | _single_pauli(slopes[index], offsets[index], lambda(theta, target) { 4 | switch(bases[index], [lambda() { 5 | IDENTITY(target); 6 | }, lambda() { 7 | RX(theta, target); 8 | }, lambda() { 9 | RY(theta, target); 10 | }, lambda() { 11 | RZ(theta, target); 12 | }]); 13 | }, x, q[index]); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /functions/open_library_definitions/modular_exp.qmod: -------------------------------------------------------------------------------- 1 | qfunc modular_exp(n: int, a: int, x: qbit[], power: qbit[]) { 2 | repeat (index: power.len) { 3 | inplace_c_modular_multiply(n, (a ** (2 ** index)) % n, x, power[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/modular_increment.qmod: -------------------------------------------------------------------------------- 1 | qfunc modular_increment(a: int, x: qnum) { 2 | array_cast: qbit[]; 3 | within { 4 | x -> array_cast; 5 | qft(array_cast); 6 | } apply { 7 | repeat (i: x.size) { 8 | PHASE((((a * 2) * pi) * (2 ** i)) / (2 ** x.size), array_cast[i]); 9 | } 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /functions/open_library_definitions/multiswap.qmod: -------------------------------------------------------------------------------- 1 | qfunc multiswap(x: qbit[], y: qbit[]) { 2 | repeat (index: min(x.len, y.len)) { 3 | SWAP(x[index], y[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/phase_oracle.qmod: -------------------------------------------------------------------------------- 1 | qfunc phase_oracle(predicate: qfunc (qbit[], qbit), target: qbit[]) { 2 | aux: qbit; 3 | within { 4 | allocate(1, aux); 5 | X(aux); 6 | H(aux); 7 | } apply { 8 | predicate(target, aux); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_bell_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_bell_state(state_num: int, output q: qbit[2]) { 2 | allocate(2, q); 3 | q ^= state_num; 4 | H(q[0]); 5 | CX(q[0], q[1]); 6 | } 7 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_exponential_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_exponential_state(rate: int, q: qbit[]) { 2 | repeat (i: q.len) { 3 | RY(2.0 * atan(exp(((-rate) * (2.0 ** i)) / 2.0)), q[i]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_ghz_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_ghz_state(size: int, output q: qbit[]) { 2 | allocate(size, q); 3 | H(q[0]); 4 | repeat (step: floor(log(size - 1, 2)) + 1) { 5 | repeat (control_index: 2 ** step) { 6 | if (size <= (control_index + (2 ** step))) { 7 | IDENTITY(q[0]); 8 | } else { 9 | CX(q[control_index], q[control_index + (2 ** step)]); 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_int.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_int(value: int, output out: qnum) { 2 | allocate(floor(log(value, 2)) + 1, out); 3 | out ^= value; 4 | } 5 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_uniform_interval_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_uniform_interval_state(start: int, end: int, q: qbit[]) { 2 | prepare_uniform_trimmed_state(end - start, q); 3 | modular_increment(start, q); 4 | } 5 | -------------------------------------------------------------------------------- /functions/open_library_definitions/prepare_uniform_trimmed_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_uniform_trimmed_state(m: int, q: qbit[]) { 2 | hadamard_transform(q); 3 | if (m < (2 ** q.len)) { 4 | RY(((-2) * (asin(sqrt(min((2 ** (q.len - 1)) / m, 1))) + (pi / 4))) + pi, q[q.len - 1]); 5 | } 6 | repeat (i: max(q.len - 1, 0)) { 7 | _prepare_uniform_trimmed_state_step((q.len - i) - 2, floor(m / (2 ** ((q.len - i) - 1))), m % (2 ** ((q.len - i) - 1)), q[(q.len - i) - 1:q.len], q[(q.len - i) - 2]); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/projector_controlled_phase.qmod: -------------------------------------------------------------------------------- 1 | qfunc projector_controlled_phase(phase: real, proj_cnot: qfunc (qbit[], qbit), qvar: qbit[], aux: qbit) { 2 | proj_cnot(qvar, aux); 3 | RZ(phase, aux); 4 | proj_cnot(qvar, aux); 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qaoa_cost_layer.qmod: -------------------------------------------------------------------------------- 1 | qfunc qaoa_cost_layer(g: real, hamiltonian: PauliTerm[], target: qbit[]) { 2 | suzuki_trotter(hamiltonian, g, 1, 1, target); 3 | } 4 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qaoa_init.qmod: -------------------------------------------------------------------------------- 1 | qfunc qaoa_init(target: qbit[]) { 2 | repeat (index: target.len) { 3 | H(target[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qaoa_layer.qmod: -------------------------------------------------------------------------------- 1 | qfunc qaoa_layer(g: real, b: real, hamiltonian: PauliTerm[], target: qbit[]) { 2 | qaoa_cost_layer(g, hamiltonian, target); 3 | qaoa_mixer_layer(b, target); 4 | } 5 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qaoa_mixer_layer.qmod: -------------------------------------------------------------------------------- 1 | qfunc qaoa_mixer_layer(b: real, target: qbit[]) { 2 | repeat (index: target.len) { 3 | RX(b, target[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qaoa_penalty.qmod: -------------------------------------------------------------------------------- 1 | qfunc qaoa_penalty(num_qubits: int, params_list: real[], hamiltonian: PauliTerm[], target: qbit[num_qubits]) { 2 | qaoa_init(target); 3 | repeat (index: params_list.len / 2) { 4 | qaoa_layer(params_list[2 * index], params_list[(2 * index) + 1], hamiltonian, target); 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qct_qst_type1.qmod: -------------------------------------------------------------------------------- 1 | qfunc qct_qst_type1(x: qbit[]) { 2 | within { 3 | _qct_d_operator(x[0:x.len - 1], x[x.len - 1]); 4 | _qct_pi_operator(x[0:x.len - 1], x[x.len - 1]); 5 | } apply { 6 | qft(x); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qct_type2.qmod: -------------------------------------------------------------------------------- 1 | qfunc qct_type2(x: qbit[]) { 2 | q: qbit; 3 | within { 4 | allocate(1, q); 5 | } apply { 6 | qct_qst_type2(x, q); 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qft.qmod: -------------------------------------------------------------------------------- 1 | qfunc qft(target: qbit[]) { 2 | repeat (index: target.len / 2) { 3 | SWAP(target[index], target[(target.len - 1) - index]); 4 | } 5 | qft_no_swap(target); 6 | } 7 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qft_no_swap.qmod: -------------------------------------------------------------------------------- 1 | qfunc qft_no_swap(qbv: qbit[]) { 2 | repeat (i: qbv.len) { 3 | H(qbv[i]); 4 | repeat (j: (qbv.len - i) - 1) { 5 | CPHASE(pi / (2 ** (j + 1)), qbv[(i + j) + 1], qbv[i]); 6 | } 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qft_space_add_const.qmod: -------------------------------------------------------------------------------- 1 | qfunc qft_space_add_const(value: int, phi_b: qbit[]) { 2 | repeat (index: phi_b.len) { 3 | PHASE(qft_const_adder_phase(index, value, phi_b.len), phi_b[index]); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qpe.qmod: -------------------------------------------------------------------------------- 1 | qfunc qpe(unitary: qfunc (), phase_var: qnum) { 2 | qpe_flexible(lambda(k) { 3 | power (k) { 4 | unitary(); 5 | } 6 | }, phase_var); 7 | } 8 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qpe_flexible.qmod: -------------------------------------------------------------------------------- 1 | qfunc qpe_flexible(unitary_with_power: qfunc (int), phase_var: qnum) { 2 | phase_array: qbit[]; 3 | phase_var -> phase_array; 4 | apply_to_all(H, phase_array); 5 | repeat (index: phase_array.len) { 6 | control (phase_array[index]) { 7 | unitary_with_power(2 ** index); 8 | } 9 | } 10 | invert { 11 | qft(phase_array); 12 | } 13 | phase_array -> phase_var; 14 | } 15 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qst_type2.qmod: -------------------------------------------------------------------------------- 1 | qfunc qst_type2(x: qbit[]) { 2 | q: qbit; 3 | within { 4 | allocate(1, q); 5 | X(q); 6 | } apply { 7 | qct_qst_type2(x, q); 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qsvt.qmod: -------------------------------------------------------------------------------- 1 | qfunc qsvt(phase_seq: real[], proj_cnot_1: qfunc (qbit[], qbit), proj_cnot_2: qfunc (qbit[], qbit), u: qfunc (qbit[]), qvar: qbit[], aux: qbit) { 2 | H(aux); 3 | projector_controlled_phase(phase_seq[0], proj_cnot_1, qvar, aux); 4 | repeat (index: floor((phase_seq.len - 1) / 2)) { 5 | qsvt_step(phase_seq[(2 * index) + 1], phase_seq[(2 * index) + 2], proj_cnot_1, proj_cnot_2, u, qvar, aux); 6 | } 7 | if ((phase_seq.len % 2) == 1) { 8 | IDENTITY(qvar); 9 | } else { 10 | u(qvar); 11 | projector_controlled_phase(phase_seq[phase_seq.len - 1], proj_cnot_2, qvar, aux); 12 | } 13 | H(aux); 14 | } 15 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qsvt_inversion.qmod: -------------------------------------------------------------------------------- 1 | qfunc qsvt_inversion(phase_seq: real[], block_encoding_cnot: qfunc (qbit[], qbit), u: qfunc (qbit[]), qvar: qbit[], aux: qbit) { 2 | qsvt(phase_seq, block_encoding_cnot, block_encoding_cnot, lambda(x) { 3 | invert { 4 | u(x); 5 | } 6 | }, qvar, aux); 7 | } 8 | -------------------------------------------------------------------------------- /functions/open_library_definitions/qsvt_step.qmod: -------------------------------------------------------------------------------- 1 | qfunc qsvt_step(phase1: real, phase2: real, proj_cnot_1: qfunc (qbit[], qbit), proj_cnot_2: qfunc (qbit[], qbit), u: qfunc (qbit[]), qvar: qbit[], aux: qbit) { 2 | u(qvar); 3 | projector_controlled_phase(phase1, proj_cnot_2, qvar, aux); 4 | invert { 5 | u(qvar); 6 | } 7 | projector_controlled_phase(phase2, proj_cnot_1, qvar, aux); 8 | } 9 | -------------------------------------------------------------------------------- /functions/open_library_definitions/reflect_about_zero.qmod: -------------------------------------------------------------------------------- 1 | qfunc reflect_about_zero(packed_vars: qbit[]) { 2 | msbs: qnum; 3 | lsb: qbit; 4 | packed_vars -> {msbs, lsb}; 5 | within { 6 | X(lsb); 7 | H(lsb); 8 | } apply { 9 | control (msbs == 0) { 10 | X(lsb); 11 | } 12 | } 13 | {msbs, lsb} -> packed_vars; 14 | } 15 | -------------------------------------------------------------------------------- /functions/open_library_definitions/swap_test.qmod: -------------------------------------------------------------------------------- 1 | qfunc swap_test(state1: qbit[], state2: qbit[], output test: qbit) { 2 | allocate(1, test); 3 | H(test); 4 | control (test) { 5 | repeat (i: state1.len) { 6 | SWAP(state1[i], state2[i]); 7 | } 8 | } 9 | H(test); 10 | } 11 | -------------------------------------------------------------------------------- /functions/open_library_definitions/switch.qmod: -------------------------------------------------------------------------------- 1 | qfunc switch(selector: int, cases: qfunc[] ()) { 2 | cases[selector](); 3 | } 4 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/grover_operator/grover_operator.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Grover Operator", 3 | "description": "Grover Operator", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/grover_operator/grover_operator.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_predicate(x: qnum, y: qnum, res: qbit) { 2 | res ^= ((x + y) < 9) and (((x * y) % 4) == 1); 3 | } 4 | 5 | qfunc main(output x: qnum<2, False, 0>, output y: qnum<2, False, 0>) { 6 | packed_vars: qbit[]; 7 | allocate(4, packed_vars); 8 | hadamard_transform(packed_vars); 9 | power (2) { 10 | grover_operator(lambda(vars) { 11 | phase_oracle(lambda(_vars, _res) { 12 | my_predicate(_vars[0:2], _vars[2:_vars.len], _res); 13 | }, vars); 14 | }, lambda(vars) { 15 | hadamard_transform(vars); 16 | }, packed_vars); 17 | } 18 | packed_vars -> {x, y}; 19 | } 20 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/grover_operator/grover_operator.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 15 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/hadamard_transform/hadamard_transform.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hadamard Transform", 3 | "description": "Hadamard Transform", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/hadamard_transform/hadamard_transform.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | allocate(3, x); 3 | hadamard_transform(x); 4 | } 5 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/hadamard_transform/hadamard_transform.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/linear_pauli_rotations/linear_pauli_rotations.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Linear Pauli Rotations", 3 | "description": "Linear Pauli Rotations", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/linear_pauli_rotations/linear_pauli_rotations.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[], output ind: qbit[]) { 2 | allocate(6, x); 3 | allocate(3, ind); 4 | linear_pauli_rotations([2, 2, 2], [2.1, 1, 7.0], [0.1, 0.3, 0.33], x, ind); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/linear_pauli_rotations/linear_pauli_rotations.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type1.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum COSINE-1 and SINE-1 Transforms", 3 | "description": "Quantum COSINE and SINE Transforms of type 1", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type1.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | prepare_amplitudes([ 3 | 0.271876012077983, 4 | 0.111698296053364, 5 | 0.088554482817766, 6 | 0.215213054529158, 7 | 0.280854283813349, 8 | 0.16516523550762, 9 | 0.382854352438831, 10 | 0.267332399091042, 11 | 0.187738165823386, 12 | 0.212529084186698, 13 | 0.186003700679956, 14 | 0.395147524523994, 15 | 0.237707710537212, 16 | 0.032345631409255, 17 | 0.215741396713795, 18 | 0.399996124724427 19 | ], 0.0, x); 20 | qct_qst_type1(x); 21 | } 22 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type1.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type2.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum COSINE-2 and SINE-2 Transforms", 3 | "description": "Quantum COSINE and SINE Transforms of type 2", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type2.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output q: qbit) { 2 | prepare_amplitudes([ 3 | 0.112068721799421, 4 | 0.107745452355844, 5 | 0.326427301057128, 6 | 0.326596924449695, 7 | 0.389587541071017, 8 | 0.521638625386058, 9 | 0.444890198893713, 10 | 0.375231379859592 11 | ], 0.0, x); 12 | allocate(1, q); 13 | H(q); 14 | qct_qst_type2(x, q); 15 | } 16 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_qst_type2.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_type2.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum COSINE-2 Transform", 3 | "description": "Quantum COSINE Transform of type 2", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_type2.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | prepare_amplitudes([ 3 | 0.112068721799421, 4 | 0.107745452355844, 5 | 0.326427301057128, 6 | 0.326596924449695, 7 | 0.389587541071017, 8 | 0.521638625386058, 9 | 0.444890198893713, 10 | 0.375231379859592 11 | ], 0.0, x); 12 | qct_type2(x); 13 | } 14 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qct_type2.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qft.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qst_type2.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum SINE-2 Transform", 3 | "description": "Quantum SINE Transform of type 2", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qst_type2.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | prepare_amplitudes([ 3 | 0.112068721799421, 4 | 0.107745452355844, 5 | 0.326427301057128, 6 | 0.326596924449695, 7 | 0.389587541071017, 8 | 0.521638625386058, 9 | 0.444890198893713, 10 | 0.375231379859592 11 | ], 0.0, x); 12 | qst_type2(x); 13 | } 14 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qct_qst/qst_type2.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qft/qft.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Fourier Transform (QFT)", 3 | "description": "Quantum Fourier Transform (QFT)", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qft/qft.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | allocate(4, x); 3 | qft(x); 4 | } 5 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qft/qft.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Quantum Phase Estimation (QPE)", 3 | "description": "Quantum Phase Estimation (QPE)", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output state: qbit[], output phase: qnum) { 2 | allocate(2, state); 3 | allocate(2, False, 2, phase); 4 | state ^= 3; 5 | qpe(lambda() { 6 | CRZ(pi, state[0], state[1]); 7 | }, phase); 8 | } 9 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe_flexible.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Flexible Quantum Phase Estimation (QPE)", 3 | "description": "Flexible Quantum Phase Estimation (QPE)", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe_flexible.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output state: qbit[], output phase: qnum) { 2 | allocate(2, state); 3 | allocate(2, False, 2, phase); 4 | hadamard_transform(state); 5 | qpe_flexible(lambda(power) { 6 | suzuki_trotter([ 7 | PauliTerm { 8 | pauli=[Pauli::I, Pauli::Z], 9 | coefficient=-0.125 10 | }, 11 | PauliTerm { 12 | pauli=[Pauli::Z, Pauli::I], 13 | coefficient=-0.25 14 | }, 15 | PauliTerm { 16 | pauli=[Pauli::I, Pauli::I], 17 | coefficient=0.375 18 | } 19 | ], ((-2) * pi) * power, 1, 1, state); 20 | }, phase); 21 | } 22 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qpe/qpe_flexible.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/qsvt/qsvt.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QSVT", 3 | "description": "QSVT", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "advanced"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_bell_state.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare Bell State", 3 | "description": "Prepare Bell State example", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_bell_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | prepare_bell_state(2, x); 3 | } 4 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_bell_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_exponential_state.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare Exponential State", 3 | "description": "Prepare Exponential State", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_exponential_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | allocate(5, x); 3 | prepare_exponential_state(0.1, x); 4 | } 5 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_exponential_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_ghz_state.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare GHZ State", 3 | "description": "Prepare Greenberger-Horne-Zeilinger (GHZ) State", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_ghz_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | prepare_ghz_state(5, x); 3 | } 4 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_ghz_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_interval_state.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare Uniform Interval State", 3 | "description": "Prepare uniform superposition of states in a given interval", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_interval_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | allocate(5, x); 3 | prepare_uniform_interval_state(2, 8, x); 4 | } 5 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_interval_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_trimmed_state.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare Uniform Trimmed State", 3 | "description": "Prepare uniform superposition of a given number of states (starting from the zero state)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_trimmed_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | allocate(4, x); 3 | prepare_uniform_trimmed_state(3, x); 4 | } 5 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/special_state_preparations/prepare_uniform_trimmed_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/encode_in_angle.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Encode in Angle", 3 | "description": "Angle encoding of classical data", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/encode_in_angle.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(data: real[4], output x: qbit[]) { 2 | encode_in_angle(data, x); 3 | } 4 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/encode_on_bloch.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Encode on Bloch", 3 | "description": "Dense angle (Bloch sphere) encoding of classical data", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/encode_on_bloch.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(data: real[7], output x: qbit[]) { 2 | encode_on_bloch(data, x); 3 | } 4 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/figures/angle_encoding_circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/functions/qmod_library_reference/classiq_open_library/variational_data_encoding/figures/angle_encoding_circuit.png -------------------------------------------------------------------------------- /functions/qmod_library_reference/classiq_open_library/variational_data_encoding/figures/dense_angle_encoding_circuit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/functions/qmod_library_reference/classiq_open_library/variational_data_encoding/figures/dense_angle_encoding_circuit.png -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/exponentiation/hamiltonian_evolution_exponentiation.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Exponentiation", 3 | "description": "Exponentiation Example", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/exponentiation/hamiltonian_evolution_exponentiation.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/qdrift/qdrift.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "qDRIFT", 3 | "description": "qDRIFT Example", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/qdrift/qdrift.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output qba: qbit[]) { 2 | allocate(2, qba); 3 | qdrift([ 4 | PauliTerm { 5 | pauli=[Pauli::X, Pauli::Y], 6 | coefficient=1.0 7 | }, 8 | PauliTerm { 9 | pauli=[Pauli::Z, Pauli::I], 10 | coefficient=0.5 11 | } 12 | ], 2.0, 5, qba); 13 | } 14 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/qdrift/qdrift.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/suzuki_trotter/suzuki_trotter.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Suzuki Trotter", 3 | "description": "Suzuki Trotter Example", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/hamiltonian_evolution/suzuki_trotter/suzuki_trotter.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(x: real, output qba: qbit[]) { 2 | allocate(3, qba); 3 | suzuki_trotter([ 4 | PauliTerm { 5 | pauli=[ 6 | Pauli::X, 7 | Pauli::X, 8 | Pauli::Z 9 | ], 10 | coefficient=1.5 11 | }, 12 | PauliTerm { 13 | pauli=[ 14 | Pauli::Y, 15 | Pauli::X, 16 | Pauli::Z 17 | ], 18 | coefficient=0.5 19 | } 20 | ], x, 1, 1, qba); 21 | } 22 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_amplitudes.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare Amplitudes", 3 | "description": "State Preparation: Loading Amplitudes", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_amplitudes.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | prepare_amplitudes([ 3 | (-0.540061724867322), 4 | (-0.38575837490523), 5 | (-0.231455024943138), 6 | (-0.077151674981046), 7 | 0.077151674981046, 8 | 0.231455024943138, 9 | 0.38575837490523, 10 | 0.540061724867322 11 | ], 0, x); 12 | } 13 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_amplitudes.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_state.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Example Prepare State", 3 | "description": "State Preparation: Loading Probability Mass Function (PMF)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum) { 2 | prepare_state([ 3 | 0.05, 4 | 0.11, 5 | 0.13, 6 | 0.23, 7 | 0.27, 8 | 0.12, 9 | 0.03, 10 | 0.06 11 | ], 0.01, x); 12 | } 13 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/prepare_state_and_amplitudes/example_prepare_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CRX.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "CRX Gate", 3 | "description": "CRX Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CRX.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q_t: qbit; 3 | allocate(1, q_t); 4 | q_c: qbit; 5 | allocate(1, q_c); 6 | CRX(1, q_c, q_t); 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CRX.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CX.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "CX Gate", 3 | "description": "CX Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CX.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q_t: qbit; 3 | allocate(1, q_t); 4 | q_c: qbit; 5 | allocate(1, q_c); 6 | CX(q_c, q_t); 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/CX.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/PHASE.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Phase Gate", 3 | "description": "Phase Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/PHASE.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit; 3 | allocate(1, q); 4 | PHASE(1, q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/PHASE.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/R.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "R Gate", 3 | "description": "R Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/R.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit; 3 | allocate(1, q); 4 | R(1, 2, q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/R.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZ.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "RZ Gate", 3 | "description": "RZ Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZ.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit; 3 | allocate(1, q); 4 | RZ(1.9, q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZ.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZZ.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "RZZ Gate", 3 | "description": "RZZ Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZZ.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit[]; 3 | allocate(2, q); 4 | RZZ(1, q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/RZZ.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/SWAP.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "SWAP Gate", 3 | "description": "SWAP Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/SWAP.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q1: qbit; 3 | allocate(1, q1); 4 | q2: qbit; 5 | allocate(1, q2); 6 | SWAP(q1, q2); 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/SWAP.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/U.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "U Gate", 3 | "description": "U Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/U.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit; 3 | allocate(1, q); 4 | U(1, 2, 1.5, 1.1, q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/U.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/X.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "X Gate", 3 | "description": "X Gate", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos", "basic"] 7 | } 8 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/X.qmod: -------------------------------------------------------------------------------- 1 | qfunc main() { 2 | q: qbit; 3 | allocate(1, q); 4 | X(q); 5 | } 6 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/standard_gates/X.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/unitary/unitary.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Unitary Function", 3 | "description": "Unitary Function", 4 | "qmod_type": ["function"], 5 | "level": ["demos", "basic"] 6 | } 7 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/unitary/unitary.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qbit[]) { 2 | allocate(2, x); 3 | unitary([ 4 | [1, 0, 0, 0], 5 | [0, 1, 0, 0], 6 | [0, 0, ((-0) - 1j), 0], 7 | [0, 0, 0, 1j] 8 | ], x); 9 | } 10 | -------------------------------------------------------------------------------- /functions/qmod_library_reference/qmod_core_library/unitary/unitary.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /pyproject.toml: -------------------------------------------------------------------------------- 1 | [tool.pytest.ini_options] 2 | python_files = "test_*.py" 3 | 4 | # treat all warnings as errors 5 | filterwarnings = [ 6 | "error", 7 | """ignore: invalid escape sequence:DeprecationWarning""", 8 | ] 9 | 10 | [tool.isort] 11 | profile = "black" 12 | combine_as_imports = true 13 | 14 | known_classiq = "classiq" 15 | sections = [ 16 | "FUTURE", 17 | "STDLIB", 18 | "THIRDPARTY", 19 | "FIRSTPARTY", 20 | "CLASSIQ", 21 | "LOCALFOLDER", 22 | ] 23 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | classiq 2 | 3 | jupyter 4 | -------------------------------------------------------------------------------- /requirements_tests.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | 3 | testbook 4 | nbformat 5 | 6 | torch 7 | torchvision 8 | galois 9 | cvxpy 10 | pyqsp 11 | jsonpickle 12 | tensorboard 13 | qiskit<2 14 | qiskit-algorithms 15 | qiskit-machine-learning 16 | scikit-learn 17 | 18 | openfermion 19 | openfermionpyscf 20 | -------------------------------------------------------------------------------- /tests/config_notebook_execute_tests.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = 3 | tests/notebooks 4 | addopts = --log-cli-level=INFO --durations=0 5 | -------------------------------------------------------------------------------- /tests/config_quick_tests.ini: -------------------------------------------------------------------------------- 1 | [pytest] 2 | testpaths = 3 | tests 4 | addopts = --log-cli-level=INFO 5 | 6 | 7 | # directories to ignore 8 | norecursedirs = tests/notebooks 9 | -------------------------------------------------------------------------------- /tests/internal/pre_commit_tools: -------------------------------------------------------------------------------- 1 | ../../.internal/pre_commit_tools -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_classiq_discrete_quantum_walk.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("classiq_discrete_quantum_walk", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=20, # actual width: 9 17 | expected_depth=500, # actual depth: 243 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_classiq_qsvt.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("classiq_qsvt", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=30, # actual width: 18 17 | expected_depth=1400, # actual depth: 701 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_pennylane_cat_qsvt_example.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("pennylane_cat_qsvt_example", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_pennylane_catalyst_discrete_quantum_walk.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("pennylane_catalyst_discrete_quantum_walk", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_qiskit_discrete_quantum_walk.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("qiskit_discrete_quantum_walk", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_qiskit_qsvt.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("qiskit_qsvt", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_tket_discrete_quantum_walk.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("tket_discrete_quantum_walk", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/classiq_paper/test_tket_qsvt_example.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("tket_qsvt_example", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # the notebook is empty, there's nothing to test 12 | pass # TODO 13 | -------------------------------------------------------------------------------- /tests/notebooks/test_auxiliary_management.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("auxiliary_management", timeout_seconds=40) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=10, # actual width: 8 17 | expected_depth=300, # actual depth: 247 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_bernstein_vazirani.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("bernstein_vazirani", timeout_seconds=30) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=6, 17 | expected_depth=5, 18 | ) 19 | 20 | # test notebook content 21 | assert int(tb.ref("secret_integer_q")) == tb.ref("SECRET_INT") 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_discrete_poisson_solver.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("discrete_poisson_solver", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=16, # actual width: 16 17 | expected_depth=12000, # actual depth: 11538 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_electric_grid_optimization.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("electric_grid_optimization", timeout_seconds=1500) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=20, # actual width: 18 17 | expected_depth=200, # actual depth: 170 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_facility_location.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("facility_location", timeout_seconds=1656) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=15, # actual width: 12 17 | expected_depth=1000, # actual depth: 9237 18 | ) 19 | 20 | # test notebook content 21 | pass # todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_grover_max_cut.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("grover_max_cut", timeout_seconds=220) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=22, # actual width 19, constrained to 22 17 | expected_depth=5000, # actual depth: 2390 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_hhl_lanchester.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("hhl_lanchester", timeout_seconds=450) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | pass # TODO 12 | -------------------------------------------------------------------------------- /tests/notebooks/test_integer_linear_programming.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("integer_linear_programming", timeout_seconds=400) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=10, # actual width: 8 17 | expected_depth=125, # actual depth: 112 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_ising_model.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("ising_model", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=6, # actual width: 6 17 | expected_depth=50, # actual depth: 41 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_link_monitoring.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("link_monitoring", timeout_seconds=76) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=15, # actual width: 12 17 | expected_depth=35, # actual depth: 23 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_logical_qubits_by_alice_and_bob.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tests/notebooks/test_logical_qubits_by_alice_and_bob.py -------------------------------------------------------------------------------- /tests/notebooks/test_max_clique.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("max_clique", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=8, # actual width: 7 17 | expected_depth=400, # actual depth: 323 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_max_independent_set.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("max_independent_set", timeout_seconds=200) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=10, # actual width: 8 17 | expected_depth=120, # actual depth: 93 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_max_induced_k_color_subgraph.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("max_induced_k_color_subgraph", timeout_seconds=1028) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=15, # actual width: 12 17 | expected_depth=8500, # actual depth: 7586 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_max_k_vertex_cover.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("max_k_vertex_cover", timeout_seconds=600) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=12, # actual width: 10 17 | expected_depth=200, # actual depth: 159 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_min_graph_coloring.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("min_graph_coloring", timeout_seconds=1800) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=17, # actual width: 15 17 | expected_depth=5000, # actual depth: 4543 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_minimum_dominating_set.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("minimum_dominating_set", timeout_seconds=1000) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=25, # actual width: 20 17 | expected_depth=450, # actual depth: 366 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_partial_exponential_state_preparation.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("partial_exponential_state_preparation", timeout_seconds=100) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), expected_width=18 # actual width: 16 16 | ) 17 | # test notebook content 18 | pass # TODO 19 | -------------------------------------------------------------------------------- /tests/notebooks/test_patch_min_vertex_cover.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("patch_min_vertex_cover", timeout_seconds=36) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=10, # actual width: 8 17 | expected_depth=35, # actual depth: 26 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_portfolio_optimization.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("portfolio_optimization", timeout_seconds=400) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=15, # actual width: 12 17 | expected_depth=300, # actual depth: 217 18 | ) 19 | 20 | # test notebook content 21 | pass # todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_protein_folding.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("protein_folding", timeout_seconds=240) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=10, # actual width: 7 17 | expected_depth=1600, # actual depth: 1417 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_qaoa_knapsack.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("qaoa_knapsack", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=18, # actual width: 18 17 | expected_depth=2500, # actual depth: 2323 18 | ) 19 | 20 | # test notebook content 21 | pass # TODO 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_qaoa_max_cut.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("qaoa_max_cut", timeout_seconds=300) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=5, 17 | expected_depth=55, 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_quantum_thermal_state_preparation.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("quantum_thermal_state_preparation", timeout_seconds=1000) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=14, # actual width: 12 17 | expected_depth=55000, # actual depth: 38600 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_quantum_walks_via_efficient_blockencoding.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("quantum_walks_via_efficient_blockencoding.ipynb", timeout_seconds=720) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod_ebt")) 13 | validate_quantum_model(tb.ref("qmod_ebt_lcu")) 14 | validate_quantum_model(tb.ref("qmod_sbc")) 15 | validate_quantum_model(tb.ref("qmod_md")) 16 | validate_quantum_model(tb.ref("qmod_nmd")) 17 | 18 | # test notebook content 19 | pass # Todo 20 | -------------------------------------------------------------------------------- /tests/notebooks/test_rainbow_options_direct_method.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("rainbow_options_direct_method", timeout_seconds=1000) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | pass # TODO 12 | -------------------------------------------------------------------------------- /tests/notebooks/test_rectangles_packing.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("rectangles_packing_grid", timeout_seconds=1800) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=20, # actual width: 17 17 | expected_depth=600, # actual depth: 501 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_rectangles_packing_grid.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("rectangles_packing_grid", timeout_seconds=1800) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | pass # TODO 12 | -------------------------------------------------------------------------------- /tests/notebooks/test_second_quantized_hamiltonian.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("second_quantized_hamiltonian", timeout_seconds=44) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=4, # actual width: 4 17 | expected_depth=15, # actual depth: 13 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_set_cover.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("set_cover", timeout_seconds=1440) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=27, # actual width: 23 17 | expected_depth=180, # actual depth: 136 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_set_partition.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("set_partition", timeout_seconds=350) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=12, # actual width: 10 17 | expected_depth=200, # actual depth: 169 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_stateprep_guassian_using_qsvt.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("stateprep_guassian_using_qsvt", timeout_seconds=600) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=None, 17 | expected_depth=None, 18 | ) 19 | 20 | # test notebook content 21 | pass # Todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/test_time_marching.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("time_marching", timeout_seconds=500) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | pass # TODO 12 | -------------------------------------------------------------------------------- /tests/notebooks/test_traveling_salesman_problem.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("traveling_salesman_problem", timeout_seconds=1068) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | # test quantum programs 14 | validate_quantum_program_size( 15 | tb.ref_pydantic("qprog"), 16 | expected_width=16, # actual width: 16 17 | expected_depth=567, # actual depth: 567 18 | ) 19 | 20 | # test notebook content 21 | pass # todo 22 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_analyze.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("analyze", timeout_seconds=20) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=30, # actual width: 12 18 | expected_depth=500, # actual depth: 390 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_classiq_overview_tutorial.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("classiq_overview_tutorial", timeout_seconds=500) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=20, # actual width: 16 18 | expected_depth=300, # actual depth: 225 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_design.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("design", timeout_seconds=20) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=20, # actual width: 16 18 | expected_depth=300, # actual depth: 225 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_quantum_operations.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("quantum_operations", timeout_seconds=20) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=15, # actual width: 11 18 | expected_depth=150, # actual depth: 96 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_quantum_variables_and_functions.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("quantum_variables_and_functions", timeout_seconds=20) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=8, # actual width: 6 18 | expected_depth=70, # actual depth: 34 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/notebooks/workshops/test_whats_classiq.py: -------------------------------------------------------------------------------- 1 | from tests.utils_for_testbook import ( 2 | validate_quantum_program_size, 3 | validate_quantum_model, 4 | wrap_testbook, 5 | ) 6 | from testbook.client import TestbookNotebookClient 7 | 8 | 9 | @wrap_testbook("whats_classiq", timeout_seconds=400) 10 | def test_notebook(tb: TestbookNotebookClient) -> None: 11 | # test models 12 | validate_quantum_model(tb.ref("qmod")) 13 | 14 | # test quantum programs 15 | validate_quantum_program_size( 16 | tb.ref_pydantic("qprog"), 17 | expected_width=8, # actual width: 6 18 | expected_depth=10, # actual depth: 3 19 | ) 20 | 21 | # test notebook content 22 | pass # Todo 23 | -------------------------------------------------------------------------------- /tests/test_dummy.py: -------------------------------------------------------------------------------- 1 | def test_dummy() -> None: 2 | assert 1 + 1 == 2 3 | -------------------------------------------------------------------------------- /tests/test_no_errors.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import nbformat 4 | 5 | from utils_for_tests import iterate_notebook_names, resolve_notebook_path 6 | 7 | 8 | def test_no_errors_in_notebooks() -> None: 9 | for notebook in iterate_notebook_names(): 10 | with open(resolve_notebook_path(notebook)) as f: 11 | notebook_data = nbformat.read(f, nbformat.NO_CONVERT) 12 | 13 | for index, cell in enumerate(notebook_data["cells"]): 14 | outputs = cell.get("outputs") 15 | if outputs is None: 16 | continue 17 | 18 | assert not any( 19 | output.get("output_type") == "error" for output in cell["outputs"] 20 | ), f"Cell #{index} in {notebook} has an output error" 21 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_circle.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Discrete Quantum Walk on a Circle", 3 | "description": "Discrete Quantum Walk on a Circle with an Unbalanced Coin", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_circle.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_circle_balanced_coin.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Discrete Quantum Walk on a Circle (Balanced Coin)", 3 | "description": "Discrete Quantum Walk on a Circle with a Balanced Coin", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_circle_balanced_coin.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_hypercube.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Discrete Quantum Walk on a Hypercube", 3 | "description": "Discrete Quantum Walk on a Hypercube with a Grover Coin", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/discrete_quantum_walk/quantum_walk_hypercube.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "width" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/linear_approximation_of_tanh/tanh.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Linear Approximation of Tanh", 3 | "description": "Linear Approximation of Tanh", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/advanced_tutorials/linear_approximation_of_tanh/tanh.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "depth" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/add_bell_states/add_bell_states.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Add Bell States", 3 | "description": "Add Bell States", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/add_bell_states/add_bell_states.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output a: qnum, output b: qnum, output sum: qnum){ 2 | prepare_state([1/2, 0, 0, 1/2], 0, a); // a is in an equal superposition of 0 and 3 3 | prepare_state([0, 1/2, 1/2, 0], 0, b); // b is in an equal superposition of 1 and 2 4 | sum = a + b; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/add_bell_states/add_bell_states.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "depth" 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/exponentiation/example_exponentiation.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Exponentiation: H20 Molecule (Classiq)", 3 | "description": "Exponentiation Function of H20 Molecule", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/exponentiation/example_exponentiation.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_gate_count": {}, 4 | "optimization_parameter": "no_opt" 5 | }, 6 | "preferences": { 7 | "machine_precision": 8, 8 | "custom_hardware_settings": { 9 | "basis_gates": ["cx", "u"], 10 | "is_symmetric_connectivity": true 11 | }, 12 | "debug_mode": true, 13 | "synthesize_all_separately": false, 14 | "optimization_level": 3, 15 | "output_format": ["qasm"], 16 | "pretty_qasm": true, 17 | "transpilation_option": "auto optimize", 18 | "timeout_seconds": 300, 19 | "random_seed": 3976322989 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/exponentiation/example_exponentiation_minimize_error.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Exponentiation: Pauli String", 3 | "description": "Exponentiation Of Pauli Strings (Optimizing for Error)", 4 | "problem_domain_tags": ["chemistry"], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_exponentiation.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hamiltonian simulation guide: Exponentiation with depth constraint", 3 | "description": "A simple implementation of exponentiation with depth constraint", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_exponentiation.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output qba: qbit[]) { 2 | allocate(2, qba); 3 | exponentiation_with_depth_constraint([ 4 | PauliTerm { 5 | pauli=[Pauli::Z, Pauli::Z], 6 | coefficient=0.3 7 | }, 8 | PauliTerm { 9 | pauli=[Pauli::X, Pauli::I], 10 | coefficient=0.7 11 | }, 12 | PauliTerm { 13 | pauli=[Pauli::I, Pauli::X], 14 | coefficient=0.2 15 | } 16 | ], 1, 30, qba); 17 | } 18 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_exponentiation.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_qdrift.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hamiltonian simulation guide: qDRIFT", 3 | "description": "A simple implementation of the qDRIFT algorithm", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_qdrift.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output qba: qbit[]) { 2 | allocate(2, qba); 3 | qdrift([ 4 | PauliTerm { 5 | pauli=[Pauli::Z, Pauli::Z], 6 | coefficient=0.3 7 | }, 8 | PauliTerm { 9 | pauli=[Pauli::X, Pauli::I], 10 | coefficient=0.7 11 | }, 12 | PauliTerm { 13 | pauli=[Pauli::I, Pauli::X], 14 | coefficient=0.2 15 | } 16 | ], 1, 288, qba); 17 | } 18 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_qdrift.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_trotter.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hamiltonian simulation guide: Suzuki-Trotter", 3 | "description": "A simple Suzuki-Trotter implementation", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_trotter.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output qba: qbit[]) { 2 | allocate(2, qba); 3 | suzuki_trotter([ 4 | PauliTerm { 5 | pauli=[Pauli::Z, Pauli::Z], 6 | coefficient=0.3 7 | }, 8 | PauliTerm { 9 | pauli=[Pauli::X, Pauli::I], 10 | coefficient=0.7 11 | }, 12 | PauliTerm { 13 | pauli=[Pauli::I, Pauli::X], 14 | coefficient=0.2 15 | } 16 | ], 1.0, 1, 10, qba); 17 | } 18 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_guide/hamiltonian_simulation_guide_trotter.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_qsvt.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hamiltonian Simulation with QSVT", 3 | "description": "Hamiltonian Simulation with QSVT", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/hamiltonian_simulation_qubitization.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hamiltonian Simulation with Qubitization", 3 | "description": "Hamiltonian Simulation with Qubitization", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["advanced", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/hamiltonian_simulation/hamiltonian_simulation_with_block_encoding/test.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_cx.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: 14 Control Qubits", 3 | "description": "MCX Function (14 Ctrl, CX Optimization)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_cx.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(14, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_cx.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 19, 4 | "max_gate_count": {}, 5 | "optimization_parameter": "cx" 6 | }, 7 | "preferences": { 8 | "machine_precision": 8, 9 | "custom_hardware_settings": { 10 | "basis_gates": ["cx", "u"], 11 | "is_symmetric_connectivity": true 12 | }, 13 | "debug_mode": true, 14 | "synthesize_all_separately": false, 15 | "optimization_level": 3, 16 | "output_format": ["qasm"], 17 | "pretty_qasm": true, 18 | "transpilation_option": "auto optimize", 19 | "timeout_seconds": 300, 20 | "random_seed": 758170018 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_depth.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: 14 Control Qubits, Minimum Depth", 3 | "description": "MCX Function (14 Ctrl, Depth Optimization)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_depth.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(14, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_depth.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 20, 4 | "optimization_parameter": "depth" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_hardware.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: 14 Control Qubits, HW Optimized", 3 | "description": "MCX Function Synthesis For IBM Hardware (14 Ctrl, CX Optimization)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_14_ctrl_hardware.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(14, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_50_ctrl.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: 50 Control Qubits", 3 | "description": "MCX Function (50 Ctrl)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/mcx/mcx_50_ctrl.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(50, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/prepare_state/prepare_state.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Prepare State", 3 | "description": "Walkthrough: prepare_state function usage", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/prepare_state/prepare_state.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output io: qbit[]) { 2 | prepare_state([ 3 | 0, 4 | 0.002, 5 | 0.004, 6 | 0.006, 7 | 0.0081, 8 | 0.0101, 9 | 0.0121, 10 | 0.0141, 11 | 0.0161, 12 | 0.0181, 13 | 0.0202, 14 | 0.0222, 15 | 0.0242, 16 | 0.0262, 17 | 0.0282, 18 | 0.0302, 19 | 0.0323, 20 | 0.0343, 21 | 0.0363, 22 | 0.0383, 23 | 0.0403, 24 | 0.0423, 25 | 0.0444, 26 | 0.0464, 27 | 0.0484, 28 | 0.0504, 29 | 0.0524, 30 | 0.0544, 31 | 0.0565, 32 | 0.0585, 33 | 0.0605, 34 | 0.0625 35 | ], 0.01, io); 36 | } 37 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/prepare_state/prepare_state.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/qml_with_classiq_guide/qnn_with_pytorch.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "QNN with PyTorch", 3 | "description": "A simple QNN example using the PyTorch integration", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/qml_with_classiq_guide/qnn_with_pytorch.qmod: -------------------------------------------------------------------------------- 1 | qfunc encoding(theta: real, q: qbit[]) { 2 | RX(theta, q[0]); 3 | } 4 | 5 | qfunc mixing(theta: real, q: qbit[]) { 6 | RX(theta, q[0]); 7 | } 8 | 9 | qfunc main(input_0: real, weight_0: real, output res: qbit[]) { 10 | allocate(1, res); 11 | encoding(input_0, res); 12 | mixing(weight_0, res); 13 | } 14 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/qml_with_classiq_guide/vqe_primitive.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "VQE Primitive", 3 | "description": "A simple VQE example using cmain", 4 | "qmod_type": ["algorithms"], 5 | "problem_domain_tags": [], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/basic_tutorials/qml_with_classiq_guide/vqe_primitive.qmod: -------------------------------------------------------------------------------- 1 | HAMILTONIAN: PauliTerm[] = [ 2 | PauliTerm { 3 | pauli=[Pauli::I], 4 | coefficient=0.5 5 | }, 6 | PauliTerm { 7 | pauli=[Pauli::Z], 8 | coefficient=0.5 9 | }, 10 | PauliTerm { 11 | pauli=[Pauli::X], 12 | coefficient=-1 13 | } 14 | ]; 15 | 16 | qfunc main(output q: qbit, angles: real[3]) { 17 | allocate(1, q); 18 | U(angles[0], angles[1], angles[2], 0, q); 19 | } 20 | 21 | cscope ``` 22 | res = vqe(hamiltonian=HAMILTONIAN, maximize=False, initial_point=[], optimizer=Optimizer.COBYLA, max_iteration=1000, tolerance=0.001, step_size=0, skip_compute_variance=False, alpha_cvar=1.0) 23 | save({'result': res}) 24 | ``` 25 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/analyze/analyze.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Analyze - Classiq Visualization Tool", 3 | "description": "Demonstration of the Classiq visualization tool", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/analyze/analyze.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | allocate(4, x); 3 | hadamard_transform(x); 4 | y = (x ** 2) + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/analyze/analyze.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/classical_variables_and_operations/classical_variables_and_operations.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Design - Classical Control Flow", 3 | "description": "Demonstration of Classical Variables and Operations with the Qmod Language", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/classical_variables_and_operations/classical_variables_and_operations.qmod: -------------------------------------------------------------------------------- 1 | qfunc apply_condition(index: int, qubit: qbit) { 2 | if ((index % 2) == 0) { 3 | X(qubit); 4 | } 5 | } 6 | 7 | qfunc main(output x: qbit[]) { 8 | allocate(10, x); 9 | repeat (index: x.len) { 10 | apply_condition(index, x[index]); 11 | } 12 | } 13 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/classical_variables_and_operations/classical_variables_and_operations.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/design/design.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Design - The Qmod Language", 3 | "description": "Demonstration of Qmod Language", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/design/design.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | allocate(3, x); 3 | hadamard_transform(x); 4 | y = (x ** 2) + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/quantum_operations/quantum_operations.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Design - Quantum Operations", 3 | "description": "Demonstration of Quantum Operations with the Qmod Language", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/quantum_operations/quantum_operations.qmod: -------------------------------------------------------------------------------- 1 | qfunc apply_control(x: qnum, y: qnum) { 2 | control (x == 15) { 3 | y ^= 17; 4 | } 5 | } 6 | 7 | qfunc main(output x: qnum, output y: qnum) { 8 | allocate(4, x); 9 | allocate(5, y); 10 | hadamard_transform(x); 11 | apply_control(x, y); 12 | } 13 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/quantum_variables_and_functions/quantum_variables_and_functions.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Design - Quantum Variables and Functions", 3 | "description": "Explanation of Quantum Variables and functions", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/design/quantum_variables_and_functions/quantum_variables_and_functions.qmod: -------------------------------------------------------------------------------- 1 | qfunc flip_msb(reg: qbit[]) { 2 | X(reg[reg.len - 1]); 3 | } 4 | 5 | qfunc main(output indicator: qbit) { 6 | x: qnum; 7 | allocate(4, x); 8 | flip_msb(x); 9 | indicator = x == 8; 10 | } 11 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/execute/execute.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Execute", 3 | "description": "Configuring Execution with Classiq", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/execute/execute.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | allocate(4, x); 3 | hadamard_transform(x); 4 | y = (x ** 2) + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/execute/execute.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/optimize/optimize.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Optimize - The Synthesis Engine", 3 | "description": "Demonstration of Constraints", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/optimize/optimize.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | allocate(4, x); 3 | hadamard_transform(x); 4 | y = (x ** 2) + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/classiq_101/classiq_concepts/optimize/optimize.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_depth": 500, 4 | "optimization_parameter": "width" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /tutorials/classiq_101/hello_many_worlds/hello_many_worlds.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output x: qnum, output y: qnum) { 2 | allocate(4, x); 3 | hadamard_transform(x); 4 | y = (x ** 2) + 1; 5 | } 6 | -------------------------------------------------------------------------------- /tutorials/classiq_101/hello_many_worlds/hello_many_worlds.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/hadamard_test/hadamard_test.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Hadamard Test", 3 | "description": "Quantum Primitives with Classiq: Hadamard Test)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/hadamard_test/hadamard_test.qmod: -------------------------------------------------------------------------------- 1 | qfunc controlled_qft(expectation_value: qbit, psi: qbit[]) { 2 | control (expectation_value) { 3 | qft(psi); 4 | } 5 | } 6 | 7 | qfunc preparation_and_application(expectation_value: qbit, psi: qbit[]) { 8 | within { 9 | H(expectation_value); 10 | } apply { 11 | controlled_qft(expectation_value, psi); 12 | } 13 | } 14 | 15 | qfunc main(output expectation_value: qbit) { 16 | psi: qbit[]; 17 | allocate(1, expectation_value); 18 | allocate(4, psi); 19 | preparation_and_application(expectation_value, psi); 20 | } 21 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/linear_combination_of_unitaries/linear_combination_of_unitaries.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Linear Combination of Unitaries (LCU)", 3 | "description": "Demonstration of the LCU algorithm for a specific example", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/linear_combination_of_unitaries/linear_combination_of_unitaries.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare(controller: qnum) { 2 | inplace_prepare_state([0.5, 0.25, 0.25, 0], 0.01, controller); 3 | } 4 | 5 | qfunc select(controller: qnum, psi: qnum) { 6 | control (controller == 0) { 7 | apply_to_all(IDENTITY, psi); 8 | } 9 | control (controller == 1) { 10 | qft(psi); 11 | } 12 | control (controller == 2) { 13 | invert { 14 | qft(psi); 15 | } 16 | } 17 | } 18 | 19 | qfunc main(output controller: qnum, output psi: qnum) { 20 | allocate(2, psi); 21 | allocate(2, controller); 22 | within { 23 | prepare(controller); 24 | } apply { 25 | select(controller, psi); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/phase_kickback/phase_kickback.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Phase Kickback", 3 | "description": "Quantum Primitives with Classiq: Phase Kickback)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/quantum_primitives/phase_kickback/phase_kickback.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_minus(output target: qbit) { 2 | allocate(1, target); 3 | X(target); 4 | H(target); 5 | } 6 | 7 | qfunc oracle_function(target: qbit, x: qnum) { 8 | target ^= x == 0; 9 | } 10 | 11 | qfunc oracle_phase_kickback(x: qnum) { 12 | target: qbit; 13 | within { 14 | prepare_minus(target); 15 | } apply { 16 | oracle_function(target, x); 17 | } 18 | } 19 | 20 | qfunc main(output x: qnum) { 21 | allocate(4, x); 22 | hadamard_transform(x); 23 | oracle_phase_kickback(x); 24 | } 25 | -------------------------------------------------------------------------------- /tutorials/classiq_101/whats_classiq/whats_classiq.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "What's Classiq", 3 | "description": "An Example of What is Classiq", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic", "demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/classiq_101/whats_classiq/whats_classiq.qmod: -------------------------------------------------------------------------------- 1 | qfunc prepare_minus(output out: qbit) { 2 | allocate(1, out); 3 | X(out); 4 | H(out); 5 | } 6 | 7 | qfunc constant_function(x: qnum, res: qbit) { 8 | res ^= x < (2 ** x.size); 9 | } 10 | 11 | qfunc apply_oracle(x: qnum) { 12 | aux: qbit; 13 | within { 14 | prepare_minus(aux); 15 | } apply { 16 | constant_function(x, aux); 17 | } 18 | } 19 | 20 | qfunc main(output x: qnum) { 21 | allocate(4, x); 22 | hadamard_transform(x); 23 | apply_oracle(x); 24 | hadamard_transform(x); 25 | } 26 | -------------------------------------------------------------------------------- /tutorials/classiq_101/whats_classiq/whats_classiq.synthesis_options.json: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_12_qubits.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Arithmetic Model (Large Width)", 3 | "description": "Complex Arithmetic Expression: Max Width 12", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_12_qubits.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output z: qnum) { 2 | x: qnum; 3 | y: qnum; 4 | x = 2; 5 | y = 1; 6 | z = (((2 * x) + y) + max(3 * y, 2)) > 4; 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_12_qubits.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 12, 4 | "optimization_parameter": "depth" 5 | }, 6 | "preferences": { 7 | "random_seed": 424788457 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_9_qubits.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Arithmetic Model (Small Width)", 3 | "description": "Complex Arithmetic Expression: Max Width 9", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["basic"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_9_qubits.qmod: -------------------------------------------------------------------------------- 1 | qfunc main(output z: qnum) { 2 | x: qnum; 3 | y: qnum; 4 | x = 2; 5 | y = 1; 6 | z = (((2 * x) + y) + max(3 * y, 2)) > 4; 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/arithmetic_expressions/arithmetic_demo_9_qubits.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 9, 4 | "optimization_parameter": "depth" 5 | }, 6 | "preferences": { 7 | "random_seed": 424788457 8 | } 9 | } 10 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/hardware_aware_mcx/hardware_aware_mcx_all_to_all.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: All-to-All Connectivity", 3 | "description": "HW-aware Synthesis of MCX Function (All-to-All Connectivity)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/hardware_aware_mcx/hardware_aware_mcx_all_to_all.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(15, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/hardware_aware_mcx/hardware_aware_mcx_all_to_all.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "max_width": 18, 4 | "max_gate_count": {}, 5 | "optimization_parameter": "depth" 6 | }, 7 | "preferences": { 8 | "machine_precision": 8, 9 | "custom_hardware_settings": { 10 | "basis_gates": ["cx", "u"], 11 | "is_symmetric_connectivity": true 12 | }, 13 | "debug_mode": true, 14 | "synthesize_all_separately": false, 15 | "optimization_level": 3, 16 | "output_format": ["qasm"], 17 | "pretty_qasm": true, 18 | "transpilation_option": "auto optimize", 19 | "timeout_seconds": 300, 20 | "random_seed": -1 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/hardware_aware_mcx/hardware_aware_mcx_linear.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "MCX Function: Linear Connectivity", 3 | "description": "HW-aware Synthesis of MCX Function (Linear Connectivity)", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["function"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/hardware_aware_mcx/hardware_aware_mcx_linear.qmod: -------------------------------------------------------------------------------- 1 | qfunc my_mcx(cntrl: qbit[], target: qbit) { 2 | control (cntrl) { 3 | X(target); 4 | } 5 | } 6 | 7 | qfunc main(output cntrl: qbit[], output target: qbit) { 8 | allocate(15, cntrl); 9 | allocate(1, target); 10 | my_mcx(cntrl, target); 11 | } 12 | -------------------------------------------------------------------------------- /tutorials/technology_demonstrations/qaoa/qiskit_res.npy: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tutorials/technology_demonstrations/qaoa/qiskit_res.npy -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/assets/graph1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tutorials/workshops/grover_workshop/assets/graph1.jpg -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/assets/graph2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tutorials/workshops/grover_workshop/assets/graph2.jpg -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/assets/oracle1.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tutorials/workshops/grover_workshop/assets/oracle1.jpg -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/assets/oracle2.jpg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Classiq/classiq-library/a2a9de7600d070a4e89d87d00baf06f70d11ab74/tutorials/workshops/grover_workshop/assets/oracle2.jpg -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/grover_workshop.metadata.json: -------------------------------------------------------------------------------- 1 | { 2 | "friendly_name": "Workshop: Grover", 3 | "description": "A workshop about the Grover algorithm", 4 | "problem_domain_tags": [], 5 | "qmod_type": ["algorithms"], 6 | "level": ["demos"] 7 | } 8 | -------------------------------------------------------------------------------- /tutorials/workshops/grover_workshop/grover_workshop.synthesis_options.json: -------------------------------------------------------------------------------- 1 | { 2 | "constraints": { 3 | "optimization_parameter": "depth" 4 | } 5 | } 6 | --------------------------------------------------------------------------------