More standard gates

Open
#16 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
55/100
Issue type
Feature
Clarity
Mostly clear
Activity status
Active
Tech stack
python, rust
Domain
backend

Research direction

Start with src/gates.rs and the existing gate methods; the issue says single-qubit and controlled gates follow that pattern, while mcx uses control_mask and the multi-qubit rotations and cswap need the listed decompositions. Then inspect the drawer’s SYMBOLS table, the type stub, and the gates documentation page. Done means adding the requested gates and measure_all behavior, with each represented in those supporting files.

Written by the indexing model from the issue text.

Description

enhancement
What you want to do

Build common circuits without writing unitary matrices by hand.

Implementation notes
  • The single-qubit and controlled ones need only a matrix in src/gates.rs and a method, the same
    as existing gates. mcx maps straight onto control_mask.
  • rzz is diagonal, so it is a phase that depends on the parity of the two bits. Without a two-qubit
    kernel, decompose it as CX · RZ · CX. rxx and ryy are the same with basis changes.
  • cswap(c, a, b) (control c, swap a and b) is cx(b, a), then ccx(c, a, b), then cx(b, a).
  • Add every gate to the drawer's SYMBOLS table, the type stub and the gates docs page.
What it could look like
qc.sx(0); qc.sxdg(0)
qc.cy(0, 1); qc.ch(0, 1); qc.crx(0, 1, t); qc.cry(0, 1, t)
qc.rzz(0, 1, t); qc.rxx(0, 1, t); qc.ryy(0, 1, t)
qc.cswap(0, 1, 2)
qc.mcx([0, 1, 2, 3], 4)     # any number of controls
qc.measure_all()            # adds classical bits if needed, like Qiskit
Contributing
  • I would like to open a pull request for this (see CONTRIBUTING.md).
Dominant language
Rust
Stars
1
Forks
0
Avg merge
12m
Merged PRs (30d)
4

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from kaiwave/qsengine

All issues in kaiwave/qsengine

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.