def test_positive_wavefunction_psi(): nn_state = PositiveWaveFunction(10, gpu=False) vis_state = torch.ones(10).to(dtype=torch.double) actual_psi = nn_state.psi(vis_state)[1].to(vis_state) expected_psi = torch.zeros(1).to(vis_state) msg = "PositiveWaveFunction is giving a non-zero imaginary part!" assert torch.equal(actual_psi, expected_psi), msg
) ] nn_state.fit( train_data, epochs=epochs, pos_batch_size=pbs, neg_batch_size=nbs, lr=lr, k=k, callbacks=callbacks, time=True, ) final_state_vector = np.array( nn_state.psi(space)[0] / nn_state.compute_normalization(space).sqrt_()) np.savetxt("phi_fourier_RBM.txt", final_state_vector, fmt='%1.5f') print("Estado cuántico final:", final_state_vector) plt.close() fig1 = plt.bar(np.arange(np.power(2, nv)), np.power(final_state_vector.real, 2)) plt.xlabel("Probabilities") plt.ylim(0, 0.01) plt.savefig("state_RBM.jpg") """ fidelities = callbacks[0].Fidelity KLs = callbacks[0]["KL"] coeffs = callbacks[0]["A_Ψrbm_"] epoch = np.arange(period, epochs + 1, period)