Skip to content

docs: fix endianness, exp_pauli, observe, spin example (#3341)#4376

Open
mitchdz wants to merge 2 commits intoNVIDIA:mainfrom
mitchdz:gh-3341
Open

docs: fix endianness, exp_pauli, observe, spin example (#3341)#4376
mitchdz wants to merge 2 commits intoNVIDIA:mainfrom
mitchdz:gh-3341

Conversation

@mitchdz
Copy link
Copy Markdown
Collaborator

@mitchdz mitchdz commented Apr 23, 2026

Closes #3341.

  • Fill in the missing spin-operator construction example in operators.{py,cpp} (the [Begin Spin] block was empty).
  • Fix the get_state endianness description: text said "Big-endian" while the table showed LSB-on-left. Rewrite with an explicit qubit-to-bit mapping and a note covering SampleResult, get_pauli_word(), and the
    binary form of the statevector index.
  • exp_pauli docs called the result a sum of exponentials; it's a product. Also swap the demo words from XYZ/IXX (commute, hides the point) to ZYX/ZXX.
  • Default shots_count for observe is -1, not 1.
  • Rewrite SpinOperator.degrees docstring for consistency; fix max_degree docstring (said "smallest").

mitchdz added 2 commits April 23, 2026 05:09
  Closes NVIDIA#3341.

  - Fill in the missing spin-operator construction example in
    `operators.{py,cpp}` (the `[Begin Spin]` block was empty).
  - Fix the `get_state` endianness description: text said "Big-endian"
    while
    the table showed LSB-on-left. Rewrite with an explicit qubit-to-bit
    mapping and a note covering `SampleResult`, `get_pauli_word()`, and
the
    binary form of the statevector index.
  - `exp_pauli` docs called the result a sum of exponentials; it's a
    product. Also swap the demo words from `XYZ`/`IXX` (commute, hides
the
    point) to `ZYX`/`ZXX`.
  - Default `shots_count` for `observe` is `-1`, not `1`.
  - Rewrite `SpinOperator.degrees` docstring for consistency; fix
    `max_degree` docstring (said "smallest").

Signed-off-by: mdzurick <mitch_dz@hotmail.com>
Copy link
Copy Markdown
Collaborator

@sacpis sacpis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks @mitchdz. Left few comments.

#include <cudaq.h>
#include <iostream>

void build_operator() {
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Seems like we are missing to call build_operator?

Comment on lines +221 to +222
The statevector returned by `get_state` indexes basis states by interpreting each
qubit's amplitude bit with qubit 0 as the least significant bit, qubit 1 as the
Copy link
Copy Markdown
Collaborator

@sacpis sacpis May 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we please show an example as where the LSB and MSB is?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Documentation Errors

2 participants