Skip to content

Modify Fock backend, supporting MCMC measurement#21

Merged
sansiro77 merged 9 commits intoTuringQ:mainfrom
Jooyuza:feature_mcmc
Jul 31, 2024
Merged

Modify Fock backend, supporting MCMC measurement#21
sansiro77 merged 9 commits intoTuringQ:mainfrom
Jooyuza:feature_mcmc

Conversation

@Jooyuza
Copy link
Copy Markdown
Collaborator

@Jooyuza Jooyuza commented Jul 24, 2024

Fock backend modified and new feature added:

Parameter is_prob of forward ,forward_fockhas been changed to:
is_prob (None or bool, optional): Choices of return type. Set None to return entire unitary matrix,
Set True to return probabilities for Fock basis states;
Set False to return amplitude dictionary of final state.
Default: None
Returns:
Union[torch.Tensor, Dict]:
Tensor of unitary matrix(is_prob = None), Dictionary of final state(is_prob = False),
or Dictionary of probabilty distribution(is_prob = True),
of the photonic quantum circuit after applying the operators.

Fock backend now supports:

  1. mcmc sampling;
  2. batch-friendly features: when QumodeCircuit is encoded with batched data, forward function will have a batched return and measure function will generate batched outcome.

Brief notebook demo:"\docs\test_fockbackend_is_prob.ipynb"

@sansiro77 sansiro77 self-requested a review July 24, 2024 07:49
@sansiro77 sansiro77 self-assigned this Jul 24, 2024
@sansiro77 sansiro77 added the enhancement New feature or request label Jul 24, 2024
Copy link
Copy Markdown
Contributor

@sansiro77 sansiro77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fock后端的measure根据forward输出是unitary、dict、tensor,分成三个

Copy link
Copy Markdown
Contributor

@sansiro77 sansiro77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

我对docstring和代码做了些调整,可以再检查一下,再尝试支持处理带batch的初态,然后测试的ipynb别忘了删

Comment thread src/deepquantum/photonic/circuit.py Outdated
Comment thread src/deepquantum/photonic/circuit.py Outdated
Comment thread src/deepquantum/photonic/circuit.py Outdated
Copy link
Copy Markdown
Contributor

@sansiro77 sansiro77 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good job

@sansiro77 sansiro77 changed the title Fock backend modifed & feature mcmc added Modify Fock backend, supporting MCMC measurement Jul 31, 2024
@sansiro77 sansiro77 merged commit af5011f into TuringQ:main Jul 31, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants