NVIDIA/cuda-quantum

Support complex numbers and lists of complex numbers defined inside, passed as parameters, or captured by kernel

annagrin opened this issue · 1 comments

Required prerequisites

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

Describe the feature

Make sure we can use complex numbers inside kernel function definitions, for example:

  c = [.70710678 + 0j, 0., 0., 0.70710678]
  
  # Pass a list of complex numbers as a parameter
  @cudaq.kernel
  def test_complex_vec_param(vec : list[complex]):
      c1 = vec

  counts = cudaq.sample(test_complex_vec_param, c)
  # Capture a list of complex numbers
  @cudaq.kernel
  def test_complex_vec_capture():
      c1 = c

   counts = cudaq.sample(test_complex_vec_capture)
  # Define a list of complex numbers inside a kernel
  @cudaq.kernel
  def test_complex_vec_definition():
      c1 = [1.0 + 0j, 0., 0., 1.]

  counts = cudaq.sample(test_complex_vec_definition)

Closed by #1550