Skip to content

Fix an issue with tensornet observe when the canonicalized spin_op doesn't span the entire qubit space#3038

Merged
1tnguyen merged 4 commits intoNVIDIA:mainfrom
1tnguyen:tnguyen/fix-tensornet-observe
Jun 12, 2025
Merged

Fix an issue with tensornet observe when the canonicalized spin_op doesn't span the entire qubit space#3038
1tnguyen merged 4 commits intoNVIDIA:mainfrom
1tnguyen:tnguyen/fix-tensornet-observe

Conversation

@1tnguyen
Copy link
Collaborator

Description

Symptom: CUTENSORNET_INVALID_VALUE error when using observe with a spin_op that doesn't span the entire qubit space, e.g., spin_op with a single term YIXXIZYZYYYIIY.

This is because we're using the number of elements in the degrees list to create the cutensornet's network operator, while adding Pauli operators at the values of those elements. Hence, this caused out-of-range (invalid value) exceptions.

The fix is that we need to find the actual max index to determine the size of the network operator to be created.

This is a regression since #2710, whereby the canonicalized spin_op no longer tracks degrees of identity Pauli.

Also,

  • Add an example, which will be validated by the Publishing pipeline.

  • Add unit tests, which will be validated by QA.

…oesn't span the entire qubit space

Signed-off-by: Thien Nguyen <thiennguyen@nvidia.com>
@1tnguyen 1tnguyen added the bug fix To be listed under Bug Fixes in the release notes label Jun 11, 2025
github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

Copy link
Collaborator

@khalatepradnya khalatepradnya 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, Thien!
(One Q about scope)

Copy link
Collaborator

@mitchdz mitchdz left a comment

Choose a reason for hiding this comment

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

Similar question to Pradnya, otherwise LGTM!

github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

github-actions bot pushed a commit that referenced this pull request Jun 11, 2025
@github-actions
Copy link

CUDA Quantum Docs Bot: A preview of the documentation can be found here.

@1tnguyen 1tnguyen merged commit 20c6dca into NVIDIA:main Jun 12, 2025
195 checks passed
github-actions bot pushed a commit that referenced this pull request Jun 12, 2025
annagrin pushed a commit to annagrin/cuda-quantum that referenced this pull request Jun 17, 2025
…oesn't span the entire qubit space (NVIDIA#3038)

Signed-off-by: Thien Nguyen <thiennguyen@nvidia.com>
Co-authored-by: Mitchell <mitch_dz@hotmail.com>
Signed-off-by: Anna Gringauze <agringauze@nvidia.com>
@bettinaheim bettinaheim added this to the release 0.12.0 milestone Jul 22, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug fix To be listed under Bug Fixes in the release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants