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

Unflatten: restore orbital structure into elements #112

Merged
merged 2 commits into from
Oct 12, 2020
Merged

Conversation

pablosanjose
Copy link
Owner

@pablosanjose pablosanjose commented Oct 12, 2020

This introduces an unexported unflatten(vec, h) that turns a flattened vector (e.g. eigenstate produced by using a flatten blochtype) to another vec´ of length(vec´) = size(h,1) and eltype(vec´) = orbitaltype(h). That is, unflatten restores the eigenstate that would have been obtained without flattening the Hamiltonian.

This is required to make progress in generalizing #111 to multiorbital Hamiltonians.

@codecov-io
Copy link

codecov-io commented Oct 12, 2020

Codecov Report

Merging #112 into master will increase coverage by 0.51%.
The diff coverage is 90.90%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #112      +/-   ##
==========================================
+ Coverage   60.89%   61.40%   +0.51%     
==========================================
  Files          16       16              
  Lines        2736     2744       +8     
==========================================
+ Hits         1666     1685      +19     
+ Misses       1070     1059      -11     
Impacted Files Coverage Δ
src/plot_vegalite.jl 0.00% <0.00%> (ø)
src/hamiltonian.jl 75.56% <94.11%> (+0.48%) ⬆️
src/tools.jl 56.48% <100.00%> (+0.55%) ⬆️
src/bandstructure.jl 88.39% <0.00%> (+0.55%) ⬆️

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 30aa7a9...1c478e8. Read the comment docs.

@pablosanjose
Copy link
Owner Author

Also maybe_unflatten that makes no unaliasing guarantees. It will call unflatten (and hence allocate a new array) only if one cannot avoid copying. For uniform number of orbitals it is possible to call reinterpret instead. Also, if unflatten is a no-op, maybe_unflatten will simply return the same input array.

@pablosanjose pablosanjose changed the title Unflatten Unflatten vectors to restore orbital structure into elements Oct 12, 2020
@pablosanjose pablosanjose changed the title Unflatten vectors to restore orbital structure into elements Unflatten: restore orbital structure into elements Oct 12, 2020
@pablosanjose pablosanjose merged commit a5a6887 into master Oct 12, 2020
@pablosanjose pablosanjose deleted the orbitalvecs branch October 14, 2020 09:31
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