Skip to content

Fix dynamics backend to accept density-matrix initial state#3967

Merged
sacpis merged 3 commits intoNVIDIA:mainfrom
sacpis:fix_state_vector
Feb 17, 2026
Merged

Fix dynamics backend to accept density-matrix initial state#3967
sacpis merged 3 commits intoNVIDIA:mainfrom
sacpis:fix_state_vector

Conversation

@sacpis
Copy link
Collaborator

@sacpis sacpis commented Feb 16, 2026

The dynamics backend did not override createFromData. For cudaq.state.from_data(rho) with a 2D density matrix rho the Python layer correctly builds a complex_matrix in a state_data variant. When the dynamics simulator created the initial state, it used the base SimulationState::createFromData(), which only supports 1D state-vector data. It calls getSizeAndPtr(), which does not handle the complex_matrix variant.

Fixes #3966.

@sacpis sacpis requested a review from 1tnguyen February 16, 2026 22:06
@github-actions
Copy link

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

…FromData

Signed-off-by: Sachin Pisal <spisal@nvidia.com>
…d-trip

Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Signed-off-by: Sachin Pisal <spisal@nvidia.com>
Copy link
Collaborator

@1tnguyen 1tnguyen 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 @sacpis

@github-actions
Copy link

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

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.

Unsupported data type for state vector

3 participants