qbraid_algorithms.amplitude_amplification.AALibrary
- class qbraid_algorithms.amplitude_amplification.AALibrary(*args, **kwargs)
Amplitude Amplification Library that implements Grover’s algorithm and general amplitude amplification
This library provides quantum algorithms for amplitude amplification, including:
Grover’s algorithm for unstructured search
General amplitude amplification for arbitrary oracles
Both algorithms use the principle of selective phase rotation to amplify desired quantum state amplitudes while suppressing unwanted ones.
- __init__(*args, **kwargs)
Initialize the AALibrary by calling the parent GateLibrary constructor.
Methods
__init__(*args, **kwargs)Initialize the AALibrary by calling the parent GateLibrary constructor.
add_gate(name, gate_def)Add a custom gate definition to the library.
add_var(name[, assignment, qtype])simple stub for programatically adding a variable
amp_ampl(Z, H, qubits, depth)Implement general amplitude amplification algorithm.
begin_gate(name, qargs[, params])GATE DEFINITION
begin_if(conditional)CONDITIONAL BLOCK
begin_loop(iterator[, ident])LOOPS
begin_subroutine(name, parameters[, return_type])SUBROUTINE DEFINITION
call_gate(gate, target[, controls, phases, ...])GATE APPLICATION
call_subroutine(subroutine, parameters[, ...])SUBROUTINE APPLICATION
close_scope()Close the current scope block and decrease indentation level.
comment(line)COMMENTS
controlled_op(gate_call, params[, n])CONTROLLED OPERATIONS
end_gate()End gate definition block.
end_if()End conditional block.
end_loop()End loop block.
end_subroutine()End subroutine definition block.
grover(H, qubits, depth)Implement Grover's algorithm for quantum search.
inverse_op(gate_call, params)INVERSE OPERATIONS
measure(qubits, clbits)MEASUREMENT
merge(program, imports, definitions, name)Merges data from a built library/GateBuilder into the current library bases scope :type program: :param program: Gate body which is added into definitions :type imports: :param imports: all imports the gate depends on :param gate_def: Gate definitions for any child gates/dynamic libraries used
Attributes
name