Skip to content

Commit 5f9851f

Browse files
committedJul 7, 2023
add some comment in vte example
1 parent dd8451b commit 5f9851f

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed
 

‎examples/variational_dynamics.py

+6
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@ def lhs_matrix(theta, psi0):
4646
vij = tc.backend.vmap(ij, vectorized_argnums=0)
4747
vvij = tc.backend.vmap(vij, vectorized_argnums=1)
4848
jacobian = ppsioverptheta(theta, psi0=psi0)
49+
# fim = tc.backend.adjoint(jacobian)@jacobian is also ok
50+
# speed comparison?
4951
jacobian = tc.backend.transpose(jacobian)
5052
fim = vvij(jacobian, jacobian)
5153
fim = tc.backend.real(fim)
@@ -62,12 +64,16 @@ def energy(theta, psi0):
6264
wl = tc.backend.reshape(wl, [1, -1])
6365
wr = tc.backend.reshape(wr, [-1, 1])
6466
e = wl @ h @ wr
67+
# use sparse matrix if required
6568
return tc.backend.real(e)[0, 0]
6669

6770
eg = tc.backend.grad(energy, argnums=0)
6871
rhs = eg(theta, psi0)
6972
rhs = tc.backend.imag(rhs)
7073
return rhs
74+
# for ITE, imag is replace with real
75+
# a simpler way to get rhs in ITE case is to directly evaluate
76+
# 0.5*\nabla <H>
7177

7278

7379
@tc.backend.jit

0 commit comments

Comments
 (0)
Please sign in to comment.