def time_evolution_RF(tfinal, qtype='hybrid-SOSS'): from qubitsim.qubit import HybridQubit as hybrid if qtype == 'hybrid-SOSS': indices = [0, 1] match_freq = 10.0 operating_point = 3.5 qubit = hybrid.SOSSHybrid(operating_point, match_freq) H0 = qubit.hamiltonian_lab() ChoiSimulation = CJFidelities.CJ(indices, H0, np.zeros((3,3))) if tfinal == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final_RF(tfinal) else: indices = [0, 1] match_freq = 10.0 operating_point = 1.0 qubit = hybrid.HybridQubit(operating_point * match_freq, match_freq, 0.7 * match_freq, 0.7*match_freq) H0 = qubit.hamiltonian_lab() ChoiSimulation = CJFidelities.CJ(indices, H0, np.zeros((3,3))) if tfinal == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final_RF(tfinal)
def test_dimension_chi0(): H0 = np.identity(3) Hnoise = np.zeros((3, 3)) indices = [0, 1] cj_test = CJ.CJ(indices, H0, Hnoise) chi_test = cj_test.chi0 assert chi_test.shape == (9, 9)
def noise_sample(qubit, ded, time): """ Calculate the resulting process matrix at for the input qubit subjected to noise ded at time, time. Parameters ---------- qubit: HybridQubit object The qubit class to use for operational parameters ded: float the specific value of quasistatic noise Units: GHz time: float final time for this simulation Units: ns Returns ------- (9, 9) complex array """ indices = [0, 1] H0 = np.diag(qubit.energies()) noise = qubit.detuning_noise_qubit(ded) ChoiSimulation = CJ.CJ(indices, H0, noise) if time == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final(time)
def test_kernel_basic(): H0 = np.array([[0, 1], [1, 0]]) Hnoise = np.zeros((2, 2)) indices = [0, 1] cj_test = CJ.CJ(indices, H0, Hnoise) kernel_from_class = cj_test.kernel test_kernel = np.array([[0, 1, 0, 0], [1, 0, 0, 0], [0, 0, 0, 1], [0, 0, 1, 0]]) assert np.array_equal(kernel_from_class, test_kernel)
def noise_sample(qubit, tfinal, ded): H0 = np.diag(qubit.energies()) noise = qubit.detuning_noise_qubit(ded) indices = [0, 1] ChoiSimulation = cj.CJ(indices, H0, noise) if tfinal == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final_RF(tfinal)
def test_basic_evolution(): H0 = np.array([[0, 1], [1, 0]]) Hnoise = np.zeros((2, 2)) indices = [0, 1] tfinal = 0.5 * math.pi cj_test = CJ.CJ(indices, H0, Hnoise) chi_final_from_class = cj_test.chi_final(tfinal) actual_chi_final = 0.5 * np.array( [[0, 0, 0, 0], [0, 1, 1, 0], [0, 1, 1, 0], [0, 0, 0, 0]], dtype=complex) assert np.array_equal(chi_final_from_class, actual_chi_final)
def noise_sample(qubit, ded, time): indices = [0, 1] H0 = np.diag(qubit.energies()) noise = qubit.detuning_noise_qubit(ded) # noise = np.zeros((3,3)) ChoiSimulation = CJ.CJ(indices, H0, noise) if time == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final_RF(time)
def test_chi0_initiliazation(): H0 = np.identity(3) Hnoise = np.zeros((3, 3)) indices = [0, 1] test_matrix = np.zeros((9, 9), dtype=complex) test_matrix[0, 0] += 0.5 test_matrix[0, 4] += 0.5 test_matrix[4, 0] += 0.5 test_matrix[4, 4] += 0.5 cj_test = CJ.CJ(indices, H0, Hnoise) chi_test = cj_test.chi0 assert np.array_equal(test_matrix, chi_test)
def noise_sample_run(ded, tfinal): """Run a single noise sample at noise point ded (GHz) and at time tfinal""" operating_point = 3.0 match_freq = 10.0 indices = [0, 1] qubit = hybrid.SOSSHybrid(operating_point, match_freq) H0 = np.diag(qubit.energies()) noise = qubit.detuning_noise_qubit(ded) # noise = np.zeros((3,3)) ChoiSimulation = cj.CJ(indices, H0, noise) if tfinal == 0: return ChoiSimulation.chi0 else: return ChoiSimulation.chi_final_RF(tfinal)
def noise_testing(input_params): ed = input_params['ed'] stsplitting = input_params['stsplitting'] delta1 = input_params['delta1'] delta2 = input_params['delta2'] tstep = input_params['tstep'] noise_samples = input_params['noise_samples'] indices = [0, 1] qubit = hybrid.HybridQubit(ed, stsplitting, delta1, delta2) H0 = np.diag(qubit.energies()) cj_array = np.zeros((9, 9, noise_samples.shape[0]), dtype=complex) for i in range(noise_samples.shape[0]): ded = noise_samples[i] noise = qubit.detuning_noise_qubit(ded) ChoiSimulation = cj.CJ(indices, H0, noise) if tstep == 0: cj_array[:, :, i] = ChoiSimulation.chi0 else: cj_array[:, :, i] = ChoiSimulation.chi_final_RF(tstep) return cj_array
def test_fidelity_normalization(): actual_chi = np.array([[0, 0, 0, 1], [0, 0, 1, 0], [0, 1, 0, 0], [1, 0, 0, 0]]) assert CJ.fidelity(actual_chi, actual_chi) == 1.0