Skip to content

Conversation

@Subh37106
Copy link
Contributor

Implement Advanced Multi-Qubit Gate Library
Overview
This PR implements the advanced multi-qubit gate library requested in issue #35, expanding the simulator's capabilities for sophisticated quantum algorithms like Grover's search and Shor's algorithm.

✅ Implemented Features
Core Gate Library
Toffoli Gate (CCX) - Double-controlled X gate implementation
Fredkin Gate (CSWAP) - Controlled SWAP gate implementation
Multi-controlled X/Z Gates - Variable control count support
Quantum Fourier Transform (QFT) - Both primitive and decomposed versions
System Integration
Parser Extensions - New AST nodes and syntax parsing for advanced gates
Visualizer Updates - Added gates to UI with LaTeX tooltips and drag-and-drop support
Build System - Updated CMakeLists.txt for compilation
Quality Assurance
Comprehensive Testing - Grover's algorithm validation test suite
High Precision - Achieved < 1e-12 numerical accuracy
Documentation - Complete API documentation and usage examples
🔧 Technical Details
New Files Added:
qubitverse/simulator/gates/advanced_gates.hh - Gate declarations
qubitverse/simulator/gates/advanced_gates.cc - Gate implementations
qubitverse/simulator/grover_test.cc - Validation test suite
Modified Files:
qubitverse/simulator/parser/ast.hh - New AST node types
qubitverse/simulator/parser/parser.cc - Parser extensions
qubitverse/visualizer/src/components/QuantumCircuit.jsx - UI updates
CMakeLists.txt - Build configuration
README.md - Documentation updates
🧪 Validation Results
✅ Toffoli gate: Correctly applies X when both controls are |1⟩
✅ Multi-controlled gates: Proper variable control handling
✅ QFT: Exact 0.5 superposition amplitudes (perfect precision)
✅ Grover's algorithm: Successfully finds target states
🎯 Impact
This implementation enables the simulator to handle real quantum algorithms, significantly expanding its educational and research capabilities while maintaining the existing clean architecture and high performance standards.
These are the backend test results:
Screenshot From 2025-09-03 18-55-45

closes #35

- Add Toffoli (CCX), Fredkin (CSWAP), and multi-controlled gates
- Implement Quantum Fourier Transform (QFT) with primitive and decomposed versions
- Extend parser to handle new gate syntax
- Update visualizer with new gates and tooltips
- Add comprehensive test suite with Grover's algorithm validation
- Update documentation and API references
- Achieve < 1e-12 numerical precision across all implementations
@github-actions
Copy link

github-actions bot commented Sep 3, 2025

Thanks for creating a PR for your Issue! ☺️

We'll review it as soon as possible.
In the meantime, please double-check the file changes and ensure that all commits are accurate.

If there are any unresolved review comments, feel free to resolve them. 🙌🏼

@Dark-CodeX
Copy link
Owner

@Subh37106 Send your email address, nexfellow and real name

@Dark-CodeX Dark-CodeX merged commit 50b4202 into Dark-CodeX:main Sep 9, 2025
1 of 2 checks passed
@Subh37106
Copy link
Contributor Author

@Dark-CodeX [email protected]
Nextfellow username:@Subham5292
Real name: Subham Paul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Advanced Multi-Qubit Gate Library

2 participants