Skip to content

Access state vector from kernel #4214

@ej-psi

Description

@ej-psi

Required prerequisites

  • Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.

Describe the feature

For some operations, it's useful to access the state vector directly from the kernel.

For example, when the user has an 8-qubit register, and wants to peek at the probability of that register having the value 100.

In our tools, this is done via my_qreg.peek_read_probability(100)

We provide this feature, and it's working, but for CUDA-Q simulation back-end it's slow and sometimes causes RAM errors. Currently, the way we're accessing the state vector is via numpy.array(cudaq.get_state(kernel)), which (if we're simulating a 34-qubit QPU) makes a 256 GB numpy array in CPU RAM, and then inspecting it takes some time.

Is there already a way to inspect the state vector in-place? If it already exists, any guidance is appreciated.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions