Skip to content

Argument assignment in execution fucntion throws an error #2796

Closed
@zohimchandani

Description

@zohimchandani

Required prerequisites

  • Consult the security policy. If reporting a security vulnerability, do not report the bug using this form. Use the process described in the policy to report the issue.
  • Make sure you've read the documentation. Your issue may be addressed there.
  • Search the issue tracker to verify that this hasn't already been reported. +1 or comment there if it has.
  • If possible, make a PR with a failing test to give us a starting point to work on!

Describe the bug

import cudaq

@cudaq.kernel
def bit_flip(which_m: int):
    
    qubits = cudaq.qvector(1)
            
    #create psi
    u3(1,2,3, qubits[0])
    
    if which_m == 1:
        mz(qubits[0])
 
#this works since argument is defined outside of sample and passed in         
which_m = 1
counts = cudaq.sample(bit_flip, which_m, shots_count = 1)

#this throws an error when argument is defined  within sample 
counts = cudaq.sample(bit_flip, which_m=1, shots_count = 1)

Steps to reproduce the bug

NA

Expected behavior

NA

Is this a regression? If it is, put the last known working version (or commit) here.

Not a regression

Environment

  • CUDA-Q version:
  • Python version:
  • C++ compiler:
  • Operating system:

Suggestions

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions