Skip to content

hemokosa/quantumfuck

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

16 Commits
 
 
 
 
 
 

Repository files navigation

Quantumf*ck: Poetic Quantum Programming Language

Installation

!pip install quri-parts[qulacs]
!pip install exrex

List of Quantumf*ck commands

Command Quantum Circuit Manipulation
> Make the next qubit the target of operation (pointer +1 )
< Make the previous qubit the target of operation (pointer -1)
+, H Apply Hadamard gate
~, T Apply $\frac{\pi}{4}$ phase shift gate
@, C Apply CNOT gate (target is the next qubit or specified by following number)
#, N Apply random Pauli gate (error rate 0.1)
: Estimate measurements from state vector (no actual measurement)
, Initialize state vector
; State vector randomization
[ Start of loop
] Conditional loop termination (exits loop if measured value is 0, otherwise returns to beginning of loop)
? Hadamard gate or $\frac{\pi}{4}$ phase shift gate is applied randomly
! Randomly move the qubit (pointer) to be manipulated
* Randomly move execution point

Usage

# Instantiate class
num = 5
qf = QF(num, regex=False, debug=False)

# Execute code
code = "[+!?~#!~@:]"
state, history, command, circuit = qf.parse(code)

# Output history of state vector
for i, s in enumerate(history):
    print(f"Step {i}: {s}")

License

This project is licensed under the MIT License - see the LICENSE file for details.

About

Quantumf*ck: Poetic Quantum Programming Language

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages