A simple quantum circuit simulator implementing three different approaches in both C and Python for efficient comparative analysis of quantum circuit simulation performance.
This project provides implementations of quantum circuit simulation using three distinct computational approaches:
- Matrix multiplication
- Tensor multiplication
- Additional optimization approach
Each approach is implemented in both C and Python to enable direct performance comparison between the two languages.
- Three simulation approaches with varying qubit capacity
- Dual implementation in C and Python
- Automatic performance benchmarking
- Visual performance comparison via plotting
- Runtime analysis across different qubit counts
- Matrix multiplication approach: Effectively simulates up to approximately 14 qubits before performance degrades
- Tensor multiplication approach: Improved scalability, handling approximately 28-29 qubits
- C implementations: Significantly outperform their Python counterparts across all approaches
- C compiler (clang recommended)
- Python 3.x
- Required packages for plotting
Clone the repository:
git clone https://github.com/feelerx/qc_simulator.git
cd qc_simulatorCompile each approach using:
clang filename.c headername.hExecute the compiled binary to run the simulation.
Execute each approach using:
python3 filename.pyAfter running any implementation:
- A
runtime.txtfile will be automatically generated - Ensure
runtime.txtis in the same directory asplot.py - Generate the performance graph:
python plot.pyThe graph displays the relationship between the number of qubits and the time taken to simulate them for each approach.
qc_simulator/
├── C implementations
├── Python implementations
├── plot.py # Performance visualization script
└── runtime.txt # Generated runtime data (auto-created)
Potential improvements and extensions:
- Implementation of noise models for realistic quantum simulation
- State visualization capabilities
- Parallelization of matrix and tensor multiplication operations
- Further code optimization techniques
- Additional simulation approaches
Contributions are welcome. Please feel free to submit issues and pull requests.
Note: This README is based on the available repository information. Some sections may need to be updated with additional details about specific file names, dependencies, and usage examples as the project evolves.