Skip to content

Amplitude Loading

The amplitude loading function performs the following operation: \(|d\rangle |0\rangle \rightarrow \sqrt{1-f^2(d)}|d\rangle |0\rangle + f(d)|d\rangle |1\rangle\),

for any input, \(|d\rangle\), and function \(f(d)\).

The function \(f(d)\) is expected to be real, include a single variable only, its domain is [0, 1) and its range is contained in [-1, 1]. For multi-argument or complex functions, an exception will be raised. If for some input, the function value exceeds from the [-1, 1] range this value will be trimmed to the mentioned range.

The function is implemented using repeated multiple controlled RY rotations where \(|d\rangle\) is the control register and \(|0\rangle\) it the target qubit.

The naive_implementations consists of equally sized MCU gates, while the optimized_implementation replaces some of the gates with MCU gates with less control qubits.

The is_zero_a_valid_input is a boolean flag that indicates whether to consider zero input state, or to ignore it. For example, for the 1/x function, we should ignore the zero input state, as it undefined.


Function: AmplitudeLoading


  • size: PositiveInt
  • expression: str
  • use_naive_implementation: bool
  • is_zero_a_valid_input: bool


  "logic_flow": [
                "function": "AmplitudeLoading",
                "function_params": {
                    "size": 3,
                    "expression": "1/x",
                    "use_naive_implementation": false
  "preferences": {
    "draw_at_level": 3
from classiq.interface.generator.amplitude_loading import AmplitudeLoading
from classiq import ModelDesigner

model_designer = ModelDesigner()
amplitude_loading_params = AmplitudeLoading(
model_designer.preferences.draw_at_level = 3