Skip to content

Range Mixer

The range mixer function performs this operation:

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

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:

  • data_reg_input: [RegisterUserInput] (see RegisterUserInput)
  • lower_bound_reg_input: Union[float, int, RegisterUserInput]
  • upper_bound_reg_input: Union[float, int, RegisterUserInput]
  • mixer_parameter: Union[float, Parameter]

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-Register Example (y <= x <= z)

{
  "functions": [
    {
      "name": "main",
      "body": [
          {
              "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, synthesize

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)
quantum_program = synthesize(model.get_model())

Generated Quantum Program

 Range_Mixer_Example