Skip to content

fix(docs): 🐛 make the README quick-start examples runnable - #222

Open
nelyasi wants to merge 4 commits into
Algorithmiq:mainfrom
nelyasi:main
Open

fix(docs): 🐛 make the README quick-start examples runnable#222
nelyasi wants to merge 4 commits into
Algorithmiq:mainfrom
nelyasi:main

Conversation

@nelyasi

@nelyasi nelyasi commented Aug 11, 2026

Copy link
Copy Markdown

Both snippets under “Quick example” currently fail with a TypeError.

Circuit.init has the signature

(gates, system_size, parameters=(), initial_state=None)

so system_size is required, but neither example passes it. The equivalent examples under docs/content/docs/ already include it correctly; the README appears to be the only one that drifted, likely because it is not covered by just doctest-docs.

The comments also describe the gates as exp(-i θ/2 · H), but ExpGate applies exp(+i θ · H). The engine rotates by 2 · gen_coeff · param (LayerAngle in Evolution.h, and cos(2 * param) in Evolution.cpp:476), so both the sign and the factor in the comments were incorrect. I fixed the comments only; no code changes were needed.

I also fixed an unterminated </p tag left over from the benchmark images.

Updated the README to correct mathematical notation and improve clarity in examples.

Signed-off-by: Seyed Navid Elyasi <navid.elyasi97@gmail.com>
@github-actions github-actions Bot added the documentation Improvements or additions to documentation label Aug 11, 2026
@diagonal-hamiltonian

Copy link
Copy Markdown
Collaborator

Thank you for the PR, I will look at it tomorrow 🙂

@robertodr

robertodr commented Aug 12, 2026

Copy link
Copy Markdown
Member

Thanks for the PR! Noting to myself that we should configure the documentation CI lane to add the examples in the README to the doctest-s to run, so we avoid these drifts in the future.

Before we merge, can you touch up the PR description to adopt our template? This is necessary to clarify that you've read and approved the contributor license agreement.

@codecov

codecov Bot commented Aug 12, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.70%. Comparing base (ec73093) to head (b361a8b).
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #222   +/-   ##
=======================================
  Coverage   97.70%   97.70%           
=======================================
  Files          14       14           
  Lines         742      742           
  Branches       98       98           
=======================================
  Hits          725      725           
  Misses         12       12           
  Partials        5        5           
Flag Coverage Δ
cpp 97.70% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

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

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants