示例#1
0
        mps_of_last_layer = [A.copy() for A in mps_of_layer[current_depth]]
    except Exception as e:
        print(e)

    stop_crit = 1e-1
    assert np.isclose(mps_func.overlap(target_mps, target_mps), 1.)
    for idx in range(running_idx, N_iter):
        #################################
        #### variational optimzation ####
        #################################

        try:
            mps_of_last_layer, my_circuit = qTEBD.var_circuit(
                target_mps, mps_of_last_layer, my_circuit, product_state)
        except:
            mps_of_last_layer, my_circuit = qTEBD.var_circuit2(
                target_mps, product_state, my_circuit)
        #################
        #### Measure ####
        #################
        assert np.isclose(
            mps_func.overlap(mps_of_last_layer, mps_of_last_layer), 1.)
        current_energy = np.sum(
            mps_func.expectation_values(mps_of_last_layer, H_list))
        E_list.append(current_energy)
        Sz_array[idx, :] = mps_func.expectation_values_1_site(
            mps_of_last_layer, Sz_list)
        ent_array[idx, :] = mps_func.get_entanglement(mps_of_last_layer)
        fidelity_reached = np.abs(
            mps_func.overlap(target_mps, mps_of_last_layer))**2

        print("iter=", idx, " E=", E_list[-1], " Sz=", Sz_array[idx, L // 2])
示例#2
0
    assert np.isclose(mps_func.overlap(target_mps, target_mps), 1.)
    for idx in range(running_idx, N_iter):
        #################################
        #### variational optimzation ####
        #################################

        try:
            mps_of_last_layer, my_circuit = qTEBD.var_circuit(
                target_mps,
                mps_of_last_layer,
                my_circuit,
                product_state,
                brickwall=True)
        except:
            mps_of_last_layer, my_circuit = qTEBD.var_circuit2(target_mps,
                                                               product_state,
                                                               my_circuit,
                                                               brickwall=True)
        #################
        #### Measure ####
        #################
        assert np.isclose(
            mps_func.overlap(mps_of_last_layer, mps_of_last_layer), 1.)
        current_energy = np.sum(
            mps_func.expectation_values(mps_of_last_layer, H_list))
        E_list.append(current_energy)
        Sz_array[idx, :] = mps_func.expectation_values_1_site(
            mps_of_last_layer, Sz_list)
        ent_array[idx, :] = mps_func.get_entanglement(mps_of_last_layer)
        fidelity_reached = np.abs(
            mps_func.overlap(target_mps, mps_of_last_layer))**2