NVIDIA / NVIDIA/cuda-quantum

[RFC] Python frontend for photonic simulator

Open
#1,937 6 comments 1 reaction 5 assignees View on GitHub

@bettinaheim is already working on this.

Since Jul 16, 2024.

enhancement python-lang RFC stale-notified
Dominant language
C++
Stars
1.1k
Forks
456
Avg merge
1d 22h
Merged PRs (30d)
165

Description

Required prerequisites
  • Search the issue tracker to check if your feature has already been mentioned or rejected in other issues.
Describe the feature
  • Add support to use the photonics simulator with photonics-cpu target from Python frontend of CUDA-Q

  • Proposed API

    • Gates (same as those supported on C++ frontend):

      1. plus(q: qudit) -> None,
      2. phase_shift(q: qudit, phi: float) -> None,
      3. beam_splitter(q: qudit, r: qudit, theta: float) -> None,
      4. mz(q: qudit) -> int and mz(q: list[qudit]) -> list[int]
    • Handler is inferred from the target

    • Custom handler must provide API for defining a qudit of level = N, for example, qudit(3)

    • APIs

      • Synchronous sampling: cudaq.sample(*args, **kwargs)
      • State retrieval: cudaq.get_state(*args, **kwargs)
  • Example

import cudaq

cudaq.set_target("photonics-cpu")


@cudaq.kernel
def photonicsKernel():    
    qutrits = [qudit(3) for i in range(2)]
    plus(qutrits[0])
    plus(qutrits[1])
    plus(qutrits[1])
    mz(qutrits)


counts = cudaq.sample(photonicsKernel)
print(counts)

state = cudaq.get_state(photonicsKernel)
print(state)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.