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

Rename cellsites to sites and polish indexing API #277

Merged
merged 9 commits into from
Apr 24, 2024
Merged

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Apr 23, 2024

In the current unreleased master we may index x::Lattices and x::GreenSolutions using s = cellsites(cell, inds), like x[s] or x[s,s´], where x[s] === x[s,s].

This PR does three things:

  • Renames cellsites to the simpler sites, which is already exported, and now takes on an additional new role. We intend this to be the stable API starting with Quantica v1.1.
  • Allows one to use sites(inds) without cell, which defaults to a 0D cell::SVector{0,Int}. When indexing, we check if the cell is 0D, and in such case we sanitize it to be the zero cell of the appropriate lattice dimension. Hence cell-less indexing likelat[sites(inds)] behaves as zero-cell indexing lat[sites(Quantica.zerocell(lat), inds)].
  • Implements indexing of h::AbstractHamiltonian, h[sites(...)] and h[sites(...), sites(...)]. This returns always a flat block, much like for GreenSolutions, but sparse.

@codecov-commenter
Copy link

codecov-commenter commented Apr 23, 2024

Codecov Report

Attention: Patch coverage is 96.07843% with 2 lines in your changes are missing coverage. Please review.

Project coverage is 92.52%. Comparing base (898a521) to head (89e40a6).
Report is 8 commits behind head on master.

Files Patch % Lines
src/sanitizers.jl 85.71% 1 Missing ⚠️
src/slices.jl 66.66% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #277   +/-   ##
=======================================
  Coverage   92.52%   92.52%           
=======================================
  Files          37       37           
  Lines        6101     6129   +28     
=======================================
+ Hits         5645     5671   +26     
- Misses        456      458    +2     

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

@pablosanjose
Copy link
Owner Author

Note: we are still missing indexing of AbstractHamiltonians with generic siteselectors. Since that is orthogonal to this PR, it should probably be done separately.

@pablosanjose pablosanjose merged commit b385817 into master Apr 24, 2024
9 checks passed
@pablosanjose pablosanjose deleted the sites branch April 24, 2024 16:01
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