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

Fix and generalize wrap #81

Merged
merged 1 commit into from
Sep 3, 2020
Merged

Fix and generalize wrap #81

merged 1 commit into from
Sep 3, 2020

Conversation

pablosanjose
Copy link
Owner

The wrap function was seriously bugged. In particular doing wrap(h) would end up modifying h. Not good :-D

This PR fixes wrap, and generalizes it to be able to wrap along several axes simultaneously. So, a 3D Hamiltonian h can be wrapped along directions 1 and 3, with corresponding phase factors phases = (ϕ₁, ϕ₃), doing

wrap(h, (1,3); phases = (ϕ₁, ϕ₃))

@codecov-commenter
Copy link

codecov-commenter commented Sep 3, 2020

Codecov Report

Merging #81 into master will decrease coverage by 0.06%.
The diff coverage is 27.39%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #81      +/-   ##
==========================================
- Coverage   62.42%   62.35%   -0.07%     
==========================================
  Files          15       16       +1     
  Lines        2355     2614     +259     
==========================================
+ Hits         1470     1630     +160     
- Misses        885      984      +99     
Impacted Files Coverage Δ
src/KPM.jl 65.82% <ø> (+2.55%) ⬆️
src/Quantica.jl 100.00% <ø> (ø)
src/diagonalizer.jl 53.84% <ø> (+1.09%) ⬆️
src/greens.jl 0.00% <0.00%> (ø)
src/lattice.jl 67.39% <ø> (+2.35%) ⬆️
src/tools.jl 67.87% <35.00%> (+4.47%) ⬆️
src/mesh.jl 93.63% <50.00%> (-0.29%) ⬇️
src/bandstructure.jl 90.84% <70.58%> (-1.47%) ⬇️
src/hamiltonian.jl 75.21% <79.16%> (+6.86%) ⬆️
src/model.jl 72.00% <84.00%> (+0.27%) ⬆️
... and 12 more

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 da23f39...9110e15. Read the comment docs.

@pablosanjose
Copy link
Owner Author

The PR uses in-place sparse broadcast of the form s .+= factor .* s´ for sparse s, s´. This is currently suboptimal. The ideal way, I believe, would be to use the sparse-specific function map!, but that is currently broken when aliasing source and target, see issue https://github.com/JuliaLang/julia/issues/37375

@pablosanjose pablosanjose merged commit 9d221e2 into master Sep 3, 2020
@pablosanjose pablosanjose deleted the wrap branch September 4, 2020 12:58
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