diff --git a/calculations/PMM.jl b/calculations/PMM.jl index fefef77..eee0769 100644 --- a/calculations/PMM.jl +++ b/calculations/PMM.jl @@ -16,9 +16,9 @@ N = 9 # initialize random Hamiltonians H0 = randn(ComplexF64, N, N) -#H0 = H0 + H0' # symmetric +H0 = H0 + transpose(H0) # symmetric H1 = randn(ComplexF64, N, N) -#H1 = H1 + H1' # symmetric +H1 = H1 + transpose(H1) # symmetric # training Es = ComplexF64[] @@ -46,9 +46,9 @@ for epoch in 1:epochs function grad(c_order=0) out = zeros(ComplexF64, N, N) for (c, E_target, ψ, E) in zip(data_c, data_E, ψs, Es) - out .+= (c^c_order * (E - E_target)) .* (ψ * ψ') + out .+= (c^c_order * conj(E - E_target)) .* (ψ * transpose(ψ)) end - return out + return 2 .* real.(out) end H0 .-= lr .* grad(0) # update H0 H1 .-= lr .* grad(1) # update H1