Skip to content

Conversation

@ahkatlio
Copy link

@ahkatlio ahkatlio commented Jun 2, 2025

fix #3

Overview

This PR confirms that the flexible circuit integration mechanism requested is already implemented in the codebase within:

  1. qpixl_integrator.py
  2. QPIXL_demo.ipynb (with complete demonstrations)

Implementation Details

The existing implementation satisfies all requirements:

1. Classes and Components

  • CircuitIntegrator class - Core integration mechanism
  • IntegrationMode enum - Defines different integration strategies:
    • MERGE: Places circuits side by side with optional connections
    • SEQUENTIAL: Applies circuits one after another
    • ENTANGLE: Connects circuits using specified entangling operations
    • CUSTOM: Supports user-defined integration rules
  • QPIXLAlgorithmEncoder - For algorithm integration during encoding

2. Key Features

  • Flexible integration of arbitrary quantum circuits with QPIXL data circuits
  • Support for multiple integration strategies through a simple API
  • Custom rule definition via function callbacks
  • Comprehensive documentation and examples in the notebook

3. Documentation

The notebook already contains clear markdown explanations:

  • Cell ID "71e16d48" explains the QPIXLAlgorithmEncoder approach
  • Cell ID "80b0ac14" documents the CircuitIntegrator class and integration modes

Examples

Complete demonstration of all integration modes is shown in demo_qpixl_integrator() function (cell ID "8719b1e3") and practical examples throughout the notebook.

@ahkatlio
Copy link
Author

ahkatlio commented Jun 5, 2025

Hello @danielbultrini, May you check the pr please.

@danielbultrini
Copy link
Contributor

Hi, thank you very much for this submission, I will check it soon!

@ahkatlio
Copy link
Author

Hello @danielbultrini, May you check the pr please.

@danielbultrini
Copy link
Contributor

I have checked this now, and it is good - tomorrow is the last day of the hackathon, so we will decide on the best implementation then. Thank you for the submission (sorry I was on vacation until today).

@ahkatlio
Copy link
Author

I have checked this now, and it is good - tomorrow is the last day of the hackathon, so we will decide on the best implementation then. Thank you for the submission (sorry I was on vacation until today).

@danielbultrini Please review it before the time ends

@danielbultrini
Copy link
Contributor

danielbultrini commented Jun 10, 2025 via email

@ahkatlio
Copy link
Author

Hello @danielbultrini did you find any winner yet?

@danielbultrini
Copy link
Contributor

Hello @ahkatlio not yet, we have until monday to finalize everything, since the submissions were all good, it will take time to determine the best implementation.

@danielbultrini
Copy link
Contributor

I would say, that if you want to guarantee a win, and you can work on this over the weekend, if you update it so that you slice the second circuit (say, every N gates), and put a connection according to the rule in the middle of the CFRQI/QPIXL circuit, then I would be very happy.

Think of it like having the circuits like this:
Screenshot 2025-06-12 at 13 05 22

@danielbultrini danielbultrini marked this pull request as draft June 12, 2025 11:05
@ahkatlio
Copy link
Author

Hello @danielbultrini,
The create_sliced_circuit method has been implemented to address this. Here's how:

  1. Slicing the Second Circuit: The provided algorithm_circuit (the "second circuit") is now sliced into smaller segments. The size of these segments (number of gates per slice) is controlled by the slice_size parameter (your "every N gates"). This is handled by the internal call to integrator._slice_circuit(algorithm_circuit, slice_size) (line 470).

  2. Integration into QPIXL Circuit: These slices are then integrated directly into the main QPIXL encoding loop.

    • The insertion_rule parameter (e.g., 'interval', 'angles') determines where in the QPIXL encoding process these slices are inserted. For example, if insertion_rule='interval', a slice is inserted every interval iterations of the main encoding loop (lines 491-500).
    • This allows the slices of the second circuit to be placed "in the middle" of the QPIXL circuit construction.
  3. Connection Rule: At each insertion point, a connection_rule (e.g., 'cx', 'cz', 'swap') is applied between specified qubits of the QPIXL data registers (storage_qubits) and the algo_qubits where the slice is applied. The connection_map parameter defines which data qubits connect to which algorithm qubits (lines 517-525).

@danielbultrini
Copy link
Contributor

Okay, this is basically perfect - all that needs to be done is for my sake, could you please make a standalone notebook with this instead of having it in the QPIXL_demo? I would rather put it in myself in a way I think is more consistent. Thank you!

@ahkatlio
Copy link
Author

Okay, this is basically perfect - all that needs to be done is for my sake, could you please make a standalone notebook with this instead of having it in the QPIXL_demo? I would rather put it in myself in a way I think is more consistent. Thank you!

Done!

@danielbultrini
Copy link
Contributor

Hi @ahkatlio thank you for your work and congratulations!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Make a function that takes a circuit as an input and mixes it with the QPIXL input.

2 participants