示例#1
0
def run_grape():
    save_file_path = generate_save_file_path(EXPERIMENT_NAME, SAVE_PATH)
    config = copy(GRAPE_CONFIG)
    config.update({
        "save_file_path": save_file_path
    })
    result = grape_schroedinger_discrete(**config)
示例#2
0
def run_grape():
    t_start = time.process_time()
    save_file_path = generate_save_file_path(EXPERIMENT_NAME, SAVE_PATH)
    config = copy(GRAPE_CONFIG)
    config.update({"save_file_path": save_file_path})
    result = grape_schroedinger_discrete(**config)

    tot_time = time.process_time() - t_start
    print("Total time (%s iterations): %d s, time/ieration: %.2f s" %
          (ITERATION_COUNT, tot_time, tot_time / ITERATION_COUNT))
示例#3
0
      "".format(TRANSMON_ZERO))
print("TRANSMON_ONE:\n{}"
      "".format(TRANSMON_ONE))
print("INITIAL_STATE_0:\n{}"
      "".format(INITIAL_STATE_0))
print("TARGET_STATE_0:\n{}"
      "".format(TARGET_STATE_0))
print("CONTROL_EVAL_TIMES:\n{}"
      "".format(anp.linspace(0, EVOLUTION_TIME, CONTROL_EVAL_COUNT)))
print("SYSTEM_EVAL_TIMES:\n{}"
      "".format(anp.linspace(0, EVOLUTION_TIME, SYSTEM_EVAL_COUNT)))

# qoc saves data in h5 format. You can parse h5 files using the `h5py` package [5].
EXPERIMENT_NAME = "tutorial_schroed_cavity01"
SAVE_PATH = "./out"
SCHROED_FILE_PATH = generate_save_file_path(EXPERIMENT_NAME, SAVE_PATH)

# Next, we use the GRAPE algorithm to find a set of time-dependent
# controls that accomplishes the state transfer that we desire.
result = grape_schroedinger_discrete(CONTROL_COUNT,
                                     CONTROL_EVAL_COUNT,
                                     COSTS, EVOLUTION_TIME,
                                     hamiltonian, INITIAL_STATES,
                                     SYSTEM_EVAL_COUNT,
                                     complex_controls=COMPLEX_CONTROLS,
                                     iteration_count=ITERATION_COUNT,
                                     log_iteration_step=LOG_ITERATION_STEP,
                                     optimizer=OPTIMIZER,
                                     save_file_path=SCHROED_FILE_PATH,
                                     save_intermediate_states=SAVE_INTERMEDIATE_STATES,
                                     save_iteration_step=SAVE_ITERATION_STEP,)
示例#4
0
# Define the optimization.
COMPLEX_CONTROLS = True
MAX_CONTROL_NORMS = anp.array((5, ))
CONTROL_COUNT = 1
EVOLUTION_TIME = 10  # nanoseconds
CONTROL_EVAL_COUNT = 11
SYSTEM_EVAL_COUNT = 2
ITERATION_COUNT = int(1e6)
OPTIMIZER = LBFGSB()

# Define output.
LOG_ITERATION_STEP = 1
SAVE_ITERATION_STEP = 1
SAVE_PATH = "./out"
SAVE_FILE_NAME = "transmon_pi_decoherence"
SAVE_FILE_PATH = generate_save_file_path(SAVE_FILE_NAME, SAVE_PATH)


def main():
    result = grape_lindblad_discrete(
        CONTROL_COUNT,
        CONTROL_EVAL_COUNT,
        COSTS,
        EVOLUTION_TIME,
        INITIAL_DENSITIES,
        SYSTEM_EVAL_COUNT,
        complex_controls=COMPLEX_CONTROLS,
        hamiltonian=hamiltonian,
        iteration_count=ITERATION_COUNT,
        lindblad_data=lindblad_data,
        log_iteration_step=LOG_ITERATION_STEP,