Skip to content

Latest commit

 

History

History
96 lines (62 loc) · 3.24 KB

File metadata and controls

96 lines (62 loc) · 3.24 KB

Visualization and Decomposition of Quantum Gates

Description

This directory contains the code that generates Figures A.7 and A.8 in the body of the BsC thesis. The scripts generate visualizations of the density matrices and the Bloch sphere representation for both a pure state and a mixed state.

Table of Contents

Project Structure

  • Toffoli_visualization.py:

    • Script that decomposes the Toffoli gate (CCNOT) into basic quantum gates.
    • Generates a black and white diagram of the decomposition and saves it as toffoli_decomposed_bw.png.
  • Bloch_visualization.py:

  • Script that generates visualizations of:

    • Pure and mixed states on the Bloch sphere.
    • 3D density matrix representations.
  • Expected outputs:

    • Bloch_pure_state.png: Representation of a pure state.
    • Bloch_mixed_state.png: Representation of a mixed state.
    • Density_pure_state.png: Density matrix of the pure state.
    • Density_mixed_state.png: Density matrix of the mixed state.

Installation

Requirements:

  1. Python 3.8+
  2. Dependencies:

Install dependencies using pip:

pip install qiskit matplotlib

Usage

1. Visualization of the Toffoli Gate

Run the script:

python Toffoli_visualization.py

The image will be generated as toffoli_decomposed_bw.png.

2. States on the Bloch Sphere and Density Matrix

Run the script:

python Bloch_visualization.py

Generated files:

  • Bloch_pure_state.png
  • Bloch_mixed_state.png
  • Density_pure_state.png
  • Density_mixed_state.png

Visualizations

  1. Bloch Sphere:

Pure state (`Bloch_pure_state.png`):

Bloch Pure State

Mixed state (`Bloch_mixed_state.png`):

Bloch Mixed State
  1. Density matrix:

Pure state (`Density_pure_state.png`):

Density Pure State

Mixed state (`Density_mixed_state.png`):

Density Mixed State
  1. Decomposition of the Toffoli Gate:

`toffoli_decomposed_bw.png`:

Toffoli Decomposed

Licence

This project is licensed under the same terms as the BSc thesis it is derived from. Please refer to the thesis documentation for specific licensing details and any applicable restrictions.

Contact

For questions or suggestions related specifically to this thesis, please contact: