Internal APIs for developers

DynamicQuantumCircuits.Conversion.conv_astMethod
conv_ast(ast::MainProgram, state_vector::StateVector, num_qubits::Int64)::MainProgram

Converts a non-unitary quantum circuit so it can be tested for equality with its equivalent a unitary circuit

source
DynamicQuantumCircuits.Conversion.conv_progMethod
conv_prog(a::Any, state_vector::StateVector, num_qubits::Int, section::Int)::Any

Pattern matches a Prog element and returns it with the new address, based on the conversion from the StateVector

source
DynamicQuantumCircuits.Conversion.conv_qopMethod
conv_qop(inst::Instruction, state_vector::StateVector, section::Int)::Instruction

Converts the adresses of a quantum operation based on the state vector and section in the dynamic circuit.

source
DynamicQuantumCircuits.Reorder.reorder_columnsMethod
reorder_columns(matrix::Matrix{Any}, column_indices::Vector{Int})::Matrix

Reorder matrix based on column_indices

Example

julia> n = 3  # Number of bits
julia> m = create_bit_matrix(n)
julia> m_reordered = reorder_columns(original_matrix, column_indices)
source
DynamicQuantumCircuits.QuantumInformation.inner_productMethod
inner_product(x, y)::Vector

Calculate the inner product

Examples

The product is written as a bra standing on the left and a ket standing on the right, for example,

\[ ⟨β|α⟩= (⟨β|) ⋅(|α⟩)\]

TODO Doctest

Source

(1.46) Quantum Mechanics Book

source
DynamicQuantumCircuits.QuantumInformation.outer_productMethod
outer_product(x, y)::Matrix

Definition

\[(|β⟩) ⋅ (⟨α|) = |β⟩⟨α|\]

$|β⟩⟨α|$ is known as the outer product of $|β⟩$ and $⟨α|$. We will emphasize in a moment that |β⟩⟨α| is to be regarded as an operator; hence it is fundamentally different from the inner product ⟨β|α⟩, which is just a number.

There are also “illegal products.” We have already mentioned that an operator must stand on the left of a ket or on the right of a bra.

Examples

TODO Doctest

Source

(1.46) Quantum Mechanics Book

source
DynamicQuantumCircuits.QuantumInformation.tracedistMethod
tracedist(A::Matrix, B::Matrix)::Float64

Return the trace distance of register1 and register2.

Definition

Trace distance is defined as following:

\[\frac{1}{2} || A - B ||_{\rm tr}\]

Examples

TODO Doctest

References

  • https://en.wikipedia.org/wiki/Trace_distance
source
DynamicQuantumCircuits.QuantumInformation.verify_equivalenceFunction
verify_equivalence(traditional_circuit, dynamic_circuit, use_zx::Bool, transform_dynamic_circuit::Bool)::Float64

Verify the equality of a traditional_circuit and a reconstruced circuit, returning the trace distance and fidelity as a tuple

TODO change api to differentiate between exact and similar qc

source
DynamicQuantumCircuits.Tools.convert_addressMethod
convert_address(state::State, section::Int, address::Int)::Int64

Replaces the address of a qubit based on the state vector, section and position using a lookup table

Objective

This function converts old addresses into new addresses required for the ideal unitary circuit

source
DynamicQuantumCircuits.Transformations.overcome_resetsMethod
overcome_resets(ast::MainProgram, state_vector::StateVector, num_qubits::Int64)::Vector{Any}

overcomes resets operations by eliminating qubit reuse

This transforms a n qubit circuit circuit containing r reset operations into a n+r qubit quantum circuits

Algorithm

Overcome resets by interpreting a reset as measuring a qubit and applying an X operation on the measurement being |1⟩ and discarding the measurement result. To overcome the resets replace by introducing a new qubit and applying subsequent operations involving the qubit to the new qubit

source
DynamicQuantumCircuits.Transformations.trans_astMethod
trans_ast(ast::MainProgram, state_vector::StateVector, num_qubits::Int64)::MainProgram

transform the dynamic primitives to unveil the underlying unitary functionality

How

  1. Overcome resets
  2. Apply the /defered measurement principle/
source

```