Skip to content

Feature/singlet [unitaryHACK]#67

Merged
vprusso merged 9 commits intovprusso:masterfrom
victor-onofre:feature/singlet
May 28, 2021
Merged

Feature/singlet [unitaryHACK]#67
vprusso merged 9 commits intovprusso:masterfrom
victor-onofre:feature/singlet

Conversation

@victor-onofre
Copy link
Copy Markdown
Contributor

Description

The function yields the generalized singlet state acting on two n-dimensional systems. This state is defined as:

(1/n^2-n) * (eye(n^2) - swap_operator([n, n])

Todos

  • Compute the generalized singlet state
  • I added the tests for the function in tests/test_states/test_singlet.py
  • Added from toqito.states.singlet import singlet to toqito/states/__init__.py
  • Added the function to the docs

Questions

Status

  • Ready to go

@victor-onofre victor-onofre changed the title Feature/singlet Feature/singlet [unitaryHACK] May 27, 2021
@codecov
Copy link
Copy Markdown

codecov bot commented May 27, 2021

Codecov Report

Merging #67 (2659021) into master (d098176) will increase coverage by 0.0%.
The diff coverage is 100.0%.

Impacted file tree graph

@@          Coverage Diff           @@
##           master     #67   +/-   ##
======================================
  Coverage    98.7%   98.7%           
======================================
  Files         118     119    +1     
  Lines        2346    2350    +4     
  Branches      564     564           
======================================
+ Hits         2317    2321    +4     
  Misses         12      12           
  Partials       17      17           
Impacted Files Coverage Δ
toqito/states/singlet.py 100.0% <100.0%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update d098176...2659021. Read the comment docs.

Comment thread toqito/states/singlet.py Outdated
"N-particleN-level Singlet States: Some Properties and Applications."
Phys. Rev. Lett., 89, (2002): 100402.

:param dim: The dimension of the generalized Singlet state.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Make sure you specify the return type as well in the comments. Something like:

:return: The singlet state of dimension `dim`. 

Comment thread toqito/states/singlet.py Outdated
"N-particleN-level Singlet States: Some Properties and Applications."
Phys. Rev. Lett., 89, (2002): 100402.

:param dim: The dimension of the generalized Singlet state.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I don't believe "singlet" is a proper noun, so I would leave that lower-case for now.

Comment thread toqito/states/singlet.py Outdated
@@ -0,0 +1,73 @@
"""Generalized Singlet state."""
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I think "singlet" should not be considered a proper noun.

Comment thread toqito/states/singlet.py Outdated

def singlet(dim: int) -> np.ndarray:
r"""
Produce a generalized Singlet state acting on two n-dimensional systems [Gsinglet]_.
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

Same comment as above "Singlet" -> "singlet".

Comment thread toqito/states/singlet.py
[ 0. , 0. , 0. , 0. ]]

It is possible for us to consider higher dimensional Singlet states. For instance, we
can consider the :math:`3`-dimensional Singlet state as follows:
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

"Singlet" -> "singlet"

Comment thread toqito/states/singlet.py Outdated
References
==========
.. [Gsinglet] Adan Cabello.
"N-particleN-level Singlet States: Some Properties and Applications."
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

For the reference, I believe the "," should be outside the ending double quote.

Comment thread toqito/states/singlet.py Outdated

:param dim: The dimension of the generalized Singlet state.
"""
return (iden(dim**2) - swap_operator([dim, dim]))/((dim**2)-dim)
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I believe you can save yourself the import of the iden method and simply use np.identity(dim**2) instead.

@vprusso vprusso merged commit 5475770 into vprusso:master May 28, 2021
@vprusso vprusso mentioned this pull request May 29, 2021
@victor-onofre victor-onofre deleted the feature/singlet branch May 30, 2021 17:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants