• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Qiskit / qiskit / 7035250835
88%

Build:
DEFAULT BRANCH: main
Ran 29 Nov 2023 04:25PM UTC
Jobs 1
Files 987
Run time 1min
Badge
Embed ▾
README BADGES
x

If you need to use a raster PNG badge, change the '.svg' to '.png' in the link

Markdown

Textile

RDoc

HTML

Rst

29 Nov 2023 02:19PM UTC coverage: 87.444% (+0.004%) from 87.44%
7035250835

push

github

web-flow
Decomposition of single R gate in RR basis should be one R gate, not two (#11304)

* Decomposition of single R gate in RR basis should be one R gate, not two

Currently, a single R gate may come out of RR-decomposition as two R gates, which is obviously not ideal.

For example, `RGate(0.1, 0.2)` is currently decomposed (in RR basis) as

```
   ┌────────────────┐┌──────────┐
0: ┤ R(-3.0416,0.2) ├┤ R(π,0.2) ├
   └────────────────┘└──────────┘
```

Two `R(𝜗, 𝜑)` gates with the same 𝜑 parameter can be combined into one by simply adding up the 𝜗 values (giving us `R(0.1, 0.2)`, unsurprisingly).

In terms of `U(𝜗, 𝜑, 𝜆)`, it is the case when `𝜑 = -𝜆` that the two R-gates we construct have the same second parameter and therefore should be expressed as a single R gate.
For example, `U3Gate(0.1, 0.2, -0.2)` currently produces this RR-decomposition:

```
   ┌───────────────────┐┌─────────────┐
0: ┤ R(-3.0416,1.7708) ├┤ R(π,1.7708) ├
   └───────────────────┘└─────────────┘
```

which also unnecessarily consists of two R gates instead of just one.

This commit adds the two examples above as unit tests, ensuring they RR-decompose two just one R gate, as well as the code changes to make these two new tests pass, along with all existing tests, of course.

The condition for this special case is that the 𝜑 parameters of the two R-gates we would emit are the same (thus `mod_2pi(PI / 2. - lam)=mod_2pi(0.5 * (phi - lam + PI)`, simplified as `mod_2pi((phi + lam) / 2)=0`).

* Add release note

11 of 11 new or added lines in 1 file covered. (100.0%)

3 existing lines in 1 file now uncovered.

59768 of 68350 relevant lines covered (87.44%)

272498.04 hits per line

Jobs
ID Job ID Ran Files Coverage
1 7035250835.1 29 Nov 2023 04:25PM UTC 0
87.44
GitHub Action Run
Source Files on build 7035250835
Detailed source file information is not available for this build.
  • Back to Repo
  • 35567401 on github
  • Prev Build on gh-readonly-queue/main/pr-11308-b72033e1cd2d37eaeaadde0c23e6ea76e44f7c59 (#7029868266)
  • Next Build on main (#7038371588)
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc