How to write a high-performance quantum computing simulator in just a few lines of code

High-performance, really?

`   ┌─────────┐         ┌─────────┐                      ┌─────────┐0: ┤ RX(π/3) ├────■────┤ RY(π/5) ├────────────────■─────┤ RX(π/7) ├   ├─────────┤┌───┴───┐└─────────┘┌─────────┐     │     └────┬────┘1: ┤ RX(π/3) ├┤ RX(3) ├─────■─────┤ RY(π/5) ├─────┼──────────┼─────                                                                                                                    ├─────────┤└───────┘ ┌───┴───┐ ├─────────┤┌────┴────┐     │     2: ┤ RX(π/3) ├──────────┤ RX(3) ├─┤ RY(π/5) ├┤ RX(π/7) ├─────■─────   └─────────┘          └───────┘ └─────────┘└─────────┘`

How it was designed

`  R = [ a b ]      [ c d ]               [ a b 0 0 0 0 0 0 ]   ┌───┐       [ c d 0 0 0 0 0 0 ]0: ┤ R ├       [ 0 0 a b 0 0 0 0 ]   └───┘       [ 0 0 c d 0 0 0 0 ]1: ─────   =>  [ 0 0 0 0 a b 0 0 ]               [ 0 0 0 0 c d 0 0 ]2: ─────       [ 0 0 0 0 0 0 a b ]               [ 0 0 0 0 0 0 c d ]               [ a 0 b 0 0 0 0 0 ] 0: ─────       [ 0 a 0 b 0 0 0 0 ]   ┌───┐       [ c 0 d 0 0 0 0 0 ]1: ┤ R ├   =>  [ 0 c 0 d 0 0 0 0 ]   └───┘       [ 0 0 0 0 a 0 b 0 ]2: ─────       [ 0 0 0 0 0 a 0 b ]               [ 0 0 0 0 c 0 d 0 ]               [ 0 0 0 0 0 c 0 d ]               [ a 0 0 0 b 0 0 0 ]0: ─────       [ 0 a 0 0 0 b 0 0 ]               [ 0 0 a 0 0 0 b 0 ]1: ─────   =>  [ 0 0 0 a 0 0 0 b ]   ┌───┐       [ c 0 0 0 d 0 0 0 ]2: ┤ R ├       [ 0 c 0 0 0 d 0 0 ]   └───┘       [ 0 0 c 0 0 0 d 0 ]               [ 0 0 0 c 0 0 0 d ]`
`               [ 1 0 0 0 0 0 0 0 ]   ┌───┐       [ 0 1 0 0 0 0 0 0 ]0: ┤ R ├       [ 0 0 a b 0 0 0 0 ]   └─┬─┘       [ 0 0 c d 0 0 0 0 ]1: ──■──   =>  [ 0 0 0 0 1 0 0 0 ]               [ 0 0 0 0 0 1 0 0 ]  2: ─────       [ 0 0 0 0 0 0 a b ]               [ 0 0 0 0 0 0 c d ]                              [ 1 0 0 0 0 0 0 0 ]   ┌───┐       [ 0 1 0 0 0 0 0 0 ]0: ┤ R ├       [ 0 0 1 0 0 0 0 0 ]   └─┬─┘   =>  [ 0 0 0 1 0 0 0 0 ]1: ──┼──       [ 0 0 0 0 a b 0 0 ]     │         [ 0 0 0 0 c d 0 0 ]2: ──■──       [ 0 0 0 0 0 0 a b ]               [ 0 0 0 0 0 0 c d ]                     [ 1 0 0 0 0 0 0 0 ]               [ 0 a 0 b 0 0 0 0 ]0: ──■──       [ 0 0 1 0 0 0 0 0 ]   ┌─┴─┐       [ 0 c 0 d 0 0 0 0 ] 1: ┤ R ├   =>  [ 0 0 0 0 1 0 0 0 ]    └───┘       [ 0 0 0 0 0 a 0 b ] 2: ─────       [ 0 0 0 0 0 0 1 0 ]                [ 0 0 0 0 0 c 0 d ]`

--

--

More from Transilvania Quantum

Quantum professionals and enthusiasts brought together to make technological advancments.

Get the Medium app

Software engineer. Quantum computing enthusiast