Skip to content

Range Mixer

The range mixer function performs the following operation:

\(M_{y, z, \theta} |x\rangle = \sum_{y \leq x' <= z, size(x')=size(x)} \alpha_{x', \theta} |x'\rangle\) .

I.e., the operation mixes the value of register x to be a superposition of all the possible values between the current values of register y and register z. x' remains with the same number of integer and fractional digits as x.

Register x is called data_reg_input, Register y is called lower_bound_reg_input, and Register z is called upper_bound_reg_input.

The bound registers can be either a quantum register or set to a fixed number.

Syntax

Function: RangeMixer

Parameters:

Register Names

The input registers are called data_reg_input, lower_bound_reg_input, and upper_bound_reg_input.

The output registers are called data_reg_output, lower_bound_reg_output, and upper_bound_reg_output.

The bound registers are added only if the corresponding argument is from RegisterUserInput type.

These names override the original name in the RegisterUserInput objects.

Three Registers Example (y <= x <= z)

{
        "logic_flow": [
            {
                "function": "RangeMixer",
                "function_params": {
                    "data_reg_input": {"size": 3},
                    "lower_bound_reg_input": {"size": 3},
                    "upper_bound_reg_input": {"size": 3},
                    "mixer_parameter": 0.4
                }
            }
        ]
    }
from classiq.builtin_functions import RangeMixer
from classiq import Model, RegisterUserInput

model = Model()
params = RangeMixer(
    data_reg_input=RegisterUserInput(size=3),
    lower_bound_reg_input=RegisterUserInput(size=3),
    upper_bound_reg_input=RegisterUserInput(size=3),
    mixer_parameter=0.4,
)
model.RangeMixer(params)
model.synthesize()

Generated Circuit

 Range_Mixer_Example