Variable Time
ampamp.variable_time
Variable-Time Amplitude Amplification module.
Provides classes and utilities for evaluating and constructing variable-time quantum search algorithms.
VTAAEngine
Core engine for Variable-Time Amplitude Amplification.
Calculates asymptotic scaling, expected costs, and branch mass.
__init__(branches)
Initializes the VTAA Engine.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
branches
|
Sequence[VariableTimeBranch]
|
A sequence of branches defining the variable-time algorithm. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
If the branches sequence is empty. |
build_staged_state_circuit(p_s1, p_fail_cond)
staticmethod
Synthesizes a coherent variable-time state with flag registers.
Encoding convention used: - \(|00\rangle\): continue - \(|01\rangle\): success - \(|10\rangle\): fail
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
p_s1
|
float
|
The probability of early success at stage 1. |
required |
p_fail_cond
|
float
|
The conditional probability of failure given continuation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
QuantumCircuit |
QuantumCircuit
|
The synthesized variable-time quantum state circuit. |
stopping_time_moments()
Return the moments of the stopping time distribution.
Returns:
| Type | Description |
|---|---|
Tuple[float, float, float]
|
Tuple[float, float, float]: A tuple containing \((E[T], \sqrt{E[T^2]}, T_{max})\) under the branch distribution. |
vtaa_asymptotic_bound(polylog_factor=1.0, c_tmax=1.0, c_trms=1.0)
Parameterized Ambainis-style VTAA scaling estimate.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
polylog_factor
|
float
|
The logarithmic overhead factor. Defaults to 1.0. |
1.0
|
c_tmax
|
float
|
The constant scaling factor for \(T_{max}\). Defaults to 1.0. |
1.0
|
c_trms
|
float
|
The constant scaling factor for \(T_{rms}\). Defaults to 1.0. |
1.0
|
Returns:
| Name | Type | Description |
|---|---|---|
float |
float
|
The asymptotic complexity bound. Returns infinity if success probability is non-positive. |
VariableTimeBranch
dataclass
One branch of a variable-time algorithm.