Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Constructing general spin-j operators #158

Merged
merged 3 commits into from
Jun 5, 2024
Merged

Conversation

ytdHuang
Copy link
Member

@ytdHuang ytdHuang commented Jun 4, 2024

This is a PR for constructing general Spin-j operators (same function names within Python qutip), where j is the spin quantum numbers that can only be non-negative integer or half-integer.

Summary of this PR:

  • introduce jmat
  • introduce spin_Jx
  • introduce spin_Jy
  • introduce spin_Jz
  • introduce spin_Jm
  • introduce spin_Jp
  • introduce spin_J_set
  • change the definition of the following Pauli operators by using jmat:
    • sigmap() = jmat(0.5, :+)
    • sigmam() = jmat(0.5, :-)
    • sigmax() = 2 * jmat(0.5, :x)
    • sigmay() = 2 * jmat(0.5, :y)
    • sigmaz() = 2 * jmat(0.5, :z)

Copy link

codecov bot commented Jun 4, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.72%. Comparing base (219c907) to head (f4d3c83).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #158      +/-   ##
==========================================
+ Coverage   92.52%   92.72%   +0.19%     
==========================================
  Files          26       26              
  Lines        1847     1884      +37     
==========================================
+ Hits         1709     1747      +38     
+ Misses        138      137       -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ytdHuang ytdHuang changed the title Constructing general Spin-j operators Constructing general spin-j operators Jun 4, 2024
"""
sigmap() = destroy(2)
sigmap() = jmat(0.5, Val(:+))
Copy link
Member

Choose a reason for hiding this comment

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

Is it more efficient that the previous definition?

Copy link
Member Author

@ytdHuang ytdHuang Jun 5, 2024

Choose a reason for hiding this comment

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

I think for sigmap and sigmam, are not so different compared to the original methods.

However, I do think sigmax, sigmay, and sigmaz would be slightly efficient.

Also, I personally think it is a bit weird to see sigmap() = destroy(2) lol.

@ytdHuang ytdHuang merged commit 62e5727 into qutip:main Jun 5, 2024
13 of 14 checks passed
@ytdHuang ytdHuang deleted the dev/spin-j branch June 5, 2024 08:04
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.

None yet

2 participants