Skip to content

Normalize in multiline galerkin#78

Merged
lkdvos merged 2 commits intoQuantumKitHub:masterfrom
leburgel:relative_galerkin
Oct 10, 2023
Merged

Normalize in multiline galerkin#78
lkdvos merged 2 commits intoQuantumKitHub:masterfrom
leburgel:relative_galerkin

Conversation

@leburgel
Copy link
Member

@leburgel leburgel commented Oct 9, 2023

Normalizes the AC´ tensor after application of the effective Hamiltonian before using it to compute the galerkin. This seems more fair for stat mech problems with very large leading boundary eigenvalues, the current implementation was giving me quite a bit of trouble.

@codecov
Copy link

codecov bot commented Oct 9, 2023

Codecov Report

Merging #78 (7a4d346) into master (a00ea68) will increase coverage by 0.03%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##           master      #78      +/-   ##
==========================================
+ Coverage   84.29%   84.33%   +0.03%     
==========================================
  Files          60       60              
  Lines        3726     3734       +8     
==========================================
+ Hits         3141     3149       +8     
  Misses        585      585              
Files Coverage Δ
src/algorithms/toolbox.jl 94.15% <100.00%> (+0.32%) ⬆️

@lkdvos
Copy link
Member

lkdvos commented Oct 9, 2023

We should probably do the same for the other cases, while less likely, it is still possible to have a pathological Hamiltonian with energy close to zero, or very large energies.

Small note, in principle the left nullspace of AC is given by (1 - AL AL*) which is slightly faster. (See above). It might be a good idea to get all of these cases to be the same

@Jutho
Copy link
Member

Jutho commented Oct 9, 2023

Doesn't normalize!(AC´) work instead of AC´/norm(AC´)? The latter gives one extra allocation. The former should work (and amount to scale!(AC´,1/norm(AC´))). If it doesn't, that's a bug.

@lkdvos lkdvos merged commit cc13ec1 into QuantumKitHub:master Oct 10, 2023
@leburgel leburgel deleted the relative_galerkin branch October 10, 2023 08:37
out -= state.AL[loc] * state.AL[loc]' * out
AC´ = ∂∂AC(loc, state, envs.opp, envs) * state.AC[loc]
normalize!(AC´)
out = add!(AC´, state.AL[loc] * state.AL[loc]' * AC´, -1)
Copy link
Member

Choose a reason for hiding this comment

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

One less allocation could have been obtained by writing
out = mul!(AC´, state.AL[loc], state.AL[loc]' * AC´, -1, +1)

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.

3 participants