Skip to content

Automatic Registers Resolution

The Engine supports the automatic merging of registers. Meaning that the circuit will open up with all the known registers already collapsed. This feature completes the manual registers merging that can be cumbersome and complicated

Introduction

Each function contains information on its registers, which is mainly provided by our synthesis engine. For example, the register type (input, output, zero, auxiliary), the name, and the qubits it contains.

You can get information about the function's registers by clicking on the function and looking in the information tab.

Opening info tab

Screenshots on this page come from this example:

from classiq import ModelDesigner, RegisterUserInput
from classiq.builtin_functions import Arithmetic

params = Arithmetic(
    expression="(a + b + c & 15) % 8 ^ 3 & a ^ 10 ^ d == 4",
    definitions=dict(
        a=RegisterUserInput(size=2, is_signed=False),
        b=RegisterUserInput(size=2),
        c=RegisterUserInput(size=3),
        d=RegisterUserInput(size=1),
    ),
    uncomputation_method="optimized",
    qubit_count=25,
)

model_designer = ModelDesigner()
model_designer.Arithmetic(params)
circuit = model_designer.synthesize()
circuit.show_interactive()

Wire Merging Criteria

Two, or more, wires can be merged if and only if:

  1. The wire's source and destination are the same gates
  2. The wires operate on sequential qubits. For example, a register will be merged if the wires are between qubits 4, 5, and 6. but a register with wires on qubits 1, 4, and 5 won't merge.

Input Registers

Currently, we support only input registers; you can see if a register is an input register in the information tab.

Register info

If a gate's input register meets the merge criteria, wires will be automatically merged when a circuit loads.

visual information

  • label - a label appears on the right side of the wire next to the gate (left of the gate), containing the register's name.
  • color - wires are color coded as described in special registers.

Circuit

If the Engine cannot merge wires, it displays them separately.

Disjoint case

Special Registers

  1. Zero - A register that always contains the |0⟩ state, appears with the color GREEN
  2. Auxiliary - A register that is used as a helper to a function appears with the color RED

Output Registers

This feature will be supported in future versions.

disclaimer

This is an experimental feature. Your feedback is appreciated.