Skip to content

Oblivious

ampamp.oblivious

Oblivious Amplitude Amplification module.

Provides the ObliviousEngine to handle oblivious operations such as block encoding.

ObliviousEngine

Engine for Oblivious Amplitude Amplification (OAA).

Handles block-encoding unitaries and 'purified' reflection sequences.

__init__(m_data_qubits, l_ancilla_qubits=1, p=0.5)

Initializes the ObliviousEngine.

Parameters:

Name Type Description Default
m_data_qubits int

The number of data qubits.

required
l_ancilla_qubits int

The number of ancilla qubits. Defaults to 1.

1
p float

The success probability of the block encoding. Defaults to 0.5.

0.5

construct_block_encoding(unitary_matrix)

Embeds a unitary \(U\) into a larger operator \(A\).

The construction ensures that the top-left block of \(A\) behaves as \(\sqrt{p} U\).

Parameters:

Name Type Description Default
unitary_matrix ndarray

The unitary matrix \(U\) to encode.

required

Returns:

Name Type Description
QuantumCircuit QuantumCircuit

The constructed quantum circuit implementing the block encoding.

get_ancilla_rotation()

Prepares the ancilla in the \(\sqrt{p}|0\rangle + \sqrt{1-p}|1\rangle\) state.

Returns:

Name Type Description
QuantumCircuit QuantumCircuit

The rotation circuit for the ancilla.

get_reflections()

Constructs the joint \(R_0\) (ancilla) and \(R_{bad}\) (data) reflections.

Returns:

Name Type Description
QuantumCircuit QuantumCircuit

The circuit that conditionally applies phase reflections.