Flip-Flop Quantum RAM

This module implements the state preparation scheme called FFQRAM see https://arxiv.org/abs/1901.02362.

Each DB has entries that are created by controlled rotations. The final step is a measurement to cancel out the wrong branch. This makes the algorithm probabilistic in its nature.

class dc_qiskit_algorithms.FlipFlopQuantumRam.FFQramEntry[source]

Bases: object

An DB entry of the FF QRAM scheme

get_bits(bin_length=None)[source]

Get the binary bit representation of data and label for state basis identification

Return type

str

Returns

a bit array

bus_size()[source]

Returns needed bus size for this entry

Return type

int

Returns

the length

add_to_circuit(qc, bus, register)[source]

This method adds the gates to encode this entry into the circuit :type qc: FFQramEntry :param qc: quantum circuit to apply the entry to :type bus: QuantumCircuit :param bus: the registers for the bus :type register: Union[QuantumRegister, list] :param register: the target register for the amplitude :rtype: QuantumCircuit :return: the applied circuit

class dc_qiskit_algorithms.FlipFlopQuantumRam.FFQramDb(iterable=(), /)[source]

Bases: List[dc_qiskit_algorithms.FlipFlopQuantumRam.FFQramEntry]

The DB object with methods to create circuits

bus_size()[source]

From all entries get the maximum needed bus size

Return type

int

Returns

the bus size for the DB

add_to_circuit(qc, bus, register)[source]

Add the DB to the circuit.

Parameters
  • qc (FFQramDb) – the quantum circuit

  • bus (QuantumCircuit) – the bus register

  • register (Union[QuantumRegister, List[Qubit]]) – the target register for the amplitudes

Return type

None

Returns

the circuit after DB being applied

add_entry(pa, data, label)[source]

Add an entry to the (classical representation of) the DB.

Parameters
  • pa (FFQramDb) – probability amplitude

  • data (float) – binary representation of data

  • label (bytes) – binary representation of the label

Return type

None

add_entry_int(pa, data, label)[source]

Add an entry to the (classical representation of) the DB.

Parameters
  • pa (FFQramDb) – probability amplitude

  • data (float) – the integer value of the data

  • label (int) – the integer value of the label

Return type

None

dc_qiskit_algorithms.FlipFlopQuantumRam.add_vector(db, vec)[source]

Add a vector to the DB. It makes sense to give an empty DB.

Parameters
  • db (FFQramDb) – The FFQRAM DB

  • vec (List[complex]) – the vector to be added

Return type

None