I have tried to solve Task 1 and Task 2. Please consider Task 1 for my official submission.
This task checks the time required for quantum operations upon increase in the number of computational qubits. For the same purpose I test our results for standard quantum circuit using pennylane's lightning qubit device. this is just for an initial test and has no purpose with the tasks.
Our main solution starts in the next bit where the "simulation" of these quantum operations are carried out using simple arithmetic with the help of numpy library. The vector size increases as O([1,0]
denoting
The technique here is that [1,0,0,0,0,0,0,0]
if you operate it with X(0) it will become [0,0,0,0,1,0,0,0]
. The init state is acquired using np.kron()
looped "n_qubit
" times. Same goes for X & H gates. But the CNOT Gate is not so trivial. So initially I use qiskit's circuit to operator functionality using Operator.from_circuit(QuantumCircuit)
method after sequentially operating the CNOT gate as I wish for value based accuracy. But I thought it could perform better and since our goal is to check the computational load I relaxed the result accuracy a little. Here's what I did : I calculated the kronecker product of CNOT n_qubits//2 times and took the direct sum of an identity matrix with cnot in case of odd num_qubit. This will provide us an operator of appropriate dimensions and I can subsequently calculate the growth rate of runtime with respect to increasing qubits.
Next I use an advanced simulation method by using tensors which is also another "classical" technique. The first idea is to writing the tensors as a tensor of shape (2,2,...)
n times. We treat gates similarly too. We do not need to change single qubit gates as their shape is already ((2,2))
, but we do need to reshape
2 qubit gates since the dimensions they have is np.tensordot
for the target axis in the state and the 1st axis in the single qubit operator (because there are only two axes). Then I rearrange the qubits by using np.transpose
and setting the last qubit in the "target" position and using this list as the transpose method, finally in order to retreieve the correct state. Similarly for double qubit gates we follow the same routine by applying tensordot
as state = np.tensordot(state, gate, axes=([control, target], [0, 1]))
. We then as we did before by bringing the second last qubit in the control position and the last qubit in the target position. We also must pop out the last two entries since then there would be a shape mismatch otherwise. After that we transpose the state in the fashion dictated by the aforementioned axes
list that we have created.
The BONUS section deals with sampling of these simulated quantum states mimicking real measurements using np.random.choice
parameterized by the probability (np.dot(np.conjugate(statevec), np.dot(O, statevec))
.
For each section I have validated my results against traditional pennylane results to show the accuracy of my final product states for each implementation i.e NAIVE matrix as well as ADVANCED tensor.
This research code implements Draper’s QFT-based addition algorithm and explores the impact of quantum noise on computational fidelity. It provides insights into the behavior of quantum circuits under realistic noise conditions.
The code constructs a quantum circuit to add two integers using quantum states:
- QFT: Encodes integer addition in the frequency domain.
- IQFT: Transforms results back to the computational basis.
- The circuit uses quantum registers to represent inputs and the sum.
Example:
( |3$\rangle$ + |4$\rangle$ = |7$\rangle$ )
Noise is modeled as random Pauli operators applied probabilistically after quantum gates:
-
(
$\alpha$ ): Probability of applying noise after single-qubit gates. -
(
$\beta$ ): Probability of applying noise after two-qubit gates.
Functionadd_noise()
applies these noise models, creating a noisy version of the circuit.
To ensure compatibility with realistic quantum processing units (QPUs), circuits are transformed into the gate basis: {CX, ID, RZ, SX, X}.
Fidelity quantifies the similarity between the ideal and noisy circuit outputs:
- Noise Levels: Fidelity is analyzed for varying noise probabilities ((\alpha, \beta)).
- Findings: Fidelity generally decreases with increased noise, but results can vary based on gate usage and noise configuration.
- Histograms: Show the output counts for ideal and noisy simulations.
- Line Plot: Depict fidelity trends across different noise levels.
This code offers a framework for analyzing the robustness of quantum algorithms in noisy environments, providing critical insights for quantum error mitigation research.
Noise in quantum computations distorts the intended operations, leading to deviations in statevector fidelity and inaccurate measurement outcomes. Each gate, especially two-qubit gates, introduces errors that accumulate throughout the circuit, amplifying the impact of noise on the final results. Mitigating noise is essential to maintain reliable computations and accurate results.
For our purposes the above analyses answer the question.
- To address noise in QPU-transpiled circuits, employ circuit optimization and error mitigation techniques tailored to the hardware's topology. Key strategies include gate reduction, native gate decomposition directly translate circuits into the QPU's native gate set to reduce redundant operations, and methods like Zero-Noise Extrapolation (ZNE) to estimate low-noise results, preserving fidelity and improving measurement accuracy.
- Dynamical Decoupling (DD) reduces decoherence at the hardware level, and intelligent qubit mapping minimizes two-qubit gate errors by optimizing qubit placement on the QPU. Intelligent qubit mapping places logical qubits on physically closer QPU qubits, reducing long-distance two-qubit gates that amplify noise. Combined with layout optimization during transpilation, this approach ensures that the circuit respects hardware-specific connectivity, decreasing two-qubit gate errors and enhancing overall circuit performance.
The number of gates directly correlates with noise levels, as each gate introduces errors that accumulate throughout the circuit. Two-qubit gates are particularly error-prone, so circuits with many such gates experience higher noise. Optimizing gate sequences and minimizing gate count are crucial for reducing overall noise in quantum computations.